@Test public void testSetDonutSize() throws Exception { Segment segment1 = spy(new Segment("s1", 25)); Segment segment2 = spy(new Segment("s2", 25)); Segment segment3 = spy(new Segment("s3", 25)); Segment segment4 = spy(new Segment("s4", 25)); SegmentFormatter formatter = spy( new SegmentFormatter(Color.GREEN, Color.GREEN, Color.GREEN, Color.GREEN)); PieRenderer renderer = formatter.getRendererInstance(pieChart); pieChart.addSegment(segment1, formatter); pieChart.addSegment(segment2, formatter); pieChart.addSegment(segment3, formatter); pieChart.addSegment(segment4, formatter); renderer.setDonutSize(0.25f, PieRenderer.DonutMode.PERCENT); renderer.onRender(canvas, plotArea, segment1, formatter, renderStack); }
public void setDonutSize(float size, DonutMode mode) { switch (mode) { case PERCENT: if (size < 0 || size > 1) { throw new IllegalArgumentException( "Size parameter must be between 0 and 1 when operating in PERCENT mode."); } break; case PIXELS: break; default: throw new UnsupportedOperationException("Not yet implemented."); } donutMode = mode; donutSize = size; }
PieRenderer extends SeriesRenderer<PieChart, Segment, SegmentFormatter> { public void setDonutSize(float size, DonutMode mode) { switch (mode) { case PERCENT: if (size < 0 || size > 1) { throw new IllegalArgumentException( "Size parameter must be between 0 and 1 when operating in PERCENT mode."); } break; case PIXELS: break; default: throw new UnsupportedOperationException("Not yet implemented."); } donutMode = mode; donutSize = size; } }
PieRenderer extends SeriesRenderer<PieChart, Segment, SegmentFormatter> { public void setDonutSize(float size, DonutMode mode) { switch (mode) { case PERCENT: if (size < 0 || size > 1) { throw new IllegalArgumentException( "Size parameter must be between 0 and 1 when operating in PERCENT mode."); } break; case PIXELS: break; default: throw new UnsupportedOperationException("Not yet implemented."); } donutMode = mode; donutSize = size; } PieRenderer(PieChart plot); }
PieRenderer extends SeriesRenderer<PieChart, Segment, SegmentFormatter> { public void setDonutSize(float size, DonutMode mode) { switch (mode) { case PERCENT: if (size < 0 || size > 1) { throw new IllegalArgumentException( "Size parameter must be between 0 and 1 when operating in PERCENT mode."); } break; case PIXELS: break; default: throw new UnsupportedOperationException("Not yet implemented."); } donutMode = mode; donutSize = size; } PieRenderer(PieChart plot); float getRadius(RectF rect); @Override void onRender(Canvas canvas, RectF plotArea, Segment series, SegmentFormatter formatter,
            RenderStack stack); void setDonutSize(float size, DonutMode mode); Segment getContainingSegment(PointF point); void setStartDegs(float degs); float getStartDegs(); void setExtentDegs(float degs); float getExtentDegs(); }
PieRenderer extends SeriesRenderer<PieChart, Segment, SegmentFormatter> { public void setDonutSize(float size, DonutMode mode) { switch (mode) { case PERCENT: if (size < 0 || size > 1) { throw new IllegalArgumentException( "Size parameter must be between 0 and 1 when operating in PERCENT mode."); } break; case PIXELS: break; default: throw new UnsupportedOperationException("Not yet implemented."); } donutMode = mode; donutSize = size; } PieRenderer(PieChart plot); float getRadius(RectF rect); @Override void onRender(Canvas canvas, RectF plotArea, Segment series, SegmentFormatter formatter,
            RenderStack stack); void setDonutSize(float size, DonutMode mode); Segment getContainingSegment(PointF point); void setStartDegs(float degs); float getStartDegs(); void setExtentDegs(float degs); float getExtentDegs();  }