ActiveReports 18 .NET Edition
Report Authors: Designer Components / Report Controls / Page/RDLX Report / Chart / Plots / Range Charts / Create Range Bar Chart
In This Topic
    Create Range Bar Chart
    In This Topic

    This walkthrough shows creating a Range Bar chart. The final chart appears like this:

    Range Bar Chart

    Create a Report and Bind Report to Data

    In the ActiveReports Designer, create a new RDLX report and follow the New Report wizard to bind the report to data. You can also perform data binding later using the Report Data Source dialog accessed from the Report Explorer.

    Connect to a Data Source

    1. In the Report Data Source dialog, select the General page and enter the name of the data source.
    2. Under Type, select 'Csv Provider'.
      For more information, see the CSV topic.
    3. Go to the Connection String tab and click Build
    4. In the Path field, navigate to the CSV file with content: weatherdata.csv  
    5. Click Get from preview and edit the Data Type column for the following fields as shown.
      Name Data Type
      DATE DateTime
      CITY String
      AVG MIN TEMP Float
      AVG MAX TEMP Float
      RAINFALL Min Float
      RAINFALL Max Float
      SUNRISE DateTime
      SUNSET DateTime
    6. Click OK to view the generated connection string, which will be similar to the following:
      Connection String
      Copy Code
      Path=C:\\Data\\weatherdata.csv;Locale=en-US;TextQualifier=";ColumnsSeparator=,;RowsSeparator=\r\n;Columns=DATE(DateTime),CITY,AVG MIN TEMP,AVG MAX TEMP,RAINFALL Min,RAINFALL Max,SUNRISE,SUNSET;HasHeaders=True
      
    7. Click OK to complete connecting to data.

    Add Report Parameters

    CityParameter

    1. In the Report Explorer, right-click Parameters and select Add Parameters.
    2. In the Report - Parameters dialog's General tab, add a name for the parameter, 'CityParameter'.
    3. Ensure that the Data type matches that of the field (here, String).
    4. In the Available Values tab, select Non-queried and enter:
      • Label: Melbourne Airport 
      • Value: MelbourneAirport
      • Order By > Condition: Value
      • Order By > Direction: Ascending
    5. In the Default Values tab, select Non-queried and add 'MelbourneAirport' (same as the Value in Available Value tab).

    YearParameter

    1. Add another parameter and in the General tab, add a name for the parameter, 'YearParameter'.
    2. Ensure that the Data type matches that of the field (here, Integer).
    3. In the Available Values tab, select Non-queried and enter:
      • Label: 2015 
      • Value: 2015
      • Order By > Condition: Value
      • Order By > Direction: Ascending
    4. In the Default Values tab, select Non-queried and add '2015' (same as the Value in Available Value tab).

    Add Filter to Dataset

    1. Right-click the 'weatherdata' dataset and select Edit.
    2. Go to Filters page and add following two filters:
      S.no. Expression Operator Value
      1. =Fields!CITY.Value Equal =Parameters!CityParameter.Value
      2. =Year(Fields!DATE.Value) Equal =Parameters!YearParameter.Value
    3. Now that the filters are added in the dataset, click OK.

    Create a Chart

    We will use the Chart Wizard dialog to configure chart data values and customization. The wizard appears by default if you have a dataset added to your report. See the topic on Chart Wizard for more information.

    1. Drag-drop Chart data region The Chart Wizard dialog appears with an option to select the data and the chart type.
    2. Select the Dataset name as 'weatherdata' and the Chart Type as 'Range Bar'.
    3. Click Next to proceed. Here, you need to specify the settings for the Range Bar chart.
    4. In Choose Data Values section, we will define the start and end fields.
      Start Field End Field
      =Fields!SUNRISE.Value =Fields!SUNSET.Value
    5. In Choose Data Categories, enter the field as =MonthName(Month([DATE])). We will add more customizations to the category in later steps.
    6. Click Next to preview your chart.
       Range Bar Chart Dialog Box
      You can also modify the chart palette and do other customizations as the last step in the process of chart creation. Or, you can exit the wizard and access these smart panels as explained below. 

    Set Advanced Customization

    Now that the chart is configured with data values, let us do some customizations on the chart elements using the smart panels.

    Plot Settings

    1. To open the smart panel for advanced plot settings, right-click 'Plot-Plot1' on the Report Explorer and choose Property Dialog.
    2. Go to the Categories page and in the Sorting > Sorting field, select =Fields!DATE.Value field and set the Sort direction to 'Ascending'.
    3. Click OK to complete setting up the plot.

    Y-Axis

    1. To open the smart panel for advanced Y-axis settings, right-click 'Y-axis' on the Report Explorer and choose Property Dialog.
    2. Go to the Title page. Enter the text in the Title field as 'Sunrise-Sunset Time' and set Color to 'DimGray'.
    3. Go to the Labels page > General tab and set Format to 'HH:MM'.
    4. Go to the Labels page > Appearance tab and set the following properties.
      • Font > Size: 9pt
      • Font > Color: DimGray
    5. Go to the Major Gridline page and set the following properties.
      • Show grid: Check-on
      • Grid appearance > Color: #cccccc 
      • Grid appearance > Width: 0.25pt
      • Grid appearance > Style: Dashed
    6. Click OK to complete setting up the Y-axis.

    X-Axis

    1. To open the smart panel for advanced Y-axis settings, right-click 'X-axis' on the Report Explorer and choose Property Dialog.
    2. Go to the Title page and edit the text in the Title field to 'Month' and set Color to 'DimGray'.
    3. Go to the Labels page > Appearance tab and set Font > Color  to DimGray.

    Chart Palette

    1. To open the smart panel for advanced chart settings, right-click 'Chart' on the Report Explorer and choose Property Dialog.
    2. Go to the Palette page and select 'Aspect'
    3. Click OK to complete setting up the chart palette.

    Chart Header

    1. To open the smart panel for the chart header, right-click 'Header' on the Report Explorer and choose Property Dialog.
    2. Go to the General page and set the Title to the following expression:
      Copy Code
      ="Monthly Average Daytime Hours for the Year " & Parameters!YearParameter.Value
      
    3. Go to the Font page and set the properties as below.
      • Size: 24pt
      • Color: #3da7a8
    4. Click OK to complete setting up the chart header.
      You may want to resize the chart.

      Range Column Chart at Design Time

      Note: We use stub data at design time and not real data. So to view the actual final chart, you need to view the chart on the preview.

    5. Once you are done with configuring and customizing the chart, press F5 to preview the report.