user227710
user227710

Reputation: 3194

How to extract the data from highstock chart

Assume that I have a sample highstock chart like this in the website. I was wondering whether it is possible to extract the data from the chart alone (i.e. chart is created by the third person and the data used for the chart is not accessible to others).

<img src="http://www.highcharts.com/stock/demo/basic-line">

Upvotes: 4

Views: 5476

Answers (2)

harnen
harnen

Reputation: 403

Actually if you download the page with the chart, you can easily extract the data. It will be stocked in the main *.html file.

It's not the actual data, but rather the positions of every point in the chart. But you'll just have to scale it to get what you want.

Upvotes: 1

James Donnelly
James Donnelly

Reputation: 128781

Yep. Each chart is stored within HighChart's Highcharts.charts array. On the page you've linked that currently contains the one chart:

Highcharts.charts
-> [ z.Chart ]

This is an object containing all the data within that chart. We can view it by picking it from the Highcharts.charts array index (0 in this case):

Highcharts.charts[0]
-> z.Chart { ... }

This contains all the information you'd need. Each chart object contains a series property which is an array containing the data for each of the series the chart renders. A data property exists within each series containing all the data within, and the name property contains the name of the series.

For example:

Highcharts.charts[0].series[0].name
-> "APPL"
Highcharts.charts[0].series[0].data
-> Array[1774]

HighCharts' documentation is laid out in the same format as the JavaScript object it creates. This can be viewed here: http://api.highcharts.com/highcharts.

Upvotes: 11

Related Questions