Class Chart

    • Field Detail

      • COLOR1

        public static final int COLOR1
        Sample gray color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR2

        public static final int COLOR2
        Sample blue color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR3

        public static final int COLOR3
        Sample orange color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR4

        public static final int COLOR4
        Sample green color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR5

        public static final int COLOR5
        Sample pink color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR6

        public static final int COLOR6
        Sample brown color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR7

        public static final int COLOR7
        Sample purple color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR8

        public static final int COLOR8
        Sample yellow color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • COLOR9

        public static final int COLOR9
        Sample red color to be used in the chart, taken from here.
        See Also:
        Constant Field Values
      • GRADIENT_HORIZONTAL

        public static final int GRADIENT_HORIZONTAL
        Indicates a horizontal gradient.
        See Also:
        type, Constant Field Values
      • GRADIENT_VERTICAL

        public static final int GRADIENT_VERTICAL
        Indicates a vertical gradient.
        See Also:
        type, Constant Field Values
      • GRADIENT_DARK

        public static final int GRADIENT_DARK
        Indicates a dark gradient. The default is a bright gradient.
        See Also:
        type, Constant Field Values
      • GRADIENT_INVERT

        public static final int GRADIENT_INVERT
        Indicates to invert the gradient direction.
        See Also:
        type, Constant Field Values
      • title

        protected java.lang.String title
        This chart's title
      • series

        public Vector series
        The series that are currently added to this chart
      • xAxisMinValue

        public double xAxisMinValue
        The value for the origin of the X axis
      • xAxisMaxValue

        public double xAxisMaxValue
        The value for the end of the X axis
      • xAxisSteps

        public int xAxisSteps
        The number of subdivisions of the X axis
      • xAxisCategories

        protected java.lang.String[] xAxisCategories
        The categories of the X axis (may be null if X is a value axis)
      • yAxisMinValue

        protected double yAxisMinValue
        The value for the origin of the Y axis
      • yAxisMaxValue

        protected double yAxisMaxValue
        The value for the end of the Y axis
      • yAxisSteps

        protected int yAxisSteps
        The number of subdivisions of the Y axis
      • xAxisX1

        public int xAxisX1
        The relative screen position of the X axis origin
      • xAxisX2

        public int xAxisX2
        The relative screen position of the X axis end
      • yAxisY1

        public int yAxisY1
        The relative screen position of the Y axis origin
      • yAxisY2

        public int yAxisY2
        The relative screen position of the Y axis end
      • border

        public Insets border
        This chart's empty border dimensions
      • showTitle

        public boolean showTitle
        Flag to indicate whether the title must be painted
      • showLegend

        public boolean showLegend
        Flag to indicate whether the legend must be painted
      • showCategories

        public boolean showCategories
        Flag to indicate whether the categories must be painted
      • showCategoriesOnTick

        public boolean showCategoriesOnTick
        Flag to indicate whether the categories must be painted on the next tick.
        The field showCategories must also be set to true.

        Special values for categories on tick:
        • "|" - Paints a line using the axis fore color.
        • ":" - Paints a dotted line using the axis fore and back colors.
        See Also:
        showCategories
      • categoryMarkIndex

        public int categoryMarkIndex
        The index where the category mark is shown.
      • categoryMarkColor

        public int categoryMarkColor
        The color for the category mark.
      • showYValues

        public boolean showYValues
        Flag to indicate whether the y values must be painted
      • showVGrids

        public boolean showVGrids
        Flag to indicate whether the X grids must be painted
      • showHGrids

        public boolean showHGrids
        Flag to indicate whether the Y grids must be painted
      • xDecimalPlaces

        public int xDecimalPlaces
        The number of decimal places to show the data of the X axis. Defaults to 3.
      • yDecimalPlaces

        public int yDecimalPlaces
        The number of decimal places to show the data of the Y axis. Defaults to 3.
      • legendPosition

        public int legendPosition
        The position of the legend. Can be one of: RIGHT (default), LEFT, TOP, BOTTOM.
      • legendPerspective

        public int legendPerspective
        Perspective distance for the Legend.
      • drawAxis

        protected boolean drawAxis
        Flag that indicates if the axis must be drawn. Defaults to true.
      • showFirstYValue

        public boolean showFirstYValue
        Shows the first y value or not.
      • axisForeColor

        public int axisForeColor
        Color used in the axis lines.
      • axisBackColor

        public int axisBackColor
        Color used in the axis lines.
      • axisText

        public int axisText
        Color used in the axis text (x,y values).
      • legendValues

        protected java.lang.String[] legendValues
        Values that may be shown with the legend.
      • clientRect

        protected Rect clientRect
      • snapToBottom

        public boolean snapToBottom
        Set to true to let a ChartData be snapped at the bottom.
      • snapToTop

        public boolean snapToTop
        Set to true to let a ChartData be snapped at the top.
      • yValuesSize

        public int yValuesSize
        Defines a value that will be used as the y-value width.
        Since:
        TotalCross 2.0
      • legendTextColor

        public int legendTextColor
        The text color for the legend.
      • fillColor2

        public int fillColor2
      • use2ndColorEveryXColumns

        public int use2ndColorEveryXColumns
      • onlyShowCategories

        public boolean onlyShowCategories
      • columnW

        public int columnW
    • Constructor Detail

      • Chart

        public Chart()
    • Method Detail

      • setTitle

        public void setTitle​(java.lang.String title)
        Sets this chart's title
        Parameters:
        title - the new title
      • getTitle

        public java.lang.String getTitle()
        Returns:
        this chart's title
      • setXAxis

        public void setXAxis​(double min,
                             double max,
                             int steps)
        Sets the X axis as a value axis given the minimum (its origin) and the maximum values to be used
        Parameters:
        min - the minimum value (the axis origin)
        max - the maximum value (the axis end)
        steps - the number of subdivisions of the axis
      • setXAxis

        public void setXAxis​(java.lang.String[] categories)
        Sets the X axis as a category axis
        Parameters:
        categories - the categories' names
      • setYAxis

        public void setYAxis​(double min,
                             double max,
                             int steps)
        Sets the Y axis given the minimum (its origin) and the maximum values to be used
        Parameters:
        min - the minimum value (the axis origin)
        max - the maximum value (the axis end)
        steps - the number of subdivisions of the axis
      • getCustomInsets

        protected void getCustomInsets​(Insets r)
      • draw

        protected boolean draw​(Graphics g)
        Draws the chart's basic features.
        Parameters:
        g - The graphics object.
      • drawTextBox

        protected void drawTextBox​(Graphics g,
                                   int refX,
                                   int refY,
                                   java.lang.String text)
        Draws a box to display a text in the chart area
        Parameters:
        text - the text to be displayed
        refX - the X position of the anchor point
        refY - the Y position of the anchor point
      • getXValuePos

        public int getXValuePos​(double value)
        Calculates the screen position of a value in the X axis according to its current minimum and maximum values. This method assumes that the X axis has the same dimensions that it assumed on the last call to draw
        Parameters:
        value - the value
        Returns:
        the screen position of the value
        See Also:
        draw(Graphics)
      • getYValuePos

        public int getYValuePos​(double value)
        Calculates the screen position of a value in the Y axis according to its current minimum and maximum values. This method assumes that the Y axis has the same dimensions that it assumed on the last call to draw
        Parameters:
        value - the value
        Returns:
        the screen position of the value
        See Also:
        draw(Graphics)