Class CategoryAxis

All Implemented Interfaces:
Serializable

public class CategoryAxis extends AbstractAxis<CategoryAxis>
Defines category axis in chart.
See documentation for properties of CategoryAxis JS Object.
http://docs.amcharts.com/3/javascriptcharts/CategoryAxis
See Also:
  • Constructor Details

    • CategoryAxis

      public CategoryAxis()
  • Method Details

    • getAutoWrap

      public Boolean getAutoWrap()
      Returns:
      true if axis labels (only when it is horizontal) are wrapped
    • setAutoWrap

      @StudioProperty(defaultValue="false") public CategoryAxis setAutoWrap(Boolean autoWrap)
      Set autoWrap to true if axis labels (only when it is horizontal) should be wrapped if they don't fit in the allocated space. If axis is vertical, you should set axis.ignoreAxisWidth to true in order this feature to work. If not set the default value is false.
      Parameters:
      autoWrap - autoWrap option
      Returns:
      category axis
    • getEqualSpacing

      public Boolean getEqualSpacing()
      Returns:
      true if data points is placed at equal intervals
    • setEqualSpacing

      @StudioProperty(defaultValue="false") public CategoryAxis setEqualSpacing(Boolean equalSpacing)
      Set equalSpacing to true if want dates to be parsed (displayed on the axis, balloons, etc), but data points to be placed at equal intervals (omitting dates with no data). In case your category axis values are Date objects and parseDates is set to true. If not set the default value is false.
      Parameters:
      equalSpacing - equalSpacing option
      Returns:
      category axis
    • getForceShowField

      public String getForceShowField()
      Returns:
      force show field name
    • setForceShowField

      @StudioProperty public CategoryAxis setForceShowField(String forceShowField)
      Sets force show field name from data provider which specifies if the category value should always be shown. For example: forceShowField = "forceShow" and data contains true or false. Note, this works only when parseDates is set to false.
      Parameters:
      forceShowField - force show field string
      Returns:
      category axis
    • getGridPosition

      public GridPosition getGridPosition()
      Returns:
      grid position
    • setGridPosition

      @StudioProperty(type=ENUMERATION, defaultValue="MIDDLE") public CategoryAxis setGridPosition(GridPosition gridPosition)
      Sets grid position: grid line is placed on the center of a cell or on the beginning of a cell. Possible values are: "start" and "middle" This setting doesn't work if parseDates is set to true. If not set the default value is MIDDLE.
      Parameters:
      gridPosition - grid position
      Returns:
      category axis
    • getMinPeriod

      public DatePeriod getMinPeriod()
      Returns:
      the shortest period of your data
    • setMinPeriod

      @StudioProperty(type=ENUMERATION, defaultValue="DAYS") public CategoryAxis setMinPeriod(DatePeriod minPeriod)
      Sets the shortest period of your data. This should be set only if parseDates is set to true. If not set the default value is "DD".
      Parameters:
      minPeriod - the shortest period of your data
      Returns:
      category axis
    • getParseDates

      public Boolean getParseDates()
      Returns:
      true if parseDates is enabled
    • setParseDates

      @StudioProperty(defaultValue="false") public CategoryAxis setParseDates(Boolean parseDates)
      Set parseDates to true if your category axis values are date-based. In this case the chart will parse dates and will place your data points at irregular intervals. If you want dates to be parsed, but data points to be placed at equal intervals, set both parseDates and equalSpacing to true.

      Note, if you are specifying dates as strings in your data, i.e. "2015-01-05", we strongly recommend setting dataDateFormat as well.

      Important, if parseDates is set to true, the data points need to come pre-ordered in ascending order. Data with incorrect order might result in visual and functional glitches on the chart.

      If not set the default value is false.

      Parameters:
      parseDates - parseDates option
      Returns:
      category axis
    • getStartOnAxis

      public Boolean getStartOnAxis()
      Returns:
      true if the graph starts on axis
    • setStartOnAxis

      @StudioProperty public CategoryAxis setStartOnAxis(Boolean startOnAxis)
      Set startOnAxis to true if the graph should start on axis. In case you display columns, it is recommended to set startOnAxis to false. If parseDates is set to true, startOnAxis will always be false, unless equalSpacing is set to true.
      Parameters:
      startOnAxis - startOnAxis option
      Returns:
      category axis
    • getCategoryFunction

      public JsFunction getCategoryFunction()
      Returns:
      JS function that is used as categoryValue for current item
    • setCategoryFunction

      public CategoryAxis setCategoryFunction(JsFunction categoryFunction)
      Sets JS function that returns the value that should be used as categoryValue for current item. If categoryFunction is set, the return value of the custom data function takes precedence over categoryField. When a chart calls this method, it passes category value, data item from chart's data provider and reference to categoryAxis: categoryFunction(category, dataItem, categoryAxis); This method can be used both when category axis parses dates and when it doesn't. If axis parses dates, your categoryFunction should return Date object.
      Parameters:
      categoryFunction - JS function
      Returns:
      category axis
    • getLabelColorField

      public String getLabelColorField()
      Returns:
      label color field
    • setLabelColorField

      @StudioProperty(type=PROPERTY_PATH_REF) public CategoryAxis setLabelColorField(String labelColorField)
      Sets label color field. Works only with non-date-based data.
      Parameters:
      labelColorField - label color field string
      Returns:
      category axis
    • getTickPosition

      public String getTickPosition()
      Returns:
      position of an axis tick
    • setTickPosition

      @StudioProperty(type=OPTIONS, options={"middle","start"}, defaultValue="middle") public CategoryAxis setTickPosition(String tickPosition)
      Sets position of an axis tick. Available settings: "middle", "start". Works only with non-date-based data. If not set the default value is false. If not set the default value is "middle".
      Parameters:
      tickPosition - tick position string
      Returns:
      category axis
    • getTwoLineMode

      public Boolean getTwoLineMode()
      Returns:
      true category axis displays date strings of bot small and big period, in two rows
    • setTwoLineMode

      @StudioProperty(defaultValue="false") public void setTwoLineMode(Boolean twoLineMode)
      Set twoLineMode to true, category axis will display date strings of bot small and big period, in two rows, at the position where bigger period changes. Works only when parseDates is set to true and equalSpacing is false. If not set the default value is false.
      Parameters:
      twoLineMode - twoLineMode option
    • getLabelFunction

      public JsFunction getLabelFunction()
      Returns:
      JS function to format category axis labels
    • setLabelFunction

      public CategoryAxis setLabelFunction(JsFunction labelFunction)
      Sets JS function to format category axis labels. If this function is set, then it is called with the following parameters passed: if dates are not parsed - labelFunction(valueText, serialDataItem, categoryAxis), if dates are parsed - labelFunction(valueText, date, categoryAxis). Js function should return string which will be displayed on the axis.
      Parameters:
      labelFunction - Js function
      Returns:
      category axis
    • getWidthField

      public String getWidthField()
      Returns:
      width field name
    • setWidthField

      @StudioProperty(type=PROPERTY_PATH_REF) public CategoryAxis setWidthField(String widthField)
      Sets relative width for your columns using this field name from data provider.
      Parameters:
      widthField - width field name
      Returns:
      category axis
    • getClassNameField

      public String getClassNameField()
      Returns:
      class name field
    • setClassNameField

      @StudioProperty(type=PROPERTY_PATH_REF) public CategoryAxis setClassNameField(String classNameField)
      Sets CSS class name field. If classNameField is set and AbstractChart.addClassNames is enabled, the category axis labels, ticks and grid will have this class name set. Note, this will not work if the axis is date-based.
      Parameters:
      classNameField - class name field string
      Returns:
      category axis