Package io.jmix.charts.model.axis
Class CategoryAxis
- All Implemented Interfaces:
Serializable
Defines category axis in chart.
See documentation for properties of CategoryAxis JS Object.
http://docs.amcharts.com/3/javascriptcharts/CategoryAxis
See documentation for properties of CategoryAxis JS Object.
http://docs.amcharts.com/3/javascriptcharts/CategoryAxis
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionsetAutoWrap
(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.setCategoryFunction
(JsFunction categoryFunction) Sets JS function that returns the value that should be used as categoryValue for current item.setClassNameField
(String classNameField) Sets CSS class name field.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).setForceShowField
(String forceShowField) Sets force show field name from data provider which specifies if the category value should always be shown.setGridPosition
(GridPosition gridPosition) Sets grid position: grid line is placed on the center of a cell or on the beginning of a cell.setLabelColorField
(String labelColorField) Sets label color field.setLabelFunction
(JsFunction labelFunction) Sets JS function to format category axis labels.setMinPeriod
(DatePeriod minPeriod) Sets the shortest period of your data.setParseDates
(Boolean parseDates) Set parseDates to true if your category axis values are date-based.setStartOnAxis
(Boolean startOnAxis) Set startOnAxis to true if the graph should start on axis.setTickPosition
(String tickPosition) Sets position of an axis tick.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.setWidthField
(String widthField) Sets relative width for your columns using this field name from data provider.Methods inherited from class io.jmix.charts.model.axis.AbstractAxis
addDateFormats, addGuides, getAutoGridCount, getAutoRotateAngle, getAutoRotateCount, getAxisAlpha, getAxisColor, getAxisThickness, getBalloon, getBoldLabels, getBoldPeriodBeginning, getCenterLabelOnFullPeriod, getCenterLabels, getCenterRotatedLabels, getColor, getDashLength, getDateFormats, getFillAlpha, getFillColor, getFirstDayOfWeek, getFontSize, getGridAlpha, getGridColor, getGridCount, getGridThickness, getGuides, getIgnoreAxisWidth, getInside, getLabelFrequency, getLabelOffset, getLabelRotation, getLabelsEnabled, getMarkPeriodChange, getMinHorizontalGap, getMinorGridAlpha, getMinorGridEnabled, getMinorTickLength, getMinVerticalGap, getOffset, getPosition, getShowFirstLabel, getShowLastLabel, getTickLength, getTitle, getTitleBold, getTitleColor, getTitleFontSize, getTitleRotation, setAutoGridCount, setAutoRotateAngle, setAutoRotateCount, setAxisAlpha, setAxisColor, setAxisThickness, setBalloon, setBoldLabels, setBoldPeriodBeginning, setCenterLabelOnFullPeriod, setCenterLabels, setCenterRotatedLabels, setColor, setDashLength, setDateFormats, setFillAlpha, setFillColor, setFirstDayOfWeek, setFontSize, setGridAlpha, setGridColor, setGridCount, setGridThickness, setGuides, setIgnoreAxisWidth, setInside, setLabelFrequency, setLabelOffset, setLabelRotation, setLabelsEnabled, setMarkPeriodChange, setMinHorizontalGap, setMinorGridAlpha, setMinorGridEnabled, setMinorTickLength, setMinVerticalGap, setOffset, setPosition, setShowFirstLabel, setShowLastLabel, setTickLength, setTitle, setTitleBold, setTitleColor, setTitleFontSize, setTitleRotation
-
Constructor Details
-
CategoryAxis
public CategoryAxis()
-
-
Method Details
-
getAutoWrap
- Returns:
- true if axis labels (only when it is horizontal) are wrapped
-
setAutoWrap
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
- Returns:
- true if data points is placed at equal intervals
-
setEqualSpacing
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
- Returns:
- force show field name
-
setForceShowField
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
- 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
- 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
- Returns:
- true if parseDates is enabled
-
setParseDates
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
- Returns:
- true if the graph starts on axis
-
setStartOnAxis
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
- Returns:
- JS function that is used as categoryValue for current item
-
setCategoryFunction
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
- 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
- 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
- Returns:
- true category axis displays date strings of bot small and big period, in two rows
-
setTwoLineMode
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
- Returns:
- JS function to format category axis labels
-
setLabelFunction
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
- Returns:
- width field name
-
setWidthField
Sets relative width for your columns using this field name from data provider.- Parameters:
widthField
- width field name- Returns:
- category axis
-
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 andAbstractChart.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
-