Class ChartContext

java.lang.Object
com.codename1.ui.chart.ChartContext

public final class ChartContext extends Object
Everything a series needs to paint one frame: graphics, the plot rectangle, the axes and how far the current animation has progressed.
  • Method Summary

    Modifier and Type
    Method
    Description
    The chart being painted.
    The label font.
    The graphics to paint with; translated so the chart's top left is (originX, originY).
    The shared collision layout: data labels placed through it never overlap each other or the axis labels.
    int
    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.
    int
    The chart's y in its parent's paint coordinates (chart.getY()).
    int
    Plot height.
    int
    Plot width.
    int
    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().
    int
    Top of the plot area, in the parent's paint coordinates.
    float
    The eased animation progress, 0 at the start of a transition and 1 when settled.
    The theme.
    The value axis a series is measured against.
    The x axis.
    boolean
    True when the category (x) axis runs vertically, as in a horizontal bar chart.
    int
    mm(float mm)
    A dimension in pixels from millimetres.
    float
    screenX(Series s, double x, double y)
    The x of a data point in the parent's paint coordinates (see getPlotX()).
    float
    screenY(Series s, double x, double y)
    The y of a data point in the parent's paint coordinates (see getPlotY()).
    float
    valuePosition(Series s, double y)
    Value to a pixel position along the value axis, for baselines.
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.