ComponentOne Reports for WPF
Task Based Help / Working with Report Fields / Creating Charts
In This Topic
    Creating Charts
    In This Topic

    In the initial versions of C1Report, adding charts to reports required handling the StartSection event, generating the chart, and assigning the chart image to a field's Picture property. This is not hard to do, and continues to be the most flexible way to add dynamic images to reports.

    However, this approach has two drawbacks:

    The current C1Report supports custom report fields, including a chart field that is based on the C1Chart control.

    To add a chart field to a Group Header section in your report, complete the following steps:

    1. Open the C1ReportDesigner. For more information on how to access the C1ReportDesigner, see Accessing C1ReportDesigner from Visual Studio.
    2. Create a new report or open an existing report. Once you have the report in the C1ReportDesigner, you can modify the report properties.
    3. Click the Design button to begin editing the report.
    4. In the Custom Fields group of the Insert tab, click the Chart Field button.
    5. Click in the Group Header section of your report and drag the field to resize the chart.
    6. From the Properties window, set the chart field's Chart.DataX and Chart.DataY properties to the values you want to display on the chart. You can show several series by setting the Chart.DataY property to a list of fields delimited by semicolons (for example, "UnitsInStock;ReorderLevel").

    The chart data is automatically scoped to the current report group. For example, when rendering the "Beverages" section, only data for that category will be charted. You can customize the chart using many other properties such as Chart.ChartType, Chart.GridLines, Chart.Use3D, and Chart.Palette properties.

    For more information on creating chart fields, see the Adding Chart Fields topic.

    Note: For the complete report, see report "11: Charts" in the CommonTasks.xml report definition file, which is available in the ComponentOne Samples folder.