PivotChart.container
Container DOM, requires width.
PivotChart.records
tabular data. The currently supported data formats are, taking the sales of large supermarkets in North America as an example:
[
{
"Category": "Technology",
"Sales": "650.5600051879883",
"City": "Amarillo"
},
{
"Category": "Technology",
"Profit": "94.46999931335449",
"City": "Amarillo"
},
{
"Category": "Furniture",
"Quantity": "14",
"City": "Amarillo"
},
{
"Category": "Furniture",
"Sales": "3048.5829124450684",
"City": "Amarillo"
},
{
"Category": "Furniture",
"Profit": "-507.70899391174316",
"City": "Amarillo"
},
{
"Category": "Office Supplies",
"Quantity": "60",
"City": "Anaheim"
}
]
PivotChart.columnTree
List header tree, type:(IDimensionHeaderNode|IIndicatorHeaderNode)[]
. Among them, IDimensionHeaderNode refers to the dimension value node of the dimension non-indicator, and IIndicatorHeaderNode refers to the indicator name node.
The specific configuration items of IDimensionHeaderNode are as follows:
export interface IDimensionHeaderNode {
/**
* The unique identifier of the dimension, corresponding to the field name of the dataset
*/
dimensionKey: string | number;
/** dimension member value */
value: string;
/** Subdimension tree structure under dimension members. */
children?: (IDimensionHeaderNode|IIndicatorHeaderNode)[] ;
/** The collapsed state is used with the tree structure display. Note: only valid in rowTree */
hierarchyState?: HierarchyState;
/** Merge display of this dimension value across cells, default is 1. If the maximum number of header levels is 5, then the last level will merge as many cells as there are levels left. */
levelSpan?: number;
}
IIndicatorHeaderNode specific configuration items are as follows:
export interface IIndicatorHeaderNode {
/**
* The key value of the indicator corresponds to the field name of the data set
*/
indicatorKey: string | number;
/**
* Indicator names such as: "sales", "for example", correspond to the value displayed in the cell. You can leave it blank, if you don’t fill it in, take the value from the corresponding configuration of the indicators and display it
*/
value?: string;
/** Merge display of this dimension value across cells, default is 1. If the maximum number of header levels is 5, then the last level will merge as many cells as there are levels left. */
levelSpan?: number;
}
PivotChart.rowTree
Row header tree, same structure as columnTree.
PivotChart.columns
The style and format configuration corresponding to the header of each level of dimensions should be set separately for each dimension. The configuration items will vary slightly depending on the headerType. Supported headerType values are: 'text' | 'link' | 'image' | 'video'
. The specific configuration items for each headerType are as follows:
PivotChart.columns-text
Specify the column type as 'text', headerType can be omitted and the default is 'text'
PivotChart.columns-link
Specify the column type as 'link', headerType can be omitted and defaults to 'text'
PivotChart.columns-image
Specify the column type as 'image'
, headerType can be omitted and defaults to 'text
PivotChart.columns-video
Specifies the column type as 'video'
, headerType can be omitted and defaults to 'text'
PivotChart.rows
The structure is the same as the list header tree structure columns configuration
The row header corresponds to the style and format configuration of each level of dimension. Each type of dimension needs to be set separately. The configuration items have slight differences according to the headerType. The supported headerTypes are: 'text' | 'link' | 'image' | 'video'
. The specific configuration items for each headerType are as follows:
PivotChart.rows-text
Specify the column type as 'text', headerType can be omitted and the default is 'text'
PivotChart.rows-link
Specify the column type as 'link', headerType can be omitted and defaults to 'text'
PivotChart.rows-image
Specify the column type as 'image'
, headerType can be omitted and defaults to 'text
PivotChart.rows-video
Specifies the column type as 'video'
, headerType can be omitted and defaults to 'text'
PivotChart.indicators
The specific configuration of each indicator in the perspective combination chart, such as style, format, title, etc., is different from the pivot table. The indicator type here only supports the configuration of the chart type.
PivotChart.indicators-chart
Specify the column type as 'chart', cellType can be omitted and defaults to 'text'
PivotChart.indicatorsAsCol = true
The indicator is displayed on the column, default is true. If configured to false, it will be displayed in rows and the indicator will be displayed in rows.
PivotChart.indicatorTitle
indicator header for displaying the value to the corner header
PivotChart.corner
The configuration and style customization of the corner table header.
PivotChart.hideIndicatorName
Whether to hide the indicator name
PivotChart.showRowHeader = true
Whether to display row headers.
PivotChart.showColumnHeader = true
Whether to show column headers.
PivotChart.rowHeaderTitle
Add a line to the top of the row header to display the dimension name, which can be customized or display the combination name of title
PivotChart.columnHeaderTitle
Add a line to the top of the column header to display the dimension name, which can be customized or display the combination name of title
PivotChart.columnResizeType
Adjust the effective range of column width, configurable items:
column
: adjust the column width only adjust the current columnindicator
: Columns corresponding to the same indicator will be adjusted when the column width is adjustedindicatorGroup
: Adjust the width of all indicator columns under the same parent dimensionall
: All column widths are adjusted
PivotChart.rowResizeType
Adjust the effective range of row height, configurable items:
row
: adjust the row height only adjust the current rowindicator
: rows corresponding to the same indicator will be adjusted when the row height is adjustedindicatorGroup
: Adjust the height of all indicator rows under the same parent dimensionall
: All row heights are adjusted
PivotChart.renderChartAsync
Whether to enable asynchronous rendering of charts
PivotChart.renderChartAsyncBatchCount
Turn on asynchronous rendering of charts. The number of progressively rendered charts in each batch is recommended to be 5-10. The details can be adjusted depending on the overall effect. Default value is 5.
PivotChart.widthMode('standard' | 'adaptive' | 'autoWidth') = 'standard'
Table column width calculation mode, can be 'standard' (standard mode), 'adaptive' (container width adaptive mode) or 'autoWidth' (automatic width mode), default is 'standard'.
- 'standard': Use the width specified by the width property as the column width.
- 'adaptive': Use the width of the table container to allocate column width.
- 'autoWidth': Calculate column width automatically based on the width of the column header and body cells content, ignoring the width property settings.
PivotChart.heightMode('standard' | 'adaptive' | 'autoHeight') = 'standard'
The calculation mode of table row height, which can be 'standard' (standard mode), 'adaptive' (adaptive container height mode) or 'autoHeight' (automatic row height mode), the default is 'standard'.
- 'standard': use
defaultRowHeight
anddefaultHeaderRowHeight
as row height. - 'adaptive': Use the height of the container to assign the height of each row.
- 'autoHeight': Automatically calculate line height based on content, based on fontSize and lineHeight(font height),include padding. The related collocation setting item
autoWrapText
automatically wraps the line, and the line height can be calculated according to the content of the multi-line text after the line wrap.
PivotChart.widthAdaptiveMode('only-body' | 'all') = 'only-body'
The width adaptation strategy in adaptive mode, the default is 'only-body'.
- 'only-body': Only the columns in the body part participate in the width adaptation calculation, and the width of the header part remains unchanged.
- 'all': All columns participate in width adaptation calculation.
PivotChart.heightAdaptiveMode('only-body' | 'all') = 'only-body'
The height adaptable strategy in adaptive mode, default is 'only-body'.
- 'only-body': Only the rows in the body part participate in the height adaptation calculation, and the height of the header part remains unchanged.
- 'all': All columns participate in the height adaptation calculation.
PivotChart.columnWidthComputeMode('normal' | 'only-header' | 'only-body') = 'normal'
When calculating the content width, the limited area participates in the calculation:
- 'only-header': Only the header content is calculated.
- 'only-body': Only the body cell content is calculated.
- 'normal': Normal calculation, that is, calculating the header and body cell contents.
PivotChart.autoWrapText
Whether to automatically wrap text
PivotChart.autoFillWidth
The configuration item autoFillWidth is used to control whether to automatically fill the container width. Different from the effect of adaptive
adaptive container of width mode widthMode
, autoFillWidth controls that only when the number of columns is small, the table can automatically fill the width of the container, but when the number of columns exceeds the container, according to the actual situation A scroll bar can appear to set the column width.
PivotChart.autoFillHeight
The configuration item autoFillHeight is used to control whether to automatically fill the container height. Different from the effect of adaptive
adaptive container of height mode heightMode
, autoFillHeight controls that only when the number of rows is small, the table can automatically fill the height of the container, but when the number of rows exceeds the container, according to the actual situation A scroll bar can appear to set the row height.
PivotChart.maxCharactersNumber = 200
The maximum number of characters that can be displayed in a cell, default is 200
PivotChart.maxOperatableRecordCount
Maximum number of operable records, such as the maximum number of data entries that can be copied in a copy operation
PivotChart.limitMaxAutoWidth = 450
Specify the maximum column width when calculating column width, which can be boolean or a specific value. Default is 450.
PivotChart.limitMinWidth = 10
Minimum column width limit. If set to true, the column width will be limited to a minimum of 10px when dragging to change the column width. If set to false, there will be no limit. Or set it directly to some numeric value. Default is 10px.
PivotChart.frozenColCount
The number of frozen columns
PivotChart.frozenRowCount
The number of frozen columns(including the header)
PivotChart.rightFrozenColCount
Freeze Columns Right
PivotChart.bottomFrozenRowCount
number of frozen rows at the bottom
PivotChart.allowFrozenColCount
Allow the number of frozen columns, indicating how many columns will show the frozen operation button (effective for basic tables)
PivotChart.showFrozenIcon = true
Whether to show the fixed column pin icon, effective for basic tables
PivotChart.defaultRowHeight = 40
Default row height
PivotChart.defaultHeaderRowHeight
Default row height for list header, can be set row by row. If not set, defaultRowHeight is used.
PivotChart.defaultColWidth = 80
Default column width value
PivotChart.defaultHeaderColWidth
Default column width for row headers, can be set column by column. If not set, defaultColWidth is used.
PivotChart.keyboardOptions
Shortcut key function settings, specific configuration items:
PivotChart.eventOptions
Issue settings related to event triggering, specific configuration items:
PivotChart.excelOptions
Align excel advanced capabilities
PivotChart.columnResizeMode = 'all'
Mouse hover over the cell bottom border can drag and adjust row height. This operation can trigger the following range:
- 'all' The entire row, including header and body cells, can adjust row height
- 'none' Disable adjustment
- 'header' Only adjustable in header cells
- 'body' Only adjustable in body cells
PivotChart.dragHeaderMode = 'none'
The switch of dragging the header to move the position. After selecting a cell, drag the cell to trigger the move. The range of replaceable cells is limited:
- 'all' All headers can be swapped
- 'none' Cannot be swapped
- 'column' Only the column header can be swapped
- 'row' Only the row header can be swapped
PivotChart.hover
Hover interaction configuration, specific configuration items as follows:
PivotChart.select
Cell selection interaction configuration, specific configuration items as follows:
PivotChart.theme
Table theme, which has built-in theme names DEFAULT, ARCO, BRIGHT, DARK, SIMPLIFY. The configuration can be made using built-in types or directly with string names:
VTable.themes.DEFAULT
VTable.themes.ARCO;
VTable.themes.BRIGHT
VTable.themes.DARK
VTable.themes.SIMPLIFY
or
'default'
'arco'
'bright'
'dark'
'simplify'
You can also extend built-in themes, for example, change the font based on the ARCO theme:
VTable.themes.ARCO.extend({
fontSize: '14px',
fontFamily: 'PingFangSC'
})
Or you can directly define a custom theme:
{
defaultStyle:{
borderLineWidth:0,
},
headerStyle:{
frameStyle:{
borderColor:'blue',
borderLineWidth:[0,0,1,0]
}
},
rowHeaderStyle:{
frameStyle:{
borderColor:'blue',
borderLineWidth:[0,1,0,0]
}
},
cornerHeaderStyle:{
frameStyle:{
borderColor:'blue',
borderLineWidth:[0,1,1,0]
}
}
}
PivotChart.menu
Configuration related to the drop-down menu. Disappearance timing: automatically disappears after clicking the area outside the menu. Specific configuration items as follows:
PivotChart.title
表格标题配置。
PivotChart.emptyTip
Table empty data prompt.
You can directly configure boolean
or IEmptyTip
type objects. The default value is false, which means no prompt information is displayed.
The IEmptyTip type is defined as follows:
PivotChart.tooltip
Tooltip related configuration. Specific configuration items are as follows:
PivotChart.legends
Legend configuration, currently providing three types of legends, namely discrete legend ('discrete'
), continuous color legend ('color'
), and continuous size legend ('size'
).
PivotChart.legends-discrete
Discrete legend configuration. Please refer to Configuration and Legend demo in VChart
PivotChart.legends-color
Continuous color legend configuration.
TODO: Add discrete legend illustration
PivotChart.legends-size
Continuous size legend configuration.
TODO: Add discrete legend illustration
PivotChart.axes
Specifically the same as the axis configuration of VChart, it can support linear axis, discrete axis and time axis.
Supports axis configuration in four directions. By default, the upper axis is at the last row of the column header, the lower axis is at the frozen row at the bottom of the table, the left axis is at the last column of the row header, and the upper axis is at the rightmost fixed column of the header. If axes of a certain orientation are also configured in the spec of the indicator, the priority in the spec is higher.
Example:
{
axes: [
{
orient: 'bottom'
},
{
orient: 'left',
title: {
visible: true
}
},
{
orient: 'right',
visible: true,
grid: {
visible: false
}
}
]
}
PivotChart.customRender
Custom rendering in function or object form. Type: ICustomRenderFuc | ICustomRenderObj
.
Where ICustomRenderFuc is defined as:
type ICustomRenderFuc = (args: CustomRenderFunctionArg) => ICustomRenderObj;
The type declaration for callback function argument CustomRenderFunctionArg is:
interface CustomRenderFunctionArg {
row: number;
col: number;
table: TableAPI;
/**Formatted value */
value: string|number;
/**Original value */
dataValue: string|number;
rect?: RectProps;
}
The definition of ICustomRenderObj is as follows:
export type ICustomRenderObj = {
/** Configured type collection */
elements: ICustomRenderElements;
/** Desired cell height */
expectedHeight: number;
/** Expected cell width */
expectedWidth: number;
/**
* Do you still need to render content by default? Only if the configuration is true, it will be drawn. By default, it will not be drawn.
*/
renderDefault?: boolean;
};
Detailed configuration instructions are as follows:
PivotChart.overscrollBehavior = 'auto'
Table scrolling behavior, can be set: 'auto'|'none', the default value is 'auto'.
'auto': Trigger the browser's default behavior when the table scrolls to the top or bottom;
'none': don't triggers the browser's default behavior when the table scrolls to the top or bottom;
PivotChart.customMergeCell
Customize cell merging rules. When the incoming row and column numbers are within the target area, the merging rules are returned:
- text: Merge text in cells
- range: merged range
- style: style of merged cells Example:
customMergeCell: (col, row, table) => {
if (col > 0 && col < 8 && row > 7 && row < 11) {
return {
text: 'merge text',
range: {
start: {
col: 1,
row: 8
},
end: {
col: 7,
row: 10
}
},
style: {
bgColor: '#ccc'
}
};
}
}
PivotChart.customCellStyle
{
customCellStyle: {id: string;style: ColumnStyleOption}[]
}
Custom cell style
- id: the unique id of the custom style
- style: Custom cell style, which is the same as the
style
configuration incolumn
. The final rendering effect is the fusion of the original style of the cell and the custom style.
PivotChart.customCellStyleArrangement
{
customCellStyleArrangement:
{
cellPosition: {
row?: number;
col?: number;
range?: {
start: {row: number; col: number};
end: {row: number; col: number}
}
};
customStyleId: string}[]
}
Custom cell style assignment
- cellPosition: cell position information, supports configuration of single cells and cell areas
- Single cell:
{ row: number, column: number }
- Cell range:
{ range: { start: { row: number, column: number }, end: { row: number, column: number} } }
- Single cell:
- customStyleId: Custom style id, the same as the id defined when registering the custom style
PivotChart.editor
Global configuration cell editor
editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);
Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts .
PivotChart.headerEditor
Global configuration table header display title title editor
headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);
PivotChart.editCellTrigger('doubleclick' | 'click' | 'api' |'keydown') = 'doubleclick'
The trigger timing for entering the editing state.
/** Edit triggering time: double click event | single click event | api to manually start editing | keydown event. Default is double click 'doubleclick' */
editCellTrigger?:'doubleclick' | 'click' | 'api' | 'keydown' | ('doubleclick' | 'click' | 'api' | 'keydown')[];
PivotChart.rowSeriesNumber
set row serial number.
PivotChart.enableLineBreak
Whether to enable line break, the default is false.
PivotChart.clearDOM = true
Whether to clear the container DOM.
PivotChart.canvasWidth
Directly set the width of the canvas. Do not determine the size of the table based on the container width and height.
PivotChart.canvasHeight
Directly set the height of the canvas. Do not determine the size of the table based on the width and height of the container.
PivotChart.animationAppear
Table entry animation configuration.
animationAppear?: boolean | {
type?: 'all' | 'one-by-one';
direction?: 'row' | 'column';
duration?: number;
delay?: number;
};
You can configure true to enable the default animation, or you can configure the animation parameters:
type
The type of the entry animation, currently supportsall
andone-by-one
, and the default isone-by-one
direction
The direction of the entry animation, currently supportsrow
andcolumn
, and the default isrow
duration
The duration of a single animation, in milliseconds, forone-by-one
, it is the duration of one animation, and the default is 500delay
The delay of the animation, in milliseconds; forone-by-one
, it is the time difference between the two animations, forall
, it is the delay of all animations, and the default is 0
PivotChart.formatCopyValue((value: string) => string)
Format the value when copying.