EGraph.getElementCount()

Returns the number of GraphElement objects currently on the chart.

Returns

Integer

Number of element objects

Chart Component Script
dataset = [["State","Total 1","Total 2"], ["NJ",200,500], ["NY",300,400]]; (1)
graph = new EGraph();
graph.addElement(new LineElement("State","Total 1")); (2)
graph.addElement(new LineElement("State","Total 2")); (2)
var elemCount = graph.getElementCount(); (3)
for (var i=0; i<elemCount; i++) {
  graph.getElement(i).endArrow = true;
}
1 See dataset to use a data block instead of an array literal.
2 Add elements to Chart.
3 Use getElementCount() to return the number of elements.

EGraphgetElementCount

Script that modifies the graph or dataset properties should be placed on the Chart component itself. See Add Component Script for more information. This script has access to the Chart data and Chart API methods. Scripted Charts are not good candidates for user-modification, so you should deselect ‘Enable Ad Hoc Editing’ in the Chart Properties dialog box.

To change the property on a Chart that was previously created with the Chart Editor, you do not need to add a Chart element. For example:

var elemCount = graph.getElementCount();
alert(elemCount)
for (var i=0; i<elemCount; i++) {
  graph.getElement(i).endArrow = true;
}