google-charts icon indicating copy to clipboard operation
google-charts copied to clipboard

Property 'api' does not exist on type 'GoogleChartsManager'.

Open sharing-innovations-luong-phuc opened this issue 3 years ago • 0 comments

        import {GoogleCharts} from 'google-charts';

        GoogleCharts.load(() => {
            let data = GoogleCharts.api.visualization.DataTable();
            data.addColumn('string', 'Name');
            data.addColumn('string', 'Manager');
            data.addColumn('string', 'ToolTip');

            let $html = $("<div />").attr("style", "color:red; font-style:italic").append("President").get(0).outerHTML;

            // For each orgchart box, provide the name, manager, and tooltip to show.
            data.addRows([
                [
                    {
                        v:'Mike',
                        f: "Mike" + $html
                    },
                    '',
                    'The President'
                ],
                [
                    {
                        v:'Jim',
                        f:'Jim<div style="color:#ff0000; font-style:italic">Vice President</div>'
                    },
                    'Mike',
                    'VP'
                ],
                ['Alice', 'Mike', ''],
                ['Bob', 'Jim', 'Bob Sponge'],
                ['Carol', 'Bob', '']
            ]);

            data.setRowProperty(2, 'selectedStyle', 'background-color:#00FF00');
            data.setRowProperty(3, 'style', 'border: 1px double red');

            // Create the chart.
            let chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
            // Draw the chart, setting the allowHtml option to true for the tooltips.
            chart.draw(data, {
                allowHtml:true,
            });
        },
        "orgchart");

When I build, I met error

image