欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

在vue項(xiàng)目中引入highcharts圖表的方法(詳解)

npm進(jìn)行highchars的導(dǎo)入,導(dǎo)入完成后就可以進(jìn)行highchars的可視化組件開發(fā)了

創(chuàng)新互聯(lián)公司專注于企業(yè)營銷型網(wǎng)站、網(wǎng)站重做改版、威寧網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、H5頁面制作商城網(wǎng)站制作、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)公司、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為威寧等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

npm install highcharts --save

1、components目錄下新建一個chart.vue組件

<template>
 <div class="x-bar">
 <div :id="id"
 :option="option"></div>
 </div>
</template>
<script>
import HighCharts from 'highcharts'
export default {
 // 驗(yàn)證類型
 props: {
 id: {
 type: String
 },
 option: {
 type: Object
 }
 },
 mounted() {
 HighCharts.chart(this.id,this.option)
 }
}
</script>

2、chart組件建好后,開始創(chuàng)建chart-options目錄,里面創(chuàng)建一個options.js用來存放模擬的chart數(shù)據(jù),如下圖目錄

在vue項(xiàng)目中引入highcharts圖表的方法(詳解)

如下圖我寫的一個柱狀圖的數(shù)據(jù)

module.exports = {
 bar: {
 chart: {
 type:'column'//指定圖表的類型,默認(rèn)是折線圖(line)
 },
 credits: {
 enabled:false
 },//去掉地址
 title: {
 text: '我的第一個圖表' //指定圖表標(biāo)題
 },
 colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00',
  '#24CBE5' ],
 xAxis: {
  categories: ['1號', '2號', '3號','3號','3號'] //指定x軸分組
 },
 yAxis: {
  title: {
  text: '最近七天', //指定y軸的標(biāo)題
 },
 },
 plotOptions: {
  column: {
  colorByPoint:true
  },
  },
 series: [{ //指定數(shù)據(jù)列
  name: '小明',
  data: [{
  y:1000,
  color:"red"}, 5000, 4000,5000,2000] //數(shù)據(jù)
 }]
 }
}

3、引用chart組件

<template>
 <div id="app">
 <x-chart :id="id" :option="option"></x-chart>
 </div>
</template>
<script>
// 導(dǎo)入chart組件
import XChart from 'components/chart.vue'
// 導(dǎo)入chart組件模擬數(shù)據(jù)
import options from './chart-options/options'
export default {
 name: 'app',
 data() {
 let option = options.bar
 return {
 id: 'test',
 option: option
 }
 },
 components: {
 XChart
 }
}
</script>
<style>
#test {
 width: 400px;
 height: 400px;
 margin: 40px auto;
}
</style>

效果如下圖所示

在vue項(xiàng)目中引入highcharts圖表的方法(詳解)

以上這篇在vue項(xiàng)目中引入highcharts圖表的方法(詳解)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持創(chuàng)新互聯(lián)。

文章名稱:在vue項(xiàng)目中引入highcharts圖表的方法(詳解)
當(dāng)前網(wǎng)址:http://www.chinadenli.net/article22/gpdhcc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)App開發(fā)App設(shè)計軟件開發(fā)小程序開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)