use of org.jfree.chart.axis.ExtendedCategoryAxis in project opennms by OpenNMS.
the class ChartUtils method addSubLabels.
/**
* @param barChart TODO
* @param subLabelClass
*/
private static void addSubLabels(JFreeChart barChart, String subLabelClass) {
ExtendedCategoryAxis subLabels;
CategoryPlot plot = barChart.getCategoryPlot();
try {
subLabels = (ExtendedCategoryAxis) Class.forName(subLabelClass).newInstance();
List<?> cats = plot.getCategories();
for (int i = 0; i < cats.size(); i++) {
subLabels.addSubLabel((Comparable<?>) cats.get(i), cats.get(i).toString());
}
plot.setDomainAxis(subLabels);
} catch (InstantiationException e) {
LOG.error("getBarChart: Couldn't instantiate configured CategorySubLabels class: {}", subLabelClass, e);
} catch (IllegalAccessException e) {
LOG.error("getBarChart: Couldn't instantiate configured CategorySubLabels class: {}", subLabelClass, e);
} catch (ClassNotFoundException e) {
LOG.error("getBarChart: Couldn't instantiate configured CategorySubLabels class: {}", subLabelClass, e);
}
}
Aggregations