123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- /**
- * Created by 30947 on 2018/7/18.
- */
- $(function(){
- char1();
- char2();
- char3();
- char4();
- })
- //统计分析图
- function char1() {
- var myChart = echarts.init($("#char1")[0]);
- option = {
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- legend: {
- orient : 'vertical',
- x : 'right',
- textStyle : {
- color : '#ffffff',
- },
- data:['客运车','危险品车','网约车','学生校车']
- },
- calculable : false,
- series : [
- {
- name:'车类型',
- type:'pie',
- radius : ['40%', '70%'],
- itemStyle : {
- normal : {
- label : {
- show : false
- },
- labelLine : {
- show : false
- }
- },
- emphasis : {
- label : {
- show : true,
- position : 'center',
- textStyle : {
- fontSize : '20',
- fontWeight : 'bold'
- }
- }
- }
- },
- data:[
- {value:335, name:'客运车'},
- {value:310, name:'危险品车'},
- {value:234, name:'网约车'},
- {value:135, name:'学生校车'}
- ]
- }
- ]
- };
- myChart.setOption(option);
- window.addEventListener('resize', function () {myChart.resize();})
- }
- function char2() {
- var myChart = echarts.init($("#char2")[0]);
- option = {
- tooltip : {
- trigger: 'axis',
- axisPointer : { // 坐标轴指示器,坐标轴触发有效
- type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- grid: {show:'true',borderWidth:'0'},
- legend: {
- data:['行驶', '停车','熄火','离线'],
- textStyle : {
- color : '#ffffff',
- }
- },
- calculable :false,
- xAxis : [
- {
- type : 'value',
- axisLabel: {
- show: true,
- textStyle: {
- color: '#fff'
- }
- },
- splitLine:{
- lineStyle:{
- color:['#f2f2f2'],
- width:0,
- type:'solid'
- }
- }
- }
- ],
- yAxis : [
- {
- type : 'category',
- data : ['客运车','危险品车','网约车','学生校车'],
- axisLabel: {
- show: true,
- textStyle: {
- color: '#fff'
- }
- },
- splitLine:{
- lineStyle:{
- width:0,
- type:'solid'
- }
- }
- }
- ],
- series : [
- {
- name:'行驶',
- type:'bar',
- stack: '总量',
- itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
- data:[320, 302, 301, 334]
- },
- {
- name:'停车',
- type:'bar',
- stack: '总量',
- itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
- data:[120, 132, 101, 134]
- },
- {
- name:'熄火',
- type:'bar',
- stack: '总量',
- itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
- data:[220, 182, 191, 234]
- },
- {
- name:'离线',
- type:'bar',
- stack: '总量',
- itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
- data:[150, 212, 201, 154]
- }
- ]
- };
- myChart.setOption(option);
- window.addEventListener('resize', function () {myChart.resize();})
- }
- function char3() {
- var myChart = echarts.init($("#char3")[0]);
- option = {
- legend: {
- data:['车辆行驶数量'],
- textStyle : {
- color : '#ffffff',
- }
- },
- grid: {show:'true',borderWidth:'0'},
- calculable : false,
- tooltip : {
- trigger: 'axis',
- formatter: "Temperature : <br/>{b}km : {c}°C"
- },
- xAxis : [
- {
- type : 'value',
- axisLabel : {
- formatter: '{value}',
- textStyle: {
- color: '#fff'
- }
- },
- splitLine:{
- lineStyle:{
- width:0,
- type:'solid'
- }
- }
- }
- ],
- yAxis : [
- {
- type : 'category',
- axisLine : {onZero: false},
- axisLabel : {
- formatter: '{value} km',
- textStyle: {
- color: '#fff'
- }
- },
- splitLine:{
- lineStyle:{
- width:0,
- type:'solid'
- }
- },
- boundaryGap : false,
- data : ['0', '10', '20', '30', '40', '50', '60', '70', '80']
- }
- ],
- series : [
- {
- name:'车辆行驶数量',
- type:'line',
- smooth:true,
- itemStyle: {
- normal: {
- lineStyle: {
- shadowColor : 'rgba(0,0,0,0.4)'
- }
- }
- },
- data:[15, 0, 20, 45, 22.1, 25, 70, 55, 76]
- }
- ]
- };
- myChart.setOption(option);
- window.addEventListener('resize', function () {myChart.resize();})
- }
- function char4() {
- var myChart = echarts.init($("#char4")[0]);
- option = {
- grid: {show:'true',borderWidth:'0'},
- tooltip : {
- trigger: 'axis',
- axisPointer : { // 坐标轴指示器,坐标轴触发有效
- type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- },
- formatter: function (params) {
- var tar = params[0];
- return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
- }
- },
- xAxis : [
- {
- type : 'category',
- splitLine: {show:false},
- data : ['客运车','危险品车','网约车','学生校车'],
- axisLabel: {
- show: true,
- textStyle: {
- color: '#fff'
- }
- }
- }
- ],
- yAxis : [
- {
- type : 'value',
- splitLine: {show:false},
- axisLabel: {
- show: true,
- textStyle: {
- color: '#fff'
- }
- }
- }
- ],
- series : [
- {
- name:'报警数量',
- type:'bar',
- stack: '总量',
- itemStyle : { normal: {label : {show: true, position: 'inside'}}},
- data:[2900, 1200, 300, 200, 900, 300]
- }
- ]
- };
- myChart.setOption(option);
- window.addEventListener('resize', function () {myChart.resize();})
- }
|