Custom Attributes

Chart Tutorials  

Custom Attributes

Using custom point attributes.

🔗Populating custom attributes

Custom attributes can be associated with any data point by including the info in the point object.

There are two equivalent ways of setting attributes. An array of key-value pair arrays can be specified, or an object with properties where the property name is the key. Both ways are demonstrated below
{
  points: [
    {
      /*Array of key-value pair arrays.*/
      attributes: [["industry", "IT"], ["phone", "(630)555-1234"]],
      name: "Angie",
      y: 3
    },
    {
      /*Object with Named properties where the name is the key.*/
      attributes: {
        industry: "Automotive",
        phone: "(630)555-1235"
      },
      name: "Chris",
      y: 8
    }
  ];
}
The attributes can be utilized in virtually all strings related to the point such as labels, links, urls, tooltips, etc. They are referenced by using tokens with the same name. For example, the above data can be used in a tooltip using the following code:
{
  defaultPoint_tooltip: "<b>%name</b><br>%phone<br>Sector: %industry";
}

Label Data Attributes Sample Uses data point attributes and displays them in labels with tokens.
Dynamic Data Sample Generates a chart based on data calculations from a different chart.
Hover Side Info Sample Uses the chart to replace tokens in an HTML string template used to show details in an HTML table when hovering a point.