diff --git a/common/changes/@visactor/vchart/fix-fix-error-of-markline-when-series-no-data_2025-10-09-07-30.json b/common/changes/@visactor/vchart/fix-fix-error-of-markline-when-series-no-data_2025-10-09-07-30.json new file mode 100644 index 0000000000..dc53f5fa6a --- /dev/null +++ b/common/changes/@visactor/vchart/fix-fix-error-of-markline-when-series-no-data_2025-10-09-07-30.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix issue of markline will report an error when series has no data\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "lixuef1313@163.com" +} \ No newline at end of file diff --git a/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts b/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts index 7ca8390c6a..84d7d500b9 100644 --- a/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts +++ b/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts @@ -111,6 +111,10 @@ export class CartesianMarkLine extends BaseMarkLine { expandDistanceValue = expandDistance as number; } const { points, limitRect } = updateAttrs; + if (!points || points.length < 2) { + this._markerComponent?.setAttributes(updateAttrs); + return; + } const joinPoints = getInsertPoints( (points as IPoint[])[0],