-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: 补充官网阶梯图demo * chore: 修复曲线单测 --------- Co-authored-by: xuying.xu <xuying.xu@alibaba-inc.com>
- Loading branch information
1 parent
e0ccc98
commit c9a72ef
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"include": [ | ||
"**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Axis, Canvas, Chart, Line } from '@antv/f2'; | ||
|
||
const data = []; | ||
|
||
[ | ||
{ | ||
time: '2016-08-01', | ||
tem: 15, | ||
type: 'start', | ||
}, | ||
{ | ||
time: '2016-08-02', | ||
tem: 22, | ||
type: 'start', | ||
}, | ||
{ | ||
time: '2016-08-03', | ||
tem: 15, | ||
type: 'start', | ||
}, | ||
{ | ||
time: '2016-08-04', | ||
tem: 26, | ||
type: 'start', | ||
}, | ||
{ | ||
time: '2016-08-05', | ||
tem: 20, | ||
type: 'start', | ||
}, | ||
{ | ||
time: '2016-08-06', | ||
tem: 26, | ||
type: 'start', | ||
}, | ||
].map((d) => { | ||
data.push(d); | ||
data.push({ ...d, tem: d.tem + 15, type: 'middle' }); | ||
data.push({ ...d, tem: d.tem + 30, type: 'end' }); | ||
}); | ||
|
||
const context = document.getElementById('container').getContext('2d'); | ||
const { props } = ( | ||
<Canvas context={context}> | ||
<Chart data={data}> | ||
<Axis | ||
field="time" | ||
tickCount={2} | ||
style={{ | ||
label: { | ||
align: 'between', | ||
}, | ||
}} | ||
/> | ||
<Axis field="tem" tickCount={5} max={60} /> | ||
<Line | ||
x="time" | ||
y="tem" | ||
color="type" | ||
shape={{ | ||
field: 'type', | ||
range: ['step-start', 'step-middle', 'step-end'], | ||
}} | ||
/> | ||
</Chart> | ||
</Canvas> | ||
); | ||
|
||
const canvas = new Canvas(props); | ||
canvas.render(); |