tvcharts 0.9.44 → 0.9.45

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.
@@ -117,7 +117,7 @@ function getStackedOnPoints(coordSys, data, dataCoordInfo) {
117
117
  }
118
118
  return points;
119
119
  }
120
- function turnPointsIntoStep(points, coordSys, stepTurnAt, connectNulls) {
120
+ export function turnPointsIntoStep(points, coordSys, stepTurnAt, connectNulls, lineWidth) {
121
121
  var baseAxis = coordSys.getBaseAxis();
122
122
  var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1;
123
123
  var stepPoints = [];
@@ -164,6 +164,11 @@ function turnPointsIntoStep(points, coordSys, stepTurnAt, connectNulls) {
164
164
  }
165
165
  // Last points
166
166
  stepPoints.push(points[i++], points[i++]);
167
+ if (lineWidth != null && lineWidth % 2 === 1) {
168
+ for (var i_1 = 0; i_1 < stepPoints.length; i_1++) {
169
+ stepPoints[i_1] = Math.floor(stepPoints[i_1]) + 0.5;
170
+ }
171
+ }
167
172
  return stepPoints;
168
173
  }
169
174
  /**
@@ -539,9 +544,10 @@ var LineView = /** @class */function (_super) {
539
544
  hasAnimation && this._initSymbolLabelAnimation(data, coordSys, clipShapeForSymbol);
540
545
  if (step) {
541
546
  // TODO If stacked series is not step
542
- points = turnPointsIntoStep(points, coordSys, step, connectNulls);
547
+ var lineWidth = lineStyleModel.get('width');
548
+ points = turnPointsIntoStep(points, coordSys, step, connectNulls, lineWidth);
543
549
  if (stackedOnPoints) {
544
- stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step, connectNulls);
550
+ stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step, connectNulls, lineWidth);
545
551
  }
546
552
  }
547
553
  polyline = this._newPolyline(points);
@@ -599,9 +605,10 @@ var LineView = /** @class */function (_super) {
599
605
  // Not do it in update with animation
600
606
  if (step) {
601
607
  // TODO If stacked series is not step
602
- points = turnPointsIntoStep(points, coordSys, step, connectNulls);
608
+ var lineWidth = lineStyleModel.get('width');
609
+ points = turnPointsIntoStep(points, coordSys, step, connectNulls, lineWidth);
603
610
  if (stackedOnPoints) {
604
- stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step, connectNulls);
611
+ stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step, connectNulls, lineWidth);
605
612
  }
606
613
  }
607
614
  polyline.setShape({
@@ -1020,10 +1027,11 @@ var LineView = /** @class */function (_super) {
1020
1027
  var stackedOnNext = diff.stackedOnNext;
1021
1028
  if (step) {
1022
1029
  // TODO If stacked series is not step
1023
- current = turnPointsIntoStep(diff.current, coordSys, step, connectNulls);
1024
- stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step, connectNulls);
1025
- next = turnPointsIntoStep(diff.next, coordSys, step, connectNulls);
1026
- stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step, connectNulls);
1030
+ var lineWidth = seriesModel.get(['lineStyle', 'width']);
1031
+ current = turnPointsIntoStep(diff.current, coordSys, step, connectNulls, lineWidth);
1032
+ stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step, connectNulls, lineWidth);
1033
+ next = turnPointsIntoStep(diff.next, coordSys, step, connectNulls, lineWidth);
1034
+ stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step, connectNulls, lineWidth);
1027
1035
  }
1028
1036
  // Don't apply animation if diff is large.
1029
1037
  // For better result and avoid memory explosion problems like
@@ -49,6 +49,7 @@ import SymbolPath from './SymbolPath.js';
49
49
  import { createSymbol } from '../../util/symbol.js';
50
50
  import { ECPolyline } from '../line/poly.js';
51
51
  import { getECData } from '../../util/innerStore.js';
52
+ import { turnPointsIntoStep } from '../line/LineView.js';
52
53
  import { toggleHoverEmphasis } from '../../util/states.js';
53
54
  // const SKIP_PROPS = ['color', 'borderColor'] as const;
54
55
  function getSmooth(smooth) {
@@ -83,14 +84,19 @@ var SymbolLineView = /** @class */function (_super) {
83
84
  var smooth = getSmooth(seriesModel.get('smooth'));
84
85
  var symbolSize = seriesModel.get('symbolSize') || 4;
85
86
  var isSimple = data.getLayout('isSimple');
87
+ var step = seriesModel.get('step');
88
+ var coordSys = seriesModel.coordinateSystem;
86
89
  var _a = symbolSize instanceof Array ? symbolSize : [symbolSize, symbolSize],
87
90
  width = _a[0],
88
91
  height = _a[1];
89
92
  var smoothMonotone = seriesModel.get('smoothMonotone');
90
93
  var ignoreBothEndsSymbol = seriesModel.get('ignoreBothEndsSymbol');
94
+ var lineStyleModel = seriesModel.getModel('lineStyle');
91
95
  var points = data.getLayout('points') || [];
96
+ if (step) {
97
+ points = turnPointsIntoStep(points, coordSys, step, connectNulls, lineStyleModel.get('width'));
98
+ }
92
99
  var polyline = this._newPolyline(points);
93
- var lineStyleModel = seriesModel.getModel('lineStyle');
94
100
  var color = lineStyleModel.get('color');
95
101
  polyline.useStyle(zrUtil.defaults(
96
102
  // Use color in lineStyle first
@@ -107,7 +113,7 @@ var SymbolLineView = /** @class */function (_super) {
107
113
  });
108
114
  polyline.states.emphasis = emphasisState;
109
115
  group.add(polyline);
110
- if (!isSimple) {
116
+ if (symbol && symbol !== 'none' && !isSimple) {
111
117
  var el = new SymbolPath({
112
118
  shape: {
113
119
  points: points,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tvcharts",
3
- "version": "0.9.44",
3
+ "version": "0.9.45",
4
4
  "main": "dist/echarts.js",
5
5
  "module": "index.js",
6
6
  "jsdelivr": "dist/echarts.min.js",
@@ -14,6 +14,7 @@ import { CoordinateSystemClipArea } from '../../coord/CoordinateSystem.js';
14
14
  import Model from '../../model/Model.js';
15
15
  declare type PolarArea = ReturnType<Polar['getArea']>;
16
16
  declare type Cartesian2DArea = ReturnType<Cartesian2D['getArea']>;
17
+ export declare function turnPointsIntoStep(points: ArrayLike<number>, coordSys: Cartesian2D | Polar, stepTurnAt: 'start' | 'end' | 'middle', connectNulls: boolean, lineWidth?: number): number[];
17
18
  export declare function canShowAllSymbolForCategory(categoryAxis: Axis2D, data: SeriesData): boolean;
18
19
  interface EndLabelAnimationRecord {
19
20
  lastFrameIndex: number;