pivot.js
Advanced interactive Pivot table.
Objects
OAT.Pivot(div, chartDiv, filterDiv, headerRow, dataRows,
headerRowIndexes, headerColIndexes, filterIndexes,
dataColumnIndex, options)
Creates Pivot table. Arguments are explained below:
-
div
- the pivot table will be
created as a child of this element (dom element)
-
chartDiv
- pivot chart will be
created as a child of this element (dom element)
-
filterDiv
- 'paging' selects
will go here (dom element)
-
headerRow
- array of headings
for dataRows (array)
-
dataRows
- array of rows. Every
row (array) must have the same number of elements as
headerRow (array of arrays)
-
headerRowIndexes
- array,
containing indexes of columns which should be drawn as
vertical aggregate columns (array)
-
headerColIndexes
- array,
containing indexes of columns which should be drawn as
horizontal aggregate columns (array)
-
filterIndexes
- array,
containing indexes of columns which should be drawn as paging
aggregate columns (array)
-
dataColumnIndex
- index of data
column (number)
-
optObj
- object containing
following:
-
headingBefore
- should we
create headings before data? (bool)
-
headingAfter
- should we create
headings after data? (bool)
-
agg
- constant, specifying
appropriate aggregating function index (number)
-
aggTotals
- constant,
specifying appropriate aggregating function index for
sub-totals and totals (number)
-
showChart
- show chart?
(bool)
-
showRowChart
- show row totals
chart? (bool)
-
showColChart
- show column
totals chart? (bool)
-
type
- one of TYPE_
constants for number formatting ( OAT.PivotData
)
-
customType
- formatting
function for TYPE_CUSTOM
-
showEmpty
- show columns &
rows with null values? (bool)
-
subtotals
- show subtotals?
(bool)
-
totals
- show totals?
(bool)
-
currencySymbol
- when using
OAT.PivotData.TYPE_CURRENCY as customType
option. Default is $.
Constants
OAT.PivotData.TYPE_
-
OAT.PivotData.TYPE_BASIC
-
1234.56
-
OAT.PivotData.TYPE_PERCENT
-
1234.56%
-
OAT.PivotData.TYPE_SCI
-
1234E+02
-
OAT.PivotData.TYPE_SPACE
- 1
234.56
-
OAT.PivotData.TYPE_CUSTOM
-
function in options.customType
-
OAT.PivotData.TYPE_COMMA
-
1,234.56
-
OAT.PivotData.TYPE_CURRENCY
(currency symbol in options.currencySymbol .
$ is default)
CSS classes
.pivot_table
ToBeDone
.h1
ToBeDone
.h2
ToBeDone
.odd
ToBeDone
.even
ToBeDone
.subtotal
ToBeDone
.total
ToBeDone
.gtotal
ToBeDone
.pivot_chart
ToBeDone
.pivot
row_chart
ToBeDone
.pivot
col_chart
ToBeDone
Example
var pivot = new OAT.Pivot(div, chartDiv, filterDiv, headerRow, dataRows,
headerRowIndexes, headerColIndexes,
filterIndexes, dataColumnIndex, {})