Chart / olddataset /web /Vchart /line /chart_0017_line.html
Pekku's picture
Upload folder using huggingface_hub
79dc9c8 verified
<div id="chart" style="width:100%;height:520px;"></div>
<script src="https://cdn.jsdelivr.net/npm/@visactor/vchart/build/index.min.js"></script>
<script>
// 这里粘贴你的那段 JS 代码
const spec = {
type: 'line',
data: {
values: [
{
x: '1st',
y: 0.012
},
{
x: '2nd',
y: -0.01
},
{
x: '3rd',
y: 0.005
},
{
x: '4th',
y: 0.007
},
{
x: '5th',
y: 0.01
},
{
x: '6th',
y: 0.017
},
{
x: '7th',
y: 0.022
},
{
x: '8th (prediction)',
y: 0.033,
latest: true
}
]
},
xField: 'x',
yField: 'y',
line: {
style: {
lineDash: data => {
if (data.latest) {
return [5, 5];
}
return [0];
}
}
}
};
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>