我有条形图和下面的代码:
var line1=[['0-1',275134],['2-3',261562],['4-5',285681],['6-7',915432],['8-9',555131]];
var line2=[['0-1',353628],['2-3',287898],['4-5',297550],['6-7',103313],['8-9',616089]];
jQuery.jqplot('_container', [line1, line2],
{
title: 'title',
seriesColors: [ "#eee", "#ccc"],
seriesDefaults:{
renderer:jQuery.jqplot.BarRenderer,
rendererOptions:{barPadding:5, barMargin:5,highlightColors: ["#000", "#FF1100"]},
pointLabels: {show: false}
},
legend:{
renderer: jQuery.jqplot.EnhancedLegendRenderer,
show:true,
showLabels: true,
labels: ["Label 1", "Label 2"],
rendererOptions:{numberColumns:2},
placement:'outsideGrid',location:"s"
},
axes:{
xaxis:{renderer:jQuery.jqplot.CategoryAxisRenderer, rendererOptions:{showDataLabels: false},showTicks: false},
yaxis:{tickOptions: {showGridline: true}}
},
highlighter: {
tooltipAxes: 'y',
formatString:'%s'
},
cursor:{style:'default', show: true, zoom:true, showTooltip:false}
});如何通过seriesColors的方式为栏添加突出显示,所以添加了highlightColors的另一种工作方式它突出显示前四个栏("#000","#000","#FF1100","#FF1100"),但需要的结果是("#000","#FF1100","#000","#FF1100","#FF1100",...)?
发布于 2012-05-30 21:52:24
您在这里遇到的问题是由barRenderer.js中的错误引起的,修复它的唯一方法似乎是编辑其代码, as explained here.的适当行
所需的更改涉及在行中用sidx替换pidx:
var opts = {fillStyle: s.highlightColors[pidx]};
为了验证这一点,我让a jsfiddle where you can quickly see that it fixes来解决问题。
https://stackoverflow.com/questions/7980475
复制相似问题