tvcharts 0.6.2 → 0.6.3

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 CHANGED
@@ -11845,7 +11845,8 @@ function getSeriesPointData(ecModel, payload = {}) {
11845
11845
  }
11846
11846
  const currentValue = data[fnKey](dim, index);
11847
11847
  const prevValue = data[fnKey](dim, index - 1);
11848
- const changePercent = ((currentValue - prevValue) / prevValue * 100).toFixed(2) + "%";
11848
+ const diffValue = currentValue - prevValue;
11849
+ const changePercent = (diffValue / prevValue * 100).toFixed(2) + "%";
11849
11850
  const seriesId = seriesModel.id;
11850
11851
  const seriesName = seriesModel.name;
11851
11852
  seriesPointData[seriesName] = {
@@ -11853,7 +11854,8 @@ function getSeriesPointData(ecModel, payload = {}) {
11853
11854
  data: values,
11854
11855
  color: color2,
11855
11856
  seriesId,
11856
- changePercent
11857
+ changePercent,
11858
+ diffValue
11857
11859
  };
11858
11860
  });
11859
11861
  return seriesPointData;
@@ -23557,6 +23559,7 @@ var ECharts = class extends Eventful_default {
23557
23559
  each(batch, (params, index) => {
23558
23560
  const seriesIndex = params.seriesIndex;
23559
23561
  const seriesName = params.seriesName;
23562
+ const isMain = params.type === "symbol";
23560
23563
  const ecModel = this.getModel();
23561
23564
  const seriesModel = seriesIndex !== void 0 ? ecModel.getSeriesByIndex(seriesIndex) : ecModel.getSeriesByName(seriesName)[0];
23562
23565
  if (true) {
@@ -23568,7 +23571,7 @@ var ECharts = class extends Eventful_default {
23568
23571
  const scale5 = seriesModel.coordinateSystem.getBaseAxis().scale;
23569
23572
  const ordinalMeta = scale5.getOrdinalMeta();
23570
23573
  const id = ordinalMeta.getLastCategories();
23571
- const isUpdate = id == paramId;
23574
+ const isUpdate = params.operation !== void 0 ? params.operation === "update" : id == paramId;
23572
23575
  if (isUpdate) {
23573
23576
  seriesModel.updateData({data: map(params.data, (item, index2) => {
23574
23577
  const idx = lastIndex + index2;
@@ -23586,7 +23589,7 @@ var ECharts = class extends Eventful_default {
23586
23589
  item[0] = idx;
23587
23590
  return item;
23588
23591
  });
23589
- if (index === 0) {
23592
+ if (isMain) {
23590
23593
  ordinalMeta.appendData(categories);
23591
23594
  }
23592
23595
  seriesModel.appendData({data: formatData});
@@ -24124,6 +24127,10 @@ ECharts.internalField = function() {
24124
24127
  let unfinished = false;
24125
24128
  ecModel.eachSeries(function(seriesModel) {
24126
24129
  const chartView = ecIns._chartsMap[seriesModel.__viewId];
24130
+ const invisible = seriesModel.get("invisible");
24131
+ if (invisible) {
24132
+ return;
24133
+ }
24127
24134
  chartView.__alive = true;
24128
24135
  const renderTask = chartView.renderTask;
24129
24136
  scheduler.updatePayload(renderTask, payload);
@@ -27765,7 +27772,7 @@ var PercentageScale = class extends Scale_default {
27765
27772
  }, this);
27766
27773
  return labels;
27767
27774
  }
27768
- getFormattedLabel(tick, idx) {
27775
+ getFormattedLabel(tick, baseValue) {
27769
27776
  const {value} = tick;
27770
27777
  const percent = this.parsePercentageValue(value, this._fromValue);
27771
27778
  return percent.toFixed(2) + "%";
@@ -27821,11 +27828,13 @@ var PercentageScale = class extends Scale_default {
27821
27828
  val = scale3(val, this._extent);
27822
27829
  return this.restorePercentageValue(val, baseValue);
27823
27830
  }
27824
- getLabel(data) {
27831
+ getLabel(data, {baseValue} = {}) {
27825
27832
  if (Number.isNaN(data.value)) {
27826
27833
  return "";
27827
27834
  }
27828
- return this.getFormattedLabel(data);
27835
+ const {value} = data;
27836
+ const percent = this.parsePercentageValue(value, baseValue ?? this._fromValue);
27837
+ return percent.toFixed(2) + "%";
27829
27838
  }
27830
27839
  getIsBaseTick(val) {
27831
27840
  const value = this.parsePercentageValue(val, this._fromValue);
@@ -39936,6 +39945,8 @@ var RoamController = class extends Eventful_default {
39936
39945
  if (this.pointerChecker && this.pointerChecker(e2, x, y)) {
39937
39946
  this._x = x;
39938
39947
  this._y = y;
39948
+ this._startX = x;
39949
+ this._startY = y;
39939
39950
  this._dragging = true;
39940
39951
  }
39941
39952
  }
@@ -39964,7 +39975,13 @@ var RoamController = class extends Eventful_default {
39964
39975
  }
39965
39976
  _mouseupHandler(e2) {
39966
39977
  if (!isMiddleOrRightButtonOnMouseUpDown(e2)) {
39967
- if (this._dragging) {
39978
+ const x = e2.offsetX;
39979
+ const y = e2.offsetY;
39980
+ const oldX = this._startX;
39981
+ const oldY = this._startY;
39982
+ const dx = x - oldX;
39983
+ const dy = y - oldY;
39984
+ if (this._dragging && (dx || dy)) {
39968
39985
  trigger(this, "dragEnd", "moveOnMouseMove", e2, {isAvailableBehavior: null});
39969
39986
  }
39970
39987
  this._dragging = false;
@@ -67312,7 +67329,7 @@ var MarkLabelView2 = class extends Component_default2 {
67312
67329
  this.type = MarkLabelView2.type;
67313
67330
  }
67314
67331
  init() {
67315
- this.markerGroupMap = createHashMap();
67332
+ this.markerGroupMapBySeries = createHashMap();
67316
67333
  this._graphicLabelElMap = createHashMap();
67317
67334
  this._graphLabelGroup = new Group_default();
67318
67335
  this.group.add(this._graphLabelGroup);
@@ -67330,10 +67347,16 @@ var MarkLabelView2 = class extends Component_default2 {
67330
67347
  this.avoidOverlap();
67331
67348
  }
67332
67349
  updateMarkLabels(markerModel, ecModel) {
67333
- const markerGroupMap = this.markerGroupMap;
67350
+ const markerGroupMapBySeries = this.markerGroupMapBySeries;
67334
67351
  const labelMap = markerModel.labelMap;
67352
+ const updatedSeriesByName = {};
67335
67353
  ecModel.eachSeries((seriesModel) => {
67354
+ const invisible = seriesModel.get("invisible");
67355
+ if (invisible) {
67356
+ return;
67357
+ }
67336
67358
  const seriesName = seriesModel.name;
67359
+ const markerGroupMap = markerGroupMapBySeries.get(seriesName) ?? createHashMap();
67337
67360
  const markLabelData = labelMap.get(seriesName);
67338
67361
  if (!markLabelData) {
67339
67362
  return;
@@ -67346,6 +67369,7 @@ var MarkLabelView2 = class extends Component_default2 {
67346
67369
  const yAxisModel = coordSys.getAxis("y");
67347
67370
  const offset = yAxisModel.model.get("offset") || 0;
67348
67371
  const x = yAxisModel.position === "right" ? gridRect.x + gridRect.width + offset : gridRect.x - offset;
67372
+ updatedSeriesByName[seriesName] = 1;
67349
67373
  each(markLabelData, (item) => {
67350
67374
  let el = markerGroupMap.get(item.name);
67351
67375
  if (item.$action === "remove") {
@@ -67365,7 +67389,8 @@ var MarkLabelView2 = class extends Component_default2 {
67365
67389
  }
67366
67390
  return;
67367
67391
  }
67368
- item.text = ["last"].includes(item.type) ? yAxisModel.scale.getLabel({value}, {precision: item.precision}) : value.toFixed(item.precision);
67392
+ const baseValue = coordSys.getBaseValue();
67393
+ item.text = ["last", "allLast"].includes(item.type) ? yAxisModel.scale.getLabel({value}, {precision: item.precision, baseValue}) : value.toFixed(item.precision);
67369
67394
  const y = coordSys.dataToPoint([0, value])[1];
67370
67395
  const fontSize = yAxisModel.getLabelModel().option.fontSize;
67371
67396
  if (el) {
@@ -67397,6 +67422,22 @@ var MarkLabelView2 = class extends Component_default2 {
67397
67422
  inner21(el).yAxisIndex = yAxisModel.index;
67398
67423
  inner21(el).isSort = item.showName;
67399
67424
  });
67425
+ markerGroupMapBySeries.set(seriesName, markerGroupMap);
67426
+ });
67427
+ markerGroupMapBySeries.each((markerGroupMap, seriesName) => {
67428
+ if (updatedSeriesByName[seriesName]) {
67429
+ return;
67430
+ }
67431
+ const markLabelData = labelMap.get(seriesName);
67432
+ each(markLabelData, (item) => {
67433
+ let el = markerGroupMap.get(item.name);
67434
+ delete markLabelData[item.name];
67435
+ if (!el) {
67436
+ return;
67437
+ }
67438
+ markerGroupMap.removeKey(item.name);
67439
+ this.group.remove(el);
67440
+ });
67400
67441
  });
67401
67442
  }
67402
67443
  updateGraphicLabels(ecModel) {
@@ -67502,15 +67543,18 @@ var MarkLabelView2 = class extends Component_default2 {
67502
67543
  }
67503
67544
  avoidOverlap() {
67504
67545
  const labelsByYAxisId = {};
67505
- this.markerGroupMap.each((item) => {
67506
- const yAxisId = inner21(item).yAxisIndex;
67507
- const isSort = inner21(item).isSort;
67508
- if (item.ignore || !isSort) {
67509
- return;
67510
- }
67511
- const labels = labelsByYAxisId[yAxisId] || [];
67512
- labels.push(item);
67513
- labelsByYAxisId[yAxisId] = labels;
67546
+ const markerGroupMapBySeries = this.markerGroupMapBySeries;
67547
+ markerGroupMapBySeries.each((markerGroupMap) => {
67548
+ markerGroupMap.each((item) => {
67549
+ const yAxisId = inner21(item).yAxisIndex;
67550
+ const isSort = inner21(item).isSort;
67551
+ if (item.ignore || !isSort) {
67552
+ return;
67553
+ }
67554
+ const labels = labelsByYAxisId[yAxisId] || [];
67555
+ labels.push(item);
67556
+ labelsByYAxisId[yAxisId] = labels;
67557
+ });
67514
67558
  });
67515
67559
  this._graphicLabelElMap.each((item) => {
67516
67560
  const yAxisId = inner21(item).yAxisIndex;