-
Notifications
You must be signed in to change notification settings - Fork 16
Pivot
asripong edited this page Aug 2, 2012
·
2 revisions
The gg.pivot object holds all the necessary information required to render a pivot table. To construct a table using Polychart, we would begin by constructing a gg.pivot object, then bind all the necessary data to it, and finally rendering it in the desired dom.
Map the row, column, or values to a variable in the data set. For example, map('row', 'var1') would mean that the row of the table will consist of the variable 'var1' in the data set.
Set the statistics to run on the data prior to rendering. The stats parameter can be a string or a gg.stats object. A statistics pre-processes the data before rendering it (e.g. take the count of some values, etc). Here's a list of all the statistics:
-
.stats(gg.stats.sum)-- will sum the numbers in the bin -
.stats(gg.stats.count)-- will count the number of values in the bin -
.stats(gg.stats.unique)-- will count the number of unique values in the bin -
.stats(gg.stats.mean)-- will take the the mean of all values in the bin
Renders the pivot table.