tvcharts 0.6.40 → 0.6.42
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.
|
@@ -49,7 +49,6 @@ import * as graphic from '../../util/graphic.js';
|
|
|
49
49
|
// import type SeriesData from '../../data/SeriesData.js';
|
|
50
50
|
import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
|
|
51
51
|
import FillPolyPath from './FillPolyPath.js';
|
|
52
|
-
import LargeFillPolyPath from './LargeFillPolyPath.js';
|
|
53
52
|
import { getFormatColor } from '../../util/format.js';
|
|
54
53
|
import { each } from 'tvrender/lib/core/util.js';
|
|
55
54
|
var FillsView = /** @class */function (_super) {
|
|
@@ -75,57 +74,56 @@ var FillsView = /** @class */function (_super) {
|
|
|
75
74
|
var z2 = seriesModel.get('z2');
|
|
76
75
|
var polygonGroup = this._polygonGroup;
|
|
77
76
|
var coordSys = seriesModel.coordinateSystem;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var
|
|
77
|
+
each(pointsByColor, function (points, key) {
|
|
78
|
+
var colors = key.split(':');
|
|
79
|
+
var fill = key;
|
|
80
|
+
var isDefaultFill = false;
|
|
81
|
+
if (colors.length > 1) {
|
|
82
|
+
var topColor = colors[0],
|
|
83
|
+
topValue = colors[1],
|
|
84
|
+
bottomColor = colors[2],
|
|
85
|
+
bottomValue = colors[3];
|
|
86
|
+
var tValue = coordSys.dataToPoint([0, topValue])[1];
|
|
87
|
+
var bValue = coordSys.dataToPoint([0, bottomValue])[1];
|
|
88
|
+
fill = new graphic.LinearGradient(0, tValue, 0, bValue, [{
|
|
89
|
+
offset: 0,
|
|
90
|
+
color: topColor
|
|
91
|
+
}, {
|
|
92
|
+
offset: 1,
|
|
93
|
+
color: bottomColor
|
|
94
|
+
}], true);
|
|
95
|
+
} else {
|
|
96
|
+
var _a = getFormatColor(fill),
|
|
97
|
+
color = _a.color,
|
|
98
|
+
isDefaultColor = _a.isDefaultColor;
|
|
99
|
+
fill = color;
|
|
100
|
+
isDefaultFill = isDefaultColor;
|
|
101
|
+
}
|
|
102
|
+
var el = new FillPolyPath({
|
|
81
103
|
shape: {
|
|
82
|
-
|
|
104
|
+
points: points
|
|
83
105
|
},
|
|
84
106
|
style: {
|
|
85
|
-
fill:
|
|
107
|
+
// fill: key,
|
|
108
|
+
fill: fill
|
|
86
109
|
},
|
|
87
|
-
z2: z2
|
|
110
|
+
z2: isDefaultFill ? -1 : z2
|
|
88
111
|
});
|
|
89
112
|
polygonGroup.add(el);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
color: topColor
|
|
105
|
-
}, {
|
|
106
|
-
offset: 1,
|
|
107
|
-
color: bottomColor
|
|
108
|
-
}], true);
|
|
109
|
-
} else {
|
|
110
|
-
var _a = getFormatColor(fill),
|
|
111
|
-
color = _a.color,
|
|
112
|
-
isDefaultColor = _a.isDefaultColor;
|
|
113
|
-
fill = color;
|
|
114
|
-
isDefaultFill = isDefaultColor;
|
|
115
|
-
}
|
|
116
|
-
var el = new FillPolyPath({
|
|
117
|
-
shape: {
|
|
118
|
-
points: points
|
|
119
|
-
},
|
|
120
|
-
style: {
|
|
121
|
-
// fill: key,
|
|
122
|
-
fill: fill
|
|
123
|
-
},
|
|
124
|
-
z2: isDefaultFill ? -1 : z2
|
|
125
|
-
});
|
|
126
|
-
polygonGroup.add(el);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
113
|
+
});
|
|
114
|
+
// const fillLength = Object.keys(pointsByColor).length;
|
|
115
|
+
// if (fillLength >= 100) {
|
|
116
|
+
// const el = new LargeFillPolyPath({
|
|
117
|
+
// shape: {
|
|
118
|
+
// pointsByColor: pointsByColor,
|
|
119
|
+
// },
|
|
120
|
+
// style: {
|
|
121
|
+
// fill: 'none'
|
|
122
|
+
// },
|
|
123
|
+
// z2: z2,
|
|
124
|
+
// });
|
|
125
|
+
// polygonGroup.add(el);
|
|
126
|
+
// }
|
|
129
127
|
var clipPath = seriesModel.get('clip', true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);
|
|
130
128
|
if (clipPath) {
|
|
131
129
|
this.group.setClipPath(clipPath);
|
|
@@ -48,8 +48,8 @@ function getKey(itemModel) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
// const color = itemModel.option?.color
|
|
50
50
|
var key = (_a = itemModel.option) === null || _a === void 0 ? void 0 : _a.color;
|
|
51
|
-
if (!key && itemModel.get('topValue')) {
|
|
52
|
-
key = (itemModel.get('topColor') || '
|
|
51
|
+
if (!key && itemModel.get('topValue') !== void 0) {
|
|
52
|
+
key = (itemModel.get('topColor') || 'rgba(255,255,255,0)') + ":" + itemModel.get('topValue') + ":" + (itemModel.get('bottomColor') || 'rgba(255,255,255,0)') + ":" + itemModel.get('bottomValue');
|
|
53
53
|
}
|
|
54
54
|
return key || 'transparent';
|
|
55
55
|
}
|
|
@@ -52,6 +52,7 @@ import * as graphicUtil from '../../util/graphic.js';
|
|
|
52
52
|
import { getFont } from '../../label/labelStyle.js';
|
|
53
53
|
import Group from 'tvrender/lib/graphic/Group.js';
|
|
54
54
|
import { positiveBorderColorQuery, negativeBorderColorQuery } from '../../chart/candlestick/candlestickVisual.js';
|
|
55
|
+
var DefaultColor = 'rgb(41,98,255)';
|
|
55
56
|
var markerTypeCalculator = {
|
|
56
57
|
dataMin: function (item, seriesModel) {
|
|
57
58
|
var seriesData = seriesModel.getData();
|
|
@@ -96,9 +97,9 @@ var markerTypeCalculator = {
|
|
|
96
97
|
return {
|
|
97
98
|
value: seriesData.getByRawIndex(item.valueDim, lastIndex),
|
|
98
99
|
labelTextStyle: {
|
|
99
|
-
fill: contrastColor(fill),
|
|
100
|
+
fill: fill ? contrastColor(fill) : '#fff',
|
|
100
101
|
// stroke: fill,
|
|
101
|
-
backgroundColor: removeTransparency(fill),
|
|
102
|
+
backgroundColor: fill ? removeTransparency(fill) : DefaultColor,
|
|
102
103
|
// borderColor: fill,
|
|
103
104
|
borderWidth: 0
|
|
104
105
|
}
|
|
@@ -125,10 +126,10 @@ var markerTypeCalculator = {
|
|
|
125
126
|
return {
|
|
126
127
|
value: seriesData.getByRawIndex(item.valueDim, lastIndex),
|
|
127
128
|
labelTextStyle: {
|
|
128
|
-
fill: fill,
|
|
129
|
+
fill: fill || DefaultColor,
|
|
129
130
|
// stroke: fill,
|
|
130
131
|
backgroundColor: backgroundColor,
|
|
131
|
-
borderColor: fill,
|
|
132
|
+
borderColor: fill || DefaultColor,
|
|
132
133
|
borderWidth: 1
|
|
133
134
|
}
|
|
134
135
|
};
|
|
@@ -619,7 +620,8 @@ function createLabel(_a) {
|
|
|
619
620
|
markerModel = _a.markerModel,
|
|
620
621
|
gridRect = _a.gridRect,
|
|
621
622
|
position = _a.position,
|
|
622
|
-
|
|
623
|
+
_d = _a.labelTextStyle,
|
|
624
|
+
labelTextStyle = _d === void 0 ? {} : _d,
|
|
623
625
|
fontSize = _a.fontSize;
|
|
624
626
|
var zlevel = markerModel.option.zlevel;
|
|
625
627
|
var lineStyle = labelData.lineStyle,
|
|
@@ -658,7 +660,7 @@ function createLabel(_a) {
|
|
|
658
660
|
ignore: !showTitle
|
|
659
661
|
});
|
|
660
662
|
var lineEl = new graphicUtil.Line({
|
|
661
|
-
style: Object.assign(lineStyle, labelTextStyle ? {
|
|
663
|
+
style: Object.assign(lineStyle, labelTextStyle.backgroundColor ? {
|
|
662
664
|
stroke: labelTextStyle.backgroundColor
|
|
663
665
|
} : {}),
|
|
664
666
|
shape: {
|
|
@@ -689,7 +691,8 @@ function updateLabel(_a) {
|
|
|
689
691
|
gridRect = _a.gridRect,
|
|
690
692
|
position = _a.position,
|
|
691
693
|
el = _a.el,
|
|
692
|
-
|
|
694
|
+
_d = _a.labelTextStyle,
|
|
695
|
+
labelTextStyle = _d === void 0 ? {} : _d,
|
|
693
696
|
fontSize = _a.fontSize;
|
|
694
697
|
var lineStyle = labelData.lineStyle,
|
|
695
698
|
showLine = labelData.showLine,
|
|
@@ -724,7 +727,7 @@ function updateLabel(_a) {
|
|
|
724
727
|
x2: showTitle && !isLeft ? gridRect.x + gridRect.width - 2 : gridRect.x + gridRect.width,
|
|
725
728
|
y2: y
|
|
726
729
|
},
|
|
727
|
-
style: Object.assign(lineStyle, labelTextStyle ? {
|
|
730
|
+
style: Object.assign(lineStyle, labelTextStyle.backgroundColor ? {
|
|
728
731
|
stroke: labelTextStyle.backgroundColor
|
|
729
732
|
} : {})
|
|
730
733
|
});
|