Vue highCharts数据可视化

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Vue highCharts数据可视化

明知山_   2022-05-28 我要评论

效果图

文档Api地址

安装

npm install highcharts-vue

在main.js进行全局配置

import HighchartsVue from 'highcharts-vue'
Vue.use(HighchartsVue)
<highcharts :options="chartOptions"></highcharts>
<script>
export default {
  data() {
    return {
      chartOptions: {}
    };
  },
  mounted(){
  this.getChart()
  }
  methods:{
    getChart() {
      var template = {
        title: {
          //去掉标题
          text: ""
        },
        xAxis: {
          //自定义x轴
          categories:["05-21", "05-22", "05-23", "05-24", "05-25", "05-26", "05-27"]
        },
        yAxis: {
          //去掉y轴的value
          title: { text: "" }
        },
        credits: {
          //去掉水印
          enabled: false
        },
        plotOptions: {
          line: {
            //设置颜色,显示点
            color: "#0e6145",
            dataLabels: {
              enabled: true
            }
          }
        },
        series: [
          {
            name: "活跃度",
            data: [0, 0, 0, 0, 0, 1, 9]
          }
        ]
      };
      this.chartOptions = template;
    }
  }
 },
</script>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们