Note that there are some explanatory texts on larger screens.

plurals
  1. POjqPlot bar graph with multiseries showing empty data series
    primarykey
    data
    text
    <p>I´m building a dynamic 6 series bar graph with jqPlot. In my implementation, the user will choose which data will go into each serie and the system will load data according to his choice. The function `GetDataFromSeries() loads the series data given a serie number and the available ticks (as categories - it gets all ticks from all series and builds an unique category array).</p> <p>If the user choose to load all series, everything runs fine. The problem is if the user decide not to load one series (that´s possible). In that case, I will not load that data in <code>GetDataFromSeries()</code> and jqPlot gives me error.</p> <p>I´m trying several ways to do it, but I´m being successfull. In the code the way it is, I´m getting <code>Uncaught Error: No data specified</code> if the user decides not to load one of the series. I have tried to put dummy data (null or zero) in case one of the series are empty, but doing so the bars are moved and shrinked as If I have more bars to be shown. </p> <p>Don´t know how to solve that. Appreciate very much any kind of help.</p> <p>Rds.</p> <p><strong>[CODE]</strong></p> <pre><code>function GeneratePlot() { var tickAxis = new Array(); var data0 = new Array(); var data1 = new Array(); var data2 = new Array(); var data3 = new Array(); var data4 = new Array(); var data5 = new Array(); /// /// Convert series into meaningfull data /// tickAxis = GetTickAxisFromSeries(); data0 = GetDataFromSeries(0, tickAxis); data1 = GetDataFromSeries(1, tickAxis); data2 = GetDataFromSeries(2, tickAxis); data3 = GetDataFromSeries(3, tickAxis); data4 = GetDataFromSeries(4, tickAxis); data5 = GetDataFromSeries(5, tickAxis); var options = { title: 'Evolution Plot', height: 500, series: [ { show: (data0.length != 0) }, { show: (data1.length != 0) }, { show: (data2.length != 0) }, { show: (data3.length != 0) }, { show: (data4.length != 0) }, { show: (data5.length != 0) } ], axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: tickAxis, tickRenderer: $.jqplot.CanvasAxisTickRenderer, tickOptions: { angle: -90, fontSize: '8pt', formatter: $.jqplot.DateTickFormatter } }, yaxis: { pad: 1.05, tickOptions: { formatString: '%d', fontSize: '8pt' } } }, seriesDefaults: { renderer: $.jqplot.BarRenderer, rendererOptions: { fillToZero: true } }, highlighter: { show: true, sizeAdjust: 7.5 }, cirsor: { show: false } } var plot = $.jqplot('chart', [data0, data1, data2, data3, data4, data5], options).replot(); } </code></pre>
    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.
    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