Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is the workaround for your problem: <a href="http://jsfiddle.net/upevG/1/" rel="nofollow">JsFiddle link</a></p> <p>here is the code which will solve your problem, please make changes to this code or grab the important part and put it in your code.</p> <pre><code>$(document).ready(function () { var s1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]; var s2 = [5, 15, 15, 30, 45, 60, 35, 49, 75, 95]; var ticks = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; var seriesData = [], seriesIndex = 0; function storeSeriesData(){ seriesData[seriesIndex] = this.data; seriesIndex = seriesIndex + 1; } $.jqplot.LabelFormatter = function(format, val){ var result, pointVal = -1; if(seriesIndex &gt; 1){ for(var i = 0; i &lt; seriesData[seriesIndex - 1].length; i++){ var tempData = seriesData[seriesIndex - 1][i]; if(tempData[1] == val){ break; } } pointVal = seriesData[seriesIndex - 2][i]; result = val + "("+ parseFloat(val/pointVal[1] * 100).toFixed(1) + "%)"; } else{ result = val; } return result; }; $.jqplot.preDrawSeriesHooks.push(storeSeriesData); var plot1 = $.jqplot('chart1', [s1, s2], { seriesDefaults: { renderer: $.jqplot.BarRenderer, rendererOptions: { barPadding: 15, barWidth: 25 }, pointLabels: { show:true, formatString: "%#.1f", formatter: $.jqplot.LabelFormatter } }, grid: { drawBorder: true, background: '#ffffff' }, axesDefaults: { tickRenderer: $.jqplot.CanvasAxisTickRenderer, tickOptions: { markSize: 4 } }, axes: { xaxis: { pad: -1.05, renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks, tickOptions: { showGridline: true } }, yaxis: { pad: 1.05, tickOptions: { formatString: '%d', showGridline: true } } } }); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload