Note that there are some explanatory texts on larger screens.

plurals
  1. POIncrease the width of the bars while using jfreechart
    text
    copied!<p>I am using StackedBarChart in the jfreechart API to display no.records in a table which comes from the database. There are 82 tables which im putting on the domain axis and the no. of records in the Range axis. But the problem that I am facing is that because of so many tables in the domain axis, the width of the bar reduces.</p> <p>Following is my code :</p> <pre><code>private JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createStackedBarChart( "Stacked Bar Chart", "Task Description", "No_Of_Records", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot)chart.getPlot(); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setMaximumCategoryLabelWidthRatio(100); categoryaxis.setLowerMargin(0.02D); categoryaxis.setUpperMargin(0.02D); NumberAxis numberaxis = (NumberAxis)categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis.setRange(0.0D, 1000D); BarRenderer barrenderer = (BarRenderer)categoryplot.getRenderer(); barrenderer.setDrawBarOutline(false); GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64)); barrenderer.setSeriesPaint(0, gradientpaint); return chart; } </code></pre> <p>I have tried using a </p> <pre><code> setItemMargin(); setMaxWidth(); setMaximumBarWidth(); </code></pre> <p>on the BarRenderer, but all in vain..</p> <p>Any help is appreciated</p> <p>Regards,</p>
 

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