DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (int i = 0; i < 60; i++) {
dataset.addValue(i, "y.....", "" + i);
}
JFreeChart chart =
ChartFactory.createBarChart(
"chart Example",
"x-axis",
"y-axis",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false);
chart.getRenderingHints().put(JFreeChart.KEY_SUPPRESS_SHADOW_GENERATION, Boolean.TRUE);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setItemMargin(0);
renderer.setMaximumBarWidth(.10);
Font font3 = new Font("Dialog", Font.PLAIN, 5);
CategoryAxis domainAxis = plot.getDomainAxis();
for (int j = 0; j < 60; j++) {
domainAxis.setTickLabelFont("" + j, font3);
}
As you can see in the image x-axis values of jfree chart are not that clear
I’m think of skipping 3-4 points between two tick mark can somebody help me with this??
.
New contributor
Shruthip Shet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.