1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
| function getCityTYJBarChart(dom,title,legendData,xAxisData,yAxisData){
|
| // 使用
| require(
| [
| 'echarts',
| 'echarts/chart/bar' // 使用柱状图就加载bar模块,按需加载
| ],
| function (ec) {
| // 基于准备好的dom,初始化echarts图表
| var myChart = ec.init(dom);
| $("#ckjcjg_ytj_charts_bar").width('65%');
| $("#ckjcjg_ytj_charts_bar").height('285px');
| var option = {
| tooltip: {
| show: true
| },
| title : {
| text: title,
| x:'center',
| subtext:'检查表类别:'+legendData
| }, dataZoom : {
| show : true,
| realtime : true,
| start : 0,
| end : 100,
| dataBackgroundColor:'rgba(0,0,0,0)',
| y:25
| },
| toolbox: {
| show : false,
| feature : {
| mark : {show: true},
| dataView : {show: true, readOnly: false},
| magicType : {show: true, type: ['line', 'bar']},
| restore : {show: true},
| saveAsImage : {show: true},
|
| }, orient : 'vertical'
| },
| xAxis : [
| {
| type : 'category',
| data : xAxisData,
| axisLabel:{
| interval:0,
| rotate:45,
| margin:2,
| textStyle:{
| color:"#222"
| }
| }
| }
| ],
| yAxis : [
| {
| type : 'value'
| }
| ],
| series : [
| {
| "name":legendData,
| "type":"bar",
| "data":yAxisData,
| itemStyle: {
| normal: {
| color: function (value){ return "#"+("00000"+((Math.random()*16777215+0.5)>>0).toString(16)).slice(-6); },
| label: {
| show: true,
| position: 'top',
| formatter: function(a){
| if(a.value!=0){
| return a.value;
| }
| else{
| return "";
| }
| }
| }
| }
| }
| }
| ]
| };
|
| // 为echarts对象加载数据
| myChart.setOption(option);
| }
| );
| }
|
|