I am needing to scrape some data from the a website that holds a responsive chart (when the mouse is hovered over a column, it displays the value of the column)
By inspecting the page, the elements only show the src value but when I look at the source code this holds the values I need.
This is the extract of the code I need to query
I need to pull a value from a corresponding label. E.g. for 2015 I would need 4.9, 2016 would be 9.2, etc. The data to be queries is BOLD & ITALICISED
Thanks
By inspecting the page, the elements only show the src value but when I look at the source code this holds the values I need.
This is the extract of the code I need to query
HTML:
</script><script>
$(document).ready(function () {
var roeOptions = {
responsive: true,
legend: {
display: false
},
scales: {
yAxes: [{
ticks: {
callback: function(value, index, values){
return value.toFixed(0) + '%';
},
fontColor: '#949ba2',
fontSize: 14,
fontFamily: 'Roboto',
beginAtZero: true
}
}],
xAxes: [{
ticks: {
fontColor: '#949ba2',
fontSize: 14,
fontFamily: 'Roboto',
}
}]
},
tooltips: {
displayColors: false,
callbacks: {
label: function(tooltipItem, data) {
return tooltipItem.yLabel.toFixed(1) + '%';
}
}
}
};
var roeData = {
[I][B]labels: [2015, 2016, 2017, 2018, 2019, 2020, 202[/B][/I][B]1][/B],
datasets: [
{
backgroundColor: '#404652',
borderColor: "#9FA1BE",
borderWidth: 2,
[I][B]data: [ 4.9, 9.2, 14, 14.5, 13.4, 13.2, 15.4[/B][/I]
[B][I] ][/I][/B]
}],
};
var roeChart = document.getElementById("roe_chart").getContext("2d");
new Chart(roeChart, {type: 'bar', data: roeData, options: roeOptions});
});
</script><script>
Thanks