tvcharts 0.7.74 → 0.7.76
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/labels/SymbolPath.js +2 -0
- 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 +5 -2
- package/lib/component/dataZoom/roams.js +8 -7
- package/lib/component/marker/MarkLabelView.js +1 -1
- package/lib/data/OrdinalMeta.js +22 -5
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +4 -2
- package/types/dist/shared.d.ts +4 -2
- package/types/src/chart/linesPlot/GradientBarPath.d.ts +29 -0
- package/types/src/chart/linesPlot/GradientHistogramPlotPath.d.ts +28 -0
- package/types/src/data/OrdinalMeta.d.ts +4 -2
- 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;
|
|
@@ -82,6 +82,8 @@ var SymbolPath = /** @class */function (_super) {
|
|
|
82
82
|
if (isNaN(x) || isNaN(y)) {
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
|
+
// const isNextSameColor = points[i + 1] && color === points[i + 1].color;
|
|
86
|
+
// const isPrevSameColor = points[i - 1] && color === points[i - 1].color;
|
|
85
87
|
var xOffset = offset[0],
|
|
86
88
|
yOffset = offset[1];
|
|
87
89
|
path.beginPathFill();
|
|
@@ -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);
|
|
@@ -336,8 +338,9 @@ function updateModelActually(showValueMap, axesInfo, outputPayload) {
|
|
|
336
338
|
var ordinalMeta = scale.getOrdinalMeta();
|
|
337
339
|
var categories = ordinalMeta.getCategories();
|
|
338
340
|
info.time = categories[info.value];
|
|
339
|
-
info.interval = ordinalMeta.interval;
|
|
341
|
+
// info.interval = ordinalMeta.interval;
|
|
340
342
|
}
|
|
343
|
+
|
|
341
344
|
outputAxesInfo.push(info);
|
|
342
345
|
}
|
|
343
346
|
});
|
|
@@ -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
|
}
|
|
@@ -491,7 +491,7 @@ var MarkLabelView = /** @class */function (_super) {
|
|
|
491
491
|
el.attr('style', {
|
|
492
492
|
text: text
|
|
493
493
|
});
|
|
494
|
-
if (item.countDown.value && item.countDown.show) {
|
|
494
|
+
if (item.countDown.value > 0 && item.countDown.show) {
|
|
495
495
|
_this._labelCountDown(item, el, key);
|
|
496
496
|
} else {
|
|
497
497
|
el.ignore = true;
|
package/lib/data/OrdinalMeta.js
CHANGED
|
@@ -46,6 +46,18 @@ import { fillWeightsForPoints } from './scale-time/time-scale-point-weight-gener
|
|
|
46
46
|
import { findClosestTimestamp } from './scale-time/find-time-range.js';
|
|
47
47
|
var uidBase = 0;
|
|
48
48
|
// const ordinalMetaInstanceById: Record<string, OrdinalMeta> = {}
|
|
49
|
+
function convertToUTCDayStart(ts) {
|
|
50
|
+
var shifted = new Date(ts * 1000);
|
|
51
|
+
// ② 提取该日期的 UTC 年、月、日(因为 shifted 已经“落在”目标时区的日期中了)
|
|
52
|
+
var year = shifted.getUTCFullYear();
|
|
53
|
+
var month = shifted.getUTCMonth(); // 注意:月份从 0 开始
|
|
54
|
+
var day = shifted.getUTCDate();
|
|
55
|
+
// ③ 目标时区(UTC-8)的当地零点,在 UTC 下的时间戳应为:
|
|
56
|
+
// (“该日期 UTC 零点”)+ 8 小时
|
|
57
|
+
var localMidUTC = Date.UTC(year, month, day);
|
|
58
|
+
// 返回秒单位时间戳
|
|
59
|
+
return localMidUTC;
|
|
60
|
+
}
|
|
49
61
|
var OrdinalMeta = /** @class */function () {
|
|
50
62
|
function OrdinalMeta(opt) {
|
|
51
63
|
// private _timePoints: TimePoint[];
|
|
@@ -58,7 +70,8 @@ var OrdinalMeta = /** @class */function () {
|
|
|
58
70
|
this._deduplication = opt.deduplication;
|
|
59
71
|
// this._timePoints = opt.timePoints;
|
|
60
72
|
this._marksByWeight = opt.marksByWeight;
|
|
61
|
-
this.
|
|
73
|
+
this.dataInterval = opt.dataInterval;
|
|
74
|
+
this.utcOffsetTime = opt.utcOffsetTime;
|
|
62
75
|
this.cache = null;
|
|
63
76
|
this.uid = ++uidBase;
|
|
64
77
|
}
|
|
@@ -68,13 +81,14 @@ var OrdinalMeta = /** @class */function () {
|
|
|
68
81
|
var isSegmentedByTime = option.segmentedByTime;
|
|
69
82
|
var timePoints = [];
|
|
70
83
|
var marksByWeight = new HashMap();
|
|
84
|
+
var formatInterval = option.dataInterval === '1D';
|
|
71
85
|
// const windowId = axisModel.ecModel.get('windowId')
|
|
72
86
|
var addItem = function (value, index) {
|
|
73
|
-
var d =
|
|
87
|
+
var d = formatInterval ? convertToUTCDayStart(value - option.utcOffsetTime) : value * 1000;
|
|
74
88
|
timePoints.push({
|
|
75
89
|
originalTime: value,
|
|
76
90
|
index: index,
|
|
77
|
-
timestamp: d
|
|
91
|
+
timestamp: d / 1000
|
|
78
92
|
});
|
|
79
93
|
};
|
|
80
94
|
var categories = data && map(data, function (val, index) {
|
|
@@ -116,7 +130,8 @@ var OrdinalMeta = /** @class */function () {
|
|
|
116
130
|
loadMoreCategory: option.loadMoreCategory,
|
|
117
131
|
// timePoints,
|
|
118
132
|
marksByWeight: marksByWeight,
|
|
119
|
-
|
|
133
|
+
dataInterval: option.dataInterval,
|
|
134
|
+
utcOffsetTime: option.utcOffsetTime
|
|
120
135
|
});
|
|
121
136
|
// console.log('%c [ windowId ]-123', 'font-size:13px; background:pink; color:#bf2c9f;', windowId)
|
|
122
137
|
// if (windowId) {
|
|
@@ -146,6 +161,8 @@ var OrdinalMeta = /** @class */function () {
|
|
|
146
161
|
if (this.loadMoreCategory) {
|
|
147
162
|
var startTime = this.extraCategory[this.extraCategory.length - 1];
|
|
148
163
|
var moreCategory = this.loadMoreCategory(startTime, data.length);
|
|
164
|
+
var utcOffsetTime_1 = this.utcOffsetTime;
|
|
165
|
+
var formatInterval_1 = this.dataInterval === '1D';
|
|
149
166
|
moreCategory.unshift(startTime);
|
|
150
167
|
var timePoints_1 = [];
|
|
151
168
|
var startIndex_1 = this.categories.length + this.extraCategory.length - 1;
|
|
@@ -156,7 +173,7 @@ var OrdinalMeta = /** @class */function () {
|
|
|
156
173
|
timePoints_1.push({
|
|
157
174
|
originalTime: val,
|
|
158
175
|
index: index + startIndex_1,
|
|
159
|
-
timestamp: val
|
|
176
|
+
timestamp: formatInterval_1 ? convertToUTCDayStart(val - utcOffsetTime_1) / 1000 : val
|
|
160
177
|
});
|
|
161
178
|
});
|
|
162
179
|
var marksByWeight = this._marksByWeight;
|
package/package.json
CHANGED
package/types/dist/echarts.d.ts
CHANGED
|
@@ -2658,7 +2658,8 @@ declare class OrdinalMeta {
|
|
|
2658
2658
|
private _deduplication;
|
|
2659
2659
|
private _map;
|
|
2660
2660
|
private _appendCount;
|
|
2661
|
-
|
|
2661
|
+
dataInterval: string;
|
|
2662
|
+
utcOffsetTime?: number;
|
|
2662
2663
|
readonly uid: number;
|
|
2663
2664
|
constructor(opt: {
|
|
2664
2665
|
categories?: OrdinalRawValue[];
|
|
@@ -2666,7 +2667,8 @@ declare class OrdinalMeta {
|
|
|
2666
2667
|
loadMoreCategory?: (startTime: number, count: number) => number[];
|
|
2667
2668
|
needCollect?: boolean;
|
|
2668
2669
|
deduplication?: boolean;
|
|
2669
|
-
|
|
2670
|
+
dataInterval?: string;
|
|
2671
|
+
utcOffsetTime?: number;
|
|
2670
2672
|
marksByWeight?: HashMap<TimePoint[]>;
|
|
2671
2673
|
});
|
|
2672
2674
|
static createByAxisModel(axisModel: Model): OrdinalMeta;
|
package/types/dist/shared.d.ts
CHANGED
|
@@ -2658,7 +2658,8 @@ declare class OrdinalMeta {
|
|
|
2658
2658
|
private _deduplication;
|
|
2659
2659
|
private _map;
|
|
2660
2660
|
private _appendCount;
|
|
2661
|
-
|
|
2661
|
+
dataInterval: string;
|
|
2662
|
+
utcOffsetTime?: number;
|
|
2662
2663
|
readonly uid: number;
|
|
2663
2664
|
constructor(opt: {
|
|
2664
2665
|
categories?: OrdinalRawValue[];
|
|
@@ -2666,7 +2667,8 @@ declare class OrdinalMeta {
|
|
|
2666
2667
|
loadMoreCategory?: (startTime: number, count: number) => number[];
|
|
2667
2668
|
needCollect?: boolean;
|
|
2668
2669
|
deduplication?: boolean;
|
|
2669
|
-
|
|
2670
|
+
dataInterval?: string;
|
|
2671
|
+
utcOffsetTime?: number;
|
|
2670
2672
|
marksByWeight?: HashMap<TimePoint[]>;
|
|
2671
2673
|
});
|
|
2672
2674
|
static createByAxisModel(axisModel: Model): OrdinalMeta;
|
|
@@ -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;
|
|
@@ -16,7 +16,8 @@ declare class OrdinalMeta {
|
|
|
16
16
|
private _deduplication;
|
|
17
17
|
private _map;
|
|
18
18
|
private _appendCount;
|
|
19
|
-
|
|
19
|
+
dataInterval: string;
|
|
20
|
+
utcOffsetTime?: number;
|
|
20
21
|
readonly uid: number;
|
|
21
22
|
constructor(opt: {
|
|
22
23
|
categories?: OrdinalRawValue[];
|
|
@@ -24,7 +25,8 @@ declare class OrdinalMeta {
|
|
|
24
25
|
loadMoreCategory?: (startTime: number, count: number) => number[];
|
|
25
26
|
needCollect?: boolean;
|
|
26
27
|
deduplication?: boolean;
|
|
27
|
-
|
|
28
|
+
dataInterval?: string;
|
|
29
|
+
utcOffsetTime?: number;
|
|
28
30
|
marksByWeight?: HashMap<TimePoint[]>;
|
|
29
31
|
});
|
|
30
32
|
static createByAxisModel(axisModel: Model): OrdinalMeta;
|
|
@@ -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;
|