Question

I currently have a bar chart in jquery. If the results show only 1 bar the issues is that the bar fills the space of the whole graph. How can I adjust the width of the bar so that it doesn't look like a log.

Was it helpful?

Solution

try setting the barWidth in the BarRenderer:

http://www.jqplot.com/docs/files/plugins/jqplot-barRenderer-js.html

OTHER TIPS

If you still want your chart bars to size dynamically with number of bars / size of chart then use the barMargin and barPadding values to adjust the width of your bars.

seriesDefaults: {
  renderer: $.jqplot.BarRenderer,
  rendererOptions: { 
    barPadding: 4,
    barMargin: 5
},

The default values are 8 and 10 respectively so the above values will actually make your bar larger. Make the values larger than default to reduce the size of your bars.

barMargin is the width between bars. barPadding is the width between bars within a category if your bar chart is representing multiple series.

See http://www.jqplot.com/docs/files/plugins/jqplot-barRenderer-js.html for more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top