Chart

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


Example :
    chart.get(“zoomEnabled”);
    chart.set(“zoomEnabled”, true, true)//re-renders chart after setting the value
    chart.set(“zoomEnabled”, true, false)//chart will not render after setting the value. You need to call chart.render() if updateChart is set to false

Methods in Chart

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

Read-Only Properties:

Can be accessed via get method or dot notation.


Property Description Example
bounds Bounding rectangle of Chart: {x1, x2, y1, y2} chart.bounds / chart.get(“bounds”)
container DOM-Element chart.container / chart.get(“container”)
selectedColorSet Colors in the Selected Colorset chart.selectedColorSet / chart.get(“selectedColorSet”)
title Title of chart chart.title / chart.get(“title”)
subtitles Array of Subtitles of chart chart.subtitles / chart.get(“subtitles”)
toolTip ToolTip of dataPoints chart.toolTip / chart.get(“toolTip”)
legend Legend of dataSeries chart.legend / chart.get(“legend”)
data Array of dataSeries chart.data / chart.get(“data”)
axisX X-axis of chart chart.axisX / chart.get(“axisX”)
axisX2 Secondary X-axis of chart chart.axisX2 / chart.get(“axisX2”)
axisY Y-axis of chart chart.axisY / chart.get(“axisY”)
axisY2 Secondary Y-axis of chart chart.axisY2 / chart.get(“axisY2”)

Writable Properties in Chart:

All Chart options become available as properties after Chart Render. 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.


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