美文网首页
vue3中vue-echarts 6.x使用

vue3中vue-echarts 6.x使用

作者: 三省吾身_9862 | 来源:发表于2022-08-09 13:43 被阅读0次
npm i vue-echarts echarts
import VChart from 'vue-echarts'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts'
import {
  GridComponent,
  TooltipComponent,
  MarkLineComponent,
  LegendComponent
} from 'echarts/components'
use([
  CanvasRenderer,
  BarChart,
  GridComponent,
  TooltipComponent,
  MarkLineComponent,
  LegendComponent
])
export default {
  setup (props) {
    return () => <VChart style="height:500px;" option={{
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: [120, 200, 150, 80, 70, 110, 130],
          type: 'bar',
          showBackground: true,
          backgroundStyle: {
            color: 'rgba(180, 180, 180, 0.2)'
          }
        }
       ]
    }} autoresize />
  }
}

相关文章

网友评论

      本文标题:vue3中vue-echarts 6.x使用

      本文链接:https://www.haomeiwen.com/subject/dxcawrtx.html