Class RadarChart
Draws multi-dimensional data as a web chart (also known as a radar or spider chart).
The chart consumes an AreaSeries where each category represents an
axis radiating from the centre. Configure colours and labelling through a
DefaultRenderer and wrap the instance in a
com.codename1.charts.ChartComponent to present it inside your UI.
-
Field Summary
Fields inherited from class RoundChart
autoCalculateCenter, mCenterX, mCenterY, mRenderer, NO_VALUE, SHAPE_WIDTHModifier and TypeFieldDescriptionprotected booleanprotected intThe chart center X axis.protected intThe chart center y axis.protected DefaultRendererThe series renderer.protected static final intA no value constant.protected static final intThe legend shape width. -
Constructor Summary
ConstructorsConstructorDescriptionRadarChart(AreaSeries dataset, DefaultRenderer renderer) Builds a new radar chart instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidThe graphical representation of the radar chart.voiddrawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint) The graphical representation of the legend shape.intgetLegendShapeWidth(int seriesIndex) Returns the legend shape width.Methods inherited from class RoundChart
drawTitle, getCenterX, getCenterY, getRenderer, isAutocalculateCenter, setAutocalculateCenter, setCenterX, setCenterYModifier and TypeMethodDescriptionvoidThe graphical representation of the round chart title.intReturns the center on X axis.intReturns the center on Y axis.Returns the renderer.booleanvoidsetAutocalculateCenter(boolean a) voidsetCenterX(int centerX) Sets a new center on X axis.voidsetCenterY(int centerY) Sets a new center on Y axis.Methods inherited from class AbstractChart
calculateDrawPoints, drawBackground, drawLabel, drawLegend, drawPath, drawPath, drawString, getExceed, getLabel, getLegendSize, getSeriesAndPointForScreenCoordinate, isNullValue, isVerticalModifier and TypeMethodDescriptionprotected static float[]calculateDrawPoints(float p1x, float p1y, float p2x, float p2y, int screenHeight, int screenWidth) protected voiddrawBackground(DefaultRenderer renderer, Canvas canvas, int x, int y, int width, int height, Paint paint, boolean newColor, int color) Draws the chart background.protected voiddrawLabel(Canvas canvas, String labelText, DefaultRenderer renderer, List<Rectangle2D> prevLabelsBounds, int centerX, int centerY, float shortRadius, float longRadius, float currentAngle, float angle, int left, int right, int color, Paint paint, boolean line, boolean display) Draws a text label.protected intdrawLegend(Canvas canvas, DefaultRenderer renderer, String[] titles, int left, int right, int y, int width, int height, int legendSize, Paint paint, boolean calculate) Draws the chart legend.protected voidThe graphical representation of a path.protected voidThe graphical representation of a path.protected voiddrawString(Canvas canvas, String text, float x, float y, Paint paint) Draw a multiple lines string.protected booleangetExceed(float currentWidth, DefaultRenderer renderer, int right, int width) Calculates if the current width exceeds the total width.protected StringgetLabel(NumberFormat format, double label) Makes sure the fraction digit is not displayed, if not needed.protected intgetLegendSize(DefaultRenderer renderer, int defaultHeight, float extraHeight) Calculates the current legend size.getSeriesAndPointForScreenCoordinate(Point screenPoint) Given screen coordinates, returns the series and point indexes of a chart element.booleanisNullValue(double value) booleanisVertical(DefaultRenderer renderer) Checks if the current chart is rendered as vertical.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Constructor Details
-
RadarChart
Builds a new radar chart instance.
Parameters
-
dataset: the series dataset -
renderer: the series renderer
-
-
-
Method Details
-
draw
The graphical representation of the radar chart.
Parameters
-
canvas: the canvas to paint to -
x: the top left x value of the view to draw to -
y: the top left y value of the view to draw to -
width: the width of the view to draw to -
height: the height of the view to draw to -
paint: the paint
- Specified by:
drawin classAbstractChart
-
-
getLegendShapeWidth
public int getLegendShapeWidth(int seriesIndex) Returns the legend shape width.
Parameters
seriesIndex: the series index
Returns
the legend shape width
- Overrides:
getLegendShapeWidthin classRoundChart
-
drawLegendShape
public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint) The graphical representation of the legend shape.
Parameters
-
canvas: the canvas to paint to -
renderer: the series renderer -
x: the x value of the point the shape should be drawn at -
y: the y value of the point the shape should be drawn at -
seriesIndex: the series index -
paint: the paint to be used for drawing
- Overrides:
drawLegendShapein classRoundChart
-
-