提交 292161b6 编写于 作者: K kener

大规模散点图性能优化

上级 1a479ea4
......@@ -164,16 +164,12 @@ define(function (require) {
]);
}
// todo
this._markMap(xAxis, yAxis, serie.data, pointList[seriesIndex]);
this.buildMark(
serie,
seriesIndex,
this.component,
{
xMarkMap : this._needMarkMap(seriesIndex)
? this._markMap(xAxis, yAxis, serie.data, pointList[seriesIndex])
: {}
xMarkMap : this._markMap(xAxis, yAxis, serie.data, pointList[seriesIndex])
}
);
}
......@@ -182,6 +178,7 @@ define(function (require) {
this._buildPointList(pointList);
},
/*
_needMarkMap : function (seriesIndex) {
var series = this.series;
var serie = series[seriesIndex];
......@@ -208,7 +205,8 @@ define(function (require) {
}
return false;
},
*/
_markMap : function (xAxis, yAxis, data, pointList) {
var xMarkMap = {
min0 : Number.POSITIVE_INFINITY,
......@@ -342,7 +340,7 @@ define(function (require) {
singlePoint[2], // dataIndex
singlePoint[3], // name
singlePoint[0], // x
singlePoint[1] // y
singlePoint[1] // y
);
shape && this.shapeList.push(shape);
}
......
......@@ -33,7 +33,7 @@
*/
define(function (require) {
var Base = require('zrender/shape/Base');
var PolygonShape = require('zrender/shape/Polygon')
var PolygonShape = require('zrender/shape/Polygon');
var polygonInstance = new PolygonShape({});
var zrUtil = require('zrender/tool/util');
......@@ -48,6 +48,29 @@ define(function (require) {
* @param {Context2D} ctx Canvas 2D上下文
* @param {Object} style 样式
*/
buildPath : function (ctx, style) {
var pointList = style.pointList;
var len = pointList.length;
var subSize = 10000;
var subSetLength = Math.ceil(len / subSize);
var sub;
var subLen;
for (var j = 0; j < subSetLength; j++) {
ctx.beginPath();
sub = j * subSize;
subLen = sub + subSize;
subLen = subLen > len ? len : subLen;
for (var i = sub; i < subLen; i++) {
ctx.rect(pointList[i][0] - 1, pointList[i][1] - 1, 2, 2);
}
ctx.closePath();
j < (subSetLength - 1) && ctx.fill();
}
return;
},
/* 像素模式
buildPath : function (ctx, style) {
var pointList = style.pointList;
var rect = this.getRect(style);
......@@ -87,7 +110,8 @@ define(function (require) {
// console.log(new Date() - ti);
return;
},
*/
/**
* 返回矩形区域,用于局部刷新和文字定位
* @param {Object} style
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册