jquery - How do you position the labels in jqPlot stacked bar charts? -
i can't figure out how position labels within bar chart. there way centre them within it's respective bar when stacked? in picture below of them seem reasonably in middle except there 1 sinks right bottom. have no idea how change this. i've tried adding margin in css seems have no effect. i've tried playing x/ypadding in pointlabel option seems move across not or down.
var s1 = [31, 10, 20, 44], s2 = [15, 4, 7, 16], ticks = ['may', 'june', 'july', 'august']; $.jqplot('graph_pnl2', [s1, s2], { stackseries: true, seriescolors:['#73c774', '#c7754c'], seriesdefaults:{ renderer:$.jqplot.barrenderer, rendereroptions: {filltozero: true}, pointlabels: { show: true, location: 'e', xpadding: 25, ypadding: 25}, }, legend: { show: false, placement: 'insidegrid' }, axes: { xaxis: { renderer: $.jqplot.categoryaxisrenderer, ticks: ticks }, yaxis: { pad: 0, tickoptions: {formatstring: '%d'} } } });
you didn't notice in second stacked column there 1 value...(where 10 value column?) ok. seems using property uncorrectly... think "pad: 0" on yaxis property. please delete or comment out.
yaxis: { //pad: 0, tickoptions: {formatstring: '%d'} }
here code on jsfiddle.
Comments
Post a Comment