Alan
Alan

Reputation: 139

Customize Highchart Map's legend type and color

I'm currently working with a Drilldown Map (with Europe instead of the USA).

I would like to change the legend's type : in the example, it's a fade from light green to dark green ; what I would like to have is something like : [0-5 : Green] ; [5-10 : Blue] ; [10-15 : Yellow] etc.

Is there any way to do something like that?

Thanks a lot!

Upvotes: 1

Views: 60

Answers (1)

João Menighin
João Menighin

Reputation: 3225

You can use dataClasses to achieve that:

colorAxis: {
    dataClasses: [
    {
        color: 'red',
        from: 0,
        to: 5,
        name: 'foo'
      },
      {
        color: 'blue',
        from: 5,
        to: 15,
        name: 'bar'
      },
      {
        color: 'yellow',
        from: 15,
        to: 60,
        name: 'xpto'
      },
    ]
}

Here's a fiddle: https://jsfiddle.net/ro91Lv2d/

To achieve something like the gradient you see on drill down you sent, you have to do it by yourself, like this example: https://jsfiddle.net/pzepywwy/

Upvotes: 1

Related Questions