syncfusion-winforms-pivot-chart

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Implementing Syncfusion Pivot Chart

实现Syncfusion Pivot Chart

A comprehensive guide for implementing the Syncfusion Pivot Chart control in Windows Forms applications. The Pivot Chart provides interactive visualization of multidimensional pivot data with drill-down capabilities, supporting 11+ chart types and advanced features like grouping bar, field list, and Excel export.
这是一份在Windows Forms应用中实现Syncfusion Pivot Chart控件的完整指南。Pivot Chart可对多维透视数据进行交互式可视化,具备下钻能力,支持11+种图表类型,还包含分组栏、字段列表、Excel导出等高级功能。

When to Use This Skill

何时使用本技能

Use this skill when you need to:
  • Visualize pivot data in graphical format with multiple chart types
  • Implement drill-down/drill-up functionality to navigate through hierarchical data levels
  • Create business intelligence dashboards with interactive pivot visualizations
  • Analyze multidimensional data from IEnumerable lists or DataTables
  • Build OLAP visualization interfaces for analytical applications
  • Add interactive data exploration with grouping bar and pivot field list
  • Export pivot charts to Excel format for reporting
  • Display hierarchical sales, financial, or analytical data in chart format
  • Implement Excel-like pivot chart functionality in Windows Forms applications
  • Create dynamic charts that update based on pivot field selections
当你需要完成以下需求时可以使用本技能:
  • 以多种图表类型的图形格式可视化透视数据
  • 实现下钻/上钻功能,用于在层级数据层级之间导航
  • 创建带有交互式透视可视化能力的商业智能仪表盘
  • 分析来自IEnumerable列表或DataTables的多维数据
  • 为分析类应用构建OLAP可视化界面
  • 通过分组栏和透视字段列表实现交互式数据探索
  • 将透视图表导出为Excel格式用于报表制作
  • 以图表格式展示分层的销售、财务或分析数据
  • 在Windows Forms应用中实现类Excel的透视图表功能
  • 创建可根据透视字段选择动态更新的动态图表

Component Overview

组件概述

The Syncfusion Pivot Chart is a lightweight, high-performance control that reads pivot information and visualizes it in graphical format. It provides:
  • 11+ Chart Types: Line, Spline, Column, Area, Spline Area, Stacking Area, Stacking Column, Stacking Area 100, Stacking Column 100, Step Line, Step Area
  • Drill Support: Navigate through inner levels of data hierarchy with drill-down/drill-up
  • Data Binding: Support for IEnumerable lists and DataTable sources
  • Pivot Table Field List: Built-in pivot schema designer similar to Microsoft Excel
  • Grouping Bar: Interactive drag-and-drop grouping of data fields
  • Legend: Color-coded series identification
  • Export: Export to Excel format
  • Zooming and Scrolling: Interactive data exploration
  • Touch Support: Touch-friendly for tablets and touch-enabled devices
  • Real-time Updates: Automatic chart updates when data changes
Syncfusion Pivot Chart是一款轻量、高性能的控件,可读取透视信息并以图形格式进行可视化。它提供以下能力:
  • 11+种图表类型: 折线图、样条图、柱形图、面积图、样条面积图、堆叠面积图、堆叠柱形图、100%堆叠面积图、100%堆叠柱形图、阶梯线图、阶梯面积图
  • 下钻支持: 通过下钻/上钻功能在数据层级的内部层级之间导航
  • 数据绑定: 支持IEnumerable列表和DataTable数据源
  • 透视表字段列表: 内置类似Microsoft Excel的透视表结构设计器
  • 分组栏: 支持交互式拖放实现数据字段分组
  • 图例: 颜色编码的系列标识
  • 导出: 支持导出为Excel格式
  • 缩放与滚动: 交互式数据探索能力
  • 触控支持: 适配平板和触控设备的友好交互
  • 实时更新: 数据变化时自动更新图表

Documentation and Navigation Guide

文档与导航指南

Getting Started

入门指南

📄 Read: references/getting-started.md
  • Assembly deployment and dependencies
  • Adding control via designer, code, or Syncfusion Reference Manager
  • Licensing requirements (v16.2.0.x+)
  • Basic initialization and first data binding
  • ItemSource, PivotAxis, PivotLegend, and PivotCalculations setup
