tvcharts 0.7.73 → 0.7.75
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.
- package/lib/chart/hlines/HLinesView.js +3 -2
- package/lib/chart/linesPlot/GradientBarPath.js +112 -0
- package/lib/chart/linesPlot/GradientHistogramPlotPath.js +101 -0
- package/lib/chart/linesPlot/LinesPlotView.js +33 -0
- package/lib/chart/linesPlot/linesPlotLayout.js +10 -2
- package/lib/component/axisPointer/axisTrigger.js +3 -1
- package/lib/component/dataZoom/roams.js +8 -7
- package/lib/core/echarts.js +6 -0
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +1 -0
- package/types/dist/shared.d.ts +1 -0
- package/types/src/chart/linesPlot/GradientBarPath.d.ts +29 -0
- package/types/src/chart/linesPlot/GradientHistogramPlotPath.d.ts +28 -0
- package/types/src/core/echarts.d.ts +1 -0
- package/lib/chart/linesPlot/linesPlotLayout1.js +0 -207
- package/types/src/chart/linesPlot/linesPlotLayout1.d.ts +0 -3
|
@@ -86,12 +86,13 @@ var HLinesView = /** @class */function (_super) {
|
|
|
86
86
|
};
|
|
87
87
|
HLinesView.prototype.remove = function (ecModel, api) {
|
|
88
88
|
this._lineDraw && this._lineDraw.remove();
|
|
89
|
-
this._lineDraw = null;
|
|
89
|
+
// this._lineDraw = null;
|
|
90
90
|
// Clear motion when lineDraw is removed;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
HLinesView.prototype.dispose = function (ecModel, api) {
|
|
94
|
-
this.remove(
|
|
94
|
+
this._lineDraw && this._lineDraw.remove();
|
|
95
|
+
this._lineDraw = null;
|
|
95
96
|
};
|
|
96
97
|
HLinesView.type = 'hlines';
|
|
97
98
|
return HLinesView;
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
/**
|
|
46
|
+
* Line path for bezier and straight line draw
|
|
47
|
+
*/
|
|
48
|
+
import * as graphic from '../../util/graphic.js';
|
|
49
|
+
// const straightLineProto = graphic.Line.prototype;
|
|
50
|
+
// const bezierCurveProto = graphic.BezierCurve.prototype;
|
|
51
|
+
var GradientBarShape = /** @class */function () {
|
|
52
|
+
function GradientBarShape() {
|
|
53
|
+
this.points = [];
|
|
54
|
+
this.baseY = 0;
|
|
55
|
+
this.width = 5;
|
|
56
|
+
}
|
|
57
|
+
return GradientBarShape;
|
|
58
|
+
}();
|
|
59
|
+
function isPointNull(point) {
|
|
60
|
+
if (point instanceof Array) {
|
|
61
|
+
return isNaN(point[0]) || isNaN(point[1]);
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
var GradientBarPath = /** @class */function (_super) {
|
|
66
|
+
__extends(GradientBarPath, _super);
|
|
67
|
+
function GradientBarPath(opts) {
|
|
68
|
+
var _this = _super.call(this, opts) || this;
|
|
69
|
+
_this.type = 'GradientBar';
|
|
70
|
+
return _this;
|
|
71
|
+
}
|
|
72
|
+
GradientBarPath.prototype.getDefaultStyle = function () {
|
|
73
|
+
return {
|
|
74
|
+
stroke: 'transparent',
|
|
75
|
+
fill: '#000'
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
GradientBarPath.prototype.getDefaultShape = function () {
|
|
79
|
+
return new GradientBarShape();
|
|
80
|
+
};
|
|
81
|
+
GradientBarPath.prototype.buildPath = function (ctx, shape) {
|
|
82
|
+
var points = shape.points,
|
|
83
|
+
baseY = shape.baseY,
|
|
84
|
+
width = shape.width;
|
|
85
|
+
var offset = width / 2;
|
|
86
|
+
var gap = offset >= 1 ? 1 : 0;
|
|
87
|
+
for (var index = 0; index < points.length; index++) {
|
|
88
|
+
var _a = points[index],
|
|
89
|
+
point = _a.point,
|
|
90
|
+
color = _a.color;
|
|
91
|
+
if (isPointNull(point)) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
var _b = point,
|
|
95
|
+
x = _b[0],
|
|
96
|
+
y = _b[1];
|
|
97
|
+
var left = Math.floor(x - offset);
|
|
98
|
+
var leftX = left + gap;
|
|
99
|
+
var rightX = Math.floor(left + width);
|
|
100
|
+
var dataY = Math.floor(y);
|
|
101
|
+
ctx.beginPathFill();
|
|
102
|
+
ctx.moveTo(leftX, dataY);
|
|
103
|
+
ctx.lineTo(rightX, dataY);
|
|
104
|
+
ctx.lineTo(rightX, baseY);
|
|
105
|
+
ctx.lineTo(leftX, baseY);
|
|
106
|
+
ctx.lineTo(leftX, dataY);
|
|
107
|
+
ctx.fillStyle(color);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return GradientBarPath;
|
|
111
|
+
}(graphic.Path);
|
|
112
|
+
export default GradientBarPath;
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
/**
|
|
46
|
+
* Line path for bezier and straight line draw
|
|
47
|
+
*/
|
|
48
|
+
import * as graphic from '../../util/graphic.js';
|
|
49
|
+
// const straightLineProto = graphic.Line.prototype;
|
|
50
|
+
// const bezierCurveProto = graphic.BezierCurve.prototype;
|
|
51
|
+
var GradientHistogramPlotShape = /** @class */function () {
|
|
52
|
+
function GradientHistogramPlotShape() {
|
|
53
|
+
this.points = [];
|
|
54
|
+
this.baseY = 0;
|
|
55
|
+
}
|
|
56
|
+
return GradientHistogramPlotShape;
|
|
57
|
+
}();
|
|
58
|
+
function isPointNull(point) {
|
|
59
|
+
if (point instanceof Array) {
|
|
60
|
+
return isNaN(point[0]) || isNaN(point[1]);
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
var GradientHistogramPlotPath = /** @class */function (_super) {
|
|
65
|
+
__extends(GradientHistogramPlotPath, _super);
|
|
66
|
+
function GradientHistogramPlotPath(opts) {
|
|
67
|
+
var _this = _super.call(this, opts) || this;
|
|
68
|
+
_this.type = 'GradientHistogramPlot';
|
|
69
|
+
return _this;
|
|
70
|
+
}
|
|
71
|
+
GradientHistogramPlotPath.prototype.getDefaultStyle = function () {
|
|
72
|
+
return {
|
|
73
|
+
stroke: 'transparent',
|
|
74
|
+
fill: '#000'
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
GradientHistogramPlotPath.prototype.getDefaultShape = function () {
|
|
78
|
+
return new GradientHistogramPlotShape();
|
|
79
|
+
};
|
|
80
|
+
GradientHistogramPlotPath.prototype.buildPath = function (ctx, shape) {
|
|
81
|
+
var points = shape.points,
|
|
82
|
+
baseY = shape.baseY;
|
|
83
|
+
for (var index = 0; index < points.length; index++) {
|
|
84
|
+
var _a = points[index],
|
|
85
|
+
point = _a.point,
|
|
86
|
+
color = _a.color;
|
|
87
|
+
if (isPointNull(point)) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
ctx.beginPathFill();
|
|
91
|
+
var _b = point,
|
|
92
|
+
x = _b[0],
|
|
93
|
+
y = _b[1];
|
|
94
|
+
ctx.moveTo(x, y);
|
|
95
|
+
ctx.lineTo(x, baseY);
|
|
96
|
+
ctx.strokeStyle(color);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
return GradientHistogramPlotPath;
|
|
100
|
+
}(graphic.Path);
|
|
101
|
+
export default GradientHistogramPlotPath;
|
|
@@ -469,6 +469,7 @@ var LinesPlotView = /** @class */function (_super) {
|
|
|
469
469
|
this._barGroup.removeAll();
|
|
470
470
|
}
|
|
471
471
|
var linePointsByKey = data.getLayout('linePointsByKey');
|
|
472
|
+
// const isGradient = data.getLayout('isGradient');
|
|
472
473
|
var barGroup_1 = this._barGroup;
|
|
473
474
|
var histbase = seriesModel.get('histbase') || 0;
|
|
474
475
|
var z2_5 = seriesModel.get('z2');
|
|
@@ -476,6 +477,38 @@ var LinesPlotView = /** @class */function (_super) {
|
|
|
476
477
|
// console.log('%c [ barSpace ]-271', 'font-size:13px; background:pink; color:#bf2c9f;', barSpace)
|
|
477
478
|
var width_1 = barSpace;
|
|
478
479
|
var baseY_3 = seriesModel.coordinateSystem.dataToPoint([0, histbase])[1];
|
|
480
|
+
// if (isGradient) {
|
|
481
|
+
// const pointInfos = data.getLayout('pointInfos');
|
|
482
|
+
// if (width <= 1) {
|
|
483
|
+
// const el = new GradientHistogramPlotPath({ shape: {
|
|
484
|
+
// points: pointInfos,
|
|
485
|
+
// baseY,
|
|
486
|
+
// },
|
|
487
|
+
// style: {
|
|
488
|
+
// stroke: '#000',
|
|
489
|
+
// fill: 'none',
|
|
490
|
+
// },
|
|
491
|
+
// z2: z2,
|
|
492
|
+
// });
|
|
493
|
+
// el.states.emphasis = emphasisState;
|
|
494
|
+
// barGroup.add(el);
|
|
495
|
+
// return;
|
|
496
|
+
// }
|
|
497
|
+
// const el = new GradientBarPath({ shape: {
|
|
498
|
+
// points: pointInfos,
|
|
499
|
+
// baseY,
|
|
500
|
+
// width: width,
|
|
501
|
+
// },
|
|
502
|
+
// style: {
|
|
503
|
+
// fill: '#000000',
|
|
504
|
+
// stroke: 'none',
|
|
505
|
+
// },
|
|
506
|
+
// z2: z2,
|
|
507
|
+
// });
|
|
508
|
+
// el.states.emphasis = emphasisState;
|
|
509
|
+
// barGroup.add(el);
|
|
510
|
+
// return;
|
|
511
|
+
// }
|
|
479
512
|
if (width_1 <= 1) {
|
|
480
513
|
each(linePointsByKey, function (item, key) {
|
|
481
514
|
var stroke = key.split(':')[0];
|
|
@@ -126,6 +126,7 @@ var linesPlotLayout = {
|
|
|
126
126
|
lastPoint = point;
|
|
127
127
|
}
|
|
128
128
|
var lastIndex = data.count(true) - 1;
|
|
129
|
+
// const colorMapping: Record<string, number> = {};
|
|
129
130
|
for (var i = params.start; i < params.end; i++) {
|
|
130
131
|
if (showLast && lastIndex - data.getRawIndex(i) >= showLast) {
|
|
131
132
|
continue;
|
|
@@ -155,7 +156,9 @@ var linesPlotLayout = {
|
|
|
155
156
|
size: itemModel.get('symbolSize') || symbolSize,
|
|
156
157
|
symbol: itemModel.get('symbol')
|
|
157
158
|
});
|
|
159
|
+
// !colorMapping[color as any] && (colorMapping[color as any] = 1);
|
|
158
160
|
}
|
|
161
|
+
// const isGradient = Object.keys(colorMapping).length > 10;
|
|
159
162
|
for (var i = 0; i < pointInfos.length; i++) {
|
|
160
163
|
var pointInfo = pointInfos[i];
|
|
161
164
|
var isRawFirst = pointInfo.isRawFirst,
|
|
@@ -225,10 +228,15 @@ var linesPlotLayout = {
|
|
|
225
228
|
linePointsByKey[key] = points;
|
|
226
229
|
lastKey = key;
|
|
227
230
|
}
|
|
228
|
-
|
|
231
|
+
var layout = {
|
|
229
232
|
linePointsByKey: linePointsByKey,
|
|
230
233
|
symbolPointsByColor: symbolPointsByColor
|
|
231
|
-
}
|
|
234
|
+
};
|
|
235
|
+
// if (isGradient) {
|
|
236
|
+
// layout.isGradient = true;
|
|
237
|
+
// layout.pointInfos = pointInfos;
|
|
238
|
+
// }
|
|
239
|
+
lineData.setLayout(layout);
|
|
232
240
|
}
|
|
233
241
|
};
|
|
234
242
|
}
|
|
@@ -102,8 +102,10 @@ export default function axisTrigger(payload, ecModel, api) {
|
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
var inputAxisInfo = findInputAxisInfo(inputAxesInfo, axisInfo);
|
|
105
|
+
// todo x轴匹配上了则认为有值
|
|
106
|
+
var isXInclude = axis.dim === 'x' && (inputAxisInfo === null || inputAxisInfo === void 0 ? void 0 : inputAxisInfo.value) !== void 0;
|
|
105
107
|
// If no inputAxesInfo, no axis is restricted.
|
|
106
|
-
if (!shouldHide && coordSysContainsPoint && (!inputAxesInfo || inputAxisInfo)) {
|
|
108
|
+
if (!shouldHide && (coordSysContainsPoint || isXInclude) && (!inputAxesInfo || inputAxisInfo)) {
|
|
107
109
|
var val = inputAxisInfo && inputAxisInfo.value;
|
|
108
110
|
if (val == null && !isIllegalPoint) {
|
|
109
111
|
val = axis.pointToData(point);
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
// pan or zoom, only dispatch one action for those data zoom
|
|
48
48
|
// components.
|
|
49
49
|
import RoamController from '../../component/helper/RoamController.js';
|
|
50
|
-
import * as throttleUtil from '../../util/throttle.js';
|
|
51
50
|
import { makeInner } from '../../util/model.js';
|
|
52
51
|
import { each, curry, createHashMap } from 'tvrender/lib/core/util.js';
|
|
53
52
|
import { collectReferCoordSysModelInfo } from './helper.js';
|
|
@@ -199,10 +198,8 @@ function dispatchAction(api, batch) {
|
|
|
199
198
|
batch: batch
|
|
200
199
|
});
|
|
201
200
|
});
|
|
202
|
-
// console.log('dispatchAction')
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
|
-
|
|
206
203
|
function containsPoint(coordSysModel, e, x, y) {
|
|
207
204
|
return coordSysModel.coordinateSystem.containPoint([x, y]);
|
|
208
205
|
}
|
|
@@ -289,10 +286,14 @@ export function installDataZoomRoamProcessor(registers) {
|
|
|
289
286
|
var controllerParams = mergeControllerParams(dataZoomInfoMap);
|
|
290
287
|
controller.enable(controllerParams.controlType, controllerParams.opt);
|
|
291
288
|
controller.setPointerChecker(coordSysRecord.containsPoint);
|
|
292
|
-
// todo 防抖直接去除看看影响大不大
|
|
293
|
-
throttleUtil.createOrUpdate(
|
|
294
|
-
//
|
|
295
|
-
'
|
|
289
|
+
// // todo 防抖直接去除看看影响大不大
|
|
290
|
+
// throttleUtil.createOrUpdate(
|
|
291
|
+
// coordSysRecord,
|
|
292
|
+
// 'dispatchAction',
|
|
293
|
+
// 30,
|
|
294
|
+
// // firstDzInfo.model.get('throttle', true),
|
|
295
|
+
// 'fixRate'
|
|
296
|
+
// );
|
|
296
297
|
});
|
|
297
298
|
});
|
|
298
299
|
}
|
package/lib/core/echarts.js
CHANGED
|
@@ -1591,6 +1591,12 @@ var ECharts = /** @class */function (_super) {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
// console.log('%c [ sereisModal ]-1815', 'font-size:13px; background:pink; color:#bf2c9f;',this._model, seriesModal);
|
|
1593
1593
|
};
|
|
1594
|
+
|
|
1595
|
+
ECharts.prototype.getXLastIndex = function () {
|
|
1596
|
+
var xAxisModal = this._model.getComponent('xAxis', 0);
|
|
1597
|
+
var scale = xAxisModal.axis.scale;
|
|
1598
|
+
return scale.getOrdinalMeta().getCategoriesSize() - 1;
|
|
1599
|
+
};
|
|
1594
1600
|
// A work around for no `internal` modifier in ts yet but
|
|
1595
1601
|
// need to strictly hide private methods to JS users.
|
|
1596
1602
|
ECharts.internalField = function () {
|
package/package.json
CHANGED
package/types/dist/echarts.d.ts
CHANGED
|
@@ -8407,6 +8407,7 @@ declare class ECharts extends Eventful<ECEventDefinition> {
|
|
|
8407
8407
|
scrollToDataIndex(dataIndex: number, animationDuration?: number): void;
|
|
8408
8408
|
scrollToTimestamp(timestamp: string, animationDuration?: number): void;
|
|
8409
8409
|
setMarkLabel(seriesName: string, data: IMarkLabelDataDir): void;
|
|
8410
|
+
getXLastIndex(): number;
|
|
8410
8411
|
private static internalField;
|
|
8411
8412
|
}
|
|
8412
8413
|
/**
|
package/types/dist/shared.d.ts
CHANGED
|
@@ -8408,6 +8408,7 @@ declare class ECharts extends Eventful<ECEventDefinition> {
|
|
|
8408
8408
|
scrollToDataIndex(dataIndex: number, animationDuration?: number): void;
|
|
8409
8409
|
scrollToTimestamp(timestamp: string, animationDuration?: number): void;
|
|
8410
8410
|
setMarkLabel(seriesName: string, data: IMarkLabelDataDir): void;
|
|
8411
|
+
getXLastIndex(): number;
|
|
8411
8412
|
private static internalField;
|
|
8412
8413
|
}
|
|
8413
8414
|
/**
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line path for bezier and straight line draw
|
|
3
|
+
*/
|
|
4
|
+
import * as graphic from '../../util/graphic.js';
|
|
5
|
+
import { PathProps } from 'tvrender/lib/graphic/Path.js';
|
|
6
|
+
import PathProxy from 'tvrender/lib/core/PathProxy.js';
|
|
7
|
+
declare class GradientBarShape {
|
|
8
|
+
points: {
|
|
9
|
+
point: number[];
|
|
10
|
+
color: string;
|
|
11
|
+
}[];
|
|
12
|
+
baseY: number;
|
|
13
|
+
width: number;
|
|
14
|
+
}
|
|
15
|
+
interface GradientBarProps extends PathProps {
|
|
16
|
+
shape: GradientBarShape;
|
|
17
|
+
}
|
|
18
|
+
declare class GradientBarPath extends graphic.Path<GradientBarProps> {
|
|
19
|
+
type: string;
|
|
20
|
+
shape: GradientBarShape;
|
|
21
|
+
constructor(opts?: GradientBarProps);
|
|
22
|
+
getDefaultStyle(): {
|
|
23
|
+
stroke: string;
|
|
24
|
+
fill: string;
|
|
25
|
+
};
|
|
26
|
+
getDefaultShape(): GradientBarShape;
|
|
27
|
+
buildPath(ctx: PathProxy, shape: GradientBarShape): void;
|
|
28
|
+
}
|
|
29
|
+
export default GradientBarPath;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line path for bezier and straight line draw
|
|
3
|
+
*/
|
|
4
|
+
import * as graphic from '../../util/graphic.js';
|
|
5
|
+
import { PathProps } from 'tvrender/lib/graphic/Path.js';
|
|
6
|
+
import PathProxy from 'tvrender/lib/core/PathProxy.js';
|
|
7
|
+
declare class GradientHistogramPlotShape {
|
|
8
|
+
points: {
|
|
9
|
+
point: number[];
|
|
10
|
+
color: string;
|
|
11
|
+
}[];
|
|
12
|
+
baseY: number;
|
|
13
|
+
}
|
|
14
|
+
interface GradientHistogramPlotProps extends PathProps {
|
|
15
|
+
shape: GradientHistogramPlotShape;
|
|
16
|
+
}
|
|
17
|
+
declare class GradientHistogramPlotPath extends graphic.Path<GradientHistogramPlotProps> {
|
|
18
|
+
type: string;
|
|
19
|
+
shape: GradientHistogramPlotShape;
|
|
20
|
+
constructor(opts?: GradientHistogramPlotProps);
|
|
21
|
+
getDefaultStyle(): {
|
|
22
|
+
stroke: string;
|
|
23
|
+
fill: string;
|
|
24
|
+
};
|
|
25
|
+
getDefaultShape(): GradientHistogramPlotShape;
|
|
26
|
+
buildPath(ctx: PathProxy, shape: GradientHistogramPlotShape): void;
|
|
27
|
+
}
|
|
28
|
+
export default GradientHistogramPlotPath;
|
|
@@ -313,6 +313,7 @@ declare class ECharts extends Eventful<ECEventDefinition> {
|
|
|
313
313
|
scrollToDataIndex(dataIndex: number, animationDuration?: number): void;
|
|
314
314
|
scrollToTimestamp(timestamp: string, animationDuration?: number): void;
|
|
315
315
|
setMarkLabel(seriesName: string, data: IMarkLabelDataDir): void;
|
|
316
|
+
getXLastIndex(): number;
|
|
316
317
|
private static internalField;
|
|
317
318
|
}
|
|
318
319
|
/**
|
|
@@ -1,207 +0,0 @@
|
|
|
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
|
-
/* global Float32Array */
|
|
45
|
-
import createRenderPlanner from '../helper/createRenderPlanner.js';
|
|
46
|
-
import { error } from '../../util/log.js';
|
|
47
|
-
import { map } from 'tvrender/lib/core/util.js';
|
|
48
|
-
import { getFormatColor } from '../../util/format.js';
|
|
49
|
-
// import { createFloat32Array } from '../../util/vendor.js';
|
|
50
|
-
function optimizePixels(point) {
|
|
51
|
-
point[0] = point[0] + 0.5;
|
|
52
|
-
return point;
|
|
53
|
-
}
|
|
54
|
-
function optimizeStepPoint(point, lineWidth) {
|
|
55
|
-
point[0] = lineWidth % 2 === 0 ? Math.floor(point[0]) : Math.floor(point[0]) + 0.5;
|
|
56
|
-
point[1] = lineWidth % 2 === 0 ? Math.floor(point[1]) : Math.floor(point[1]) + 0.5;
|
|
57
|
-
// return lineWidth % 2 === 0 ? Math.floor(y) : Math.floor(y) + 0.5;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var linesPlotLayout = {
|
|
61
|
-
seriesType: 'linesPlot',
|
|
62
|
-
plan: createRenderPlanner(),
|
|
63
|
-
reset: function (seriesModel) {
|
|
64
|
-
var coordSys = seriesModel.coordinateSystem;
|
|
65
|
-
if (!coordSys) {
|
|
66
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
67
|
-
error('The lines series must have a coordinate system.');
|
|
68
|
-
}
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
var data = seriesModel.getData();
|
|
72
|
-
// const pipelineContext = seriesModel.pipelineContext;
|
|
73
|
-
var dims = map(coordSys.dimensions, function (dim) {
|
|
74
|
-
return data.mapDimension(dim);
|
|
75
|
-
}).slice(0, 2);
|
|
76
|
-
var store = data.getStore();
|
|
77
|
-
var dimIdx0 = data.getDimensionIndex(dims[0]);
|
|
78
|
-
var dimIdx1 = data.getDimensionIndex(dims[1]);
|
|
79
|
-
// const isPolyline = seriesModel.get('polyline');
|
|
80
|
-
// const isLarge = seriesModel.pipelineContext.large;
|
|
81
|
-
var connectNulls = seriesModel.get('connectNulls');
|
|
82
|
-
var step = seriesModel.get('step');
|
|
83
|
-
var isSingle = seriesModel.get('histogramVisible') || seriesModel.get('barVisible');
|
|
84
|
-
var symbolByStep = seriesModel.get('symbolByStep');
|
|
85
|
-
var xOffset = seriesModel.get('offset') || 0;
|
|
86
|
-
var symbolVisible = seriesModel.get('symbolVisible');
|
|
87
|
-
var symbolSize = seriesModel.get('symbolSize');
|
|
88
|
-
var showLast = seriesModel.get('showLast');
|
|
89
|
-
var barVisible = seriesModel.get('barVisible');
|
|
90
|
-
// const globalSymbol = seriesModel.get('symbol')
|
|
91
|
-
return {
|
|
92
|
-
progress: function (params, lineData) {
|
|
93
|
-
// const lineCoords: number[][] = [];
|
|
94
|
-
// const segCount = params.end - params.start;
|
|
95
|
-
// const symbolPoints = createFloat32Array(segCount * 2);
|
|
96
|
-
var linePointsByKey = {};
|
|
97
|
-
var symbolPointsByColor = {};
|
|
98
|
-
// const allLinePoints = [];
|
|
99
|
-
var lastKey = '';
|
|
100
|
-
// let offset = 0;
|
|
101
|
-
var defaultColor = 'transparent';
|
|
102
|
-
function setSymbolPoint(point, index) {
|
|
103
|
-
var _a;
|
|
104
|
-
if (!symbolVisible) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
var dataModal = lineData.getItemModel(index);
|
|
108
|
-
var symbolColor = (_a = dataModal.get('itemStyle')) === null || _a === void 0 ? void 0 : _a.color;
|
|
109
|
-
if (!symbolColor) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
var symbol = dataModal.get('symbol');
|
|
113
|
-
// const symbolSize = dataModal.get("symbolSize");
|
|
114
|
-
var symbolKey = "" + symbol;
|
|
115
|
-
var symbolData = symbolPointsByColor[symbolKey] || [];
|
|
116
|
-
symbolData.push({
|
|
117
|
-
point: point,
|
|
118
|
-
size: dataModal.get('symbolSize') || symbolSize,
|
|
119
|
-
color: symbolColor ? getFormatColor(symbolColor).color : symbolColor
|
|
120
|
-
});
|
|
121
|
-
symbolPointsByColor[symbolKey] = symbolData;
|
|
122
|
-
}
|
|
123
|
-
var lastIndex = data.count(true) - 1;
|
|
124
|
-
for (var i = params.start; i < params.end; i++) {
|
|
125
|
-
if (showLast && lastIndex - data.getRawIndex(i) >= showLast) {
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
var isRawLast = i + 1 === params.end ? data.getRawIndex(i) === lastIndex : false;
|
|
129
|
-
var isRawFirst = i === 0 ? data.getRawIndex(i) === 0 : false;
|
|
130
|
-
var x = store.get(dimIdx0, i);
|
|
131
|
-
var y = store.get(dimIdx1, i);
|
|
132
|
-
var point = barVisible ? coordSys.dataToPoint([x + xOffset, y]) : optimizePixels(coordSys.dataToPoint([x + xOffset, y]));
|
|
133
|
-
if (symbolByStep ? connectNulls && isNaN(y) || isRawLast : true) {
|
|
134
|
-
// symbolPoints[offset++] = point[0];
|
|
135
|
-
// symbolPoints[offset++] = point[1];
|
|
136
|
-
setSymbolPoint(point, i);
|
|
137
|
-
}
|
|
138
|
-
if (connectNulls && isNaN(y)) {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
var isStep = step && !isRawFirst && !isRawLast;
|
|
142
|
-
// Let coordinate system to handle the NaN data.
|
|
143
|
-
var nextPoint = [];
|
|
144
|
-
// pts[1] = coordSys.dataToPoint([nextX, nextY]);
|
|
145
|
-
if (!isSingle && isRawLast) {
|
|
146
|
-
var lastPoints = linePointsByKey[lastKey] || [];
|
|
147
|
-
if (isStep && Array.isArray(lastPoints[lastPoints.length - 1])) {
|
|
148
|
-
point[1] = lastPoints[lastPoints.length - 1][1];
|
|
149
|
-
}
|
|
150
|
-
lastPoints.push(point);
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
if (isStep) {
|
|
154
|
-
var nextX = store.get(dimIdx0, i + 1);
|
|
155
|
-
var nextY = store.get(dimIdx1, i + 1);
|
|
156
|
-
while (connectNulls && isNaN(nextY) && i < params.end) {
|
|
157
|
-
i++;
|
|
158
|
-
nextX = store.get(dimIdx0, i + 1);
|
|
159
|
-
nextY = store.get(dimIdx1, i + 1);
|
|
160
|
-
}
|
|
161
|
-
nextPoint = optimizePixels(coordSys.dataToPoint([nextX + xOffset, nextY]));
|
|
162
|
-
var midX = (point[0] + nextPoint[0]) / 2;
|
|
163
|
-
point[0] = midX;
|
|
164
|
-
point[1] = Math.floor(point[1]);
|
|
165
|
-
nextPoint[0] = midX;
|
|
166
|
-
}
|
|
167
|
-
var itemModel = lineData.getItemModel(isSingle ? i : i + 1);
|
|
168
|
-
var _a = itemModel.get('lineStyle'),
|
|
169
|
-
color = _a.color,
|
|
170
|
-
_b = _a.type,
|
|
171
|
-
type = _b === void 0 ? 'solid' : _b,
|
|
172
|
-
_c = _a.width,
|
|
173
|
-
width = _c === void 0 ? '1' : _c;
|
|
174
|
-
var key = (color || defaultColor) + ":" + type + ":" + width;
|
|
175
|
-
var points = linePointsByKey[key] || [];
|
|
176
|
-
if (!isSingle && lastKey !== key) {
|
|
177
|
-
if (lastKey) {
|
|
178
|
-
var lastPoints = linePointsByKey[lastKey];
|
|
179
|
-
lastPoints.push(point);
|
|
180
|
-
}
|
|
181
|
-
points.push(0);
|
|
182
|
-
}
|
|
183
|
-
points.push(point);
|
|
184
|
-
if (isStep) {
|
|
185
|
-
optimizeStepPoint(point, +width);
|
|
186
|
-
optimizeStepPoint(nextPoint, +width);
|
|
187
|
-
points.push(nextPoint);
|
|
188
|
-
if (symbolByStep) {
|
|
189
|
-
// symbolPoints[offset++] = nextPoint[0];
|
|
190
|
-
// symbolPoints[offset++] = nextPoint[1];
|
|
191
|
-
setSymbolPoint(nextPoint, i + 1);
|
|
192
|
-
}
|
|
193
|
-
// allLinePoints.push(nextPoint);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
linePointsByKey[key] = points;
|
|
197
|
-
lastKey = key;
|
|
198
|
-
}
|
|
199
|
-
lineData.setLayout({
|
|
200
|
-
linePointsByKey: linePointsByKey,
|
|
201
|
-
symbolPointsByColor: symbolPointsByColor
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
export default linesPlotLayout;
|