How to use this sample?
Use controls to the right of the chart to change scale modes and configure them.
How it works
AnyChart Stock offers you the very flexible Value (Y Axis), you can read about it in Y-Axes Settings article, this sample is totally about Scale Modes and ability change them on the fly using using Object Model modifications.
There are three scale modes available, in this sample you can change them using combo box:
||Display changes in values.
|| Display changes in percents.
Values mode has no additional settings, but both Changes modes have them, and these settings are available when you choose this modes in combo box. Let's see in detail what exactly is changed when you change scale mode using this combo control: main function source code, that does the changes is updateMode.
First of all link to the chart object is obtained using getChartById function, then using object model we create links to axis, legend and axis marker objects (the last one is used only in Changes modes and it is not necessary).
In axis object we have to change the scale mode itself and axis labels format, which should be different for every mode, and in legend object we have to change format too - if we display different things on the chart, legend should reflect this as well. Take a look at the illustration below to notice the changes:
Modifications in Changes Modes
When you choose one of the changes modes you can also choose the date from which the changes are calculated: this date can be either static (Series Start or Custom Date) or dynamic (First Visible). Note, that calendar control is a custom element created with a help of jQuery library and that we add axis marker with the label to the chart to mark the custom base date (if Custom Date is used and configured).
||Defines whether the access to full chart configuration object model is required.
||Commits changes made to settings element of the objectModel.
||Returns link to a chart object in the objectModel.
||Sets chart XML configuration file path.
||Adds the chart to HTML DOM as a child of the specified container.
||This event is dispatched when the AnyChart Stock is drawn.
This section lists all configuration, data and auxiliary files required for this sample.
- AnyChartStock.swf - AnyChart Stock component.
- Preloader.swf - AnyChart Stock helper component that loads the main component (AnyChartStock.swf) and displays loading progress.