📄 阅读: references/getting-started.md
  • 程序集部署与依赖项
  • 通过设计器、代码或Syncfusion引用管理器添加控件
  • 许可要求(v16.2.0.x及以上版本)
  • 基础初始化与首次数据绑定
  • ItemSource、PivotAxis、PivotLegend和PivotCalculations的设置

Data Binding

数据绑定

📄 Read: references/data-binding.md
  • Binding IEnumerable lists
  • Binding DataTable sources
  • Configuring ItemSource property
  • Setting up PivotAxis for hierarchical data
  • Configuring PivotLegend for series categorization
  • Setting up PivotCalculations for data aggregation
  • Real-time updates with EnableUpdating
  • Performance optimization with BeginUpdate/EndUpdate
📄 阅读: references/data-binding.md
  • 绑定IEnumerable列表
  • 绑定DataTable数据源
  • 配置ItemSource属性
  • 为层级数据设置PivotAxis
  • 配置PivotLegend用于系列分类
  • 设置PivotCalculations用于数据聚合
  • 通过EnableUpdating实现实时更新
  • 通过BeginUpdate/EndUpdate优化性能

Chart Types

图表类型

📄 Read: references/chart-types.md
  • Overview of 11 supported chart types
  • Line, Spline, Step Line charts
  • Column and Stacking Column charts
  • Area, Spline Area, Step Area charts
  • Stacking Area and Stacking Column (100%) charts
  • Switching chart types dynamically
  • ChartTypes enumeration
  • Choosing appropriate chart type for your data
📄 阅读: references/chart-types.md
  • 11种支持的图表类型概述
  • 折线图、样条图、阶梯线图
  • 柱形图和堆叠柱形图
  • 面积图、样条面积图、阶梯面积图
  • 堆叠面积图和100%堆叠柱形图
  • 动态切换图表类型
  • ChartTypes枚举
  • 为你的数据选择合适的图表类型

Drill Operations

下钻操作

📄 Read: references/drill-operations.md
  • Enabling drill-down/drill-up functionality
  • AllowDrillDown property configuration
  • Navigating through hierarchical data levels
  • Using expanders for drill operations
  • Programmatic drill operations
  • User interactions and drill events
📄 阅读: references/drill-operations.md
  • 启用下钻/上钻功能
  • AllowDrillDown属性配置
  • 在层级数据层级之间导航
  • 使用扩展器执行下钻操作
  • 程序化下钻操作
  • 用户交互与下钻事件

Grouping Bar

分组栏

📄 Read: references/grouping-bar.md
  • Enabling and configuring grouping bar
  • Interactive drag-and-drop field grouping
  • Field manipulation and rearrangement
  • Visibility and customization options
  • User interactions with grouping bar
📄 阅读: references/grouping-bar.md
  • 启用与配置分组栏
  • 交互式拖放字段分组
  • 字段操作与重排
  • 可见性与自定义选项
  • 用户与分组栏的交互

Pivot Axis Configuration

透视轴配置

📄 Read: references/pivot-axis.md
  • Understanding PivotAxis property
  • Adding PivotItem objects to axis
  • FieldMappingName for data field binding
  • TotalHeader for aggregate displays
  • Multiple axis items for hierarchical structure
  • Axis customization options
📄 阅读: references/pivot-axis.md
  • 理解PivotAxis属性
  • 向轴添加PivotItem对象
  • 用于数据字段绑定的FieldMappingName
  • 聚合展示的TotalHeader
  • 层级结构的多轴项
  • 轴自定义选项

Pivot Table Field List

透视表字段列表

📄 Read: references/pivot-table-field-list.md
  • Built-in pivot schema designer
  • Microsoft Excel-like field list interface
  • Enabling and displaying field list
  • Drag-and-drop field configuration
  • Filter setup and management
  • Calculation field configuration
  • User interactions with field list
📄 阅读: references/pivot-table-field-list.md
  • 内置透视表结构设计器
  • 类Microsoft Excel的字段列表界面
  • 启用与展示字段列表
  • 拖放字段配置
  • 筛选设置与管理
  • 计算字段配置
  • 用户与字段列表的交互

Legend

图例

📄 Read: references/legend.md
  • Configuring PivotLegend property
  • Color coding for series identification
  • Legend positioning and layout
  • Visibility and customization options
  • Series labels and formatting
