Permalink
Browse files

Fixed #3936, colorAxis was not update through chart.update.

  • Loading branch information...
KacperMadej committed Mar 10, 2017
1 parent acd30ac commit c6c16cc854a6132071848172ab4508482a8de5ae
@@ -284,7 +284,7 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
// an id will update the first and the second respectively (#6019)
// // docs: New behaviour for unidentified items, add it to docs for
// chart.update and responsive.
each(['xAxis', 'yAxis', 'series'], function (coll) {
each(['xAxis', 'yAxis', 'series', 'colorAxis'], function (coll) {
if (options[coll]) {
each(splat(options[coll]), function (newOptions, i) {
var item = (
@@ -0,0 +1,6 @@
---
resources:
- https://code.jquery.com/qunit/qunit-2.0.1.js
- https://code.jquery.com/qunit/qunit-2.0.1.css
js_wrap: b
...
@@ -0,0 +1,10 @@
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/heatmap.js"></script>
<script src="https://code.highcharts.com/modules/treemap.js"></script>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="container" style="width: 600px; margin: 0 auto"></div>
@@ -0,0 +1,73 @@
/* eslint func-style:0 */
var config = {
colorAxis: {
minColor: '#ff0',
maxColor: '#f0f',
labels: {
style: {
fontSize: '10px'
}
},
min: 0,
max: 10
},
series: [{
type: 'treemap',
data: [{
value: 6,
colorValue: 0
}, {
value: 6,
colorValue: 2
}, {
value: 4,
colorValue: 3
}, {
value: 3,
colorValue: 4
}, {
value: 2,
colorValue: 5
}, {
value: 2,
colorValue: 6
}, {
value: 1,
colorValue: 10
}]
}]
};
QUnit.test('Update colorAxis through chart.update (#3936)', function (assert) {
var chart = Highcharts.chart($('<div>').appendTo('#container')[0], Highcharts.merge(config));
// Update colorAxis
chart.update({
colorAxis: {
minColor: '#0f0',
maxColor: '#00f',
labels: {
style: {
fontSize: '15px'
}
}
}
});
assert.ok(
chart.series[0].points[0].color === "rgb(0,255,0)",
'colorAxis.minColor updated'
);
assert.ok(
chart.series[0].points[6].color === "rgb(0,0,255)",
'colorAxis.maxColor updated'
);
assert.ok(
$('.highcharts-coloraxis-labels text').css('font-size') === '15px',
'colorAxis.labels.style.fontSize updated'
);
});

0 comments on commit c6c16cc

Please sign in to comment.