#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    14
    Rep Power
    0

    Problem binding data row to chart


    Hi all! I am totally new to the Chart object found in Windows.Forms.Datavisualization. I have found some tutorials around on the net, but none of them seem instructive regarding the issue I am having.

    I am using VB.NET, querying from a database, and the result is always a single row with 7 columns, each having an integer value. I want the values returned in the row displayed in vertical bars with height matching the value returned, with each column's value spaced out along the X axis.

    Every tutorial I've come across has been set up to have the values retrieved from successive rows in a dataset. I have tried using the Series.Points.AddXY() function to manually map the values, but that isn't quite working right either.

    Code:
    Dim row As DataRow = ds.Tables(0).Rows(0)
                chtForecast.Series(0).Points.AddXY(1, row.Item("Tomorrow"))
                chtForecast.Series(0).Points.AddXY(2, row.Item("Day2"))
                chtForecast.Series(0).Points.AddXY(3, row.Item("Day3"))
                chtForecast.Series(0).Points.AddXY(4, row.Item("Day4"))
                chtForecast.Series(0).Points.AddXY(5, row.Item("Day5"))
                chtForecast.Series(0).Points.AddXY(6, row.Item("Day6"))
                chtForecast.Series(0).Points.AddXY(7, row.Item("Day7"))
    For some reason the above code causes only one bar (column) to be drawn, and I have confirmed that it is the height of the largest value returned in the row.

    If someone could help out with this, or even point me toward a more comprehensive review of the functionality of this Chart object, that would be much appreciated.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    14
    Rep Power
    0

    Problem is now gone


    I'm not sure why this solved the problem, but I removed some dummy data from the chart that I'd entered in the designer interface in VS2010. Once I did that, everything came up correctly. I suppose the issue was that I was adding points whose values were the same as points already in the series.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0

    Re:-


    Hi Guys.

    I am From Outsource . net And SharePoint Development Company. We Provide Custom Word Wide SharePoint Development And .Net Development service as per client requirement.

    All your comment for SharePoint Development And . net Development are welcome.

    Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo