vue中使用highchart

1.安装highchart依赖并导入

import Highcharts from 'highcharts'
import HighchartsNoData from 'highcharts-no-data-to-display'
import HighchartsMore from 'highcharts-more'

HighchartsNoData(Highcharts);//导入hightchart
HighchartsMore(Highcharts);

2.使用highchart

Highcharts.chart('HighChartid', {//id   => 类似
chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: '' }, tooltip: { pointFormat: '{series.name}: {point.percentage:.1f}%' }, credits: { enabled: false }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '{point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' } }, colors: [ "#21c393", //不合格 "#4879df", // 合格 "#fad567", // 良好 "#f44a36", //优秀 ], } }, series: [{ type: 'pie', name: '占比', data: dataArr//为要处理的格式,对应官网api的格式填写即可 }] });

你可能感兴趣的:(vue)