1
我想爲附加圖像的正值和負值添加圖例。如何實現此目的?請幫幫我。在negativeSeries條形圖中添加圖例
我試過代碼爲FIDDLE
xSeries = [["a", -1], ["b", 2], ["c", -3], ["d", 5]];
var barChartOptions = {
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
rendererOptions: {
barDirection: 'vertical',
barWidth:10,
varyBarColor: true,
},
fillToZero: true,
fillAxis: 'x',
pointLabels: {
// show: true
},
pointLabels : {
show : true,
hideZeros : true,
location : 's',
ypadding : 12
}
},
legend : {
show : true,
placement : 'outsideGrid',
fontFamily : 'OpenSans-Regular',
marginTop : '100px',
textColor : '#414141',
rowSpacing : '14px',
border : 'none',
background : 'transparent'
},
series : [{
label : "Greater",
lineWidth : 1,
// Use (open) circlular markers.
markerOptions : {
style : "filledCircle"
}
}],
seriesColors: ["#7DAB0B"],
negativeSeriesColors: ["#D99F03"],
axes:{
yaxis:{
renderer: $.jqplot.LinearAxisRenderer,
fontFamily : 'OpenSans-Regular',
label : "kWh",
textColor : '#414141',
tickOptions : {
show : true,
fontFamily : 'OpenSans-Regular',
textColor : '#414141',
fontSize : '10pt'
}
},
xaxis:{
label : "Date",
renderer : $.jqplot.CategoryAxisRenderer,
labelRenderer : $.jqplot.CanvasAxisLabelRenderer,
tickRenderer : $.jqplot.CanvasAxisTickRenderer,
//renderer: $.jqplot.CategoryAxisRenderer,
fontFamily : 'OpenSans-Regular',
textColor : '#414141',
tickOptions : {
angle : -60,
show : true,
fontFamily : 'OpenSans-Regular',
textColor : '#414141',
fontSize : '10pt'
}
},
},
grid : {
background : 'transparent',
gridLineColor : '#c5c5c5'
}
};
try {
var plotBarChart = $.jqplot("chart1", [xSeries], barChartOptions);
} catch (e) {
// alert(e);
}
是您的小提琴真的完成了嗎? –
@ felipe.zkn是的。我想添加像附加圖像的傳說 – Nandu