Reputation: 106
When using Highcharts heapmap module, there is an issue with exporting the chart following a colorAxis
update.
I create a chart using
var chart = new Highcharts.Chart({
...
colorAxis: {
min: 0,
max: 100,
minColor: '#FFFFFF',
maxColor: Highcharts.getOptions().colors[0]
},
...
})
Following an update
on the colorAxis
, where max
is altered, an export of the chart shows the original scale.
Is there something I should be doing differently?
Upvotes: 0
Views: 262
Reputation: 106
Figured out the issue. Looks like this is an issue with how Highcharts handles the update of the colorAxis. It doesn't set the chart.options.colorAxis
values correctly.
In the update call, the following line (line 15467 in highcharts.src.js) is supposed to update the correct chart.options
value.
newOptions = chart.options[this.coll][this.options.index] = merge(this.userOptions, newOptions);
However, chart.options.colorAxis
is not an array and doesn't have this.options.index
. Thus, this line doesn't work as intended. This can be fixed if you slightly modify to check if the index exists and update either the object or the indexed object as necessary.
newOptions = this.options.index ? chart.options[this.coll][this.options.index] : chart.options[this.coll] = merge(this.userOptions, newOptions);
Upvotes: 0
Reputation: 37588
Call your action in the chart callback, and wrap exporting into setTimeout(), then will work.
chart.colorAxis[0].update({
max: 200
}, true);
setTimeout(function () {
chart.exportChart();
}, 1);
Example: http://jsfiddle.net/rje8y2sw/6/
Upvotes: 1