The Chart is a sophisticated control used to embed graphs in to your report. It graphically represents a series of points using numerous 2D or 3D chart types. A Chart can be populated with points both manually (by specifying arguments and values for each point) and dynamically (by connecting it to the report's data source, or binding it to a separate one).
There are many available Chart types you can choose from. To name a few, Bar, Point, Line, Pie and Doughnut, Area, Radar and Polar, Range Bar, Gantt, Candle Stick and Stock charts.
A Chart control contains multiple elements (diagram, series, series points, axes, legend, titles, labels, strips, constant lines, etc.). When any of these elements is selected, the Property Grid shows only the properties which correspond to the selected item. Visual Chart elements can be highlighted or selected and described in Highlighting and Selection Chart Elements.
The Chart control is data-aware in a different manner than the other report controls. Consider three common report scenarios:
1. Static data for a Chart's series is provided manually. It can be done using the Series Collection Editor invoked by the Chart's Series property. It allows you to manually define values and arguments for each series point.
2. Chart's series are created automatically, getting their data from the Chart's Data Source and dependent on the rules defined by the Series Template property. This approach is described in Chart with Dynamic Series.
3. Each series is created and customized manually and has a separate Data Source. This approach is described in Chart with Static Series.
When adding a chart to the report, the Chart Designer window will open up. Here you can design and edit your chart.
The Chart Designer will guide you through the whole process of customizing the Chart, from defining its view type to providing its data and customizing its appearance.
Start by clicking the plus next to 'Series' to create a new series of data and select a chart type.
You can change the Chart Type by clicking the 'Change Chart Type' button found at the top of the Chart Designer.
Whilst the Chart is selected, on the right-hand side of the chart designer, navigate to the 'Data' tab. Here you can select which data fields will populate the chart.
- Series - The data field to be set that the 'Argument' and 'Value' fields will link to.
- Argument - This is the data field that will populate the y-axis.
- Value - This is the data field that will populate the x-axis.
In the example below, the 'Series' is set to the 'Company Name', the 'Argument' is set to the 'Inventory Name' and the 'Value' is set to 'Average Unit Cost'. This should create a chart that displays the Average Unit Cost as bars for each item in each company. Click 'OK' once completed.
We can add a 'Filter String' to the chart if you wish to refine the data on the chart. For example if we wanted to view the Average Unit Cost of each Item for only the 1st company.
Select the created chart. Navigate to the 'Properties' panel on the right, and then to the 'Data' tab. Under 'Series Templet' click the ellipses next to 'Filter String'.
The filter expression is set to the 'Company ID' field. The chart will now only display records for the company with ID 1. Click 'OK' to set the filter.
You can click the 'Preview' tab to see what data the chart represents and how it would appear on a running report. The example below needs some adjustments before it is readable.
Navigate to the 'Designer' tab and click the Smart Tag, select 'Run Designer...' to open the Chart Designer again.
You can select any of the elements on the chart and then navigate to either the 'Options' tab or 'Properties' tab to change settings for the selected element.
In the below example, the 'Chart Legend' element has been selected, we can take it off the chart but unselecting the 'Visibility' option.
- To further clean up the chart, I added to the filter string to only show items that are from the Inventory Group 'FG Bags'
- The Value Labels visibility setting unselected to make the bars more visible.
The chart now looks like this on the 'Preview' tab
To finish the chart off, we can add some titles to the chart and axes.
Open the 'Chart Designer' again, in the navigation tree on the left, go to 'XY-Diagram' > 'Default Pane' > 'Title'. On the 'Options' tab on the right of the Chart Designer, select the visibility to make the title show up on the chart and type in 'Text' to set the title.
Do the same for 'Primary AxisX' and 'Proimary AxisY'
My simple chart is now ready to be previewed.