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

- Display Data with Xvalues correctly in Highcharts
- HighCharts - 2nd yAxis graphs not scaling correctly
- How to change the color of marker-points dynamically based on y-position
- How to make a chart with highcharts, load data from API
- HighCharts Disable some Series Name from the Legend
- Highcharts - Starting index of series at 1 instead of 0
- Remove elements in a chart generated with highchart
- HighStock Area Charts - Add Two Series
- Javascript data loading issue
- Custom hover / tooltip data on highcharts network chart
- Set crosshairs color for a specific series - highcharts
- Disable week view in more then 3 months x axis (Highchart js)
- Disable Plotpoint legend on hover in Highcharts
- using gauges in ionic 3
- Update datalabel position after Heatmap resize with Highcharts
- HighCharts error #18: Requested Axis Does not exist
- Interactive charts in angularjs or highcharts
- Highcharts downsampling - CSV
- how to add border radius on plotbackground area in highcharts
- highcharts v3.0Beta bubblechart not rendering. Possible bug?
- display json data in a chart
- Highcharts -- yAxis on donut chart not being displayed
- angular-chartJs change chart background and highlight colors
- Highmaps: How do you change the name of a state
- React Highstock Won't Work But Highchart works
- Using Highcharts (and modules) with lit-element
- How to create Highcharts tree map with 4 levels
- how to add tooltip on hover over the stacked Labels in highcarts
- how push some elements of an array to another
- programatically change the color of a highcharts spline series?