警务可视化 玫瑰图和柱折混合图

 

 什么时候用,什么时候导入echarts

 完整代码:

 

 

 搭建页面结构的代码

html

<template>
  <h2>智慧公安数字服务系统</h2>
  <div>
    <div class="container1"> 
      
    </div> 
    <div class="container2">
      
    </div>
  </div>
</template>

css

*{
  padding:0;
  margin:0;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  width:100%;
  height:760px;
  background:url(./assets/bg.webp) no-repeat;
  background-size: contain;
}
h2{
  color:#fff;
  line-height:60px;
}
.container1{
  width:550px;
  height:360px;
  border:1px solid #0043A0;
  float:left;
  margin-left:70px;
  padding:10px;
  margin-top:70px;
}
.container2{
  width:550px;
  height:360px;
  border:1px solid #0043A0;
  float:right;
  margin-right:70px;
  padding:10px;
  margin-top:70px;
}

玫瑰图代码

html

<div id="canvas1" style="width: 600px;height:360px; margin:20px auto"></div>

js

import * as echarts from 'echarts' 
export default {
  name: 'App',
  mounted () {
    //图表1-玫瑰图
    // 根据准备好的dom初始化echarts实例
    var myChart1 = echarts.init(document.getElementById('canvas1'));
    var option1={
      title : {
        text: '各局打击和处理违法犯罪人数占比',
        textStyle:{
          color:'#EDEDED',
          fontSize:14
        }
      },
      tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
      },
      series : [{
        name:'案件类型',                  
        type:'pie',                       
        radius : [35, 100], // 图表内外半径大小
        center : ['45%', '50%'], // 图表位置
        roseType : 'area',
        // 修改字体颜色的代码begin
        itemStyle: {
          normal: {
            label: {
              textStyle: {
                color:'#EDEDED',
                fontSize: 12
              }
            }
          }
        },
        data:[
          {value:514, name:'行政拘留'},    
          {value:428, name:'移送起诉'},
          {value:397, name:'罚款'},
          {value:214, name:'刑事拘留'},
          {value:103, name:'社区戒毒'},
          {value:56, name:'强制戒毒'}
        ]
      }]
    }
    myChart1.setOption(option1);
  }
}

柱折混合图

html

<div id="canvas2" style="width: 600px;height:360px; margin:20px auto"></div>

js

//图表4-柱折混合图
    // 根据准备好的dom初始化echarts实例
    var myChart2 = echarts.init(document.getElementById('canvas2'));
    var option2={
      title:{
        text:'近一年受案量趋势',
        textStyle:{
          color:'#EDEDED',
          fontSize:14
        }
      },
      tooltip: {
        trigger: 'axis',
      },
      legend: {
        data:['受案量','同比'],
        x:'center',
        textStyle: {
          fontSize: 12,
          color: '#EDEDED',
        },        
      },
      xAxis: {
        data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
        axisLine: {
          lineStyle: {
            color: '#EDEDED',
          },
        },
      },
      yAxis: {
        type: 'value',
        axisLine: {
          lineStyle: {
            color: '#EDEDED',
          },
        },
      },
      series: [{
        name: '受案量',
        type: 'bar',
        barWidth : '28%',
        data: [241, 221, 188, 167, 126, 231, 194, 157, 254, 166, 283, 215],
        markPoint: { 
          data: [ 
              { type: 'max', name: '最大值' } 
          ] 
        },
      },{
        name: '同比',
        type: 'line',
        smooth:true,
        data: [48, 34, 22, 16, 12, 36, 20, 14, 53, 17, 67, 27],
        label: {
          show: true,
          position: 'top',
          textStyle: {
            fontSize: 12
          }
        }
      }]
    }
    myChart2.setOption(option2);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值