syncfusion-blazor-chart-wizard
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing Syncfusion Blazor Chart Wizard
实现Syncfusion Blazor Chart Wizard
NuGet: +
Namespace:
Syncfusion.Blazor.ChartWizardSyncfusion.Blazor.ThemesNamespace:
Syncfusion.Blazor.ChartWizardThe Syncfusion Blazor Chart Wizard is a comprehensive, user-friendly component that guides users through interactive chart creation and customization. It provides a dialog-based interface with property panels, multiple chart types, data binding, theming, accessibility features, and export capabilities.
NuGet: +
命名空间:
Syncfusion.Blazor.ChartWizardSyncfusion.Blazor.Themes命名空间:
Syncfusion.Blazor.ChartWizardSyncfusion Blazor Chart Wizard是一个全面且易用的组件,可引导用户完成交互式图表的创建与自定义。它提供了带属性面板的对话框式界面,支持多种图表类型、数据绑定、主题设置、可访问性功能以及导出能力。
When to Use This Skill
何时使用此组件
Use this skill when:
- Interactive Chart Creation: Building applications that allow users to create and customize charts interactively
- Data Visualization Tools: Implementing dashboard builders, report generators, or analytics interfaces
- Guided Chart Configuration: Providing step-by-step chart setup with visual property panels
- Multi-Format Export: Requiring chart export to PNG, JPEG, SVG, PDF, CSV, or XLSX formats
- Theme-Aware Charts: Building charts that adapt to application themes (Material, Fluent, Bootstrap, Tailwind, etc.)
- Accessible Visualizations: Creating WCAG 2.2 AA compliant charts with keyboard navigation and screen reader support
- Chart State Persistence: Saving and loading chart configurations for user preferences or templates
- Blazor Applications: Implementing in Blazor Server, WebAssembly, or Web App architectures
在以下场景中使用此组件:
- 交互式图表创建: 构建允许用户交互式创建和自定义图表的应用
- 数据可视化工具: 实现仪表板构建器、报表生成器或分析界面
- 引导式图表配置: 提供带可视化属性面板的分步图表设置流程
- 多格式导出: 需要将图表导出为PNG、JPEG、SVG、PDF、CSV或XLSX格式
- 主题适配图表: 构建可适配应用主题(Material、Fluent、Bootstrap、Tailwind等)的图表
- 可访问可视化: 创建符合WCAG 2.2 AA标准的图表,支持键盘导航和屏幕阅读器
- 图表状态持久化: 保存和加载图表配置以满足用户偏好或模板需求
- Blazor应用: 在Blazor Server、WebAssembly或Web App架构中实现
Component Overview
组件概述
The Chart Wizard component provides:
- Interactive Chart Builder: Step-by-step guided interface for chart creation
- 15+ Chart Types: Line, Column, Bar, Area, Pie, Scatter, and stacked variations
- Property Panel: Real-time chart customization with visual controls
- Data Binding: Support for IEnumerable, List, and ObservableCollection data sources
- Multi-Series Support: Create charts with multiple data series and categories
- Export Capabilities: Export to image (PNG, JPEG, SVG), document (PDF), and data formats (CSV, XLSX)
- Serialization: Save and load complete chart configurations as JSON
- Theming: 20+ built-in themes with consistent styling
- Accessibility: Full WCAG 2.2 AA compliance with keyboard navigation
- RTL Support: Right-to-left layout for international applications
Chart Wizard组件提供以下功能:
- 交互式图表构建器: 分步引导式的图表创建界面
- 15+种图表类型: 折线图、柱状图、条形图、面积图、饼图、散点图及其堆叠变体
- 属性面板: 通过可视化控件实时自定义图表
- 数据绑定: 支持IEnumerable、List和ObservableCollection数据源
- 多系列支持: 创建包含多个数据系列和类别的图表
- 导出能力: 导出为图片(PNG、JPEG、SVG)、文档(PDF)和数据格式(CSV、XLSX)
- 序列化: 将完整图表配置保存为JSON并可重新加载
- 主题设置: 20+种内置主题,样式保持一致
- 可访问性: 完全符合WCAG 2.2 AA标准,支持键盘导航
- RTL支持: 面向国际应用的从右到左布局
Documentation and Navigation Guide
文档与导航指南
Getting Started
快速入门
Choose the appropriate setup guide based on your Blazor application type:
根据你的Blazor应用类型选择合适的设置指南:
Blazor Server App Setup
Blazor Server App 设置
📄 Read: references/getting-started.md
Complete setup instructions for Blazor Server applications, including:
- Visual Studio, VS Code, and .NET CLI project creation
- NuGet package installation (Syncfusion.Blazor.ChartWizard)
- Namespace imports and service registration
- Script reference configuration
- Component implementation
- Data model creation and binding
- Theme configuration
- Complete working example with Olympics data
- Troubleshooting common setup issues
📄 阅读: references/getting-started.md
Blazor Server应用的完整设置说明,包括:
- Visual Studio、VS Code和.NET CLI项目创建
- NuGet包安装(Syncfusion.Blazor.ChartWizard)
- 命名空间导入和服务注册
- 脚本引用配置
- 组件实现
- 数据模型创建与绑定
- 主题配置
- 包含奥运会数据的完整运行示例
- 常见设置问题排查
Blazor WebAssembly (WASM) App Setup
Blazor WebAssembly (WASM) App 设置
📄 Read: references/getting-started-wasm.md
Complete setup instructions for Blazor WASM applications, including:
- WASM-specific project creation across IDEs
- Package installation with dependency restoration
- Configuration for client-side rendering
- Component setup and data binding
- Theme configuration for WASM
- Complete functional WASM example
- Performance optimization considerations
📄 阅读: references/getting-started-wasm.md
Blazor WASM应用的完整设置说明,包括:
- 跨IDE的WASM专属项目创建
- 带依赖还原的包安装
- 客户端渲染配置
- 组件设置与数据绑定
- WASM主题配置
- 完整功能WASM示例
- 性能优化注意事项
Blazor Web App Setup
Blazor Web App 设置
📄 Read: references/getting-started-web-app.md
Complete setup instructions for Blazor Web Apps with render modes, including:
- Interactive render mode configuration (Server, WebAssembly, Auto)
- Interactivity location setup (Global, Per page/component)
- Client vs Server project package management
- Render mode-specific component implementation
- Theme management across render modes
- Complete Web App example with Auto mode
- Best practices for choosing render modes
📄 阅读: references/getting-started-web-app.md
带渲染模式的Blazor Web App完整设置说明,包括:
- 交互式渲染模式配置(Server、WebAssembly、Auto)
- 交互位置设置(全局、每页/组件)
- 客户端与服务端项目包管理
- 渲染模式专属组件实现
- 跨渲染模式的主题管理
- 带Auto模式的完整Web App示例
- 选择渲染模式的最佳实践
Working with Data
数据处理
📄 Read: references/working-with-data.md
Comprehensive data binding and field configuration, including:
- ChartSettings configuration and properties
- DataSource binding (IEnumerable<Object>)
- CategoryFields configuration for x-axis grouping
- SeriesFields for multi-series data mapping
- SeriesType selection (15+ chart types)
- Single-series vs multi-series chart patterns
- List<T> data binding examples
- ObservableCollection for dynamic data
- Data model design best practices
- Field mapping and ordering
- Complete examples with Olympics and sales data
- Troubleshooting data display issues
📄 阅读: references/working-with-data.md
全面的数据绑定和字段配置说明,包括:
- ChartSettings配置与属性
- DataSource绑定(IEnumerable<Object>)
- CategoryFields配置用于X轴分组
- SeriesFields用于多系列数据映射
- SeriesType选择(15+种图表类型)
- 单系列与多系列图表模式
- List<T>数据绑定示例
- ObservableCollection用于动态数据
- 数据模型设计最佳实践
- 字段映射与排序
- 包含奥运会和销售数据的完整示例
- 数据显示问题排查
Appearance and Customization
外观与自定义
📄 Read: references/appearance-customization.md
Visual customization and layout configuration, including:
- Width and Height properties (percentage and pixel-based)
- Responsive design patterns
- Theme property configuration (20+ built-in themes)
- Material, Material3, MaterialDark, Material3Dark
- Fluent, Fluent2, FluentDark, Fluent2Dark, Fluent2HighContrast
- Bootstrap, Bootstrap4, Bootstrap5, BootstrapDark, Bootstrap5Dark
- Tailwind, Tailwind3, TailwindDark, Tailwind3Dark
- Fabric, FabricDark
- HighContrast, HighContrastLight
- Theme stylesheet prerequisites and inclusion
- EnableRtl for right-to-left layout support
- PropertyPanelExpanded for initial panel state control
- Combined appearance configuration examples
- Theme consistency best practices
- Troubleshooting theme and sizing issues
📄 阅读: references/appearance-customization.md
视觉自定义与布局配置说明,包括:
- Width和Height属性(百分比和像素单位)
- 响应式设计模式
- Theme属性配置(20+种内置主题)
- Material、Material3、MaterialDark、Material3Dark
- Fluent、Fluent2、FluentDark、Fluent2Dark、Fluent2HighContrast
- Bootstrap、Bootstrap4、Bootstrap5、BootstrapDark、Bootstrap5Dark
- Tailwind、Tailwind3、TailwindDark、Tailwind3Dark
- Fabric、FabricDark
- HighContrast、HighContrastLight
- 主题样式表的前提条件与引入
- EnableRtl用于从右到左布局支持
- PropertyPanelExpanded用于控制初始面板状态
- 外观组合配置示例
- 主题一致性最佳实践
- 主题与尺寸问题排查
Accessibility
可访问性
📄 Read: references/accessibility.md
Comprehensive accessibility compliance and features, including:
- WCAG 2.2 AA level support
- Section 508 compliance
- WAI-ARIA attributes and roles
- Data labels, legends, axis titles
- Chart titles and series points
- ARIA roles: img, button, region
- ARIA attributes: label, hidden, pressed
- Screen reader support
- Complete keyboard navigation
- Focus management (Alt+J, Tab, Shift+Tab)
- Data point navigation (Arrow keys)
- Series selection (Enter, Space)
- Legend navigation and toggling
- Zoom and pan controls
- Print shortcut (Ctrl+P)
- Color contrast compliance
- Mobile device support
- Axe-core validation integration
- Testing guidelines and best practices
📄 阅读: references/accessibility.md
全面的可访问性合规与功能说明,包括:
- WCAG 2.2 AA级别支持
- Section 508合规
- WAI-ARIA属性与角色
- 数据标签、图例、轴标题
- 图表标题和系列数据点
- ARIA角色:img、button、region
- ARIA属性:label、hidden、pressed
- 屏幕阅读器支持
- 完整键盘导航
- 焦点管理(Alt+J、Tab、Shift+Tab)
- 数据点导航(方向键)
- 系列选择(Enter、Space)
- 图例导航与切换
- 缩放和平移控件
- 打印快捷键(Ctrl+P)
- 颜色对比度合规
- 移动设备支持
- Axe-core验证集成
- 测试指南与最佳实践
Serialization
序列化
📄 Read: references/serialization.md
Chart state save and load functionality, including:
- SaveChart() method - serialize to JSON string
- LoadChartAsync() method - restore from JSON
- Complete chart state capture (settings, series, axes, titles, styles)
- Storage options (database, file, LocalStorage, session state)
- Save and load button implementation
- Component reference setup (@ref)
- State management patterns
- Version compatibility considerations
- Use cases: user preferences, dashboard configs, report templates
- Error handling and validation
- Complete working examples
📄 阅读: references/serialization.md
图表状态保存与加载功能说明,包括:
- SaveChart()方法 - 序列化为JSON字符串
- LoadChartAsync()方法 - 从JSON恢复
- 完整图表状态捕获(设置、系列、坐标轴、标题、样式)
- 存储选项(数据库、文件、LocalStorage、会话状态)
- 保存和加载按钮实现
- 组件引用设置(@ref)
- 状态管理模式
- 版本兼容性注意事项
- 使用场景:用户偏好、仪表板配置、报表模板
- 错误处理与验证
- 完整运行示例
Print and Export
打印与导出
📄 Read: references/print-export.md
Export charts to multiple formats, including:
- Supported formats: PNG, JPEG, SVG, PDF, CSV, XLSX, PRINT
- ChartExportSettings declarative configuration
- FileName property
- Width and Height for image/PDF exports
- Orientation (Portrait/Landscape) for PDF/print
- Export button integration
- Print functionality via browser dialog
- Exporting event for runtime customization
- ChartExportingEventArgs properties
- Dynamic file naming
- Conditional export cancellation
- Runtime dimension adjustment
- Orientation control
- Format-specific considerations
- Best practices for resolution and file naming
- Complete examples with event handling
- Troubleshooting export issues
📄 阅读: references/print-export.md
将图表导出为多种格式的说明,包括:
- 支持格式:PNG、JPEG、SVG、PDF、CSV、XLSX、PRINT
- ChartExportSettings声明式配置
- FileName属性
- 图片/PDF导出的Width和Height
- PDF/打印的Orientation(纵向/横向)
- 导出按钮集成
- 通过浏览器对话框实现打印功能
- 用于运行时自定义的导出事件
- ChartExportingEventArgs属性
- 动态文件名
- 条件导出取消
- 运行时尺寸调整
- 方向控制
- 格式专属注意事项
- 分辨率与文件名最佳实践
- 带事件处理的完整示例
- 导出问题排查
API Reference
API参考
📄 Read: references/api-reference.md
Complete API documentation for all classes, properties, methods, and events, including:
- SfChartWizard class
- Width, Height, Theme properties
- EnableRtl, PropertyPanelExpanded
- Exporting event
- SaveChart(), LoadChartAsync() methods
- ChartSettings class
- Datasource, CategoryFields, SeriesFields
- SeriesType property with 15+ types
- ChartExportSettings class
- FileName, Width, Height, Orientation
- ChartExportingEventArgs class
- Event arguments for export customization
- ChartWizardSeriesType enum
- All available series types
- PageOrientation enum
- Portrait and Landscape options
📄 阅读: references/api-reference.md
所有类、属性、方法和事件的完整API文档,包括:
- SfChartWizard类
- Width、Height、Theme属性
- EnableRtl、PropertyPanelExpanded
- Exporting事件
- SaveChart()、LoadChartAsync()方法
- ChartSettings类
- Datasource、CategoryFields、SeriesFields
- 带15+种类型的SeriesType属性
- ChartExportSettings类
- FileName、Width、Height、Orientation
- ChartExportingEventArgs类
- 用于导出自定义的事件参数
- ChartWizardSeriesType枚举
- 所有可用系列类型
- PageOrientation枚举
- 纵向和横向选项
Quick Start Example
快速入门示例
Here's a minimal example to get you started with the Chart Wizard component:
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%" Height="500px">
<ChartSettings DataSource="@Data"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Column">
</ChartSettings>
</SfChartWizard>
@code {
public class OlympicsData
{
public string Country { get; set; }
public int Gold { get; set; }
public int Silver { get; set; }
public int Bronze { get; set; }
}
private readonly List<string> CategoryList = new() { "Country" };
private readonly List<string> SeriesList = new() { "Gold", "Silver", "Bronze" };
private List<OlympicsData> Data = new()
{
new OlympicsData { Country = "USA", Gold = 40, Silver = 44, Bronze = 42 },
new OlympicsData { Country = "China", Gold = 40, Silver = 27, Bronze = 24 },
new OlympicsData { Country = "Japan", Gold = 20, Silver = 12, Bronze = 13 }
};
}以下是使用Chart Wizard组件的最简示例:
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%" Height="500px">
<ChartSettings DataSource="@Data"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Column">
</ChartSettings>
</SfChartWizard>
@code {
public class OlympicsData
{
public string Country { get; set; }
public int Gold { get; set; }
public int Silver { get; set; }
public int Bronze { get; set; }
}
private readonly List<string> CategoryList = new() { "Country" };
private readonly List<string> SeriesList = new() { "Gold", "Silver", "Bronze" };
private List<OlympicsData> Data = new()
{
new OlympicsData { Country = "USA", Gold = 40, Silver = 44, Bronze = 42 },
new OlympicsData { Country = "China", Gold = 40, Silver = 27, Bronze = 24 },
new OlympicsData { Country = "Japan", Gold = 20, Silver = 12, Bronze = 13 }
};
}Common Patterns
常见模式
Single-Series Chart
单系列图表
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%" Height="500px">
<ChartSettings DataSource="@SalesData"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Line">
</ChartSettings>
</SfChartWizard>
@code {
public class SalesInfo
{
public string Month { get; set; }
public double Sales { get; set; }
}
private List<SalesInfo> SalesData = new()
{
new SalesInfo { Month = "Jan", Sales = 100 },
new SalesInfo { Month = "Feb", Sales = 120 },
new SalesInfo { Month = "Mar", Sales = 140 }
};
private readonly List<string> CategoryList = new() { "Month" };
private readonly List<string> SeriesList = new() { "Sales" };
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%" Height="500px">
<ChartSettings DataSource="@SalesData"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Line">
</ChartSettings>
</SfChartWizard>
@code {
public class SalesInfo
{
public string Month { get; set; }
public double Sales { get; set; }
}
private List<SalesInfo> SalesData = new()
{
new SalesInfo { Month = "Jan", Sales = 100 },
new SalesInfo { Month = "Feb", Sales = 120 },
new SalesInfo { Month = "Mar", Sales = 140 }
};
private readonly List<string> CategoryList = new() { "Month" };
private readonly List<string> SeriesList = new() { "Sales" };
}Multi-Series with Theme
带主题的多系列图表
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Theme="Theme.Fluent2" Width="100%" Height="500px">
<ChartSettings DataSource="@OlympicsData"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Bar">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryList = new() { "Country" };
private readonly List<string> SeriesList = new() { "Gold", "Silver", "Bronze" };
public class OlympicsDataModel
{
public string Country { get; set; }
public int Gold { get; set; }
public int Silver { get; set; }
public int Bronze { get; set; }
}
private List<OlympicsDataModel> OlympicsData = new()
{
new OlympicsDataModel { Country = "USA", Gold = 40, Silver = 44, Bronze = 42 },
new OlympicsDataModel { Country = "China", Gold = 40, Silver = 27, Bronze = 24 },
new OlympicsDataModel { Country = "Japan", Gold = 20, Silver = 12, Bronze = 13 }
};
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Theme="Theme.Fluent2" Width="100%" Height="500px">
<ChartSettings DataSource="@OlympicsData"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Bar">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryList = new() { "Country" };
private readonly List<string> SeriesList = new() { "Gold", "Silver", "Bronze" };
public class OlympicsDataModel
{
public string Country { get; set; }
public int Gold { get; set; }
public int Silver { get; set; }
public int Bronze { get; set; }
}
private List<OlympicsDataModel> OlympicsData = new()
{
new OlympicsDataModel { Country = "USA", Gold = 40, Silver = 44, Bronze = 42 },
new OlympicsDataModel { Country = "China", Gold = 40, Silver = 27, Bronze = 24 },
new OlympicsDataModel { Country = "Japan", Gold = 20, Silver = 12, Bronze = 13 }
};
}With Export Configuration
带导出配置的图表
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%" Height="500px">
<ChartSettings DataSource="@ReportData"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Column">
<ChartExportSettings FileName="QuarterlyReport"
Width="1024"
Height="768"
Orientation="Syncfusion.Blazor.ChartWizard.PageOrientation.Landscape" />
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryList = new() { "Quarter" };
private readonly List<string> SeriesList = new() { "Revenue", "Profit" };
public class ReportItem
{
public string Quarter { get; set; }
public double Revenue { get; set; }
public double Profit { get; set; }
}
private List<ReportItem> ReportData = new()
{
new ReportItem { Quarter = "Q1", Revenue = 120000, Profit = 45000 },
new ReportItem { Quarter = "Q2", Revenue = 150000, Profit = 60000 },
new ReportItem { Quarter = "Q3", Revenue = 170000, Profit = 75000 },
new ReportItem { Quarter = "Q4", Revenue = 200000, Profit = 90000 }
};
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%" Height="500px">
<ChartSettings DataSource="@ReportData"
CategoryFields="@CategoryList"
SeriesFields="@SeriesList"
SeriesType="ChartWizardSeriesType.Column">
<ChartExportSettings FileName="QuarterlyReport"
Width="1024"
Height="768"
Orientation="Syncfusion.Blazor.ChartWizard.PageOrientation.Landscape" />
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryList = new() { "Quarter" };
private readonly List<string> SeriesList = new() { "Revenue", "Profit" };
public class ReportItem
{
public string Quarter { get; set; }
public double Revenue { get; set; }
public double Profit { get; set; }
}
private List<ReportItem> ReportData = new()
{
new ReportItem { Quarter = "Q1", Revenue = 120000, Profit = 45000 },
new ReportItem { Quarter = "Q2", Revenue = 150000, Profit = 60000 },
new ReportItem { Quarter = "Q3", Revenue = 170000, Profit = 75000 },
new ReportItem { Quarter = "Q4", Revenue = 200000, Profit = 90000 }
};
}With Property Panel Collapsed
折叠属性面板的图表
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="90%"
Height="600px"
PropertyPanelExpanded="false"
Theme="Theme.Material3">
<ChartSettings DataSource="@MyData"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Area">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "CategoryName" };
private readonly List<string> SeriesFields = new() { "Value1", "Value2" };
public class MyItem
{
public string CategoryName { get; set; }
public double Value1 { get; set; }
public double Value2 { get; set; }
}
private List<MyItem> MyData = new()
{
new MyItem { CategoryName = "A", Value1 = 30, Value2 = 20 },
new MyItem { CategoryName = "B", Value1 = 45, Value2 = 35 },
new MyItem { CategoryName = "C", Value1 = 50, Value2 = 40 }
};
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="90%"
Height="600px"
PropertyPanelExpanded="false"
Theme="Theme.Material3">
<ChartSettings DataSource="@MyData"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Area">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "CategoryName" };
private readonly List<string> SeriesFields = new() { "Value1", "Value2" };
public class MyItem
{
public string CategoryName { get; set; }
public double Value1 { get; set; }
public double Value2 { get; set; }
}
private List<MyItem> MyData = new()
{
new MyItem { CategoryName = "A", Value1 = 30, Value2 = 20 },
new MyItem { CategoryName = "B", Value1 = 45, Value2 = 35 },
new MyItem { CategoryName = "C", Value1 = 50, Value2 = 40 }
};
}Key Properties
关键属性
SfChartWizard Properties
SfChartWizard 属性
| Property | Type | Default | Description |
|---|---|---|---|
| Width | string | "100%" | Width of the component (px or %) |
| Height | string | "100%" | Height of the component (px or %) |
| Theme | Theme | Fluent2 | Visual theme (Material, Fluent, Bootstrap, Tailwind, etc.) |
| EnableRtl | bool | false | Enable right-to-left layout |
| PropertyPanelExpanded | bool | true | Show property panel on initial render |
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| Width | string | "100%" | 组件宽度(像素或百分比) |
| Height | string | "100%" | 组件高度(像素或百分比) |
| Theme | Theme | Fluent2 | 视觉主题(Material、Fluent、Bootstrap、Tailwind等) |
| EnableRtl | bool | false | 启用从右到左布局 |
| PropertyPanelExpanded | bool | true | 初始渲染时显示属性面板 |
ChartSettings Properties
ChartSettings 属性
| Property | Type | Required | Description |
|---|---|---|---|
| DataSource | IEnumerable<object> | Yes | Data collection for the chart |
| CategoryFields | List<string> | Yes | Field names for x-axis categories |
| SeriesFields | List<string> | Yes | Field names for data series |
| SeriesType | ChartWizardSeriesType | No | Chart type (Line, Column, Bar, Area, Pie, etc.) |
| 属性 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| DataSource | IEnumerable<object> | 是 | 图表的数据集合 |
| CategoryFields | List<string> | 是 | X轴类别的字段名称 |
| SeriesFields | List<string> | 是 | 数据系列的字段名称 |
| SeriesType | ChartWizardSeriesType | 否 | 图表类型(折线图、柱状图、条形图、面积图、饼图等) |
ChartExportSettings Properties
ChartExportSettings 属性
| Property | Type | Default | Description |
|---|---|---|---|
| FileName | string | "" | Name for exported file (without extension) |
| Width | double | NaN | Export width in pixels |
| Height | double | NaN | Export height in pixels |
| Orientation | PageOrientation | Portrait | Page orientation for PDF/print |
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| FileName | string | "" | 导出文件的名称(不含扩展名) |
| Width | double | NaN | 导出宽度(像素) |
| Height | double | NaN | 导出高度(像素) |
| Orientation | PageOrientation | Portrait | PDF/打印的页面方向 |
Common Use Cases
常见使用场景
Business Analytics Dashboard
商业分析仪表板
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%"
Height="600px"
Theme="Theme.Bootstrap5">
<ChartSettings DataSource="@QuarterlySales"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.StackingColumn">
<ChartExportSettings FileName="QuarterlyAnalysis"
Orientation="Syncfusion.Blazor.ChartWizard.PageOrientation.Landscape" />
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "Quarter", "Region" };
private readonly List<string> SeriesFields = new() { "Revenue", "Profit", "Expenses" };
public class QuarterlySale
{
public string Quarter { get; set; }
public string Region { get; set; }
public double Revenue { get; set; }
public double Profit { get; set; }
public double Expenses { get; set; }
}
private List<QuarterlySale> QuarterlySales = new()
{
new QuarterlySale { Quarter = "Q1", Region = "North", Revenue = 150000, Profit = 50000, Expenses = 30000 },
new QuarterlySale { Quarter = "Q2", Region = "North", Revenue = 170000, Profit = 60000, Expenses = 35000 },
new QuarterlySale { Quarter = "Q3", Region = "South", Revenue = 160000, Profit = 55000, Expenses = 32000 },
new QuarterlySale { Quarter = "Q4", Region = "South", Revenue = 180000, Profit = 65000, Expenses = 38000 }
};
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="100%"
Height="600px"
Theme="Theme.Bootstrap5">
<ChartSettings DataSource="@QuarterlySales"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.StackingColumn">
<ChartExportSettings FileName="QuarterlyAnalysis"
Orientation="Syncfusion.Blazor.ChartWizard.PageOrientation.Landscape" />
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "Quarter", "Region" };
private readonly List<string> SeriesFields = new() { "Revenue", "Profit", "Expenses" };
public class QuarterlySale
{
public string Quarter { get; set; }
public string Region { get; set; }
public double Revenue { get; set; }
public double Profit { get; set; }
public double Expenses { get; set; }
}
private List<QuarterlySale> QuarterlySales = new()
{
new QuarterlySale { Quarter = "Q1", Region = "North", Revenue = 150000, Profit = 50000, Expenses = 30000 },
new QuarterlySale { Quarter = "Q2", Region = "North", Revenue = 170000, Profit = 60000, Expenses = 35000 },
new QuarterlySale { Quarter = "Q3", Region = "South", Revenue = 160000, Profit = 55000, Expenses = 32000 },
new QuarterlySale { Quarter = "Q4", Region = "South", Revenue = 180000, Profit = 65000, Expenses = 38000 }
};
}Olympics Medal Comparison
奥运会奖牌对比
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Theme="Theme.Material3"
PropertyPanelExpanded="true"
Width="100%"
Height="500px">
<ChartSettings DataSource="@OlympicsMedals"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Bar">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "Country" };
private readonly List<string> SeriesFields = new() { "Gold", "Silver", "Bronze" };
public class OlympicsMedalInfo
{
public string Country { get; set; }
public int Gold { get; set; }
public int Silver { get; set; }
public int Bronze { get; set; }
}
private List<OlympicsMedalInfo> OlympicsMedals = new()
{
new OlympicsMedalInfo { Country = "USA", Gold = 40, Silver = 44, Bronze = 42 },
new OlympicsMedalInfo { Country = "China", Gold = 40, Silver = 27, Bronze = 24 },
new OlympicsMedalInfo { Country = "Japan", Gold = 20, Silver = 12, Bronze = 13 }
};
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Theme="Theme.Material3"
PropertyPanelExpanded="true"
Width="100%"
Height="500px">
<ChartSettings DataSource="@OlympicsMedals"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Bar">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "Country" };
private readonly List<string> SeriesFields = new() { "Gold", "Silver", "Bronze" };
public class OlympicsMedalInfo
{
public string Country { get; set; }
public int Gold { get; set; }
public int Silver { get; set; }
public int Bronze { get; set; }
}
private List<OlympicsMedalInfo> OlympicsMedals = new()
{
new OlympicsMedalInfo { Country = "USA", Gold = 40, Silver = 44, Bronze = 42 },
new OlympicsMedalInfo { Country = "China", Gold = 40, Silver = 27, Bronze = 24 },
new OlympicsMedalInfo { Country = "Japan", Gold = 20, Silver = 12, Bronze = 13 }
};
}Sales Trend Visualization
销售趋势可视化
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="90%"
Height="500px">
<ChartSettings DataSource="@MonthlySales"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Line">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "Month" };
private readonly List<string> SeriesFields = new() { "CurrentYear", "PreviousYear" };
public class SalesRecord
{
public string Month { get; set; }
public double CurrentYear { get; set; }
public double PreviousYear { get; set; }
}
private List<SalesRecord> MonthlySales = new()
{
new SalesRecord { Month = "Jan", CurrentYear = 12000, PreviousYear = 10000 },
new SalesRecord { Month = "Feb", CurrentYear = 13500, PreviousYear = 11000 },
new SalesRecord { Month = "Mar", CurrentYear = 15000, PreviousYear = 12500 }
};
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard Width="90%"
Height="500px">
<ChartSettings DataSource="@MonthlySales"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Line">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "Month" };
private readonly List<string> SeriesFields = new() { "CurrentYear", "PreviousYear" };
public class SalesRecord
{
public string Month { get; set; }
public double CurrentYear { get; set; }
public double PreviousYear { get; set; }
}
private List<SalesRecord> MonthlySales = new()
{
new SalesRecord { Month = "Jan", CurrentYear = 12000, PreviousYear = 10000 },
new SalesRecord { Month = "Feb", CurrentYear = 13500, PreviousYear = 11000 },
new SalesRecord { Month = "Mar", CurrentYear = 15000, PreviousYear = 12500 }
};
}Multi-Category Population Data
多类别人口数据
cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard EnableRtl="false"
Theme="Theme.Fluent2"
Width="100%"
Height="500px">
<ChartSettings DataSource="@CityPopulation"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Column">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "City", "Country" };
private readonly List<string> SeriesFields = new() { "Population" };
public class PopulationInfo
{
public string City { get; set; }
public string Country { get; set; }
public double Population { get; set; }
}
private List<PopulationInfo> CityPopulation = new()
{
new PopulationInfo { City = "Tokyo", Country = "Japan", Population = 37.4 },
new PopulationInfo { City = "Delhi", Country = "India", Population = 31.0 },
new PopulationInfo { City = "Shanghai", Country = "China", Population = 27.0 },
new PopulationInfo { City = "São Paulo", Country = "Brazil", Population = 22.0 }
};
}cshtml
@using Syncfusion.Blazor.ChartWizard
<SfChartWizard EnableRtl="false"
Theme="Theme.Fluent2"
Width="100%"
Height="500px">
<ChartSettings DataSource="@CityPopulation"
CategoryFields="@CategoryFields"
SeriesFields="@SeriesFields"
SeriesType="ChartWizardSeriesType.Column">
</ChartSettings>
</SfChartWizard>
@code {
private readonly List<string> CategoryFields = new() { "City", "Country" };
private readonly List<string> SeriesFields = new() { "Population" };
public class PopulationInfo
{
public string City { get; set; }
public string Country { get; set; }
public double Population { get; set; }
}
private List<PopulationInfo> CityPopulation = new()
{
new PopulationInfo { City = "Tokyo", Country = "Japan", Population = 37.4 },
new PopulationInfo { City = "Delhi", Country = "India", Population = 31.0 },
new PopulationInfo { City = "Shanghai", Country = "China", Population = 27.0 },
new PopulationInfo { City = "São Paulo", Country = "Brazil", Population = 22.0 }
};
}Available Chart Types (SeriesType)
可用图表类型(SeriesType)
- Line - Line chart with connected data points
- StackingLine - Stacked line chart
- StackingLine100 - 100% stacked line chart
- Column - Vertical bar chart
- StackingColumn - Stacked column chart
- StackingColumn100 - 100% stacked column chart
- Bar - Horizontal bar chart
- StackingBar - Stacked bar chart
- StackingBar100 - 100% stacked bar chart
- Area - Area chart with filled regions
- StackingArea - Stacked area chart
- StackingArea100 - 100% stacked area chart
- Scatter - Scatter plot with individual markers
- Pie - Circular pie chart for proportions
- Line - 带连接数据点的折线图
- StackingLine - 堆叠折线图
- StackingLine100 - 100%堆叠折线图
- Column - 垂直柱状图
- StackingColumn - 堆叠柱状图
- StackingColumn100 - 100%堆叠柱状图
- Bar - 水平条形图
- StackingBar - 堆叠条形图
- StackingBar100 - 100%堆叠条形图
- Area - 带填充区域的面积图
- StackingArea - 堆叠面积图
- StackingArea100 - 100%堆叠面积图
- Scatter - 带独立标记的散点图
- Pie - 用于比例显示的圆形饼图
Prerequisites
前提条件
- .NET SDK 6.0 or later
- Syncfusion Blazor license (trial or commercial)
- Blazor Server, WebAssembly, or Web App project
- Visual Studio 2022, VS Code, or .NET CLI
- .NET SDK 6.0或更高版本
- Syncfusion Blazor许可证(试用版或商业版)
- Blazor Server、WebAssembly或Web App项目
- Visual Studio 2022、VS Code或.NET CLI
Package Requirements
包依赖
bash
dotnet add package Syncfusion.Blazor.ChartWizardbash
dotnet add package Syncfusion.Blazor.ChartWizardNamespace Imports
命名空间导入
cshtml
@using Syncfusion.Blazor
@using Syncfusion.Blazor.ChartWizardcshtml
@using Syncfusion.Blazor
@using Syncfusion.Blazor.ChartWizardService Registration
服务注册
csharp
// Program.cs
builder.Services.AddSyncfusionBlazor();csharp
// Program.cs
builder.Services.AddSyncfusionBlazor();Script Reference
脚本引用
html
<!-- App.razor or _Host.cshtml -->
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>html
<!-- App.razor 或 _Host.cshtml -->
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>Next Steps
下一步
- Choose your Blazor application type (Server, WASM, or Web App)
- Read the appropriate getting started guide
- Configure data binding with your data models
- Customize appearance with themes and properties
- Implement export and serialization as needed
- Ensure accessibility compliance for production use
- 选择你的Blazor应用类型(Server、WASM或Web App)
- 阅读对应的快速入门指南
- 使用你的数据模型配置数据绑定
- 通过主题和属性自定义外观
- 根据需要实现导出和序列化功能
- 确保生产环境中的可访问性合规
Related Components
相关组件
- Syncfusion Blazor Charts - For programmatic chart creation without wizard interface
- Syncfusion Blazor DataGrid - For tabular data visualization
- Syncfusion Blazor Dashboard Layout - For arranging multiple charts
- Syncfusion Blazor Charts - 无需向导界面的程序化图表创建
- Syncfusion Blazor DataGrid - 用于表格数据可视化
- Syncfusion Blazor Dashboard Layout - 用于排列多个图表