Class XYMultipleSeriesRenderer

java.lang.Object
com.codename1.charts.renderers.DefaultRenderer
com.codename1.charts.renderers.XYMultipleSeriesRenderer

public class XYMultipleSeriesRenderer extends DefaultRenderer
Multiple XY series renderer.
  • Constructor Details

    • XYMultipleSeriesRenderer

      public XYMultipleSeriesRenderer()
    • XYMultipleSeriesRenderer

      public XYMultipleSeriesRenderer(int scaleNumber)
  • Method Details

    • initAxesRange

      public void initAxesRange(int scales)
    • initAxesRangeForScale

      public void initAxesRangeForScale(int i)
    • getOrientation

      public XYMultipleSeriesRenderer.Orientation getOrientation()

      Returns the current orientation of the chart X axis.

      Returns

      the chart orientation

    • setOrientation

      public void setOrientation(XYMultipleSeriesRenderer.Orientation orientation)

      Sets the current orientation of the chart X axis.

      Parameters
      • orientation: the chart orientation
    • getXTitle

      public String getXTitle()

      Returns the title for the X axis.

      Returns

      the X axis title

    • setXTitle

      public void setXTitle(String title)

      Sets the title for the X axis.

      Parameters
      • title: the X axis title
    • getYTitle

      public String getYTitle()

      Returns the title for the Y axis.

      Returns

      the Y axis title

    • setYTitle

      public void setYTitle(String title)

      Sets the title for the Y axis.

      Parameters
      • title: the Y axis title
    • getYTitle

      public String getYTitle(int scale)

      Returns the title for the Y axis.

      Parameters
      • scale: the renderer scale
      Returns

      the Y axis title

    • setYTitle

      public void setYTitle(String title, int scale)

      Sets the title for the Y axis.

      Parameters
      • title: the Y axis title

      • scale: the renderer scale

    • getAxisTitleTextSize

      public float getAxisTitleTextSize()

      Returns the axis title text size.

      Returns

      the axis title text size

    • setAxisTitleTextSize

      public void setAxisTitleTextSize(float textSize)

      Sets the axis title text size. Consider using #setAxisTitleTextFont(com.codename1.ui.Font) instead to allow the font size to to be adjusted appropriately for the display resolution.

      Parameters
      • textSize: the chart axis text size
    • setAxisTitleTextFont

      public void setAxisTitleTextFont(Font font)

      Sets the Axis title text font size using a Font object instead of a point size. This method is the preferred way to set font size because it allows you to more easily have fonts appear in an appropriate size for the target device.

      Alternatively check out #setAxisTitleTextSize(float) to set the text size in pixels.

      Parameters
      • font
    • getXAxisMin

      public double getXAxisMin()

      Returns the start value of the X axis range.

      Returns

      the X axis range start value

    • setXAxisMin

      public void setXAxisMin(double min)

      Sets the start value of the X axis range.

      Parameters
      • min: the X axis range start value
    • isMinXSet

      public boolean isMinXSet()

      Returns if the minimum X value was set.

      Returns

      the minX was set or not

    • getXAxisMax

      public double getXAxisMax()

      Returns the end value of the X axis range.

      Returns

      the X axis range end value

    • setXAxisMax

      public void setXAxisMax(double max)

      Sets the end value of the X axis range.

      Parameters
      • max: the X axis range end value
    • isMaxXSet

      public boolean isMaxXSet()

      Returns if the maximum X value was set.

      Returns

      the maxX was set or not

    • getYAxisMin

      public double getYAxisMin()

      Returns the start value of the Y axis range.

      Returns

      the Y axis range end value

    • setYAxisMin

      public void setYAxisMin(double min)

      Sets the start value of the Y axis range.

      Parameters
      • min: the Y axis range start value
    • isMinYSet

      public boolean isMinYSet()

      Returns if the minimum Y value was set.

      Returns

      the minY was set or not

    • getYAxisMax

      public double getYAxisMax()

      Returns the end value of the Y axis range.

      Returns

      the Y axis range end value

    • setYAxisMax

      public void setYAxisMax(double max)

      Sets the end value of the Y axis range.

      Parameters
      • max: the Y axis range end value
    • isMaxYSet

      public boolean isMaxYSet()

      Returns if the maximum Y value was set.

      Returns

      the maxY was set or not

    • getXAxisMin

      public double getXAxisMin(int scale)

      Returns the start value of the X axis range.

      Parameters
      • scale: the renderer scale
      Returns

      the X axis range start value

    • setXAxisMin

      public void setXAxisMin(double min, int scale)

      Sets the start value of the X axis range.

      Parameters
      • min: the X axis range start value

      • scale: the renderer scale

    • isMinXSet

      public boolean isMinXSet(int scale)

      Returns if the minimum X value was set.

      Parameters
      • scale: the renderer scale
      Returns

      the minX was set or not

    • getXAxisMax

      public double getXAxisMax(int scale)

      Returns the end value of the X axis range.

      Parameters
      • scale: the renderer scale
      Returns

      the X axis range end value

    • setXAxisMax

      public void setXAxisMax(double max, int scale)

      Sets the end value of the X axis range.

      Parameters
      • max: the X axis range end value

      • scale: the renderer scale

    • isMaxXSet

      public boolean isMaxXSet(int scale)

      Returns if the maximum X value was set.

      Parameters
      • scale: the renderer scale
      Returns

      the maxX was set or not

    • getYAxisMin

      public double getYAxisMin(int scale)

      Returns the start value of the Y axis range.

      Parameters
      • scale: the renderer scale
      Returns

      the Y axis range end value

    • setYAxisMin

      public void setYAxisMin(double min, int scale)

      Sets the start value of the Y axis range.

      Parameters
      • min: the Y axis range start value

      • scale: the renderer scale

    • isMinYSet

      public boolean isMinYSet(int scale)

      Returns if the minimum Y value was set.

      Parameters
      • scale: the renderer scale
      Returns

      the minY was set or not

    • getYAxisMax

      public double getYAxisMax(int scale)

      Returns the end value of the Y axis range.

      Parameters
      • scale: the renderer scale
      Returns

      the Y axis range end value

    • setYAxisMax

      public void setYAxisMax(double max, int scale)

      Sets the end value of the Y axis range.

      Parameters
      • max: the Y axis range end value

      • scale: the renderer scale

    • isMaxYSet

      public boolean isMaxYSet(int scale)

      Returns if the maximum Y value was set.

      Parameters
      • scale: the renderer scale
      Returns

      the maxY was set or not

    • getXLabels

      public int getXLabels()

      Returns the approximate number of labels for the X axis.

      Returns

      the approximate number of labels for the X axis

    • setXLabels

      public void setXLabels(int xLabels)

      Sets the approximate number of labels for the X axis.

      Parameters
      • xLabels: the approximate number of labels for the X axis
    • addTextLabel

      public void addTextLabel(double x, String text)

      Adds a new text label for the specified X axis value.

      Parameters
      • x: the X axis value

      • text: the text label

      Deprecated

      use addXTextLabel instead

    • addXTextLabel

      public void addXTextLabel(double x, String text)

      Adds a new text label for the specified X axis value.

      Parameters
      • x: the X axis value

      • text: the text label

    • removeXTextLabel

      public void removeXTextLabel(double x)

      Removes text label for the specified X axis value.

      Parameters
      • x: the X axis value
    • getXTextLabel

      public String getXTextLabel(Double x)

      Returns the X axis text label at the specified X axis value.

      Parameters
      • x: the X axis value
      Returns

      the X axis text label

    • getXTextLabelLocations

      public Double[] getXTextLabelLocations()

      Returns the X text label locations.

      Returns

      the X text label locations

    • clearTextLabels

      public void clearTextLabels()

      Clears the existing text labels.

      Deprecated

      use clearXTextLabels instead

    • clearXTextLabels

      public void clearXTextLabels()
      Clears the existing text labels on the X axis.
    • isXRoundedLabels

      public boolean isXRoundedLabels()

      If X axis labels should be rounded.

      Returns

      if rounded time values to be used

    • setXRoundedLabels

      public void setXRoundedLabels(boolean rounded)

      Sets if X axis rounded time values to be used.

      Parameters
      • rounded: rounded values to be used
    • addYTextLabel

      public void addYTextLabel(double y, String text)

      Adds a new text label for the specified Y axis value.

      Parameters
      • y: the Y axis value

      • text: the text label

    • removeYTextLabel

      public void removeYTextLabel(double y)

      Removes text label for the specified Y axis value.

      Parameters
      • y: the Y axis value
    • addYTextLabel

      public void addYTextLabel(double y, String text, int scale)

      Adds a new text label for the specified Y axis value.

      Parameters
      • y: the Y axis value

      • text: the text label

      • scale: the renderer scale

    • removeYTextLabel

      public void removeYTextLabel(double y, int scale)

      Removes text label for the specified Y axis value.

      Parameters
      • y: the Y axis value

      • scale: the renderer scale

    • getYTextLabel

      public String getYTextLabel(Double y)

      Returns the Y axis text label at the specified Y axis value.

      Parameters
      • y: the Y axis value
      Returns

      the Y axis text label

    • getYTextLabel

      public String getYTextLabel(Double y, int scale)

      Returns the Y axis text label at the specified Y axis value.

      Parameters
      • y: the Y axis value

      • scale: the renderer scale

      Returns

      the Y axis text label

    • getYTextLabelLocations

      public Double[] getYTextLabelLocations()

      Returns the Y text label locations.

      Returns

      the Y text label locations

    • getYTextLabelLocations

      public Double[] getYTextLabelLocations(int scale)

      Returns the Y text label locations.

      Parameters
      • scale: the renderer scale
      Returns

      the Y text label locations

    • clearYTextLabels

      public void clearYTextLabels()
      Clears the existing text labels on the Y axis.
    • clearYTextLabels

      public void clearYTextLabels(int scale)

      Clears the existing text labels on the Y axis.

      Parameters
      • scale: the renderer scale
    • getYLabels

      public int getYLabels()

      Returns the approximate number of labels for the Y axis.

      Returns

      the approximate number of labels for the Y axis

    • setYLabels

      public void setYLabels(int yLabels)

      Sets the approximate number of labels for the Y axis.

      Parameters
      • yLabels: the approximate number of labels for the Y axis
    • getBarWidth

      public float getBarWidth()

      Returns the constant bar chart item width in pixels.

      Returns

      the bar width

    • setBarWidth

      public void setBarWidth(float width)

      Sets the bar chart item constant width in pixels.

      Parameters
      • width: width in pixels
    • isPanEnabled

      public boolean isPanEnabled()

      Returns the enabled state of the pan on at least one axis.

      Returns

      if pan is enabled

      Overrides:
      isPanEnabled in class DefaultRenderer
    • setPanEnabled

      public void setPanEnabled(boolean enabled)
      Override DefaultRenderer#setPanEnabled(boolean) so it can be delegated to boolean).
      Overrides:
      setPanEnabled in class DefaultRenderer
    • isPanXEnabled

      public boolean isPanXEnabled()

      Returns the enabled state of the pan on X axis.

      Returns

      if pan is enabled on X axis

    • isPanYEnabled

      public boolean isPanYEnabled()

      Returns the enabled state of the pan on Y axis.

      Returns

      if pan is enabled on Y axis

    • setPanEnabled

      public void setPanEnabled(boolean enabledX, boolean enabledY)

      Sets the enabled state of the pan.

      Parameters
      • enabledX: pan enabled on X axis

      • enabledY: pan enabled on Y axis

    • isZoomEnabled

      public boolean isZoomEnabled()

      Returns the enabled state of the zoom on at least one axis.

      Returns

      if zoom is enabled

      Overrides:
      isZoomEnabled in class DefaultRenderer
    • isZoomXEnabled

      public boolean isZoomXEnabled()

      Returns the enabled state of the zoom on X axis.

      Returns

      if zoom is enabled on X axis

    • isZoomYEnabled

      public boolean isZoomYEnabled()

      Returns the enabled state of the zoom on Y axis.

      Returns

      if zoom is enabled on Y axis

    • setZoomEnabled

      public void setZoomEnabled(boolean enabledX, boolean enabledY)

      Sets the enabled state of the zoom.

      Parameters
      • enabledX: zoom enabled on X axis

      • enabledY: zoom enabled on Y axis

    • getBarsSpacing

      public double getBarsSpacing()

      Returns the spacing between bars, in bar charts.

      Returns

      the spacing between bars

      Deprecated

      use getBarSpacing instead

    • getBarSpacing

      public double getBarSpacing()

      Returns the spacing between bars, in bar charts.

      Returns

      the spacing between bars

    • setBarSpacing

      public void setBarSpacing(double spacing)

      Sets the spacing between bars, in bar charts. Only available for bar charts. This is a coefficient of the bar width. For instance, if you want the spacing to be a half of the bar width, set this value to 0.5.

      Parameters
      • spacing: the spacing between bars coefficient
    • getMarginsColor

      public int getMarginsColor()

      Returns the margins color.

      Returns

      the margins color

    • setMarginsColor

      public void setMarginsColor(int color)

      Sets the color of the margins.

      Parameters
      • color: the margins color
    • getGridColor

      public int getGridColor(int scale)

      Returns the grid color.

      Parameters
      • scale: the renderer index
      Returns

      the grid color

    • setGridColor

      public void setGridColor(int color)

      Sets the color of the grid.

      Parameters
      • color: the grid color
    • setGridColor

      public void setGridColor(int color, int scale)

      Sets the color of the grid.

      Parameters
      • color: the grid color

      • scale: the renderer scale

    • getPanLimits

      public double[] getPanLimits()

      Returns the pan limits.

      Returns

      the pan limits

    • setPanLimits

      public void setPanLimits(double[] panLimits)

      Sets the pan limits as an array of 4 values. Setting it to null or a different size array will disable the panning limitation. Values: [panMinimumX, panMaximumX, panMinimumY, panMaximumY]

      Parameters
      • panLimits: the pan limits
    • getZoomLimits

      public double[] getZoomLimits()

      Returns the zoom limits as a 4-element array, or null if there are no limits applied.

      Array elements are:

      • 0 : Minimum distance between X-Axis min and max values. Same as #getZoomInLimitX()

      • 1 : Maximum distance between X-Axis min and max values.

      • 2 : Minimum distance between Y-Axis min and max values. Same as #getZoomInLimitY()

      • 3 : Maximum distance between Y-Axis min and max values.

      Returns

      the zoom limits

    • setZoomLimits

      public void setZoomLimits(double[] zoomLimits)

      Sets the zoom limits as an array of 4 values.

      Array elements are:

      • 0 : Minimum distance between X-Axis min and max values. Same as #getZoomInLimitX()

      • 1 : Maximum distance between X-Axis min and max values.

      • 2 : Minimum distance between Y-Axis min and max values. Same as #getZoomInLimitY()

      • 3 : Maximum distance between Y-Axis min and max values.

      Setting this value as null will turn off all limits so that, if zoom is enabled, users can zoom and and out as much as they like.

      Parameters
      • zoomLimits: the zoom limits
    • getXLabelsAngle

      public float getXLabelsAngle()

      Returns the rotation angle of labels for the X axis.

      Returns

      the rotation angle of labels for the X axis

    • setXLabelsAngle

      public void setXLabelsAngle(float angle)

      Sets the rotation angle (in degrees) of labels for the X axis.

      Parameters
      • angle: the rotation angle of labels for the X axis
    • getYLabelsAngle

      public float getYLabelsAngle()

      Returns the rotation angle of labels for the Y axis.

      Returns

      the approximate number of labels for the Y axis

    • setYLabelsAngle

      public void setYLabelsAngle(float angle)

      Sets the rotation angle (in degrees) of labels for the Y axis.

      Parameters
      • angle: the rotation angle of labels for the Y axis
    • getPointSize

      public float getPointSize()

      Returns the size of the points, for charts displaying points.

      Returns

      the point size

    • setPointSize

      public void setPointSize(float size)

      Sets the size of the points, for charts displaying points.

      Parameters
      • size: the point size
    • setRange

      public void setRange(double[] range)

      Sets the axes range values.

      Parameters
      • range: @param range an array having the values in this order: minX, maxX, minY, maxY
    • setRange

      public void setRange(double[] range, int scale)

      Sets the axes range values.

      Parameters
      • range: @param range an array having the values in this order: minX, maxX, minY, maxY

      • scale: the renderer scale

    • isInitialRangeSet

      public boolean isInitialRangeSet()
    • isInitialRangeSet

      public boolean isInitialRangeSet(int scale)

      Returns if the initial range is set.

      Parameters
      • scale: the renderer scale
      Returns

      the initial range was set or not

    • getInitialRange

      public double[] getInitialRange()

      Returns the initial range.

      Returns

      the initial range

    • setInitialRange

      public void setInitialRange(double[] range)

      Sets the axes initial range values. This will be used in the zoom fit tool.

      Parameters
      • range: @param range an array having the values in this order: minX, maxX, minY, maxY
    • getInitialRange

      public double[] getInitialRange(int scale)

      Returns the initial range.

      Parameters
      • scale: the renderer scale
      Returns

      the initial range

    • setInitialRange

      public void setInitialRange(double[] range, int scale)

      Sets the axes initial range values. This will be used in the zoom fit tool.

      Parameters
      • range: @param range an array having the values in this order: minX, maxX, minY, maxY

      • scale: the renderer scale

    • getXLabelsColor

      public int getXLabelsColor()

      Returns the X axis labels color.

      Returns

      the X axis labels color

    • setXLabelsColor

      public void setXLabelsColor(int color)

      Sets the X axis labels color.

      Parameters
      • color: the X axis labels color
    • getYLabelsColor

      public int getYLabelsColor(int scale)

      Returns the Y axis labels color.

      Returns

      the Y axis labels color

    • setYLabelsColor

      public void setYLabelsColor(int scale, int color)

      Sets the Y axis labels color.

      Parameters
      • scale: the renderer scale

      • color: the Y axis labels color

    • getXLabelsAlign

      public int getXLabelsAlign()

      Returns the X axis labels alignment. One of Component.CENTER, Component.LEFT, Component.RIGHT

      Returns

      X labels alignment

    • setXLabelsAlign

      public void setXLabelsAlign(int align)

      Sets the X axis labels alignment. One of Component.CENTER, Component.LEFT, Component.RIGHT

      Parameters
      • align: the X labels alignment
    • getYLabelsAlign

      public int getYLabelsAlign(int scale)

      Returns the Y axis labels alignment.

      Parameters
      • scale: the renderer scale
      Returns

      Y labels alignment

    • setYLabelsAlign

      public void setYLabelsAlign(int align)
    • getYAxisAlign

      public int getYAxisAlign(int scale)
    • setYAxisAlign

      public void setYAxisAlign(int align, int scale)
    • setYLabelsAlign

      public void setYLabelsAlign(int align, int scale)

      Sets the Y axis labels alignment.

      Parameters
      • align: the Y labels alignment
    • getXLabelsPadding

      public float getXLabelsPadding()

      Returns the X labels padding.

      Returns

      X labels padding

    • setXLabelsPadding

      public void setXLabelsPadding(float padding)

      Sets the X labels padding

      Parameters
      • padding: the amount of padding between the axis and the label
    • getYLabelsPadding

      public float getYLabelsPadding()

      Returns the Y labels padding.

      Returns

      Y labels padding

    • setYLabelsPadding

      public void setYLabelsPadding(float padding)

      Sets the Y labels padding

      Parameters
      • padding: the amount of padding between the axis and the label
    • getYLabelsVerticalPadding

      public float getYLabelsVerticalPadding()

      Returns the Y labels vertical padding.

      Returns

      Y labels vertical padding

    • setYLabelsVerticalPadding

      public void setYLabelsVerticalPadding(float padding)

      Sets the Y labels vertical padding

      Parameters
      • padding: the amount of vertical padding
    • getLabelFormat

      public NumberFormat getLabelFormat()

      Returns the number format for displaying labels.

      Returns

      the number format for labels

      Deprecated

      use getXLabelFormat and getYLabelFormat instead

    • getXLabelFormat

      public NumberFormat getXLabelFormat()

      Returns the number format for displaying X axis labels.

      Returns

      the number format for X axis labels

    • setXLabelFormat

      public void setXLabelFormat(NumberFormat format)

      Sets the number format for X axis displaying labels.

      Parameters
      • format: the number format for X axis labels
    • getYLabelFormat

      public NumberFormat getYLabelFormat(int scale)

      Returns the number format for Y axis displaying labels.

      Parameters
      • scale: the renderer scale
      Returns

      the number format for Y axis labels

    • setYLabelFormat

      public void setYLabelFormat(NumberFormat format, int scale)

      Sets the number format for Y axis displaying labels.

      Parameters
      • format: the number format for labels

      • scale: the renderer scale

    • getZoomInLimitX

      public double getZoomInLimitX()

      Returns the zoom in limit permitted in the axis X. This is interpreted as the maximum distance between #getXAxisMin() and #getXAxisMax().

      Returns

      the maximum zoom in permitted in the axis X

      See also
      • #setZoomInLimitX(double)
    • setZoomInLimitX

      public void setZoomInLimitX(double zoomInLimitX)

      Sets the zoom in limit permitted in the axis X.

      This function prevent that the distance between #getXAxisMin() and #getXAxisMax() can't be greater or equal than #getZoomInLimitX()

      Parameters
      • zoomInLimitX: @param zoomInLimitX the maximum distance permitted between #getXAxisMin() and #getXAxisMax().
    • getZoomInLimitY

      public double getZoomInLimitY()

      Returns the zoom in limit permitted in the axis Y. This is interpreted as the maximum difference between #getYAxisMin() and #getYAxisMax().

      Returns

      the maximum in zoom permitted in the axis Y

      See also
      • #setZoomInLimitY(double)
    • setZoomInLimitY

      public void setZoomInLimitY(double zoomInLimitY)

      Sets zoom in limit permitted in the axis Y.

      This function prevent that the distance between #getYAxisMin() and #getYAxisMax() can't be greater or equal than #getZoomInLimitY()

      Parameters
      • zoomInLimitY: @param zoomInLimitY the maximum distance permitted between #getYAxisMin() and #getYAxisMax()
    • getScalesCount

      public int getScalesCount()