confidence interval - Render bands / bandData in jqplot when series contains null values -


i using jqplot render line graph.

my series data looks like:

results =[       ['1/1/2014', 1000],     ['2/1/2014', 2000],     ['3/1/2014', 3000],     ['4/1/2014', 4000],     ['5/1/2014', null] ]; 

my call jqplot looks like

$.jqplot('mychart', results,  {    series: [         {             rendereroptions: {                 bands: {                     show: true,                     interval: '10%'                 },             }         }    ] }); 

the chart render, missing 10% bands above , below.

if change null value ['5/1/2014', null] ['5/1/2014', 5000] bands render correctly.

my data have missing values. there way make bands render non-null data points on line, if line does have null data points?

instead of sending null values, omit them entirely , depend on dateaxisrenderer correctly space values on axis.

results = [     ['1/1/2014', 1000],     ['2/1/2014', 2000],     ['3/1/2014', 3000],     ['4/1/2014', 4000],     ['6/1/2014', 3500] ];  $.jqplot ('mychart', [results], {     series: [{         rendereroptions: {             bands: {                 show: true,                 interval: '10%'                                 }         }     }],     axes: {         xaxis: {             renderer: $.jqplot.dateaxisrenderer         }     } }); 

jsfiddle version here (don't forget script reference dateaxisrenderer) http://jsfiddle.net/4vmnf/1/

alternatively, can pass separate arrays upper & lower band data, , not have follow same intervals underlying data array.

lowerband = []; upperband = [];  for(var = 0; < results.length; i++) {     if (results[i][1]) {         lowerband.push([results[i][0], results[i][1] * 0.9]);         upperband.push([results[i][0], results[i][1] * 1.1]);     } else {         // not clear me how want calculate band missing values         lowerband.push([results[i][0], 3500]);         upperband.push([results[i][0], 6500]);     } } 

and use banddata option:

series: [{         rendereroptions: {             banddata: [lowerband, upperband]         }     }] 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -