score:64

*Accepted answer*

This worked for me using v2.2:

```
this.series.data.indexOf( this.point )
```

score:0

This is about as hacky as it comes, and will get slow as hell with alot of points, but it'll work. The general idea is to look through all the points in the series' data until you find the one matching the current point:

```
tooltip: {
formatter: function() {
for(var i=0;i<this.series.data.length;i++){
var item = this.series.data[i];
if(item.x == this.x && item.y == this.y)
return 'point ' + i;
}
return 'not found'
}
}
```

Live example: http://jsfiddle.net/Fuv4h/

score:0

If you have access to your point then you can simple access,
`this.point.index`

or simply `this.index`

if `this`

refers to the point it self
to get access to its index,

In my case I always use this because its simpler then @Edgar solution, which is also great.

score:1

Sounds like you only need the xAxis value (i.e. time). Use:
`this.xData.indexOf(point.x)`

this.points will be grouped in larger series so would need a deeper search through points[0]...points[n].

score:1

This is all that worked for me on Highstock JS v4.2.4:

```
var index = this.points[0].point.dataGroup.start;
```

score:2

Since the data is sorted you can use a binary search.

A binary search should perform well even for large number of points (from the wikipedia article: "For example, to search a list of one million items takes as many as one million iterations with linear search, but **never more than twenty iterations with binary search**."

Example:

```
var bsComparator = function(a, b) {
if (a.x < b.x) { return -1; }
if (a.x > b.x) { return 1; }
return 0;
};
var binarySearch = function(series_data, point) {
var low = 0, high = series_data.length - 1,
i, comparison;
while (low <= high) {
i = Math.floor((low + high) / 2);
comparison = bsComparator(series_data[i], point);
if (comparison < 0) { low = i + 1; continue; }
if (comparison > 0) { high = i - 1; continue; }
return i;
}
return null;
};
tooltip: {
formatter: function() {
var pointIndex = binarySearch(this.series.data, this.point);
return "Point index: " + pointIndex;
}
}
```

(the binarySearch function above is inspired by http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/)

score:6

For the record your can do it directly in a nice way

It is store in:

```
this.points[0].point.x
```

score:13

One way is to pre-process the data to contain a property with the index. In the Snow-depth example you could do a preparation like this:

```
function prepare(dataArray) {
return dataArray.map(function (item, index) {
return {x: item[0], y: item[1], myIndex: index};
});
};
```

to convert the array of `[x, y]`

to be an object like `{ x: x, y: y, myIndex: i}`

. Then its easy to pick up that index in the formatter with:

```
formatter: function() {
return 'point ' + this.point.myIndex;
}
```

Example on jsfiddle

Source: stackoverflow.com

#### Related Query

- how to get index of a point in Highcharts to use in an event?
- How to get index of a point in Highcharts?
- How to get Highcharts X-Axis Categories starting at the left most point
- How do I get the value of a highcharts graph point on mouseover?
- how to get chart object inside a point event function in Highcharts
- Highcharts How to get decimal point values on y-axis with big numbers
- How to get next point in Highcharts tooltip
- How to get the highlighted point from shared tooltip formatter, Highcharts
- Highcharts Boxplots How to get five point summary?
- Highcharts Bubble Chart - How to get the size of the point
- Highcharts - How can I get the nearest point on click event
- how can I get the index of point hovering in Highcharts?
- How to get index of clicked point in scatter plot
- How to get highcharts dates in the x axis?
- How can I get access to a Highcharts chart through a DOM-Container?
- Hiding _groups_ of series in Highcharts and jQuery: how to get acceptable performance?
- How do I dynamically change a data point in Highcharts using JavaScript
- how do I get two highcharts on one page?
- How to get rangeSelector to work with HighCharts
- How to get series's id in Highcharts / Highstock
- How to get an image watermark in HighCharts charts?
- Highcharts - How to remove connecting line between fixed tooltip and point
- How to get multiple data series into Highcharts
- Highcharts - How to get a value of a stack in a series?
- How do I set highcharts line graph point colors to an array of colors?
- how to get svg of highcharts using div id?
- How get data name in Highcharts pie chart legend instead of "Slice" using array of values?
- Get name of clicked point in Highcharts when the point has drilldown
- Highcharts - How do I get dashed lines in legend
- How to get the Div id of charts in highcharts on click of it in angular 6

#### More Query from same tag

- Plotting the below json in a HighChart
- Highchart solid gauge: trigger click on the grey area
- Display real time scale on xAxis
- Highcharts 2nd yaxis not scaling
- Highcharts: Dual axis line and column with multiple series
- Highcharts : using JSON data as label to xaxis
- Alternate for highcharts-more
- Highcharts show the same yAxis start and end value with multiple data series
- HighCharts Funnel - Set minimum size of each section
- Highchart is not working when I am fetching the axis values from database
- Referencing a JSON object created in Java through javascript in the one JSP page
- Enormous data and PHP errors
- How to show values in Highcharts tooltip other than x and y when data points are too high?
- Series Data for column high chart
- time data with irregular intervals in HighChart
- HighCharts one y axis automatic for each serie
- Accessing Highcharts methods in Rally chart
- Can I set a minimum positive and a minimum negative axis value in Highcharts
- How show interactive charts in a GTK window?
- Datepicker jquery-ui for angular highcharts-ng rangeSelector
- Issue with last column width in Highcharts
- How to dynamically add point placement and point padding in fixed column chart (highcharts)
- Hight chart show series data in milliseconds
- Highcharts: Line graph with half solid line and half dotted line?
- Credit ON/OFF on Button click in Highcharts
- change particular line chart series colour dynamically in highcharts
- parse JavaScript object to render highcharts
- Can't set title of highchart through @input
- Add dynamic series
- Rails BigDecimal JSON output for Highcharts