Class ChartCursor

ChartCursor is a class which displays a cursor which follows the mouse. In case of Serial chart it also shows value and category balloons.

example

var chart = new AmCharts.AmSerialChart(); var chartCursor = new AmCharts.ChartCursor(); chart.addChartCursor(chartCursor);

Index

Properties

Methods

Properties

public bulletSize: number

Size of bullets, following the cursor.

default

8

public bulletsEnabled: boolean

Specifies if bullet for each graph will follow the cursor.

public categoryBalloonAlpha: number

Opacity of the category balloon.

default

1

public categoryBalloonColor: string

Color of the category balloon. cursorColor is used if not set.

public categoryBalloonDateFormat: string

Category balloon date format (used only if category axis parses dates). Check this page for instructions on how to format dates. MMM DD, YYYY

public categoryBalloonEnabled: boolean

Specifies whether category balloon is enabled.

default

true

public color: string

Text color. #FFFFFF

public cursorAlpha: number

Opacity of the cursor line. 1

public cursorColor: string

Color of the cursor line. #CC0000

public cursorPosition: string

Specifies where the cursor line should be placed - on the beginning of the period (day, hour, etc) or in the middle (only when parseDates property of categoryAxis 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".

public enabled: boolean

Specifies whether cursor is enabled.

default

true

public oneBalloonOnly: boolean

If this is set to true, only one balloon at a time will be displayed. Note, this is quite CPU consuming.

public pan: boolean

If this is set to true, the user will be able to pan the chart (Serial only) instead of zooming.

public selectWithoutZooming: boolean

Specifies if cursor should only mark selected area but not zoom-in after user releases mouse button.

public selectionAlpha: number

Opacity of the selection.

public valueBalloonsEnabled: boolean

Specifies whether value balloons are enabled. In case they are not, the balloons might be displayed anyway, when the user rolls-over the column or bullet.

default

true

public zoomable: boolean

Specifies if the user can zoom-in the chart. If pan is set to true, zoomable is switched to false automatically.

default

true

public zooming: boolean

Indicates if currently user is selecting some chart area to zoom-in.

Methods

public addListener(type: string, handler: (e: { type: string; index: number; zooming: boolean; mostCloseGraph: AmCharts.AmGraph; chart: AmCharts.AmChart; }) => void): any

Adds event listener of the type "changed" to the object.

Parameters

  • type: string

    Always "changed".

  • handler: (e: { type: string; index: number; zooming: boolean; mostCloseGraph: AmCharts.AmGraph; chart: AmCharts.AmChart; }) => void

    Dispatched when cursor position is changed. "index" is a series index over which chart cursors currently is. "zooming" specifies if user is currently zooming (is selecting) the chart. mostCloseGraph property is set only when oneBalloonOnly is set to true.

Returns

any

public addListener(type: string, handler: (e: { type: string; chart: AmCharts.AmChart; }) => void): any

Adds event listener of the type "onHideCursor" to the object.

Parameters

  • type: string

    Always "onHideCursor".

  • handler: (e: { type: string; chart: AmCharts.AmChart; }) => void

    Dispatched when cursor is hidden.

Returns

any

public addListener(type: string, handler: (e: { type: string; index: number; zooming: boolean; chart: AmCharts.AmChart; }) => void): any

Adds event listener of the type "selected" or "zoomed" to the object.

Parameters

  • type: string

    "selected" or "zoomed".

  • handler: (e: { type: string; index: number; zooming: boolean; chart: AmCharts.AmChart; }) => void

    If the type is "selected". Dispatched if selectWithoutZooming is set to true and when user selects some period. start and end are indices or timestamp (when categoryAxis.parseDates is true) of selection start/end. If the type is "zoomed". Dispatched when user zooms to some period. start and end are indices or timestamp (when categoryAxis.parseDates is true) of selection start/end.

Returns

any

public hideCursor(): any

Hides cursor.

Returns

any

public removeListener(chart: AmChart, type: string, handler: any): any

Removes event listener from chart object.

Parameters

  • chart: AmChart
  • type: string
  • handler: any

Returns

any

public showCursorAt(category: any): any

You can force cursor to appear at specified cateogry or date.

Parameters

  • category: any

Returns

any