Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help on plotting a chart using jqplot - showing negative values
    primarykey
    data
    text
    <p>I am working on plotting some sales data. I need to plot the graph in this screenshot:<img src="https://i.stack.imgur.com/DWWLN.png" alt="Desired Graph">.</p> <p>I have been able to complete this much: <img src="https://i.stack.imgur.com/c2DVy.png" alt="Able to complete this much"></p> <p>The jquery code for this is:</p> <pre><code>plot = $.jqplot('SalesChart2', [ [[1,5]], [[1,10]], [[1,15]], [[1,20]], [[2,-25]], [[3,10]], [[4,10]], [[5, 6]] ] , { // Tell the plot to stack the bars. stackSeries: true, series: [ { label: 'Cash' }, { label: 'CreditCard' }, { label: 'DebitCard' }, { label: 'StoreCredit' }, { label: 'Discount' }, { label: 'AverageTransaction', xaxis: 'xaxis', yaxis: 'y2axis', disableStack: true }, { xaxis: 'xaxis', yaxis: 'y2axis', label: 'ItemsPerTransaction', disableStack: true }, { xaxis: 'xaxis', yaxis: 'y2axis', label: 'CustomerCount', disableStack: true } ], animate: !$.jqplot.use_excanvas, seriesDefaults: { renderer: $.jqplot.BarRenderer, rendererOptions: { highlightMouseDown: true, barWidth: 50 }, pointLabels: { show: true } }, axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: [1,2,3,4,5] }, yaxis: { min: -25, tickOptions: { formatString: "$%'d" } }, y2axis: { autoscale: true, min: 0 } }, legend: { show: true, location: 'e', placement: 'outside' }, grid: { drawGridlines: false } }); </code></pre> <p>But, it seems I am missing something in documentation of jqplot. </p> <p>First, if there are negative axis values on y-axis, the positive ones also start from the most negative point on y-axis.</p> <p>Second, the last series - 'Customer count' is running far ahead on the x-axis, and is visible when I remove the width restrictions on the container DIV.</p> <p>Can some body help me in this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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