Horizontal Bar Chart With Custom Label Position

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
Posts: 1
Joined: Thu Jun 14, 2018 4:09 pm
antibot: No, of course not.

Horizontal Bar Chart With Custom Label Position

Post by SetNug » Thu Jun 14, 2018 4:47 pm

Hi all,

We have requirement to create horizontal bar chart with one category and 1-3 series. The label of each series should be positioned at the left most of the bar and the value at the right most. Something like below:


So far I've come up with the following snippet:

Code: Select all

final CategoryDataset dataset = DatasetUtils.createCategoryDataset(new String[]{"Power"}, new String[]{""}, new double[][]{{100d}});
final JFreeChart chart = ChartFactory.createBarChart(null, null, null, dataset, PlotOrientation.HORIZONTAL, false, true, false);
final CategoryPlot plot = chart.getCategoryPlot();
Seems that I need to create custom renderer, but could anyone point me to samples on how to do so.

Any help would be greatly appreciated.


Post Reply