F
F
Finom2013-01-23 19:13:07
JavaScript
Finom, 2013-01-23 19:13:07

How to bind custom data in Highcharts?

I have been working with Highcharts for quite a long time and every time I invent my own bike of data binding to series in order to use them somehow (for example, display them in a tooltip).

series: [{data : [{
  x: 5,
  y: 6,
  customData: 'Какие-то данные'
}]}]

But, in the end, no object (strings, numbers, etc.) passed under a non-standard key (in this case, customData) is found anywhere in the series object (neither in data nor in options)
chart.series[ 0 ].options.data[ 0 ] →
{
  x: 5,
  y: 6
}


The documentation is silent, or I am inattentive.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Pavlov, 2013-01-23
@Finom

Your custom data (snap to a point) will be in

chart.series[0].points[0].customdata

Example: jsfiddle.net/dALDR/32/
If you need to bind custom data to a series of points, then the data will be here:
chart.series[0].options.customdata.somekey

Example: jsfiddle.net/dALDR/33/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question