public abstract class AbstractChart extends Object
| Constructor and Description |
|---|
AbstractChart() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
draw(Canvas canvas,
int x,
int y,
int width,
int height,
Paint paint)
The graphical representation of the chart.
|
protected void |
drawBackground(DefaultRenderer renderer,
Canvas canvas,
int x,
int y,
int width,
int height,
Paint paint,
boolean newColor,
int color)
Draws the chart background.
|
protected void |
drawLabel(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 int |
drawLegend(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.
|
abstract void |
drawLegendShape(Canvas canvas,
SimpleSeriesRenderer renderer,
float x,
float y,
int seriesIndex,
Paint paint)
The graphical representation of the legend shape.
|
protected void |
drawPath(Canvas canvas,
float[] points,
Paint paint,
boolean circular)
The graphical representation of a path.
|
protected void |
drawPath(Canvas canvas,
List<Float> points,
Paint paint,
boolean circular)
The graphical representation of a path.
|
protected void |
drawString(Canvas canvas,
String text,
float x,
float y,
Paint paint)
Draw a multiple lines string.
|
protected boolean |
getExceed(float currentWidth,
DefaultRenderer renderer,
int right,
int width)
Calculates if the current width exceeds the total width.
|
protected String |
getLabel(NumberFormat format,
double label)
Makes sure the fraction digit is not displayed, if not needed.
|
abstract int |
getLegendShapeWidth(int seriesIndex)
Returns the legend shape width.
|
protected int |
getLegendSize(DefaultRenderer renderer,
int defaultHeight,
float extraHeight)
Calculates the current legend size.
|
SeriesSelection |
getSeriesAndPointForScreenCoordinate(Point screenPoint)
Given screen coordinates, returns the series and point indexes of a chart
element.
|
boolean |
isNullValue(double value) |
boolean |
isVertical(DefaultRenderer renderer)
Checks if the current chart is rendered as vertical.
|
public abstract void draw(Canvas canvas, int x, int y, int width, int height, Paint paint)
canvas - the canvas to paint tox - the top left x value of the view to draw toy - the top left y value of the view to draw towidth - the width of the view to draw toheight - the height of the view to draw topaint - the paintprotected void drawBackground(DefaultRenderer renderer, Canvas canvas, int x, int y, int width, int height, Paint paint, boolean newColor, int color)
renderer - the chart renderercanvas - the canvas to paint tox - the top left x value of the view to draw toy - the top left y value of the view to draw towidth - the width of the view to draw toheight - the height of the view to draw topaint - the paint used for drawingnewColor - if a new color is to be usedcolor - the color to be usedprotected int drawLegend(Canvas canvas, DefaultRenderer renderer, String[] titles, int left, int right, int y, int width, int height, int legendSize, Paint paint, boolean calculate)
canvas - the canvas to paint torenderer - the series renderertitles - the titles to go to the legendleft - the left X value of the area to draw toright - the right X value of the area to draw toy - the y value of the area to draw towidth - the width of the area to draw toheight - the height of the area to draw tolegendSize - the legend sizepaint - the paint to be used for drawingcalculate - if only calculating the legend sizeprotected void drawString(Canvas canvas, String text, float x, float y, Paint paint)
canvas - the canvas to paint totext - the text to be paintedx - the x value of the area to draw toy - the y value of the area to draw topaint - the paint to be used for drawingprotected boolean getExceed(float currentWidth,
DefaultRenderer renderer,
int right,
int width)
currentWidth - the current widthrenderer - the rendererright - the right side pixel valuewidth - the total widthpublic boolean isVertical(DefaultRenderer renderer)
renderer - the rendererprotected String getLabel(NumberFormat format, double label)
format - the number format for the labellabel - the input label valueprotected void drawPath(Canvas canvas, List<Float> points, Paint paint, boolean circular)
canvas - the canvas to paint topoints - the points that are contained in the path to paintpaint - the paint to be used for paintingcircular - if the path ends with the start pointprotected void drawPath(Canvas canvas, float[] points, Paint paint, boolean circular)
canvas - the canvas to paint topoints - the points that are contained in the path to paintpaint - the paint to be used for paintingcircular - if the path ends with the start pointpublic abstract int getLegendShapeWidth(int seriesIndex)
seriesIndex - the series indexpublic abstract void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint)
canvas - the canvas to paint torenderer - the series rendererx - the x value of the point the shape should be drawn aty - the y value of the point the shape should be drawn atseriesIndex - the series indexpaint - the paint to be used for drawingprotected int getLegendSize(DefaultRenderer renderer, int defaultHeight, float extraHeight)
renderer - the rendererdefaultHeight - the default heightextraHeight - the added extra heightprotected void drawLabel(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)
canvas - the canvaslabelText - the label textrenderer - the rendererprevLabelsBounds - the previous rendered label boundscenterX - the round chart center on X axiscenterY - the round chart center on Y axisshortRadius - the short radius for the round chartlongRadius - the long radius for the round chartcurrentAngle - the current angleangle - the label extra angleleft - the left sideright - the right sidecolor - the label colorpaint - the paintline - if a line to the label should be drawndisplay - display the label anywaypublic boolean isNullValue(double value)
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint)
screenPoint -