Hello. I've a page with a form where the user can insert different filter.
On form submission I make an ajax request that give send me back and array
with 2 keys: chartType and chartData.
In the first one I've the type of chart user has to see (PieChart, GeoChart
etc) and in the second one the data for the chart (the "structure" depend
on chartType)
Everything works. But I would like a better code.
Now, to create the correct data I have a series of IF
if (jsonData['chartType'] == 'PieChart')
var chart = new
google.visualization.PieChart(document.getElementById('chart_div'));
if (jsonData['chartType'] == 'GeoChart')
var chart = new
google.visualization.GeoChart(document.getElementById('chart_div'));
is there a way to dynamically create the name of the class for the chart ?
Something like
var chart = new
"google.visualization."+jsonData['chartType'](document.getElementById('chart_div'));
Thank you
--
Simone
--
You received this message because you are subscribed to the Google Groups
"Google Chart 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 http://groups.google.com/group/google-chart-api.
For more options, visit https://groups.google.com/groups/opt_out.