Results 1 to 4 of 4
  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2017

    Angry Candle Stick Chart in VB

    I have a candle stick chart, name is CANDLE
    and datagridview for data, name is HesapsonDataGridView
    series of chart; open, high, low, close

    I arrange everything in chart properties like collection.

    That is the code:

    Me.CANDLE.Series("open").Points.AddXY("CANDLE", HesapsonDataGridView.Rows(60).Cells(1).Value)
    Me.CANDLE.Series("high").Points.AddXY("CANDLE", HesapsonDataGridView.Rows(60).Cells(2).Value)
    Me.CANDLE.Series("low").Points.AddXY("CANDLE", HesapsonDataGridView.Rows(60).Cells(3).Value)
    Me.CANDLE.Series("close").Points.AddXY("CANDLE", HesapsonDataGridView.Rows(60).Cells(4).Value)

    But I can't draw the candle stick, need help. Thanks a lot.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: Candle Stick Chart in VB

    What exactly are the values of those grid cells?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2017

    Re: Candle Stick Chart in VB

    Here is the exact values of the grids. Friend, I have 120 rows like those. In my code I wrote only one. At the picture, I have send ten of 120. Thanks a lot for your interest.

    Name:  candle.jpeg
Views: 115
Size:  12.6 KB

  4. #4
    Frenzied Member
    Join Date
    Jul 2011

    Re: Candle Stick Chart in VB

    According to the documentation here, each data point in the series has 4 Y values in the order "high, low, open and close, respectively". So your code should look more like:
    Dim someXvalue As Integer = 60 ' for example
    Dim open As Double = CDbl(HesapsonDataGridView.Rows(60).Cells(1).Value)
    Dim high As Double = CDbl(HesapsonDataGridView.Rows(60).Cells(2).Value)
    Dim low As Double = CDbl(HesapsonDataGridView.Rows(60).Cells(3).Value)
    Dim close As Double = CDbl(HesapsonDataGridView.Rows(60).Cells(4).Value)
    CANDLE.Series(0).Points.AddXY(someXvalue, high, low, open, close)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width