I’m not familiar with front end techniques.So I’m not sure if this can actually works. Here is a web page about the residential vacancy rate of a suburb 2000: https://sqmresearch.com.au/graph_vacancy.php?postcode=2000.
Now that I have the HTML that renders the trend plot, can we get the data behind it, for example, the vacancy rate in the most recent month? In this plot, the last month (March 2023)’s vacancy rate is 3.1% and the vacancy number is 292. These numbers are shown only when hovering the cursor on that month in the plot.
It shows "Highcharts" in bottom right. Can we get the data using Python or JavaScript?
2
Answers
Yes, it’s possible to retrieve the data from a rendered Highcharts graph with Javascript (Python would be a little harder I suppose). Go to the website, open your development console (F12 on most Chromium browers), open the console tab and execute this:
$('#hichartcontainerVR').highcharts().series
. It outputs two series, one for the bars and one for the line. Each of them has a data property which represents all data points (last entry = last month). Thex
value is probably the value you’re looking for.You can get access to all chart options by the global variable
Highcharts
.Call the below JS code:
to access pure data:
Highcharts.charts[0].userOptions.series[1].data
to access data:
Highcharts.charts[0].series[1].points