kzoon
Posts: 281
Joined: Wed Aug 10, 2011 8:22 am

Map data without keys?

I want to supply (dummy) data to a map through a data array that only contains (dummy) values. This way I can easily show a preview of any map, without having to know the actual hc-keys in the map.
The documentation (https://api.highcharts.com/highmaps/series.map.data ) suggests that I can do such a thing:
An array of numerical values. In this case, the numerical values will be interpreted as value options. Example:
data: [0, 5, 3, 5]
However, for me it doesn't seem to work:

https://jsfiddle.net/kzoon/bep6jdfs/

Am I doing something wrong?
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Map data without keys?

Hello kzoon!

We appreciate you reaching out to us!

I'm not sure if I understood you correctly. Do you want these numerical values to be automatically assigned to hc-keys that are in the chart?

Best regards!
Dominik Chudy
Highcharts Developer
kzoon
Posts: 281
Joined: Wed Aug 10, 2011 8:22 am

Re: Map data without keys?

Yes. Since it is dummy data, that suffices for me.

I assumed this would happen because the documentation for map series:
series.map.data
An array of data points for the series. For the map series type, points can be given in the following ways:

An array of numerical values. In this case, the numerical values will be interpreted as value options. Example:

data: [0, 5, 3, 5]
An array of arrays with 2 values. In this case, the values correspond to [hc-key, value]. Example:

data: [
['us-ny', 0],
['us-mi', 5],
['us-tx', 3],
['us-ak', 5]
]
An array of objects with named values. The following snippet shows only a few settings, see the complete options set below. If the total number of data points exceeds the series' turboThreshold, this option is not available.

data: [{
value: 6,
name: "Point2",
color: "#00FF00"
}, {
value: 6,
name: "Point1",
color: "#FF00FF"
}]
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Map data without keys?

Hi again!

Sure, it works as it's written in the API but first, you need to set joinBy property to null.

API references:
https://api.highcharts.com/highmaps/series.map.joinBy

Demo:
https://jsfiddle.net/BlackLabel/qu8n0c1y/1/

Best regards!
Dominik Chudy
Highcharts Developer
kzoon
Posts: 281
Joined: Wed Aug 10, 2011 8:22 am

Re: Map data without keys?

Thanks!
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Map data without keys?

You're welcome!

In case of any further questions, feel free to contact us again.
Dominik Chudy
Highcharts Developer

Return to “Highcharts Maps”