JavaScript API Reference
Overview
AnyChart Stock JavaScript Library is created to make AnyChart Stock charts embedding easier and provide a lot of interactivity options that make AnyChart Stock Component suitable for Rich Internet Applications (RIA) development
Constructor
AnyChartStock instance constructor
| Name | Description |
|---|---|
| AnyChartStock | Creates new AnyChartStock instance. |
Static properties
AnyChartStock static properties
| Name | Description |
|---|---|
| enableFirefoxPrintPreviewFix | Enables Firefox print preview fix in all charts. |
| height | Default chart height in pixels ("px" postfix, e.g. "300px") or container width percent ("%" postfix, e.g. "80%"). |
| messages | Holds the table with default auxiliary chart texts. |
| needConfig | Defines whether the access to full chart configuration object model is required. |
| platform | Stores information about end users OS, browser and Flash Player version. |
| preloaderSWFFile | Default path to Preloader.swf file for all charts on the page. |
| resizing | Default resizing settings for all charts. |
| swfFile | Default path to AnyChartStock.swf file for all charts on the page. |
| width | Default chart width in pixels ("px" postfix, e.g. "300px") or container width percent ("%" postfix, e.g. "80%"). |
Properties
AnyChartStock instance properties
| Name | Description |
|---|---|
| bgColor | Flash movie background color. |
| enableFirefoxPrintPreviewFix | Enables Firefox print preview fix. |
| enablePreloader | Turns component messages about configuration and data loading on or off. |
| flashObject | Link to a created Flash DOM object, that is used to show charts. |
| height | Chart height in pixels ("px" postfix, e.g. "300px") or container height percent ("%" postfix, e.g. "80%"). |
| jsonFile | Sets chart JSON configuration file path. |
| messages | Holds the table with auxiliary chart texts. |
| needConfig | Defines whether the access to full chart configuration object model is required. |
| objectModel | Gets chart configuration as an Object. |
| preloaderSWFFile | Path to Preloader.swf file. |
| resizing | Chart resizing settings. |
| swfFile | Path to AnyChartStock swf file. |
| target | Link to a chart container DOM object. |
| visible | Sets chart visibility. |
| width | Chart width in pixels ("px" postfix, e.g. "300px") or container width percent ("%" postfix, e.g. "80%"). |
| wMode | Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser. |
| xmlFile | Sets chart XML configuration file path. |
Methods
AnyChartStock instance methods
| Name | Description |
|---|---|
| addAnnotation | Adds new annotation to the chart. This function can be called only onChartDraw event has been fired, if you call addAnnotation prior to that - no annotation is added. |
| addEventMarker | Adds new event marker to the specified group. |
| addEventMarkerGroup | Adds new event marker group. |
| appendData | Appends data to the chart. |
| applyConfigChanges | Commits changes made to the objectModel. |
| applyEventMarkersChanges | Commits changes made to eventMarkers element of the objectModel. |
| applySettingsChanges | Commits changes made to settings element of the objectModel. |
| clearEvents | Removes all event listeners. |
| commitDataChanges | Commits data appends and data points erasure made by appendData(), removeDataRow() and removeDataRange() method calls. |
| commitEventMarkersChanges | Commits all changes made to event markers by addEventMarker(), removeEventMarker(), addEventMarkerGroup(), removeEventMarkerGroup() method calls. |
| deselectAnnotation | Deselects the annotation, that is currently selected. |
| disableInteractivity | Disables chart interactivity. |
| dispose | Removes all HTML DOM and JavaScript references to the chart. |
| enableInteractivity | Enables chart interactivity, if it is disabled by disableInteractivity() method. |
| exportAsInteractivePDF | Exports the chart as an Interactive PDF document. |
| exportAsJPG | Exports the chart as a JPG image. |
| exportAsPDF | Exports the chart as PDF document. |
| exportAsPNG | Exports the chart as PNG image |
| getAnnotationAsJSON | Returns annotation as an object. Object type is: annotation. |
| getAnnotationAsXML | Returns annotation as XML. XML is formatted as <annotation> node. |
| getAnnotationListAsJSON | Returns an array with objects of annotation type, which contains all annotations in all charts. |
| getAnnotationListAsXML | Returns an XML string with all annotations. XML of annotations is formatted as <annotation_list> node. |
| getChartById | Returns link to a chart object in the objectModel. |
| getCurrentDataGroupingInterval | Gets current data grouping information. |
| getCurrentYAxisInfo | Retrieves info about current Y axis scale maximum, minimum and interval. |
| getDataSetCSV | Gets dataset values as CSV with custom columns order and timestamp format. |
| getEventMarkerById | Returns the link to event marker object. |
| getEventMarkersGroupById | Returns the link to event marker group object. |
| getFirstDate | Gets the first date of all used by visible series data sources. |
| getFirstVisibleDate | Gets the first visible date. |
| getInteractivePDFBase64Encoded | Gets base64 encoded Interactive PDF document with embedded chart. |
| getJPGImageBase64Encoded | Gets a chart screenshot as the base64 encoded JPG image. |
| getLastDate | Gets the last date from all mapped and used by visible series data sources. |
| getLastVisibleDate | Gets the last visible date. |
| getPDFBase64Encoded | Gets a chart screenshot as a base64 encoded PDF document. |
| getPNGImageBase64Encoded | Gets a chart screenshot as a base64 encoded PNG image. |
| getSelectedAnnotationId | Returns id of the selected annotation. |
| getSeriesById | Gets series object from the object model by its id. |
| getSeriesCloseValue | Gets info about "close" field of the series. |
| getSeriesCustomValue | Gets information about custom field of the series. |
| getSeriesHighValue | Gets info about "high" field of the series. |
| getSeriesLowValue | Gets info about "low" field of the series. |
| getSeriesOpenValue | Gets info about "open" field of the series. |
| getSeriesPercentValueChange | Gets info about a percent change of "value" (or "close" field, if "value" field is not specified) series field values. |
| getSeriesValue | Gets info about "value" (or "close" field, if "value" field is not specified) series field. |
| getSeriesValueChange | Gets info about a change of "value" (or "close" field, if "value" field is not specified) series field values. |
| getTechIndicatorById | Gets the link to technical indicator object by its id. |
| getTechnicalIndicatorValue | Gets info about technical indicator value. |
| hide | Hides chart Flash movie. |
| hideEventMarker | Hides event marker. |
| hideEventMarkerGroup | Hides event markers group. |
| hideOverlayMessage | Hides chart overlay message, shown by showOverlayMessage() method. Also can hide noDataText message set in AnyChartStock.messages or in instance messages property. |
| hideWaitingState | Hides chart "waiting" state, initiated by showWaitingState() method. |
| printChart | Shows chart printing dialog. |
| removeAllAnnotations | Removes all annotations from all charts. |
| removeAnnotation | Removes an annotation from the chart. |
| removeDataRange | Removes data range from a data set by the range of dates. |
| removeDataRow | Removes data row from a data set by its date. |
| removeEventMarker | Removes event marker. |
| removeEventMarkerGroup | Removes event marker group by its id. |
| removeFlashObject | Removes AnyChart Stock Flash Object from HTML DOM. |
| resetEventMarkerSelection | Resets event marker selection in a specified chart. |
| scrollTo | Scrolls the chart to a given date. |
| selectAnnotation | Selects an annotation with the given id. |
| selectEventMarker | Selects an event marker by its id and its group id. |
| selectRange | Selects a dates range. |
| setAnnotationList | Sets new annotation list to the chart, replacing all that are on the charts at the moment. Can be called only after onChartDraw event is fired. |
| setConfig | Updates chart configuration. |
| setEventMarkers | Updates chart event markers. |
| setJSONFile | Sets chart JSON configuration file path. |
| setSettings | Updates chart visual settings. |
| setSize | Sets chart size. |
| setXMLFile | Sets chart XML configuration file path. |
| show | Shows chart movie, if it is hidden using hide() method. |
| showEventMarker | Shows event marker. |
| showEventMarkerGroup | Shows event markers group. |
| showOverlayMessage | Displays "Waiting..." or any other message over the chart. |
| showWaitingState | Displays "Waiting..." or any other message over the chart. |
| startDrawingAnnotation | Starts drawing annotation of a given type. |
| stopDrawingAnnotation | Ends drawing mode started by startDrawingAnnotation() method. |
| updateAnnotation | Updates the settings of the annotation with the given id. |
| updateEventMarker | Updates event marker visual settings. |
| updatePrintForFirefox | Updates Firefox print preview to current chart state. |
| write | Adds the chart to HTML DOM as a child of the specified container. |
| zoomTo | Zooms the chart to a custom range. |
Events
AnyChartStock instance events
| Name | Description |
|---|---|
| onAnnotationDeselect | This event is dispatched when an annotation looses focus. |
| onAnnotationDrawingFinish | This event is dispatched when an annotation drawing initiated by startDrawingAnnotation() finishes. |
| onAnnotationDrawingProgress | This event is fired repeatedly when annotation drawing started with startAnnotationDrawing() call progresses. Mouse coordinates, passed to event handler may become NaN, when the cursor leaves plot area. |
| onAnnotationDrawingStart | This event is dispatched when startDrawingAnnotation() methods is used and drawing has successfully started. |
| onAnnotationEditingFinish | This event is dispatched when a user has finished editing an annotation. |
| onAnnotationEditingProgress | This event is fired repeatedly when annotation editing progresses. |
| onAnnotationEditingStart | This event is dispatched when a user has started editing an annotation. |
| onAnnotationRemove | This event is dispatched when an annotation is removed using "Delete" key on a Windows system or "Fn + Backspace" on Mac. |
| onAnnotationSelect | This event is dispatched when an annotation is selected. |
| onChartCreate | This event is dispatched when the AnyChart Stock SWF file is loaded. |
| onChartDataLoad | This event is dispatched when AnyChart Stock CSV data is loaded. |
| onChartDraw | This event is dispatched when the AnyChart Stock is drawn. |
| onChartMouseDown | This event is dispatched when the mouse button is pressed on the chart plotting area. |
| onChartMouseMove | This event is dispatched when the mouse is moving over the chart plotting area. |
| onChartMouseOut | This event is dispatched when the mouse leaves the chart plotting area. |
| onChartMouseOver | This event is dispatched when the chart plotting area is hovered by the mouse. |
| onChartMouseUp | This event is dispatched when the mouse button is released. |
| onContextMenuCustomItemClick | This event is dispatched when the user clicks on the custom context menu item. |
| onEventMarkerClick | This event is dispatched when the user clicks an event marker. |
| onEventMarkerDeselect | This event is dispatched when an event marker is deselected. |
| onEventMarkerDoubleClick | This event is dispatched when the user double clicks an event marker. |
| onEventMarkerMouseOut | This event is dispatched when the mouse leaves an event marker. |
| onEventMarkerMouseOver | This event is dispatched when an event marker is hovered by the mouse. |
| onEventMarkerSelect | This event is dispatched when an event marker is selected. |
| onGotData | This event is dispatched when chart settings are set and data is found. |
| onMergedEventMarkerClick | This event is dispatched when the user clicks an event marker group. |
| onMergedEventMarkerDeselect | This event is dispatched when a merged event marker group is deselected. |
| onMergedEventMarkerDoubleClick | This event is dispatched when the user double clicks a merged event marker group. |
| onMergedEventMarkerMouseOut | This event is dispatched when the mouse leaves a merged event marker group. |
| onMergedEventMarkerMouseOver | This event is dispatched when the user hovers a merged event marker group. |
| onMergedEventMarkerSelect | This event is dispatched when a merged event marker group is selected. |
| onNoData | This event is dispatched when a chart settings are set and no data is found. |
| onSelectedRangeChange | This event is dispatched when the selected range of the chart is changed. |