Skip to main content
A newer version of this page is available. .

XRChart.Parameters Property

Provides access to the chart’s parameters collection.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[SRCategory(ReportStringId.CatData)]
public XRControlParameterCollection Parameters { get; }

Property Value

Type Description
XRControlParameterCollection

The chart’s parameters collection.

Remarks

Use chart parameters with the chart series’ FilterString property to filter the series’ data. Prefix a parameter’s name with “?“ in a filter string to refer to a chart parameter.

Each item in the Parameters collection is an XRControlParameter class instance. You can bind these items to:

  • a report parameter to filter chart series data by this report parameter. To do this, set the report parameter you want to use as the chart parameter’s Parameter property.

  • a report data field or calculated field to filter chart series data by this field. To do this, use the XRControlParameter’s XRControlParameter(String, Object, String) constructor to set the chart parameter’s DataSource and DataMember fields and specify which field should be used. Set the DataSource field to null (Nothing in Visual Basic) to use the report’s data source.

Tip

The Use Charts to Visualize Grouped Data topic shows how to create a chart where data is filtered by a parameter value.

Example

The code sample below illustrates how to create a chart parameter that is bound to a data source field and filter chart series data by this parameter’s value.

An XRChart instance named chart is placed in a Group Footer band where the data is grouped by the Products.CategoryID field. The report is bound to the Northwind database’s Products table.

using DevExpress.XtraCharts;
// ...
// Create a new chart parameter and bind it to the report's group field (CategoryID). Prepend the group field's name with the data member's name.
chart.Parameters.Add(new XRControlParameter("controlParameter1", null, "Products.CategoryID"));
// Create a chart series.
Series series = new Series("Series 1", ViewType.Bar);
// Show product names on the Argument axis.
series.ArgumentDataMember = "Products.ProductName";
// Show product prices on the Value axis.
series.ValueDataMembers.AddRange(new string[] { "Products.UnitPrice" });
// Set up a filter to show products from the specified category only. Use the created parameter's name in the filter string.
series.FilterString = "Products.CategoryID = ?controlParameter1";
chart.Series.Add(series);
See Also