Use Charts in Reports
- 3 minutes to read
This topic describes how to embed a chart into a report.
|2D Series View||3D Series View|
If you use 3D series in charts on Linux-based platforms, see the following instructions on how to configure your application: Use 3D Chart Series on Linux.
The XRChart control can display multiple series.
|Bar and Point Series||Nested Doughnut Series|
The XRChart control contains various visual elements (diagrams, series, legends, primary and secondary axes, titles and labels, and so forth). You can select these elements in the Report Designer and customize their settings in the Properties window.
The XRChart control is implemented based on the ChartControl for WinForms. Refer to the Chart Control (WinForms) article for information on possible ChartControl configurations and the XRChart class description for instructions on how to apply these configurations in reports.
The desktop and Web End-User Report Designer versions contain the Chart Designer that allow end users to create and customize charts.
You can use the XRChart control in reports only. Refer to the following topics for details on how to create charts in ASP.NET, Windows Forms, and WPF applications:
|Platform||Chart Control Class||Documentation|
|ASP.NET||WebChartControl||Chart Control (ASP.NET)|
|Windows Forms||ChartControl||Chart Control (WinForms)|
|WPF||ChartControl and Chart3DControl||Charts Suite (WPF)|
Bind a Chart to Data
To bind data to a chart, use the XRChart.DataSource property.
When the chart data source is not assigned, the chart obtains data from the report’s data source (assigned to the XtraReportBase.DataSource property). A chart can display report data in the following ways:
- Place a chart on the report header/footer band to display a summary for the detail report data.
- Place a chart on a group header/footer to visualize data in each report group. Refer to the Use Charts to Visualize Data in Report Groups step-by-step tutorial for more information.
- The chart in the Detail band is printed as many times as there are records in the report’s data source. You can use a custom progress bar control instead of the chart control to visualize report detail data.
Specify the following settings to supply data to a chart’s series.
- The SeriesBase.ArgumentDataMember property specifies the data field that contains point arguments.
- The SeriesBase.ValueDataMembers property specifies the data fields that supply point values.
You can specify these settings in the following ways:
Bind each series individually
Create series dynamically
Assign the data field that contains series names to the XRChart.SeriesDataMember property and specify the argument and value data members of the SeriesBase object the XRChart.SeriesTemplate property returns. Refer to the Add a Chart (Use a Series Template) step-by-step tutorial for more information.
See the WinForms Charts Documentation to learn more about a chart’s configuration.