CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    38

    column of data from a flexgrid to MSChart

    Hello
    I'm trying to send a column of data from a flexgrid to MSChart to plot. But, with this code all I get is the last entry of the first column. This number is the same across the chart x-axis. So the chart has a straight line left to right.

    I wanted all the values of the single column plotted. My chart has years as the x-axis and amount as the y-axis.
    Code:
    For iRowCount = 1 To tempview1.MSFlexGrid1.Rows - 2
         For iColumnCount = 1 To 12               
                ' assign a FlexGrid cell's data to dCurrData 
                dCurrData = tempview1.MSFlexGrid1.TextMatrix(iRowCount, iColumnCount) 
                With MSChart1
                     .ColumnCount = 1
                     .Column = iColumnCount
                     .Row = iRowCount
                     .RowCount =  tempview1.MSFlexGrid1.Rows -2 
                     .Column = iColumnCount 
                     .Data = dCurrData 
                     .enabled = True 
                End With
           Next iColumnCount
    Next iRowCount
    any help is much appreciated
    Steve
    Last edited by codeUp; September 18th, 2005 at 02:41 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: column of data from a flexgrid to MSChart

    In the following code you set MsChart1.ColumnCount to 1 (red line ) and some rows later you set the same value to iColumnCount ( two times - Blue lines). So there must be a logical issue here.
    Code:
    For iRowCount = 1 To tempview1.MSFlexGrid1.Rows - 2
         For iColumnCount = 1 To 12               
                ' assign a FlexGrid cell's data to dCurrData 
                dCurrData = tempview1.MSFlexGrid1.TextMatrix(iRowCount, iColumnCount) 
                With MSChart1
                     .ColumnCount = 1
                     .Column = iColumnCount
                     .Row = iRowCount
                     .RowCount =  tempview1.MSFlexGrid1.Rows -2 
                     .Column = iColumnCount  
                     .Data = dCurrData 
                     .enabled = True 
                End With
           Next iColumnCount
    Next iRowCount
    If there would be some more code I would test it out whats going on here.
    Hope that helps

    Jonny Poet
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

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

Featured