1、echart柱状图的使用(横向)
function initColumnEchart(idName , dayArray , fromClr , toClr, tipClr,type){
var myChart = null;
var xArry = [];
var yArry = [];
if(type=="A"){
$.each(dayArray,function (i,iele) {
yArry.unshift(iele.name);
xArry.unshift(iele.avg);
});
}else {
$.each(dayArray,function (i,iele) {
yArry.unshift(iele.name);
xArry.unshift(iele.sum);
});
}
myChart = echarts.init(document.getElementById(idName));
var columnOption = {
grid: {
left: '15px',
right: '15px',
bottom: '10px',
top: '10px',
x:20,
x2:20,
containLabel: true
},
tooltip: {
padding: 10,
backgroundColor: tipClr,
borderColor: '#79ABCC',
borderWidth: 1,
textStyle: {
color: "#D4F7FF",
fontSize:12,
textAlign:'center'
},
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);',
formatter: function (obj) {
var value = obj.value;
var index = obj.dataIndex;
if(type=="A"){
var clickDate = yArry[index];
var count = xArry[index];
return clickDate+"<br>分数:"+count+"分";
}else {
var clickDate = yArry[index];
var count = xArry[index];
return clickDate+"<br>数量:"+count+"次&