Example usage for org.jfree.chart.renderer.category ScatterRenderer setUseSeriesOffset

List of usage examples for org.jfree.chart.renderer.category ScatterRenderer setUseSeriesOffset

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.category ScatterRenderer setUseSeriesOffset.

Prototype

public void setUseSeriesOffset(boolean offset) 

Source Link

Document

Sets the flag that controls whether or not the x-position for each data item is offset within its category according to the series, and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.ChartRendererFactory.java

private static void configureScatterRenderer(ScatterRenderer renderer, ValueSource valueSource,
        PlotInstance plotInstance) throws ChartPlottimeException {
    ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
    int seriesCount = valueSourceData.getSeriesCount();
    SeriesFormat seriesFormat = valueSource.getSeriesFormat();
    DimensionConfig domainConfig = valueSource.getDomainConfig();
    DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone()
            .getDimensionConfig(PlotDimension.COLOR);
    DimensionConfig shapeDimensionConfig = plotInstance.getCurrentPlotConfigurationClone()
            .getDimensionConfig(PlotDimension.SHAPE);

    renderer.setDefaultEntityRadius(4);/* w  w  w.  j a  v a2s  . c  om*/

    // loop all series and set series format
    for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
        // lines are not supported in a ScatterRenderer, but this is already checked in
        // JFreeChartPlotEngine.getWarnings().

        // configure series shape if necessary
        if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, shapeDimensionConfig)) {
            // if(seriesFormat.getItemShape() != ItemShape.NONE) {
            renderer.setSeriesShape(seriesIdx, seriesFormat.getItemShape().getShape());
            // } else {
            // throw new ChartPlottimeException("unsupported_item_shape",
            // valueSource.toString(), seriesFormat.getItemShape());
            // }
        }

        // configure series color if necessary
        if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) {
            Color itemColor = seriesFormat.getItemColor();
            renderer.setSeriesPaint(seriesIdx, itemColor);
        }
        renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
        renderer.setUseOutlinePaint(true);
        renderer.setDrawOutlines(true);
        renderer.setUseSeriesOffset(false);
    }
}