Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suddenly none of the charts are working ('Undefined' in not an object) #2991

Open
vitorlfaria opened this issue Apr 4, 2023 · 6 comments
Open
Assignees
Labels

Comments

@vitorlfaria
Copy link

vitorlfaria commented Apr 4, 2023

I'm using Google charts for several months, now it stopped working with the same come that was working last week.
Here is the code:

<script type='text/javascript' src='https://www.gstatic.com/charts/loader.js'></script>
<script type='text/javascript'>
    google.charts.load('current', { 'packages': ['corechart', 'bar', 'line'] });
    google.charts.setOnLoadCallback(function () { });

    setTimeout(function () {
        drawChart_economiaMensalGrafico();
        drawChart_consumoAnualGrafico();
    }, 1000);

    function drawChart_economiaMensalGrafico() {
            var data = new google.visualization.arrayToDataTable([
                ['Mês', 'Valor em R$'],
                {economiaMensalGrafico_dados}
            ]);

            var view = new google.visualization.DataView(data);
            view.setColumns([0, 1,
                {
                    calc: 'stringify',
                    sourceColumn: 1,
                    type: 'string',
                    role: 'annotation'
                },
            ]);

            var options = {
                //curveType: 'function',
                colors: ['#01357B'],
                backgroundColor: '#EBEBF2',
                chartArea: { backgroundColor: '#EBEBF2', left: 60, right: 10, top: 20, bottom: 20, width: '100%', height: '100%' },

                title: '',
                legend: { position: 'none' },
                annotations: {
                    style: 'point',
                    stem: { color: 'transparent' },
                    alwaysOutside: false,
                    textStyle: {
                        fontSize: 10,
                        fontName: 'Muli',
                        bold: false,
                    },
                },
                hAxis: {
                    textStyle: {
                        fontSize: 10,
                        fontName: 'Muli',
                        bold: false,
                    },
                },
                vAxis: {
                    textStyle: {
                        fontSize: 10,
                        bold: false
                    },
                },
            };

            //var chart = new google.visualization.ColumnChart(document.getElementById('economiaMensalGrafico'));
            var chart = new google.visualization.LineChart(document.getElementById('economiaMensalGrafico'));

            chart.draw(view, options);
    };
<script/>

Does anyone know what's wrong?

@cwsneil
Copy link

cwsneil commented Apr 4, 2023

I have see a similar issue with our reports. The latest version (52) does not work with custom fontName options. If you remove the fontName: 'Muli', option from the textStyle it should load correctly.

@bhimrajg
Copy link

bhimrajg commented Apr 4, 2023

I am also facing same issue. Google charts which were working for last few years, completely stopped rendering and it was throwing an error - "Cannot read properties of undefined (reading 'length')" within a red container error box. This error is being thrown at "chart.draw" method call.

There is recent release of google charts today: https://developers.google.com/chart/interactive/docs/release_notes#current:-april-2023

It looks like that could have triggered this issue, since we are referencing the js library as https://www.gstatic.com/charts/loader.js

I am not sure what caused it to broke the chart functionality and showing that error, but for us - removing the certain fonts specified for chart have worked.

@dlaliberte dlaliberte self-assigned this Apr 4, 2023
@dlaliberte dlaliberte added the bug label Apr 4, 2023
@dlaliberte
Copy link

This has been reported by a few people, though why the error is occurring is not at all clear to me since the webfont code should be identical. As a workaround, removing the fontName option works, or loading '51' instead of 'current'. I may rollback the v52 rollout, since there is also a mysterious problem with the CategoryFilter.

@vitorlfaria
Copy link
Author

I have see a similar issue with our reports. The latest version (52) does not work with custom fontName options. If you remove the fontName: 'Muli', option from the textStyle it should load correctly.

This worked! Thanks!

@dlaliberte dlaliberte reopened this Apr 4, 2023
@dlaliberte
Copy link

The bug still exists in v52 even though you have some workarounds. So reopening. I just rolled back the v52 release, (which may take a couple hours for you to see), but it would be great if more people could test the 'upcoming' version to find out if there are more bugs that need to be fixed before I push out another release.

@PBalsdon
Copy link

PBalsdon commented Apr 5, 2023

We also had issues, but we're using the old GWT/imagechart, so we're 10 years out of support anyway...
We'll fix our version at 51 and make a plan to migrat/update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants