Min y-axis not working for jQPlotSeries stacked series
> I am having issues getting the y-axis to start at 0 when using the stacked series option in the bar chart. I used the Demo data and put and example here.
Please have a look at [0], it seems that 'data.parameters.stackseries' uses jqplot autoscale. I'm not sure whether jqplot/bar/stack itself can be adjusted or not but I recommend you try tweaking those options available and see the results.
[2] https://stackoverflow.com/questions/9046987/jqplot-individual-values-not-totals-in-stacked-chart
Below is what I found fixes the issue I was having.
Starting at line 93 in SemanticResultFormats/formats/jqplot/resources/ext.srf.jqplot.chart.bar.js
// Number axis var numberaxis = { ticks: data.parameters.stackseries || data.parameters.autoscale ? [] : data.ticks, // use autoscale for staked series label: data.parameters.numbersaxislabel, labelRenderer: $.jqplot.CanvasAxisLabelRenderer, - autoscale: data.parameters.stackseries || data.parameters.autoscale ? true : false, + autoscale: data.parameters.autoscale ? true : false, //do not use autoscale for stacked series - padMax: 0, + padMax: 0.5, // make some room at the top padMin: 0, + min: 0, // force min = 0 (should be changed to accept min param) tickOptions: { angle: data.parameters.direction === 'horizontal' ? 0 : -40, formatString: !data.parameters.valueformat ? '%d' : data.parameters.valueformat // %d default } };
Well done, now tracked at [0].
[0] https://github.com/SemanticMediaWiki/SemanticResultFormats/issues/96