Skip to content

Commit

Permalink
docs: 添加line-sample DEMO案例 (#5702)
Browse files Browse the repository at this point in the history
* docs: 添加line-sample DEMO案例

* docs: 添加实例截图
  • Loading branch information
iamzone authored Nov 1, 2023
1 parent 4b27ba7 commit 05e408a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions site/docs/spec/transform/sample.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ chart
.line()
.encode('x', 'x')
.encode('y', 'y')
.transform([
.transform({
type: 'sample',
thresholds: 500,
strategy: 'max',
])
})

chart.render();
```
Expand Down
26 changes: 26 additions & 0 deletions site/examples/general/line/demo/line-sample.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* A recreation of this demo: https://observablehq.com/@d3/line-chart
*/
import { Chart } from '@antv/g2';

const chart = new Chart({
container: 'container',
autoFit: true,
});

chart
.line()
.data({
type: 'fetch',
value:
'https://gw.alipayobjects.com/os/bmw-prod/551d80c6-a6be-4f3c-a82a-abd739e12977.csv',
})
.encode('x', 'date')
.encode('y', 'close')
.transform({
type: 'sample',
thresholds: 500,
strategy: 'max',
});

chart.render();
10 changes: 9 additions & 1 deletion site/examples/general/line/demo/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
},
"screenshot": "https://mdn.alipayobjects.com/mdn/huamei_qa8qxu/afts/img/A*jTdCR7wVFZAAAAAAAAAAAAAADmJ7AQ"
},
{
"filename": "line-sample.ts",
"title": {
"zh": "数据样本折线图",
"en": "Sample Data Line Chart"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*AoLUS4D86LwAAAAAAAAAAAAADmJ7AQ/original"
},
{
"filename": "line-connect-nulls.ts",
"title": {
Expand Down Expand Up @@ -109,4 +117,4 @@
"screenshot": "https://mdn.alipayobjects.com/mdn/huamei_qa8qxu/afts/img/A*zrqfRKBLvAsAAAAAAAAAAAAADmJ7AQ"
}
]
}
}

0 comments on commit 05e408a

Please sign in to comment.