$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Windows Forms PivotGrid Control
Create interactive user interface of Pivot table, build summarizations and highlight specific data
Home > WinForms UI Controls > User Manual > Bind PivotGrid with Chart in C#

Bind KetticPivotGrid with ChartView in C#.NET

KetticPivotGrid control can be used together with any other controls of Kettic WinForms UI components, including the KetticChartView control. The designers of user interface of PivotGrid are able to easily and seamlessly integrate this control into KetticChartView components to visualize the reports generated by KetticPivotGrid. In this article, we are going through the process of binding the KetticPivotGrid control with chart view in C#.NET template projects.

Bind KetticPivotGrid with KetticChartView

To bind the KetticPivotGrid control to chart view in .NET project, we shall assign a KetticPivotGrid instance as a DataSource of KetticChartView control. The simple C# code snippet below demonstrates how to achieve this.

this.ketticChartView1.DataSource = this.ketticPivotGrid1;

Populate KetticChartView with Data via PivotGridChartDataProvider

KetticPivotGrid control provides the PivotGridChartDataProvider object for the users to populate KetticChartView control with data and customize the behaviors. To access the PivotGridChartDataProvider object, the KetticPivotGrid control offers the ChartDataProvider property.

Set PivotGridChartDataProvider object

Sometimes, we may not need to visualize the values of SubTotal and GrandTotal. The following C# code shows how to display one kind of totals.

this.ketticPivotGrid1.ChartDataProvider.IncludeColumnSubTotals = false;
this.ketticPivotGrid1.ChartDataProvider.IncludeRowSubTotals = false;

this.ketticPivotGrid1.ChartDataProvider.IncludeColumnGrandTotals = false;
this.ketticPivotGrid1.ChartDataProvider.IncludeRowSubTotals = false;
Furthermore, we can customize one of the series, Bar, Line, and Area, to be generated, as well as the pivot axes to be applied.

this.ketticPivotGrid1.ChartDataProvider.GeneratedSeriesType = Kettic.WinForms.UI.GeneratedSeriesType.Line;
this.ketticPivotGrid1.ChartDataProvider.SeriesAxis = Kettic.Pivot.Core.PivotAxis.Rows;

C# Visualize Reports of KetticPivotGrid in Chart View

KetticPivotGrid control provides the options for the users to visualize the reports entirely or partially. Additionally, it allows the users to delay the data updates to KetticChartView. The C# code below shows how to achieve this.

this.ketticPivotGrid1.ChartDataProvider.SelectionOnly = true;
this.ketticPivotGrid1.ChartDataProvider.DelayUpdate = true;
this.ketticPivotGrid1.ChartDataProvider.DelayAmount = 300;

PivotGridChartDataProvider C# events

KetticPivotGrid control provides two C# events, the CreateSeries and the CompletedUpdate, for the users to customize the generated series or apply custom series. The CreateSeries event is used to replace the series instance with a custom series and the CompletedUpdate event is used to apply any final settings to all series generated. The C# code below shows how to achieve this.

void ChartDataProvider_UpdateCompleted(object sender, EventArgs e)
{
if (this.ketticPivotGrid1.ChartDataProvider.GeneratedSeriesType != GeneratedSeriesType.Bar)
{
foreach (CartesianSeries series in this.ketticChartView1.Series)
{
series.CombineMode = ChartSeriesCombineMode.Stack;
}
}
}

void ChartDataProvider_CreateSeries(object sender, Kettic.WinForms.UI.CreateSeriesEventArgs e)
{
e.Series = new BarSeries();
}
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls