PiePlot extends AbstractPlot implements Navigable { @Override public void add(int index, DataSource source, boolean visible) { if (getData().size() != 0) { throw new IllegalArgumentException( "This plot type only supports a single data source."); } PointRenderer pointRendererDefault = new PieSliceRenderer(this); setPointRenderer(source, pointRendererDefault); super.add(index, source, visible); setMapping(source, AXIS_TANGENTIAL); } PiePlot(DataSource data); @Override void autoscaleAxis(String axisName); @Override void add(int index, DataSource source, boolean visible); PointRenderer getPointRenderer(DataSource s); void setPointRenderer(DataSource s, PointRenderer pointRenderer); Navigator getNavigator(); static DataSource createPieData(DataSource data); Point2D getCenter(); void setCenter(Point2D center); double getRadius(); void setRadius(double radius); double getStart(); void setStart(double start); boolean isClockwise(); void setClockwise(boolean clockwise); static final String AXIS_TANGENTIAL; }
@Test public void testAddRemoveData() { plot.remove(data); assertEquals(0, plot.getData().size()); plot.add(data); assertEquals(1, plot.getData().size()); try { plot.add(data); fail(); } catch (IllegalArgumentException e) { } }