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:
- Select the Chart Area control.
- Define DataTemplates to link ItemDataView objects to Chart Item Elements.
- Define DataTemplates to link ChartScale objects to Axes elements.
- Define selected at the step one ItemsControl (Chart Area control) style.
- Optionally, define the control and corresponding DataTemplates and a style for the Chart legend element.
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.