1

I'm trying to fill colours in countries based on each country's data. Something similar to this map. Something similar to the function formatter in tooltip.

I've tried different approaches, including using zones (like it's described here, here and here) but couldn't do it.

import mapDataWorld from '@highcharts/map-collection/custom/world.geo.json';
import worldMapData from '../data/WorldMapData';

const options: Highcharts.Options = {
    series: [{
        type: 'map',
        mapData: mapDataWorld,
        data: worldMapData,
        // Zones don't seem to work for point value
        zones: [{
            value: 2,
            color: '#f7a35c'
        }]
    }],
    tooltip: {
        headerFormat: '',
        formatter: function () {
            const country = this.point;
            const info = `The value for ${country.name} is ${country.value}`
            return info;
        }
    }
}

1 Answer 1

3

You can use colorAxis

const options: Highcharts.Options = {
    colorAxis: {
            dataClasses: [{
              to: 10,
              color: "red"
            }, {
              from: 10,
              to: 20,
              color: "orange"
            }, {
              from: 20,
              to: 50,
              color: "yellow"
            }]
          }
      .
      .
      .

more about colorAxis

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you @Alex. Let me try it. I'll get back to you.
That does it. Thank you @Alex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.