日期:2014-05-17 浏览次数:20653 次
//lineCount表示需要显示几个不同的数据,
//results 是后台返回的数据,这里是我的形式,你按照你自己数据结构来写方法
for (var i = 0; i < lineCount; i++) {
//for bar
var bar_data = [];
for (var j = 0; j < results.length; j++) {
//base data
var date = new Date(results[j].Key);
//转化成保留2位小数的值
var temp = results[j].Value[i].key - results[0].Value[i].key;
temp = Math.round(temp * 100) / 100.0;
// for bar
bar_data.push(temp);
if (i == 0) {
bar_xaxises.push(date.add(Date.HOUR, -8).format('m/d'));
}
}
//for bar
bar_datas.push(bar_data);
bar_labels.push({ label: branchnames[i] });
}
//for bar
bar_config = {
seriesColors: ['#2181d8', '#a2d821', '#FCA604', '#C355EC'],
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
pointLabels: { show: true, location: 'n' },
rendererOptions: { fillToZero: true }
},
// Custom labels for the series are specified with the "label"
// option on&nbs