use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class CombinedCategoryPlot method getDataRange.
/**
* Returns the bounds of the data values that will be plotted against
* the specified axis.
*
* @param axis the axis.
*
* @return The bounds.
*/
public Range getDataRange(ValueAxis axis) {
Range l_result = null;
Iterator l_itr = getSubplots().iterator();
while (l_itr.hasNext()) {
CategoryPlot l_subplot = (CategoryPlot) l_itr.next();
l_result = Range.combine(l_result, l_subplot.getDataRange(axis));
}
return l_result;
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class CombinedCategoryPlot method setRangeAxis.
/**
* Sets the range axis that is shared by all the subplots.
*
* @param axis the axis.
*/
public void setRangeAxis(ValueAxis axis) {
Iterator l_itr = getSubplots().iterator();
while (l_itr.hasNext()) {
CategoryPlot l_subplot = (CategoryPlot) l_itr.next();
l_subplot.setRangeAxis(0, axis, false);
}
super.setRangeAxis(axis);
if (null == axis) {
return;
}
axis.configure();
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class ChartFactory method createStackedAreaChart.
/**
* Creates a stacked area chart with default settings. The chart object
* returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a
* {@link NumberAxis} as the range axis, and a {@link StackedAreaRenderer}
* as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param valueAxisLabel the label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the plot orientation (horizontal or vertical)
* (<code>null</code> not permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A stacked area chart.
*/
public static JFreeChart createStackedAreaChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {
ParamChecks.nullNotPermitted(orientation, "orientation");
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
categoryAxis.setCategoryMargin(0.0);
ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
StackedAreaRenderer renderer = new StackedAreaRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class ChartFactory method createBoxAndWhiskerChart.
/**
* Creates and returns a default instance of a box and whisker chart
* based on data from a {@link BoxAndWhiskerCategoryDataset}.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel a label for the category axis
* (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A box and whisker chart.
*
* @since 1.0.4
*/
public static JFreeChart createBoxAndWhiskerChart(String title, String categoryAxisLabel, String valueAxisLabel, BoxAndWhiskerCategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
valueAxis.setAutoRangeIncludesZero(false);
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class ChartFactory method createWaterfallChart.
/**
* Creates a waterfall chart. The chart object returned by this method
* uses a {@link CategoryPlot} instance as the plot, with a
* {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
* range axis, and a {@link WaterfallBarRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param valueAxisLabel the label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param orientation the plot orientation (horizontal or vertical)
* (<code>null</code> NOT permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A waterfall chart.
*/
public static JFreeChart createWaterfallChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {
ParamChecks.nullNotPermitted(orientation, "orientation");
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);
plot.clearRangeMarkers();
Marker baseline = new ValueMarker(0.0);
baseline.setPaint(Color.black);
plot.addRangeMarker(baseline, Layer.FOREGROUND);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
Aggregations