-
public class PieRenderer extends SeriesRenderer<PieChart, Segment, SegmentFormatter>
Basic renderer for drawing pie charts.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enum
PieRenderer.DonutMode
-
Field Summary
Fields Modifier and Type Field Description private float
startDegs
private float
extentDegs
private float
donutSize
-
Constructor Summary
Constructors Constructor Description PieRenderer(PieChart plot)
-
Method Summary
Modifier and Type Method Description float
getStartDegs()
void
setStartDegs(float degs)
Set the starting point in degrees from which series will be drawn in order.The input value must be within the range 0 - 360. float
getExtentDegs()
void
setExtentDegs(float degs)
Set the size in degrees of the pie chart, extending from the startDegs. void
setDonutSize(float size, PieRenderer.DonutMode mode)
Set the size of the pie's empty inner space. float
getRadius(RectF rect)
void
onRender(Canvas canvas, RectF plotArea, Segment series, SegmentFormatter formatter, RenderStack stack)
Segment
getContainingSegment(PointF point)
Retrieve the segment containing the specified point. -
Methods inherited from class com.androidplot.ui.SeriesRenderer
drawSeriesLegendIcon, getFormatter, getPlot, getSeriesAndFormatterList, getSeriesList, render, setPlot
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
PieRenderer
PieRenderer(PieChart plot)
-
-
Method Detail
-
getStartDegs
float getStartDegs()
-
setStartDegs
void setStartDegs(float degs)
Set the starting point in degrees from which series will be drawn in order.The input value must be within the range 0 - 360.
-
getExtentDegs
float getExtentDegs()
-
setExtentDegs
void setExtentDegs(float degs)
Set the size in degrees of the pie chart, extending from the startDegs. The input valuemust be within the range 0 - 360. An input value would represent 100% of the pie as a halfcircle while an input value of 360 would be a full circle.
-
setDonutSize
void setDonutSize(float size, PieRenderer.DonutMode mode)
Set the size of the pie's empty inner space. May be specified as either pixels or as a percentage.If using PIXELS, the best practice is to specify values in dp using dpToPix.If using PERCENT the value must be within the range 0 - 1. The value beingset corresponds to the size of the donut radius relative to the pie's total radius.
-
onRender
void onRender(Canvas canvas, RectF plotArea, Segment series, SegmentFormatter formatter, RenderStack stack)
- Parameters:
series
- The series to be renderedformatter
- The getFormatter that should be used to render the seriesstack
- Ordered list of all series being renderered.
-
getContainingSegment
Segment getContainingSegment(PointF point)
Retrieve the segment containing the specified point. This current implementationonly matches against angle; clicks outside of the pie/donut inner/outer boundarieswill still trigger a match on the segment whose beginning and ending angle containsthe angle of the line drawn between the pie chart's center point and the clicked point.
- Parameters:
point
- The clicked point
-
-
-
-