Skip to main content
Skip table of contents

addDataPoint

A child command of addSeries that adds a data point to the series created by the parent command.  The order of the data points in the series is the order in which they are added with this command.

Parent commands

  • addSeries
    Required. Defines the series into which the created data point is added to.

Attributes

value

Required

Value type

EL-evaluated

No

Number

Yes

Defines the numerical value of the data point. 

label

Required

Value type

EL-evaluated

No

String

Yes

This attribute can be used to a create default category label for data points at the created data point's index. If the related setChartData command doesn't have any defineAxis command defining an X-axis, the category labels defined through this attribute can be used to automatically construct a category axis with these labels.

This label-setting function only works when this command creates a data point for the first series of the chart.   

color

Required

Value type

EL-evaluated

No

String

Yes

Defines a color for the data point. The data point on the chart will be displayed in this color, unless the chart's type has all data of a series displayed in a single color. The resolved value is expected to specify a color in hexadecimal, RGB, or HSL notation.

If not defined, the command rendering the chart will select the color to display this data point in.

Examples

The addDataPoint command works well with the forEach loop command. Loop through a Collection and generate data points based on its contents. The following would create a series with its data points created out of a Salesforce query result, with each data point having the Amount field value of an Opportunity record as its value. Additionally, if this is the first series, the Chart Data is given a set of default category labels out of the Opportunities' names.  

CODE
<addSeries label="Opportunity Amounts">
  <forEach value="${opportunities}" var="opp">
    <addDataPoint value="${opp.Amount}" label="${opp.Name}">  
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.