CategoryFilter - how to change displayed values

50 views
Skip to first unread message

Petr

unread,
Nov 27, 2015, 10:35:06 AM11/27/15
to Google Visualization API
Hi,
I'm using CategoryFilter for selecting displayed data. Example:

Name Age Tag
John 50  M
Ray  25  M
Eve  33  F
Child    3     C

I do not want to display column "Tag", it is only used by CategoryFilter. I want to spare data volume, so I use "M" for "male", "F" for "female", "C" for "child". (The data are stored in JSON file).
The problem is, how to display in CategoryFilter "Male" instead of "M".

I have two solution, both are not nice:
1st: I can write "Male" instead of "M". But the data file is much bigger.
2nd: I can change the cells in DataTable after loading. But execution of this code takes some time as well.

Is there any idea how to do that?
It would be nice to have formatter enabling more complex transformations. But there is no formatter for string values.

Any idea?

Daniel LaLiberte

unread,
Nov 30, 2015, 8:37:31 AM11/30/15
to Google Visualization API
Petr,

You can specify the formatted representation of each value in your data table.  Instead of a value like "M", use {v: "M", f: "Male"}.  The formatted representation should then be used in all displays instead of the value. The problem with this, however, is that you want two different formatted representations, one for the Table and a different one for your CategoryFilter.    We don't have a way of dealing with that currently, unfortunately.

One feature that we have been considering would support a formatting function that you could provide in the Table or CategoryFilter options (for example), and then your formatting function could do whatever it wants with the values.  This would have to apply to string values as well, of course.

But since you don't want to display your Tag column in your Table at all, you can specify the columns you do want to display with a 'view' property for your ChartWrapper.  Like so:

  "options": { "view": {"columns": [0, 1]} }




--
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-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/1288f1cb-ddc3-400d-b704-bfb94bfd0582%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA
Reply all
Reply to author
Forward
0 new messages