From 9797a5d92b75e9ffeea7e5f78ddde6c4fa6ec278 Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 21 Jul 2023 17:00:19 +0800 Subject: [PATCH] fix(chat:timeline): fix `y2` to be optional --- packages/chart/timeline/index.md | 2 +- packages/chart/timeline/timeline.component.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/chart/timeline/index.md b/packages/chart/timeline/index.md index 3913e0ac3..e537ad25a 100644 --- a/packages/chart/timeline/index.md +++ b/packages/chart/timeline/index.md @@ -18,7 +18,7 @@ module: import { G2TimelineModule } from '@delon/chart/timeline'; | `[delay]` | 延迟渲染,单位:毫秒 | `number` | `0` | | `[title]` | 图表标题 | `string,TemplateRef` | - | | `[maxAxis]` | 最大指标数量 | `number` | `2` | -| `[data]` | 数据 | `G2TimelineData[]` | - | +| `[data]` | 数据,注:根据 `maxAxis` 值传递指标数据 | `G2TimelineData[]` | - | | `[titleMap]` | 指标别名 | `G2TimelineMap` | - | | `[colorMap]` | 颜色 | `G2TimelineMap` | `{ y1: '#5B8FF9', y2: '#5AD8A6', y3: '#5D7092', y4: '#F6BD16', y5: '#E86452' }` | | `[height]` | 高度值 | `number` | `400` | diff --git a/packages/chart/timeline/timeline.component.ts b/packages/chart/timeline/timeline.component.ts index c2dc86b07..3c2cf27bb 100644 --- a/packages/chart/timeline/timeline.component.ts +++ b/packages/chart/timeline/timeline.component.ts @@ -17,6 +17,11 @@ import { toDate } from '@delon/util/date-time'; import { BooleanInput, InputBoolean, InputNumber, NumberInput } from '@delon/util/decorator'; import type { NzSafeAny } from 'ng-zorro-antd/core/types'; +/** + * 数据 + * + * 注:根据 `maxAxis` 值传递指标数据 + */ export interface G2TimelineData { /** * 时间值 @@ -25,7 +30,7 @@ export interface G2TimelineData { /** 指标1数据 */ y1: number; /** 指标2数据 */ - y2: number; + y2?: number; /** 指标3数据 */ y3?: number; /** 指标4数据 */ @@ -39,7 +44,7 @@ export interface G2TimelineMap { /** 指标1 */ y1: string; /** 指标 */ - y2: string; + y2?: string; /** 指标3 */ y3?: string; /** 指标4 */