VTable Documentation
repository·develop·Indexed 25 days ago
https://github.com/visactor/vtableA high-performance multidimensional data analysis table and grid rendering engine built on VRender. VTable supports millions of data points and integrates with VChart. The ecosystem includes specialized packages such as @visactor/react-vtable, @visactor/vtable-sheet for workbook functionality, @visactor/vtable-calendar, @visactor/vtable-gantt, and various plugins for search, history (undo/redo), and data export to CSV or Excel.
What's inside VTable
- VTable-Sheet is a spreadsheet component built on top of VTable that provides an Excel-like interactive experience in web applications. It is designed for scenarios requiring advanced spreadsheet functionality such as data analysis, financial reporting, and project management.
Use Gantt charts with @visactor/vtable-gantt
developThe@visactor/vtable-ganttpackage provides Gantt chart functionality, introduced in version 1.7.0.VTable Package Ecosystem Overview
developThe VTable repository contains several specialized packages for different use cases:
@visactor/vtable: The core engine.@visactor/vtable-gantt: Gantt chart component.@visactor/vtable-editors: Table editor component.@visactor/vtable-plugins: Table plugin functionality.@visactor/vtable-export: Export tools.@visactor/vtable-search: Search tools.@visactor/react-vtable: React component wrapper.@visactor/vue-vtable: Vue component wrapper.
Understand Pivot Table concepts in VTable
developVTable Pivot Tables (multidimensional analysis tables) allow you to display relationships between multiple Dimensions by placing them in rows and columns to analyze Metrics (indicators).
Key concepts include:
- Dimensions: Perspectives used to classify data (e.g.,
country,category). - Dimension hierarchy: Levels within a dimension (e.g., a Date dimension having
year->month->daylevels). - Dimension members: The specific values within a dimension (e.g.,
January,February). - Metric (Indicator): The quantitative data being measured (e.g.,
sales,costs,profits). - Row Tree: A hierarchical tree structure representing row dimensions.
- Column Tree: A hierarchical tree structure representing column dimensions.
- Corner: The intersection cell of the row and column headers, typically used for metric headers.
- Dimensions: Perspectives used to classify data (e.g.,
Understand Master-Detail rendering principles
developThe Master-Detail plugin uses several technical strategies to ensure performance and visual consistency:
- ViewBox Positioning: Uses VTable's ViewBox mechanism for precise positioning of detail grids within expanded rows.
- Canvas Shared Rendering: Detail grids share the same Canvas surface as the master table to avoid multi-canvas overhead.
- Dynamic Row Height: Expanded rows have their height adjusted dynamically to create space for the detail grid, while keeping the original height of
CellGroupsunchanged. - Scroll Optimization: Automatically sets
scrollEventAlwaysTriggertotrueto ensure detail grids scroll correctly when reaching table boundaries.
Important Concept: Sub-tables do not have true independent row numbers. Visually, they appear as separate rows, but they are actually part of the expanded rows of the master table. The master table's row numbers remain continuous.
Features of VTable-Sheet
developVTable-Sheet provides several advanced spreadsheet capabilities:
- Multi-sheet Management: Create and manage multiple sheets to organize large datasets.
- Formula Calculation: Supports Excel-like formulas including
SUM,AVERAGE,MAX,MIN, andCOUNT. - Data Filtering: Filter data by specific conditions or value lists.
- Table Editing: Direct cell content editing.
- Data Import/Export: Support for CSV and XLSX formats.
- Data Persistence: Save and restore table states.
- Cell Merging: Merge cells for flexible presentation.
- Frozen Rows and Columns: Freeze headers for easier navigation of large datasets.
- Custom Menus: Extend functionality via a customizable top menu bar.
VTable-Gantt Overview
developVTable-Gantt is a Gantt chart component library within the VisActor visualization ecosystem. It is built on top of the VTable component and the VRender visualization engine. It is designed for project management and task tracking, offering:
- High Performance: Fast computation and rendering for large-scale project data.
- Flexible Layout: Customizable timelines, task bar styles, and layouts.
- Powerful Interaction: Support for dragging, scaling, and editing tasks.
- Rich Visualization: Custom rendering for information cells and task bars, including tree structure support.
Enable Smart Zoom in Gantt Charts
developThe Gantt chart smart zoom feature allows for multi-level timeline displays that automatically switch time scale combinations based on the current zoom level. This provides an optimal viewing experience across different time granularities.
To enable this, configure the
timelineHeader.zoomScale.enabledproperty and define the desired scale levels usingtimelineHeader.zoomScale.levels.Dynamically set min and max values for progressBar cell type
developWhen using the
progressbarcell type in VTable, you can set theminandmaxconfiguration options as functions instead of static values. This allows you to derive the minimum and maximum bounds for the progress bar from the specific data record of the current row.To implement this, use the
argsparameter provided to the function. You can access the current row's data usingargs.table.getCellOriginRecord(args.col, args.row).Configure Undo/Redo UI and history depth
developVTable-Sheet provides workbook-level undo/redo for cell edits, sheet management, and more.
- Enable/Disable UI: Use
undoRedo: { show: boolean }in the configuration. IfmainMenu.showis true, buttons appear in the menu bar; otherwise, they appear at the top-left. - Shortcuts: Use
Ctrl/Cmd + Zfor undo andCtrl/Cmd + Shift + ZorCtrl/Cmd + Yfor redo. - Customizing History: To change the history depth, pass
HistoryPluginviaVTablePluginModulesand configuremaxHistoryandenableCompressioninmoduleOptions.
import { HistoryPlugin } from '@visactor/vtable-plugins'; // Example: Customizing history depth const sheetInstance = new VTableSheet(document.getElementById('container'), { undoRedo: { show: true }, VTablePluginModules: [ { module: HistoryPlugin, moduleOptions: { maxHistory: 200, enableCompression: false } } ], sheets: [/* ... */] });- Enable/Disable UI: Use
Quick Start with VTable-Search
developTo use
SearchComponent, first initialize aVTable.ListTableinstance with your data and columns, then pass that instance to theSearchComponentconstructor. You can enableautoJumpto automatically move the selection when searching.const option = { container: document.getElementById(CONTAINER_ID), records, columns, }; const tableInstance = new VTable.ListTable(option); window.tableInstance = tableInstance; const search = new SearchComponent({ table: tableInstance, autoJump: true }); window.search = search;Fix missing React 19 HostConfig callbacks
developIf you encounter
TypeError: resolveEventTimeStamp is not a functionorTypeError: trackSchedulerEvent is not a functionin a React 19 environment, yourHostConfigis missing required React 19 callbacks.Required Callbacks:
trackSchedulerEventresolveEventTyperesolveEventTimeStampshouldAttemptEagerTransition
Fix: Ensure you are using a version of
@visactor/react-vtablethat includes the patch for these callbacks in itsHostConfigimplementation.