The various types of Charts that can be displayed in C1Reports are Bar, Column, Scatter, Line, Area and Pie. However, 'Stacking' in Bar Charts is not yet provided by the Chart Custom Field.

This blog describes the implementation of Stacked Charts in C1Reports. This can be achieved by making a few changes in the source code of the 'CustomFields.dll.'

Adding a ‘Stacked’ property in the source code and setting its type to 'Boolean' adds it in the ‘Properties’ window of the C1ReportDesigner. The stacking of the chart can be set on the basis of the value passed to this property.

The following is the code added in the Chart.cs of CustomField's Source Code:

 // public bool Stacked
// Draws a Stacked Chart

private bool _stacked;

public bool Stacked
{
get { return _stacked; }
set
{
_stacked = value;
OnPropertyChanged();
}
}

override public void OnPropertyChanged()
{
ChartGroup group = _chart.ChartGroups.Group0;
group.Stacked = Stacked;
}


You can use this modified CustomField dll with the C1ReportDesigner SourceCode provided by ComponentOne. You can further customize the dll by adding/removing properties in a similar manner.

Please download the attached customized ‘CustomField.dll' which can be used in your project. Using the same would give the following result:

A. Stacked Property in the C1ReportDesigner:




B. Resultant Stacked Chart:




Note: This 'CustomField dll' can only be used with the C1ReportDesigner-Source Code and not with the C1ReportDesigner-Tool.