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

Examples :
    stockChart.charts[0].set(“culture”, “es”);

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

Methods in Chart

Method Description Example
get(String propertyName) Returns the specified property of chart stockChart.charts[0].get(“backgroundColor”)
set(String propertyName, Mixed value [,Boolean updateChart = true]) Sets the specified property of chart and optionally updates (default) the chart. stockChart.charts[0].set(“backgroundColor”, “#dedede”)
addTo(String arrayName, Object options [, Number index=array.length [, Boolean updateChart = true]]) Adds a new element of given type to the specified array. stockChart.charts[0].addTo(“axisX”, {title: “Axis X Title”})
render() Renders the chart stockChart.charts[0].render()
exportChart(Object options) Exports the respective chart as image. stockChart.charts[0].exportChart()
print() Prints the chart stockChart.print()

Read-Only Properties in Chart

Can be accessed via get method or dot notation.

Property Description Example
bounds Bounding rectangle of chart: {x1, y1, x2, y2} stockChart.charts[0].get(“bounds”) / stockChart.charts[0].bounds
container DOM-Element stockChart.charts[0].container / stockChart.charts[0].get(“container”)

Writable Properties in Chart:

All chart options become available as properties only after Stock Chart 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 chart options for complete list of properties available.

Try it Yourself by Editing the Code below.

  Also See:    

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