tvcharts 0.6.11 → 0.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/echarts.js +868 -114
  2. package/dist/echarts.js.map +3 -3
  3. package/index.js +2 -2
  4. package/lib/chart/bgColor/BgColorView.js +4 -1
  5. package/lib/chart/helper/Symbol.js +55 -12
  6. package/lib/chart/helper/SymbolDraw.js +2 -1
  7. package/lib/chart/labels/LabelsSeries.js +109 -0
  8. package/lib/chart/labels/LabelsView.js +133 -0
  9. package/lib/chart/labels/install.js +55 -0
  10. package/lib/chart/labels/labelsVisual.js +128 -0
  11. package/lib/chart/labels.js +46 -0
  12. package/lib/chart/linesPlot/LinesPlotSeries.js +2 -26
  13. package/lib/chart/linesPlot/LinesPlotView.js +52 -34
  14. package/lib/chart/linesPlot/SymbolPath.js +88 -0
  15. package/lib/chart/linesPlot/linesPlotLayout.js +58 -32
  16. package/lib/chart/scatter/ScatterView.js +2 -1
  17. package/lib/export/charts.js +1 -0
  18. package/lib/model/Global.js +1 -0
  19. package/lib/util/symbol.js +597 -1
  20. package/package.json +1 -1
  21. package/types/dist/charts.d.ts +1 -1
  22. package/types/dist/components.d.ts +1 -1
  23. package/types/dist/echarts.d.ts +5 -6
  24. package/types/dist/renderers.d.ts +1 -1
  25. package/types/dist/shared.d.ts +11 -10
  26. package/types/src/chart/helper/Symbol.d.ts +1 -0
  27. package/types/src/chart/helper/SymbolDraw.d.ts +1 -0
  28. package/types/src/chart/labels/LabelsSeries.d.ts +37 -0
  29. package/types/src/chart/labels/LabelsView.d.ts +28 -0
  30. package/types/src/chart/labels/install.d.ts +2 -0
  31. package/types/src/chart/labels/labelsVisual.d.ts +3 -0
  32. package/types/src/chart/labels.d.ts +1 -0
  33. package/types/src/chart/linesPlot/LinesPlotSeries.d.ts +6 -7
  34. package/types/src/chart/linesPlot/SymbolPath.d.ts +24 -0
  35. package/types/src/chart/linesPlot/linesPlotLayout.d.ts +1 -1
  36. package/types/src/export/charts.d.ts +1 -0
@@ -45,30 +45,6 @@ import { __extends } from "tslib";
45
45
  /* global Uint32Array, Float64Array, Float32Array */
46
46
  import SeriesModel from '../../model/Series.js';
47
47
  import createSeriesData from '../helper/createSeriesData.js';
