tvcharts 0.6.25 → 0.6.27
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 +76 -29
- package/dist/echarts.js.map +2 -2
- package/lib/chart/candlestick/CandlestickView.js +2 -0
- package/lib/chart/candlestick/candlestickLayout.js +4 -3
- package/lib/chart/fills/FillPolyPath.js +1 -1
- package/lib/chart/fills/FillsView.js +21 -10
- package/lib/chart/fills/fillsLayout.js +15 -15
- package/lib/chart/labels/labelsLayout.js +10 -8
- package/lib/chart/labels/labelsVisual.js +17 -15
- package/lib/chart/linesPlot/BarPath.js +13 -11
- package/lib/chart/linesPlot/LinesPlotView.js +40 -29
- package/lib/chart/linesPlot/linesPlotLayout.js +17 -13
- package/lib/component/dataZoom/AxisProxy.js +5 -1
- package/lib/util/format.js +13 -0
- package/package.json +1 -1
- package/types/src/chart/fills/FillsView.d.ts +5 -5
- package/types/src/chart/fills/fillsLayout.d.ts +1 -1
- package/types/src/chart/labels/LabelsSeries.d.ts +2 -2
- package/types/src/chart/linesPlot/BarPath.d.ts +2 -2
- package/types/src/util/format.d.ts +4 -0
package/dist/echarts.js
CHANGED
|
@@ -15396,6 +15396,19 @@ function windowOpen(link, target) {
|
|
|
15396
15396
|
window.open(link, target);
|
|
15397
15397
|
}
|
|
15398
15398
|
}
|
|
15399
|
+
function getFormatColor(color2) {
|
|
15400
|
+
if (~color2.indexOf("defaultColor")) {
|
|
15401
|
+
const colors = color2.split("_");
|
|
15402
|
+
return {
|
|
15403
|
+
color: `rgba(0, 0, 0, ${colors[1]})`,
|
|
15404
|
+
isDefaultColor: true
|
|
15405
|
+
};
|
|
15406
|
+
}
|
|
15407
|
+
return {
|
|
15408
|
+
isDefaultColor: false,
|
|
15409
|
+
color: color2
|
|
15410
|
+
};
|
|
15411
|
+
}
|
|
15399
15412
|
|
|
15400
15413
|
// src/util/layout.ts
|
|
15401
15414
|
var each2 = each;
|
|
@@ -53279,6 +53292,7 @@ var candlestickLayout = {
|
|
|
53279
53292
|
const points4 = isNaN(axisDimVal) || isNaN(val) ? [NaN, NaN] : coordSys.dataToPoint(p);
|
|
53280
53293
|
if (!isNaN(points4[0])) {
|
|
53281
53294
|
points4[0] = points4[0] + 0.5;
|
|
53295
|
+
points4[1] = Math.floor(points4[1]);
|
|
53282
53296
|
}
|
|
53283
53297
|
return points4;
|
|
53284
53298
|
}
|
|
@@ -53334,11 +53348,11 @@ var candlestickLayout = {
|
|
|
53334
53348
|
tmpIn[cDimIdx] = axisDimVal;
|
|
53335
53349
|
tmpIn[vDimIdx] = lowestVal;
|
|
53336
53350
|
point = coordSys.dataToPoint(tmpIn, null, tmpOut);
|
|
53337
|
-
points4[offset++] = point ? point[0] : NaN;
|
|
53338
|
-
points4[offset++] = point ? point[1] : NaN;
|
|
53351
|
+
points4[offset++] = point ? point[0] + 0.5 : NaN;
|
|
53352
|
+
points4[offset++] = point ? Math.floor(point[1]) : NaN;
|
|
53339
53353
|
tmpIn[vDimIdx] = highestVal;
|
|
53340
53354
|
point = coordSys.dataToPoint(tmpIn, null, tmpOut);
|
|
53341
|
-
points4[offset++] = point ? point[1] : NaN;
|
|
53355
|
+
points4[offset++] = point ? Math.floor(point[1]) : NaN;
|
|
53342
53356
|
if (points4[offset - 1] === points4[offset - 2]) {
|
|
53343
53357
|
points4[offset - 1] += 1;
|
|
53344
53358
|
}
|
|
@@ -54780,7 +54794,14 @@ var BarPlotPath = class extends Path_default {
|
|
|
54780
54794
|
continue;
|
|
54781
54795
|
}
|
|
54782
54796
|
const [x, y] = point;
|
|
54783
|
-
|
|
54797
|
+
const leftX = Math.floor(x - offset);
|
|
54798
|
+
const rightX = Math.floor(x + offset);
|
|
54799
|
+
const dataY = Math.floor(y);
|
|
54800
|
+
ctx.moveTo(leftX, dataY);
|
|
54801
|
+
ctx.lineTo(rightX, dataY);
|
|
54802
|
+
ctx.lineTo(rightX, baseY);
|
|
54803
|
+
ctx.lineTo(leftX, baseY);
|
|
54804
|
+
ctx.lineTo(leftX, dataY);
|
|
54784
54805
|
}
|
|
54785
54806
|
}
|
|
54786
54807
|
};
|
|
@@ -54822,6 +54843,7 @@ var SymbolPath = class extends Path_default {
|
|
|
54822
54843
|
var SymbolPath_default = SymbolPath;
|
|
54823
54844
|
|
|
54824
54845
|
// src/chart/linesPlot/LinesPlotView.ts
|
|
54846
|
+
var LastZ2 = -1;
|
|
54825
54847
|
var LinesPlotView2 = class extends Chart_default {
|
|
54826
54848
|
constructor() {
|
|
54827
54849
|
super(...arguments);
|
|
@@ -54862,19 +54884,20 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54862
54884
|
this._lineGroup.removeAll();
|
|
54863
54885
|
}
|
|
54864
54886
|
const lineGroup = this._lineGroup;
|
|
54887
|
+
const z2 = seriesModel.get("z2");
|
|
54865
54888
|
each(linePointsByKey, function(item, key) {
|
|
54866
|
-
const [stroke, lineDash, lineWidth] = key.split("
|
|
54867
|
-
const
|
|
54889
|
+
const [stroke, lineDash, lineWidth] = key.split(":");
|
|
54890
|
+
const {color: color2, isDefaultColor} = getFormatColor(stroke);
|
|
54868
54891
|
const el = new LinePlotPath_default({
|
|
54869
54892
|
shape: {
|
|
54870
54893
|
points: item
|
|
54871
54894
|
},
|
|
54872
54895
|
style: {
|
|
54873
54896
|
lineDash,
|
|
54874
|
-
stroke,
|
|
54897
|
+
stroke: color2,
|
|
54875
54898
|
lineWidth: +lineWidth
|
|
54876
54899
|
},
|
|
54877
|
-
z2
|
|
54900
|
+
z2: isDefaultColor ? LastZ2 : z2
|
|
54878
54901
|
});
|
|
54879
54902
|
lineGroup.add(el);
|
|
54880
54903
|
});
|
|
@@ -54899,16 +54922,18 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54899
54922
|
const z2 = seriesModel.get("z2");
|
|
54900
54923
|
const baseY = seriesModel.coordinateSystem.dataToPoint([0, histbase])[1];
|
|
54901
54924
|
each(linePointsByKey, function(item, key) {
|
|
54902
|
-
const [stroke
|
|
54925
|
+
const [stroke] = key.split(":");
|
|
54926
|
+
const {color: color2, isDefaultColor} = getFormatColor(stroke);
|
|
54903
54927
|
const el = new PolyPlotPath_default({
|
|
54904
54928
|
shape: {
|
|
54905
54929
|
points: item,
|
|
54906
54930
|
baseY
|
|
54907
54931
|
},
|
|
54908
54932
|
style: {
|
|
54909
|
-
|
|
54933
|
+
stroke: color2,
|
|
54934
|
+
fill: color2
|
|
54910
54935
|
},
|
|
54911
|
-
z2
|
|
54936
|
+
z2: isDefaultColor ? LastZ2 : z2
|
|
54912
54937
|
});
|
|
54913
54938
|
polygonGroup.add(el);
|
|
54914
54939
|
});
|
|
@@ -54933,17 +54958,18 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
54933
54958
|
const z2 = seriesModel.get("z2");
|
|
54934
54959
|
const baseY = seriesModel.coordinateSystem.dataToPoint([0, histbase])[1];
|
|
54935
54960
|
each(linePointsByKey, function(item, key) {
|
|
54936
|
-
const [stroke, lineDash, lineWidth] = key.split("
|
|
54961
|
+
const [stroke, lineDash, lineWidth] = key.split(":");
|
|
54962
|
+
const {color: color2, isDefaultColor} = getFormatColor(stroke);
|
|
54937
54963
|
const el = new HistogramPlotPath_default({
|
|
54938
54964
|
shape: {
|
|
54939
54965
|
points: item,
|
|
54940
54966
|
baseY
|
|
54941
54967
|
},
|
|
54942
54968
|
style: {
|
|
54943
|
-
stroke,
|
|
54969
|
+
stroke: color2,
|
|
54944
54970
|
lineWidth: +lineWidth
|
|
54945
54971
|
},
|
|
54946
|
-
z2
|
|
54972
|
+
z2: isDefaultColor ? LastZ2 : z2
|
|
54947
54973
|
});
|
|
54948
54974
|
histogramGroup.add(el);
|
|
54949
54975
|
});
|
|
@@ -55017,23 +55043,25 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
55017
55043
|
const baseY = seriesModel.coordinateSystem.dataToPoint([0, histbase])[1];
|
|
55018
55044
|
if (width <= 1) {
|
|
55019
55045
|
each(linePointsByKey, function(item, key) {
|
|
55020
|
-
const [stroke] = key.split("
|
|
55046
|
+
const [stroke] = key.split(":");
|
|
55047
|
+
const {color: color2, isDefaultColor} = getFormatColor(stroke);
|
|
55021
55048
|
const el = new HistogramPlotPath_default({
|
|
55022
55049
|
shape: {
|
|
55023
55050
|
points: item,
|
|
55024
55051
|
baseY
|
|
55025
55052
|
},
|
|
55026
55053
|
style: {
|
|
55027
|
-
stroke
|
|
55054
|
+
stroke: color2
|
|
55028
55055
|
},
|
|
55029
|
-
z2
|
|
55056
|
+
z2: isDefaultColor ? LastZ2 : z2
|
|
55030
55057
|
});
|
|
55031
55058
|
barGroup.add(el);
|
|
55032
55059
|
});
|
|
55033
55060
|
return;
|
|
55034
55061
|
}
|
|
55035
55062
|
each(linePointsByKey, function(item, key) {
|
|
55036
|
-
const [stroke] = key.split("
|
|
55063
|
+
const [stroke] = key.split(":");
|
|
55064
|
+
const {color: color2, isDefaultColor} = getFormatColor(stroke);
|
|
55037
55065
|
const el = new BarPath_default({
|
|
55038
55066
|
shape: {
|
|
55039
55067
|
points: item,
|
|
@@ -55041,9 +55069,9 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
55041
55069
|
width
|
|
55042
55070
|
},
|
|
55043
55071
|
style: {
|
|
55044
|
-
fill:
|
|
55072
|
+
fill: color2
|
|
55045
55073
|
},
|
|
55046
|
-
z2
|
|
55074
|
+
z2: isDefaultColor ? LastZ2 : z2
|
|
55047
55075
|
});
|
|
55048
55076
|
barGroup.add(el);
|
|
55049
55077
|
});
|
|
@@ -55133,6 +55161,10 @@ function optimizePixels(point) {
|
|
|
55133
55161
|
point[0] = point[0] + 0.5;
|
|
55134
55162
|
return point;
|
|
55135
55163
|
}
|
|
55164
|
+
function optimizeStepPoint(point, lineWidth) {
|
|
55165
|
+
point[0] = lineWidth % 2 === 0 ? Math.floor(point[0]) : Math.floor(point[0]) + 0.5;
|
|
55166
|
+
point[1] = lineWidth % 2 === 0 ? Math.floor(point[1]) : Math.floor(point[1]) + 0.5;
|
|
55167
|
+
}
|
|
55136
55168
|
var linesPlotLayout = {
|
|
55137
55169
|
seriesType: "linesPlot",
|
|
55138
55170
|
plan: createRenderPlanner(),
|
|
@@ -55178,7 +55210,7 @@ var linesPlotLayout = {
|
|
|
55178
55210
|
symbolData.push({
|
|
55179
55211
|
point,
|
|
55180
55212
|
size: dataModal.get("symbolSize") || symbolSize,
|
|
55181
|
-
color: symbolColor
|
|
55213
|
+
color: symbolColor ? getFormatColor(symbolColor).color : symbolColor
|
|
55182
55214
|
});
|
|
55183
55215
|
symbolPointsByColor[symbolKey] = symbolData;
|
|
55184
55216
|
}
|
|
@@ -55198,13 +55230,16 @@ var linesPlotLayout = {
|
|
|
55198
55230
|
if (connectNulls && isNaN(y)) {
|
|
55199
55231
|
continue;
|
|
55200
55232
|
}
|
|
55233
|
+
const isStep = step && !isRawFirst && !isRawLast;
|
|
55201
55234
|
let nextPoint = [];
|
|
55202
55235
|
if (!isSingle && isRawLast) {
|
|
55203
55236
|
const lastPoints = linePointsByKey[lastKey] || [];
|
|
55237
|
+
if (isStep && Array.isArray(lastPoints[lastPoints.length - 1])) {
|
|
55238
|
+
point[1] = lastPoints[lastPoints.length - 1][1];
|
|
55239
|
+
}
|
|
55204
55240
|
lastPoints.push(point);
|
|
55205
55241
|
break;
|
|
55206
55242
|
}
|
|
55207
|
-
const isStep = step && !isRawFirst && !isRawLast;
|
|
55208
55243
|
if (isStep) {
|
|
55209
55244
|
let nextX = store.get(dimIdx0, i + 1);
|
|
55210
55245
|
let nextY = store.get(dimIdx1, i + 1);
|
|
@@ -55216,6 +55251,7 @@ var linesPlotLayout = {
|
|
|
55216
55251
|
nextPoint = optimizePixels(coordSys.dataToPoint([nextX + xOffset, nextY]));
|
|
55217
55252
|
const midX = (point[0] + nextPoint[0]) / 2;
|
|
55218
55253
|
point[0] = midX;
|
|
55254
|
+
point[1] = Math.floor(point[1]);
|
|
55219
55255
|
nextPoint[0] = midX;
|
|
55220
55256
|
}
|
|
55221
55257
|
const itemModel = lineData.getItemModel(isSingle ? i : i + 1);
|
|
@@ -55224,7 +55260,7 @@ var linesPlotLayout = {
|
|
|
55224
55260
|
type = "solid",
|
|
55225
55261
|
width = "1"
|
|
55226
55262
|
} = itemModel.get("lineStyle");
|
|
55227
|
-
const key = `${color2}
|
|
55263
|
+
const key = `${color2}:${type}:${width}`;
|
|
55228
55264
|
const points4 = linePointsByKey[key] || [];
|
|
55229
55265
|
if (!isSingle && lastKey !== key) {
|
|
55230
55266
|
if (lastKey) {
|
|
@@ -55235,6 +55271,8 @@ var linesPlotLayout = {
|
|
|
55235
55271
|
}
|
|
55236
55272
|
points4.push(point);
|
|
55237
55273
|
if (isStep) {
|
|
55274
|
+
optimizeStepPoint(point, +width);
|
|
55275
|
+
optimizeStepPoint(nextPoint, +width);
|
|
55238
55276
|
points4.push(nextPoint);
|
|
55239
55277
|
if (symbolByStep) {
|
|
55240
55278
|
setSymbolPoint(nextPoint, i + 1);
|
|
@@ -55947,8 +55985,9 @@ var FillsView2 = class extends Chart_default {
|
|
|
55947
55985
|
const polygonGroup = this._polygonGroup;
|
|
55948
55986
|
const coordSys = seriesModel.coordinateSystem;
|
|
55949
55987
|
each(pointsByColor, function(points4, key) {
|
|
55950
|
-
const colors = key.split("
|
|
55988
|
+
const colors = key.split(":");
|
|
55951
55989
|
let fill = key;
|
|
55990
|
+
let isDefaultFill = false;
|
|
55952
55991
|
if (colors.length > 1) {
|
|
55953
55992
|
const [topColor, topValue, bottomColor, bottomValue] = colors;
|
|
55954
55993
|
const tValue = coordSys.dataToPoint([0, topValue])[1];
|
|
@@ -55963,6 +56002,10 @@ var FillsView2 = class extends Chart_default {
|
|
|
55963
56002
|
color: bottomColor
|
|
55964
56003
|
}
|
|
55965
56004
|
], true);
|
|
56005
|
+
} else {
|
|
56006
|
+
const {color: color2, isDefaultColor} = getFormatColor(fill);
|
|
56007
|
+
fill = color2;
|
|
56008
|
+
isDefaultFill = isDefaultColor;
|
|
55966
56009
|
}
|
|
55967
56010
|
const el = new FillPolyPath_default({
|
|
55968
56011
|
shape: {
|
|
@@ -55971,7 +56014,7 @@ var FillsView2 = class extends Chart_default {
|
|
|
55971
56014
|
style: {
|
|
55972
56015
|
fill
|
|
55973
56016
|
},
|
|
55974
|
-
z2
|
|
56017
|
+
z2: isDefaultFill ? -1 : z2
|
|
55975
56018
|
});
|
|
55976
56019
|
polygonGroup.add(el);
|
|
55977
56020
|
});
|
|
@@ -56000,10 +56043,10 @@ var FillsView_default = FillsView;
|
|
|
56000
56043
|
// src/chart/fills/fillsLayout.ts
|
|
56001
56044
|
function getKey(itemModel) {
|
|
56002
56045
|
let key = itemModel.option?.color;
|
|
56003
|
-
if (!key && itemModel.get("
|
|
56004
|
-
key = `${itemModel.get("topColor")}
|
|
56046
|
+
if (!key && itemModel.get("topValue")) {
|
|
56047
|
+
key = `${itemModel.get("topColor") || "transparent"}:${itemModel.get("topValue")}:${itemModel.get("bottomColor") || "transparent"}:${itemModel.get("bottomValue")}`;
|
|
56005
56048
|
}
|
|
56006
|
-
return key;
|
|
56049
|
+
return key || "transparent";
|
|
56007
56050
|
}
|
|
56008
56051
|
var fillsLayout = {
|
|
56009
56052
|
seriesType: "fills",
|
|
@@ -64279,7 +64322,11 @@ var AxisProxy = class {
|
|
|
64279
64322
|
return;
|
|
64280
64323
|
}
|
|
64281
64324
|
if (dim === "x" && offset) {
|
|
64282
|
-
|
|
64325
|
+
if (offset > 0) {
|
|
64326
|
+
range[dim][0] = range[dim][0] - offset;
|
|
64327
|
+
} else {
|
|
64328
|
+
range[dim][1] = range[dim][1] - offset;
|
|
64329
|
+
}
|
|
64283
64330
|
}
|
|
64284
64331
|
seriesData.selectRange(range);
|
|
64285
64332
|
}
|