📄 阅读: references/legend.md
  • 配置PivotLegend属性
  • 用于系列标识的颜色编码
  • 图例定位与布局
  • 可见性与自定义选项
  • 系列标签与格式化

Sorting

排序

📄 Read: references/sorting.md
  • Sorting pivot data in charts
  • Ascending and descending sort orders
  • Multiple field sorting
  • Custom sort logic
  • Sort configuration options
📄 阅读: references/sorting.md
  • 对图表中的透视数据排序
  • 升序与降序排序
  • 多字段排序
  • 自定义排序逻辑
  • 排序配置选项

Export

导出

📄 Read: references/export.md
  • Exporting pivot charts to Excel
  • Export configuration and options
  • File format settings
  • Programmatic export operations
  • Customizing exported output
📄 阅读: references/export.md
  • 将透视图表导出为Excel
  • 导出配置与选项
  • 文件格式设置
  • 程序化导出操作
  • 自定义导出结果

Zooming and Scrolling

缩放与滚动

📄 Read: references/zooming-scrolling.md
  • Interactive zoom functionality
  • Scroll support for large datasets
  • Mouse wheel zoom operations
  • Zoom configuration and customization
  • Scrollbar appearance and behavior
📄 阅读: references/zooming-scrolling.md
  • 交互式缩放功能
  • 大数据集的滚动支持
  • 鼠标滚轮缩放操作
  • 缩放配置与自定义
  • 滚动条外观与行为

Touch Support

触控支持

📄 Read: references/touch-support.md
  • Touch gesture support for tablets
  • Touch interactions (tap, swipe, pinch)
  • Optimizing for touch-enabled devices
  • Touch gesture configuration
  • Mobile and tablet considerations
📄 阅读: references/touch-support.md
  • 平板的触控手势支持
  • 触控交互(点击、滑动、捏合)
  • 适配触控设备的优化
  • 触控手势配置
  • 移动端与平板适配注意事项

Appearance and Customization

外观与自定义

📄 Read: references/appearance-customization.md
  • Chart area customization
  • Series styling and colors
  • Color palette configuration
  • Print support and settings
  • Theme and visual customization
  • Custom styling options
📄 阅读: references/appearance-customization.md
  • 图表区域自定义
  • 系列样式与颜色
  • 配色方案配置
  • 打印支持与设置
  • 主题与视觉自定义
  • 自定义样式选项

Troubleshooting

故障排查

📄 Read: references/troubleshooting.md
  • Common issues and solutions
  • Data binding errors and fixes
  • Performance optimization tips
  • How to enable drill-down
  • How to print the pivot chart
  • How to set custom color palettes
  • Debugging and diagnostic tips
📄 阅读: references/troubleshooting.md
  • 常见问题与解决方案
  • 数据绑定错误与修复
  • 性能优化技巧
  • 如何启用下钻功能
  • 如何打印透视图表
  • 如何设置自定义配色方案
  • 调试与诊断技巧

Quick Start Example

快速入门示例

Minimal Pivot Chart Implementation

最简Pivot Chart实现

csharp
using System;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.PivotChart;
using Syncfusion.PivotAnalysis.Base;

namespace PivotChartDemo
{
    public partial class Form1 : Form
    {
        private PivotChart pivotChart1;
        
        public Form1()
        {
            InitializeComponent();
            
            // Register Syncfusion license (required for v16.2.0.x+)
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY");
            
            // Initialize Pivot Chart
            pivotChart1 = new PivotChart();
            pivotChart1.Dock = DockStyle.Fill;
            
            // Bind data source
            pivotChart1.ItemSource = ProductSales.GetSalesData();
            
            // Configure Pivot Axis (hierarchical structure)
            pivotChart1.PivotAxis.Add(new PivotItem 
            { 
                FieldMappingName = "Product", 
                TotalHeader = "Total" 
            });
            pivotChart1.PivotAxis.Add(new PivotItem 
            { 
                FieldMappingName = "Country", 
                TotalHeader = "Total" 
            });
            pivotChart1.PivotAxis.Add(new PivotItem 
            { 
                FieldMappingName = "State", 
                TotalHeader = "Total" 
            });
            
            // Configure Pivot Legend (series categorization)
            pivotChart1.PivotLegend.Add(new PivotItem 
            { 
                FieldMappingName = "Date", 
                TotalHeader = "Total" 
            });
            
            // Configure Calculations (data aggregation)
            pivotChart1.PivotCalculations.Add(new PivotComputationInfo 
            { 
                FieldName = "Quantity", 
                Format = "#,##0" 
            });
            
            // Set chart type
            pivotChart1.ChartTypes = PivotChartTypes.Column;
            
            // Enable drill-down
            pivotChart1.AllowDrillDown = true;
            
            // Add to form
            this.Controls.Add(pivotChart1);
        }
    }
}
csharp
using System;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.PivotChart;
using Syncfusion.PivotAnalysis.Base;

