如果按照Echarts官網(wǎng)來(lái)使用势决,就會(huì)報(bào)以下錯(cuò)誤:
正確使用方法:
// Echarts 柱狀圖
drawLine() {
let echarts = require('echarts')
// 基于準(zhǔn)備好的dom侠仇,初始化echarts實(shí)例
let myChart = echarts.init(document.getElementById('registerChart'))
// 繪制圖表
myChart.setOption({
grid: {
left: '3%',
right: '2%',
bottom: '3%',
containLabel: true,
},
xAxis: [
{
type: 'category',
data: [1,2,3,4,5,6,7],
axisTick: {
alignWithLabel: true,
},
},
],
yAxis: [
{
type: 'value',
},
],
series: [
{
type: 'bar',
data:[22,28,36,52,88,66,42],
barWidth: 24,
},
],
})
},