tvcharts 0.9.16 → 0.9.18
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/component/events/EventsView.js +10 -2
- package/lib/component/marker/MarkLabelView.js +64 -31
- package/lib/util/color.js +24 -1
- package/lib/util/seriesType.js +1 -1
- package/lib/util/states.js +1 -1
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +1 -0
- package/types/dist/shared.d.ts +1 -0
- package/types/src/component/marker/MarkLabelModal.d.ts +1 -0
- package/types/src/util/color.d.ts +6 -1
|
@@ -45,6 +45,13 @@ import { __extends } from "tslib";
|
|
|
45
45
|
import ComponentView from "../../view/Component.js";
|
|
46
46
|
import { each } from "tvrender/lib/core/util.js";
|
|
47
47
|
import * as graphic from "../../util/graphic.js";
|
|
48
|
+
import { getIsLightColor } from '../../util/color.js';
|
|
49
|
+
var getRectFill = function (color) {
|
|
50
|
+
if (typeof color !== 'string') {
|
|
51
|
+
return '#000';
|
|
52
|
+
}
|
|
53
|
+
return getIsLightColor(color) ? '#fff' : '#000';
|
|
54
|
+
};
|
|
48
55
|
var r = 15;
|
|
49
56
|
var optimizeX = function (x, lineWidth) {
|
|
50
57
|
return lineWidth % 2 === 0 ? x : Math.floor(x) + 0.5;
|
|
@@ -96,6 +103,7 @@ var EventsView = /** @class */function (_super) {
|
|
|
96
103
|
var lineStyle = eventsModel.get('lineStyle');
|
|
97
104
|
var z = eventsModel.get('z');
|
|
98
105
|
var selectedEventViewId = eventsModel.get('selectedEventViewId');
|
|
106
|
+
var backgroundColor = ecModel.get('backgroundColor') || '#fff';
|
|
99
107
|
var hoverEventId = this.hoverEventId;
|
|
100
108
|
var lastPoint = this._lastPoint;
|
|
101
109
|
var mouseMove = this._mouseMove.bind(this);
|
|
@@ -143,7 +151,6 @@ var EventsView = /** @class */function (_super) {
|
|
|
143
151
|
}
|
|
144
152
|
});
|
|
145
153
|
img.setClipPath(clipPath);
|
|
146
|
-
imgGroup.add(img);
|
|
147
154
|
var rect = new graphic.Rect({
|
|
148
155
|
shape: {
|
|
149
156
|
x: x + 5 - borderWidth / 2,
|
|
@@ -154,7 +161,7 @@ var EventsView = /** @class */function (_super) {
|
|
|
154
161
|
},
|
|
155
162
|
style: {
|
|
156
163
|
stroke: "#ED544F",
|
|
157
|
-
fill:
|
|
164
|
+
fill: getRectFill(backgroundColor),
|
|
158
165
|
lineWidth: borderWidth
|
|
159
166
|
},
|
|
160
167
|
z2: z2,
|
|
@@ -168,6 +175,7 @@ var EventsView = /** @class */function (_super) {
|
|
|
168
175
|
}
|
|
169
176
|
}
|
|
170
177
|
imgGroup.add(rect);
|
|
178
|
+
imgGroup.add(img);
|
|
171
179
|
if (i !== list.length - 1) {
|
|
172
180
|
y = y - 24;
|
|
173
181
|
}
|
|
@@ -46,7 +46,7 @@ import ComponentView from '../../view/Component.js';
|
|
|
46
46
|
import { createHashMap, each, isGradientObject } from 'tvrender/lib/core/util.js';
|
|
47
47
|
import { getBoundingRect } from 'tvrender/lib/contain/text.js';
|
|
48
48
|
import { makeInner } from '../../util/model.js';
|
|
49
|
-
import { contrastColor, removeTransparency } from '../../util/color.js';
|
|
49
|
+
import { contrastColor, removeTransparency, getGradientColorByY } from '../../util/color.js';
|
|
50
50
|
import * as formatUtil from '../../util/format.js';
|
|
51
51
|
import * as graphicUtil from '../../util/graphic.js';
|
|
52
52
|
import { getFont } from '../../label/labelStyle.js';
|
|
@@ -55,35 +55,58 @@ import { isCandle, isPlot } from '../../util/seriesType.js';
|
|
|
55
55
|
import { positiveColorQuery, negativeColorQuery, positiveBorderColorQuery, negativeBorderColorQuery } from '../../chart/candlestick/candlestickVisual.js';
|
|
56
56
|
import { getLeftTextX, formatSeconds } from '../../util/axisLabel.js';
|
|
57
57
|
var DefaultColor = 'rgb(41,98,255)';
|
|
58
|
+
var formatTextColor = function (color, height) {
|
|
59
|
+
if (color && isGradientObject(color) && !color.global && color.type === 'linear') {
|
|
60
|
+
return __assign(__assign({}, color), {
|
|
61
|
+
global: true,
|
|
62
|
+
y2: height
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return color;
|
|
66
|
+
};
|
|
67
|
+
var linePlotTypes = ["linesPlot", "line"];
|
|
58
68
|
var markerTypeCalculator = {
|
|
59
|
-
dataMin: function (item, seriesModel, backgroundColor) {
|
|
69
|
+
dataMin: function (item, seriesModel, height, backgroundColor) {
|
|
60
70
|
var seriesData = seriesModel.getData();
|
|
61
71
|
return {
|
|
62
72
|
value: seriesData.getDataExtent(item.valueDim)[0]
|
|
63
73
|
};
|
|
64
74
|
},
|
|
65
|
-
dataMax: function (item, seriesModel, backgroundColor) {
|
|
75
|
+
dataMax: function (item, seriesModel, height, backgroundColor) {
|
|
66
76
|
var seriesData = seriesModel.getData();
|
|
67
77
|
return {
|
|
68
78
|
value: seriesData.getDataExtent(item.valueDim)[1]
|
|
69
79
|
};
|
|
70
80
|
},
|
|
71
|
-
min: function (item, seriesModel, backgroundColor) {
|
|
81
|
+
min: function (item, seriesModel, height, backgroundColor) {
|
|
72
82
|
var seriesData = seriesModel.getData();
|
|
73
83
|
return {
|
|
74
84
|
value: seriesData.getDataExtent(item.valueDim, true)[0]
|
|
75
85
|
};
|
|
76
86
|
},
|
|
77
|
-
max: function (item, seriesModel, backgroundColor) {
|
|
87
|
+
max: function (item, seriesModel, height, backgroundColor) {
|
|
78
88
|
var seriesData = seriesModel.getData();
|
|
79
89
|
return {
|
|
80
90
|
value: seriesData.getDataExtent(item.valueDim, true)[1]
|
|
81
91
|
};
|
|
82
92
|
},
|
|
83
|
-
rawLast: function (item, seriesModel, backgroundColor) {
|
|
93
|
+
rawLast: function (item, seriesModel, height, backgroundColor) {
|
|
84
94
|
var _a;
|
|
85
95
|
var seriesData = seriesModel.getData();
|
|
86
96
|
var lastIndex = seriesData.count(true) - 1;
|
|
97
|
+
var itemFill = item.textStyle.fill;
|
|
98
|
+
if (item.customColor && itemFill) {
|
|
99
|
+
return {
|
|
100
|
+
value: seriesData.getByRawIndex(item.valueDim, lastIndex),
|
|
101
|
+
labelTextStyle: {
|
|
102
|
+
fill: typeof itemFill === 'string' ? contrastColor(itemFill) : '#ffffff',
|
|
103
|
+
// stroke: fill,
|
|
104
|
+
backgroundColor: removeTransparency(itemFill),
|
|
105
|
+
// borderColor: fill,
|
|
106
|
+
borderWidth: 0
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
87
110
|
var fill = (_a = seriesData.getItemVisual(lastIndex, 'style')) === null || _a === void 0 ? void 0 : _a.fill;
|
|
88
111
|
if (isCandle(seriesModel.subType)) {
|
|
89
112
|
var dataItem = seriesData.getItemModel(lastIndex, true);
|
|
@@ -95,22 +118,22 @@ var markerTypeCalculator = {
|
|
|
95
118
|
fill = dataItem.get(sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery);
|
|
96
119
|
}
|
|
97
120
|
} else if (isPlot(seriesModel.subType)) {
|
|
98
|
-
var isLinesPlot = seriesModel.subType
|
|
121
|
+
var isLinesPlot = linePlotTypes.includes(seriesModel.subType);
|
|
99
122
|
var dataItem = seriesData.getItemModel(lastIndex, true);
|
|
100
|
-
fill = dataItem.get([isLinesPlot ? 'lineStyle' : 'itemStyle', 'color']);
|
|
123
|
+
fill = formatTextColor(dataItem.get([isLinesPlot ? 'lineStyle' : 'itemStyle', 'color']), height);
|
|
101
124
|
}
|
|
102
125
|
return {
|
|
103
126
|
value: seriesData.getByRawIndex(item.valueDim, lastIndex),
|
|
104
127
|
labelTextStyle: {
|
|
105
|
-
fill: fill ? contrastColor(fill) : '#ffffff',
|
|
128
|
+
fill: typeof fill === 'string' ? contrastColor(fill) : '#ffffff',
|
|
106
129
|
// stroke: fill,
|
|
107
|
-
backgroundColor: fill ? removeTransparency(fill) : DefaultColor,
|
|
130
|
+
backgroundColor: isGradientObject(fill) ? fill : fill ? removeTransparency(fill) : DefaultColor,
|
|
108
131
|
// borderColor: fill,
|
|
109
132
|
borderWidth: 0
|
|
110
133
|
}
|
|
111
134
|
};
|
|
112
135
|
},
|
|
113
|
-
last: function (item, seriesModel, backgroundColor) {
|
|
136
|
+
last: function (item, seriesModel, height, backgroundColor) {
|
|
114
137
|
var _a;
|
|
115
138
|
var seriesData = seriesModel.getData();
|
|
116
139
|
var count = seriesData.count(true);
|
|
@@ -124,9 +147,9 @@ var markerTypeCalculator = {
|
|
|
124
147
|
var lastItem = seriesData.count() - 1;
|
|
125
148
|
var fill = (_a = seriesData.getItemVisual(lastItem, 'style')) === null || _a === void 0 ? void 0 : _a.fill;
|
|
126
149
|
if (isPlot(seriesModel.subType)) {
|
|
127
|
-
var isLinesPlot = seriesModel.subType
|
|
150
|
+
var isLinesPlot = linePlotTypes.includes(seriesModel.subType);
|
|
128
151
|
var dataItem = seriesData.getItemModel(lastItem);
|
|
129
|
-
fill = dataItem.get([isLinesPlot ? 'lineStyle' : 'itemStyle', 'color']);
|
|
152
|
+
fill = formatTextColor(dataItem.get([isLinesPlot ? 'lineStyle' : 'itemStyle', 'color']), height);
|
|
130
153
|
} else if (isCandle(seriesModel.subType)) {
|
|
131
154
|
var dataItem = seriesData.getItemModel(lastItem);
|
|
132
155
|
var closeValue = seriesData.get('close', lastItem);
|
|
@@ -148,7 +171,7 @@ var markerTypeCalculator = {
|
|
|
148
171
|
}
|
|
149
172
|
};
|
|
150
173
|
},
|
|
151
|
-
allLast: function (item, seriesModel, backgroundColor) {
|
|
174
|
+
allLast: function (item, seriesModel, height, backgroundColor) {
|
|
152
175
|
var seriesData = seriesModel.getData();
|
|
153
176
|
var count = seriesData.count(true);
|
|
154
177
|
var axisModel = seriesModel.getBaseAxis();
|
|
@@ -156,9 +179,9 @@ var markerTypeCalculator = {
|
|
|
156
179
|
var offset = seriesModel.get('offset') || 0;
|
|
157
180
|
var lastIndex = extent[1] + offset;
|
|
158
181
|
if (lastIndex >= count || lastIndex < 0) {
|
|
159
|
-
return markerTypeCalculator.rawLast(item, seriesModel, backgroundColor);
|
|
182
|
+
return markerTypeCalculator.rawLast(item, seriesModel, height, backgroundColor);
|
|
160
183
|
}
|
|
161
|
-
return markerTypeCalculator.last(item, seriesModel, backgroundColor);
|
|
184
|
+
return markerTypeCalculator.last(item, seriesModel, height, backgroundColor);
|
|
162
185
|
}
|
|
163
186
|
};
|
|
164
187
|
var inner = makeInner();
|
|
@@ -243,7 +266,7 @@ var MarkLabelView = /** @class */function (_super) {
|
|
|
243
266
|
return;
|
|
244
267
|
}
|
|
245
268
|
var yCalcFn = markerTypeCalculator[item.type];
|
|
246
|
-
var _a = yCalcFn ? yCalcFn(item, seriesModel, backgroundColor) || {} : {
|
|
269
|
+
var _a = yCalcFn ? yCalcFn(item, seriesModel, height, backgroundColor) || {} : {
|
|
247
270
|
value: item.value
|
|
248
271
|
},
|
|
249
272
|
value = _a.value,
|
|
@@ -686,15 +709,15 @@ function updateText(_a) {
|
|
|
686
709
|
}
|
|
687
710
|
var mistake = 0;
|
|
688
711
|
function createLabel(_a) {
|
|
689
|
-
var _b
|
|
712
|
+
var _b;
|
|
690
713
|
var x = _a.x,
|
|
691
714
|
y = _a.y,
|
|
692
715
|
labelData = _a.labelData,
|
|
693
716
|
markerModel = _a.markerModel,
|
|
694
717
|
gridRect = _a.gridRect,
|
|
695
718
|
position = _a.position,
|
|
696
|
-
|
|
697
|
-
labelTextStyle =
|
|
719
|
+
_c = _a.labelTextStyle,
|
|
720
|
+
labelTextStyle = _c === void 0 ? {} : _c,
|
|
698
721
|
fontSize = _a.fontSize;
|
|
699
722
|
var zlevel = markerModel.option.zlevel;
|
|
700
723
|
var lineStyle = labelData.lineStyle,
|
|
@@ -703,7 +726,7 @@ function createLabel(_a) {
|
|
|
703
726
|
showTitle = labelData.showTitle,
|
|
704
727
|
title = labelData.title,
|
|
705
728
|
countDown = labelData.countDown;
|
|
706
|
-
var textStyle = Object.assign((
|
|
729
|
+
var textStyle = Object.assign(__assign({}, labelData.textStyle), {
|
|
707
730
|
fontSize: fontSize,
|
|
708
731
|
padding: getPaddingByStyle(fontSize, labelTextStyle.borderWidth)
|
|
709
732
|
}, labelTextStyle);
|
|
@@ -712,7 +735,7 @@ function createLabel(_a) {
|
|
|
712
735
|
var isLeft = position === 'left';
|
|
713
736
|
var group = new graphicUtil.Group();
|
|
714
737
|
var labelY = y;
|
|
715
|
-
var borderWidth = (
|
|
738
|
+
var borderWidth = (_b = textStyle.borderWidth) !== null && _b !== void 0 ? _b : 0;
|
|
716
739
|
var font = getFont(textStyle, markerModel.ecModel);
|
|
717
740
|
var countDownText = countDown && countDown.show && formatSeconds(countDown.value) || '';
|
|
718
741
|
var renderText = countDownText.length > text.length ? countDownText : text;
|
|
@@ -720,6 +743,7 @@ function createLabel(_a) {
|
|
|
720
743
|
var paddings = formatUtil.normalizeCssArray(textStyle.padding || 0);
|
|
721
744
|
var textElWidth = textRect.width + paddings[1] + paddings[3];
|
|
722
745
|
var textElx = isLeft ? x - textElWidth - borderWidth - 1 : x + borderWidth;
|
|
746
|
+
var formatLabelFill = getGradientColorByY(textStyle.fill, labelY);
|
|
723
747
|
var textEl = new graphicUtil.Text({
|
|
724
748
|
// x: textElx,
|
|
725
749
|
// y: labelY,
|
|
@@ -728,7 +752,9 @@ function createLabel(_a) {
|
|
|
728
752
|
width: textRect.width,
|
|
729
753
|
x: textElx,
|
|
730
754
|
y: labelY
|
|
731
|
-
}, textStyle
|
|
755
|
+
}, textStyle, {
|
|
756
|
+
fill: formatLabelFill
|
|
757
|
+
}),
|
|
732
758
|
z: 101,
|
|
733
759
|
zlevel: zlevel,
|
|
734
760
|
ignore: !showName
|
|
@@ -742,7 +768,9 @@ function createLabel(_a) {
|
|
|
742
768
|
text: labelTitle,
|
|
743
769
|
x: isLeft ? gridRect.x - borderWidth : getLeftTextX(gridRect.x + gridRect.width, labelTitle, textStyle, markerModel.ecModel) + borderWidth,
|
|
744
770
|
y: labelY
|
|
745
|
-
}, textStyle
|
|
771
|
+
}, textStyle, {
|
|
772
|
+
fill: formatLabelFill
|
|
773
|
+
}),
|
|
746
774
|
z: 101,
|
|
747
775
|
zlevel: zlevel,
|
|
748
776
|
ignore: !showTitle
|
|
@@ -796,7 +824,7 @@ function createLabel(_a) {
|
|
|
796
824
|
return group;
|
|
797
825
|
}
|
|
798
826
|
function updateLabel(_a) {
|
|
799
|
-
var _b
|
|
827
|
+
var _b;
|
|
800
828
|
var x = _a.x,
|
|
801
829
|
y = _a.y,
|
|
802
830
|
labelData = _a.labelData,
|
|
@@ -804,8 +832,8 @@ function updateLabel(_a) {
|
|
|
804
832
|
gridRect = _a.gridRect,
|
|
805
833
|
position = _a.position,
|
|
806
834
|
el = _a.el,
|
|
807
|
-
|
|
808
|
-
labelTextStyle =
|
|
835
|
+
_c = _a.labelTextStyle,
|
|
836
|
+
labelTextStyle = _c === void 0 ? {} : _c,
|
|
809
837
|
fontSize = _a.fontSize;
|
|
810
838
|
var lineStyle = labelData.lineStyle,
|
|
811
839
|
showLine = labelData.showLine,
|
|
@@ -815,11 +843,11 @@ function updateLabel(_a) {
|
|
|
815
843
|
countDown = labelData.countDown;
|
|
816
844
|
// const lineStyle = Object.assign({}, labelData.lineStyle);
|
|
817
845
|
// const textStyle = Object.assign(defaultLabelStyle, labelData.textStyle);
|
|
818
|
-
var textStyle = Object.assign((
|
|
846
|
+
var textStyle = Object.assign(__assign({}, labelData.textStyle), {
|
|
819
847
|
fontSize: fontSize,
|
|
820
848
|
padding: getPaddingByStyle(fontSize, labelTextStyle.borderWidth)
|
|
821
849
|
}, labelTextStyle);
|
|
822
|
-
var borderWidth = (
|
|
850
|
+
var borderWidth = (_b = textStyle.borderWidth) !== null && _b !== void 0 ? _b : 0;
|
|
823
851
|
var isLeft = position === 'left';
|
|
824
852
|
if (el.ignore) {
|
|
825
853
|
el.ignore = false;
|
|
@@ -833,6 +861,7 @@ function updateLabel(_a) {
|
|
|
833
861
|
var textElWidth = textRect.width + paddings[1] + paddings[3];
|
|
834
862
|
var textElx = isLeft ? x - textElWidth - borderWidth - 1 : x + borderWidth;
|
|
835
863
|
var labelY = y;
|
|
864
|
+
var formatLabelFill = getGradientColorByY(textStyle.fill, labelY);
|
|
836
865
|
inner(el).y = labelY;
|
|
837
866
|
each(el.children(), function (element) {
|
|
838
867
|
var labelType = inner(element).labelType;
|
|
@@ -870,7 +899,9 @@ function updateLabel(_a) {
|
|
|
870
899
|
width: textRect.width,
|
|
871
900
|
x: textElx,
|
|
872
901
|
y: labelY
|
|
873
|
-
}, textStyle
|
|
902
|
+
}, textStyle, {
|
|
903
|
+
fill: formatLabelFill
|
|
904
|
+
}));
|
|
874
905
|
element.ignore = false;
|
|
875
906
|
break;
|
|
876
907
|
case 'nameLabel':
|
|
@@ -886,7 +917,9 @@ function updateLabel(_a) {
|
|
|
886
917
|
text: labelTitle,
|
|
887
918
|
x: nameX,
|
|
888
919
|
y: labelY
|
|
889
|
-
}, textStyle
|
|
920
|
+
}, textStyle, {
|
|
921
|
+
fill: formatLabelFill
|
|
922
|
+
}));
|
|
890
923
|
element.ignore = false;
|
|
891
924
|
break;
|
|
892
925
|
case 'countDown':
|
package/lib/util/color.js
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { colorToRgba } from 'tvrender/lib/core/util.js';
|
|
27
|
+
var round = Math.round;
|
|
27
28
|
// function parseColor(color: string): [number, number, number] {
|
|
28
29
|
// // 移除可能存在的#号
|
|
29
30
|
// if (color.startsWith('#')) {
|
|
@@ -199,4 +200,26 @@ function parseColorToRgba(color) {
|
|
|
199
200
|
function rgbToHex(r, g, b) {
|
|
200
201
|
return "#" + Math.round(r).toString(16).padStart(2, '0') + Math.round(g).toString(16).padStart(2, '0') + Math.round(b).toString(16).padStart(2, '0');
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
+
/**
|
|
204
|
+
* 获取渐变色中指定比例的颜色
|
|
205
|
+
*/
|
|
206
|
+
function getGradientColorByY(color, y) {
|
|
207
|
+
if (typeof color === 'string' || color.type !== 'linear') {
|
|
208
|
+
return color;
|
|
209
|
+
}
|
|
210
|
+
var colorStops = color.colorStops,
|
|
211
|
+
y2 = color.y2;
|
|
212
|
+
var color1 = colorStops[0].color,
|
|
213
|
+
color2 = colorStops[1].color;
|
|
214
|
+
// 限制 ratio 在 [0,1] 区间
|
|
215
|
+
var t = Math.min(1, Math.max(0, y / y2));
|
|
216
|
+
var c1 = parseColorToRgba(color1);
|
|
217
|
+
var c2 = parseColorToRgba(color2);
|
|
218
|
+
// 线性插值
|
|
219
|
+
var r = c1.r + (c2.r - c1.r) * t;
|
|
220
|
+
var g = c1.g + (c2.g - c1.g) * t;
|
|
221
|
+
var b = c1.b + (c2.b - c1.b) * t;
|
|
222
|
+
var a = c1.a ? c1.a + (c2.a - c1.a) * t : 1;
|
|
223
|
+
return "rgba(" + round(r) + ", " + round(g) + ", " + round(b) + ", " + a.toFixed(2) + ")";
|
|
224
|
+
}
|
|
225
|
+
export { colorToRgba, removeTransparency, contrastColor, isColorSimilarManhattan, blendColors, getIsLightColor, getGradientColorByY };
|
package/lib/util/seriesType.js
CHANGED
|
@@ -27,7 +27,7 @@ var candleArr = ['candlestick', 'candlePlot', 'barPlot'];
|
|
|
27
27
|
function isCandle(type) {
|
|
28
28
|
return candleArr.includes(type);
|
|
29
29
|
}
|
|
30
|
-
var plotsArr = ['labels', 'linesPlot', 'charPlot', 'arrowsPlot'];
|
|
30
|
+
var plotsArr = ['labels', 'linesPlot', 'charPlot', 'arrowsPlot', 'line'];
|
|
31
31
|
function isPlot(type) {
|
|
32
32
|
return plotsArr.includes(type);
|
|
33
33
|
}
|
package/lib/util/states.js
CHANGED
|
@@ -667,7 +667,7 @@ export function getSeriesPointData(ecModel, payload) {
|
|
|
667
667
|
if (fill) {
|
|
668
668
|
color = fill;
|
|
669
669
|
}
|
|
670
|
-
} else if (isPlot(seriesModel.subType)) {
|
|
670
|
+
} else if (isPlot(seriesModel.subType) && seriesModel.subType !== 'line') {
|
|
671
671
|
var isLinesPlot = seriesModel.subType === 'linesPlot';
|
|
672
672
|
var dataItem = data.getItemModel(index, isRaw);
|
|
673
673
|
var fill = dataItem.get([isLinesPlot ? 'lineStyle' : 'itemStyle', 'color']);
|
package/package.json
CHANGED
package/types/dist/echarts.d.ts
CHANGED
package/types/dist/shared.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { colorToRgba } from 'tvrender/lib/core/util.js';
|
|
2
|
+
import { ZRColor } from './types.js';
|
|
2
3
|
declare function contrastColor(color: string): string;
|
|
3
4
|
declare function getIsLightColor(color: string): boolean;
|
|
4
5
|
declare function removeTransparency(color: string): string;
|
|
@@ -18,4 +19,8 @@ declare function isColorSimilarManhattan(rgbas1: number[], rgbas2: number[], thr
|
|
|
18
19
|
* @returns 混合后的颜色(十六进制格式)
|
|
19
20
|
*/
|
|
20
21
|
declare function blendColors(foreground: string, background: string): string;
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* 获取渐变色中指定比例的颜色
|
|
24
|
+
*/
|
|
25
|
+
declare function getGradientColorByY(color: ZRColor, y: number): string | import("tvrender/lib/graphic/Pattern").PatternObject | import("tvrender/lib/graphic/RadialGradient").RadialGradientObject;
|
|
26
|
+
export { colorToRgba, removeTransparency, contrastColor, isColorSimilarManhattan, blendColors, getIsLightColor, getGradientColorByY };
|