namespace PivotChartDemo
{
    public partial class Form1 : Form
    {
        private PivotChart pivotChart1;
        
        public Form1()
        {
            InitializeComponent();
            
            // Register Syncfusion license (required for v16.2.0.x+)
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY");
            
            // Initialize Pivot Chart
            pivotChart1 = new PivotChart();
            pivotChart1.Dock = DockStyle.Fill;
            
            // Bind data source
            pivotChart1.ItemSource = ProductSales.GetSalesData();
            
            // Configure Pivot Axis (hierarchical structure)
            pivotChart1.PivotAxis.Add(new PivotItem 
            { 
                FieldMappingName = "Product", 
                TotalHeader = "Total" 
            });
            pivotChart1.PivotAxis.Add(new PivotItem 
            { 
                FieldMappingName = "Country", 
                TotalHeader = "Total" 
            });
            pivotChart1.PivotAxis.Add(new PivotItem 
            { 
                FieldMappingName = "State", 
                TotalHeader = "Total" 
            });
            
            // Configure Pivot Legend (series categorization)
            pivotChart1.PivotLegend.Add(new PivotItem 
            { 
                FieldMappingName = "Date", 
                TotalHeader = "Total" 
            });
            
            // Configure Calculations (data aggregation)
            pivotChart1.PivotCalculations.Add(new PivotComputationInfo 
            { 
                FieldName = "Quantity", 
                Format = "#,##0" 
            });
            
            // Set chart type
            pivotChart1.ChartTypes = PivotChartTypes.Column;
            
            // Enable drill-down
            pivotChart1.AllowDrillDown = true;
            
            // Add to form
            this.Controls.Add(pivotChart1);
        }
    }
}

Common Patterns

常用模式

Pattern 1: Binding to IEnumerable Collection

模式1:绑定到IEnumerable集合

csharp
using System.Collections.Generic;

// Data model
public class SalesData
{
    public string Product { get; set; }
    public string Region { get; set; }
    public string Quarter { get; set; }
    public int Quantity { get; set; }
    public decimal Amount { get; set; }
}

// Create and bind data
private void BindPivotChart()
{
    List<SalesData> salesList = new List<SalesData>
    {
        new SalesData { Product = "Laptop", Region = "North", Quarter = "Q1", Quantity = 50, Amount = 50000 },
        new SalesData { Product = "Laptop", Region = "South", Quarter = "Q1", Quantity = 40, Amount = 40000 },
        new SalesData { Product = "Mouse", Region = "North", Quarter = "Q1", Quantity = 200, Amount = 6000 },
        // Add more data...
    };
    
    pivotChart1.ItemSource = salesList;
    
    // Configure fields
    pivotChart1.PivotAxis.Add(new PivotItem { FieldMappingName = "Product", TotalHeader = "Total" });
    pivotChart1.PivotLegend.Add(new PivotItem { FieldMappingName = "Quarter", TotalHeader = "Total" });
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo 
    { 
        FieldName = "Amount", 
        Format = "C",
        SummaryType = SummaryType.DoubleTotalSum 
    });
}
csharp
using System.Collections.Generic;

// Data model
public class SalesData
{
    public string Product { get; set; }
    public string Region { get; set; }
    public string Quarter { get; set; }
    public int Quantity { get; set; }
    public decimal Amount { get; set; }
}

