-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
108 additions
and
49 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
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,25 @@ | ||
import { Area } from '@antv/g2plot'; | ||
|
||
fetch('https://gw.alipayobjects.com/os/bmw-prod/360c3eae-0c73-46f0-a982-4746a6095010.json') | ||
.then((res) => res.json()) | ||
.then((originalData) => { | ||
let cnt = 2; | ||
const area = new Area('container', { | ||
data: originalData.slice(0, cnt), | ||
xField: 'timePeriod', | ||
yField: 'value', | ||
xAxis: { | ||
range: [0, 1], | ||
}, | ||
}); | ||
area.render(); | ||
|
||
const interval = setInterval(() => { | ||
if (cnt === originalData.length) { | ||
clearInterval(interval); | ||
} else { | ||
cnt += 1; | ||
area.changeData(originalData.slice(0, cnt)); | ||
} | ||
}, 400); | ||
}); |
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,37 @@ | ||
import { Line } from '@antv/g2plot'; | ||
|
||
function getData() { | ||
// generate an array of random data | ||
const data = []; | ||
const time = new Date().getTime(); | ||
|
||
for (let i = -19; i <= 0; i += 1) { | ||
data.push({ | ||
x: time + i * 1000, | ||
y: Math.random() + 0.2, | ||
}); | ||
} | ||
return data; | ||
} | ||
|
||
const line = new Line('container', { | ||
data: getData(), | ||
padding: 'auto', | ||
xField: 'x', | ||
yField: 'y', | ||
xAxis: { | ||
type: 'time', | ||
mask: 'HH:MM:ss', | ||
}, | ||
smooth: true, | ||
point: {}, | ||
}); | ||
|
||
line.render(); | ||
|
||
setInterval(() => { | ||
const x = new Date().getTime(), // current time | ||
y = Math.random() + 0.2; | ||
const newData = line.options.data.slice(1).concat({ x, y }); | ||
line.changeData(newData); | ||
}, 1000); |
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,24 @@ | ||
{ | ||
"title": { | ||
"zh": "中文分类", | ||
"en": "Category" | ||
}, | ||
"demos": [ | ||
{ | ||
"filename": "dynamic-spline.ts", | ||
"title": { | ||
"zh": "实时刷新的曲线图", | ||
"en": "Spline updating real-time" | ||
}, | ||
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/vOmMGBA1k6/dongtaigengxinzhexiantushuju2.gif" | ||
}, | ||
{ | ||
"filename": "dynamic-area.ts", | ||
"title": { | ||
"zh": "动态更新的面积图", | ||
"en": "Area updating with dynamic" | ||
}, | ||
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/ld0NQtdLO0/mianjitugengxinshuju-after.gif" | ||
} | ||
] | ||
} |
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,4 @@ | ||
--- | ||
title: ChangeData | ||
order: 0 | ||
--- |
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,4 @@ | ||
--- | ||
title: 动态更新数据 | ||
order: 0 | ||
--- |
This file was deleted.
Oops, something went wrong.
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