Scraping responsive chart on website

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,600
Office Version
  1. 365
Platform
  1. Windows
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
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>
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
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,214,851
Messages
6,121,931
Members
449,056
Latest member
denissimo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top