// Create and bind data
private void BindPivotChart()
{
    List<SalesData> salesList = new List<SalesData>
    {
        new SalesData { Product = "Laptop", Region = "North", Quarter = "Q1", Quantity = 50, Amount = 50000 },
        new SalesData { Product = "Laptop", Region = "South", Quarter = "Q1", Quantity = 40, Amount = 40000 },
        new SalesData { Product = "Mouse", Region = "North", Quarter = "Q1", Quantity = 200, Amount = 6000 },
        // Add more data...
    };
    
    pivotChart1.ItemSource = salesList;
    
    // Configure fields
    pivotChart1.PivotAxis.Add(new PivotItem { FieldMappingName = "Product", TotalHeader = "Total" });
    pivotChart1.PivotLegend.Add(new PivotItem { FieldMappingName = "Quarter", TotalHeader = "Total" });
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo 
    { 
        FieldName = "Amount", 
        Format = "C",
        SummaryType = SummaryType.DoubleTotalSum 
    });
}

Pattern 2: Switching Chart Types Dynamically

模式2:动态切换图表类型

csharp
// Add buttons or menu items to switch chart types
private void btnLineChart_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.Line;
}

private void btnColumnChart_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.Column;
}

private void btnAreaChart_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.Area;
}

private void btnStackingColumn_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.StackingColumn;
}
csharp
// Add buttons or menu items to switch chart types
private void btnLineChart_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.Line;
}

private void btnColumnChart_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.Column;
}

private void btnAreaChart_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.Area;
}

private void btnStackingColumn_Click(object sender, EventArgs e)
{
    pivotChart1.ChartTypes = PivotChartTypes.StackingColumn;
}

Pattern 3: Hierarchical Drill-Down Configuration

模式3:层级下钻配置

csharp
// Enable drill-down with multiple hierarchy levels
private void ConfigureDrillDown()
{
    pivotChart1.AllowDrillDown = true;
    
    // Define hierarchy: Category → Product → Region → State
    pivotChart1.PivotAxis.Clear();
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "Category", 
        TotalHeader = "All Categories" 
    });
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "Product", 
        TotalHeader = "All Products" 
    });
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "Region", 
        TotalHeader = "All Regions" 
    });
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "State", 
        TotalHeader = "All States" 
    });
}
csharp
// Enable drill-down with multiple hierarchy levels
private void ConfigureDrillDown()
{
    pivotChart1.AllowDrillDown = true;
    
    // Define hierarchy: Category → Product → Region → State
    pivotChart1.PivotAxis.Clear();
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "Category", 
        TotalHeader = "All Categories" 
    });
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "Product", 
        TotalHeader = "All Products" 
    });
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "Region", 
        TotalHeader = "All Regions" 
    });
    pivotChart1.PivotAxis.Add(new PivotItem 
    { 
        FieldMappingName = "State", 
        TotalHeader = "All States" 
    });
}

Pattern 4: Real-Time Data Updates

模式4:实时数据更新

csharp
// Enable automatic updates when data changes
private void ConfigureRealTimeUpdates()
{
    // Enable automatic chart updates
    pivotChart1.EnableUpdating = true;
    
    // Bind to observable collection or implement INotifyPropertyChanged
    var salesData = new BindingList<SalesData>(GetSalesData());
    pivotChart1.ItemSource = salesData;
    
    // Now any changes to salesData will automatically update the chart
}

// For bulk updates, use BeginUpdate/EndUpdate
private void BulkDataUpdate()
{
    pivotChart1.BeginUpdate();
    
    try
    {
        // Perform multiple data operations
        var data = (BindingList<SalesData>)pivotChart1.ItemSource;
        for (int i = 0; i < 100; i++)
        {
            data.Add(new SalesData { /* ... */ });
        }
    }
    finally
    {
        pivotChart1.EndUpdate(); // Chart updates once after all changes
    }
}
csharp
// Enable automatic updates when data changes
private void ConfigureRealTimeUpdates()
{
    // Enable automatic chart updates
    pivotChart1.EnableUpdating = true;
    
    // Bind to observable collection or implement INotifyPropertyChanged
    var salesData = new BindingList<SalesData>(GetSalesData());
    pivotChart1.ItemSource = salesData;
    
    // Now any changes to salesData will automatically update the chart
}

// For bulk updates, use BeginUpdate/EndUpdate
private void BulkDataUpdate()
{
    pivotChart1.BeginUpdate();
    
    try
    {
        // Perform multiple data operations
        var data = (BindingList<SalesData>)pivotChart1.ItemSource;
        for (int i = 0; i < 100; i++)
        {
            data.Add(new SalesData { /* ... */ });
        }
    }
    finally
    {
        pivotChart1.EndUpdate(); // Chart updates once after all changes
    }
}

