ActiveReports 16 .NET Edition
ActiveReports 16 User Guide / Concepts / Page Report/RDL Report Concepts / Toolbox / Chart / Plots / Line Chart / Create Single Line Chart
In This Topic
    Create Single Line Chart
    In This Topic

    This walkthrough creates a Single Line Chart. The chart shows the trend in the return quantity over the year. The final chart appears like this:

    Single Line Chart

    Create a Report

    In the ActiveReports Designer, create a new RDL report.

    Bind Report to Data

    The Report Data Source dialog is invoked when a new report is created if you keep the default check on for the Launch Data Source Wizard option. You can also access this dialog by right-clicking the Data Sources node in the Report Explorer and then selecting the Add Data Source option.

    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 'Json Provider'.
    3. Go to the Content tab under Connection and set the type of JSON data to 'External file or URL'.
    4. In the Select or type the file name or URL field, enter the following URL:
      https://demodata.grapecity.com/contoso/odata/v1/FactSales
      For more information, see the JSON Provider topic.
    5. Go to the Connection String tab and verify the generated connection string by clicking the Validate DataSource Validate Icon icon.
    6. Click OK to save the changes and open the DataSet dialog.

    Add a Dataset

    1. In the Dataset dialog, select the General page and enter the name of the dataset, 'FactSales'.
    2. Go to the Query page and enter the following query to fetch the required fields:  
      Query
      Copy Code
      $.value[*]
           
    3. Click OK to save the changes.
    4. Go to the Fields page to view the available fields and modify the Name of the [DateKey] and [ReturnQuantity] fields to [Sales Date] and [Return Quantity], respectively.

    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 onto the design area. The Chart Wizard dialog appears with an option to select the data and the chart type.
    2. Select the Dataset Name as 'FactSales' and the Chart Type as 'Line'.
    3. Click Next to proceed. Here, you need to specify the line settings. We will define a data series value to display the return quantity values along the horizontal axis.
    4. Under Choose Data Values, add a new data value, and set its properties as below. 
      Field Aggregate
      =[Return Quantity] Sum
    5. In Choose Data Categories, set Field to =MonthName(Month([Sales Date])). We will add more customizations to the category in later steps.
    6. Click Next to preview your chart.
       Line Chart at Preview Time
      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. Here, we will sort the month names to display in the order of increasing month numbers. So fill in the following settings:
      Field Settings
      Sorting field =Month([Sales Date])
      Sorting direction Ascending
    3. Go to the Appearance page and set the following properties.
      • Line Style > Width: 1.5pt
      • Line Style > Color: #808080
      • Symbol Settings > Shape: Dot
      • Symbol Settings > Background Color: #1fd537
      • Symbol Border Settings > Style: Solid
      • Symbol Border Settings > Color: White          
    4. 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 and remove the text from the Title field to hide the Y-axis title in the chart.
    3. Go to the Labels page and set the following properties:
      • Font > Size: 10pt
      • Font > Color: DimGray
    4. Go to the Line page and uncheck the Show Line option.
    5. Go to the Major Gridline page and set the following properties.
      • Show Grid: Check-on
      • Grid appearance > Width: 0.25pt
      • Grid appearance > Color: #cccccc
      • Grid appearance > Style: Dashed
    6. Go to the Scale page and set the following properties.
      • Scale Type: Linear
      • Minimum scale value: 0
      • Maximum scale value: 11
    7. Click OK to complete setting up the Y-axis.

    X-Axis

    1. To open the smart panel for advanced X-axis settings, right-click 'X-axis' on the Report Explorer and choose Property Dialog.
    2. Go to the Title page and remove the text from the Title field to hide the X-axis title in the chart.
    3. Go to the Labels page > General tab and set the Angle to '-45'.
    4. Now go to the Appearance tab and set the following properties.
      • Font > Size: 10pt
      • Font > Color: DimGray
    5. Go to the Line page and set the following properties.
      • Color: #cccccc
      • Width: 2pt
    6. Click OK to complete setting up the X-axis.

    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 Text to 'Product Returns'.
    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.
         Single Line Plot 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.