lxw
2020-07-11 9db52f2f2dd3665fe9da1ae5657e0167c3a34d40
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
//创建电池组统计分析折线图
var mycapacityChart;        
function CreateLineEchart(ele,lname,xdata,sdata){
    //console.info(xdata);
    mycapacityChart=echarts.init(ele);
    mycapacityChart.clear();
    var option={
        tooltip:{
            trigger:'axis'
        },
        title : {   
            //text: tname,
            x: "center", //标题水平方向位置
            textStyle: {  
                fontSize:13  
            }
        },
 
        
        toolbox:{
            show : true
        },
        xAxis:{
            data:xdata
        },
        grid: {
            top:'10%',
            left: '1%',
            right: '4%',
            bottom: '2%',
            containLabel: true
        },
        yAxis:[{
            name:"y(AH)",
            type:'value',
            
            axisLabel:{
                formatter:function(value){
                    //解决原点处带符号问题
                    if(value==0)
                    {
                        return value;
                    }else{
                        return value ;
                    }
                }
            }
        }],
        series:function(){
            var serie=[];
            //console.info(sdata);
            for( var i=0;i<sdata.length;i++){
                //console.info(lname[i]);
                //console.info(sdata[i]);
                var item={
                    name:lname[i],
                    type:'line',
                    //symbol:'none',
                    data:sdata[i],
                    itemStyle:{
                        normal:{
                            lineStyle:{
                                width:1
                            }
                        }
                    }    
                }
                serie.push(item);
            }
            //console.info(serie);
            return serie;
        }()
 
    };
    // 使用刚指定的配置项和数据显示图表。
    mycapacityChart.setOption(option);
    
}