Pattern 5: Multiple Calculations with Formatting

模式5:带格式化的多计算项配置

csharp
// Display multiple aggregated values with custom formatting
private void ConfigureMultipleCalculations()
{
    pivotChart1.PivotCalculations.Clear();
    
    // Total quantity
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo
    {
        FieldName = "Quantity",
        Format = "#,##0",
        SummaryType = SummaryType.DoubleTotalSum,
        FieldHeader = "Total Qty"
    });
    
    // Total amount (currency)
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo
    {
        FieldName = "Amount",
        Format = "C2",
        SummaryType = SummaryType.DoubleTotalSum,
        FieldHeader = "Total Amount"
    });
    
    // Average price
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo
    {
        FieldName = "UnitPrice",
        Format = "C2",
        SummaryType = SummaryType.DoubleAverage,
        FieldHeader = "Avg Price"
    });
}
csharp
// Display multiple aggregated values with custom formatting
private void ConfigureMultipleCalculations()
{
    pivotChart1.PivotCalculations.Clear();
    
    // Total quantity
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo
    {
        FieldName = "Quantity",
        Format = "#,##0",
        SummaryType = SummaryType.DoubleTotalSum,
        FieldHeader = "Total Qty"
    });
    
    // Total amount (currency)
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo
    {
        FieldName = "Amount",
        Format = "C2",
        SummaryType = SummaryType.DoubleTotalSum,
        FieldHeader = "Total Amount"
    });
    
    // Average price
    pivotChart1.PivotCalculations.Add(new PivotComputationInfo
    {
        FieldName = "UnitPrice",
        Format = "C2",
        SummaryType = SummaryType.DoubleAverage,
        FieldHeader = "Avg Price"
    });
}

Key Properties and Methods

核心属性与方法

Core Properties

核心属性

PropertyTypeDescription
ItemSource
objectData source (IEnumerable or DataTable)
PivotAxis
PivotItemCollectionFields for chart axis (hierarchical)
PivotLegend
PivotItemCollectionFields for legend/series
PivotCalculations
PivotComputationInfoCollectionCalculation/aggregation fields
ChartTypes
PivotChartTypesChart type (Line, Column, Area, etc.)
AllowDrillDown
boolEnable drill-down/drill-up operations
EnableUpdating
boolAuto-update when data changes
属性类型描述
ItemSource
object数据源(IEnumerable或DataTable)
PivotAxis
PivotItemCollection图表轴字段(层级结构)
PivotLegend
PivotItemCollection图例/系列字段
PivotCalculations
PivotComputationInfoCollection计算/聚合字段
ChartTypes
PivotChartTypes图表类型(折线图、柱形图、面积图等)
AllowDrillDown
bool启用下钻/上钻操作
EnableUpdating
bool数据变化时自动更新

PivotItem Properties

PivotItem属性

PropertyTypeDescription
FieldMappingName
stringName of data field to bind
TotalHeader
stringHeader text for total/aggregate row
FieldHeader
stringDisplay header for the field
属性类型描述
FieldMappingName
string要绑定的数据字段名称
TotalHeader
string总计/聚合行的标题文本
FieldHeader
string字段的展示标题

PivotComputationInfo Properties

PivotComputationInfo属性

PropertyTypeDescription
FieldName
stringName of field to calculate
Format
stringNumber format string
SummaryType
SummaryTypeAggregation type (Sum, Average, Count, etc.)
FieldHeader
stringDisplay name for calculation
属性类型描述
FieldName
string要计算的字段名称
Format
string数字格式化字符串
SummaryType
SummaryType聚合类型(求和、平均值、计数等)
FieldHeader
string计算项的展示名称

Key Methods

核心方法

MethodDescription
BeginUpdate()
Suspend chart updates for bulk operations
EndUpdate()
Resume chart updates and refresh
Refresh()
Manually refresh the chart
方法描述
BeginUpdate()
暂停图表更新,用于批量操作
EndUpdate()
恢复图表更新并刷新
Refresh()
手动刷新图表

Common Use Cases

常见使用场景

Business Intelligence Dashboard

商业智能仪表盘

  • Visualize sales data by product, region, and time period
  • Drill down from yearly to quarterly to monthly views
  • Compare multiple metrics (quantity, revenue, profit)
  • 按产品、区域和时间段可视化销售数据
  • 从年度视图下钻到季度再到月度视图
  • 对比多个指标(数量、收入、利润)

