[英]Highcharts Export after updating colorAxis
When using Highcharts heapmap module, there is an issue with exporting the chart following a colorAxis
update. 使用Highcharts堆图模块时,在colorAxis
更新后导出图表存在问题。
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. 在colorAxis
( max
已更改)上进行update
之后,图表的导出将显示原始比例。
Is there something I should be doing differently? 我应该做些不同的事情吗?
Call your action in the chart callback, and wrap exporting into setTimeout(), then will work. 在图表回调中调用您的操作,然后将导出包装到setTimeout()中,然后将起作用。
chart.colorAxis[0].update({
max: 200
}, true);
setTimeout(function () {
chart.exportChart();
}, 1);
Example: http://jsfiddle.net/rje8y2sw/6/ 示例: http : //jsfiddle.net/rje8y2sw/6/
Figured out the issue. 找出问题。 Looks like this is an issue with how Highcharts handles the update of the colorAxis. 看起来这是Highcharts如何处理colorAxis更新的问题。 It doesn't set the chart.options.colorAxis
values correctly. 它没有正确设置chart.options.colorAxis
值。
In the update call, the following line (line 15467 in highcharts.src.js) is supposed to update the correct chart.options
value. 在update调用中,以下行(highcharts.src.js中的15467行)应该更新正确的chart.options
值。
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
. 但是, chart.options.colorAxis
不是数组,并且没有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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.