error: uncaught exception: All series on a given axis must be of the same data type

8,573 views
Skip to first unread message

derridur

unread,
Dec 14, 2011, 11:08:52 AM12/14/11
to Google Visualization API
Hi
i am taking from google analytice country and city as dimentions and
visits as metrics. i get the right results.
i loop them to send them to the addRows function but then i get this
error:

uncaught exception: All series on a given axis must be of the same
data type

i use:
data.addColumn('string', 'Country');
data.addColumn('string', 'City');
data.addColumn('number', 'Visits');

and i try to use the ColumnChart.

please help i have no idea what is wrong.

by the way, i tried PieChart and i get no errors but no chart too.

asgallant

unread,
Dec 14, 2011, 1:46:49 PM12/14/11
to google-visua...@googlegroups.com
With column charts (and bar, line, area, scatter, pie - pretty much all charts except tables), only the first data column can be of type 'string'.

EZChart

unread,
Dec 15, 2011, 1:50:19 AM12/15/11
to google-visua...@googlegroups.com
On Wed, Dec 14, 2011 at 8:46 PM, asgallant <drew_g...@abtassoc.com> wrote:
With column charts (and bar, line, area, scatter, pie - pretty much all charts except tables), only the first data column can be of type 'string'.

--
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/-/906yZBoMHt0J.

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.

Mike Bucaro

unread,
Apr 10, 2012, 8:19:05 AM4/10/12
to google-visua...@googlegroups.com
Same issue here, x-axis is date, all other columns are numbers.  Graph comes up fine in spreadsheet but gives the same error on google sites until you refresh sometimes multiple times: All series on a given axis must be of same data type.

asgallant

unread,
Apr 10, 2012, 10:11:46 AM4/10/12
to google-visua...@googlegroups.com
Can you post your code or a link to the page so we can examine it?

asgallant

unread,
Jul 20, 2012, 11:22:14 AM7/20/12
to google-visua...@googlegroups.com
I'm not sure why, but your spreadsheet is returning numbers as strings.  Using a DataView with calculated columns that parse the strings into numbers fixes the problem: http://jsfiddle.net/asgallant/tnuuk/ (in the example, I use the "view" property of the ChartWrapper, but a DataView does the same thing).

On Friday, July 20, 2012 4:15:33 AM UTC-4, Dick Newell wrote:
I would dearly like to know how to overcome this.
I have a spreadsheet here:
which gives the error on a scatter chart: "All series on a given axis must be of the same data type"
I have shared the file
Dick

Dick Newell

unread,
Jul 20, 2012, 2:30:35 PM7/20/12
to google-visua...@googlegroups.com
Thank you so much for this, but your solution is a bit above my head. Bizarrely I can make a chart of all sorts of subsets of the data, but not all of the data. However, I decided maybe it is because I have some duplicate points. To find these I needed to sort the data - guess what, when the x-axis data is sorted, the problem goes away. 
Dick
Reply all
Reply to author
Forward
0 new messages