javascript - Flot Categories Plugin Ordering Incorrect -


thanks in advance time.

i have following code flot chart

 <script src="js/plugins/flot/jquery.flot.js"></script>   <script src="js/plugins/flot/jquery.flot.tooltip.min.js"></script>   <script src="js/plugins/flot/jquery.flot.spline.js"></script>   <script src="js/plugins/flot/jquery.flot.resize.js"></script>   <script src="js/plugins/flot/jquery.flot.categories.js"></script>    <script type="text/javascript">  $(document).ready(function(){                      $(function() {  var data = [{     "label": "commission",     "color": "#1ab394",     "data": [["oct", ],["nov", ],["dec", ],["jan", ],["feb", ],["mar", ],["apr", ],["may", 14],["jun", 0],["jul", 5],["aug", 12],["sep", 7]] }, {     "label": "epl",     "color": "#1c84c6",      "data": [["oct", 0],["nov", 0],["dec", 0],["jan", 0],["feb", 0],["mar", 0],["apr", 0],["may", 1.75],["jun", 0.00],["jul", 0.17],["aug", 0.39],["sep", 0.35]] }];  var options = {                series: {                     lines: {                             show: false,                             fill: true                         },                         splines: {                             show: true,                             tension: 0.4,                             linewidth: 1,                             fill: 0.4                         },                         points: {                             radius: 0,                             show: true                         },                         shadowsize: 2                 },                 grid: {                     bordercolor: '#eee',                     borderwidth: 1,                     hoverable: true,                     backgroundcolor: '#fff'                 },                 tooltip: true,                 tooltipopts: {                     content: function (label, x, y) { return x + ' : ' + y; }                 },                 xaxis: {                     tickcolor: '#eee',                     mode: 'categories'                 },                 yaxis: {                     tickcolor: '#eee'                 },                 shadowsize: 0             };      var chart = $('.dashchart');     if(chart.length)        $.plot(chart, data, options);    });   })(window, document, window.jquery);   </script> 

the docs state...

by default, labels ordered met in data series. if need different ordering, can specify "categories" on axis options , list categories there:

https://code.google.com/p/flot/source/browse/trunk/jquery.flot.categories.js?r=341

however x axis ordering not same data series, seen in screenshot below

any idea why may be.

flot chart wrong x-axis order

i figured out. hope helps day

seems flot doesnt empty values in data series

 "data": [["oct", ],["nov", ],["dec", ],["jan", ],["feb", ],["mar", ],["apr", ],["may", 14],["jun", 0],["jul", 5],["aug", 12],["sep", 7]] 

changed , works fine

 "data": [["oct", 0],["nov", 0],["dec", 0],["jan", 0],["feb", 0],["mar", ]0,["apr", 0],["may", 14],["jun", 0],["jul", 5],["aug", 12],["sep", 7]] 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -