Class AmStockChart

AmStockChart is a main class Stock chart.

Index

Properties

Methods

Properties

public animationPlayed: boolean

Specifies if animation was already played. Animation is only played once, when chart is rendered for the first time. If you want the animation to be repeated, set this property to false.

public balloon: AmBalloon

Balloon object.

public categoryAxesSettings: CategoryAxesSettings

Settings for category axes.

public chartCreated: boolean

Indicates if the chart is created.

public chartCursorSettings: ChartCursorSettings

Chart cursor settings.

public chartScrollbarSettings: ChartScrollbarSettings

Chart scrollbar settings.

public colors: Array<any>

Array of colors used by data sets if no color was set explicitly on data set itself. #FF6600, "#FCD202", "#B0DE09", "#0D8ECF", "#2A0CD0", "#CD0D74", "#CC0000", "#00CC00", "#0000CC", "#DDDDDD", "#999999", "#333333", "#990000"

public comparedDataSets: Array<any>

Array of data sets selected for comparing.

public dataSetSelector: DataSetSelector

DataSetSelector object. You can add it if you have more than one data set and want users to be able to select/compare them.

public dataSets: Array<any>

Array of DataSets.

public endDate: Date

Current end date of the selected period, get only. To set start/end dates, use stockChart.zoom(startDate, endDate) method.

public firstDayOfWeek: number

Defines on which day week starts. 0 - Sunday, 1 - Monday..

default

1

public glueToTheEnd: boolean

If set to true the scope of the data view will be set to the end after data update.

public legendSettings: LegendSettings

Legend settings.

public mainDataSet: DataSet

Data set selected as main.

public panels: Array<any>

Array of StockPanels (charts).

public panelsSettings: PanelsSettings

Settings for stock panels.

public periodSelector: PeriodSelector

Period selector object. You can add it if you want user's to be able to enter date ranges or zoom chart with predefined period buttons.

public scrollbarChart: AmSerialChart

Scrollbar's chart object, get only.

public startDate: Date

Current start date of the selected period, get only. To set start/end dates, use stockChart.zoom(startDate, endDate) method.

public stockEventsSettings: any

Settings for stock events.

public valueAxesSettings: ValueAxesSettings

Settings for value axes.

public version: string

read-only. Indicates current version of a script.

public zoomOutOnDataSetChange: boolean

Specifies whether the chart should zoom-out when main data set is changed.

Methods

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

Adds event listener of the type "dataUpdated" or "init" or "rendered" to the object.

Parameters

  • type: string

    Always "dataUpdated" or "init" or "rendered".

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

    If the type is "dataUpdated", dispatched when the chart was updated with new data. If the type is "init", dispatched when the chart is initialized for the first time. In case you want it to fire again after validateNow() method is called, set chart.chartCreated = false. If the type is "rendered", dispatched each when chart is rendered.

Returns

any

public addListener(type: string, handler: (e: { type: string; eventObject: any; graph: AmCharts.AmGraph; date: Date; chart: AmCharts.AmStockChart; }) => void): any

Adds event listener of the type "rollOutStockEvent" or "rollOverStockEvent" or "clickStockEvent" to the object.

Parameters

  • type: string

    // Either "rollOutStockEvent" or "rollOverStockEvent" or "clickStockEvent".

  • handler: (e: { type: string; eventObject: any; graph: AmCharts.AmGraph; date: Date; chart: AmCharts.AmStockChart; }) => void

    If the type is "rollOutStockEvent", dispatched when the user rolls-out of the Stock event (bullet). If the type is "rollOverStockEvent", dispatched when the user rolls-over of the Stock event (bullet). If the type is "clickStockEvent", dispatched when the user clicks on the Stock event (bullet).

Returns

any

public addListener(type: string, handler: (e: { type: string; startDate: Date; endDate: Date; period: string; chart: AmCharts.AmStockChart; }) => void): any

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

Parameters

  • type: string

    Always "zoomed".

  • handler: (e: { type: string; startDate: Date; endDate: Date; period: string; chart: AmCharts.AmStockChart; }) => void

    Dispatched when the chart is zoomed (even for the first time, when chart is initialized).

Returns

any

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

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

Parameters

  • type: string

    Always "panelRemoved".

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

    Dispatched when the StockPanel is removed.

Returns

any

public addPanel(panel: StockPanel): any

Adds panel to the stock chart. Requires stockChart.validateNow() method to be called after this action.

Parameters

Returns

any

public addPanelAt(panel: StockPanel, index: number): any

Adds panel to the stock chart at a specified index. Requires stockChart.validateNow() method to be called after this action.

Parameters

Returns

any

public clear(): any

Destroys chart, all timeouts and listeners.

Returns

any

public hideStockEvents(): any

Hides event bullets.

Returns

any

public removeListener(obj: any, type: any, handler: any): any

Removes event listener from the object.

Parameters

  • obj: any
  • type: any
  • handler: any

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 removePanel(panel: StockPanel): any

Removes panel from the stock chart. Requires stockChart.validateNow() method to be called after this action.

Parameters

Returns

any

public showStockEvents(): any

Shows event bullets.

Returns

any

public validateData(): any

Method which should be called after data was changed.

Returns

any

public validateNow(): any

Method which forces the stock chart to rebuild. Should be called after properties are changed.

Returns

any

public zoom(startDate: any, endDate: any): any

Zooms chart to specified dates. startDate, endDate - Date objects.

Parameters

  • startDate: any
  • endDate: any

Returns

any

public zoomOut(): any

Zooms out the chart.

Returns

any