# Class DefaultRenderer

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

Direct Known Subclasses:
  `DialRenderer, XYMultipleSeriesRenderer`

public class DefaultRenderer extends java.lang.Object
An abstract renderer to be extended by the multiple series classes.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `BACKGROUND_COLOR`
  The default background color.
  `static final int`
  `NO_COLOR`
  A no color constant.
  `static final int`
  `TEXT_COLOR`
  The default color for text.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultRenderer()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addSeriesRenderer(int index, SimpleSeriesRenderer renderer)`
  Adds a simple renderer to the multiple renderer.
  `void`
  `addSeriesRenderer(SimpleSeriesRenderer renderer)`
  Adds a simple renderer to the multiple renderer.
  `int`
  `getAxesColor()`
  Returns the axes color.
  `int`
  `getBackgroundColor()`
  Returns the background color.
  `String`
  `getChartTitle()`
  Returns the chart title.
  `float`
  `getChartTitleTextSize()`
  Returns the chart title text size.
  `int`
  `getLabelsColor()`
  Returns the labels color.
  `float`
  `getLabelsTextSize()`
  Returns the labels text size.
  `int`
  `getLegendHeight()`
  Returns the legend height.
  `float`
  `getLegendTextSize()`
  Returns the legend text size.
  `int[]`
  `getMargins()`
  Returns the margin sizes.
  `float`
  `getOriginalScale()`
  Returns the original value to be used for scaling the chart.
  `float`
  `getScale()`
  Returns the value to be used for scaling the chart.
  `int`
  `getSelectableBuffer()`
  Returns the selectable radius value around clickable points.
  `SimpleSeriesRenderer`
  `getSeriesRendererAt(int index)`
  Returns the simple renderer from the multiple renderer list.
  `int`
  `getSeriesRendererCount()`
  Returns the simple renderers count in the multiple renderer list.
  `SimpleSeriesRenderer[]`
  `getSeriesRenderers()`
  Returns an array of the simple renderers in the multiple renderer list.
  `float`
  `getStartAngle()`
  Returns the start angle for circular charts such as pie, doughnut.
  `Font`
  `getTextTypeface()`
  Returns the text typeface.
  `int`
  `getTextTypefaceName()`
  Returns the text typeface name.
  `int`
  `getTextTypefaceStyle()`
  Returns the text typeface style.
  `int`
  `getXAxisColor()`
  Returns the color of the X axis
  `int`
  `getYAxisColor()`
  Returns the color of the Y axis
  `float`
  `getZoomRate()`
  Returns the zoom rate.
  `boolean`
  `isAntialiasing()`
  Returns the antialiasing flag value.
  `boolean`
  `isApplyBackgroundColor()`
  Returns if the background color should be applied.
  `boolean`
  `isClickEnabled()`
  Returns the enabled state of the click.
  `boolean`
  `isDisplayValues()`
  Returns if the values should be displayed as text.
  `boolean`
  `isExternalZoomEnabled()`
  Returns the enabled state of the external (application implemented) zoom.
  `boolean`
  `isFitLegend()`
  Returns if the legend should size to fit.
  `boolean`
  `isInScroll()`
  Returns if the chart is inside a scroll view and doesn't need to shrink.
  `boolean`
  `isPanEnabled()`
  Returns the enabled state of the pan.
  `boolean`
  `isShowAxes()`
  Returns if the axes should be visible.
  `boolean`
  `isShowCustomTextGridX()`
  Returns if the X axis custom text grid should be visible.
  `boolean`
  `isShowCustomTextGridY()`
  Returns if the Y axis custom text grid should be visible.
  `boolean`
  `isShowGridX()`
  Returns if the X axis grid should be visible.
  `boolean`
  `isShowGridY()`
  Returns if the Y axis grid should be visible.
  `boolean`
  `isShowLabels()`
  Returns if the labels should be visible.
  `boolean`
  `isShowLegend()`
  Returns if the legend should be visible.
  `boolean`
  `isShowTickMarks()`
  Returns if the tick marks should be visible.
  `boolean`
  `isZoomButtonsVisible()`
  Returns the visible state of the zoom buttons.
  `boolean`
  `isZoomEnabled()`
  Returns the enabled state of the zoom.
  `void`
  `removeAllRenderers()`
  Removes all renderers from the multiple renderer.
  `void`
  `removeSeriesRenderer(SimpleSeriesRenderer renderer)`
  Removes a simple renderer from the multiple renderer.
  `void`
  `setAntialiasing(boolean antialiasing)`
  Sets the antialiasing value.
  `void`
  `setApplyBackgroundColor(boolean apply)`
  Sets if the background color should be applied.
  `void`
  `setAxesColor(int color)`
  Sets the axes color.
  `void`
  `setBackgroundColor(int color)`
  Sets the background color.
  `void`
  `setChartTitle(String title)`
  Sets the chart title.
  `void`
  `setChartTitleTextFont(Font font)`
  Sets the chart title font size using a Font object instead of a point size.
  `void`
  `setChartTitleTextSize(float textSize)`
  Sets the chart title text size in pixels.
  `void`
  `setClickEnabled(boolean enabled)`
  Sets the enabled state of the click.
  `void`
  `setDisplayValues(boolean display)`
  Sets if the values should be displayed as text (supported by pie chart).
  `void`
  `setExternalZoomEnabled(boolean enabled)`
  Sets the enabled state of the external (application implemented) zoom.
  `void`
  `setFitLegend(boolean fit)`
  Sets if the legend should size to fit.
  `void`
  `setInScroll(boolean inScroll)`
  To be set if the chart is inside a scroll view and doesn't need to shrink when not enough space.
  `void`
  `setLabelsColor(int color)`
  Sets the labels color.
  `void`
  `setLabelsTextFont(Font font)`
  Sets the label title font size using a Font object instead of a point size.
  `void`
  `setLabelsTextSize(float textSize)`
  Sets the labels text size.
  `void`
  `setLegendHeight(int height)`
  Sets the legend height, in pixels.
  `void`
  `setLegendTextFont(Font font)`
  Sets the legend text font size using a Font object instead of a point size.
  `void`
  `setLegendTextSize(float textSize)`
  Sets the legend text size.
  `void`
  `setMargins(int[] margins)`
  Sets the margins, in pixels.
  `void`
  `setPanEnabled(boolean enabled)`
  Sets the enabled state of the pan.
  `void`
  `setScale(float scale)`
  Sets the value to be used for scaling the chart.
  `void`
  `setSelectableBuffer(int buffer)`
  Sets the selectable radius value around clickable points.
  `void`
  `setShowAxes(boolean showAxes)`
  Sets if the axes should be visible.
  `void`
  `setShowCustomTextGrid(boolean showGrid)`
  Sets if the grid for custom X or Y labels should be visible.
  `void`
  `setShowCustomTextGridX(boolean showGrid)`
  Sets if the X axis custom text grid should be visible.
  `void`
  `setShowCustomTextGridY(boolean showGrid)`
  Sets if the Y axis custom text grid should be visible.
  `void`
  `setShowGrid(boolean showGrid)`
  Sets if the grid should be visible.
  `void`
  `setShowGridX(boolean showGrid)`
  Sets if the X axis grid should be visible.
  `void`
  `setShowGridY(boolean showGrid)`
  Sets if the Y axis grid should be visible.
  `void`
  `setShowLabels(boolean showLabels)`
  Sets if the labels should be visible.
  `void`
  `setShowLegend(boolean showLegend)`
  Sets if the legend should be visible.
  `void`
  `setShowTickMarks(boolean mShowTickMarks)`
  Sets if the tick marks should be visible.
  `void`
  `setStartAngle(float startAngle)`
  Sets the start angle for circular charts such as pie, doughnut, etc.
  `void`
  `setTextTypeface(int typefaceName, int style)`
  Sets the text typeface name and style.
  `void`
  `setTextTypeface(Font typeface)`
  Sets the text typeface.
  `void`
  `setXAxisColor(int color)`
  Sets the X axis color.
  `void`
  `setYAxisColor(int color)`
  Sets the Y axis color.
  `void`
  `setZoomButtonsVisible(boolean visible)`
  Sets the visible state of the zoom buttons.
  `void`
  `setZoomEnabled(boolean enabled)`
  Sets the enabled state of the zoom.
  `void`
  `setZoomRate(float rate)`
  Sets the zoom rate.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NO_COLOR

    public static final int NO_COLOR
    A no color constant.
    See Also:
      - Constant Field Values

  - ### BACKGROUND_COLOR

    public static final int BACKGROUND_COLOR
    The default background color.
    See Also:
      - Constant Field Values

  - ### TEXT_COLOR

    public static final int TEXT_COLOR
    The default color for text.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### DefaultRenderer

    public DefaultRenderer()

- ## Method Details

  - ### getChartTitle

    public String getChartTitle()

    Returns the chart title.

    ###### Returns

    the chart title

  - ### setChartTitle

    public void setChartTitle(String title)

    Sets the chart title.

    ###### Parameters

    - `title`: the chart title

  - ### getChartTitleTextSize

    public float getChartTitleTextSize()

    Returns the chart title text size.

    ###### Returns

    the chart title text size

  - ### setChartTitleTextSize

    public void setChartTitleTextSize(float textSize)

    Sets the chart title text size in pixels. Consider using `#setChartTitleTextFont(com.codename1.ui.Font)` instead of this method to allow the text to be sized appropriately for the device resolution.

    ###### Parameters

    - `textSize`: the chart title text size

  - ### setChartTitleTextFont

    public void setChartTitleTextFont(Font font)

    Sets the chart title 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 `#setChartTitleTextSize(float)` to set the text size in pixels.

    ###### Parameters

    - `font`

  - ### addSeriesRenderer

    public void addSeriesRenderer(SimpleSeriesRenderer renderer)

    Adds a simple renderer to the multiple renderer.

    ###### Parameters

    - `renderer`: the renderer to be added

  - ### addSeriesRenderer

    public void addSeriesRenderer(int index, SimpleSeriesRenderer renderer)

    Adds a simple renderer to the multiple renderer.

    ###### Parameters

    - `index`: the index in the renderers list

    - `renderer`: the renderer to be added

  - ### removeSeriesRenderer

    public void removeSeriesRenderer(SimpleSeriesRenderer renderer)

    Removes a simple renderer from the multiple renderer.

    ###### Parameters

    - `renderer`: the renderer to be removed

  - ### removeAllRenderers

    public void removeAllRenderers()
    Removes all renderers from the multiple renderer.

  - ### getSeriesRendererAt

    public SimpleSeriesRenderer getSeriesRendererAt(int index)

    Returns the simple renderer from the multiple renderer list.

    ###### Parameters

    - `index`: the index in the simple renderers list

    ###### Returns

    the simple renderer at the specified index

  - ### getSeriesRendererCount

    public int getSeriesRendererCount()

    Returns the simple renderers count in the multiple renderer list.

    ###### Returns

    the simple renderers count

  - ### getSeriesRenderers

    public SimpleSeriesRenderer[] getSeriesRenderers()

    Returns an array of the simple renderers in the multiple renderer list.

    ###### Returns

    the simple renderers array

  - ### getBackgroundColor

    public int getBackgroundColor()

    Returns the background color.

    ###### Returns

    the background color

  - ### setBackgroundColor

    public void setBackgroundColor(int color)

    Sets the background color.

    ###### Parameters

    - `color`: the background color

  - ### isApplyBackgroundColor

    public boolean isApplyBackgroundColor()

    Returns if the background color should be applied.

    ###### Returns

    the apply flag for the background color.

  - ### setApplyBackgroundColor

    public void setApplyBackgroundColor(boolean apply)

    Sets if the background color should be applied.

    ###### Parameters

    - `apply`: the apply flag for the background color

  - ### getAxesColor

    public int getAxesColor()

    Returns the axes color.

    ###### Returns

    the axes color

  - ### setAxesColor

    public void setAxesColor(int color)

    Sets the axes color.

    ###### Parameters

    - `color`: the axes color

  - ### getYAxisColor

    public int getYAxisColor()

    Returns the color of the Y axis

    ###### Returns

    the Y axis color

  - ### setYAxisColor

    public void setYAxisColor(int color)

    Sets the Y axis color.

    ###### Parameters

    - `color`: the Y axis color

  - ### getXAxisColor

    public int getXAxisColor()

    Returns the color of the X axis

    ###### Returns

    the X axis color

  - ### setXAxisColor

    public void setXAxisColor(int color)

    Sets the X axis color.

    ###### Parameters

    - `color`: the X axis color

  - ### getLabelsColor

    public int getLabelsColor()

    Returns the labels color.

    ###### Returns

    the labels color

  - ### setLabelsColor

    public void setLabelsColor(int color)

    Sets the labels color.

    ###### Parameters

    - `color`: the labels color

  - ### getLabelsTextSize

    public float getLabelsTextSize()

    Returns the labels text size.

    ###### Returns

    the labels text size

  - ### setLabelsTextSize

    public void setLabelsTextSize(float textSize)

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

    ###### Parameters

    - `textSize`: the labels text size

  - ### setLabelsTextFont

    public void setLabelsTextFont(Font font)

    Sets the label title 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 `#setLabelsTextSize(float)` to set the text size in pixels.

    ###### Parameters

    - `font`

  - ### isShowAxes

    public boolean isShowAxes()

    Returns if the axes should be visible.

    ###### Returns

    the visibility flag for the axes

  - ### setShowAxes

    public void setShowAxes(boolean showAxes)

    Sets if the axes should be visible.

    ###### Parameters

    - `showAxes`: the visibility flag for the axes

  - ### isShowLabels

    public boolean isShowLabels()

    Returns if the labels should be visible.

    ###### Returns

    the visibility flag for the labels

  - ### setShowLabels

    public void setShowLabels(boolean showLabels)

    Sets if the labels should be visible.

    ###### Parameters

    - `showLabels`: the visibility flag for the labels

  - ### isShowTickMarks

    public boolean isShowTickMarks()
    Returns if the tick marks should be visible.

  - ### setShowTickMarks

    public void setShowTickMarks(boolean mShowTickMarks)

    Sets if the tick marks should be visible.

    ###### Parameters

    - `showTickMarks`: the visibility flag for the tick marks

  - ### isShowGridX

    public boolean isShowGridX()

    Returns if the X axis grid should be visible.

    ###### Returns

    the visibility flag for the X axis grid

  - ### setShowGridX

    public void setShowGridX(boolean showGrid)

    Sets if the X axis grid should be visible.

    ###### Parameters

    - `showGrid`: the visibility flag for the X axis grid

  - ### isShowGridY

    public boolean isShowGridY()

    Returns if the Y axis grid should be visible.

    ###### Returns

    the visibility flag for the Y axis grid

  - ### setShowGridY

    public void setShowGridY(boolean showGrid)

    Sets if the Y axis grid should be visible.

    ###### Parameters

    - `showGrid`: the visibility flag for the Y axis grid

  - ### setShowGrid

    public void setShowGrid(boolean showGrid)

    Sets if the grid should be visible.

    ###### Parameters

    - `showGrid`: the visibility flag for the grid

  - ### isShowCustomTextGridX

    public boolean isShowCustomTextGridX()

    Returns if the X axis custom text grid should be visible.

    ###### Returns

    the visibility flag for the X axis custom text grid

  - ### setShowCustomTextGridX

    public void setShowCustomTextGridX(boolean showGrid)

    Sets if the X axis custom text grid should be visible.

    ###### Parameters

    - `showGrid`: the visibility flag for the X axis custom text grid

  - ### isShowCustomTextGridY

    public boolean isShowCustomTextGridY()

    Returns if the Y axis custom text grid should be visible.

    ###### Returns

    the visibility flag for the custom text Y axis grid

  - ### setShowCustomTextGridY

    public void setShowCustomTextGridY(boolean showGrid)

    Sets if the Y axis custom text grid should be visible.

    ###### Parameters

    - `showGrid`: the visibility flag for the Y axis custom text grid

  - ### setShowCustomTextGrid

    public void setShowCustomTextGrid(boolean showGrid)

    Sets if the grid for custom X or Y labels should be visible.

    ###### Parameters

    - `showGrid`: the visibility flag for the custom text grid

  - ### isShowLegend

    public boolean isShowLegend()

    Returns if the legend should be visible.

    ###### Returns

    the visibility flag for the legend

  - ### setShowLegend

    public void setShowLegend(boolean showLegend)

    Sets if the legend should be visible.

    ###### Parameters

    - `showLegend`: the visibility flag for the legend

  - ### isFitLegend

    public boolean isFitLegend()

    Returns if the legend should size to fit.

    ###### Returns

    the fit behavior

  - ### setFitLegend

    public void setFitLegend(boolean fit)

    Sets if the legend should size to fit.

    ###### Parameters

    - `fit`: the fit behavior

  - ### getTextTypefaceName

    public int getTextTypefaceName()

    Returns the text typeface name.

    ###### Returns

    the text typeface name

  - ### getTextTypefaceStyle

    public int getTextTypefaceStyle()

    Returns the text typeface style.

    ###### Returns

    the text typeface style

  - ### getTextTypeface

    public Font getTextTypeface()

    Returns the text typeface.

    ###### Returns

    the text typeface

  - ### setTextTypeface

    public void setTextTypeface(Font typeface)

    Sets the text typeface.

    ###### Parameters

    - `typeface`: the typeface

  - ### getLegendTextSize

    public float getLegendTextSize()

    Returns the legend text size.

    ###### Returns

    the legend text size

  - ### setLegendTextSize

    public void setLegendTextSize(float textSize)

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

    ###### Parameters

    - `textSize`: the legend text size

  - ### setLegendTextFont

    public void setLegendTextFont(Font font)

    Sets the legend 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 `#setLegendTextSize(float)` to set the text size in pixels.

    ###### Parameters

    - `font`

  - ### setTextTypeface

    public void setTextTypeface(int typefaceName, int style)

    Sets the text typeface name and style.

    ###### Parameters

    - `typefaceName`: the text typeface name

    - `style`: the text typeface style

  - ### isAntialiasing

    public boolean isAntialiasing()

    Returns the antialiasing flag value.

    ###### Returns

    the antialiasing value

  - ### setAntialiasing

    public void setAntialiasing(boolean antialiasing)

    Sets the antialiasing value.

    ###### Parameters

    - `antialiasing`: the antialiasing

  - ### getScale

    public float getScale()

    Returns the value to be used for scaling the chart.

    ###### Returns

    the scale value

  - ### setScale

    public void setScale(float scale)

    Sets the value to be used for scaling the chart. It works on some charts like pie, doughnut, dial.

    ###### Parameters

    - `scale`: the scale value

  - ### getOriginalScale

    public float getOriginalScale()

    Returns the original value to be used for scaling the chart.

    ###### Returns

    the original scale value

  - ### isZoomEnabled

    public boolean isZoomEnabled()

    Returns the enabled state of the zoom.

    ###### Returns

    if zoom is enabled

  - ### setZoomEnabled

    public void setZoomEnabled(boolean enabled)

    Sets the enabled state of the zoom.

    ###### Parameters

    - `enabled`: zoom enabled

  - ### isZoomButtonsVisible

    public boolean isZoomButtonsVisible()

    Returns the visible state of the zoom buttons.

    ###### Returns

    if zoom buttons are visible

  - ### setZoomButtonsVisible

    public void setZoomButtonsVisible(boolean visible)

    Sets the visible state of the zoom buttons.

    ###### Parameters

    - `visible`: if the zoom buttons are visible

  - ### isExternalZoomEnabled

    public boolean isExternalZoomEnabled()

    Returns the enabled state of the external (application implemented) zoom.

    ###### Returns

    if external zoom is enabled

  - ### setExternalZoomEnabled

    public void setExternalZoomEnabled(boolean enabled)

    Sets the enabled state of the external (application implemented) zoom.

    ###### Parameters

    - `enabled`: external zoom enabled

  - ### getZoomRate

    public float getZoomRate()

    Returns the zoom rate.

    ###### Returns

    the zoom rate

  - ### setZoomRate

    public void setZoomRate(float rate)

    Sets the zoom rate.

    ###### Parameters

    - `rate`: the zoom rate

  - ### isPanEnabled

    public boolean isPanEnabled()

    Returns the enabled state of the pan.

    ###### Returns

    if pan is enabled

  - ### setPanEnabled

    public void setPanEnabled(boolean enabled)

    Sets the enabled state of the pan.

    ###### Parameters

    - `enabled`: pan enabled

  - ### isClickEnabled

    public boolean isClickEnabled()

    Returns the enabled state of the click.

    ###### Returns

    if click is enabled

  - ### setClickEnabled

    public void setClickEnabled(boolean enabled)

    Sets the enabled state of the click.

    ###### Parameters

    - `enabled`: click enabled

  - ### getSelectableBuffer

    public int getSelectableBuffer()

    Returns the selectable radius value around clickable points.

    ###### Returns

    the selectable radius

  - ### setSelectableBuffer

    public void setSelectableBuffer(int buffer)

    Sets the selectable radius value around clickable points.

    ###### Parameters

    - `buffer`: the selectable radius

  - ### getLegendHeight

    public int getLegendHeight()

    Returns the legend height.

    ###### Returns

    the legend height

  - ### setLegendHeight

    public void setLegendHeight(int height)

    Sets the legend height, in pixels.

    ###### Parameters

    - `height`: the legend height

  - ### getMargins

    public int[] getMargins()

    Returns the margin sizes. An array containing the margins in this order: top, left, bottom, right

    ###### Returns

    the margin sizes

  - ### setMargins

    public void setMargins(int[] margins)

    Sets the margins, in pixels.

    ###### Parameters

    - `margins`: @param margins an array containing the margin size values, in this order: top, left, bottom, right

  - ### isInScroll

    public boolean isInScroll()

    Returns if the chart is inside a scroll view and doesn't need to shrink.

    ###### Returns

    if it is inside a scroll view

  - ### setInScroll

    public void setInScroll(boolean inScroll)

    To be set if the chart is inside a scroll view and doesn't need to shrink when not enough space.

    ###### Parameters

    - `inScroll`: if it is inside a scroll view

  - ### getStartAngle

    public float getStartAngle()

    Returns the start angle for circular charts such as pie, doughnut. An angle of 0 degrees correspond to the geometric angle of 0 degrees (3 o'clock on a watch.)

    ###### Returns

    the start angle in degrees

  - ### setStartAngle

    public void setStartAngle(float startAngle)

    Sets the start angle for circular charts such as pie, doughnut, etc. An angle of 0 degrees correspond to the geometric angle of 0 degrees (3 o'clock on a watch.)

    ###### Parameters

    - `startAngle`: the start angle in degrees

  - ### isDisplayValues

    public boolean isDisplayValues()

    Returns if the values should be displayed as text.

    ###### Returns

    if the values should be displayed as text

  - ### setDisplayValues

    public void setDisplayValues(boolean display)

    Sets if the values should be displayed as text (supported by pie chart).

    ###### Parameters

    - `display`: if the values should be displayed as text