1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <script>
- import apiSecurityAlarmMgr from "@/api/security/apiSecurityAlarmMgr";
- export default {
- data() {
- return {
- option: {
- color: ['#80D4FF', '#A6A6FF', '#FFB580', '#FFDF80', '#79F2E8'],
- tooltip: {
- trigger: 'item'
- },
- legend: {
- bottom: '10%',
- icon: 'circle'
- },
- series: [
- {
- name: '告警次数',
- type: 'pie',
- radius: '50%',
- center: ['50%','40%'],
- data: [
- ],
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- }
- }
- },
- props: {
- height: Number,
- queryData: Object
- },
- mounted() {
- this.$nextTick(()=>{
- this.initChart()
- })
- },
- methods: {
- initChart() {
- let chart = this.$echarts.init(this.$refs.myChart)
- this.chart = chart;
- this.$util.chartsResize(this.chart);
- this.getData();
- },
- getData() {
- return apiSecurityAlarmMgr.getFloorAlarmDistribution(this.queryData).then(res=>{
- this.option.series[0].data = res;
- this.chart.setOption(this.option);
- })
- }
- }
- }
- </script>
- <template>
- <div style="width: 100%" :style="{height: height+'px'}" ref="myChart"></div>
- </template>
- <style lang="less" scoped>
- </style>
|