I'm trying to use the visualization toolbar to allow people to get the
htmlcode to add my gadgets to their web sites. The recent release
fixed various things with the toolbar, including the ability to pass
user preferences. But I'm having trouble getting multiple preferences
to work.

Here is the example from the documentation (http://code.google.com/
apis/visualization/documentation/gallery/toolbar.html#syntax)

function drawToolbar() {
  var components = [
      {type: 'igoogle', datasource: 'http://spreadsheets.google.com/tq?
key=pCQbetd-CptHnwJEfo8tALA',
       gadget: 'http://www.google.com/ig/modules/pie-chart.xml',
       userprefs: {'3d': 1}},
      {type: 'html', datasource: 'http://spreadsheets.google.com/tq?
key=pCQbetd-CptHnwJEfo8tALA'},
      {type: 'csv', datasource: 'http://spreadsheets.google.com/tq?
key=pCQbetd-CptHnwJEfo8tALA'},
      {type: 'htmlcode', datasource: 'http://spreadsheets.google.com/
tq?key=pCQbetd-CptHnwJEfo8tALA',
       gadget: 'http://www.google.com/ig/modules/pie-chart.xml'},
  ];

  var container = document.getElementById('toolbar_div');
  google.visualization.drawToolbar(container, components);
};

By the way, the docs have an error--the comma after the last component
and just before the closing bracket shouldn't be there, and it messes
things up in some browsers.

The user prefs example under type: 'igoogle' works for type:
'htmlcode' too. But I want to pass more user parameters, and I can't
figure out the syntax to do it. I'm also not hardcoding the values for
the prefs, but using what the creator entered.

If I use
userprefs: {'chart_type': prefs.getString('chart_type') }
it works fine.

If I use
userprefs: {'chart_type': prefs.getString('chart_type'), 'myTag':
prefs.getString('myTag') }
the toolbar doesn't appear at all (using FireFox on Mac).

If I use
userprefs: {'chart_type': prefs.getString('chart_type')}, {'myTag':
prefs.getString('myTag') }
I get an error.

I think this is just me not understanding the syntax, but any help
would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to