tvcharts 0.8.77 → 0.8.79
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.
|
@@ -346,6 +346,9 @@ var LinesPlotView = /** @class */function (_super) {
|
|
|
346
346
|
var z2_2 = seriesModel.get('z2');
|
|
347
347
|
var baseY_1 = seriesModel.coordinateSystem.dataToPoint([0, histbase], true)[1];
|
|
348
348
|
var visualColor_2 = getAreaGradient(data, seriesModel, api);
|
|
349
|
+
var connectNulls_2 = seriesModel.get('connectNulls');
|
|
350
|
+
var step_2 = seriesModel.get('step');
|
|
351
|
+
var barSpace_2 = Math.floor((seriesModel.coordinateSystem.getAxesByScale('ordinal')[0].scale.barSpace || calculatebandWidth(seriesModel, data)) * 0.8) || 1;
|
|
349
352
|
each(linePointsByKey, function (item, key) {
|
|
350
353
|
var stroke = key.split(':')[0];
|
|
351
354
|
var _a = getFormatColor(stroke),
|
|
@@ -354,7 +357,9 @@ var LinesPlotView = /** @class */function (_super) {
|
|
|
354
357
|
var el = new PolyPlotPath({
|
|
355
358
|
shape: {
|
|
356
359
|
points: item,
|
|
357
|
-
baseY: baseY_1
|
|
360
|
+
baseY: baseY_1,
|
|
361
|
+
connectSelf: !connectNulls_2 && !step_2,
|
|
362
|
+
barWidth: barSpace_2
|
|
358
363
|
},
|
|
359
364
|
style: {
|
|
360
365
|
stroke: 'none',
|
|
@@ -78,7 +78,46 @@ var PolyPlotPath = /** @class */function (_super) {
|
|
|
78
78
|
};
|
|
79
79
|
PolyPlotPath.prototype.buildPath = function (ctx, shape) {
|
|
80
80
|
var points = shape.points,
|
|
81
|
-
baseY = shape.baseY
|
|
81
|
+
baseY = shape.baseY,
|
|
82
|
+
connectSelf = shape.connectSelf,
|
|
83
|
+
barWidth = shape.barWidth;
|
|
84
|
+
if (connectSelf) {
|
|
85
|
+
var offset = barWidth / 2;
|
|
86
|
+
var isMove = false;
|
|
87
|
+
var lastExistIndex = -1;
|
|
88
|
+
for (var index = 0; index < points.length; index++) {
|
|
89
|
+
var point = points[index];
|
|
90
|
+
if (point === 0 || isPointNull(point)) {
|
|
91
|
+
isMove = true;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
var _a = point,
|
|
95
|
+
x = _a[0],
|
|
96
|
+
y = _a[1];
|
|
97
|
+
var nextPoint = points[index + 1];
|
|
98
|
+
var nextIsNull = !nextPoint || nextPoint === 0 || isPointNull(nextPoint);
|
|
99
|
+
if (lastExistIndex < 0 || isMove) {
|
|
100
|
+
ctx.moveTo(x - offset, y);
|
|
101
|
+
if (nextIsNull) {
|
|
102
|
+
ctx.lineTo(x + offset, y);
|
|
103
|
+
ctx.lineTo(x + offset, baseY);
|
|
104
|
+
ctx.lineTo(x - offset, baseY);
|
|
105
|
+
ctx.lineTo(x - offset, y);
|
|
106
|
+
}
|
|
107
|
+
isMove = false;
|
|
108
|
+
} else {
|
|
109
|
+
ctx.lineTo(x + offset, y);
|
|
110
|
+
if (nextIsNull) {
|
|
111
|
+
ctx.lineTo(x + offset, baseY);
|
|
112
|
+
var startPoint = points[lastExistIndex];
|
|
113
|
+
ctx.lineTo(startPoint[0] - x, baseY);
|
|
114
|
+
ctx.lineTo(startPoint[0] - x, startPoint[1]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
lastExistIndex = index;
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
82
121
|
var startIndex = 0;
|
|
83
122
|
for (var index = 0; index < points.length; index++) {
|
|
84
123
|
var point = points[index];
|
|
@@ -96,16 +135,16 @@ var PolyPlotPath = /** @class */function (_super) {
|
|
|
96
135
|
if (!nextPoint) {
|
|
97
136
|
continue;
|
|
98
137
|
}
|
|
99
|
-
var
|
|
100
|
-
x_1 =
|
|
101
|
-
y_1 =
|
|
138
|
+
var _b = nextPoint,
|
|
139
|
+
x_1 = _b[0],
|
|
140
|
+
y_1 = _b[1];
|
|
102
141
|
ctx.moveTo(x_1, y_1);
|
|
103
142
|
startIndex = index;
|
|
104
143
|
continue;
|
|
105
144
|
}
|
|
106
|
-
var
|
|
107
|
-
x =
|
|
108
|
-
y =
|
|
145
|
+
var _c = point,
|
|
146
|
+
x = _c[0],
|
|
147
|
+
y = _c[1];
|
|
109
148
|
ctx.lineTo(x, y);
|
|
110
149
|
if (index === points.length - 1) {
|
|
111
150
|
ctx.lineTo(points[index][0], baseY);
|
package/package.json
CHANGED
|
@@ -6,6 +6,8 @@ import { PathProps } from 'tvrender/lib/graphic/Path.js';
|
|
|
6
6
|
declare class PolyPlotShape {
|
|
7
7
|
points: (number | number[])[];
|
|
8
8
|
baseY: number;
|
|
9
|
+
connectSelf?: boolean;
|
|
10
|
+
barWidth?: number;
|
|
9
11
|
}
|
|
10
12
|
interface EPolyPlotPathProps extends PathProps {
|
|
11
13
|
shape: PolyPlotShape;
|