public class TimeChart
- Object
- AbstractChart
- XYChart
- LineChart
- TimeChart
Specialised LineChart that formats the X axis as dates or times.
Populate the chart with an XYMultipleSeriesDataset where X values are
expressed as milliseconds since the epoch. Configure the desired date format
using #setDateFormat(String) or let the chart choose an appropriate
format automatically.
Fields
public static final String TYPE = "Time" | /** The constant to identify this chart type. |
public static final long DAY = 86400000L | The number of milliseconds in a day. |
Constructors
public TimeChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) | Builds a new time chart instance. |
Methods
public String getDateFormat() | Returns the date format pattern to be used for formatting the X axis labels. |
public void setDateFormat(String format) | Sets the date format pattern to be used for formatting the X axis labels. |
protected void drawXLabels(List<Double> xLabels, Double[] xTextLabelLocations, Canvas canvas, Paint paint, int left, int top, int bottom, double xPixelsPerUnit, double minX, double maxX) | The graphical representation of the labels on the X axis. |
public String getChartType() | Returns the chart type identifier. |
protected List<Double> getXLabels(double min, double max, int count) |
Inherited fields
Inherited methods
From LineChart
setDatasetRenderer, drawSeries, clickableAreasForPoints, getLegendShapeWidth, drawLegendShape, isRenderPoints, getPointsChart
From XYChart
draw, getYLabels, getScreenR, setScreenR, drawSeries, drawPoints, drawChartValuesText, drawText, drawYLabels, drawXTextLabels, getRenderer, getDataset, getCalcRange, setCalcRange, toRealPoint, toScreenPoint, toRealPoint, toScreenPoint, getSeriesAndPointForScreenCoordinate, isRenderNullValues, getDefaultMinimum
Field details
TYPE
public static final String TYPE = "Time"/** The constant to identify this chart type.
DAY
public static final long DAY = 86400000LThe number of milliseconds in a day.
Constructor details
TimeChart
public TimeChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)Builds a new time chart instance.
Parameters
datasetXYMultipleSeriesDataset- the multiple series dataset
rendererXYMultipleSeriesRenderer- the multiple series renderer
Method details
getDateFormat
public String getDateFormat()Returns the date format pattern to be used for formatting the X axis
labels.
Returns
the date format pattern for the X axis labels
setDateFormat
public void setDateFormat(String format)Sets the date format pattern to be used for formatting the X axis labels.
Parameters
formatString- the date format pattern for the X axis labels. If null, an appropriate default format will be used.
drawXLabels
protected void drawXLabels(List<Double> xLabels, Double[] xTextLabelLocations, Canvas canvas, Paint paint, int left, int top, int bottom, double xPixelsPerUnit, double minX, double maxX)The graphical representation of the labels on the X axis.
Parameters
xLabelsList<Double>- the X labels values
xTextLabelLocationsDouble[]- the X text label locations
canvasCanvas- the canvas to paint to
paintPaint- the paint to be used for drawing
leftint- the left value of the labels area
topint- the top value of the labels area
bottomint- the bottom value of the labels area
xPixelsPerUnitdouble- the amount of pixels per one unit in the chart labels
minXdouble- the minimum value on the X axis in the chart
maxXdouble- the maximum value on the X axis in the chart
getChartType
public String getChartType()Returns the chart type identifier.
Returns
the chart type
getXLabels
protected List<Double> getXLabels(double min, double max, int count)