如果按照Echarts官网来使用,就会报以下错误:
正确使用方法:
// Echarts 柱状图
drawLine() {
let echarts = require('echarts')
// 基于准备好的dom,初始化echarts实例
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,
},
],
})
},