tvcharts 0.6.95 → 0.6.97
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/minePolyLines/MinePolyLinesLayout.js +6 -5
- package/lib/chart/minePolyLines/MinePolyLinesSeries.js +1 -0
- package/lib/chart/minePolyLines/MinePolyLinesView.js +10 -5
- package/lib/chart/minePolyLines/PolyLinesPath.js +98 -19
- package/lib/component/axisPointer/axisTrigger.js +4 -0
- package/lib/component/marker/MarkLabelView.js +6 -4
- package/package.json +1 -1
- package/types/src/chart/minePolyLines/MinePolyLinesSeries.d.ts +1 -1
- package/types/src/chart/minePolyLines/PolyLinesPath.d.ts +3 -1
|
@@ -60,7 +60,7 @@ var MinePolyLinesLayout = {
|
|
|
60
60
|
return {
|
|
61
61
|
progress: function (params, minePolyLinesData) {
|
|
62
62
|
// const store = minePolyLinesData.getStore();
|
|
63
|
-
var
|
|
63
|
+
var linesPointLayouts = [];
|
|
64
64
|
var _loop_1 = function (i) {
|
|
65
65
|
var itemModel = data.getItemModel(i);
|
|
66
66
|
var _a = itemModel.get('itemStyle'),
|
|
@@ -77,21 +77,22 @@ var MinePolyLinesLayout = {
|
|
|
77
77
|
return "continue";
|
|
78
78
|
}
|
|
79
79
|
var key = color + ":" + width + ":" + lineStyle + ":" + fill + ":" + closed_1 + ":" + curved;
|
|
80
|
-
var linePoints = linesPointById[key] || [];
|
|
81
80
|
var points = itemModel.get('points');
|
|
82
81
|
var itemPoints = [];
|
|
83
82
|
each(points, function (item) {
|
|
84
83
|
var point = coordSys.dataToPoint(item);
|
|
85
84
|
itemPoints.push(point);
|
|
86
85
|
});
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
linesPointLayouts.push({
|
|
87
|
+
key: key,
|
|
88
|
+
points: itemPoints
|
|
89
|
+
});
|
|
89
90
|
};
|
|
90
91
|
for (var i = params.start; i < params.end; i++) {
|
|
91
92
|
_loop_1(i);
|
|
92
93
|
}
|
|
93
94
|
data.setLayout({
|
|
94
|
-
|
|
95
|
+
linesPointLayouts: linesPointLayouts
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
};
|
|
@@ -46,6 +46,7 @@ import { __extends } from "tslib";
|
|
|
46
46
|
import SeriesModel from '../../model/Series.js';
|
|
47
47
|
import createSeriesData from '../helper/createSeriesData.js';
|
|
48
48
|
import * as zrUtil from 'tvrender/lib/core/util.js';
|
|
49
|
+
;
|
|
49
50
|
var MinePolyLinesSeriesModel = /** @class */function (_super) {
|
|
50
51
|
__extends(MinePolyLinesSeriesModel, _super);
|
|
51
52
|
function MinePolyLinesSeriesModel() {
|
|
@@ -90,8 +90,10 @@ var MinePolyLinesView = /** @class */function (_super) {
|
|
|
90
90
|
}
|
|
91
91
|
var linesGroup = this._linesGroup;
|
|
92
92
|
var z2 = seriesModel.get('z2');
|
|
93
|
-
var
|
|
94
|
-
each(
|
|
93
|
+
var linesPointLayouts = data.getLayout('linesPointLayouts');
|
|
94
|
+
each(linesPointLayouts, function (item) {
|
|
95
|
+
var key = item.key,
|
|
96
|
+
points = item.points;
|
|
95
97
|
var _a = key.split(':'),
|
|
96
98
|
color = _a[0],
|
|
97
99
|
width = _a[1],
|
|
@@ -99,11 +101,14 @@ var MinePolyLinesView = /** @class */function (_super) {
|
|
|
99
101
|
fill = _a[3],
|
|
100
102
|
closed = _a[4],
|
|
101
103
|
curved = _a[5];
|
|
104
|
+
var isCurved = curved === 'true';
|
|
105
|
+
var isClosed = closed === 'true';
|
|
102
106
|
var el = new PolyLinesPath({
|
|
103
107
|
shape: {
|
|
104
|
-
points:
|
|
105
|
-
closed:
|
|
106
|
-
curved:
|
|
108
|
+
points: points,
|
|
109
|
+
closed: isClosed,
|
|
110
|
+
curved: isCurved,
|
|
111
|
+
lineStyle: lineStyle
|
|
107
112
|
},
|
|
108
113
|
style: {
|
|
109
114
|
fill: fill,
|
|
@@ -46,11 +46,86 @@ import { __extends } from "tslib";
|
|
|
46
46
|
// TODO Batch by color
|
|
47
47
|
import * as graphic from '../../util/graphic.js';
|
|
48
48
|
import smoothBezier from 'tvrender/lib/graphic/helper/smoothBezier.js';
|
|
49
|
+
import { getArrowPoints } from '../mineLines/util.js';
|
|
49
50
|
// const BOOST_SIZE_THRESHOLD = 4;
|
|
50
51
|
var PolyLinesPathShape = /** @class */function () {
|
|
51
52
|
function PolyLinesPathShape() {}
|
|
52
53
|
return PolyLinesPathShape;
|
|
53
54
|
}();
|
|
55
|
+
function drawArrow(params) {
|
|
56
|
+
var lineStyle = params.lineStyle,
|
|
57
|
+
path = params.path,
|
|
58
|
+
polyPoints = params.polyPoints;
|
|
59
|
+
if (polyPoints.length < 2) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var lastIndex = polyPoints.length - 1;
|
|
63
|
+
switch (lineStyle) {
|
|
64
|
+
case 'style_arrow_left':
|
|
65
|
+
{
|
|
66
|
+
var points = getArrowPoints(polyPoints[1][0], polyPoints[1][1], polyPoints[0][0], polyPoints[0][1]);
|
|
67
|
+
if (!points) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
var x1 = points[0],
|
|
71
|
+
y1 = points[1],
|
|
72
|
+
x2 = points[2],
|
|
73
|
+
y2 = points[3],
|
|
74
|
+
x3 = points[4],
|
|
75
|
+
y3 = points[5];
|
|
76
|
+
path.moveTo(x1, y1);
|
|
77
|
+
path.lineTo(x2, y2);
|
|
78
|
+
path.lineTo(x3, y3);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case 'style_arrow_right':
|
|
82
|
+
{
|
|
83
|
+
var points = getArrowPoints(polyPoints[lastIndex - 1][0], polyPoints[lastIndex - 1][1], polyPoints[lastIndex][0], polyPoints[lastIndex][1]);
|
|
84
|
+
if (!points) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
var x1 = points[0],
|
|
88
|
+
y1 = points[1],
|
|
89
|
+
x2 = points[2],
|
|
90
|
+
y2 = points[3],
|
|
91
|
+
x3 = points[4],
|
|
92
|
+
y3 = points[5];
|
|
93
|
+
path.moveTo(x1, y1);
|
|
94
|
+
path.lineTo(x2, y2);
|
|
95
|
+
path.lineTo(x3, y3);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case 'style_arrow_both':
|
|
99
|
+
{
|
|
100
|
+
var points = getArrowPoints(polyPoints[1][0], polyPoints[1][1], polyPoints[0][0], polyPoints[0][1]);
|
|
101
|
+
if (!points) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
var lx1 = points[0],
|
|
105
|
+
ly1 = points[1],
|
|
106
|
+
lx2 = points[2],
|
|
107
|
+
ly2 = points[3],
|
|
108
|
+
lx3 = points[4],
|
|
109
|
+
ly3 = points[5];
|
|
110
|
+
path.moveTo(lx1, ly1);
|
|
111
|
+
path.lineTo(lx2, ly2);
|
|
112
|
+
path.lineTo(lx3, ly3);
|
|
113
|
+
var _a = getArrowPoints(polyPoints[lastIndex - 1][0], polyPoints[lastIndex - 1][1], polyPoints[lastIndex][0], polyPoints[lastIndex][1]),
|
|
114
|
+
x1 = _a[0],
|
|
115
|
+
y1 = _a[1],
|
|
116
|
+
x2 = _a[2],
|
|
117
|
+
y2 = _a[3],
|
|
118
|
+
x3 = _a[4],
|
|
119
|
+
y3 = _a[5];
|
|
120
|
+
path.moveTo(x1, y1);
|
|
121
|
+
path.lineTo(x2, y2);
|
|
122
|
+
path.lineTo(x3, y3);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
default:
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
54
129
|
var PolyLinesPath = /** @class */function (_super) {
|
|
55
130
|
__extends(PolyLinesPath, _super);
|
|
56
131
|
// private _ctx: CanvasRenderingContext2D;
|
|
@@ -63,27 +138,31 @@ var PolyLinesPath = /** @class */function (_super) {
|
|
|
63
138
|
PolyLinesPath.prototype.buildPath = function (ctx, shape) {
|
|
64
139
|
var points = shape.points,
|
|
65
140
|
closed = shape.closed,
|
|
66
|
-
curved = shape.curved
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
141
|
+
curved = shape.curved,
|
|
142
|
+
lineStyle = shape.lineStyle;
|
|
143
|
+
var polyPoints = points;
|
|
144
|
+
if (curved) {
|
|
145
|
+
var controlPoints = smoothBezier(polyPoints, 0.8, closed);
|
|
146
|
+
ctx.moveTo(polyPoints[0][0], polyPoints[0][1]);
|
|
147
|
+
var len = polyPoints.length;
|
|
148
|
+
for (var i = 0; i < (closed ? len : len - 1); i++) {
|
|
149
|
+
var cp1 = controlPoints[i * 2];
|
|
150
|
+
var cp2 = controlPoints[i * 2 + 1];
|
|
151
|
+
var p = polyPoints[(i + 1) % len];
|
|
152
|
+
ctx.bezierCurveTo(cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]);
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
ctx.moveTo(polyPoints[0][0], polyPoints[0][1]);
|
|
156
|
+
for (var i = 1, l = polyPoints.length; i < l; i++) {
|
|
157
|
+
ctx.lineTo(polyPoints[i][0], polyPoints[i][1]);
|
|
84
158
|
}
|
|
85
|
-
closed && ctx.closePath();
|
|
86
159
|
}
|
|
160
|
+
closed && ctx.closePath();
|
|
161
|
+
drawArrow({
|
|
162
|
+
lineStyle: lineStyle,
|
|
163
|
+
path: ctx,
|
|
164
|
+
polyPoints: polyPoints
|
|
165
|
+
});
|
|
87
166
|
};
|
|
88
167
|
return PolyLinesPath;
|
|
89
168
|
}(graphic.Path);
|
|
@@ -146,6 +146,10 @@ export default function axisTrigger(payload, ecModel, api) {
|
|
|
146
146
|
if (outputPayload.dataIndex === void 0 && outputPayload.axesInfo.length) {
|
|
147
147
|
outputPayload.dataIndex = +outputPayload.axesInfo[0].value;
|
|
148
148
|
}
|
|
149
|
+
if (outputPayload.seriesIndex !== undefined && outputPayload.axesInfo.length) {
|
|
150
|
+
outputPayload.dataIndexInside = void 0;
|
|
151
|
+
outputPayload.dataIndex = +outputPayload.axesInfo[0].value;
|
|
152
|
+
}
|
|
149
153
|
// if (payload.isConnect && outputPayload.axesInfo.length) {
|
|
150
154
|
// outputPayload.axesInfo = filter(outputPayload.axesInfo, function (item) {
|
|
151
155
|
// return item.axisDim !== 'y';
|
|
@@ -666,15 +666,16 @@ function createLabel(_a) {
|
|
|
666
666
|
zlevel: zlevel,
|
|
667
667
|
ignore: !showTitle
|
|
668
668
|
});
|
|
669
|
+
var lineY = Math.floor(y) + 0.5;
|
|
669
670
|
var lineEl = new graphicUtil.Line({
|
|
670
671
|
style: Object.assign(lineStyle, labelTextStyle.backgroundColor ? {
|
|
671
672
|
stroke: labelTextStyle.backgroundColor
|
|
672
673
|
} : {}),
|
|
673
674
|
shape: {
|
|
674
675
|
x1: showTitle && isLeft ? gridRect.x + 2 : gridRect.x,
|
|
675
|
-
y1:
|
|
676
|
+
y1: lineY,
|
|
676
677
|
x2: showTitle && !isLeft ? gridRect.x + gridRect.width - 2 : gridRect.x + gridRect.width,
|
|
677
|
-
y2:
|
|
678
|
+
y2: lineY
|
|
678
679
|
},
|
|
679
680
|
z: 100,
|
|
680
681
|
// zlevel,
|
|
@@ -727,12 +728,13 @@ function updateLabel(_a) {
|
|
|
727
728
|
element.ignore = true;
|
|
728
729
|
return;
|
|
729
730
|
}
|
|
731
|
+
var lineY = Math.floor(y) + 0.5;
|
|
730
732
|
element.attr({
|
|
731
733
|
shape: {
|
|
732
734
|
x1: showTitle && isLeft ? gridRect.x + 2 : gridRect.x,
|
|
733
|
-
y1:
|
|
735
|
+
y1: lineY,
|
|
734
736
|
x2: showTitle && !isLeft ? gridRect.x + gridRect.width - 2 : gridRect.x + gridRect.width,
|
|
735
|
-
y2:
|
|
737
|
+
y2: lineY
|
|
736
738
|
},
|
|
737
739
|
style: Object.assign(lineStyle, labelTextStyle.backgroundColor ? {
|
|
738
740
|
stroke: labelTextStyle.backgroundColor
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ declare type LinesValue = OptionDataValue | OptionDataValue[];
|
|
|
5
5
|
interface LinesStatesMixin {
|
|
6
6
|
emphasis?: DefaultStatesMixinEmphasis;
|
|
7
7
|
}
|
|
8
|
-
export declare type ILineStyle = 'style_dashed' | 'style_dotted' | 'style_solid';
|
|
8
|
+
export declare type ILineStyle = 'style_arrow_both' | 'style_arrow_left' | 'style_arrow_right' | 'style_dashed' | 'style_dotted' | 'style_solid';
|
|
9
9
|
export interface LinesStateOption {
|
|
10
10
|
id: string;
|
|
11
11
|
itemStyle?: {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as graphic from '../../util/graphic.js';
|
|
2
2
|
import { PathProps } from 'tvrender/lib/graphic/Path.js';
|
|
3
3
|
import PathProxy from 'tvrender/lib/core/PathProxy.js';
|
|
4
|
+
import { ILineStyle } from './MinePolyLinesSeries.js';
|
|
4
5
|
declare class PolyLinesPathShape {
|
|
5
|
-
points: number[][]
|
|
6
|
+
points: number[][];
|
|
6
7
|
closed: boolean;
|
|
7
8
|
curved: boolean;
|
|
9
|
+
lineStyle: ILineStyle;
|
|
8
10
|
}
|
|
9
11
|
declare type PolyLinesPathProps = PathProps & {
|
|
10
12
|
shape?: Partial<PolyLinesPathShape>;
|