Hey all,
I'm in a constant struggle with Google's visualization api, but I
really don't see anything better, so I'm coming to you all with my
bind. Let's say we have some data, like the number of tweets per
language for a set of tweets. In this case, our breakdown may look
something like:
+----------+-------+
| label | value |
+----------+-------+
| German | 21 |
| English | 448 |
| Spanish | 30 |
| French | 7 |
| Italian | 2 |
| Japanese | 1 |
+----------+-------+
So, I set up a service on my site that exposes this data in the
fashion I have seen to work with google charts, and a little piece of
code to access and draw() the graph. Altogether, the snippet would
look something like this pastie:
http://pastie.org/2281512.
So, my question is pretty simple. I don't want to pre-sort everything
on the database end, as it would get particularly messing in
determining what to sort by (as the code on that level is very
abstracted from the business of displaying any particular graph). It
would be better to sort it once loaded in js, and spit the sorted
version out in the graph. How would one sort this particular graph by
something like value (the number of people per language)? Would it
just make more sense to load direct json like that located at
http://test.140kit.com/test.json, and then sort and display that? what
would the js look like for that?
As you can tell, i know some programming but I'm basically useless and
utterly defeated/hopeless when it comes to js. Any help would be very,
very welcome.
Thanks much.