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
| function createEcharts(ele){
| //console.info(xarr.length);
| var height = document.documentElement.clientHeight + 'px';
| var width = document.documentElement.clientWidth-20 + 'px';
| $(ele).height(height).width(width);
| }
| // 绘制折线图
| var myLineChart;
| function CreateLineEchart(ele,lname,xdata,sdata){
| createEcharts(ele)
| myLineChart=echarts.init(ele);
| var option={
| tooltip:{
| trigger: 'axis'
| },
| title : {
| //text: tname,
| x: "center", //标题水平方向位置
| textStyle: {
| fontSize:13
| }
| },
| toolbox:{
| show :true
| },
| calculable :true,
| xAxis:{
| data:xdata
| },
| grid: {
| left: '1%',
| right: '5%',
| bottom: '2%',
| containLabel: true
| },
| yAxis:[{
| name:"y("+lname+")" ,
| type:'value',
| min:Math.floor(Math.min.apply(null, sdata)-1),
| max:Math.ceil(Math.max.apply(null, sdata)+1),
| precision:2,
| axisLabel:{
| formatter:function(value){
| //解决原点处带符号问题
| if(value==0)
| {
| return value;
| }else{
| return value ;
| }
| }
| }
| }],
| series:[{
| type:'line',
| name:'',
| symbol:'none',
| data:sdata,
| itemStyle:{
| normal:{
| lineStyle:{
| color:'green'
| }
| }
| }
|
| }]
| };
| // 使用刚指定的配置项和数据显示图表。
| myLineChart.setOption(option);
| }
|
|