Calling any of Hit-Test methods produces a HitTestInfo object as a result. The HitTestInfo object has metadata property. It contains the point metadata from associated data series, which is useful for displaying any additional information for the data point.
Let's create a column chart with metadata for Forbes world's billionaires.
First we will create ForbesMetadata class by implementing IPointMetadata interface.
Next we create an array with the Forbes data.
This is the bit where we use this data to fill XyDataSeries.
Filling XyDataSeries |
Copy Code
|
---|---|
const dataSeries = new XyDataSeries(wasmContext);
forbesData.forEach((data, i) => dataSeries.append(i + 1, data[0], data[1]));
|
This is the full example of metadata usage for a line chart.
This is the resulting column chart.
If we click on the column we get metadata displayed at the bottom of the chart. In the browser console you will find output with the metadata property which contains Name, Age, Country and isSelected fields. The isSelected is a common property, which is used to select/deselect data points.