KGB1st
Posts: 11
Joined: Sun Feb 20, 2022 4:06 am

Problem with map format understanding

I tried to use highcharts maps by this example:
https://jsfiddle.net/gh/get/library/pur ... mo/geojson
But my geojson consist shape data only. I tried to add custom attributes data to the my geojson data with additional JS method after AJAX request will be loading. And there I've a problem. Can't understand how it must works.
request_by_data.png
request_by_data.png (29.92 KiB) Viewed 771 times
In my model I've `armed_data` section, where `armed` it's an integer and subsystems it's an array which contains 2D array (string as subsystem name and its counter).
request_by_struct.png
request_by_struct.png (8.45 KiB) Viewed 771 times
Not sure that I fully understanding how I can correctly use .setData() or series.data with this data structure
magdalena
Posts: 517
Joined: Tue Aug 24, 2021 1:32 pm

Re: Problem with map format understanding

Hi,

Welcome to our forum and thanks for contacting us with your question!

First of all, a map chart has two types of data:
- geojson (or typojson) - the shape of map and all information about projection, etc. (this is what we add into chart.map or series.mapData)
- normal data, that we supply the chart with, like concrete regions and values which we want to show (this is what we add to series.data)

If I understand correctly, you would like to combine your geojson with series.data. You can do this by various keys (hc-key, iso-a2, name, etc.) and series.joinBy.

So, if you have 'DE.SH' in your data, and want to combine it with geojson, you need to use series.joinBy: 'code_hasc' and additionally series.keys: ['code_hasc', 'value'], because Highcharts needs to recognize that in your 2D array, the first element is code_hasc and the second one is value.

You will find more information in our Docs and API Reference:
https://api.highcharts.com/highmaps/series.map.joinBy
https://www.highcharts.com/docs/maps/map-collection

Let me know if that was what you were looking for,
Regards!
Magdalena Gut
Developer and Highcharts Support Engineer
KGB1st
Posts: 11
Joined: Sun Feb 20, 2022 4:06 am

Re: Problem with map format understanding

Yes, it's helpful. I didn't guessed immediately with feature which called as "extended data array with keys". That is the first my mistake. Second, that I didn't fully understand the data map model which is explained in https://api.highcharts.com/highmaps/series.map.data
magdalena
Posts: 517
Joined: Tue Aug 24, 2021 1:32 pm

Re: Problem with map format understanding

That's great to hear!

In case of any further questions, feel free to contact us again,
Regards!
Magdalena Gut
Developer and Highcharts Support Engineer

Return to “Highcharts Maps”