2
我有一个填充了六个数据系列的矩阵,我想用同一个名称“process a”标记前五个(也给它们相同的颜色),而左边的是'process b'。那么有没有办法在jqplot中做到这一点?感谢您的任何建议。jqplot组和标签具有相同名称和颜色的几个数据系列
下面是代码和demo:
$(document).ready(function(){
$.jqplot.config.enablePlugins = true;
s1 = [[10.0, 11.0, 11.0, 12.0, 12.0, 14.0], [10.0, 11.0, 12.0, 12.0, 12.0, 12.0], [10.0, 13.0, 14.0, 15.0, 15.0, 16.0], [10.0, 10.0, 11.0, 11.0, 11.0, 12.0], [10.0, 10.0, 11.0, 12.0, 12.0, 12.0]];
s2 = [10.0, 10.4, 10.816, 11.248640000000002, 11.698585600000003, 12.166529024000004];
s1.push(s2);
$.jqplot('chart1', s1, {
seriesDefaults: {
showMarker:false,
pointLabels: { show:false } ,
},
series:[
{label:'Process A'},{label:'Process B'}
],
legend: {
show: true,
location: 'nw',
placement: 'inside',
fontSize: '11px'
}
})
})
感谢您的帮助。这与我想要的非常接近。但是,是否有可能仅显示两个图例(过程A和B)而不是全部六个(过程A和过程B)?另外,是否可以使用循环来分配这些系列信息(使用'push'来添加标签名称和颜色)? – 2012-07-12 14:23:51
有关您的答案,请参阅**编辑**。 – Boro 2012-07-12 14:46:29
有一种更简单的方法来修复图例中的多个条目。对于系列配置,为每个附加重复添加“showLabel:false”。例如: ''系列:[' ''标签:'处理A',颜色:'红'},{标签:'处理A',颜色:'红',showLabel:false}' ''' – 2017-01-05 15:27:21