简体   繁体   中英

Reverse highmaps legend values or color OR draw legend color from other attribute instead of value in series

here is my highmaps
http://jsfiddle.net/waqarakbar/8fypgxvc/
I need to reverse the values of the legend so that 30 go to top (red color) and 0 come to bottom (green color). Reversing either the values or the color gradient will solve my problem. I have tried

colorAxis: {
    reversed:false
}

but it reverse both, values and color (I need only one to be reversed). I have also tried

legend: {
    reversed: true
}

but it seems to be not working at all...

Another possible solution that will solve my problem is to draw the legend based on some other attribute instead of "value" attribute. Highmaps is using the value of "value" attribute to draw the color gradient of the legend, in my case, i would like to draw it on the basis of "rank" attribute that i assigned to districts.

Try to replace colors

   minColor: '#26c40d',
    maxColor: '#e51414',

Update 1

try with the option

         colorAxis: {
        min: 0,
        max: 26,
        step:2,
        minColor: '#e51414',
        maxColor: '#26c40d',
        align: 'top',
        reversed : false
    },

在此处输入图片说明

Here are some more options http://api.highcharts.com/highcharts#legend.reversed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM