<!-- * @Description: 地下管网数量统计图:彩色柱状图 * @Author: 王晓颖 * @Date: 2020-09-04 15:15:51 --> <template> <!--<chart-layout title="物联网设备" @click="getData">--> <div style="width: 100%;height:100%;padding:0.1rem"> <colorful-bar-chart :id="options.id" :unit="options.unit" :height="options.height" :xAxisData="options.xAxisData" :seriesData="options.seriesData" /> </div> <!--</chart-layout>--> </template> <script> import ColorfulBarChart from '@/components/barChart/colorfulBarChart' import ChartLayout from '@/components/layout/chartLayout' import {fetchPipeCount} from '@/api/cityManage' export default { name: 'deviceCountBar', components: {ChartLayout, ColorfulBarChart}, data () { return { options: { id: 'device_count_bar', height: '100%', width: '100%', unit: '米', xAxisData: ['井盖状态监测仪', '液位检测仪', '燃气智能监测终端', '噪声记录仪', '有害气体监测仪', '摄像头','路灯控制器'], seriesData: [1000, 5, 12, 13, 24, 10, 100] } } }, created () { this.getData() }, methods: { getData () { fetchPipeCount().then(response => { if (response.code === 200) { const data = response.data this.options.xAxisData = data.map(item => { return item.name }) this.options.seriesData = data.map(item => { return item.value }) } }) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> </style>