tvcharts 0.8.99 → 0.9.11
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 +137 -96
- package/dist/echarts.js.map +2 -2
- package/lib/chart/boxes/BoxesLayout.js +1 -2
- package/lib/chart/boxes/BoxesPath.js +1 -1
- package/lib/chart/boxes/util.js +17 -13
- package/lib/chart/candlePlot/CandlePlotView.js +16 -35
- package/lib/chart/candlePlot/NormalBoxPath.js +4 -4
- package/lib/chart/candlePlot/candlePlotLayout.js +56 -42
- package/lib/component/dataZoom/InsideZoomView.js +6 -7
- package/lib/component/dataZoom/helper.js +2 -2
- package/lib/component/events/EventsView.js +2 -2
- package/lib/component/helper/RoamController.js +24 -3
- package/lib/coord/Axis.js +22 -1
- package/package.json +1 -1
- package/types/src/chart/boxes/util.d.ts +2 -2
- package/types/src/chart/candlePlot/candlePlotLayout.d.ts +0 -1
- package/types/src/component/helper/RoamController.d.ts +3 -0
package/dist/echarts.js
CHANGED
|
@@ -31313,6 +31313,13 @@ function makeLabelsByCustomizedCategoryInterval(axis, categoryInterval, onlyTick
|
|
|
31313
31313
|
|
|
31314
31314
|
// src/coord/Axis.ts
|
|
31315
31315
|
var NORMALIZED_EXTENT = [0, 1];
|
|
31316
|
+
function isMobileByWidth(breakPoint = 768) {
|
|
31317
|
+
if (typeof window === "undefined")
|
|
31318
|
+
return false;
|
|
31319
|
+
const viewportWidth = window.innerWidth;
|
|
31320
|
+
return viewportWidth < breakPoint && window.devicePixelRatio !== 1;
|
|
31321
|
+
}
|
|
31322
|
+
var isMobile = isMobileByWidth();
|
|
31316
31323
|
var Axis = class {
|
|
31317
31324
|
constructor(dim, scale4, extent3) {
|
|
31318
31325
|
this.onBand = false;
|
|
@@ -31348,7 +31355,7 @@ var Axis = class {
|
|
|
31348
31355
|
const dataIndex = data;
|
|
31349
31356
|
const dataCount = this.scale.getAxisDataLen();
|
|
31350
31357
|
const deltaFromRight = dataCount + scale4.lastBarRightSideDiffBarCount - dataIndex;
|
|
31351
|
-
return Math.round(this._extent[1] - deltaFromRight * scale4.barSpace);
|
|
31358
|
+
return isMobile ? this._extent[1] - deltaFromRight * scale4.barSpace : Math.round(this._extent[1] - deltaFromRight * scale4.barSpace);
|
|
31352
31359
|
}
|
|
31353
31360
|
if (this.onBand && scale4.type === "ordinal") {
|
|
31354
31361
|
extent3 = extent3.slice();
|
|
@@ -42307,9 +42314,15 @@ function getStore(zr) {
|
|
|
42307
42314
|
registerAction({type: "takeGlobalCursor", event: "globalCursorTaken", update: "update"}, noop);
|
|
42308
42315
|
|
|
42309
42316
|
// src/component/helper/RoamController.ts
|
|
42317
|
+
function getDistance(p1, p2) {
|
|
42318
|
+
const xDiff = p1.clientX - p2.clientX;
|
|
42319
|
+
const yDiff = p1.clientY - p2.clientY;
|
|
42320
|
+
return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
|
|
42321
|
+
}
|
|
42310
42322
|
var RoamController = class extends Eventful_default {
|
|
42311
42323
|
constructor(zr) {
|
|
42312
42324
|
super();
|
|
42325
|
+
this._prevPinchScale = 1;
|
|
42313
42326
|
this._zr = zr;
|
|
42314
42327
|
const mousedownHandler = bind(this._mousedownHandler, this);
|
|
42315
42328
|
const mousemoveHandler = bind(this._mousemoveHandler, this);
|
|
@@ -42469,10 +42482,20 @@ var RoamController = class extends Eventful_default {
|
|
|
42469
42482
|
if (isTaken(this._zr, "globalPan")) {
|
|
42470
42483
|
return;
|
|
42471
42484
|
}
|
|
42472
|
-
const
|
|
42485
|
+
const touches = e2.event.touches;
|
|
42486
|
+
if (e2.pinchScale === 1) {
|
|
42487
|
+
this._prevPinchScale = 1;
|
|
42488
|
+
this._startPinchDistance = getDistance(touches[0], touches[1]);
|
|
42489
|
+
this._originX = Math.floor(e2.pinchX);
|
|
42490
|
+
return;
|
|
42491
|
+
}
|
|
42492
|
+
const currentDistance = getDistance(touches[0], touches[1]);
|
|
42493
|
+
const scale4 = currentDistance / this._startPinchDistance;
|
|
42494
|
+
const zoomScale = (scale4 - this._prevPinchScale) * 5;
|
|
42495
|
+
this._prevPinchScale = scale4;
|
|
42473
42496
|
checkPointerAndTrigger(this, "zoom", "zoomOnMouseWheel", e2, {
|
|
42474
|
-
scale:
|
|
42475
|
-
originX: e2.pinchX,
|
|
42497
|
+
scale: zoomScale,
|
|
42498
|
+
originX: this._originX || e2.pinchX,
|
|
42476
42499
|
originY: e2.pinchY,
|
|
42477
42500
|
isAvailableBehavior: null,
|
|
42478
42501
|
inSitu: true,
|
|
@@ -56688,6 +56711,11 @@ var SymbolPath_default = SymbolPath;
|
|
|
56688
56711
|
|
|
56689
56712
|
// src/chart/linesPlot/LinesPlotView.ts
|
|
56690
56713
|
var LastZ2 = -1;
|
|
56714
|
+
var lineStyleMap = {
|
|
56715
|
+
style_dotted: [2, 2],
|
|
56716
|
+
style_solid: "solid",
|
|
56717
|
+
style_dashed: [5, 5]
|
|
56718
|
+
};
|
|
56691
56719
|
function clipColorStops2(colorStops, maxSize) {
|
|
56692
56720
|
const newColorStops = [];
|
|
56693
56721
|
const len2 = colorStops.length;
|
|
@@ -56869,7 +56897,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
56869
56897
|
const z2 = seriesModel.get("z2");
|
|
56870
56898
|
const visualColor = getVisualGradient2(data, seriesModel.coordinateSystem, api2);
|
|
56871
56899
|
const connectNulls = seriesModel.get("connectNulls");
|
|
56872
|
-
const
|
|
56900
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
56873
56901
|
const step = seriesModel.get("step");
|
|
56874
56902
|
const barSpace = Math.floor((seriesModel.coordinateSystem.getAxesByScale("ordinal")[0].scale.barSpace || calculatebandWidth(seriesModel, data)) * 0.8) || 1;
|
|
56875
56903
|
each(linePointsByKey, function(item, key) {
|
|
@@ -56884,10 +56912,10 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
56884
56912
|
connectSelf: !connectNulls && !step,
|
|
56885
56913
|
barWidth: barSpace,
|
|
56886
56914
|
stroke: color2,
|
|
56887
|
-
isWebviewRender:
|
|
56915
|
+
isWebviewRender: isMobile2
|
|
56888
56916
|
},
|
|
56889
56917
|
style: {
|
|
56890
|
-
lineDash,
|
|
56918
|
+
lineDash: lineStyleMap[lineDash],
|
|
56891
56919
|
stroke: visualColor || color2,
|
|
56892
56920
|
lineWidth: +lineWidth,
|
|
56893
56921
|
lineCap: "round",
|
|
@@ -56963,7 +56991,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
56963
56991
|
const histogramGroup = this._histogramGroup;
|
|
56964
56992
|
const histbase = seriesModel.get("histbase") || 0;
|
|
56965
56993
|
const z2 = seriesModel.get("z2");
|
|
56966
|
-
const
|
|
56994
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
56967
56995
|
const baseY = seriesModel.coordinateSystem.dataToPoint([0, histbase], true)[1];
|
|
56968
56996
|
each(linePointsByKey, function(item, key) {
|
|
56969
56997
|
const [stroke, lineDash, lineWidth] = key.split(":");
|
|
@@ -56973,7 +57001,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
56973
57001
|
points: item,
|
|
56974
57002
|
baseY,
|
|
56975
57003
|
stroke: color2,
|
|
56976
|
-
isWebviewRender:
|
|
57004
|
+
isWebviewRender: isMobile2
|
|
56977
57005
|
},
|
|
56978
57006
|
style: {
|
|
56979
57007
|
stroke: color2,
|
|
@@ -57004,7 +57032,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
57004
57032
|
}
|
|
57005
57033
|
const symbolGroup = this._symbolGroup;
|
|
57006
57034
|
const z2 = seriesModel.get("z2");
|
|
57007
|
-
const
|
|
57035
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
57008
57036
|
each(symbolPointsByColor, function(item, key) {
|
|
57009
57037
|
if (shadowShape) {
|
|
57010
57038
|
const shadowEl = new SymbolPath_default({
|
|
@@ -57024,7 +57052,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
57024
57052
|
const el = new SymbolPath_default({
|
|
57025
57053
|
shape: {
|
|
57026
57054
|
points: item,
|
|
57027
|
-
isWebviewRender:
|
|
57055
|
+
isWebviewRender: isMobile2
|
|
57028
57056
|
},
|
|
57029
57057
|
style: {
|
|
57030
57058
|
fill: "#000000"
|
|
@@ -57112,7 +57140,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
57112
57140
|
});
|
|
57113
57141
|
return;
|
|
57114
57142
|
}
|
|
57115
|
-
const
|
|
57143
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
57116
57144
|
each(linePointsByKey, function(item, key) {
|
|
57117
57145
|
const [stroke] = key.split(":");
|
|
57118
57146
|
const {color: color2, isDefaultColor} = getFormatColor(stroke);
|
|
@@ -57121,7 +57149,7 @@ var LinesPlotView2 = class extends Chart_default {
|
|
|
57121
57149
|
points: item,
|
|
57122
57150
|
baseY,
|
|
57123
57151
|
width,
|
|
57124
|
-
isWebviewRender:
|
|
57152
|
+
isWebviewRender: isMobile2,
|
|
57125
57153
|
fill: color2
|
|
57126
57154
|
},
|
|
57127
57155
|
style: {
|
|
@@ -57308,7 +57336,7 @@ var linesPlotLayout = {
|
|
|
57308
57336
|
const itemModal = lineData.getRawDataItem(i);
|
|
57309
57337
|
const {
|
|
57310
57338
|
color: color2,
|
|
57311
|
-
type = "
|
|
57339
|
+
type = "style_solid",
|
|
57312
57340
|
width = "1",
|
|
57313
57341
|
rgbas
|
|
57314
57342
|
} = itemModal.lineStyle || {};
|
|
@@ -57375,7 +57403,7 @@ var linesPlotLayout = {
|
|
|
57375
57403
|
const itemModel = lineData.getItemModel(params.end);
|
|
57376
57404
|
const {
|
|
57377
57405
|
color: color3,
|
|
57378
|
-
type: type2 = "
|
|
57406
|
+
type: type2 = "style_solid",
|
|
57379
57407
|
width: width2 = "1"
|
|
57380
57408
|
} = itemModel.get("lineStyle");
|
|
57381
57409
|
stylePointInfo = {
|
|
@@ -58527,7 +58555,7 @@ var MineLinesView2 = class extends Chart_default {
|
|
|
58527
58555
|
const emphasisState = seriesModel.get("emphasis").emphasisState;
|
|
58528
58556
|
const linesGroup = this._linesGroup;
|
|
58529
58557
|
const z2 = seriesModel.get("z2");
|
|
58530
|
-
const
|
|
58558
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
58531
58559
|
const linesPointById = data.getLayout("linesPointById");
|
|
58532
58560
|
const rectWidth = api2.getWidth();
|
|
58533
58561
|
const rectHeight = api2.getHeight();
|
|
@@ -58541,7 +58569,7 @@ var MineLinesView2 = class extends Chart_default {
|
|
|
58541
58569
|
rectWidth,
|
|
58542
58570
|
rectHeight,
|
|
58543
58571
|
stroke: color2,
|
|
58544
|
-
isWebviewRender:
|
|
58572
|
+
isWebviewRender: isMobile2
|
|
58545
58573
|
},
|
|
58546
58574
|
style: {
|
|
58547
58575
|
fill: "none",
|
|
@@ -59278,7 +59306,7 @@ var BoxesPath = class extends Path_default {
|
|
|
59278
59306
|
path.lineTo(right, bottom);
|
|
59279
59307
|
path.lineTo(left, bottom);
|
|
59280
59308
|
path.closePath();
|
|
59281
|
-
if (
|
|
59309
|
+
if (i < points4.length - 2) {
|
|
59282
59310
|
hasFill && path.fillStyle(fill);
|
|
59283
59311
|
hasStroke && path.strokeStyle(stroke);
|
|
59284
59312
|
path.beginPathFill();
|
|
@@ -59330,7 +59358,7 @@ var BoxesView2 = class extends Chart_default {
|
|
|
59330
59358
|
}
|
|
59331
59359
|
const emphasisState = seriesModel.get("emphasis").emphasisState;
|
|
59332
59360
|
const groupId = seriesModel.get("groupId");
|
|
59333
|
-
const
|
|
59361
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
59334
59362
|
const linesGroup = this._linesGroup;
|
|
59335
59363
|
const z2 = seriesModel.get("z2");
|
|
59336
59364
|
const linesPointById = data.getLayout("linesPointById");
|
|
@@ -59341,7 +59369,7 @@ var BoxesView2 = class extends Chart_default {
|
|
|
59341
59369
|
points: item,
|
|
59342
59370
|
fill: fill || "none",
|
|
59343
59371
|
stroke: color2,
|
|
59344
|
-
isWebviewRender:
|
|
59372
|
+
isWebviewRender: isMobile2
|
|
59345
59373
|
},
|
|
59346
59374
|
style: {
|
|
59347
59375
|
fill: fill || "none",
|
|
@@ -59471,16 +59499,26 @@ var BoxesSeries_default = BoxesSeriesModel;
|
|
|
59471
59499
|
// src/chart/boxes/util.ts
|
|
59472
59500
|
var canvas = document.createElement("canvas");
|
|
59473
59501
|
var ctx = canvas.getContext("2d");
|
|
59474
|
-
function findFontSize(text, maxWidth, font = DefaultFamily, tolerance = 8,
|
|
59475
|
-
let low =
|
|
59476
|
-
let high =
|
|
59502
|
+
function findFontSize(text, maxWidth, font = DefaultFamily, tolerance = 8, maxHeight) {
|
|
59503
|
+
let low = 2;
|
|
59504
|
+
let high = 50;
|
|
59505
|
+
const lines = text.split("\n");
|
|
59506
|
+
const linesLength = lines.length;
|
|
59507
|
+
let maxLengthText = lines[0];
|
|
59508
|
+
for (let index = 1; index < lines.length; index++) {
|
|
59509
|
+
const element = lines[index];
|
|
59510
|
+
if (element.length > maxLengthText.length) {
|
|
59511
|
+
maxLengthText = element;
|
|
59512
|
+
}
|
|
59513
|
+
}
|
|
59477
59514
|
while (low <= high) {
|
|
59478
59515
|
const size = Math.floor((low + high) / 2);
|
|
59479
59516
|
ctx.font = `${size}px ${font}`;
|
|
59480
|
-
const
|
|
59481
|
-
|
|
59517
|
+
const isInHeight = size * linesLength <= maxHeight;
|
|
59518
|
+
const width = ctx.measureText(maxLengthText).width;
|
|
59519
|
+
if (maxWidth > width && maxWidth - width <= tolerance && isInHeight) {
|
|
59482
59520
|
return size;
|
|
59483
|
-
} else if (width < maxWidth) {
|
|
59521
|
+
} else if (width < maxWidth && isInHeight) {
|
|
59484
59522
|
low = size + 1;
|
|
59485
59523
|
} else {
|
|
59486
59524
|
high = size - 1;
|
|
@@ -59495,11 +59533,11 @@ var boxFontSizeMapping = {
|
|
|
59495
59533
|
small: 10,
|
|
59496
59534
|
tiny: 8
|
|
59497
59535
|
};
|
|
59498
|
-
function getFontSize(size, text, maxWidth, font) {
|
|
59536
|
+
function getFontSize(size, text, maxWidth, font, maxHeight) {
|
|
59499
59537
|
if (typeof size === "number") {
|
|
59500
59538
|
return size;
|
|
59501
59539
|
}
|
|
59502
|
-
return boxFontSizeMapping[size] || findFontSize(text, maxWidth, font, 2);
|
|
59540
|
+
return boxFontSizeMapping[size] || findFontSize(text, maxWidth, font, 2, maxHeight);
|
|
59503
59541
|
}
|
|
59504
59542
|
|
|
59505
59543
|
// src/chart/boxes/BoxesLayout.ts
|
|
@@ -59623,12 +59661,11 @@ var BoxesLayout = {
|
|
|
59623
59661
|
continue;
|
|
59624
59662
|
}
|
|
59625
59663
|
const {x, y, align, v_align} = getBoxPoint(startPoint, endPoint, text_halign, text_valign);
|
|
59626
|
-
const padding = Math.min(minBoxSize / 2, 8);
|
|
59627
59664
|
textList.push({
|
|
59628
59665
|
text,
|
|
59629
59666
|
text_color,
|
|
59630
59667
|
text_wrap,
|
|
59631
|
-
text_size: getFontSize(text_size, text,
|
|
59668
|
+
text_size: getFontSize(text_size, text, width2 - Math.floor(width2 / 5), font, height - Math.min(minBoxSize / 2, 10)),
|
|
59632
59669
|
align,
|
|
59633
59670
|
v_align,
|
|
59634
59671
|
width: width2,
|
|
@@ -59805,7 +59842,7 @@ function getFontSizeByBarWidth(barWidth) {
|
|
|
59805
59842
|
function getFontSize2(size, barWidth) {
|
|
59806
59843
|
return charFontSizeMapping[size] || getFontSizeByBarWidth(barWidth);
|
|
59807
59844
|
}
|
|
59808
|
-
function
|
|
59845
|
+
function getDistance2(location, fontSize) {
|
|
59809
59846
|
if (location === "absolute") {
|
|
59810
59847
|
return 0;
|
|
59811
59848
|
}
|
|
@@ -59841,7 +59878,7 @@ var CharPlotLayout = {
|
|
|
59841
59878
|
const location = seriesModel.get("location");
|
|
59842
59879
|
const size = seriesModel.get("size");
|
|
59843
59880
|
const fontSize = getFontSize2(size, bandWidth);
|
|
59844
|
-
const distance2 =
|
|
59881
|
+
const distance2 = getDistance2(location, fontSize);
|
|
59845
59882
|
const dims = map(coordSys.dimensions, function(dim) {
|
|
59846
59883
|
return data.mapDimension(dim);
|
|
59847
59884
|
}).slice(0, 2);
|
|
@@ -59919,21 +59956,21 @@ var NormalBoxPath2 = class extends Path_default {
|
|
|
59919
59956
|
return new NormalBoxPathShape2();
|
|
59920
59957
|
}
|
|
59921
59958
|
buildPath(ctx2, shape) {
|
|
59922
|
-
const {points: points4, isSimpleBox, fill, isMobile, stroke} = shape;
|
|
59959
|
+
const {points: points4, isSimpleBox, fill, isMobile: isMobile2, stroke} = shape;
|
|
59923
59960
|
for (let index = 0; index < points4.length; ) {
|
|
59924
59961
|
const point1 = points4[index++];
|
|
59925
59962
|
const point2 = points4[index++];
|
|
59926
|
-
const point3 = points4[index++];
|
|
59927
|
-
const point4 = points4[index++];
|
|
59928
59963
|
if (isSimpleBox) {
|
|
59929
59964
|
const x = point1[0];
|
|
59930
|
-
const isSame = point1[1] ===
|
|
59965
|
+
const isSame = point1[1] === point2[1];
|
|
59931
59966
|
ctx2.moveTo(x, point1[1]);
|
|
59932
|
-
ctx2.lineTo(x, isSame ? point1[1] + 1 :
|
|
59967
|
+
ctx2.lineTo(x, isSame ? point1[1] + 1 : point2[1]);
|
|
59933
59968
|
} else {
|
|
59969
|
+
const point3 = points4[index++];
|
|
59970
|
+
const point4 = points4[index++];
|
|
59934
59971
|
ctx2.rect(point1[0], point1[1], point2[0] - point1[0], point3[1] - point1[1]);
|
|
59935
59972
|
}
|
|
59936
|
-
if (
|
|
59973
|
+
if (isMobile2 && index % 16 === 0 && index !== points4.length) {
|
|
59937
59974
|
!isSimpleBox && fill && ctx2.fillStyle(fill);
|
|
59938
59975
|
stroke && ctx2.strokeStyle(stroke);
|
|
59939
59976
|
ctx2.beginPathFill();
|
|
@@ -59955,7 +59992,7 @@ var WickPath = class extends Path_default {
|
|
|
59955
59992
|
return new WickPathShape();
|
|
59956
59993
|
}
|
|
59957
59994
|
buildPath(ctx2, shape) {
|
|
59958
|
-
const {points: points4, isMobile, stroke} = shape;
|
|
59995
|
+
const {points: points4, isMobile: isMobile2, stroke} = shape;
|
|
59959
59996
|
for (let index = 0; index < points4.length; ) {
|
|
59960
59997
|
const point1 = points4[index++];
|
|
59961
59998
|
const point2 = points4[index++];
|
|
@@ -59965,7 +60002,7 @@ var WickPath = class extends Path_default {
|
|
|
59965
60002
|
ctx2.lineTo(point2[0], point2[1]);
|
|
59966
60003
|
ctx2.moveTo(point3[0], point3[1]);
|
|
59967
60004
|
ctx2.lineTo(point4[0], point4[1]);
|
|
59968
|
-
if (
|
|
60005
|
+
if (isMobile2 && stroke && index % 16 === 0 && index !== points4.length) {
|
|
59969
60006
|
ctx2.strokeStyle(stroke);
|
|
59970
60007
|
ctx2.beginPathFill();
|
|
59971
60008
|
}
|
|
@@ -59993,39 +60030,39 @@ var CandlePlotView2 = class extends Chart_default {
|
|
|
59993
60030
|
const isSimpleBox = data.getLayout("isSimpleBox");
|
|
59994
60031
|
const bodyPointsByColor = data.getLayout("bodyPointsByColor");
|
|
59995
60032
|
const wickPointsByColor = data.getLayout("wickPointsByColor");
|
|
59996
|
-
const
|
|
59997
|
-
each(
|
|
59998
|
-
const [
|
|
59999
|
-
const el = new
|
|
60033
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
60034
|
+
each(wickPointsByColor, function(points4, key) {
|
|
60035
|
+
const [stroke] = key.split(":");
|
|
60036
|
+
const el = new WickPath_default({
|
|
60000
60037
|
shape: {
|
|
60001
60038
|
points: points4,
|
|
60002
|
-
|
|
60003
|
-
fill: fill !== "none" ? fill : "",
|
|
60004
|
-
isMobile,
|
|
60039
|
+
isMobile: isMobile2,
|
|
60005
60040
|
stroke: stroke !== "none" ? stroke : ""
|
|
60006
60041
|
},
|
|
60007
60042
|
style: {
|
|
60008
|
-
fill,
|
|
60009
60043
|
stroke
|
|
60010
60044
|
}
|
|
60011
60045
|
});
|
|
60012
|
-
group.add(el);
|
|
60013
60046
|
el.states.emphasis = emphasisState;
|
|
60047
|
+
group.add(el);
|
|
60014
60048
|
});
|
|
60015
|
-
each(
|
|
60016
|
-
const [stroke] = key.split(":");
|
|
60017
|
-
const el = new
|
|
60049
|
+
each(bodyPointsByColor, function(points4, key) {
|
|
60050
|
+
const [fill, stroke] = key.split(":");
|
|
60051
|
+
const el = new NormalBoxPath_default({
|
|
60018
60052
|
shape: {
|
|
60019
60053
|
points: points4,
|
|
60020
|
-
|
|
60021
|
-
|
|
60054
|
+
isSimpleBox,
|
|
60055
|
+
fill: fill !== "none" ? fill : "",
|
|
60056
|
+
isMobile: isMobile2,
|
|
60057
|
+
stroke: stroke === "none" ? "" : stroke
|
|
60022
60058
|
},
|
|
60023
60059
|
style: {
|
|
60060
|
+
fill: isSimpleBox ? "none" : fill,
|
|
60024
60061
|
stroke
|
|
60025
60062
|
}
|
|
60026
60063
|
});
|
|
60027
|
-
el.states.emphasis = emphasisState;
|
|
60028
60064
|
group.add(el);
|
|
60065
|
+
el.states.emphasis = emphasisState;
|
|
60029
60066
|
});
|
|
60030
60067
|
const clipPath = seriesModel.get("clip", true) ? createClipPath(seriesModel.coordinateSystem, false, seriesModel) : null;
|
|
60031
60068
|
if (clipPath) {
|
|
@@ -60142,6 +60179,12 @@ var candlePlotLayout = {
|
|
|
60142
60179
|
}
|
|
60143
60180
|
const showLast = seriesModel.get("showLast");
|
|
60144
60181
|
const ignoreParentColor = seriesModel.get("ignoreParentColor");
|
|
60182
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
60183
|
+
const formatY = isMobile2 ? function(y) {
|
|
60184
|
+
return y;
|
|
60185
|
+
} : function(y) {
|
|
60186
|
+
return Math.floor(y);
|
|
60187
|
+
};
|
|
60145
60188
|
return {
|
|
60146
60189
|
progress: normalProgress
|
|
60147
60190
|
};
|
|
@@ -60162,17 +60205,17 @@ var candlePlotLayout = {
|
|
|
60162
60205
|
const ocLow = Math.min(openVal, closeVal);
|
|
60163
60206
|
const ocHigh = Math.max(openVal, closeVal);
|
|
60164
60207
|
const [ocLowX, ocLowY] = coordSys.dataToPoint([axisDimVal, ocLow]);
|
|
60165
|
-
const x = ocLowX + 0.5;
|
|
60166
|
-
const ocLowPoint = [x,
|
|
60208
|
+
const x = isMobile2 ? ocLowX : ocLowX + 0.5;
|
|
60209
|
+
const ocLowPoint = [x, formatY(ocLowY)];
|
|
60167
60210
|
const ocHighPoint = coordSys.dataToPoint([axisDimVal, ocHigh]);
|
|
60168
60211
|
ocHighPoint[0] = x;
|
|
60169
|
-
ocHighPoint[1] =
|
|
60212
|
+
ocHighPoint[1] = formatY(ocHighPoint[1]);
|
|
60170
60213
|
const lowestPoint = coordSys.dataToPoint([axisDimVal, lowestVal]);
|
|
60171
60214
|
lowestPoint[0] = x;
|
|
60172
|
-
lowestPoint[1] =
|
|
60215
|
+
lowestPoint[1] = formatY(lowestPoint[1]);
|
|
60173
60216
|
const highestPoint = coordSys.dataToPoint([axisDimVal, highestVal]);
|
|
60174
60217
|
highestPoint[0] = x;
|
|
60175
|
-
highestPoint[1] =
|
|
60218
|
+
highestPoint[1] = formatY(highestPoint[1]);
|
|
60176
60219
|
const itemModel = candleData.getItemModel(dataIndex);
|
|
60177
60220
|
const hasDojiColor = !!itemModel.get(["itemStyle", "borderColorDoji"]);
|
|
60178
60221
|
const sign = getSign2(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor);
|
|
@@ -60183,13 +60226,17 @@ var candlePlotLayout = {
|
|
|
60183
60226
|
}
|
|
60184
60227
|
const key = `${color2 || "none"}:${border || "none"}`;
|
|
60185
60228
|
const bodyPoints = bodyPointsByColor[key] || [];
|
|
60186
|
-
|
|
60187
|
-
|
|
60229
|
+
if (isSimpleBox) {
|
|
60230
|
+
bodyPoints.push(ocHighPoint, lowestPoint);
|
|
60231
|
+
} else {
|
|
60232
|
+
addBodyEnd(bodyPoints, ocHighPoint, 0);
|
|
60233
|
+
addBodyEnd(bodyPoints, ocLowPoint, 1);
|
|
60234
|
+
}
|
|
60188
60235
|
bodyPointsByColor[key] = bodyPoints;
|
|
60189
60236
|
const wickKey = getWickColor(sign, itemModel, ignoreParentColor);
|
|
60190
60237
|
if (wickKey) {
|
|
60191
60238
|
const wickPoint = wickPointsByColor[wickKey] || [];
|
|
60192
|
-
wickPoint.push(
|
|
60239
|
+
wickPoint.push(highestPoint, ocHighPoint, lowestPoint, ocLowPoint);
|
|
60193
60240
|
wickPointsByColor[wickKey] = wickPoint;
|
|
60194
60241
|
}
|
|
60195
60242
|
}
|
|
@@ -60201,8 +60248,8 @@ var candlePlotLayout = {
|
|
|
60201
60248
|
function addBodyEnd(ends, point, start2) {
|
|
60202
60249
|
const point1 = point.slice();
|
|
60203
60250
|
const point2 = point.slice();
|
|
60204
|
-
point1[
|
|
60205
|
-
point2[
|
|
60251
|
+
point1[0] = point1[0] - Math.floor(candleWidth * 0.5);
|
|
60252
|
+
point2[0] = point1[0] + candleWidth;
|
|
60206
60253
|
point1[1] += 0.5;
|
|
60207
60254
|
point2[1] += 0.5;
|
|
60208
60255
|
start2 ? ends.push(point1, point2) : ends.push(point2, point1);
|
|
@@ -60225,31 +60272,26 @@ function getSign2(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor)
|
|
|
60225
60272
|
}
|
|
60226
60273
|
return sign;
|
|
60227
60274
|
}
|
|
60275
|
+
function calculateCandleWidth2(seriesModel, data) {
|
|
60276
|
+
const baseAxis = seriesModel.getBaseAxis();
|
|
60277
|
+
let extent3;
|
|
60278
|
+
const bandWidth = baseAxis.type === "category" ? baseAxis.getBandWidth() : (extent3 = baseAxis.getExtent(), Math.abs(extent3[1] - extent3[0]) / data.count());
|
|
60279
|
+
return optimalCandlestickWidth(bandWidth, 1);
|
|
60280
|
+
}
|
|
60228
60281
|
function optimalCandlestickWidth(barSpacing, pixelRatio) {
|
|
60229
60282
|
const barSpacingSpecialCaseFrom = 2.5;
|
|
60230
60283
|
const barSpacingSpecialCaseTo = 4;
|
|
60231
60284
|
const barSpacingSpecialCaseCoeff = 3;
|
|
60232
60285
|
if (barSpacing >= barSpacingSpecialCaseFrom && barSpacing <= barSpacingSpecialCaseTo) {
|
|
60233
|
-
return Math.floor(barSpacingSpecialCaseCoeff * pixelRatio);
|
|
60234
|
-
} else if (barSpacing > barSpacingSpecialCaseTo && barSpacing <= 7.5) {
|
|
60235
|
-
return Math.floor(Math.max(barSpacing * 0.72, 1));
|
|
60286
|
+
return Math.floor(barSpacingSpecialCaseCoeff * pixelRatio) - 2;
|
|
60236
60287
|
}
|
|
60237
60288
|
const barSpacingReducingCoeff = 0.2;
|
|
60238
60289
|
const coeff = 1 - barSpacingReducingCoeff * Math.atan(Math.max(barSpacingSpecialCaseTo, barSpacing) - barSpacingSpecialCaseTo) / (Math.PI * 0.5);
|
|
60239
60290
|
const res = Math.floor(barSpacing * coeff * pixelRatio);
|
|
60240
60291
|
const scaledBarSpacing = Math.floor(barSpacing * pixelRatio);
|
|
60241
|
-
const optimal = Math.min(res, scaledBarSpacing);
|
|
60292
|
+
const optimal = Math.min(res, scaledBarSpacing) - 2;
|
|
60242
60293
|
return Math.max(Math.floor(pixelRatio), optimal);
|
|
60243
60294
|
}
|
|
60244
|
-
function calculateCandleWidth2(seriesModel, data) {
|
|
60245
|
-
const baseAxis = seriesModel.getBaseAxis();
|
|
60246
|
-
let extent3;
|
|
60247
|
-
const bandWidth = baseAxis.type === "category" ? baseAxis.getBandWidth() : (extent3 = baseAxis.getExtent(), Math.abs(extent3[1] - extent3[0]) / data.count());
|
|
60248
|
-
return optimalCandlestickWidth(bandWidth, 1);
|
|
60249
|
-
}
|
|
60250
|
-
function getRenderIndexX(bandWidth, x) {
|
|
60251
|
-
return subPixelOptimize2(x - bandWidth / 2, 1, false);
|
|
60252
|
-
}
|
|
60253
60295
|
var candlePlotLayout_default = candlePlotLayout;
|
|
60254
60296
|
|
|
60255
60297
|
// src/chart/candlePlot/install.ts
|
|
@@ -60320,7 +60362,7 @@ var BarPlotView2 = class extends Chart_default {
|
|
|
60320
60362
|
const isSimpleBox = data.getLayout("isSimpleBox");
|
|
60321
60363
|
const emphasisState = seriesModel.get("emphasis").emphasisState;
|
|
60322
60364
|
const groupId = seriesModel.get("groupId");
|
|
60323
|
-
const
|
|
60365
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
60324
60366
|
const bodyPointsByColor = data.getLayout("bodyPointsByColor");
|
|
60325
60367
|
each(bodyPointsByColor, function(points4, stroke) {
|
|
60326
60368
|
const el = new BarPath_default2({
|
|
@@ -60329,7 +60371,7 @@ var BarPlotView2 = class extends Chart_default {
|
|
|
60329
60371
|
isSimpleBox,
|
|
60330
60372
|
candleWidth,
|
|
60331
60373
|
stroke,
|
|
60332
|
-
isWebviewRender:
|
|
60374
|
+
isWebviewRender: isMobile2
|
|
60333
60375
|
},
|
|
60334
60376
|
style: {
|
|
60335
60377
|
stroke,
|
|
@@ -60605,7 +60647,7 @@ var ArrowsPlotView2 = class extends Chart_default {
|
|
|
60605
60647
|
const minheight = seriesModel.get("minheight");
|
|
60606
60648
|
const emphasisState = seriesModel.get("emphasis").emphasisState;
|
|
60607
60649
|
const groupId = seriesModel.get("groupId");
|
|
60608
|
-
const
|
|
60650
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
60609
60651
|
const upArrowsByColor = data.getLayout("upArrowsByColor");
|
|
60610
60652
|
const maxValue = data.getLayout("maxValue");
|
|
60611
60653
|
each(upArrowsByColor, function(item, color2) {
|
|
@@ -60616,7 +60658,7 @@ var ArrowsPlotView2 = class extends Chart_default {
|
|
|
60616
60658
|
minHeight: minheight,
|
|
60617
60659
|
valueLength: maxheight / maxValue,
|
|
60618
60660
|
fill: color2,
|
|
60619
|
-
isWebviewRender:
|
|
60661
|
+
isWebviewRender: isMobile2
|
|
60620
60662
|
},
|
|
60621
60663
|
style: {
|
|
60622
60664
|
fill: color2
|
|
@@ -60958,7 +61000,7 @@ var LabelsView2 = class extends Chart_default {
|
|
|
60958
61000
|
const emphasisState = seriesModel.get("emphasis").emphasisState;
|
|
60959
61001
|
const symbolGroup = this._symbolGroup;
|
|
60960
61002
|
const symbolStyleMap = data.getLayout("symbolStyleMap");
|
|
60961
|
-
const
|
|
61003
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
60962
61004
|
each(symbolStyleMap, function(item, key) {
|
|
60963
61005
|
const isLine = lineSymbols.includes(key);
|
|
60964
61006
|
const el = new SymbolPath_default3({
|
|
@@ -60966,7 +61008,7 @@ var LabelsView2 = class extends Chart_default {
|
|
|
60966
61008
|
points: item,
|
|
60967
61009
|
needCenter: !variableMap[key],
|
|
60968
61010
|
isLine,
|
|
60969
|
-
isWebviewRender:
|
|
61011
|
+
isWebviewRender: isMobile2
|
|
60970
61012
|
},
|
|
60971
61013
|
style: {
|
|
60972
61014
|
fill: "#000000",
|
|
@@ -61843,7 +61885,7 @@ var FillsView2 = class extends Chart_default {
|
|
|
61843
61885
|
render(seriesModel, ecModel, api2) {
|
|
61844
61886
|
const data = seriesModel.getData();
|
|
61845
61887
|
const pointsByColor = data.getLayout("pointsByColor");
|
|
61846
|
-
const
|
|
61888
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
61847
61889
|
if (!this._polygonGroup) {
|
|
61848
61890
|
this._polygonGroup = new Group_default();
|
|
61849
61891
|
this.group.add(this._polygonGroup);
|
|
@@ -61879,7 +61921,7 @@ var FillsView2 = class extends Chart_default {
|
|
|
61879
61921
|
const el = new FillPolyPath_default({
|
|
61880
61922
|
shape: {
|
|
61881
61923
|
points: points4,
|
|
61882
|
-
isWebviewRender:
|
|
61924
|
+
isWebviewRender: isMobile2,
|
|
61883
61925
|
fill
|
|
61884
61926
|
},
|
|
61885
61927
|
style: {
|
|
@@ -62162,7 +62204,7 @@ var BgColorView2 = class extends Chart_default {
|
|
|
62162
62204
|
} else {
|
|
62163
62205
|
this._bgColorGroup.removeAll();
|
|
62164
62206
|
}
|
|
62165
|
-
const
|
|
62207
|
+
const isMobile2 = seriesModel.get("isMobile");
|
|
62166
62208
|
const bgColorGroup = this._bgColorGroup;
|
|
62167
62209
|
const barWidth = Math.ceil(seriesModel.coordinateSystem.getBaseAxis().scale.barSpace) || 5;
|
|
62168
62210
|
const isLine = barWidth <= 4;
|
|
@@ -62174,7 +62216,7 @@ var BgColorView2 = class extends Chart_default {
|
|
|
62174
62216
|
height,
|
|
62175
62217
|
fill: isLine ? null : color2,
|
|
62176
62218
|
stroke: isLine ? color2 : "none",
|
|
62177
|
-
isWebviewRender:
|
|
62219
|
+
isWebviewRender: isMobile2
|
|
62178
62220
|
},
|
|
62179
62221
|
style: {
|
|
62180
62222
|
fill: isLine ? null : color2,
|
|
@@ -69815,8 +69857,8 @@ function collectReferCoordSysModelInfo(dataZoomModel) {
|
|
|
69815
69857
|
return coordSysInfoWrap;
|
|
69816
69858
|
}
|
|
69817
69859
|
function barSpaceLimit(barSpace, maxWidth = 200) {
|
|
69818
|
-
if (barSpace <
|
|
69819
|
-
return
|
|
69860
|
+
if (barSpace < 0.5) {
|
|
69861
|
+
return 0.5;
|
|
69820
69862
|
} else if (barSpace > maxWidth) {
|
|
69821
69863
|
return maxWidth;
|
|
69822
69864
|
}
|
|
@@ -74305,6 +74347,7 @@ var EventsView2 = class extends Component_default2 {
|
|
|
74305
74347
|
const selectedEventViewId = eventsModel.get("selectedEventViewId");
|
|
74306
74348
|
const hoverEventId = this.hoverEventId;
|
|
74307
74349
|
const lastPoint = this._lastPoint;
|
|
74350
|
+
const mouseMove = this._mouseMove.bind(this);
|
|
74308
74351
|
const borderWidth = 2;
|
|
74309
74352
|
for (let index = 0; index < data.length; index++) {
|
|
74310
74353
|
const {time, list} = data[index];
|
|
@@ -74398,11 +74441,11 @@ var EventsView2 = class extends Component_default2 {
|
|
|
74398
74441
|
});
|
|
74399
74442
|
};
|
|
74400
74443
|
img.onmouseout = mouseout;
|
|
74401
|
-
img.onmousemove =
|
|
74444
|
+
img.onmousemove = mouseMove;
|
|
74402
74445
|
img.onmouseover = mouseover;
|
|
74403
74446
|
img.onclick = click;
|
|
74404
74447
|
rect2.onmouseout = mouseout;
|
|
74405
|
-
rect2.onmousemove =
|
|
74448
|
+
rect2.onmousemove = mouseMove;
|
|
74406
74449
|
rect2.onmouseover = mouseover;
|
|
74407
74450
|
rect2.onclick = click;
|
|
74408
74451
|
}, this);
|
|
@@ -81200,11 +81243,9 @@ var getRangeHandlers = {
|
|
|
81200
81243
|
distanceRange[0] = barSpaceLimit(distanceRange[0] * e2.scale, maxWidth);
|
|
81201
81244
|
if (e2.inSitu) {
|
|
81202
81245
|
const extent3 = axisModel.axis.getExtent()[1];
|
|
81203
|
-
|
|
81246
|
+
const x = axisModel.axis.toLocalCoord(e2.originX);
|
|
81204
81247
|
if (e2.isPinch) {
|
|
81205
|
-
|
|
81206
|
-
const basex = axisModel.axis.toLocalCoord(axisModel.axis.dataToCoord(Math.floor((endIndex + startIndex) / 2)));
|
|
81207
|
-
x = getRenderIndexX(axisModel.axis.getBandWidth(), basex);
|
|
81248
|
+
distanceRange[0] = barSpaceLimit(lastDistanceRange[0] + lastDistanceRange[0] / 10 * e2.scale, maxWidth);
|
|
81208
81249
|
}
|
|
81209
81250
|
const dataCount = axisModel.axis.scale.getAxisDataLen();
|
|
81210
81251
|
const deltaFromRight = (extent3 - x) / lastDistanceRange[0];
|