StockChart

This section is regarding Methods and Properties available in the StockChart element.


Examples:
    stockChart.get(“backgroundColor”);
    stockChart.set(“backgroundColor”, “red”, true); //re-renders stockchart after setting the value
    stockChart.set(“backgroundColor”, “red”, false); //stockchart will not be re-rendered after setting the value. You need to call stockChart.render() to update the stockchart.


Note:
  • You can refer to StockChart Element for complete list of properties available.
  • StockChart should be rendered before you can access stockChart & its methods / properties.

Methods in StockChart

Method Description Example
get(String propertyName) Returns the specified property of StockChart stockChart.get(“backgroundColor”)
set(String propertyName, Mixed value [,Boolean updateChart = true]) Sets the specified property of StockChart & optionally updates (default) the StockChart. stockChart.set(“backgroundColor”, “red”)
addTo(String arrayName, Object options [, Number index = array.length]) Adds a new element of given type to the specified array. stockChart.addTo(“charts”, {data: []})
render() Renders the StockChart stockChart.render()
exportChart(Object options) Exports the StockChart as image stockChart.exportChart()
print() Prints the StockChart stockChart.print()

Read-Only StockChart Properties:

Can be accessed via get method or dot notation.


Property Description Example
bounds Bounding rectangle of Chart: {x1, x2, y1, y2} stockChart.bounds / stockChart.get(“bounds”)
container DOM-Element stockChart.container / stockChart.get(“container”
selectedColorSet Colors in the Selected Colorset stockChart.selectedColorSet / stockChart.get(“selectedColorSet”)
title Title of StockChart stockChart.title / stockChart.get(“title”)
subtitles Array of Subtitles of StockChart stockChart.subtitles / stockChart.get(“subtitles”)
charts Array of Charts of StockChart stockChart.charts/ stockChart.get(“charts”)
navigator Navigator of StockChart stockChart.navigator/ stockChart.get(“navigator”)
rangeSelector Range-Selector of StockChart stockChart.rangeSelector/ stockChart.get(“rangeSelector”)

Writable Properties in StockChart:

All StockChart options become available as properties after StockChart is rendered. You can access them either via get method or dot notation. But you can change / set those values only via set method.

Please refer to StockChart Element for complete list of properties available.


Try it Yourself by Editing the Code below.




If you have any questions, please feel free to ask in our forums.Ask Question