當前位置:
首頁 >
Vue中引入heighchars图表------蜘蛛图/雷达图
發(fā)布時間:2024/3/24
43
豆豆
生活随笔
收集整理的這篇文章主要介紹了
Vue中引入heighchars图表------蜘蛛图/雷达图
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1、沒有Vue安裝Vue環(huán)境的請看這篇博客:
https://www.jianshu.com/p/02b12c600c7b
2、安裝JetBrains WebStorm 11.0.3網(wǎng)上有資源,這里不在累贅。
3、WebStorm打開第一步創(chuàng)建的Vue項目
npm進行highchars的導入,導入完成后就可以進行highchars的可視化組件開發(fā)了
一、npm install highcharts --save(回車)
二、components目錄下新建一個chart.vue組件
內容如下:
三、chart組件建好后,開始創(chuàng)建chart-options目錄,里面創(chuàng)建一個options.js用來存放模擬的chart數(shù)據(jù),如下圖目錄
內容如下:
四、再App.vue中引用chart組件
內容如下:
<template><div id="app"><x-chart :id="id" :option="option"></x-chart></div> </template><script>// 導入chart組件import XChart from './components/chart.vue'// 導入chart組件模擬數(shù)據(jù)import options from './chart-options/options'export default { // name: 'app',data() {let option = options.barreturn {id: 'test',option: option}},components: {XChart}} </script><style>#test {width: 600px;height: 600px;margin: 40px auto;} </style>代碼書寫完畢!運行Vue項目!
npm run dev-------(回車)
訪問:localhost:8080即可!
總結
以上是生活随笔為你收集整理的Vue中引入heighchars图表------蜘蛛图/雷达图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 最大吞吐量和信道利用率
- 下一篇: vue 5s倒计时