Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class ChartContext
- Object
- ChartContext
Everything a series needs to paint one frame: graphics, the plot rectangle, the axes
and how far the current animation has progressed.
Methods
public Graphics getGraphics() | The graphics to paint with; translated so the chart’s top left is (originX, originY). |
public Chart getChart() | The chart being painted. |
public ChartTheme getTheme() | The theme. |
public int getPlotX() | Left of the plot area, in the parent’s paint coordinates (the coordinate space of getGraphics()), not absolute screen coordinates. |
public int getPlotY() | Top of the plot area, in the parent’s paint coordinates. |
public int getPlotWidth() | Plot width. |
public int getPlotHeight() | Plot height. |
public int getOriginX() | The chart’s x in its parent’s paint coordinates (chart.getX()); subtract it from a painted x to get one relative to the chart. |
public int getOriginY() | The chart’s y in its parent’s paint coordinates (chart.getY()). |
public float getProgress() | The eased animation progress, 0 at the start of a transition and 1 when settled. |
public Font getFont() | The label font. |
public LabelLayout getLabels() | The shared collision layout: data labels placed through it never overlap each other or the axis labels. |
public boolean isRotated() | True when the category (x) axis runs vertically, as in a horizontal bar chart. |
public Axis getXAxis() | The x axis. |
public Axis getValueAxis(Series s) | The value axis a series is measured against. |
public float screenX(Series s, double x, double y) | The x of a data point in the parent’s paint coordinates (see getPlotX()). |
public float screenY(Series s, double x, double y) | The y of a data point in the parent’s paint coordinates (see getPlotY()). |
public float xLength(double dx) | The length in pixels of dx units along the x axis (a category band, a bar width), measured from the start of the visible range. |
public float valuePosition(Series s, double y) | Value to a pixel position along the value axis, for baselines. |
public int mm(float mm) | A dimension in pixels from millimetres. |
Inherited methods
Method details
getGraphics
public Graphics getGraphics()The graphics to paint with; translated so the chart’s top left is
(originX, originY).getChart
public Chart getChart()The chart being painted.
getTheme
public ChartTheme getTheme()The theme.
getPlotX
public int getPlotX()Left of the plot area, in the parent’s paint coordinates (the coordinate space of
getGraphics()), not absolute screen coordinates. A pointer’s absolute x converts to
this space as absX - chart.getAbsoluteX() + chart.getX().getPlotY
public int getPlotY()Top of the plot area, in the parent’s paint coordinates. A pointer’s absolute y
converts as
absY - chart.getAbsoluteY() + chart.getY().getPlotWidth
public int getPlotWidth()Plot width.
getPlotHeight
public int getPlotHeight()Plot height.
getOriginX
public int getOriginX()The chart’s x in its parent’s paint coordinates (
chart.getX()); subtract it from a
painted x to get one relative to the chart.getOriginY
public int getOriginY()The chart’s y in its parent’s paint coordinates (
chart.getY()).getProgress
public float getProgress()The eased animation progress, 0 at the start of a transition and 1 when settled.
getFont
public Font getFont()The label font.
getLabels
public LabelLayout getLabels()The shared collision layout: data labels placed through it never overlap each other
or the axis labels.
isRotated
public boolean isRotated()True when the category (x) axis runs vertically, as in a horizontal bar chart.
getXAxis
public Axis getXAxis()The x axis.
getValueAxis
public Axis getValueAxis(Series s)The value axis a series is measured against.
screenX
public float screenX(Series s, double x, double y)The x of a data point in the parent’s paint coordinates (see
getPlotX()).screenY
public float screenY(Series s, double x, double y)The y of a data point in the parent’s paint coordinates (see
getPlotY()).xLength
public float xLength(double dx)The length in pixels of
dx units along the x axis (a category band, a bar width),
measured from the start of the visible range. On a linear axis that is the same
everywhere; on a non-linear one (a LogAxis x) it is the length at the low end only,
so slot widths derived from it stay uniform rather than following each point.valuePosition
public float valuePosition(Series s, double y)Value to a pixel position along the value axis, for baselines.
mm
public int mm(float mm)A dimension in pixels from millimetres.