Using category filter to display different data formats in single chart container

23 views
Skip to first unread message

dunba...@gmail.com

unread,
Sep 2, 2015, 12:44:05 PM9/2/15
to Google Visualization API
Hi, 

I'm trying to find a way to use multiple category filters to display filtered views of a data table in line chart form. The data is a table with time series columns representing different categories/subcategories, some of which are dollar amounts and some are ratios of these amounts (expressed as percentages). 

My approach has been to adapt Andrew Gallant's code converting data columns into rows and using the dashboards to filter that from an initial default state. Because I need to be able to display dollar and percentage quantities in the same chart container, I have to apply two formatting routines 1) a NumberFormat rule applied to the data table, which gets the tooltip quantities right, and 2) Two chart wrappers with vAxis formats for dollars and percentages respectively. I then use a setView function to draw chart1 or chart2 depending on an if/else test for data type. 

The problem is that while this works for the initial default state (say chart1) and for the first time the dashboard control changes the data type (displaying chart2), it doesn't allow the user to make any changes subsequently. This is the case even though I have checked that the computer is correctly performing the if/else test and therefore is trying to execute the correct chart display every time there is a control event. 

I am mystified why the Google Visualization API won't let me draw a chart more than twice. The only way out I can see is to have separate <div>'s for each chart but I don't want to do that. Perhaps there is a fundamentally better way of approaching this problem within the framework you provide. 

All assistance appreciated. 

Nick 

Nick Dunbar

unread,
Sep 2, 2015, 3:28:59 PM9/2/15
to google-visua...@googlegroups.com
Just adding a further comment to this: it seems odd to me that the API forces me to format data twice: once with NumberFormat and a second time for chart axes. Shouldn't there be a way for chart axes to inherit the data format already defined by NumberFormat? It would save a lot of trouble if that was possible. 

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/05NLFG5r6HI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/2c195155-0502-49ba-b0d2-5d83182d937a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages