Permalink
Browse files

Fixed #6895, zoomed heat map wastn't clipped properly in boost mode.

  • Loading branch information...
TorsteinHonsi committed Nov 3, 2017
1 parent 6aa6fe5 commit 5d27939d22548592859bb00a79d2054aa284d5ae
@@ -125,12 +125,7 @@ H.initCanvasBoost = function () {
}
};
target.boostClipRect = chart.renderer.clipRect(
chart.plotLeft,
chart.plotTop,
chart.plotWidth,
chart.chartHeight
);
target.boostClipRect = chart.renderer.clipRect();
target.renderTarget.clip(target.boostClipRect);
@@ -155,12 +150,7 @@ H.initCanvasBoost = function () {
href: ''
});
target.boostClipRect.attr({
x: chart.plotLeft,
y: chart.plotTop,
width: chart.plotWidth,
height: chart.chartHeight
});
target.boostClipRect.attr(chart.getBoostClipRect(target));
return ctx;
},
View
@@ -538,6 +538,32 @@ Chart.prototype.isChartSeriesBoosting = function () {
shouldForceChartSeriesBoosting(this);
};
/*
* Get the clip rectangle for a target, either a series or the chart. For the
* chart, we need to consider the maximum extent of its Y axes, in case of
* Highstock panes and navigator.
*/
Chart.prototype.getBoostClipRect = function (target) {
var clipBox = {
x: this.plotLeft,
y: this.plotTop,
width: this.plotWidth,
height: this.plotHeight
};
if (target === this) {
each(this.yAxis, function (yAxis) {
clipBox.y = Math.min(yAxis.pos, clipBox.y);
clipBox.height = Math.max(
yAxis.pos - this.plotTop + yAxis.len,
clipBox.height
);
}, this);
}
return clipBox;
};
/*
* Returns true if the series is in boost mode
* @param series {Highchart.Series} - the series to check
@@ -2382,12 +2408,7 @@ function createAndAttachRenderer(chart, series) {
}
};
target.boostClipRect = chart.renderer.clipRect(
chart.plotLeft,
chart.plotTop,
chart.plotWidth,
chart.chartHeight
);
target.boostClipRect = chart.renderer.clipRect();
(target.renderTargetFo || target.renderTarget).clip(target.boostClipRect);
@@ -2401,12 +2422,7 @@ function createAndAttachRenderer(chart, series) {
target.canvas.width = width;
target.canvas.height = height;
target.boostClipRect.attr({
x: chart.plotLeft,
y: chart.plotTop,
width: chart.plotWidth,
height: chart.chartHeight
});
target.boostClipRect.attr(chart.getBoostClipRect(target));
target.boostResizeTarget();
target.boostClear();
@@ -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,8 @@
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/boost.js"></script>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="container"></div>
@@ -0,0 +1,27 @@
(function () {
QUnit.test("#6895 - clipping rectangle after set extremes.", function (assert) {
var chart = Highcharts.chart('container', {
chart: {
type: 'column'
},
series: [{
boostThreshold: 1,
data: [
[0, 0],
[0, 1],
[0, 2],
[0, 3],
[0, 4]
]
}]
});
chart.yAxis[0].setExtremes(1, 2);
assert.strictEqual(
chart.series[0].boostClipRect.getBBox(true).height,
chart.plotHeight,
'Correct height of the clipping box.'
);
});
}());

0 comments on commit 5d27939

Please sign in to comment.