Home>Article>Web Front-end> What are the ways to introduce highcharts charts into vue projects?

What are the ways to introduce highcharts charts into vue projects?

亚连
亚连 Original
2018-06-01 11:44:57 1863browse

Below I will share with you a method (detailed explanation) of introducing highcharts charts into the vue project. It has a good reference value and I hope it will be helpful to everyone.

Npm imports highchars and imports After completion, you can develop the visual component of highchars

npm install highcharts --save

1. Create a new chart.vue component in the components directory

 

2. After the chart component is built, start creating the chart-options directory and create an options.js in it. To store the simulated chart data, as shown in the directory below

The data for a histogram I wrote as shown below

module.exports = { bar: { chart: { type:'column'//指定图表的类型,默认是折线图(line) }, credits: { enabled:false },//去掉地址 title: { text: '我的第一个图表' //指定图表标题 }, colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5' ], xAxis: { categories: ['1号', '2号', '3号','3号','3号'] //指定x轴分组 }, yAxis: { title: { text: '最近七天', //指定y轴的标题 }, }, plotOptions: { column: { colorByPoint:true }, }, series: [{ //指定数据列 name: '小明', data: [{ y:1000, color:"red"}, 5000, 4000,5000,2000] //数据 }] } }

3. Reference chart component

##

  

Effect As shown in the picture below

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Vue uses mixins to implement compressed image code

Instance of vue2.0 simulation anchor point

Vue2.0 event broadcasting and reception (observer mode)

The above is the detailed content of What are the ways to introduce highcharts charts into vue projects?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn