提交 7333da62 编写于 作者: S sushuang

Merge branch 'next' of https://github.com/100pah/echarts into next

......@@ -1423,7 +1423,7 @@ function renderSeries(ecIns, ecModel, api, payload, dirtySeriesModels) {
updateZ(seriesModel, chartView);
// ??? updateProgressiveAndBlend(seriesModel, chartView);
updateBlend(seriesModel, chartView);
}
scheduler.unfinished |= unfinished;
......@@ -1550,29 +1550,7 @@ function updateHoverLayerStatus(zr, ecModel) {
* @param {module:echarts/model/Series|module:echarts/model/Component} model
* @param {module:echarts/view/Component|module:echarts/view/Chart} view
*/
function updateProgressiveAndBlend(seriesModel, chartView) {
// Progressive configuration
var elCount = 0;
chartView.group.traverse(function (el) {
if (el.type !== 'group' && !el.ignore) {
elCount++;
}
});
var frameDrawNum = +seriesModel.get('progressive');
var needProgressive = elCount > seriesModel.get('progressiveThreshold') && frameDrawNum && !env.node;
if (needProgressive) {
chartView.group.traverse(function (el) {
// FIXME marker and other components
if (!el.isGroup) {
el.progressive = needProgressive ?
Math.floor(elCount++ / frameDrawNum) : -1;
if (needProgressive) {
el.stopAnimation(true);
}
}
});
}
function updateBlend(seriesModel, chartView) {
// Blend configration
// ???
var blendMode = seriesModel.get('blendMode') || null;
......@@ -1586,6 +1564,11 @@ function updateProgressiveAndBlend(seriesModel, chartView) {
if (!el.isGroup) {
el.setStyle('blend', blendMode);
}
if (el.eachPendingDisplayable) {
el.eachPendingDisplayable(function (displayable) {
displayable.setStyle('blend', blendMode);
});
}
});
}
......
var echarts = require('../../dist/echarts');
// var v8 = require('v8');
// v8.setFlagsFromString('--max-old-space-size=4096');
var { createCanvas } = require('canvas');
var fs = require('fs');
var ProgressBar = require('progress');
echarts.setCanvasCreator(function () {
return createCanvas(100, 100);
});
var canvas = createCanvas();
canvas.width = 2048;
canvas.height = 1024;
var worldJson = JSON.parse(fs.readFileSync('../../map/json/world.json', 'utf-8'));
echarts.registerMap('world', worldJson);
var chart = echarts.init(canvas);
chart.setOption({
backgroundColor: '#000',
geo: {
map: 'world',
roam: true,
label: {
emphasis: {
show: false
}
},
silent: true,
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#111'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
series: [{
name: '',
type: 'scatter',
progressive: 1e5,
coordinateSystem: 'geo',
symbolSize: 1,
blendMode: 'lighter',
large: true,
itemStyle: {
normal: {
color: 'rgb(20, 15, 2)'
}
},
postEffect: {
enable: true
},
silent: true,
dimensions: ['lng', 'lat'],
data: new Float32Array()
}]
});
// var CHUNK_COUNT = 277;
var CHUNK_COUNT = 229;
// https://blog.openstreetmap.org/2012/04/01/bulk-gps-point-data/
function fetchData(idx) {
if (idx >= CHUNK_COUNT) {
setTimeout(function () {
fs.writeFile('out.png', canvas.toBuffer());
chart.dispose();
});
return;
}
fs.readFile(`../../../echarts-gl/test/data/gps/gps_${idx}.bin`, function (err, buffer) {
var arr = new Uint8Array(buffer.length);
for (var i = 0; i < buffer.length; i++) {
arr[i] = buffer[i];
}
var rawData = new Int32Array(arr.buffer);
var data = new Float32Array(rawData.length);
for (var i = 0; i < rawData.length; i += 2) {
data[i] = rawData[i+1] / 1e7;
data[i+1] = rawData[i] / 1e7;
}
chart.addData({
seriesIndex: 0,
data: data
});
fetchData(idx + 1);
progress.tick();
});
}
var progress = new ProgressBar('Generating [:bar] :percent :etas', {
complete: '=',
incomplete: ' ',
width: 50,
total: CHUNK_COUNT
});
fetchData(0);
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册