Chart with Dynamic Series
- Last UpdatedOct 30, 2024
- 4 minute read
Creates a report with a Chart control bound to data, all series are auto-created using the series template which specifies common data binding properties.
The data for all series (the series names along with series point arguments) must be stored in the same data table. Also, the series view type and certain other settings must be the same for all the created series.
In this example the GSP table of the sample gsp.mdb database is used. This table contains the Gross State Product (GSP) statistics for some US regions.

-
Create a new report.
-
On the Toolbox, select a Chart control.
-
Click on the Detail blank space to position the control.

Note:
The Chart Wizard may be displayed at this point (if the Show wizard every time a new chart is added option is enabled). Click Cancel to close the Chart Wizard and manually customize the chart. -
To bind the chart to a data source, click the Smart tag, and select Add New DataSource from the Data Source drop-down list. The Report Wizard is displayed.

The wizard can be used assign a data non-dabacon source to the chart.
The specified data source is then assigned to the chart's Data Source property. The Data Member property is also set, which specifies which table or view of the dataset the chart obtains data from, as is the Data Adapter property.


Note:
The report Data Source property must be set to None. Otherwise, the chart is blank when previewed.
-
To specify the data field which provides data for the series names, set the Series Data Member property.

-
Set the Argument Data Member property.

Set the Data Members property, specify the data fields from which the series obtains the data values of its points.

A number of modifications can be made to improve the appearance of a chart, for example:
-
Adjust the Series Name Template. By default, the name for every series, automatically generated by the chart using the Series Data Member property, is obtained directly from a data field in the bound data source. It may be necessary to add prefixes or suffixes to these names. Customize the Series Name Template object returned by the Series Name Template property to add some text to the beginning or to the end of the series names. For example, set the Series Name Template > Begin Text property to GSP in.
-
Customize Series Labels. Set the Series Template > Label Visibility property to No to hide labels for all series points and prevent the chart from being crowded with numerous overlapping labels.
-
Customize Axis Labels. Initially, all axis labels (which, in the preview example, display the names of the US regions) are lined up and overlap. To avoid this, select the X-Axis (which is also accessed via the Chart Control > Diagram > Axis X property) and set the Label.Staggered property to Yes.
-
-
Click the Print Preview tab to display the result.

Refer to Create Layout Template / Report Definition and Bind Report to Non-Dabacon Data for further information.