美文网首页
vue中使用echarts

vue中使用echarts

作者: 莫soso | 来源:发表于2019-08-22 15:20 被阅读0次

安装看上一篇:https://www.jianshu.com/p/a67d78f3a3a9

注意:表格不显示可能是因为没有给他设置大小宽高。


<template>

    <div id="echarts" style="position: absolute; top: 50px; left:200px;width: 300px;height: 300px">

  </div>

</template>

<script>

  import echarts from 'echarts'

  export default {

    name: 'hello',

    data() {

      return {

        mychart: null

      }

},

    mounted() {

      this.shipchart();

},

    methods: {

     shipchart() {

        this.mychart = echarts.init(document.getElementById('echarts'))

        this.mychart.setOption({

          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',

            barWidth: "50%"

          }]

})

}

}

}

</script>

<style scoped>

</style>

相关文章

网友评论

      本文标题:vue中使用echarts

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