Highcharts 和 Echarts 就像是 Office 和 WPS 的关系。
不过这也是暂时的,相信Echarts会做得更好,谁说国产的东西比不过外国。
重点是:Echarts免费,Highcharts用于商业用途时还需要授权,个人用时虽然免费,但会在图表上显示logo,有洁癖的话就只能绕道了。
一,highchars的导入与搭建
npm install highcharts
二,components下的commons公共目录下新建一个chart.vue文件,用于搭建chart组件的架子
<template>
<div class="x-bar">
<div :id="id" :option="option"></div>
</div>
</template>
<script>
import HighCharts from 'highcharts'
export default {
// 验证类型
props: {
id: {
type: String
},
option: {
type: Object
}
},