我需要在每个栏中显示自定义标签。这是一个使用jqplot的多系列条形图。我在这里粘贴我的代码。此代码无效。向我显示一个单独的栏而不是多个系列。请帮帮我..
function plotJQBarChart(critical, major, minor, warning) {
var s1 = [32, 65, 57, 10];
var s2 = [45, 56, 90, 30];
var ticks = ['Critical', 'Major', 'Minor', 'Warning'];
plot1 = $.jqplot('JQPlotBar', [s1,s2], {
color: '#657383',
shadow: true,
grid:{background:'#F1F1F1',
borderWidth:0.0,
drawGridLines: false},
seriesColors: ['#9E7BFF','#3BB9FF'],
barPadding: 2,
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
pointLabels: { show: true,labels:
['Severity', 'Wifi','Severity', 'Wifi',
'Severity', 'Wifi','Severity', 'Wifi',
'Severity', 'Wifi','Severity', 'Wifi',
'Severity', 'Wifi','Severity', 'Wifi'] }
},
legend:{
show:true,
placement: 'outside',
rendererOptions: {
numberRows: 1
},
location:'e',
marginTop: '15px',
labels:['Wifi','Severity']
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks
}
},
highlighter: { show: false }
});
}
答案 0 :(得分:0)
您是否尝试在您的配置中添加:stackSeries: true
?
此外,添加点标签的方式也不对。见http://www.jqplot.com/tests/point-labels.php
答案 1 :(得分:-1)
尝试将pointLabels
放入series
属性
series:[
{label:'Serie X', pointLabels: { show: true }},
{label:'Serie Y', pointLabels: { show: true }},
{label:'Serie Z', pointLabels: { show: true }}
],