ActiveReports 6 Online Help
Bar Chart

Bar charts are useful in comparing items across categories. This walkthrough illustrates how to create a simple bar chart using the ActiveReports chart control.

The walkthrough is split up into the following activities:

Tip: For basic steps like adding a report to a Visual Studio project and viewing a report, please see the Basic Data Bound Reports walkthrough.

To complete the walkthrough, you must have access to the Northwind database.
A copy is located at C:\Program Files\GrapeCity\ActiveReports 6\Data\NWIND.MDB (on a 64-bit Windows operating system, a copy is located in C:\Program Files (x86)\GrapeCity\ActiveReports 6\Data\NWIND.MDB).

When you have finished this walkthrough, you will have a report that looks similar to the following.

To add a chart control to the report

  1. Resize the section in which you want to place the chart.
  2. Click the ChartControl in the ActiveReports toolbox and draw it onto the report.
  3. If the chart wizard appears, click Cancel.
    Tip: If you do not want the chart wizard to appear each time you add a chart, clear the Auto Run Wizard checkbox. You can still access the wizard via the command verbs (see below).
  4. Select the ChartControl and set its Size property to 7.5, 3.5 in.

To set a data source for the chart

  1. With the chart control highlighted, click the Data Source verb below the Properties Window.
    Tip: If the verb is not visible, right-click an empty space in the Properties Window and select Commands to display verbs.
  2. In the Chart DataSource dialog box that appears, click the Build button.
  3. In the Data Link Properties window, select Microsoft Jet 4.0 OLE DB Provider and click the Next button. 
  4. Click the ellipsis button (...) to browse to the Northwind database. Click Open once you have selected the file.
  5. Click the OK button to close the window and fill in the Connection String.
  6. In the Query field, enter the following SQL query 
    SQL Query
    Copy Code
    SELECT ShipCountry, SUM(Freight) AS FreightSum FROM Orders GROUP BY ShipCountry
  7. Click OK to save the data source and return to the report design surface.

To set the chart's properties

  1. With the chart control highlighted, click the Customize verb below the Properties Window to open the Chart Designer window.  
  2. In the ChartAreas view which displays by default, click the Axes bar to expand it.
  3. Click Axis X, and on the Common tab in the pane to the right, type Country in the Title textbox and increase the font size to 12.
  4. Choose the Labels tab in the Axis Properties pane on the right, select the Staggered Labels option to avoid overlapping labels and set the Text angle property to 45.
  5. Click Axis Y on the left, and on the Common tab in the pane to the right, type Freight in the Title textbox and increase the font size to 12.
  6. Click the Titles bar on the left to expand it and display Title Properties in the pane to the right. In the list of titles, header is selected by default.
  7. Type Simple Bar Chart in the Caption textbox, and increase the font size to 14.
  8. Select the footer in the list of titles to the left, and delete it.
  9. Click the Series bar on the left to expand it and display Series Properties in the pane to the right. Series1 is selected by default.
  10. In the Data Binding box, set X (Name) to ShipCountry, and set Y to FreightSum.
  11. Delete Series2 and Series3.
  12. Click the Legend bar on the left to expand it and display Legend Properties in the pane to the right. defaultLegend is selected by default.
  13. Clear the Visible checkbox at the top of the Common tab to hide the legend.
  14. Click the Finish button to exit the Chart Designer.
See Also

Concepts