Package io.jmix.charts.model.cursor
Class Cursor
java.lang.Object
io.jmix.charts.model.AbstractChartObject
io.jmix.charts.model.cursor.Cursor
- All Implemented Interfaces:
Serializable
Creates a cursor for the chart which follows the mouse movements. In case of
See documentation for properties of ChartCursor JS Object.
http://docs.amcharts.com/3/javascriptcharts/ChartCursor
SerialChartModelImpl
charts it shows
the balloons of hovered data points.
See documentation for properties of ChartCursor JS Object.
http://docs.amcharts.com/3/javascriptcharts/ChartCursor
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetColor()
getPan()
setAdjustment
(Integer adjustment) Sets adjustment.setAnimationDuration
(Double animationDuration) Sets duration of animation of a line, in seconds.setAvoidBalloonOverlapping
(Boolean avoidBalloonOverlapping) Specifies if cursor should arrange balloons so they won't overlap.setBalloonPointerOrientation
(String balloonPointerOrientation) Sets the balloon pointer orientation.setBulletsEnabled
(Boolean bulletsEnabled) Set bulletsEnabled to true if bullet for each graph should follow the cursor.setBulletSize
(Integer bulletSize) Sets bullet size, that following the cursor.@Max(1L) @Min(0L) Cursor
setCategoryBalloonAlpha
(Double categoryBalloonAlpha) Sets opacity of the category balloon.setCategoryBalloonColor
(Color categoryBalloonColor) Sets color of the category balloon.setCategoryBalloonDateFormat
(String categoryBalloonDateFormat) Sets category balloon date format (used only if category axis parses dates).setCategoryBalloonEnabled
(Boolean categoryBalloonEnabled) Set categoryBalloonEnabled to false if you want balloon shouldn't be enabled.setCategoryBalloonFunction
(JsFunction categoryBalloonFunction) Sets JS function that format category balloon text.setCategoryBalloonText
(String categoryBalloonText) Sets category balloon text.Sets text color.@Max(1L) @Min(0L) Cursor
setCursorAlpha
(Double cursorAlpha) Sets opacity of the cursor line.setCursorColor
(Color cursorColor) Sets color of the cursor line.setCursorPosition
(CursorPosition cursorPosition) Sets cursor position: on the beginning of the period (day, hour, etc) or in the middle (only whenCategoryAxis.parseDates
is set to true).setEnabled
(Boolean enabled) Set enabled to false if you want cursor shouldn't be enabled.setFullWidth
(Boolean fullWidth) Set to true if you want instead of a cursor line user should see a fill which width will always be equal to the width of one data item.@Max(1L) @Min(0L) Cursor
setGraphBulletAlpha
(Double graphBulletAlpha) Sets opacity of graph bullet.setGraphBulletSize
(Double graphBulletSize) Sets size of a graph's bullet (if available) at the cursor position.setLeaveAfterTouch
(Boolean leaveAfterTouch) Set leaveAfterTouch to false if cursor and balloons shouldn't remain after the user touches the chart.setLeaveCursor
(Boolean leaveCursor) Set leaveCursor to true if cursor should be left at it's last position.setLimitToGraph
(String limitToGraph) Sets an id of a graph.setOneBalloonOnly
(Boolean oneBalloonOnly) Set to oneBalloonOnly true if only one balloon at a time should be displayed.Set pan to true and the user will be able to pan the chart instead of zooming.@Max(1L) @Min(0L) Cursor
setSelectionAlpha
(Double selectionAlpha) Sets opacity of the selection.setSelectWithoutZooming
(Boolean selectWithoutZooming) Set selectWithoutZooming to true if cursor should only mark selected area but not zoom-in after user releases mouse button.setShowNextAvailable
(Boolean showNextAvailable) Set showNextAvailable to true if the graph should display balloon on next available data point if currently hovered item doesn't have value for this graph.void
setTabIndex
(Integer tabIndex) In case you set it to some number, the chart will set focus on chart cursor (works only with serial chart) when user clicks tab key.setValueBalloonsEnabled
(Boolean valueBalloonsEnabled) Set valueBalloonsEnabled to false if you want value balloons will not be enabled.@Max(1L) @Min(0L) Cursor
setValueLineAlpha
(Double valueLineAlpha) Sets opacity of value line.setValueLineAxis
(String valueLineAxis) Sets axis which should display the balloon.setValueLineBalloonEnabled
(Boolean valueLineBalloonEnabled) Set valueLineBalloonEnabled to true if value balloon next to value axes labels should be displayed.setValueLineEnabled
(Boolean valueLineEnabled) Set valueLineEnabled to true if cursor of serial chart should display horizontal (or vertical if chart is rotated) line.setValueZoomable
(Boolean valueZoomable) Set valueZoomable to true if the user should zoom-in value axes of a serial chart.setZoomable
(Boolean zoomable) Set zoomable to true if the user should zoom-in the chart.
-
Constructor Details
-
Cursor
public Cursor()
-
-
Method Details
-
getAdjustment
- Returns:
- adjustment
-
setAdjustment
Sets adjustment. If you set adjustment to -1, the balloon will be shown near previous, if you set it to 1 - near next data point. If not set the default value is 0.- Parameters:
adjustment
- adjustment- Returns:
- cursor
-
getAvoidBalloonOverlapping
- Returns:
- true if avoidBalloonOverlapping is enabled
-
setAvoidBalloonOverlapping
@StudioProperty(defaultValue="true") public Cursor setAvoidBalloonOverlapping(Boolean avoidBalloonOverlapping) Specifies if cursor should arrange balloons so they won't overlap. If chart is rotated, it might be good idea to turn this off. If not set the default value is true.- Parameters:
avoidBalloonOverlapping
- avoidBalloonOverlapping option- Returns:
- cursor
-
getBalloonPointerOrientation
- Returns:
- balloon pointer orientation
-
setBalloonPointerOrientation
@StudioProperty(defaultValue="horizontal") public Cursor setBalloonPointerOrientation(String balloonPointerOrientation) Sets the balloon pointer orientation. It defines if the balloon should be shown above the datapoint or sideways. If not set the default value is "horizontal".- Parameters:
balloonPointerOrientation
- balloon pointer orientation- Returns:
- cursor
-
getAnimationDuration
- Returns:
- duration of animation of a line, in seconds
-
setAnimationDuration
Sets duration of animation of a line, in seconds. If not set the default value is 0.3.- Parameters:
animationDuration
- duration of animation of a line, in seconds- Returns:
- cursor
-
getBulletsEnabled
- Returns:
- true if bullet for each graph follows the cursor
-
setBulletsEnabled
Set bulletsEnabled to true if bullet for each graph should follow the cursor. If not set the default value is false.- Parameters:
bulletsEnabled
- bulletsEnabled option- Returns:
- cursor
-
getBulletSize
- Returns:
- bullet size
-
setBulletSize
Sets bullet size, that following the cursor. If not set the default value is 8.- Parameters:
bulletSize
- bullet size- Returns:
- cursor
-
getCategoryBalloonAlpha
- Returns:
- opacity of the category balloon
-
setCategoryBalloonAlpha
@StudioProperty(defaultValue="1") @Max(1L) @Min(0L) public @Max(1L) @Min(0L) Cursor setCategoryBalloonAlpha(Double categoryBalloonAlpha) Sets opacity of the category balloon. If not set the default value is 1.- Parameters:
categoryBalloonAlpha
- opacity of the category balloon- Returns:
- cursor
-
getCategoryBalloonColor
- Returns:
- category balloon color
-
setCategoryBalloonColor
Sets color of the category balloon. Default color is cursorColor.- Parameters:
categoryBalloonColor
- category balloon color- Returns:
- cursor
-
getCategoryBalloonDateFormat
- Returns:
- category balloon date format
-
setCategoryBalloonDateFormat
@StudioProperty(defaultValue="MMM DD, YYYY") public Cursor setCategoryBalloonDateFormat(String categoryBalloonDateFormat) Sets category balloon date format (used only if category axis parses dates). If not set the default value is "MMM DD, YYYY".- Parameters:
categoryBalloonDateFormat
- category balloon date format string- Returns:
- cursor
-
getCategoryBalloonEnabled
- Returns:
- true if balloon is enabled
-
setCategoryBalloonEnabled
@StudioProperty(defaultValue="true") public Cursor setCategoryBalloonEnabled(Boolean categoryBalloonEnabled) Set categoryBalloonEnabled to false if you want balloon shouldn't be enabled. If not set the default value is true.- Parameters:
categoryBalloonEnabled
- categoryBalloonEnabled option- Returns:
- cursor
-
getColor
- Returns:
- text color
-
setColor
Sets text color. If not set the default value is #FFFFFF.- Parameters:
color
- text color- Returns:
- cursor
-
getCursorAlpha
- Returns:
- opacity of the cursor line
-
setCursorAlpha
@StudioProperty(defaultValue="1") @Max(1L) @Min(0L) public @Max(1L) @Min(0L) Cursor setCursorAlpha(Double cursorAlpha) Sets opacity of the cursor line. If not set the default value is 1.- Parameters:
cursorAlpha
- opacity- Returns:
- cursor
-
getCursorColor
- Returns:
- color of the cursor line
-
setCursorColor
@StudioProperty(type=OPTIONS, defaultValue="#CC0000") public Cursor setCursorColor(Color cursorColor) Sets color of the cursor line. If not set the default value is #CC0000.- Parameters:
cursorColor
- color- Returns:
- cursor
-
getCursorPosition
- Returns:
- cursor position
-
setCursorPosition
@StudioProperty(type=ENUMERATION, defaultValue="MIDDLE") public Cursor setCursorPosition(CursorPosition cursorPosition) Sets cursor position: on the beginning of the period (day, hour, etc) or in the middle (only whenCategoryAxis.parseDates
is set to true). If you want the cursor to follow mouse and not to glue to the nearest data point, set "mouse" here. Possible values are: start, middle, mouse. If not set the default value is MIDDLE.- Parameters:
cursorPosition
- cursor position- Returns:
- cursor
-
getEnabled
- Returns:
- true if cursor is enabled
-
setEnabled
Set enabled to false if you want cursor shouldn't be enabled. If not set the default value is true.- Parameters:
enabled
- enabled option- Returns:
- cursor
-
getGraphBulletSize
- Returns:
- size of a graph's bullet
-
setGraphBulletSize
Sets size of a graph's bullet (if available) at the cursor position. If you don't want the bullet to change its size, set this property to 1. If not set the default value is 1.7.- Parameters:
graphBulletSize
- graph bullet size- Returns:
- cursor
-
getOneBalloonOnly
- Returns:
- true if only one balloon at a time is displayed
-
setOneBalloonOnly
Set to oneBalloonOnly true if only one balloon at a time should be displayed. Note, this is quite CPU consuming. If not set the default value is false.- Parameters:
oneBalloonOnly
- oneBalloonOnly option- Returns:
- cursor
-
getPan
- Returns:
- true if the user can pan the chart instead of zooming
-
setPan
Set pan to true and the user will be able to pan the chart instead of zooming. If not set the default value is false.- Parameters:
pan
- pan option- Returns:
- cursor
-
getSelectionAlpha
- Returns:
- opacity of the selection
-
setSelectionAlpha
@StudioProperty(defaultValue="0.2") @Max(1L) @Min(0L) public @Max(1L) @Min(0L) Cursor setSelectionAlpha(Double selectionAlpha) Sets opacity of the selection. If not set the default value is 0.2.- Parameters:
selectionAlpha
- opacity- Returns:
- cursor
-
getSelectWithoutZooming
- Returns:
- true if cursor only marks selected area but not zoom-in after user releases mouse button
-
setSelectWithoutZooming
@StudioProperty(defaultValue="false") public Cursor setSelectWithoutZooming(Boolean selectWithoutZooming) Set selectWithoutZooming to true if cursor should only mark selected area but not zoom-in after user releases mouse button. If not set the default value is false.- Parameters:
selectWithoutZooming
- selectWithoutZooming option- Returns:
- cursor
-
getShowNextAvailable
- Returns:
- true if the graph displays balloon on next available data point if currently hovered item doesn't have value for this graph. If not set the default value is false.
-
setShowNextAvailable
Set showNextAvailable to true if the graph should display balloon on next available data point if currently hovered item doesn't have value for this graph.- Parameters:
showNextAvailable
- showNextAvailable option- Returns:
- cursor
-
getValueBalloonsEnabled
- Returns:
- true if valueBalloonsEnabled is enabled
-
setValueBalloonsEnabled
@StudioProperty(defaultValue="true") public Cursor setValueBalloonsEnabled(Boolean valueBalloonsEnabled) Set valueBalloonsEnabled to false if you want value balloons will not be enabled. In case they are not, the balloons might be displayed anyway, when the user rolls-over the column or bullet. If not set the default value is true.- Parameters:
valueBalloonsEnabled
- valueBalloonsEnabled option- Returns:
- cursor
-
getZoomable
- Returns:
- true if the user can zoom-in the chart
-
setZoomable
Set zoomable to true if the user should zoom-in the chart. If pan is set to true, zoomable is switched to false automatically. If not set the default value is true.- Parameters:
zoomable
- zoomable option- Returns:
- cursor
-
getCategoryBalloonFunction
- Returns:
- JS function that format category balloon text
-
setCategoryBalloonFunction
Sets JS function that format category balloon text. This function should return a string which will be displayed in a balloon. When categoryBalloonFunction is called, category value (or date) is passed as an argument.- Parameters:
categoryBalloonFunction
- JS function- Returns:
- cursor
-
getFullWidth
- Returns:
- true if instead of a cursor line, used fill which width will always be equal to the width of one data item
-
setFullWidth
Set to true if you want instead of a cursor line user should see a fill which width will always be equal to the width of one data item. It recommended setting cursorAlpha to 0.1 or some other small number if using this feature. If not set the default value is false.- Parameters:
fullWidth
- fullWidth option- Returns:
- cursor
-
getGraphBulletAlpha
- Returns:
- opacity of graph bullet
-
setGraphBulletAlpha
@StudioProperty @Max(1L) @Min(0L) public @Max(1L) @Min(0L) Cursor setGraphBulletAlpha(Double graphBulletAlpha) Sets opacity of graph bullet. If you make graph's bullets invisible by setting their opacity to 0 (AbstractGraph.bulletAlpha
) and will set graphBulletAlpha to 1, the bullets will only appear at the cursor's position.- Parameters:
graphBulletAlpha
- opacity of graph bullet- Returns:
- cursor
-
getValueLineAlpha
- Returns:
- opacity of value line
-
setValueLineAlpha
@StudioProperty @Max(1L) @Min(0L) public @Max(1L) @Min(0L) Cursor setValueLineAlpha(Double valueLineAlpha) Sets opacity of value line. Will use cursorAlpha value if not set.- Parameters:
valueLineAlpha
- opacity of value line.- Returns:
- cursor
-
getValueLineAxis
- Returns:
- value line axis id
-
setValueLineAxis
Sets axis which should display the balloon.- Parameters:
valueLineAxis
- value line axis id- Returns:
- cursor
-
getValueLineBalloonEnabled
- Returns:
- true if value balloon next to value axes labels is displayed
-
setValueLineBalloonEnabled
@StudioProperty(defaultValue="false") public Cursor setValueLineBalloonEnabled(Boolean valueLineBalloonEnabled) Set valueLineBalloonEnabled to true if value balloon next to value axes labels should be displayed. If not set the default value is false.- Parameters:
valueLineBalloonEnabled
- valueLineBalloonEnabled option- Returns:
- cursor
-
getValueLineEnabled
- Returns:
- true if cursor of serial chart displays horizontal (or vertical if chart is rotated) line
-
setValueLineEnabled
Set valueLineEnabled to true if cursor of serial chart should display horizontal (or vertical if chart is rotated) line. This line might help users to compare distant values of a chart. You can also enable value balloons on this line by setting valueLineBalloonEnabled to true. If not set the default value is false.- Parameters:
valueLineEnabled
- valueLineEnabled option- Returns:
- cursor
-
getCategoryBalloonText
- Returns:
- category balloon text
-
setCategoryBalloonText
@StudioProperty(defaultValue="[[category]]") public Cursor setCategoryBalloonText(String categoryBalloonText) Sets category balloon text. You can have [[category]] - [[toCategory]] tags in there and show category ranges this way. If not set the default value is "[[category]]".- Parameters:
categoryBalloonText
- category balloon text- Returns:
- cursor
-
getLeaveAfterTouch
- Returns:
- true if cursor and balloons remain after the user touches the chart
-
setLeaveAfterTouch
Set leaveAfterTouch to false if cursor and balloons shouldn't remain after the user touches the chart. If not set the default value is true.- Parameters:
leaveAfterTouch
- leaveAfterTouch option- Returns:
- cursor
-
getLeaveCursor
- Returns:
- true if the cursor remains in the last position
-
setLeaveCursor
Set leaveCursor to true if cursor should be left at it's last position. Useful for touch devices - user might want to see the balloons after he moves finger away. If not set the default value is false.- Parameters:
leaveCursor
- leaveCursor option- Returns:
- cursor
-
getLimitToGraph
- Returns:
- id of a graph
-
setLimitToGraph
Sets an id of a graph.CategoryAxis
cursor line will be limited to this graph instead of being drawn through full height of plot area. Note, this works with serial chart only. Also, cursorPosition must be set to middle.- Parameters:
limitToGraph
- id of a graph- Returns:
- cursor
-
getValueZoomable
- Returns:
- true if the user can zoom-in value axes of a serial chart
-
setValueZoomable
Set valueZoomable to true if the user should zoom-in value axes of a serial chart. If not set the default value is false.- Parameters:
valueZoomable
- valueZoomable option- Returns:
- cursor
-
getTabIndex
- Returns:
- tab index
-
setTabIndex
In case you set it to some number, the chart will set focus on chart cursor (works only with serial chart) when user clicks tab key. When a focus is set user can move cursor using cursor keys. Note, not all browsers and readers support this.- Parameters:
tabIndex
- tab index
-