docs: update echarts doc
This commit is contained in:
parent
f02617908f
commit
437f6cd75e
@ -64,7 +64,7 @@ export default defineUserConfig({
|
||||
|
||||
如果你需要通过脚本来获取数据,你可以使用 js 和 javascript 的代码块。
|
||||
|
||||
我们将通过 `myChart` 变量暴露 Echarts 实例,并且你应该将 Echart 配置赋值给 `option` 变量。
|
||||
我们将通过 `echarts` 变量暴露 Echarts 实例,并且你应该将 Echart 配置赋值给 `option` 变量。
|
||||
同时,你也可以赋值 `width` 和 `height` 来设置图表大小。
|
||||
|
||||
````md
|
||||
|
||||
@ -81,14 +81,14 @@ const option = {
|
||||
],
|
||||
}
|
||||
const timeId = setInterval(() => {
|
||||
if (myChart._disposed)
|
||||
if (echarts._disposed)
|
||||
return clearInterval(timeId)
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
data.shift()
|
||||
data.push(randomData())
|
||||
}
|
||||
myChart.setOption({
|
||||
echarts.setOption({
|
||||
series: [
|
||||
{
|
||||
data,
|
||||
|
||||
@ -60,13 +60,13 @@ function run() {
|
||||
for (let i = 0; i < data.length; i++)
|
||||
data[i] += Math.round(Math.random() * Math.random() > 0.9 ? 2000 : 200)
|
||||
|
||||
myChart.setOption({
|
||||
echarts.setOption({
|
||||
series: [{ type: 'bar', data }],
|
||||
})
|
||||
}
|
||||
|
||||
const timeId = setInterval(() => {
|
||||
if (myChart._disposed)
|
||||
if (echarts._disposed)
|
||||
return clearInterval(timeId)
|
||||
|
||||
run()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user