table coulmn selection based on view selected in dropdown

55 views
Skip to first unread message

kotmanp

unread,
Jan 21, 2013, 2:55:31 AM1/21/13
to google-visua...@googlegroups.com
Hi,
 
Please find the two attached html files with google charts.
 
1. excludeDropdownWorking.html is my current html file which is working as expected.
 
I want to extend this script to have one more dropdown to select view for the coulumns to be displayed for the table.
 
Please find my 2nd attachment (viewsDropdown.html) that i currently trying:
 
i have the following views: (and the correspoding columns that should be displayed.)
 
All= ['Name', 'Gender', 'Age', 'Donuts eaten'];
Default= ['Name', 'Age', 'Donuts eaten'];
GenderView= ['Name', 'Gender', 'Donuts eaten'];
DEView= ['Name', 'Donuts eaten'];
 
My other pie chart data depends on the columns in the current table. Hence when a particular view is selected, the coulmns display should only be changed, but the all the data should be present in the table for the pie chart to be displayed.
 
Also When i first select the view, the table is correctly setting the display, but then if i change any of the other controls, table is again displaying all the columns. (table should retain its state for required columns based on view selected) 
Can you please help me in fixing this script?
 
Thank you in advance!!
 
  
excludeDropdownWorking.html
viewsDropdown.html

asgallant

unread,
Jan 21, 2013, 12:22:00 PM1/21/13
to google-visua...@googlegroups.com
This one was a bit tricky (since you are working with a control in a backwards manner), but I think I've got it nailed down.  I would explain everything I did to make it work, except I don't remember even half of what I did, so perhaps it would be best for you to look it over and see if you have any questions about it.  See the attached file.
viewsDropdown_fixed.html

kotmanp

unread,
Jan 22, 2013, 1:09:27 AM1/22/13
to google-visua...@googlegroups.com
Hi Asgallant,
 
Thankq for the solution. i will try at my end and will get back to you if i face any issues.
 
Thank you once again!!

kotmanp

unread,
Jan 22, 2013, 1:59:28 AM1/22/13
to google-visua...@googlegroups.com
Hi Asgallant,
 
I have a problem here. in the solution taht you have provided, i can see that you have modified the pie chart data generation code from generic to using group (google.visualization.data.group). Actually in my actual requirement, i have 15 such various charts (bar, pie, area, other tables etc) that i am generating data by adding listerner for (main) table 'ready' state. i havent used groups there and i ahve written generic code to get the required data after certain calculations and make them work. If i need to use your logic then it might be difficult for me to rewirte the code for all such charts whose data depends on primary data table.
 
Is there any other solution that i can use without chaging the logic for pie chart and still make the dependency for Exclude designs and View dropdown work?
 
Thankyou for your time !!

asgallant

unread,
Jan 22, 2013, 11:24:00 AM1/22/13
to google-visua...@googlegroups.com
You don't have to use groups there, I was just consolidating the code block.  Your previous code worked fine, just make sure you pull data from the DataView (view) to populate your data_a table.

kotmanp p

unread,
Jan 22, 2013, 1:04:20 PM1/22/13
to google-visua...@googlegroups.com
Hi Asgallant,
 
Can you please help me in making this work. Please find the attached file for the same!!  
 
Thank you!!
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/l6zS0d57eUgJ.

To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

viewsDropdown_fixed_try.html

asgallant

unread,
Jan 22, 2013, 1:56:47 PM1/22/13
to google-visua...@googlegroups.com
See attached.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.
viewsDropdown_fixed_2.html

kotmanp

unread,
Jan 22, 2013, 10:11:15 PM1/22/13
to google-visua...@googlegroups.com
Thank you very much for the solution !!
Reply all
Reply to author
Forward
0 new messages