Hi, everyone

I'm trying to dynamically call up to show many graphics on the same page, 
because I do not know how many graphics I need.
I need to create graphics at runtime. What is the problem with my code?

$(document).ready(function () {
    graph_curving_the_lines();
});

var graph_curving_the_lines = function () {

    var graficos = $('.graph_curving_the_lines');
    var params, self, id_grafico, nome_funcao;

    graficos.each(function () {

        self = $(this);

        id_grafico = self.attr('id');

        nome_funcao = 'funcao_' + id_grafico;

        params = self.data('params');

        if (typeof params != 'undefined') {

            console.log(nome_funcao);
            
            google.charts.load('current', {'packages': ['corechart']});
            google.charts.setOnLoadCallback(nome_funcao);
            
            window[nome_funcao] = function () {
                var data = 
google.visualization.arrayToDataTable(params.data);
                var options = params.options;
                var chart = new 
google.visualization.LineChart(document.getElementById('' + id_grafico));

                chart.draw(data, options);
            };

        }

    });

};

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/25613b57-fd72-491b-a025-585a3ca47076%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to