Financial Analysis

财务分析

  • Display financial data across departments, periods, and categories
  • Analyze budget vs. actual spending with hierarchical drill-down
  • Visualize profit/loss trends across business units
  • 展示跨部门、周期和类别的财务数据
  • 通过层级下钻分析预算与实际支出的对比
  • 可视化各业务单元的盈亏趋势

Inventory Management

库存管理

  • Visualize stock levels across warehouses, products, and categories
  • Drill down to specific product lines or locations
  • Track inventory movements over time
  • 跨仓库、产品和类别可视化库存水平
  • 下钻到特定产品线或位置
  • 跟踪库存随时间的变动情况

Marketing Analytics

营销分析

  • Analyze campaign performance by channel, region, and time period
  • Compare multiple KPIs (impressions, clicks, conversions)
  • Drill down from campaign level to ad group level
  • 按渠道、区域和时间段分析活动表现
  • 对比多个KPI(曝光量、点击量、转化量)
  • 从活动层级下钻到广告组层级

Resource Planning

资源规划

  • Visualize resource allocation across projects, teams, and time periods
  • Analyze utilization rates with hierarchical breakdown
  • Track capacity vs. demand trends
  • 跨项目、团队和时间段可视化资源分配
  • 通过层级分解分析利用率
  • 跟踪容量与需求趋势

Performance Considerations

性能注意事项

  1. Use BeginUpdate/EndUpdate for bulk data operations to prevent multiple redraws
  2. Limit hierarchy depth - 3-4 levels is optimal for performance and usability
  3. Filter data before binding rather than binding entire dataset
  4. Disable EnableUpdating if real-time updates aren't needed
  5. Use appropriate chart types - simpler types (Line, Column) render faster than complex types
  6. Optimize data model - ensure data classes are lightweight
  7. Consider data volume - for very large datasets (100k+ rows), pre-aggregate data
  1. 批量数据操作使用BeginUpdate/EndUpdate,避免多次重绘
  2. 限制层级深度:3-4层是性能和可用性的最优选择
  3. 绑定前先过滤数据,不要直接绑定整个数据集
  4. 如果不需要实时更新则关闭EnableUpdating
  5. 使用合适的图表类型:简单类型(折线图、柱形图)比复杂类型渲染更快
  6. 优化数据模型:确保数据类轻量
  7. 考虑数据量:对于超大数据集(10万行以上),先预聚合数据

Best Practices

最佳实践

  1. Always register license key before creating pivot chart control
  2. Define clear hierarchy in PivotAxis for intuitive drill-down
  3. Use descriptive TotalHeader values for better user understanding
  4. Format calculations appropriately (currency, percentages, numbers)
  5. Enable drill-down only if data has meaningful hierarchical structure
  6. Provide chart type selection if users need different visualizations
  7. Handle empty data gracefully with appropriate messages
  8. Test with representative data volumes to ensure performance
  9. Use grouping bar or field list for interactive user exploration
  10. Consider export functionality for reporting requirements
  1. 创建透视图表控件前务必注册许可密钥
  2. 在PivotAxis中定义清晰的层级结构,方便用户直观下钻
  3. 使用描述性的TotalHeader值,提升用户理解度
  4. 对计算项进行合适的格式化(货币、百分比、数字)
  5. 仅当数据具备有意义的层级结构时才启用下钻
  6. 如果用户需要不同的可视化形式,提供图表类型选择功能
  7. 优雅处理空数据,展示合适的提示信息
  8. 使用代表性的数据量进行测试,确保性能达标
  9. 提供分组栏或字段列表,支持用户交互式探索
  10. 如有报表需求,考虑提供导出功能

Related Components

相关组件

  • Pivot Grid - Tabular view of pivot data (pair with Pivot Chart)
  • Chart Control - Standard charting for non-pivot data
  • Data Grid - Display detailed raw data
  • Gantt Chart - Project scheduling visualization
  • TreeMap - Hierarchical data visualization alternative
  • Pivot Grid:透视数据的表格视图(可与Pivot Chart搭配使用)
  • Chart Control:非透视数据的标准图表组件
  • Data Grid:展示详细原始数据
  • Gantt Chart:项目排期可视化
  • TreeMap:层级数据可视化的替代方案

Additional Resources

额外资源