CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
categoryAxis.setCategoryMargin(0.0);
ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
WaterfallBarRenderer renderer = new WaterfallBarRenderer();
if (orientation == PlotOrientation.HORIZONTAL) {
ItemLabelPosition position = new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENTER,
TextAnchor.CENTER, Math.PI / 2.0);
renderer.setBasePositiveItemLabelPosition(position);
renderer.setBaseNegativeItemLabelPosition(position);
}
else if (orientation == PlotOrientation.VERTICAL) {
ItemLabelPosition position = new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENTER,
TextAnchor.CENTER, 0.0);
renderer.setBasePositiveItemLabelPosition(position);
renderer.setBaseNegativeItemLabelPosition(position);
}
if (tooltips) {
StandardCategoryToolTipGenerator generator
= new StandardCategoryToolTipGenerator();
renderer.setBaseToolTipGenerator(generator);
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);