Class Cursor

All Implemented Interfaces:
Serializable

public class Cursor extends AbstractChartObject
Creates a cursor for the chart which follows the mouse movements. In case of 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 Details

    • Cursor

      public Cursor()
  • Method Details

    • getAdjustment

      public Integer getAdjustment()
      Returns:
      adjustment
    • setAdjustment

      @StudioProperty(defaultValue="0") public Cursor setAdjustment(Integer adjustment)
      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

      public Boolean 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

      public String 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

      public Double getAnimationDuration()
      Returns:
      duration of animation of a line, in seconds
    • setAnimationDuration

      @StudioProperty(defaultValue="0.3") public Cursor setAnimationDuration(Double animationDuration)
      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

      public Boolean getBulletsEnabled()
      Returns:
      true if bullet for each graph follows the cursor
    • setBulletsEnabled

      @StudioProperty(defaultValue="false") public Cursor setBulletsEnabled(Boolean bulletsEnabled)
      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

      public Integer getBulletSize()
      Returns:
      bullet size
    • setBulletSize

      @StudioProperty(defaultValue="8") public Cursor setBulletSize(Integer bulletSize)
      Sets bullet size, that following the cursor. If not set the default value is 8.
      Parameters:
      bulletSize - bullet size
      Returns:
      cursor
    • getCategoryBalloonAlpha

      public Double 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

      public Color getCategoryBalloonColor()
      Returns:
      category balloon color
    • setCategoryBalloonColor

      @StudioProperty(type=OPTIONS) public Cursor setCategoryBalloonColor(Color categoryBalloonColor)
      Sets color of the category balloon. Default color is cursorColor.
      Parameters:
      categoryBalloonColor - category balloon color
      Returns:
      cursor
    • getCategoryBalloonDateFormat

      public String 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

      public Boolean 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

      public Color getColor()
      Returns:
      text color
    • setColor

      @StudioProperty(type=OPTIONS, defaultValue="#FFFFFF") public Cursor setColor(Color color)
      Sets text color. If not set the default value is #FFFFFF.
      Parameters:
      color - text color
      Returns:
      cursor
    • getCursorAlpha

      public Double 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

      public Color 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

      public CursorPosition 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 when CategoryAxis.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

      public Boolean getEnabled()
      Returns:
      true if cursor is enabled
    • setEnabled

      @StudioProperty(defaultValue="true") public Cursor setEnabled(Boolean enabled)
      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

      public Double getGraphBulletSize()
      Returns:
      size of a graph's bullet
    • setGraphBulletSize

      @StudioProperty(defaultValue="1.7") public Cursor setGraphBulletSize(Double graphBulletSize)
      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

      public Boolean getOneBalloonOnly()
      Returns:
      true if only one balloon at a time is displayed
    • setOneBalloonOnly

      @StudioProperty(defaultValue="false") public Cursor setOneBalloonOnly(Boolean oneBalloonOnly)
      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

      public Boolean getPan()
      Returns:
      true if the user can pan the chart instead of zooming
    • setPan

      @StudioProperty(defaultValue="false") public Cursor setPan(Boolean pan)
      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

      public Double 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

      public Boolean 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

      public Boolean 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

      @StudioProperty public Cursor 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.
      Parameters:
      showNextAvailable - showNextAvailable option
      Returns:
      cursor
    • getValueBalloonsEnabled

      public Boolean 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

      public Boolean getZoomable()
      Returns:
      true if the user can zoom-in the chart
    • setZoomable

      @StudioProperty(defaultValue="true") public Cursor setZoomable(Boolean zoomable)
      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

      public JsFunction getCategoryBalloonFunction()
      Returns:
      JS function that format category balloon text
    • setCategoryBalloonFunction

      public Cursor setCategoryBalloonFunction(JsFunction categoryBalloonFunction)
      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

      public Boolean 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

      @StudioProperty(defaultValue="false") public Cursor 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. 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

      public Double 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

      public Double 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

      public String getValueLineAxis()
      Returns:
      value line axis id
    • setValueLineAxis

      @StudioProperty public Cursor setValueLineAxis(String valueLineAxis)
      Sets axis which should display the balloon.
      Parameters:
      valueLineAxis - value line axis id
      Returns:
      cursor
    • getValueLineBalloonEnabled

      public Boolean 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

      public Boolean getValueLineEnabled()
      Returns:
      true if cursor of serial chart displays horizontal (or vertical if chart is rotated) line
    • setValueLineEnabled

      @StudioProperty(defaultValue="false") public Cursor setValueLineEnabled(Boolean valueLineEnabled)
      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

      public String 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

      public Boolean getLeaveAfterTouch()
      Returns:
      true if cursor and balloons remain after the user touches the chart
    • setLeaveAfterTouch

      @StudioProperty(defaultValue="true") public Cursor setLeaveAfterTouch(Boolean leaveAfterTouch)
      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

      public Boolean getLeaveCursor()
      Returns:
      true if the cursor remains in the last position
    • setLeaveCursor

      @StudioProperty(defaultValue="false") public Cursor setLeaveCursor(Boolean leaveCursor)
      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

      public String getLimitToGraph()
      Returns:
      id of a graph
    • setLimitToGraph

      @StudioProperty public Cursor setLimitToGraph(String limitToGraph)
      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

      public Boolean getValueZoomable()
      Returns:
      true if the user can zoom-in value axes of a serial chart
    • setValueZoomable

      @StudioProperty(defaultValue="false") public Cursor setValueZoomable(Boolean valueZoomable)
      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

      public Integer getTabIndex()
      Returns:
      tab index
    • setTabIndex

      @StudioProperty public 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. When a focus is set user can move cursor using cursor keys. Note, not all browsers and readers support this.
      Parameters:
      tabIndex - tab index