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

    This walkthrough creates a Gantt Chart to layout recommended child immunization schedule based on age in the United States. The schedule shows recommended vaccines at an acceptable age range, the number of doses, and highlights the recommendations for all children, catch-up vaccinations in case of missed vaccines, and other high-risk groups.

    Gantt 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 'Embedded'.
    4. In the Select or type the file name or URL or enter the data to be embedded field, enter the following data:

      JSON Data

      Copy Code
      [
       {
         "Vaccine": "Hepatitis B (HepB)",
         "Start": 0,
         "End": 1,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Hepatitis B (HepB)",
         "Start": 1,
         "End": 3,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Hepatitis B (HepB)",
         "Start": 4,
         "End": 5,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Hepatitis B (HepB)",
         "Start": 6,
         "End": 18,
         "Dose": "3rd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Hepatitis B (HepB)",
         "Start": 19,
         "End": 216,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Rotavirus (RV)",
         "Start": 2,
         "End": 3,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Rotavirus (RV)",
         "Start": 4,
         "End": 5,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Rotavirus (RV)",
         "Start": 6,
         "End": 7,
         "Dose": "3rd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Diptheria, Tetanus & Acellular pertussis (DTaP)",
         "Start": 2,
         "End": 3,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Diptheria, Tetanus & Acellular pertussis (DTaP)",
         "Start": 4,
         "End": 5,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Diptheria, Tetanus & Acellular pertussis (DTaP)",
         "Start": 6,
         "End": 7,
         "Dose": "3rd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Diptheria, Tetanus & Acellular pertussis (DTaP)",
         "Start": 9,
         "End": 12,
         "Dose": " ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Diptheria, Tetanus & Acellular pertussis (DTaP)",
         "Start": 15,
         "End": 18,
         "Dose": "4th Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Diptheria, Tetanus & Acellular pertussis (DTaP)",
         "Start": 18.5,
         "End": 48,
         "Dose": " ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Diptheria, Tetanus & Acellular pertussis (DTaP)",
         "Start": 48,
         "End": 84,
         "Dose": "5th Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Haemophilus Influenzae type b (Hib)",
         "Start": 2,
         "End": 3,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Haemophilus Influenzae type b (Hib)",
         "Start": 4,
         "End": 5,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Haemophilus Influenzae type b (Hib)",
         "Start": 9,
         "End": 10,
         "Dose": "  ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Haemophilus Influenzae type b (Hib)",
         "Start": 12,
         "End": 16,
         "Dose": "3rd Dose or 4th Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Haemophilus Influenzae type b (Hib)",
         "Start": 18,
         "End": 36,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Haemophilus Influenzae type b (Hib)",
         "Start": 48,
         "End": 84,
         "Dose": " ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Haemophilus Influenzae type b (Hib)",
         "Start": 84,
         "End": 216,
         "Dose": " ",
         "Range": "For certain high-risks groups"
       },
       {
         "Vaccine": "Pneumococcal conjugate (PCV13)",
         "Start": 2,
         "End": 3,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Pneumococcal conjugate (PCV13)",
         "Start": 4,
         "End": 5,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Pneumococcal conjugate (PCV13)",
         "Start": 6,
         "End": 7,
         "Dose": "3rd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Pneumococcal conjugate (PCV13)",
         "Start": 9,
         "End": 10,
         "Dose": "  ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Pneumococcal conjugate (PCV13)",
         "Start": 12,
         "End": 16,
         "Dose": "4th Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Pneumococcal conjugate (PCV13)",
         "Start": 19,
         "End": 84,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Pneumococcal conjugate (PCV13)",
         "Start": 84,
         "End": 216,
         "Dose": " ",
         "Range": "For certain high-risks groups"
       },
       {
         "Vaccine": "Inactivated poliovirus (IPV)",
         "Start": 2,
         "End": 3,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Inactivated poliovirus (IPV)",
         "Start": 4,
         "End": 5,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Inactivated poliovirus (IPV)",
         "Start": 6,
         "End": 18,
         "Dose": "3rd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Inactivated poliovirus (IPV)",
         "Start": 18.1,
         "End": 48,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Inactivated poliovirus (IPV)",
         "Start": 48,
         "End": 84,
         "Dose": "4th Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Inactivated poliovirus (IPV)",
         "Start": 84,
         "End": 204,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Influenza (IIV)",
         "Start": 6,
         "End": 18,
         "Dose": "Annual vaccination 1 or 2 doses ",
         "Range": "For all children"
       },
       {
        "Vaccine": "Influenza (IIV)",
        "Start": 18,
        "End": 19,
        "Dose": " ",
        "Range": "For all children"
      },
       {
         "Vaccine": "Influenza (IIV)",
         "Start": 19,
         "End": 84,
         "Dose": "Annual vaccination 1 or 2 doses",
         "Range": "For all children"
       },
       {
         "Vaccine": "Influenza (IIV)",
         "Start": 96,
         "End": 216,
         "Dose": "Annual vaccination 1 dose only",
         "Range": "For all children"
       },
       {
        "Vaccine": "Measles, mumps, rubella (MMR)",
        "Start": 6,
        "End": 9,
        "Dose": " ",
        "Range": "For certain high-risks groups"
      },
       {
         "Vaccine": "Measles, mumps, rubella (MMR)",
         "Start": 12,
         "End": 16,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Measles, mumps, rubella (MMR)",
         "Start": 18.1,
         "End": 48,
         "Dose": "  ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Measles, mumps, rubella (MMR)",
         "Start": 48,
         "End": 84,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Measles, mumps, rubella (MMR)",
         "Start": 84,
         "End": 216,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Varicella (VAR)",
         "Start": 12,
         "End": 16,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Varicella (VAR)",
         "Start": 18.1,
         "End": 48,
         "Dose": "  ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Varicella (VAR)",
         "Start": 48,
         "End": 84,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Varicella (VAR)",
         "Start": 84,
         "End": 216,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       {
        "Vaccine": "Hepatitis A (HepA)",
        "Start": 6,
        "End": 9,
        "Dose": "  ",
        "Range": "For certain high-risks groups"
      },
       {
         "Vaccine": "Hepatitis A (HepA)",
         "Start": 12,
         "End": 18,
         "Dose": "2nd Dose Series",
         "Range": "For all children"
       },
       {
         "Vaccine": "Hepatitis A (HepA)",
         "Start": 18,
         "End": 23,
         "Dose": " ",
         "Range": "For all children"
       },
       {
         "Vaccine": "Hepatitis A (HepA)",
         "Start": 24,
         "End": 216,
         "Dose": "",
         "Range": "For catch-up immunization"
       },
       
       {
        "Vaccine": "Meningococcal (MenACWY)",
        "Start": 2,
        "End": 132,
        "Dose": " ",
        "Range": "For certain high-risks groups"
      },
       {
         "Vaccine": "Meningococcal (MenACWY)",
         "Start": 132,
         "End": 156,
         "Dose": "1st Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Meningococcal (MenACWY)",
         "Start": 156,
         "End": 180,
         "Dose": "   ",
         "Range": "For catch-up immunization"
       },
       {
         "Vaccine": "Meningococcal (MenACWY)",
         "Start": 180,
         "End": 191,
         "Dose": "2nd Dose",
         "Range": "For all children"
       },
       {
         "Vaccine": "Meningococcal (MenACWY)",
         "Start": 191,
         "End": 216,
         "Dose": "  ",
         "Range": "For catch-up immunization"
       }
      ]
      

      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 Data Source icon.
    6. Click OK to save the changes and open the DataSet dialog.

    Add a Dataset   

    1. In the Chart Wizard, from the Select Data Set dialog, select a suitable Dataset name from the dropdown menu.
    2. Go to the Query page and enter the following query to fetch the required fields:
      Query
      Copy Code
      $.[*]
    3. Click OK to save the changes.

    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 'DataSet1' and the Chart Type as 'Gantt'.
    3. Click Next to proceed.
    4. Under Choose Data Values, add a new data value, and set its properties as below.
      Start Field End Field
      =[Start] =[End]
    5. Under the Choose Data Categories option, set the following fields:
      Field SortDirection
      =[Vaccine] None
    6. Under the Choose Data Subcategories option, set the following fields:
      Field SortDirection
      =[Dose] None
    7. Click Next to preview your chart.
       Gantt Chart - Preview
      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 Data Fields page and ensure that Type is set to 'Complex'.  
    3. Go to the Categories page, with the Expression to =[Vaccine], remove the Sorting field.
    4. Go to the Encodings page > Detail tab and set the following properties:
      • Expression: =[Dose]
      • Group: Cluster
      • Sorting field: =[Start]
      • Exclude nulls: Check-on
    5. Go to the Color tab and set the Expression to =[Range].
    6. Go to the Labels page > General and set following properties:
      • Template: {detailFields.value}
      • Text Position: Center
      • Overlapping Labels Mode: Auto
    7. 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' from the Report Explorer and choose Property Dialog.    
    2. Go to the Title page and set the following properties.
      • Title: Age (in months)
      • Font > Size: 10pt
      • Padding > Top: 4pt
      • Padding > Bottom: 4pt
    3. Go to the Layout page and set Position to 'Far'.
    4. Go to the Labels page > General, check-on Show Labels and set Format to 'n0'.    
    5. Go to the Labels page > Appearance tab and set the following properties.
      • Font > Size: 9pt
      • Font > Color: DimGray
    6. Go to the Line page and check the Show Line option. Set the color to 'Gainsboro'.
    7. Go to the Major Gridline page and set Grid appearance > Show Grid: Uncheck
    8. Go to the Scale page and set the following properties.
      • Scale Type: Linear
      • Minimum Scale value: 0
      • Maximum Scale value: 18
    9. 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 Layout page and check the Position > Reversed option to reverse the axis to appear from top to bottom.
    4. Go to the Labels page > General tab and check the Show Labels option to show the data labels.
    5. Go to the Labels page > Appearance tab and set the following properties.
      • Font > Size: 9pt
      • Font > Color: DimGray
    6. Go to the Line page and uncheck the Show Line option.
    7. Go to the Minor Gridline page and uncheck the Show Grid option to hide minor gridlines.
    8. Go to the Major Gridline page, check the Show Grid option, and set the Color to 'GainsBoro'.
    9. Click OK to complete setting up the X-axis.

    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 add these custom palette colors, #bfecb8, #9ebac4 and #ffb1ae.
    3. Click OK to complete setting up the chart palette.

    Legend - Color

    1. To open the smart panel for the legend, right-click 'Legend - Color' on the Report Explorer, and choose Property Dialog.
    2. Go to the Title page and set the title to 'Recommended age range' and Font > Size  to '12pt'.
    3. Go to the Appearance page and set the following properties.
      • Font > Size: 10pt
      • Font > Color: DimGray
    4. Go to the Layout page and set the following properties.
      • Position: Top
      • Orientation: Horizontal
    5. Click OK to complete setting up the Legend.

    Chart

    1. From the Report Explorer, select Chart.
    2. In the Properties panel, go to BarSettings > Overlap and set it to some percentage, say '98%'.

    Chart Header

    1. To open the smart panel for the chart header, click 'Header' on the Report Explorer and choose Property Dialog.
    2. Go to the General page and set Text to 'Child Immunization Schedule'.
    3. Set the Horizontal Alignment to Center and Vertical Alignment to Middle.
    4. Go to the Font page and set the properties as below.
      • Size: 20pt
      • Color: #3da7a8
    5. Click OK to complete setting up the chart header.
      You may want to resize the chart.
         Gantt 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 preview.
    6. Once you are done with configuring and customizing the chart, press F5 to preview the report.