Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Dataviewmappings with unrelated data

I'm trying to create a custom visual similar to the shape map visual, with a few modifications. One modification is that I'm trying to find a way to use table data (strings) as the source of the json...
  • dm-p's avatar
    7 years ago

    Hi Anonymous,

    If I understand correctly, your dataViewMapping could contain the JSON data as a dataRole that would be seemingly unrelated to other data but would map out the JSON to each row of your dataView.

    This can work but as you're presumably working with GeoJSON, I can't imagine these fields being particularly compact. As such having the GeoJSON in each row of your dataView is going to potentially blow up the resources your visual will need and you may not get particularly good performance. Not great if you want to use a lot of data points.

    This is a great example where multiple dataViewMappings would be really useful, and I'd love to see this restriction lifted at some point...

    I think that to minimise impact on visual performance and give you more flexibility with the dataView you can work with, it would probably be best to allow the GeoJSON to be provided as an object (property) of the visual, which unfortunately means that data-driving it might be tricky.

    Alternatively, you could use a URL for the GeoJSON as a dataRole? This wouldn't add much overhead in terms of data consumption and you could use TypeScript to load from a known location, only if there is a difference in the value between updates?

    Not sure if this answers your question, but might give you some jumping-off points.

    Good luck!

    Daniel