小編給大家分享一下vue中怎么使用hightchats,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
創(chuàng)新互聯(lián)公司專(zhuān)注為客戶(hù)提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、榮縣網(wǎng)絡(luò)推廣、微信小程序定制開(kāi)發(fā)、榮縣網(wǎng)絡(luò)營(yíng)銷(xiāo)、榮縣企業(yè)策劃、榮縣品牌公關(guān)、搜索引擎seo、人物專(zhuān)訪(fǎng)、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供榮縣建站搭建服務(wù),24小時(shí)服務(wù)熱線(xiàn):18982081108,官方網(wǎng)址:aaarwkj.com
vue中使用hightchats
1、安裝highcharts
npm install highcharts --save
2、在main.js中
import Highcharts from 'highcharts/highstock';
import HighchartsMore from 'highcharts/highcharts-more';
import HighchartsDrilldown from 'highcharts/modules/drilldown';
import Highcharts3D from 'highcharts/highcharts-3d';
import Highmaps from 'highcharts/modules/map';
HighchartsMore(Highcharts)
HighchartsDrilldown(Highcharts);
Highcharts3D(Highcharts);
Highmaps(Highcharts);
new Vue({
el: '#app',
router,
axios,
components: { App },
template: '<App/>',
methods:{
moreChart() {
var options = this.getMoreOptions(this.type);
if (this.chart) {
this.chart.destroy();
};
// 初始化 Highcharts 圖表
this.chart = new Highcharts.Chart('highcharts-more', options);
}
}
})
3、創(chuàng)建chart組件
<template>
<p class="chart">
<p :id="id" :option="option"></p>
</p>
</template>
<script>
import HighCharts from 'highcharts'
export default {
// 驗(yàn)證類(lèi)型
props: {
id: {
type: String
},
option: {
type: Object
}
},
mounted() {
HighCharts.chart(this.id, this.option)
}
}
</script>
<style scoped>
</style>
4、其他組件引用圖表
<Chart :id="id" :option="option"></Chart>
import Chart from "./Chart";
export default {
name: "HelloWorld",
components: {
Chart
},
data() {
return {
msg: "Welcome to Your Vue.js App",
id: "test",
option: {
credits: {
enabled: false
},
chart: {
type: "line"
},
title: {
text: "月平均氣溫" //表頭文字
},
subtitle: {
text: "數(shù)據(jù)來(lái)源: WorldClimate.com" //表頭下文字
},
xAxis: {
//x軸顯示的內(nèi)容
categories: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"
],
plotbands: [
{
//可以顯示一個(gè)方塊,如果需要的話(huà)可以更改透明度和顏色
from: 4.5,
to: 6.5,
color: "rgba(68,170,213,0)" //透明度和顏色
}
]
},
yAxis: {
//y軸顯示的內(nèi)容
title: {
text: "氣溫 (°C)"
}
},
plotOptions: {
line: {
dataLabels: {
enabled: false // 開(kāi)啟數(shù)據(jù)標(biāo)簽
},
enableMouseTracking: false // 關(guān)閉鼠標(biāo)跟蹤,對(duì)應(yīng)的提示框、點(diǎn)擊事件會(huì)失效
}
},
series: [
{
//兩條數(shù)據(jù)
name: "東京",
data: [
7.0,
6.9,
9.5,
14.5,
18.4,
21.5,
25.2,
26.5,
23.3,
18.3,
13.9,
9.6
]
},
{
name: "倫敦",
data: [
3.9,
4.2,
5.7,
8.5,
11.9,
15.2,
17.0,
16.6,
14.2,
10.3,
6.6,
4.8
]
}
]
}
}
}
以上是“vue中怎么使用hightchats”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
名稱(chēng)欄目:vue中怎么使用hightchats
網(wǎng)頁(yè)地址:http://aaarwkj.com/article46/iipdeg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信小程序、靜態(tài)網(wǎng)站、做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)公司、軟件開(kāi)發(fā)、手機(jī)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)