EChart,又是EChart!

npm install echarts --save
引用一:
maim.js
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
one.vue
let myChart = this.$echarts.init(document.getElementById('ec'))
引用二:
two.vue
import echarts from 'echarts'
let myChart = echarts.init(document.getElementById('main'))

  myChart.setOption({
    title: {
      text: 'ECharts 入门示例'
    },
    tooltip: {},
    xAxis: {
      data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
    },
    yAxis: {},
    series: [{
      name: '销量',
      type: 'bar',
      data: [5, 20, 36, 10, 10, 20]
    }]
  })

https://www.echartsjs.com/zh/option.html
title.text:主标题文本
tooltip:提示框组件
xAxis.type:x轴,默认category
yAxis.type:y轴,默认value
series:系列列表(数据),type: 'bar/line'

标签: none

添加新评论