Problems using setView

83 views
Skip to first unread message

John Held

unread,
Apr 18, 2017, 2:08:05 PM4/18/17
to Google Visualization API
I like Google Charts a lot, but have run into something I haven't seen posted anywhere.

In short, I am using different controls to select which row of a 36 row json file to display based on a column labeled "Index".
 

If I set the columns as below, I can exclude the Index column with a ProgrammaticSlider set as a NumberRangeFilter.  The problem is that it seems impossible to set the Slider above 9 using a control.  The chart becomes unresponsive after selecting any double-digit row. 

This is what I have when attempting this : 

programmaticChart.setView({'columns': [0, 1]});   //this works, but only for 9 rows! 

cols": [ 
        {"id":"","label":"Year","pattern":"","type":"string"}, 
        {"id":"","label":"Cases","pattern":"","type":"number"}, 
        {"id":"","label":"Index","pattern":"","type":"number"} 
      ], 

On the other hand, I can set the Slider to an Index up to 36  using programmaticChart.setView({'columns': [0, 1, 2]}) and select the row I want - which of course doesn't help because there's no need to see columns with the index.

However setting the columns to skip column 1 creates the following error (and the code and json columns are below): 
"Invalid column index 2. Should be an integer in the range [0-1]." 
. 
programmaticChart.setView({'columns': [0, 2]});   //this now blows up with the following column definitions 

"cols": [ 
        {"id":"","label":"Year","pattern":"","type":"string"}, 
        {"id":"","label":"Index","pattern":"","type":"number"}, 
        {"id":"","label":"Cases","pattern":"","type":"number"} 
      ], 

Here's three rows of the json file I want to use displaying column 2 as an example: 

{"c":[{"v":"2013","f":null},{"v":1,"f":null},{"v":"10","f":null}]}, 
{"c":[{"v":"2013","f":null},{"v":2,"f":null},{"v":"20","f":null}]}, 
{"c":[{"v":"2013","f":null},{"v":3,"f":null},{"v":"30","f":null}]}, 


Any help would be greatly appreciated! 

Daniel LaLiberte

unread,
Apr 18, 2017, 2:42:56 PM4/18/17
to Google Visualization API
Your column 2 values are quoted.  I wonder if that is related to the problem you are seeing.  

After creating a view with only columns 0 and 2 in it, you will have a table with only 2 columns, indexed 0 and 1.  The error message "Invalid column index 2. Should be an integer in the range [0-1]."  means you are referencing column index 2 somewhere.

--
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 google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
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/95b06fa1-e2f1-4f1e-9a77-9c3a6c139841%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

John Held

unread,
Apr 19, 2017, 1:49:26 PM4/19/17
to Google Visualization API
Thanks very much.  I did have quotes in my example.  Taking them out actually resolved this issue:
If I set the columns as below, I can exclude the Index column with a ProgrammaticSlider set as a NumberRangeFilter.  The problem is that it seems impossible to set the Slider above 9 using a control.  The chart becomes unresponsive after selecting any double-digit row.

but I still get the same error when skipping columns ("Invalid column index 2. Should be an integer in the range [0-1]." )
.
programmaticChart.setView({'columns': [0, 2]});   //this now blows up with the following column definitions 

My only thought is that this may be an issue with ColumnCharts.  

Please let me know if you have any further thoughts, or if I can provide more information.

Much appreciated!
To post to this group, send email to google-visua...@googlegroups.com.



--

Daniel LaLiberte

unread,
Apr 19, 2017, 2:36:48 PM4/19/17
to Google Visualization API
If you can point us at a web page that shows what you are seeing, we will have a better chance of identifying what is going wrong.  

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@googlegroups.com.



--

--
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 google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

John Held

unread,
Apr 19, 2017, 3:20:04 PM4/19/17
to Google Visualization API
I don't have what I'm working on out at a production site yet, but see how this would be useful.  Now that I can access all the rows I need to, I believe that I can set up the structure of the json file to do what needs doing.

Your earlier observation regarding Index being set as a string instead of an integer should do the trick!

Thanks much!
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--

--
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 google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.



--
Reply all
Reply to author
Forward
0 new messages