Skip to content

Commit c67ac4c

Browse files
committed
docs: line-chart add OneDotToLine
1 parent 4e3054e commit c67ac4c

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

packages/console-line-chart/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import { ConsoleLineChart } from '@alicloud/console-chart';
2525

2626
[MDXInstruction:importDemo:XLabel](./demo/XLabel.tsx)
2727

28+
## 只有一个点数据时展示线
29+
30+
[MDXInstruction:importDemo:OneDotToLine](./demo/OneDotToLine.tsx)
31+
2832
## 自定义x轴时间刻度间距
2933

3034
通过传入`tickInterval`字段,来配置坐标轴上每个刻度之间的差值大小。注意:如果是`type`设置为`time`的话,`tickInterval`字段的值必须是时间戳(毫秒)。
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
import { ConsoleLineChart } from '@alicloud/console-chart';
3+
4+
const data = [
5+
{
6+
name: 'A产品',
7+
data: [
8+
['2015', 20]
9+
],
10+
},
11+
];
12+
13+
const config: any = {};
14+
15+
export default () => {
16+
const dataLength = data[0].data.length;
17+
if (dataLength === 1) {
18+
config.guide = {
19+
line: {
20+
start: ['0%', '0'],
21+
end: ['100%', '0'],
22+
lineStyle: {
23+
stroke: '#2196F3',
24+
lineWidth: 2,
25+
lineDash: [ 0, 0 ]
26+
},
27+
}
28+
};
29+
}
30+
return (
31+
<ConsoleLineChart data={data} config={config} height={300} />
32+
);
33+
};

packages/console-line-chart/demo/index.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import XAxisAsync from './XAxisAsync';
1414
import YAxisMin from './YAxisMin';
1515
import GradualColor from './GradualColor';
1616
import LegendClick from './LegendClick';
17+
import OneDotToLine from './OneDotToLine';
1718

1819
storiesOf('ConsoleLineChart', module)
1920
.add('基本折线图', () => <Basic />)
@@ -29,3 +30,4 @@ storiesOf('ConsoleLineChart', module)
2930
.add('面积堆栈图', () => <Stack />)
3031
.add('颜色渐变图', GradualColor)
3132
.add('图例点击控制', LegendClick)
33+
.add('只有一个点数据时展示线', OneDotToLine)

0 commit comments

Comments
 (0)