48
- import { mergeAll, map } from 'zrender/lib/core/util.js';
49
- var Uint32Arr = typeof Uint32Array === 'undefined' ? Array : Uint32Array;
50
- var Float64Arr = typeof Float64Array === 'undefined' ? Array : Float64Array;
51
- function compatEc2(seriesOpt) {
52
- var data = seriesOpt.data;
53
- if (data && data[0] && data[0][0] && data[0][0].coord) {
54
- if (process.env.NODE_ENV !== 'production') {
55
- console.warn('Lines data configuration has been changed to' + ' { coords:[[1,2],[2,3]] }');
56
- }
57
- seriesOpt.data = map(data, function (itemOpt) {
58
- var coords = [itemOpt[0].coord, itemOpt[1].coord];
59
- var target = {
60
- coords: coords
61
- };
62
- if (itemOpt[0].name) {
63
- target.fromName = itemOpt[0].name;
64
- }
65
- if (itemOpt[1].name) {
66
- target.toName = itemOpt[1].name;
67
- }
68
- return mergeAll([target, itemOpt[0], itemOpt[1]]);
69
- });
70
- }
71
- }
72
48
  var LinesPlotSeriesModel = /** @class */function (_super) {
73
49
  __extends(LinesPlotSeriesModel, _super);
74
50
  function LinesPlotSeriesModel() {
@@ -110,12 +86,12 @@ var LinesPlotSeriesModel = /** @class */function (_super) {
110
86
  symbol: 'emptyCircle',
111
87
  symbolSize: 10,
112
88
  // symbolRotate: null,
113
- showSymbol: true,
89
+ // showSymbol: true,
114
90
  // `false`: follow the label interval strategy.
115
91
  // `true`: show all symbols.
116
92
  // `'auto'`: If possible, show all symbols, otherwise
117
93
  // follow the label interval strategy.
118
- showAllSymbol: 'auto',
94
+ // showAllSymbol: 'auto',
119
95
  // Geo coordinate system
120
96
  geoIndex: 0,
121
97
  // effect: {
@@ -55,6 +55,7 @@ import LinePlotPath from "./LinePlotPath.js";
55
55
  import PolyPlotPath from "./PolyPlotPath.js";
56
56
  import HistogramPlotPath from "./HistogramPlotPath.js";
57
57
  import BarPath from "./BarPath.js";
58
+ // import SymbolPath from "./SymbolPath.js";
58
59
  var LinesPlotView = /** @class */function (_super) {
59
60
  __extends(LinesPlotView, _super);
60
61
  function LinesPlotView() {
@@ -77,35 +78,6 @@ var LinesPlotView = /** @class */function (_super) {
77
78
  this._renderSymbol(data, seriesModel);
78
79
  this._renderHistogram(data, seriesModel);
79
80
  this._renderBar(data, seriesModel);
80
- // const lineDraw = this._updateLineDraw(data, seriesModel);
81
- // const zlevel = seriesModel.get('zlevel');
82
- // const trailLength = seriesModel.get(['effect', 'trailLength']);
83
- // const zr = api.getZr();
84
- // // Avoid the drag cause ghost shadow
85
- // // FIXME Better way ?
86
- // // SVG doesn't support
87
- // const isSvg = zr.painter.getType() === 'svg';
88
- // if (!isSvg) {
89
- // (zr.painter as CanvasPainter).getLayer(zlevel).clear(true);
90
- // }
91
- // Config layer with motion blur
92
- // if (this._lastZlevel != null && !isSvg) {
93
- // zr.configLayer(this._lastZlevel, {
94
- // motionBlur: false
95
- // });
96
- // }
97
- // if (this._showEffect(seriesModel) && trailLength > 0) {
98
- // if (!isSvg) {
99
- // zr.configLayer(zlevel, {
100
- // motionBlur: true,
101
- // lastFrameAlpha: Math.max(Math.min(trailLength / 10 + 0.9, 1), 0)
102
- // });
103
- // }
104
- // else if (__DEV__) {
105
- // console.warn('SVG render mode doesn\'t support lines with trail effect');
106
- // }
107
- // }
108
- // lineDraw.updateData(data as SeriesData);
109
81
  var clipPath = seriesModel.get('clip', true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);
110
82
  if (clipPath) {
111
83
  this.group.setClipPath(clipPath);
@@ -231,6 +203,50 @@ var LinesPlotView = /** @class */function (_super) {
231
203
  };
232
204
  LinesPlotView.prototype._renderSymbol = function (data, seriesModel) {
233
205
  var symbolVisible = seriesModel.get('symbolVisible');
206
+ // const symbolPointsByColor = data.getLayout("symbolPointsByColor")
207
+ // const shadowShape = seriesModel.get('shadowShape');
208
+ // if (symbolVisible) {
209
+ // if (!this._symbolGroup) {
210
+ // this._symbolGroup = new graphic.Group();
211
+ // this.group.add(this._symbolGroup)
212
+ // } else {
213
+ // this._symbolGroup.removeAll();
214
+ // }
215
+ // const symbolGroup = this._symbolGroup;
216
+ // console.log('%c [ symbolPointsByColor ]-219', 'font-size:13px; background:pink; color:#bf2c9f;', symbolPointsByColor)
217
+ // each(symbolPointsByColor, function(item: { point: number[]; size: number }[], key: string) {
218
+ // const [stroke, type] = key.split("_");
219
+ // // if (shadowShape) {
220
+ // // const shadowEl = new SymbolPath({ shape: {
221
+ // // points: item,
222
+ // // isShadow: true,
223
+ // // },
224
+ // // style: {
225
+ // // fill: stroke,
226
+ // // opacity: 0.5,
227
+ // // }
228
+ // // })
229
+ // // shadowEl.symbolProxy = createSymbol(type, 0, 0, 0, 0) as ECSymbol;
230
+ // // symbolGroup.add(shadowEl)
231
+ // // }
232
+ // const el = new SymbolPath({ shape: {
233
+ // points: item,
234
+ // },
235
+ // style: {
236
+ // fill: null,
237
+ // stroke: null,
238
+ // }
239
+ // })
240
+ // el.symbolProxy = createSymbol(type, 0, 0, 0, 0, "pink") as ECSymbol;
241
+ // // el.symbolProxy.setColor("pink")
242
+ // // console.log('%c [ symbolProxy ]-228', 'font-size:13px; background:pink; color:#bf2c9f;', el.symbolProxy)
243
+ // symbolGroup.add(el)
244
+ // })
245
+ // } else if (this._symbolGroup) {
246
+ // this._symbolGroup.removeAll();
247
+ // this.group.remove(this._symbolGroup)
248
+ // this._symbolGroup = null
249
+ // }
234
250
  var symbolDraw = this._symbolDraw;
235
251
  if (symbolVisible) {
236
252
  var symbolDraw_1 = this._updateSymbolDraw(data, seriesModel);
@@ -417,6 +433,8 @@ var LinesPlotView = /** @class */function (_super) {
417
433
  this._polygonGroup = null;
418
434
  this._symbolDraw && this._symbolDraw.remove();
419
435
  this._symbolDraw = null;
436
+ // this._symbolGroup && this._symbolGroup.removeAll();
437
+ // this._symbolGroup = null;
420
438
  this._histogramGroup && this._histogramGroup.removeAll();
421
439
  this._histogramGroup = null;
422
440
  this._barGroup && this._barGroup.removeAll();
@@ -433,11 +451,11 @@ var LinesPlotView = /** @class */function (_super) {
433
451
  return LinesPlotView;
434
452
  }(ChartView);
435
453
  function getIsIgnoreFunc(seriesModel, data, coordSys) {
436
- var showAllSymbol = seriesModel.get('showAllSymbol');
437
- var isAuto = showAllSymbol === 'auto';
438
- if (showAllSymbol && !isAuto) {
439
- return;
440
- }
454
+ // const showAllSymbol = seriesModel.get('showAllSymbol');
455
+ // const isAuto = showAllSymbol === 'auto';
456
+ // if (showAllSymbol && !isAuto) {
457
+ // return;
458
+ // }
441
459
  var categoryAxis = coordSys.getAxesByScale('ordinal')[0];
442
460
  if (!categoryAxis) {
443
461
  return;
@@ -0,0 +1,88 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+
22
+ /**
23
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
24
+ */
25
+
26
+ /*
27
+ * Licensed to the Apache Software Foundation (ASF) under one
28
+ * or more contributor license agreements. See the NOTICE file
29
+ * distributed with this work for additional information
30
+ * regarding copyright ownership. The ASF licenses this file
31
+ * to you under the Apache License, Version 2.0 (the
32
+ * "License"); you may not use this file except in compliance
33
+ * with the License. You may obtain a copy of the License at
34
+ *
35
+ * http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing,
38
+ * software distributed under the License is distributed on an
39
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
+ * KIND, either express or implied. See the License for the
41
+ * specific language governing permissions and limitations
42
+ * under the License.
43
+ */
44
+ import { __extends } from "tslib";
45
+ /* global Float32Array */
46
+ // TODO Batch by color
47
+ import * as graphic from '../../util/graphic.js';
48
+ // const BOOST_SIZE_THRESHOLD = 4;
49
+ var LargeSymbolPathShape = /** @class */function () {
50
+ function LargeSymbolPathShape() {}
51
+ return LargeSymbolPathShape;
52
+ }();
53
+ var SymbolPath = /** @class */function (_super) {
54
+ __extends(SymbolPath, _super);
55
+ function SymbolPath(opts) {
56
+ return _super.call(this, opts) || this;
57
+ }
58
+ SymbolPath.prototype.getDefaultShape = function () {
59
+ return new LargeSymbolPathShape();
60
+ };
61
+ SymbolPath.prototype.buildPath = function (path, shape) {
62
+ var points = shape.points;
63
+ var isShadow = shape.isShadow;
64
+ var symbolProxy = this.symbolProxy;
65
+ var symbolProxyShape = symbolProxy.shape;
66
+ var ctx = path.getContext ? path.getContext() : path;
67
+ // this._ctx = ctx;
68
+ ctx.fillStyle = "red";
69
+ ctx.strokeStyle = "red";
70
+ for (var i = 0; i < points.length; i++) {
71
+ var point = points[i].point;
72
+ var size = isShadow ? points[i].size * 2 : points[i].size;
73
+ var x = point[0],
74
+ y = point[1];
75
+ if (isNaN(x) || isNaN(y)) {
76
+ continue;
77
+ }
78
+ symbolProxyShape.x = x - size / 2;
79
+ symbolProxyShape.y = y - size / 2;
80
+ symbolProxyShape.width = size;
81
+ symbolProxyShape.height = size;
82
+ symbolProxy.style.fill = "pink";
83
+ symbolProxy.buildPath(path, symbolProxyShape, true);
84
+ }
85
+ };
86
+ return SymbolPath;
87
+ }(graphic.Path);
88
+ export default SymbolPath;
@@ -24,50 +24,48 @@
24
24
  */
25
25
 
26
26
  /*
27
- * Licensed to the Apache Software Foundation (ASF) under one
28
- * or more contributor license agreements. See the NOTICE file
29
- * distributed with this work for additional information
30
- * regarding copyright ownership. The ASF licenses this file
31
- * to you under the Apache License, Version 2.0 (the
32
- * "License"); you may not use this file except in compliance
33
- * with the License. You may obtain a copy of the License at
34
- *
35
- * http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing,
38
- * software distributed under the License is distributed on an
39
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
- * KIND, either express or implied. See the License for the
41
- * specific language governing permissions and limitations
42
- * under the License.
43
- */
27
+ * Licensed to the Apache Software Foundation (ASF) under one
28
+ * or more contributor license agreements. See the NOTICE file
29
+ * distributed with this work for additional information
30
+ * regarding copyright ownership. The ASF licenses this file
31
+ * to you under the Apache License, Version 2.0 (the
32
+ * "License"); you may not use this file except in compliance
33
+ * with the License. You may obtain a copy of the License at
34
+ *
35
+ * http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing,
38
+ * software distributed under the License is distributed on an
39
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
+ * KIND, either express or implied. See the License for the
41
+ * specific language governing permissions and limitations
42
+ * under the License.
43
+ */
44
44
  /* global Float32Array */
45
- import createRenderPlanner from '../helper/createRenderPlanner.js';
46
- import { error } from '../../util/log.js';
47
- import { map } from 'zrender/lib/core/util.js';
48
- import { createFloat32Array } from '../../util/vendor.js';
45
+ import createRenderPlanner from "../helper/createRenderPlanner.js";
46
+ import { error } from "../../util/log.js";
47
+ import { map } from "zrender/lib/core/util.js";
48
+ import { createFloat32Array } from "../../util/vendor.js";
49
49
  function optimizePixels(point) {
50
50
  point[0] = point[0] + 0.5;
51
51
  return point;
52
52
  }
53
53
  var linesPlotLayout = {
54
- seriesType: 'linesPlot',
54
+ seriesType: "linesPlot",
55
55
  plan: createRenderPlanner(),
56
56
  reset: function (seriesModel) {
57
57
  var coordSys = seriesModel.coordinateSystem;
58
58
  if (!coordSys) {
59
59
  if (process.env.NODE_ENV !== 'production') {
60
- error('The lines series must have a coordinate system.');
60
+ error("The lines series must have a coordinate system.");
61
61
  }
62
62
  return;
63
63
  }
64
64
  var data = seriesModel.getData();
65
65
  var pipelineContext = seriesModel.pipelineContext;
66
- var useTypedArray = pipelineContext.large;
67
66
  var dims = map(coordSys.dimensions, function (dim) {
68
67
  return data.mapDimension(dim);
69
68
  }).slice(0, 2);
70
- var dimLen = dims.length;
71
69
  var store = data.getStore();
72
70
  var dimIdx0 = data.getDimensionIndex(dims[0]);
73
71
  var dimIdx1 = data.getDimensionIndex(dims[1]);
@@ -75,20 +73,43 @@ var linesPlotLayout = {
75
73
  // const isLarge = seriesModel.pipelineContext.large;
76
74
  var connectNulls = seriesModel.get("connectNulls");
77
75
  var step = seriesModel.get("step");
78
- var isSingle = seriesModel.get('histogramVisible') || seriesModel.get('barVisible');
79
- var symbolByStep = seriesModel.get('symbolByStep');
80
- var xOffset = seriesModel.get('offset') || 0;
76
+ var isSingle = seriesModel.get("histogramVisible") || seriesModel.get("barVisible");
77
+ var symbolByStep = seriesModel.get("symbolByStep");
78
+ var xOffset = seriesModel.get("offset") || 0;
79
+ var symbolVisible = seriesModel.get("symbolVisible");
80
+ var symbolSize = seriesModel.get("symbolSize");
81
+ var globalSymbol = seriesModel.get('symbol');
81
82
  return {
82
83
  progress: function (params, lineData) {
83
84
  // const lineCoords: number[][] = [];
84
85
  var segCount = params.end - params.start;
85
86
  var symbolPoints = createFloat32Array(segCount * 2);
86
87
  var linePointsByKey = {};
88
+ // const symbolPointsByColor: Record<
89
+ // string,
90
+ // { point: number[]; size: number[] | number }[]
91
+ // > = {};
87
92
  var allLinePoints = [];
88
93
  var lastKey = "";
89
94
  var offset = 0;
90
95
  var stroke = seriesModel.getLineStyle().stroke;
91
96
  var defaultColor = Array.isArray(stroke) ? stroke[0] : stroke;
97
+ // function setSymbolPoint(point: number[], index: number) {
98
+ // if (!symbolVisible) {
99
+ // return;
100
+ // }
101
+ // const dataModal = lineData.getItemModel<LinesDataItemOption>(index);
102
+ // const symbolColor = dataModal.get("itemStyle").color as string;
103
+ // const symbol = dataModal.get("symbol");
104
+ // // const symbolSize = dataModal.get("symbolSize");
105
+ // const symbolKey = `${symbolColor}_${symbol}`;
106
+ // const symbolData = symbolPointsByColor[symbolKey] || [];
107
+ // symbolData.push({
108
+ // point,
109
+ // size: symbolSize || dataModal.get("symbolSize"),
110
+ // });
111
+ // symbolPointsByColor[symbolKey] = symbolData;
112
+ // }
92
113
  for (var i = params.start; i < params.end; i++) {
93
114
  var isRawLast = i + 1 === params.end ? data.getRawIndex(i) === data.count(true) - 1 : false;
94
115
  var isRawFirst = i === 0 ? data.getRawIndex(i) === 0 : false;
@@ -98,7 +119,9 @@ var linesPlotLayout = {
98
119
  if (symbolByStep ? connectNulls && isNaN(y) || isRawLast : true) {
99
120
  symbolPoints[offset++] = point[0];
100
121
  symbolPoints[offset++] = point[1];
122
+ // setSymbolPoint(point, i);
101
123
  }
124
+
102
125
  if (connectNulls && isNaN(y)) {
103
126
  continue;
104
127
  }
@@ -129,7 +152,7 @@ var linesPlotLayout = {
129
152
  nextPoint[0] = midX;
130
153
  }
131
154
  var itemModel = lineData.getItemModel(isSingle ? i : i + 1);
132
- var _a = itemModel.get('lineStyle'),
155
+ var _a = itemModel.get("lineStyle"),
133
156
  _b = _a.color,
134
157
  color = _b === void 0 ? defaultColor : _b,
135
158
  _c = _a.type,
@@ -150,21 +173,24 @@ var linesPlotLayout = {
150
173
  points.push(0);
151
174
  }
152
175
  points.push(point);
153
- allLinePoints.push(point);
176
+ // allLinePoints.push(point);
154
177
  if (isStep) {
155
178
  points.push(nextPoint);
156
179
  if (symbolByStep) {
157
180
  symbolPoints[offset++] = nextPoint[0];
158
181
  symbolPoints[offset++] = nextPoint[1];
182
+ // setSymbolPoint(point, i);
159
183
  }
160
- allLinePoints.push(nextPoint);
184
+ // allLinePoints.push(nextPoint);
161
185
  }
186
+
162
187
  linePointsByKey[key] = points;
163
188
  lastKey = key;
164
189
  }
165
190
  lineData.setLayout({
166
191
  linePointsByKey: linePointsByKey,
167
- allLinePoints: allLinePoints,
192
+ // allLinePoints,
193
+ // symbolPointsByColor,
168
194
  points: symbolPoints
169
195
  });
170
196
  }
@@ -61,7 +61,8 @@ var ScatterView = /** @class */function (_super) {
61
61
  // If this parameter should be a shape or a bounding volume
62
62
  // shape will be more general.
63
63
  // But bounding volume like bounding rect will be much faster in the contain calculation
64
- clipShape: this._getClipShape(seriesModel)
64
+ clipShape: this._getClipShape(seriesModel),
65
+ useNameLabel: true
65
66
  });
66
67
  this._finished = true;
67
68
  };
@@ -64,6 +64,7 @@ export { install as CandlestickChart } from '../chart/candlestick/install.js';
64
64
  export { install as EffectScatterChart } from '../chart/effectScatter/install.js';
65
65
  export { install as LinesChart } from '../chart/lines/install.js';
66
66
  export { install as LinesPlotChart } from '../chart/linesPlot/install.js';
67
+ export { install as LabelsChart } from '../chart/labels/install.js';
67
68
  export { install as HLinesChart } from '../chart/hlines/install.js';
68
69
  export { install as BgColorChart } from '../chart/bgColor/install.js';
69
70
  export { install as HeatmapChart } from '../chart/heatmap/install.js';
@@ -121,6 +121,7 @@ var BUILTIN_CHARTS_MAP = {
121
121
  effectScatter: 'EffectScatterChart',
122
122
  lines: 'LinesChart',
123
123
  linesPlot: 'LinesPlotChart',
124
+ labels: 'LabelsChart',
124
125
  hlines: 'HLinesChart',
125
126
  bgcolor: 'BgColorChart',
126
127
  heatmap: 'HeatmapChart',