Download web/Vchart/pie/chart_0022_pie.html from chartact-benchmark/ChartAct: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Vchart/pie/chart_0022_pie.html
- Command line
-
hf download hf://datasets/chartact-benchmark/ChartAct/web/Vchart/pie/chart_0022_pie.html
-
curl -L -o chart_0022_pie.html https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Vchart/pie/chart_0022_pie.html
1.7 kB
| <div id="chart" style="width:100%;height:520px;"></div> | |
| <script src="_deps/cdn.jsdelivr.net/npm/@visactor/vchart/build/index.min.js"></script> | |
| <script type="module"> | |
| // 这里粘贴你的那段 JS 代码 | |
| const spec = { | |
| type: 'pie', | |
| data: [ | |
| { | |
| id: 'id0', | |
| values: [ | |
| { type: '0~9', value: '39.12' }, | |
| { type: '10~19', value: '43.01' }, | |
| { type: '20~29', value: '43.91' }, | |
| { type: '30~39', value: '45.4' }, | |
| { type: '40~49', value: '40.89' }, | |
| { type: '50~59', value: '42.48' }, | |
| { type: '60~69', value: '39.63' }, | |
| { type: '70~79', value: '25.17' }, | |
| { type: '80 and over', value: '12.29' } | |
| ] | |
| } | |
| ], | |
| valueField: 'value', | |
| categoryField: 'type', | |
| outerRadius: { | |
| field: 'value', | |
| scale: 'outer-radius' | |
| }, | |
| innerRadius: { | |
| field: 'value', | |
| scale: 'inner-radius' | |
| }, | |
| scales: [ | |
| { | |
| id: 'outer-radius', | |
| type: 'linear', | |
| domain: [10, 50], | |
| range: [120, 220] | |
| }, | |
| { | |
| id: 'inner-radius', | |
| type: 'linear', | |
| domain: [10, 50], | |
| range: [110, 10] | |
| } | |
| ], | |
| label: { | |
| visible: true | |
| }, | |
| color: ['#98abc5', '#8a89a6', '#7b6888', '#6b486b', '#a05d56', '#d0743c', '#ff8c00'], | |
| title: { | |
| visible: true, | |
| text: 'Population Distribution by Age in the United States, 2021 (in millions)', | |
| textStyle: { | |
| fontFamily: 'Times New Roman' | |
| } | |
| }, | |
| legends: { | |
| visible: true, | |
| orient: 'right' | |
| } | |
| }; | |
| const vchart = new VChart.default(spec, { dom: "chart" }); | |
| vchart.renderSync(); | |
| // Just for the convenience of console debugging, DO NOT COPY! | |
| window['vchart'] = vchart; | |
| // 只要记得:dom 要写成 "chart" | |
| </script> | |