FlowGLSeries.js
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import * as echarts from 'echarts/lib/echarts';
export default echarts.SeriesModel.extend({
type: 'series.flowGL',
dependencies: ['geo', 'grid', 'bmap'],
visualStyleAccessPath: 'itemStyle',
getInitialData: function (option, ecModel) {
var coordType = this.get('coordinateSystem');
// TODO hotfix for the bug in echarts that get coord dimensions is undefined.
var coordSysDimensions = coordType === 'geo' ? ['lng', 'lat']
: (echarts.getCoordinateSystemDimensions(coordType) || ['x', 'y']);
if (process.env.NODE_ENV !== 'production') {
if (coordSysDimensions.length > 2) {
throw new Error('flowGL can only be used on 2d coordinate systems.');
}
}
coordSysDimensions.push('vx', 'vy');
var dimensions = echarts.helper.createDimensions(this.getSource(), {
coordDimensions: coordSysDimensions,
encodeDefine: this.get('encode'),
dimensionsDefine: this.get('dimensions')
});
var data = new echarts.List(dimensions, this);
data.initData(this.getSource());
return data;
},
defaultOption: {
coordinateSystem: 'cartesian2d',
zlevel: 10,
supersampling: 1,
// 128x128 particles
particleType: 'point',
particleDensity: 128,
particleSize: 1,
particleSpeed: 1,
particleTrail: 2,
colorTexture: null,
gridWidth: 'auto',
gridHeight: 'auto',
itemStyle: {
color: '#fff',
opacity: 0.8
}
}
});