too large bar width in jqplot

dusiliang picture dusiliang · Mar 6, 2013 · Viewed 11.4k times · Source

I'm new to jqplot, when I want to draw a bar chart, x axis is date, interval is 1 day. This is part of my code:

     axesDefaults:{                                                                  
          tickRenderer: $.jqplot.CanvasAxisTickRenderer,                              
         tickOptions:{
            fontSize:'10pt',
         },                                                                          
    },                                                                              
     axes:{                                                                          
         xaxis:{
            renderer:$x_renderer,                                                   
             tickOptions:{
               formatString:'%Y-%#m-%#d',                                          
            },
            rendererOptions:{                                                       
                 tickOptions:{
                     angle:-90,                                                      
                 }                                                                   
              },                                                                      
             label:'$label',
             tickInterval:'86400000',
         },
         yaxis:{                                                                     
            tickOptions:{
               formatString:'%.2f',                                                
             },                                                                      
           autoscale:true                                                          
         }, 
    },                                                                              
     highlighter:{ 
         show:true,                                                                  
    },

But I find the width of each bar is too large to cover each other. How to fix it?

Thanks!

Answer

AnthonyLeGovic picture AnthonyLeGovic · Mar 6, 2013

You can specify it in your series options :

seriesDefault:{
   renderer: $.jqplot.BarRenderer,
   rendererOptions: {
      barWidth: 5
   }
}

Don't forget to include barRenderer plugins. For more documentations about bar chart on jqplot please take a look at : Jqplot documentation