Chart enhancements on WinForms (v17.2)

Don Wibier's Blog
03 November 2017

In v17.2 of our WinForms Charts, we’ve added some useful features that both of you, the developer, and your end-users might appreciate.

Criteria Based Filtering

The Chart control already supported filtering on series, but in this release we have replaced the DataFilter property with the FilterCriteria and FilterString properties. This makes filtering more powerful and is also inline with several other controls like the Grid, Reporting and XPO. It allows you to use the DevExpress Criteria Language to filter series.

It also allows you to use the FilterControl or the Filtering UI Context to select the data which is used by the Chart control without writing any code.

FilteringUIContext

Because of this change, you can use one filter control which manages the data for a Grid as well as a Chart!

EqualFilter

Bind a Chart to Grid data

In the previous releases you always needed to bind the data to a DataSource like a collection of objects or a DataReader. In scenarios which involve a grid and a chart, these DataSources where used by both controls. With custom unbound grid columns, grouping and filtering  you always needed to code some additional mechanism to get that data in the chart as well.

With v17.2, we have added a ControlRowSource component which allows you to bind the chart directly to the Grid control. With this feature, the chart doesn’t use the same DataSource as the grid, but it will actually use the rows and columns available in the grid as its DataSource. It will make use of things like Grouping, Sorting, Filtering which might have been set in the Grid when supplying data to the Chart.

This also works in combination with the Treelist, Listbox and VerticalGrid controls.

Grid Data In Chart

Use a Chart as Grid Cell Editor

With v17.2 we implemented a long requested feature; Use a chart as Grid Cell Editor!

This gives you the possibility to design beautiful master-detail data visualizations as you can see:

Cell Chart

This functionality is based on the RepositoryItemAnyControl class and is now possible because we have implemented the IAnyControlEdit interface on the Chart control.

Conclusion

With this release we’ve taken a big step in letting different controls make use of each others functionality. For you this means writing less code and better performance. This will result in an even better experience for your end-users.

Talking about performance and user experience; have you seen Julian’s blog post about that we’ve done with the XtraGrid in v17.2?

2 comment(s)
Roel Vlemmings
Roel Vlemmings

I really like that we will have the Filter Editor for charts. But ideally, we would also have grouping capability.

For example, we have a screen where we show trades for investment portfolios. What I would like to see there is:

Total trade amount by security type (equity, mutual fund, bond, etc.)

Total trade amount by broker (JP Morgan, Deutsche Bank, Goldman Sachs)

Total trade amount by sector (Technology, Healthcare, Financials)

I can get these values in the grid by grouping the grid, for example, by the Security Type field, and then showing the group summary for the Amount column.

Ideally, it should be easy to do the same thing for charts without any programming. Is the "Binding the Grid to a Chart" functionality going to assist in this?

13 November, 2017
Roman K (DevExpress)
Roman K (DevExpress)

Hello Roel,

The Grid Control provides only non-grouped data rows, and the Chart Control can group data rows itself using aggregation functions. To do this, you should specify the column whose values you will be using for grouping as a series's ArgumentDataMember.

The following code sample demonstrates how to do this.

```csharp

chart.SeriesTemplate.ArgumentDataMember = "Broker";

((XYDiagram)chart.Diagram).AxisX.QualitativeScaleOptions.AggregateFunction = AggregateFunction.Sum;

```

Note that with the 17.2 release we have also introduced the axis's QualitativeScaleOptions property.

14 November, 2017

Please login or register to post comments.