Pivot Table V2¶
Introduction¶
A pivot table is a powerful tool for summarizing and analyzing data. It allows you to aggregate data based on multiple dimensions and metrics, making it easier to identify trends and patterns.
Pivot Table V2 requires at least one group and a page limit higher than 100. Note that this refers to the pagination limit defined at the chart level, not the group limits defined at the Attribute level.
It supports up to three row groups and up to three column groups.
In the ChartFactor toolkit, we can define a Pivot Table V2 visualization in this way:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
The code above creates a pivot table that summarizes the count of taxi trips by company and dropoff community area. The results are limited to the top 100 companies and the top 50 dropoff community areas, with a pagination limit of 100 records.
Page Size¶
Pivot Table V2 uses infinite scrolling to render data as naturally as possible. Behind the scenes, it uses pages of 100 rows by default. This page size can be changed with the limit()
function as shown bellow:
1 2 3 |
|
Page sizes under 100 are not allowed. This ensures the page size is big enough to be displayed in the view port of the Pivot Table V2.
Row totals and column totals¶
To render row and column totals, simply add the showTotal()
call to your Attribute definitions. The example below renders totals for the company
row group and for the payment_type
columns group.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
The previous code creates a pivot table shown below.
Configuration options¶
autoSizeColumns¶
A boolean value that indicates whether the columns should be automatically sized based on their content. Example:
1 2 3 4 |
|
color¶
This setting allows to specify out-of-the-box color themes and also to override them. Please refer to the color themes for table visualizations documentation for details. Example:
1 2 3 4 5 |
|
columnFilters¶
A boolean value that indicates whether column filters should be enabled. Default is false
. Example:
1 2 3 4 |
|
columnsWidth¶
This setting allows to manually set the ideal width for every grid column. Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
dataZoom¶
A string that specifies the type of data zoom filter to be applied. It supports only dragFilter
, default is null
. Example:
1 2 3 4 |
|
pinRows¶
A boolean value that indicates whether the rows should be pinned to the left side of the table. Default is true
. example:
1 2 3 4 |
|
rowHighlight¶
A boolean value that indicates whether the rows should be highlighted when hovered over. Default is true
. Example:
1 2 3 4 |
|
showEmptyValuesAs¶
A string that specifies how empty values should be displayed in the pivot table. It can be set to any string value, such as "-"
or "N/A"
. Default is null
, which means empty values will not be displayed. Example:
1 2 3 4 |
|
sizeColumnsToFit¶
A boolean value that indicates whether the columns should be resized to fit the available width of the pivot table. This configuration overrides the autoSizeColumns
property. Example:
1 2 3 4 |
|