vue或webpack加载highcharts与highcharts-3d

highcharts与highcharts-3d下载

https://jshare.com.cn/demos/hhhhiG

点击对应的文件可打开,复制代码到(创建一个同名文件)里面;放到项目对应目录下

引入

两种引入 highcharts.js 方法皆可用;注意 highcharts-3d 引入方式

import Highcharts from './static/js/highcharts.js'
// const Highcharts = require('./static/js/highcharts.js')
require('./static/js/highcharts-3d')(Highcharts)

 调用

在vue中使用

new Vue({
  el: '#app',
  data() {
    return {}
  },

  mounted() {
    this.$nextTick(() => {
      this.renderHighcharts()
    })
  },

  methods: {
    renderHighcharts() {
      var chart = Highcharts.chart('container', {
        chart: {
          type: 'pie',
          backgroundColor: 'rgba(0,0,0,0)',
          options3d: {
            enabled: true,
            alpha: 45,
            beta: 0
          }
        },
        title: {
          text: '访问量占比',
          style: {
            color: 'white',
            fontWeight: 'bold'
          }
        },
        credits: {
          enabled: false //去除图表右下角版权信息
        },
        tooltip: {
          pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
          pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            depth: 35,
            dataLabels: {
              enabled: true,
              format: '{point.name}({point.y})'
            }
          }
        },
        series: [
          {
            type: 'pie',
            name: '占比',
            style: {
              color: 'white'
            },
            data: [
              ['Firefox', 45.0],
              ['IE', 26.8],
              ['Safari', 8.5]
            ]
          }
        ]
      })
    }
  }
})

相关推荐

  1. Highcharts 动态图

    2024-02-22 13:24:03       7 阅读
  2. uniapp使用vue3打包H5,androidios白屏

    2024-02-22 13:24:03       4 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-02-22 13:24:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-02-22 13:24:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-02-22 13:24:03       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-02-22 13:24:03       20 阅读

热门阅读

  1. Handler原理总结

    2024-02-22 13:24:03       29 阅读
  2. Electron 入门

    2024-02-22 13:24:03       31 阅读
  3. LeetCode每日一题 同构字符串(哈希表)

    2024-02-22 13:24:03       30 阅读
  4. K8S实战:Centos7部署Kubernetes1.24.0集群

    2024-02-22 13:24:03       32 阅读