ActiveReports 18 .NET Edition
Report Authors / Report Controls / Report Controls in Page/RDLX Report / Chart / Plots / Candlestick Chart / Create Candlestick Chart
In This Topic
    Create Candlestick Chart
    In This Topic

    This walkthrough creates a Candlestick Chart. The chart shows the movement of the stock price for a certain company over time. The rectangles in the chart show the relationship between the opening and closing values. If the rectangle is filled with a background color, it means that the opening value is greater than the closing value. Else, the rectangle is empty. Moreover, the vertical lines above and below the rectangle represent the high and low values in the chart. The final chart appears like this:

    Candlestick 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 '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
      [
        {
          "Date": "1/4/2021",
          "Close": 129.41,
          "Open": 133.52,
          "High": 133.61,
          "Low": 126.76
        },
        {
          "Date": "1/5/2021",
          "Close": 131.01,
          "Open": 128.89,
          "High": 131.74,
          "Low": 128.43
        },
        {
          "Date": "1/6/2021",
          "Close": 126.6,
          "Open": 127.72,
          "High": 131.05,
          "Low": 126.38
        },
        {
          "Date": "1/7/2021",
          "Close": 130.92,
          "Open": 128.36,
          "High": 131.63,
          "Low": 127.86
        },
        {
          "Date": "1/8/2021",
          "Close": 132.05,
          "Open": 132.43,
          "High": 132.63,
          "Low": 130.23
        },
        {
          "Date": "1/11/2021",
          "Close": 128.98,
          "Open": 129.19,
          "High": 130.17,
          "Low": 128.5
        },
        {
          "Date": "1/12/2021",
          "Close": 128.8,
          "Open": 128.5,
          "High": 129.69,
          "Low": 126.86
        },
        {
          "Date": "1/13/2021",
          "Close": 130.89,
          "Open": 128.76,
          "High": 131.45,
          "Low": 128.49
        },
        {
          "Date": "1/14/2021",
          "Close": 128.91,
          "Open": 130.8,
          "High": 131,
          "Low": 128.76
        },
        {
          "Date": "1/15/2021",
          "Close": 127.14,
          "Open": 128.78,
          "High": 130.22,
          "Low": 127
        },
        {
          "Date": "1/19/2021",
          "Close": 127.83,
          "Open": 127.78,
          "High": 128.71,
          "Low": 126.94
        },
        {
          "Date": "1/20/2021",
          "Close": 132.03,
          "Open": 128.66,
          "High": 132.49,
          "Low": 128.55
        },
        {
          "Date": "1/21/2021",
          "Close": 136.87,
          "Open": 133.8,
          "High": 139.67,
          "Low": 133.59
        },
        {
          "Date": "1/22/2021",
          "Close": 139.07,
          "Open": 136.28,
          "High": 139.85,
          "Low": 135.02
        },
        {
          "Date": "1/25/2021",
          "Close": 142.92,
          "Open": 143.07,
          "High": 145.09,
          "Low": 136.54
        },
        {
          "Date": "1/26/2021",
          "Close": 143.16,
          "Open": 143.6,
          "High": 144.3,
          "Low": 141.37
        },
        {
          "Date": "1/27/2021",
          "Close": 142.06,
          "Open": 143.43,
          "High": 144.3,
          "Low": 140.41
        },
        {
          "Date": "1/28/2021",
          "Close": 137.09,
          "Open": 139.52,
          "High": 141.99,
          "Low": 136.7
        },
        {
          "Date": "1/29/2021",
          "Close": 131.96,
          "Open": 135.83,
          "High": 136.74,
          "Low": 130.21
        },
        {
          "Date": "2/1/2021",
          "Close": 134.14,
          "Open": 133.75,
          "High": 135.38,
          "Low": 130.93
        },
        {
          "Date": "2/2/2021",
          "Close": 134.99,
          "Open": 135.73,
          "High": 136.31,
          "Low": 134.61
        },
        {
          "Date": "2/3/2021",
          "Close": 133.94,
          "Open": 135.76,
          "High": 135.77,
          "Low": 133.61
        },
        {
          "Date": "2/4/2021",
          "Close": 137.39,
          "Open": 136.3,
          "High": 137.4,
          "Low": 134.59
        },
        {
          "Date": "2/5/2021",
          "Close": 136.76,
          "Open": 137.35,
          "High": 137.42,
          "Low": 135.86
        },
        {
          "Date": "2/8/2021",
          "Close": 136.91,
          "Open": 136.03,
          "High": 136.96,
          "Low": 134.92
        },
        {
          "Date": "2/9/2021",
          "Close": 136.01,
          "Open": 136.62,
          "High": 137.88,
          "Low": 135.85
        },
        {
          "Date": "2/10/2021",
          "Close": 135.39,
          "Open": 136.48,
          "High": 136.99,
          "Low": 134.4
        },
        {
          "Date": "2/11/2021",
          "Close": 135.13,
          "Open": 135.9,
          "High": 136.39,
          "Low": 133.77
        },
        {
          "Date": "2/12/2021",
          "Close": 135.37,
          "Open": 134.35,
          "High": 135.53,
          "Low": 133.69
        },
        {
          "Date": "2/16/2021",
          "Close": 133.19,
          "Open": 135.49,
          "High": 136.01,
          "Low": 132.79
        },
        {
          "Date": "2/17/2021",
          "Close": 130.84,
          "Open": 131.25,
          "High": 132.22,
          "Low": 129.47
        },
        {
          "Date": "2/18/2021",
          "Close": 129.71,
          "Open": 129.2,
          "High": 130,
          "Low": 127.41
        },
        {
          "Date": "2/19/2021",
          "Close": 129.87,
          "Open": 130.24,
          "High": 130.71,
          "Low": 128.8
        },
        {
          "Date": "2/22/2021",
          "Close": 126,
          "Open": 128.01,
          "High": 129.72,
          "Low": 125.6
        },
        {
          "Date": "2/23/2021",
          "Close": 125.86,
          "Open": 123.76,
          "High": 126.71,
          "Low": 118.39
        },
        {
          "Date": "2/24/2021",
          "Close": 125.35,
          "Open": 124.94,
          "High": 125.56,
          "Low": 122.23
        },
        {
          "Date": "2/25/2021",
          "Close": 120.99,
          "Open": 124.68,
          "High": 126.46,
          "Low": 120.54
        },
        {
          "Date": "2/26/2021",
          "Close": 121.26,
          "Open": 122.59,
          "High": 124.85,
          "Low": 121.2
        },
        {
          "Date": "3/1/2021",
          "Close": 127.79,
          "Open": 123.75,
          "High": 127.93,
          "Low": 122.79
        },
        {
          "Date": "3/2/2021",
          "Close": 125.12,
          "Open": 128.41,
          "High": 128.72,
          "Low": 125.01
        },
        {
          "Date": "3/3/2021",
          "Close": 122.06,
          "Open": 124.81,
          "High": 125.71,
          "Low": 121.84
        },
        {
          "Date": "3/4/2021",
          "Close": 120.13,
          "Open": 121.75,
          "High": 123.6,
          "Low": 118.62
        },
        {
          "Date": "3/5/2021",
          "Close": 121.42,
          "Open": 120.98,
          "High": 121.94,
          "Low": 117.57
        },
        {
          "Date": "3/8/2021",
          "Close": 116.36,
          "Open": 120.93,
          "High": 121,
          "Low": 116.21
        },
        {
          "Date": "3/9/2021",
          "Close": 121.09,
          "Open": 119.03,
          "High": 122.06,
          "Low": 118.79
        },
        {
          "Date": "3/10/2021",
          "Close": 119.98,
          "Open": 121.69,
          "High": 122.17,
          "Low": 119.45
        },
        {
          "Date": "3/11/2021",
          "Close": 121.96,
          "Open": 122.54,
          "High": 123.21,
          "Low": 121.26
        },
        {
          "Date": "3/12/2021",
          "Close": 121.03,
          "Open": 120.4,
          "High": 121.17,
          "Low": 119.16
        },
        {
          "Date": "3/15/2021",
          "Close": 123.99,
          "Open": 121.41,
          "High": 124,
          "Low": 120.42
        },
        {
          "Date": "3/16/2021",
          "Close": 125.57,
          "Open": 125.7,
          "High": 127.22,
          "Low": 124.72
        },
        {
          "Date": "3/17/2021",
          "Close": 124.76,
          "Open": 124.05,
          "High": 125.86,
          "Low": 122.34
        },
        {
          "Date": "3/18/2021",
          "Close": 120.53,
          "Open": 122.88,
          "High": 123.18,
          "Low": 120.32
        },
        {
          "Date": "3/19/2021",
          "Close": 119.99,
          "Open": 119.9,
          "High": 121.43,
          "Low": 119.68
        },
        {
          "Date": "3/22/2021",
          "Close": 123.39,
          "Open": 120.33,
          "High": 123.87,
          "Low": 120.26
        },
        {
          "Date": "3/23/2021",
          "Close": 122.54,
          "Open": 123.33,
          "High": 124.24,
          "Low": 122.14
        },
        {
          "Date": "3/24/2021",
          "Close": 120.09,
          "Open": 122.82,
          "High": 122.9,
          "Low": 120.07
        },
        {
          "Date": "3/25/2021",
          "Close": 120.59,
          "Open": 119.54,
          "High": 121.66,
          "Low": 119
        },
        {
          "Date": "3/26/2021",
          "Close": 121.21,
          "Open": 120.35,
          "High": 121.48,
          "Low": 118.92
        },
        {
          "Date": "3/29/2021",
          "Close": 121.39,
          "Open": 121.65,
          "High": 122.58,
          "Low": 120.73
        },
        {
          "Date": "3/30/2021",
          "Close": 119.9,
          "Open": 120.11,
          "High": 120.4,
          "Low": 118.86
        },
        {
          "Date": "3/31/2021",
          "Close": 122.15,
          "Open": 121.65,
          "High": 123.52,
          "Low": 121.15
        },
        {
          "Date": "4/1/2021",
          "Close": 123,
          "Open": 123.66,
          "High": 124.18,
          "Low": 122.49
        },
        {
          "Date": "4/5/2021",
          "Close": 125.9,
          "Open": 123.87,
          "High": 126.16,
          "Low": 123.07
        },
        {
          "Date": "4/6/2021",
          "Close": 126.21,
          "Open": 126.5,
          "High": 127.13,
          "Low": 125.65
        },
        {
          "Date": "4/7/2021",
          "Close": 127.9,
          "Open": 125.83,
          "High": 127.92,
          "Low": 125.14
        },
        {
          "Date": "4/8/2021",
          "Close": 130.36,
          "Open": 128.95,
          "High": 130.39,
          "Low": 128.52
        },
        {
          "Date": "4/9/2021",
          "Close": 133,
          "Open": 129.8,
          "High": 133.04,
          "Low": 129.47
        },
        {
          "Date": "4/12/2021",
          "Close": 131.24,
          "Open": 132.52,
          "High": 132.85,
          "Low": 130.63
        },
        {
          "Date": "4/13/2021",
          "Close": 134.43,
          "Open": 132.44,
          "High": 134.66,
          "Low": 131.93
        },
        {
          "Date": "4/14/2021",
          "Close": 132.03,
          "Open": 134.94,
          "High": 135,
          "Low": 131.66
        },
        {
          "Date": "4/15/2021",
          "Close": 134.5,
          "Open": 133.82,
          "High": 135,
          "Low": 133.64
        },
        {
          "Date": "4/16/2021",
          "Close": 134.16,
          "Open": 134.3,
          "High": 134.67,
          "Low": 133.28
        },
        {
          "Date": "4/19/2021",
          "Close": 134.84,
          "Open": 133.51,
          "High": 135.47,
          "Low": 133.34
        },
        {
          "Date": "4/20/2021",
          "Close": 133.11,
          "Open": 135.02,
          "High": 135.53,
          "Low": 131.81
        },
        {
          "Date": "4/21/2021",
          "Close": 133.5,
          "Open": 132.36,
          "High": 133.75,
          "Low": 131.3
        },
        {
          "Date": "4/22/2021",
          "Close": 131.94,
          "Open": 133.04,
          "High": 134.15,
          "Low": 131.41
        },
        {
          "Date": "4/23/2021",
          "Close": 134.32,
          "Open": 132.16,
          "High": 135.12,
          "Low": 132.16
        },
        {
          "Date": "4/26/2021",
          "Close": 134.72,
          "Open": 134.83,
          "High": 135.06,
          "Low": 133.56
        },
        {
          "Date": "4/27/2021",
          "Close": 134.39,
          "Open": 135.01,
          "High": 135.41,
          "Low": 134.11
        },
        {
          "Date": "4/28/2021",
          "Close": 133.58,
          "Open": 134.31,
          "High": 135.02,
          "Low": 133.08
        },
        {
          "Date": "4/29/2021",
          "Close": 133.48,
          "Open": 136.47,
          "High": 137.07,
          "Low": 132.45
        },
        {
          "Date": "4/30/2021",
          "Close": 131.46,
          "Open": 131.78,
          "High": 133.56,
          "Low": 131.07
        },
        {
          "Date": "5/3/2021",
          "Close": 132.54,
          "Open": 132.04,
          "High": 134.07,
          "Low": 131.83
        },
        {
          "Date": "5/4/2021",
          "Close": 127.85,
          "Open": 131.19,
          "High": 131.49,
          "Low": 126.7
        },
        {
          "Date": "5/5/2021",
          "Close": 128.1,
          "Open": 129.2,
          "High": 130.45,
          "Low": 127.97
        },
        {
          "Date": "5/6/2021",
          "Close": 129.74,
          "Open": 127.89,
          "High": 129.75,
          "Low": 127.13
        },
        {
          "Date": "5/7/2021",
          "Close": 130.21,
          "Open": 130.85,
          "High": 131.26,
          "Low": 129.48
        },
        {
          "Date": "5/10/2021",
          "Close": 126.85,
          "Open": 129.41,
          "High": 129.54,
          "Low": 126.81
        },
        {
          "Date": "5/11/2021",
          "Close": 125.91,
          "Open": 123.5,
          "High": 126.27,
          "Low": 122.77
        },
        {
          "Date": "5/12/2021",
          "Close": 122.77,
          "Open": 123.4,
          "High": 124.64,
          "Low": 122.25
        },
        {
          "Date": "5/13/2021",
          "Close": 124.97,
          "Open": 124.58,
          "High": 126.15,
          "Low": 124.26
        },
        {
          "Date": "5/14/2021",
          "Close": 127.45,
          "Open": 126.25,
          "High": 127.89,
          "Low": 125.85
        },
        {
          "Date": "5/17/2021",
          "Close": 126.27,
          "Open": 126.82,
          "High": 126.93,
          "Low": 125.17
        },
        {
          "Date": "5/18/2021",
          "Close": 124.85,
          "Open": 126.56,
          "High": 126.99,
          "Low": 124.78
        },
        {
          "Date": "5/19/2021",
          "Close": 124.69,
          "Open": 123.16,
          "High": 124.92,
          "Low": 122.86
        },
        {
          "Date": "5/20/2021",
          "Close": 127.31,
          "Open": 125.23,
          "High": 127.72,
          "Low": 125.1
        },
        {
          "Date": "5/21/2021",
          "Close": 125.43,
          "Open": 127.82,
          "High": 128,
          "Low": 125.21
        },
        {
          "Date": "5/24/2021",
          "Close": 127.1,
          "Open": 126.01,
          "High": 127.94,
          "Low": 125.94
        },
        {
          "Date": "5/25/2021",
          "Close": 126.9,
          "Open": 127.82,
          "High": 128.32,
          "Low": 126.32
        },
        {
          "Date": "5/26/2021",
          "Close": 126.85,
          "Open": 126.96,
          "High": 127.39,
          "Low": 126.42
        },
        {
          "Date": "5/27/2021",
          "Close": 125.28,
          "Open": 126.44,
          "High": 127.64,
          "Low": 125.08
        },
        {
          "Date": "5/28/2021",
          "Close": 124.61,
          "Open": 125.57,
          "High": 125.8,
          "Low": 124.55
        },
        {
          "Date": "6/1/2021",
          "Close": 124.28,
          "Open": 125.08,
          "High": 125.35,
          "Low": 123.94
        },
        {
          "Date": "6/2/2021",
          "Close": 125.06,
          "Open": 124.28,
          "High": 125.24,
          "Low": 124.05
        },
        {
          "Date": "6/3/2021",
          "Close": 123.54,
          "Open": 124.68,
          "High": 124.85,
          "Low": 123.13
        },
        {
          "Date": "6/4/2021",
          "Close": 125.89,
          "Open": 124.07,
          "High": 126.16,
          "Low": 123.85
        },
        {
          "Date": "6/7/2021",
          "Close": 125.9,
          "Open": 126.17,
          "High": 126.32,
          "Low": 124.83
        },
        {
          "Date": "6/8/2021",
          "Close": 126.74,
          "Open": 126.6,
          "High": 128.46,
          "Low": 126.21
        }
      ]
      
      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, 'StockPrice'.
    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 'StockPrice' and the Chart Type as 'Candlestick'.
    3. Click Next to proceed. Here, we will define the high, low, open, and close field values in the chart.
    4. Under Choose Data Values, set the High, Low, Open, and Close fields to the following values.
      High Field Low Field Open Field Close Field
      =[High] =[Low] =[Open] =[Close]
    5. In Choose Data Category, set Field to =[Date] and Sort Direction to Ascending.
    6. Click Next to preview your chart.
       Candlestick 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. Select the 'Plot-Plot1' on the Report Explorer and go to the Properties pane to set advanced plot settings.
    2. Set the BackgroundColor property to '#f77268' to change the default color of the fill.

    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 > General page and set the Format to 'Currency (with 0 decimal points)'.
    4. Navigate to the Appearance tab and set the following properties.
      • Font > Size: 12pt
      • Font > Color: DimGray
    5. Go to the Line page and set the following properties.
      • Show Line: Check-on
      • Color: Black
      • Width: 1pt
      • Style: Solid
    6. Go to the Major Gridline page and set the following properties.
      • Grid Interval: 10
      • Grid appearance > Show Grid: Check-on
      • Grid appearance > Width: 0.25pt
      • Grid appearance > Color: #cccccc
      • Grid appearance > Style: Dashed 
      • Tick mark appearance > Position: Outside
      • Tick mark appearance > Color: #cccccc
      • Tick mark appearance > Width: 0.25pt
      • Tick mark appearance > Style: Solid  
    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 following properties.
      • Format: Short Date
      • Angle: -45
    4. Now, navigate to the Appearance page and set the following properties.
      • Font > Size: 12pt
      • Font > Color: DimGray
    5. Go to the Line page and set the following properties.
      • Show Line: Check-on
      • Color: Black
      • Width: 1pt
      • Style: Solid
    6. Go to the Major Gridline page and set the following properties.
      • Grid Interval: 7 (to view weekly stock prices)
      • Grid appearance > Show Grid: Check-on
      • Grid appearance > Width: 0.25pt
      • Grid appearance > Color: #cccccc
      • Grid appearance > Style: Dashed
      • Tick mark appearance > Position: Outside
      • Tick mark appearance > Color: #cccccc
      • Tick mark appearance > Width: 0.25pt
      • Tick mark appearance > Style: Solid  
    7. Click OK to complete setting up the X-axis.

    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 'Stock Price'.
    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.
         Candlestick 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.