Candle Stick Chart in VB-VBForums
Results 1 to 4 of 4

Thread: Candle Stick Chart in VB

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2017
    Posts
    19

    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
    Location
    Sydney, Australia
    Posts
    97,099

    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
    Posts
    19

    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: 39
Size:  12.6 KB

  4. #4
    Frenzied Member
    Join Date
    Jul 2011
    Location
    UK
    Posts
    1,126

    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:
    Code:
    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.