/ * Bar graph * /
the loadData function (Option) {$ .ajax ({
type: 'POST',
the async: to false, // synchronous execution
url: 'GetDefect.action', //web.xml registered url-pattern Servlet of
data: {} // no parameters
dataType: 'json', // return data in the form of JSON
Success: function (bar) {
IF (bar) {
// initialization xAxis [0] of data
option.xAxis [0] .data = [] ;
for (var I = 0; I <bar.length; I ++) {
// cycle of the output data of the X-axis
option.xAxis [0] .data.push (bar [I] .createTime);
}
// Initialization series [0] of Data
option.series [0] .data = [];
for (var I = 0; I <bar.length; I ++) {
//// cycle of the output data of the Y-axis
option.series [ 0] .data.push (bar [I] .ppId);
}
}
},
error: function (errorMsg) {
Alert ( "failure loading data");
}
});
} // Ajax var myChart echarts.init = ( document.getElementById ( 'Line')); var {Option = ToolTip: { Show: to true
},
Legend: {
Data: [ 'missing implicit point']
},
XAXIS: [{
type: 'category',
name: 'time',
}],
YAXIS: [{
type: 'value',
name: 'lack Implicit point ID '
}],
Series: [{
name: "missing hidden points",
type: "bar",
ItemStyle: {
Normal: {
// color selected by array subscript
color: function(params) {
var colorList = [
'# C1232B', '# B5C334', '# FCCE10', '# E87C25', '# 27727B',
'# FE8463', '# 9BCA63', '# FAD860', '# F3A43B', '# 60C0DD'
] ;
return the colorList [params.dataIndex]
},
}
}
}]
};
// load data into Option
the loadData (Option);
// load data objects is echarts
myChart.setOption (option);