tvcharts 0.6.43 → 0.6.44
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/dist/echarts.js +268 -106
- package/dist/echarts.js.map +3 -3
- package/lib/chart/labels/install.js +1 -0
- package/lib/chart/labels/labelsLayout.js +2 -1
- package/lib/chart/linesPlot/BarPath.js +0 -7
- package/lib/chart/linesPlot/LinesPlotView.js +165 -82
- package/lib/chart/linesPlot/linesPlotLayout.js +0 -1
- package/lib/util/symbolSize.js +255 -2
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +6 -0
- package/types/dist/shared.d.ts +6 -0
- package/types/src/chart/linesPlot/LinesPlotSeries.d.ts +6 -0
- package/types/src/chart/linesPlot/LinesPlotView.d.ts +2 -2
- package/types/src/util/symbolSize.d.ts +1 -1
package/dist/echarts.js
CHANGED
|
@@ -35011,6 +35011,7 @@ var LineView = class extends Chart_default {
|
|
|
35011
35011
|
const focus = emphasisModel.get("focus");
|
|
35012
35012
|
const blurScope = emphasisModel.get("blurScope");
|
|
35013
35013
|
const emphasisDisabled = emphasisModel.get("disabled");
|
|
35014
|
+
console.log("%c [ polyline ]-829", "font-size:13px; background:pink; color:#bf2c9f;", polyline, visualColor);
|
|
35014
35015
|
polyline.useStyle(defaults(lineStyleModel.getLineStyle(), {
|
|
35015
35016
|
fill: "none",
|
|
35016
35017
|
stroke: visualColor,
|
|
@@ -54907,6 +54908,138 @@ var SymbolPath_default = SymbolPath;
|
|
|
54907
54908
|
|
|
54908
54909
|
// src/chart/linesPlot/LinesPlotView.ts
|
|
54909
54910
|
var LastZ2 = -1;
|
|
54911
|
+
function clipColorStops2(colorStops, maxSize) {
|
|
54912
|
+
const newColorStops = [];
|
|
54913
|
+
const len2 = colorStops.length;
|
|
54914
|
+
let prevOutOfRangeColorStop;
|
|
54915
|
+
let prevInRangeColorStop;
|
|
54916
|
+
function lerpStop(stop0, stop1, clippedCoord) {
|
|
54917
|
+
const coord0 = stop0.coord;
|
|
54918
|
+
const p = (clippedCoord - coord0) / (stop1.coord - coord0);
|
|
54919
|
+
const color2 = lerp2(p, [stop0.color, stop1.color]);
|
|
54920
|
+
return {coord: clippedCoord, color: color2};
|
|
54921
|
+
}
|
|
54922
|
+
for (let i = 0; i < len2; i++) {
|
|
54923
|
+
const stop2 = colorStops[i];
|
|
54924
|
+
const coord = stop2.coord;
|
|
54925
|
+
if (coord < 0) {
|
|
54926
|
+
prevOutOfRangeColorStop = stop2;
|
|
54927
|
+
} else if (coord > maxSize) {
|
|
54928
|
+
if (prevInRangeColorStop) {
|
|
54929
|
+
newColorStops.push(lerpStop(prevInRangeColorStop, stop2, maxSize));
|
|
54930
|
+
} else if (prevOutOfRangeColorStop) {
|
|
54931
|
+
newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop2, 0), lerpStop(prevOutOfRangeColorStop, stop2, maxSize));
|
|
54932
|
+
}
|
|
54933
|
+
break;
|
|
54934
|
+
} else {
|
|
54935
|
+
if (prevOutOfRangeColorStop) {
|
|
54936
|
+
newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop2, 0));
|
|
54937
|
+
prevOutOfRangeColorStop = null;
|
|
54938
|
+
}
|
|
54939
|
+
newColorStops.push(stop2);
|
|
54940
|
+
prevInRangeColorStop = stop2;
|
|
54941
|
+
}
|
|
54942
|
+
}
|
|
54943
|
+
return newColorStops;
|
|
54944
|
+
}
|
|
54945
|
+
function calculatebandWidth(seriesModel, data) {
|
|
54946
|
+
const baseAxis = seriesModel.getBaseAxis();
|
|
54947
|
+
let extent3;
|
|
54948
|
+
const bandWidth = baseAxis.type === "category" ? baseAxis.getBandWidth() : (extent3 = baseAxis.getExtent(), Math.abs(extent3[1] - extent3[0]) / data.count());
|
|
54949
|
+
return bandWidth;
|
|
54950
|
+
}
|
|
54951
|
+
function getVisualGradient2(data, coordSys, api2) {
|
|
54952
|
+
const visualMetaList = data.getVisual("visualMeta");
|
|
54953
|
+
if (!visualMetaList || !visualMetaList.length || !data.count()) {
|
|
54954
|
+
return;
|
|
54955
|
+
}
|
|
54956
|
+
if (coordSys.type !== "cartesian2d") {
|
|
54957
|
+
if (true) {
|
|
54958
|
+
console.warn("Visual map on line style is only supported on cartesian2d.");
|
|
54959
|
+
}
|
|
54960
|
+
return;
|
|
54961
|
+
}
|
|
54962
|
+
let coordDim;
|
|
54963
|
+
let visualMeta;
|
|
54964
|
+
for (let i = visualMetaList.length - 1; i >= 0; i--) {
|
|
54965
|
+
const dimInfo = data.getDimensionInfo(visualMetaList[i].dimension);
|
|
54966
|
+
coordDim = dimInfo && dimInfo.coordDim;
|
|
54967
|
+
if (coordDim === "x" || coordDim === "y") {
|
|
54968
|
+
visualMeta = visualMetaList[i];
|
|
54969
|
+
break;
|
|
54970
|
+
}
|
|
54971
|
+
}
|
|
54972
|
+
if (!visualMeta) {
|
|
54973
|
+
if (true) {
|
|
54974
|
+
console.warn("Visual map on line style only support x or y dimension.");
|
|
54975
|
+
}
|
|
54976
|
+
return;
|
|
54977
|
+
}
|
|
54978
|
+
const axis = coordSys.getAxis(coordDim);
|
|
54979
|
+
const colorStops = map(visualMeta.stops, function(stop2) {
|
|
54980
|
+
return {
|
|
54981
|
+
coord: axis.toGlobalCoord(axis.dataToCoord(stop2.value)),
|
|
54982
|
+
color: stop2.color
|
|
54983
|
+
};
|
|
54984
|
+
});
|
|
54985
|
+
const stopLen = colorStops.length;
|
|
54986
|
+
const outerColors = visualMeta.outerColors.slice();
|
|
54987
|
+
if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) {
|
|
54988
|
+
colorStops.reverse();
|
|
54989
|
+
outerColors.reverse();
|
|
54990
|
+
}
|
|
54991
|
+
const colorStopsInRange = clipColorStops2(colorStops, coordDim === "x" ? api2.getWidth() : api2.getHeight());
|
|
54992
|
+
const inRangeStopLen = colorStopsInRange.length;
|
|
54993
|
+
if (!inRangeStopLen && stopLen) {
|
|
54994
|
+
return colorStops[0].coord < 0 ? outerColors[1] ? outerColors[1] : colorStops[stopLen - 1].color : outerColors[0] ? outerColors[0] : colorStops[0].color;
|
|
54995
|
+
}
|
|
54996
|
+
const tinyExtent = 10;
|
|
54997
|
+
const minCoord = colorStopsInRange[0].coord - tinyExtent;
|
|
54998
|
+
const maxCoord = colorStopsInRange[inRangeStopLen - 1].coord + tinyExtent;
|
|
54999
|
+
const coordSpan = maxCoord - minCoord;
|
|
55000
|
+
if (coordSpan < 1e-3) {
|
|
55001
|
+
return "transparent";
|
|
55002
|
+
}
|
|
55003
|
+
each(colorStopsInRange, function(stop2) {
|
|
55004
|
+
stop2.offset = (stop2.coord - minCoord) / coordSpan;
|
|
55005
|
+
});
|
|
55006
|
+
colorStopsInRange.push({
|
|
55007
|
+
offset: inRangeStopLen ? colorStopsInRange[inRangeStopLen - 1].offset : 0.5,
|
|
55008
|
+
color: outerColors[1] || "transparent"
|
|
55009
|
+
});
|
|
55010
|
+
colorStopsInRange.unshift({
|
|
55011
|
+
offset: inRangeStopLen ? colorStopsInRange[0].offset : 0.5,
|
|
55012
|
+
color: outerColors[0] || "transparent"
|
|
55013
|
+
});
|
|
55014
|
+
const gradient = new LinearGradient_default(0, 0, 0, 0, colorStopsInRange, true);
|
|
55015
|
+
gradient[coordDim] = minCoord;
|
|
55016
|
+
gradient[coordDim + "2"] = maxCoord;
|
|
55017
|
+
return gradient;
|
|
55018
|
+
}
|
|
55019
|
+
function getAreaGradient(data, seriesModel, api2) {
|
|
55020
|
+
const colorStopsInRange = [];
|
|
55021
|
+
const areaGradient = seriesModel.get("areaGradient");
|
|
55022
|
+
const valueByType = {
|
|
55023
|
+
start: 0,
|
|
55024
|
+
end: 1
|
|
55025
|
+
};
|
|
55026
|
+
if (!areaGradient) {
|
|
55027
|
+
return;
|
|
55028
|
+
}
|
|
55029
|
+
const coordSys = seriesModel.coordinateSystem;
|
|
55030
|
+
const axis = coordSys.getAxis("y");
|
|
55031
|
+
const extent3 = axis.getExtent();
|
|
55032
|
+
const span = extent3[1] - extent3[0];
|
|
55033
|
+
each(areaGradient, function(item) {
|
|
55034
|
+
const offset = valueByType[item.type] ?? axis.toGlobalCoord(axis.dataToCoord(item.value)) / span;
|
|
55035
|
+
colorStopsInRange.push({
|
|
55036
|
+
color: item.color,
|
|
55037
|
+
offset
|
|
55038
|
+
});
|
|
55039
|
+
});
|
|
55040
|
+
const gradient = new LinearGradient_default(0, extent3[0], 0, extent3[1], colorStopsInRange, true);
|
|
55041
|
+
return gradient;
|
|
55042
|
+
}
|
|
54910
55043
|
var LinesPlotView2 = class extends Chart_default {
|
|
54911
55044
|
constructor() {
|
|
54912
55045
|
super(...arguments);
|
|
@@ -54916,8 +55049,8 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54916
55049
|
}
|
|
54917
55050
|
render(seriesModel, ecModel, api2) {
|
|
54918
55051
|
const data = seriesModel.getData();
|
|
54919
|
-
this._renderLine(data, seriesModel);
|
|
54920
|
-
this._renderArea(data, seriesModel);
|
|
55052
|
+
this._renderLine(data, seriesModel, api2);
|
|
55053
|
+
this._renderArea(data, seriesModel, api2);
|
|
54921
55054
|
this._renderSymbol(data, seriesModel);
|
|
54922
55055
|
this._renderHistogram(data, seriesModel);
|
|
54923
55056
|
this._renderBar(data, seriesModel);
|
|
@@ -54936,7 +55069,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54936
55069
|
const coordSys = seriesModel.coordinateSystem;
|
|
54937
55070
|
return coordSys && coordSys.getArea && coordSys.getArea(0.1);
|
|
54938
55071
|
}
|
|
54939
|
-
_renderLine(data, seriesModel) {
|
|
55072
|
+
_renderLine(data, seriesModel, api2) {
|
|
54940
55073
|
const linePointsByKey = data.getLayout("linePointsByKey");
|
|
54941
55074
|
const lineVisible = seriesModel.get("lineVisible");
|
|
54942
55075
|
if (lineVisible) {
|
|
@@ -54946,6 +55079,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54946
55079
|
} else {
|
|
54947
55080
|
this._lineGroup.removeAll();
|
|
54948
55081
|
}
|
|
55082
|
+
const visualColor = getVisualGradient2(data, seriesModel.coordinateSystem, api2);
|
|
54949
55083
|
const lineGroup = this._lineGroup;
|
|
54950
55084
|
const z2 = seriesModel.get("z2");
|
|
54951
55085
|
each(linePointsByKey, function(item, key) {
|
|
@@ -54957,7 +55091,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54957
55091
|
},
|
|
54958
55092
|
style: {
|
|
54959
55093
|
lineDash,
|
|
54960
|
-
stroke: color2,
|
|
55094
|
+
stroke: visualColor || color2,
|
|
54961
55095
|
lineWidth: +lineWidth
|
|
54962
55096
|
},
|
|
54963
55097
|
z2: isDefaultColor ? LastZ2 : z2
|
|
@@ -54970,7 +55104,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54970
55104
|
this._lineGroup = null;
|
|
54971
55105
|
}
|
|
54972
55106
|
}
|
|
54973
|
-
_renderArea(data, seriesModel) {
|
|
55107
|
+
_renderArea(data, seriesModel, api2) {
|
|
54974
55108
|
const areaVisible = seriesModel.get("areaVisible");
|
|
54975
55109
|
if (areaVisible) {
|
|
54976
55110
|
if (!this._polygonGroup) {
|
|
@@ -54984,6 +55118,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54984
55118
|
const histbase = seriesModel.get("histbase") || 0;
|
|
54985
55119
|
const z2 = seriesModel.get("z2");
|
|
54986
55120
|
const baseY = seriesModel.coordinateSystem.dataToPoint([0, histbase])[1];
|
|
55121
|
+
const visualColor = getAreaGradient(data, seriesModel, api2);
|
|
54987
55122
|
each(linePointsByKey, function(item, key) {
|
|
54988
55123
|
const [stroke] = key.split(":");
|
|
54989
55124
|
const {color: color2, isDefaultColor} = getFormatColor(stroke);
|
|
@@ -54993,8 +55128,8 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54993
55128
|
baseY
|
|
54994
55129
|
},
|
|
54995
55130
|
style: {
|
|
54996
|
-
stroke:
|
|
54997
|
-
fill: color2
|
|
55131
|
+
stroke: "none",
|
|
55132
|
+
fill: visualColor || color2
|
|
54998
55133
|
},
|
|
54999
55134
|
z2: isDefaultColor ? LastZ2 : z2
|
|
55000
55135
|
});
|
|
@@ -55101,7 +55236,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
55101
55236
|
const barGroup = this._barGroup;
|
|
55102
55237
|
const histbase = seriesModel.get("histbase") || 0;
|
|
55103
55238
|
const z2 = seriesModel.get("z2");
|
|
55104
|
-
const barSpace = seriesModel.coordinateSystem.getAxesByScale("ordinal")[0].scale.barSpace;
|
|
55239
|
+
const barSpace = seriesModel.coordinateSystem.getAxesByScale("ordinal")[0].scale.barSpace || calculatebandWidth(seriesModel, data);
|
|
55105
55240
|
const width = Math.floor(barSpace * 0.8);
|
|
55106
55241
|
const baseY = seriesModel.coordinateSystem.dataToPoint([0, histbase])[1];
|
|
55107
55242
|
if (width <= 1) {
|
|
@@ -55572,6 +55707,16 @@ var xCrossMapping = {
|
|
|
55572
55707
|
return {w: width * 0.7, h: width * 0.7};
|
|
55573
55708
|
}
|
|
55574
55709
|
};
|
|
55710
|
+
var shapeXCrossMapping = {
|
|
55711
|
+
huge: () => ({w: 61, h: 65}),
|
|
55712
|
+
large: () => ({w: 46, h: 39}),
|
|
55713
|
+
normal: () => ({w: 27, h: 27}),
|
|
55714
|
+
small: () => ({w: 18, h: 18}),
|
|
55715
|
+
tiny: () => ({w: 11, h: 11}),
|
|
55716
|
+
auto: (width) => {
|
|
55717
|
+
return {w: width * 0.7, h: width * 0.7};
|
|
55718
|
+
}
|
|
55719
|
+
};
|
|
55575
55720
|
var lCrossMapping = {
|
|
55576
55721
|
huge: () => ({w: 60, h: 50}),
|
|
55577
55722
|
large: () => ({w: 46, h: 38}),
|
|
@@ -55582,6 +55727,16 @@ var lCrossMapping = {
|
|
|
55582
55727
|
return {w: width * 0.7, h: width * 0.7};
|
|
55583
55728
|
}
|
|
55584
55729
|
};
|
|
55730
|
+
var shapeLCrossMapping = {
|
|
55731
|
+
huge: () => ({w: 60, h: 50}),
|
|
55732
|
+
large: () => ({w: 46, h: 38}),
|
|
55733
|
+
normal: () => ({w: 30, h: 26}),
|
|
55734
|
+
small: () => ({w: 18, h: 18}),
|
|
55735
|
+
tiny: () => ({w: 11, h: 11}),
|
|
55736
|
+
auto: (width) => {
|
|
55737
|
+
return {w: width * 0.7, h: width * 0.7};
|
|
55738
|
+
}
|
|
55739
|
+
};
|
|
55585
55740
|
var triangleMapping = {
|
|
55586
55741
|
huge: () => ({w: 63, h: 51}),
|
|
55587
55742
|
large: () => ({w: 47, h: 39}),
|
|
@@ -55592,6 +55747,16 @@ var triangleMapping = {
|
|
|
55592
55747
|
return {w: width, h: Math.max(width - 6, 1)};
|
|
55593
55748
|
}
|
|
55594
55749
|
};
|
|
55750
|
+
var shapeTriangleMapping = {
|
|
55751
|
+
huge: () => ({w: 63, h: 51}),
|
|
55752
|
+
large: () => ({w: 47, h: 39}),
|
|
55753
|
+
normal: () => ({w: 33, h: 26}),
|
|
55754
|
+
small: () => ({w: 18, h: 18}),
|
|
55755
|
+
tiny: () => ({w: 11, h: 11}),
|
|
55756
|
+
auto: (width) => {
|
|
55757
|
+
return {w: width, h: Math.max(width - 6, 1)};
|
|
55758
|
+
}
|
|
55759
|
+
};
|
|
55595
55760
|
var flagMapping = {
|
|
55596
55761
|
huge: () => ({w: 61, h: 57}),
|
|
55597
55762
|
large: () => ({w: 47, h: 43}),
|
|
@@ -55602,6 +55767,16 @@ var flagMapping = {
|
|
|
55602
55767
|
return {w: width, h: Math.max(width - 2, 1)};
|
|
55603
55768
|
}
|
|
55604
55769
|
};
|
|
55770
|
+
var shapeFlagMapping = {
|
|
55771
|
+
huge: () => ({w: 61, h: 57}),
|
|
55772
|
+
large: () => ({w: 47, h: 43}),
|
|
55773
|
+
normal: () => ({w: 31, h: 29}),
|
|
55774
|
+
small: () => ({w: 18, h: 19}),
|
|
55775
|
+
tiny: () => ({w: 11, h: 10}),
|
|
55776
|
+
auto: (width) => {
|
|
55777
|
+
return {w: width, h: Math.max(width - 2, 1)};
|
|
55778
|
+
}
|
|
55779
|
+
};
|
|
55605
55780
|
var circleMapping = {
|
|
55606
55781
|
huge: () => ({w: 61, h: 61}),
|
|
55607
55782
|
large: () => ({w: 47, h: 47}),
|
|
@@ -55612,6 +55787,16 @@ var circleMapping = {
|
|
|
55612
55787
|
return {w: width, h: width};
|
|
55613
55788
|
}
|
|
55614
55789
|
};
|
|
55790
|
+
var shapeCircleMapping = {
|
|
55791
|
+
huge: () => ({w: 61, h: 61}),
|
|
55792
|
+
large: () => ({w: 47, h: 47}),
|
|
55793
|
+
normal: () => ({w: 31, h: 31}),
|
|
55794
|
+
small: () => ({w: 18, h: 18}),
|
|
55795
|
+
tiny: () => ({w: 11, h: 11}),
|
|
55796
|
+
auto: (width) => {
|
|
55797
|
+
return {w: width, h: width};
|
|
55798
|
+
}
|
|
55799
|
+
};
|
|
55615
55800
|
var labelMapping = {
|
|
55616
55801
|
huge: () => ({w: 33, h: 28, shape: {triangleWidth: 16}}),
|
|
55617
55802
|
large: () => ({w: 25, h: 21, shape: {triangleWidth: 12}}),
|
|
@@ -55643,6 +55828,16 @@ var rectMapping = {
|
|
|
55643
55828
|
return {w: width * 0.7, h: width * 0.7};
|
|
55644
55829
|
}
|
|
55645
55830
|
};
|
|
55831
|
+
var shapeRectMapping = {
|
|
55832
|
+
huge: () => ({w: 51, h: 51}),
|
|
55833
|
+
large: () => ({w: 39, h: 39}),
|
|
55834
|
+
normal: () => ({w: 27, h: 27}),
|
|
55835
|
+
small: () => ({w: 18, h: 18}),
|
|
55836
|
+
tiny: () => ({w: 11, h: 11}),
|
|
55837
|
+
auto: (width) => {
|
|
55838
|
+
return {w: width * 0.7, h: width * 0.7};
|
|
55839
|
+
}
|
|
55840
|
+
};
|
|
55646
55841
|
var getArrowShape = (width, height, baseW) => {
|
|
55647
55842
|
const w = width * 0.6;
|
|
55648
55843
|
const rectHeight = Math.max(Math.floor((baseW - w) / 3), 0);
|
|
@@ -55681,8 +55876,28 @@ var symbolSizeMapping = {
|
|
|
55681
55876
|
arrowUp: arrowMapping,
|
|
55682
55877
|
arrowDown: arrowMapping
|
|
55683
55878
|
};
|
|
55684
|
-
|
|
55685
|
-
|
|
55879
|
+
var plotShapeSymbolSizeMapping = {
|
|
55880
|
+
xCross: shapeXCrossMapping,
|
|
55881
|
+
lCross: shapeLCrossMapping,
|
|
55882
|
+
triangle: shapeTriangleMapping,
|
|
55883
|
+
triangleDown: shapeTriangleMapping,
|
|
55884
|
+
flag: shapeFlagMapping,
|
|
55885
|
+
circle: shapeCircleMapping,
|
|
55886
|
+
rect: shapeRectMapping,
|
|
55887
|
+
diamond: shapeRectMapping,
|
|
55888
|
+
arrowUp: arrowMapping,
|
|
55889
|
+
arrowDown: arrowMapping,
|
|
55890
|
+
labelUp: labelMapping,
|
|
55891
|
+
labelDown: labelMapping,
|
|
55892
|
+
labelLeft: labelMapping,
|
|
55893
|
+
labelRight: labelMapping,
|
|
55894
|
+
labelLowerLeft: labelAngleMapping,
|
|
55895
|
+
labelLowerRight: labelAngleMapping,
|
|
55896
|
+
labelUpperLeft: labelAngleMapping,
|
|
55897
|
+
labelUpperRight: labelAngleMapping
|
|
55898
|
+
};
|
|
55899
|
+
function getSymbolSize2(type, size, width, isShape = false) {
|
|
55900
|
+
const fn = (isShape ? plotShapeSymbolSizeMapping : symbolSizeMapping)[type]?.[size];
|
|
55686
55901
|
return fn ? fn(width) : {w: 1, h: 1};
|
|
55687
55902
|
}
|
|
55688
55903
|
var labelFontSizeMapping = {
|
|
@@ -55761,6 +55976,7 @@ var labelsLayout = {
|
|
|
55761
55976
|
}
|
|
55762
55977
|
const bandWidth = Math.max(1, Math.round(coordSys.getAxesByScale("ordinal")[0].scale.barSpace * 0.8));
|
|
55763
55978
|
const location = seriesModel.get("location");
|
|
55979
|
+
const isShape = seriesModel.get("isShape");
|
|
55764
55980
|
const dims = map(coordSys.dimensions, function(dim) {
|
|
55765
55981
|
return data.mapDimension(dim);
|
|
55766
55982
|
}).slice(0, 2);
|
|
@@ -55804,7 +56020,8 @@ var labelsLayout = {
|
|
|
55804
56020
|
let position2 = labelModel.get("position") || "top";
|
|
55805
56021
|
if (location === "top" || location === "belowbar") {
|
|
55806
56022
|
position2 = "bottom";
|
|
55807
|
-
}
|
|
56023
|
+
}
|
|
56024
|
+
if (isLabel || symbol === "textOutline") {
|
|
55808
56025
|
position2 = "inside";
|
|
55809
56026
|
}
|
|
55810
56027
|
if (textShow) {
|
|
@@ -55823,7 +56040,7 @@ var labelsLayout = {
|
|
|
55823
56040
|
oldOffset = [textRect.width / 2, 0];
|
|
55824
56041
|
}
|
|
55825
56042
|
}
|
|
55826
|
-
const {w, h, shape} = getSymbolSize2(symbol, size, bandWidth);
|
|
56043
|
+
const {w, h, shape} = getSymbolSize2(symbol, size, bandWidth, isShape);
|
|
55827
56044
|
if (isLabel ? !textShow || !text : true) {
|
|
55828
56045
|
symbolSize = [w, h];
|
|
55829
56046
|
}
|
|
@@ -56113,48 +56330,6 @@ var FillPolyPath = class extends Path_default {
|
|
|
56113
56330
|
};
|
|
56114
56331
|
var FillPolyPath_default = FillPolyPath;
|
|
56115
56332
|
|
|
56116
|
-
// src/chart/fills/LargeFillPolyPath.ts
|
|
56117
|
-
var LargeFillPolyShape = class {
|
|
56118
|
-
constructor() {
|
|
56119
|
-
this.pointsByColor = {};
|
|
56120
|
-
}
|
|
56121
|
-
};
|
|
56122
|
-
var LargeFillPolyPath = class extends Path_default {
|
|
56123
|
-
constructor(opts) {
|
|
56124
|
-
super(opts);
|
|
56125
|
-
this.type = "largeFillPoly";
|
|
56126
|
-
}
|
|
56127
|
-
getDefaultStyle() {
|
|
56128
|
-
return {
|
|
56129
|
-
stroke: "transparent"
|
|
56130
|
-
};
|
|
56131
|
-
}
|
|
56132
|
-
getDefaultShape() {
|
|
56133
|
-
return new LargeFillPolyShape();
|
|
56134
|
-
}
|
|
56135
|
-
buildPath(ctx, shape) {
|
|
56136
|
-
const {pointsByColor} = shape;
|
|
56137
|
-
each(pointsByColor, function(points4, color2) {
|
|
56138
|
-
ctx.beginPathFill();
|
|
56139
|
-
for (let index = 0; index < points4.length; index++) {
|
|
56140
|
-
const polyPoints = points4[index];
|
|
56141
|
-
for (let i = 0; i < polyPoints.length; i++) {
|
|
56142
|
-
if (i === 0) {
|
|
56143
|
-
ctx.moveTo(polyPoints[i][0], polyPoints[i][1]);
|
|
56144
|
-
continue;
|
|
56145
|
-
}
|
|
56146
|
-
ctx.lineTo(polyPoints[i][0], polyPoints[i][1]);
|
|
56147
|
-
if (i + 1 === polyPoints.length) {
|
|
56148
|
-
ctx.closePath();
|
|
56149
|
-
}
|
|
56150
|
-
}
|
|
56151
|
-
}
|
|
56152
|
-
ctx.fillStyle(color2);
|
|
56153
|
-
});
|
|
56154
|
-
}
|
|
56155
|
-
};
|
|
56156
|
-
var LargeFillPolyPath_default = LargeFillPolyPath;
|
|
56157
|
-
|
|
56158
56333
|
// src/chart/fills/FillsView.ts
|
|
56159
56334
|
var FillsView2 = class extends Chart_default {
|
|
56160
56335
|
constructor() {
|
|
@@ -56175,54 +56350,40 @@ var FillsView2 = class extends Chart_default {
|
|
|
56175
56350
|
const z2 = seriesModel.get("z2");
|
|
56176
56351
|
const polygonGroup = this._polygonGroup;
|
|
56177
56352
|
const coordSys = seriesModel.coordinateSystem;
|
|
56178
|
-
|
|
56179
|
-
|
|
56180
|
-
|
|
56353
|
+
each(pointsByColor, function(points4, key) {
|
|
56354
|
+
const colors = key.split(":");
|
|
56355
|
+
let fill = key;
|
|
56356
|
+
let isDefaultFill = false;
|
|
56357
|
+
if (colors.length > 1) {
|
|
56358
|
+
const [topColor, topValue, bottomColor, bottomValue] = colors;
|
|
56359
|
+
const tValue = coordSys.dataToPoint([0, topValue])[1];
|
|
56360
|
+
const bValue = coordSys.dataToPoint([0, bottomValue])[1];
|
|
56361
|
+
fill = new LinearGradient_default(0, tValue, 0, bValue, [
|
|
56362
|
+
{
|
|
56363
|
+
offset: 0,
|
|
56364
|
+
color: topColor
|
|
56365
|
+
},
|
|
56366
|
+
{
|
|
56367
|
+
offset: 1,
|
|
56368
|
+
color: bottomColor
|
|
56369
|
+
}
|
|
56370
|
+
], true);
|
|
56371
|
+
} else {
|
|
56372
|
+
const {color: color2, isDefaultColor} = getFormatColor(fill);
|
|
56373
|
+
fill = color2;
|
|
56374
|
+
isDefaultFill = isDefaultColor;
|
|
56375
|
+
}
|
|
56376
|
+
const el = new FillPolyPath_default({
|
|
56181
56377
|
shape: {
|
|
56182
|
-
|
|
56378
|
+
points: points4
|
|
56183
56379
|
},
|
|
56184
56380
|
style: {
|
|
56185
|
-
fill
|
|
56381
|
+
fill
|
|
56186
56382
|
},
|
|
56187
|
-
z2
|
|
56383
|
+
z2: isDefaultFill ? -1 : z2
|
|
56188
56384
|
});
|
|
56189
56385
|
polygonGroup.add(el);
|
|
56190
|
-
}
|
|
56191
|
-
each(pointsByColor, function(points4, key) {
|
|
56192
|
-
const colors = key.split(":");
|
|
56193
|
-
let fill = key;
|
|
56194
|
-
let isDefaultFill = false;
|
|
56195
|
-
if (colors.length > 1) {
|
|
56196
|
-
const [topColor, topValue, bottomColor, bottomValue] = colors;
|
|
56197
|
-
const tValue = coordSys.dataToPoint([0, topValue])[1];
|
|
56198
|
-
const bValue = coordSys.dataToPoint([0, bottomValue])[1];
|
|
56199
|
-
fill = new LinearGradient_default(0, tValue, 0, bValue, [
|
|
56200
|
-
{
|
|
56201
|
-
offset: 0,
|
|
56202
|
-
color: topColor
|
|
56203
|
-
},
|
|
56204
|
-
{
|
|
56205
|
-
offset: 1,
|
|
56206
|
-
color: bottomColor
|
|
56207
|
-
}
|
|
56208
|
-
], true);
|
|
56209
|
-
} else {
|
|
56210
|
-
const {color: color2, isDefaultColor} = getFormatColor(fill);
|
|
56211
|
-
fill = color2;
|
|
56212
|
-
isDefaultFill = isDefaultColor;
|
|
56213
|
-
}
|
|
56214
|
-
const el = new FillPolyPath_default({
|
|
56215
|
-
shape: {
|
|
56216
|
-
points: points4
|
|
56217
|
-
},
|
|
56218
|
-
style: {
|
|
56219
|
-
fill
|
|
56220
|
-
},
|
|
56221
|
-
z2: isDefaultFill ? -1 : z2
|
|
56222
|
-
});
|
|
56223
|
-
polygonGroup.add(el);
|
|
56224
|
-
});
|
|
56225
|
-
}
|
|
56386
|
+
});
|
|
56226
56387
|
const clipPath = seriesModel.get("clip", true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);
|
|
56227
56388
|
if (clipPath) {
|
|
56228
56389
|
this.group.setClipPath(clipPath);
|
|
@@ -56248,8 +56409,8 @@ var FillsView_default = FillsView;
|
|
|
56248
56409
|
// src/chart/fills/fillsLayout.ts
|
|
56249
56410
|
function getKey(itemModel) {
|
|
56250
56411
|
let key = itemModel.option?.color;
|
|
56251
|
-
if (!key && itemModel.get("topValue")) {
|
|
56252
|
-
key = `${itemModel.get("topColor") || "
|
|
56412
|
+
if (!key && itemModel.get("topValue") !== void 0) {
|
|
56413
|
+
key = `${itemModel.get("topColor") || "rgba(255,255,255,0)"}:${itemModel.get("topValue")}:${itemModel.get("bottomColor") || "rgba(255,255,255,0)"}:${itemModel.get("bottomValue")}`;
|
|
56253
56414
|
}
|
|
56254
56415
|
return key || "transparent";
|
|
56255
56416
|
}
|
|
@@ -70449,6 +70610,7 @@ function removeTransparency(color2) {
|
|
|
70449
70610
|
}
|
|
70450
70611
|
|
|
70451
70612
|
// src/component/marker/MarkLabelView.ts
|
|
70613
|
+
var DefaultColor = "rgb(41,98,255)";
|
|
70452
70614
|
var markerTypeCalculator2 = {
|
|
70453
70615
|
dataMin: (item, seriesModel) => {
|
|
70454
70616
|
const seriesData = seriesModel.getData();
|
|
@@ -70492,8 +70654,8 @@ var markerTypeCalculator2 = {
|
|
|
70492
70654
|
return {
|
|
70493
70655
|
value: seriesData.getByRawIndex(item.valueDim, lastIndex),
|
|
70494
70656
|
labelTextStyle: {
|
|
70495
|
-
fill: contrastColor2(fill),
|
|
70496
|
-
backgroundColor: removeTransparency(fill),
|
|
70657
|
+
fill: fill ? contrastColor2(fill) : "#fff",
|
|
70658
|
+
backgroundColor: fill ? removeTransparency(fill) : DefaultColor,
|
|
70497
70659
|
borderWidth: 0
|
|
70498
70660
|
}
|
|
70499
70661
|
};
|
|
@@ -70518,9 +70680,9 @@ var markerTypeCalculator2 = {
|
|
|
70518
70680
|
return {
|
|
70519
70681
|
value: seriesData.getByRawIndex(item.valueDim, lastIndex),
|
|
70520
70682
|
labelTextStyle: {
|
|
70521
|
-
fill,
|
|
70683
|
+
fill: fill || DefaultColor,
|
|
70522
70684
|
backgroundColor: backgroundColor2,
|
|
70523
|
-
borderColor: fill,
|
|
70685
|
+
borderColor: fill || DefaultColor,
|
|
70524
70686
|
borderWidth: 1
|
|
70525
70687
|
}
|
|
70526
70688
|
};
|
|
@@ -70869,7 +71031,7 @@ function updateText({option, gridRect, position: position2, ecModel, el, y, offs
|
|
|
70869
71031
|
el.attr("style", fontSize ? Object.assign(style, {fontSize, padding: getPaddingByStyle(fontSize, style.borderWidth)}) : style);
|
|
70870
71032
|
inner21(el).y = y;
|
|
70871
71033
|
}
|
|
70872
|
-
function createLabel({x, y, labelData, markerModel, gridRect, position: position2, labelTextStyle, fontSize}) {
|
|
71034
|
+
function createLabel({x, y, labelData, markerModel, gridRect, position: position2, labelTextStyle = {}, fontSize}) {
|
|
70873
71035
|
const {zlevel} = markerModel.option;
|
|
70874
71036
|
const {lineStyle, showLine, showName, showTitle, title} = labelData;
|
|
70875
71037
|
const textStyle = Object.assign(labelData.textStyle ?? {}, {fontSize, padding: getPaddingByStyle(fontSize, labelTextStyle.borderWidth)}, labelTextStyle);
|
|
@@ -70896,7 +71058,7 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
70896
71058
|
ignore: !showTitle
|
|
70897
71059
|
});
|
|
70898
71060
|
const lineEl = new Line_default({
|
|
70899
|
-
style: Object.assign(lineStyle, labelTextStyle ? {stroke: labelTextStyle.backgroundColor} : {}),
|
|
71061
|
+
style: Object.assign(lineStyle, labelTextStyle.backgroundColor ? {stroke: labelTextStyle.backgroundColor} : {}),
|
|
70900
71062
|
shape: {
|
|
70901
71063
|
x1: showTitle && isLeft ? gridRect.x + 2 : gridRect.x,
|
|
70902
71064
|
y1: y,
|
|
@@ -70915,7 +71077,7 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
70915
71077
|
group.add(textNameEl);
|
|
70916
71078
|
return group;
|
|
70917
71079
|
}
|
|
70918
|
-
function updateLabel({x, y, labelData, markerModel, gridRect, position: position2, el, labelTextStyle, fontSize}) {
|
|
71080
|
+
function updateLabel({x, y, labelData, markerModel, gridRect, position: position2, el, labelTextStyle = {}, fontSize}) {
|
|
70919
71081
|
const {lineStyle, showLine, showName, showTitle, title} = labelData;
|
|
70920
71082
|
const textStyle = Object.assign(labelData.textStyle ?? {}, {fontSize, padding: getPaddingByStyle(fontSize, labelTextStyle.borderWidth)}, labelTextStyle);
|
|
70921
71083
|
const borderWidth = textStyle.borderWidth ?? 0;
|
|
@@ -70940,7 +71102,7 @@ function updateLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
70940
71102
|
x2: showTitle && !isLeft ? gridRect.x + gridRect.width - 2 : gridRect.x + gridRect.width,
|
|
70941
71103
|
y2: y
|
|
70942
71104
|
},
|
|
70943
|
-
style: Object.assign(lineStyle, labelTextStyle ? {stroke: labelTextStyle.backgroundColor} : {})
|
|
71105
|
+
style: Object.assign(lineStyle, labelTextStyle.backgroundColor ? {stroke: labelTextStyle.backgroundColor} : {})
|
|
70944
71106
|
});
|
|
70945
71107
|
element.ignore = false;
|
|
70946
71108
|
break;
|