Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Table sort not working for a number column
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mike Beccaria  
View profile  
 More options Feb 8, 4:25 pm
From: Mike Beccaria <mikebecca...@gmail.com>
Date: Wed, 8 Feb 2012 13:25:32 -0800 (PST)
Local: Wed, Feb 8 2012 4:25 pm
Subject: Table sort not working for a number column
I created my 1st visualization that creates a sortable table of
values. The problem is that when I sort the "Checkouts" column, they
sort like letters and not like numbers even though I specified the
column data type as a number.

Here's the table:
http://library.paulsmiths.edu/test/charts/top5visualization.html

And the json data that it queries:
http://library.paulsmiths.edu/test/charts/top5.php

Notice that that Checkouts column is a number but when you sort the
column, it doesn't sort properly:
{"cols":[{"id":"year","label":"Year","type":"number"},
{"id":"title","label":"Title","type":"string"},
{"id":"checkouts","label":"Checkouts","type":"number"}],

Sorted Copy from chart:
2011    Dog hikes in the Adirondacks : 20 trails to enjoy       9
2010    Water for elephants : a novel by Sara Gruen.    9
2010    The Eighth International Symposium on Environmenta      9
2010    Streams : their ecology and life by Colbert.E. Cu       8
2010    Introduction to permaculture by Bill Mollison wit       8
2010    Negotiation by Roy J. Lewicki, Bruce Barry, David       8
2010    Amuse-bouche : little bites that delight before th      8
2010    Billy Joe Tatum's Wild foods cookbook and field gu      8
2008    About wine by J. Patrick Henderson, Dellie Rex. 36
2011    The help by Kathryn Stockett.   18
2009    Twilight by Stephenie Meyer.    16
2011    Research design : qualitative, quantitative, and m      14
2009    Lies my teacher told me : everything your American      14
2009    Marked : a house of night novel |c P.C. Cast and        14
2008    Plows, plagues, and petroleum : how humans took co      14
2010    How the other half lives; studies among the teneme      13

Any idea how to fix this? Am I overlooking something?
Thanks,
Mike


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fons Seesink  
View profile  
 More options Feb 9, 7:05 am
From: Fons Seesink <fons.sees...@gmail.com>
Date: Thu, 9 Feb 2012 13:05:41 +0100
Local: Thurs, Feb 9 2012 7:05 am
Subject: Re: Table sort not working for a number column
Looking at your website, I think you sorted things out

--

Best regards
Fons Seesink


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Beccaria  
View profile  
 More options Feb 9, 7:48 am
From: Mike Beccaria <mikebecca...@gmail.com>
Date: Thu, 9 Feb 2012 04:48:45 -0800 (PST)
Local: Thurs, Feb 9 2012 7:48 am
Subject: Re: Table sort not working for a number column
Not with my browser. I checked it this morning (just now) and noted
that the numbers don't sort in order. Here's a screenshot:
http://screencast.com/t/O5Otv4fv

Notice the checkouts are supposed to be sorted from high to low but
they go from 9,8,...36,18,16.

Mike

On Feb 9, 7:05 am, Fons Seesink <fons.sees...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fons Seesink  
View profile  
 More options Feb 9, 8:53 am
From: Fons Seesink <fons.sees...@gmail.com>
Date: Thu, 9 Feb 2012 14:53:34 +0100
Local: Thurs, Feb 9 2012 8:53 am
Subject: Re: Table sort not working for a number column
indeed, have been looking with my eyes closed it seems
in your code try and define with single ' rather than using "
{'cols':[{'id':.......'type':'number'}],

not sure but the websites explaining about the topic all use single

--

Best regards
Fons Seesink


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Beccaria  
View profile  
 More options Feb 9, 9:54 am
From: Mike Beccaria <mikebecca...@gmail.com>
Date: Thu, 9 Feb 2012 06:54:32 -0800 (PST)
Local: Thurs, Feb 9 2012 9:54 am
Subject: Re: Table sort not working for a number column
Thanks for your help! Unfortunately it didn't work. If I understood
you correctly, you wanted me to use "single" as the "type" for the
checkouts column. I couldn't find any mention of a "single" type but
put it in there anyway and now the table won't sort. The data is live
with "single" now as the type.

On this page:
http://code.google.com/apis/chart/interactive/docs/reference.html#Dat...

It lists a getColumnType function that does not mention a "single"
type:
Returns the type of a given column specified by the column index.
    columnIndex should be a number greater than or equal to zero, and
less than the number of columns as returned by the
getNumberOfColumns() method.
The returned column type can be one of the following: 'string'
'number' 'boolean' 'date' 'datetime' 'timeofday'

I'm not gonna lie, I'm a bit stumped at the moment and hope I'm
overlooking something simple.
Thanks again,
Mike

On Feb 9, 8:53 am, Fons Seesink <fons.sees...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fons Seesink  
View profile  
 More options Feb 9, 10:01 am
From: Fons Seesink <fons.sees...@gmail.com>
Date: Thu, 9 Feb 2012 16:01:28 +0100
Local: Thurs, Feb 9 2012 10:01 am
Subject: Re: Table sort not working for a number column
I did not want to advise you to use "single", but the single qoutes as
in ' rather than " to wrap your code in
like i placed in your ( shortened) code
{'cols':[{'id':.......'type':'number'}],

--

Best regards
Fons Seesink


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Beccaria  
View profile  
 More options Feb 9, 10:23 am
From: Mike Beccaria <mikebecca...@gmail.com>
Date: Thu, 9 Feb 2012 07:23:41 -0800 (PST)
Local: Thurs, Feb 9 2012 10:23 am
Subject: Re: Table sort not working for a number column
Hmm...That could be a problem.
I'm creating the json from a php object using json_encode() and
http://www.json.org/ website mentions the use of double quotes, not
single, but I figured I'd try it anyway. I did a string replace of all
double quotes with single quotes, which works (the data has single
quotes, not doubles), but then the chart doesn't show up at all.

Mike

On Feb 9, 10:01 am, Fons Seesink <fons.sees...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Beccaria  
View profile  
 More options Feb 22, 9:30 am
From: Mike Beccaria <mikebecca...@gmail.com>
Date: Wed, 22 Feb 2012 06:30:50 -0800 (PST)
Local: Wed, Feb 22 2012 9:30 am
Subject: Re: Table sort not working for a number column
Sorry for the bump. This is still not working and it looks like my
data and code are correct. Is this a bug? Any ideas?

On Feb 9, 10:23 am, Mike Beccaria <mikebecca...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TheCompWiz  
View profile  
 More options Feb 22, 10:27 am
From: TheCompWiz <thecomp...@gmail.com>
Date: Wed, 22 Feb 2012 10:27:29 -0500
Local: Wed, Feb 22 2012 10:27 am
Subject: Re: Table sort not working for a number column
Stop using "" around your digits.  In the results from your data set:
(http://library.paulsmiths.edu/test/charts/top5.php) the results
return values like: {"v":"10"}  ... which means the string "10" and
not the number value "10".  Adjust your php to return {"v":10} for
numeric values.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Beccaria  
View profile  
 More options Feb 22, 2:13 pm
From: Mike Beccaria <mikebecca...@gmail.com>
Date: Wed, 22 Feb 2012 11:13:14 -0800 (PST)
Local: Wed, Feb 22 2012 2:13 pm
Subject: Re: Table sort not working for a number column
Worked like a champ:) Thanks!

On Feb 22, 10:27 am, TheCompWiz <thecomp...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »