After the developer has selected OpenWPFChart predefined parts or has wrote its own extension parts she or he wants to see at the Chart, one can proceed to the Chart composition.

Chart could be composed from Chart Parts as either reusable piece of code like Custom or User Control or directly at the WPF Window or Page. The latter approach has some drawbacks because it forces to place a lot of XAML code at the Windows or Page XAML but, except for lack of maintainability and reusability, there is nothing wrong in this approach. Anyhow, the composition principles remain the same.

The steps the developer has to take are as follows:
  1. Select the Chart Area control.
  2. Define DataTemplates to link ItemDataView objects to Chart Item Elements.
  3. Define DataTemplates to link ChartScale objects to Axes elements.
  4. Define selected at the step one ItemsControl (Chart Area control) style.
  5. Optionally, define the control and corresponding DataTemplates and a style for the Chart legend element.

Chart Area

Chart Area is a rectangular partition of the Chart where Chart Items and grid lines are drawn. The Chart Area control is the one managing Chart Items. It holds Chart Items as well as decorative elements like coordinate Grids, Axes (if they should be rendered at the Chart Area), text labels, etc.
Most naturally Chart Area control is one of the ItemsControl derived class. It could be the ItemsControl class itself if the new chart doesn’t require to support the selection. Or, it could be the Selector class or, more convenient, the ListBox.

Last edited Mar 16, 2009 at 5:30 AM by ovp, version 1


No comments yet.