Java 类org.jfree.chart.renderer.category.ScatterRenderer 实例源码

项目:rapidminer    文件: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);

    // 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);
    }
}
项目:rapidminer-studio    文件: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);

    // 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);
    }
}
项目:astor    文件:ScatterRendererTests.java   
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {

    ScatterRenderer r1 = new ScatterRenderer();
    ScatterRenderer r2 = new ScatterRenderer();
    assertEquals(r1, r2);

    r1.setSeriesShapesFilled(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesShapesFilled(1, true);
    assertTrue(r1.equals(r2));

    r1.setBaseShapesFilled(false);
    assertFalse(r1.equals(r2));
    r2.setBaseShapesFilled(false);
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setDrawOutlines(true);
    assertFalse(r1.equals(r2));
    r2.setDrawOutlines(true);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(true);
    assertTrue(r1.equals(r2));

    r1.setUseSeriesOffset(false);
    assertFalse(r1.equals(r2));
    r2.setUseSeriesOffset(false);
    assertTrue(r1.equals(r2));

}
项目:astor    文件:ScatterRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    ScatterRenderer r1 = new ScatterRenderer();
    ScatterRenderer r2 = new ScatterRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:ScatterRendererTests.java   
/**
 * Checks that the two renderers are equal but independent of one another.
 *
 * @param r1  renderer 1.
 * @param r2  renderer 2.
 *
 * @return A boolean.
 */
private boolean checkIndependence(ScatterRenderer r1,
        ScatterRenderer r2) {

    // should be equal...
    if (!r1.equals(r2)) {
        return false;
    }

    // and independent...
    r1.setSeriesShapesFilled(1, true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setSeriesShapesFilled(1, true);
    if (!r1.equals(r2)) {
        return false;
    }

    r1.setBaseShapesFilled(false);
    r2.setBaseShapesFilled(true);
    if (r1.equals(r2)) {
        return false;
    }
    r2.setBaseShapesFilled(false);
    if (!r1.equals(r2)) {
        return false;
    }
    return true;

}
项目:rapidminer-5    文件: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);

        // 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);
        }
    }
项目:astor    文件:ScatterRendererTests.java   
/**
 * Check that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    ScatterRenderer r1 = new ScatterRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}