我正在使用jqPlot,我想知道如果不是以'蓝色'显示所有条形图,我可以用'红色'或任何我想要的方式显示它们:
jQuery(document).ready(function(){
var data = <?php echo $times; ?>;
var plot1 = jQuery.jqplot('chart-time', [data], {
title:'Pages per Hours',
stackSeries: true,
seriesDefaults: {
renderer: jQuery.jqplot.BarRenderer,
rendererOptions:{barMargin: 10, shadow:false},
pointLabels:{show:true, stackedValue: true}
},
axes: {
xaxis:{renderer:jQuery.jqplot.CategoryAxisRenderer,
label:'(Hours)'}
}
});
});
由于
答案 0 :(得分:1)
您可以通过向color
添加seriesDefaults
媒体资源来实现此目的:
jQuery(document).ready(function(){
var data = <?php echo $times; ?>;
var plot1 = jQuery.jqplot('chart-time', [data], {
title:'Pages per Hours',
stackSeries: true,
seriesDefaults: {
renderer: jQuery.jqplot.BarRenderer,
rendererOptions:{barMargin: 10, shadow:false},
pointLabels:{show:true, stackedValue: true},
color: '#FF6666'
},
axes: {
xaxis:{renderer:jQuery.jqplot.CategoryAxisRenderer,
label:'(Hours)'}
}
});
});