提交 ad2709b6 编写于 作者: P pissang

[heatmap] support incremental rendering.

上级 998f3696
...@@ -77,9 +77,12 @@ export default echarts.extendChartView({ ...@@ -77,9 +77,12 @@ export default echarts.extendChartView({
} }
this.group.removeAll(); this.group.removeAll();
this._incrementalDisplayable = null;
var coordSys = seriesModel.coordinateSystem; var coordSys = seriesModel.coordinateSystem;
if (coordSys.type === 'cartesian2d' || coordSys.type === 'calendar') { if (coordSys.type === 'cartesian2d' || coordSys.type === 'calendar') {
this._renderOnCartesianAndCalendar(coordSys, seriesModel, api); this._renderOnCartesianAndCalendar(seriesModel, api, 0, seriesModel.getData().count());
} }
else if (isGeoCoordSys(coordSys)) { else if (isGeoCoordSys(coordSys)) {
this._renderOnGeo( this._renderOnGeo(
...@@ -88,10 +91,20 @@ export default echarts.extendChartView({ ...@@ -88,10 +91,20 @@ export default echarts.extendChartView({
} }
}, },
dispose: function () {}, incrementalPrepareRender: function (seriesModel, ecModel, api) {
this.group.removeAll();
},
incrementalRender: function (params, seriesModel, ecModel, api) {
var coordSys = seriesModel.coordinateSystem;
if (coordSys) {
this._renderOnCartesianAndCalendar(seriesModel, api, params.start, params.end, true);
}
},
_renderOnCartesianAndCalendar: function (coordSys, seriesModel, api) { _renderOnCartesianAndCalendar: function (seriesModel, api, start, end, incremental) {
var coordSys = seriesModel.coordinateSystem;
if (coordSys.type === 'cartesian2d') { if (coordSys.type === 'cartesian2d') {
var xAxis = coordSys.getAxis('x'); var xAxis = coordSys.getAxis('x');
var yAxis = coordSys.getAxis('y'); var yAxis = coordSys.getAxis('y');
...@@ -134,7 +147,7 @@ export default echarts.extendChartView({ ...@@ -134,7 +147,7 @@ export default echarts.extendChartView({
seriesModel.coordDimToDataDim('value')[0] seriesModel.coordDimToDataDim('value')[0]
]; ];
data.each(function (idx) { for (var idx = start; idx < end; idx++) {
var rect; var rect;
if (coordSysType === 'cartesian2d') { if (coordSysType === 'cartesian2d') {
...@@ -206,9 +219,17 @@ export default echarts.extendChartView({ ...@@ -206,9 +219,17 @@ export default echarts.extendChartView({
rect.setStyle(style); rect.setStyle(style);
graphic.setHoverStyle(rect, data.hasItemOption ? hoverStl : zrUtil.extend({}, hoverStl)); graphic.setHoverStyle(rect, data.hasItemOption ? hoverStl : zrUtil.extend({}, hoverStl));
rect.incremental = incremental;
// PENDING
if (incremental) {
rect.needsClear = start === 0;
// Rect must use hover layer if it's incremental.
rect.useHoverLayer = true;
}
group.add(rect); group.add(rect);
data.setItemGraphicEl(idx, rect); data.setItemGraphicEl(idx, rect);
}); }
}, },
_renderOnGeo: function (geo, seriesModel, visualMapModel, api) { _renderOnGeo: function (geo, seriesModel, visualMapModel, api) {
...@@ -272,5 +293,7 @@ export default echarts.extendChartView({ ...@@ -272,5 +293,7 @@ export default echarts.extendChartView({
silent: true silent: true
}); });
this.group.add(img); this.group.add(img);
} },
dispose: function () {}
}); });
\ No newline at end of file
...@@ -21,6 +21,7 @@ import CompoundPath from 'zrender/src/graphic/CompoundPath'; ...@@ -21,6 +21,7 @@ import CompoundPath from 'zrender/src/graphic/CompoundPath';
import LinearGradient from 'zrender/src/graphic/LinearGradient'; import LinearGradient from 'zrender/src/graphic/LinearGradient';
import RadialGradient from 'zrender/src/graphic/RadialGradient'; import RadialGradient from 'zrender/src/graphic/RadialGradient';
import BoundingRect from 'zrender/src/core/BoundingRect'; import BoundingRect from 'zrender/src/core/BoundingRect';
import IncrementalDisplayable from 'zrender/src/graphic/IncrementalDisplayable';
var round = Math.round; var round = Math.round;
...@@ -1073,6 +1074,7 @@ export { ...@@ -1073,6 +1074,7 @@ export {
Line, Line,
BezierCurve, BezierCurve,
Arc, Arc,
IncrementalDisplayable,
CompoundPath, CompoundPath,
LinearGradient, LinearGradient,
RadialGradient, RadialGradient,
......
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
noise.seed(Math.random()); noise.seed(Math.random());
function generateData(theta, min, max) { function generateData(theta, min, max) {
var data = []; var data = [];
for (var i = 0; i <= 100; i++) { for (var i = 0; i <= 300; i++) {
for (var j = 0; j <= 100; j++) { for (var j = 0; j <= 300; j++) {
// var x = (max - min) * i / 200 + min; // var x = (max - min) * i / 200 + min;
// var y = (max - min) * j / 100 + min; // var y = (max - min) * j / 100 + min;
data.push([i, j, noise.perlin2(i / 40, j / 20) + 0.5]); data.push([i, j, noise.perlin2(i / 40, j / 20) + 0.5]);
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
min: 0, min: 0,
max: 1, max: 1,
calculable: true, calculable: true,
realtime: false,
splitNumber: 8, splitNumber: 8,
inRange: { inRange: {
color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026'] color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册