CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Mschart

  1. #1
    Join Date
    Apr 2003
    Posts
    1

    Mschart

    Hi ,
    I need to plot a lin graph with time on x-axis and c[t] on y-axis.I am not able to understand clearly how i can set the way i wanted in MSCHART.By the way I am using VC++ 6 .Any help will be appreciated.
    regards,
    Rajesh

  2. #2
    Join Date
    Feb 2003
    Location
    Chennai
    Posts
    14
    Check-out if this helps you
    The following safe array can be used to set time in x-axis and integers in y axis.
    The values are taken from an excel file here. It can be changed such that it is taken from an array
    long index[2];
    long lRow;
    COleVariant vTemp,vTemp1;
    Range l_rCell;
    CString s;

    DWORD dwElements[2];
    dwElements[0]= 16; //Number of rows
    dwElements[1]= 2; //Number of columns
    sa.Create(VT_VARIANT, 2, dwElements);

    COleDateTime vDateTime;
    for(lRow=0;lRow<=15;lRow++)
    {
    index[0] = lRow;
    //Fill the first column with time
    index[1] = 0;
    vTemp = RowRange.GetItem(COleVariant((short)(lRow+1)),
    COleVariant((short)1));
    l_rCell.AttachDispatch(vTemp.pdispVal);

    s = l_rCell.GetText().bstrVal;
    vTemp1 = s;
    int hh,mm,ss;
    hh = atoi(s.Left(2));
    mm = atoi(s.Mid(3,2));
    ss = atoi(s.Right(2));
    vDateTime.SetTime(hh,mm,ss);
    sa.PutElement(index,(COleVariant)vDateTime);
    //Fill the second column with strings
    index[1] = 1;
    vTemp = RowRange.GetItem(COleVariant((short)(lRow+1)),
    COleVariant((short)4));
    l_rCell.AttachDispatch(vTemp.pdispVal);
    s = l_rCell.GetText().bstrVal;
    vTemp1 = s;
    sa.PutElement(index,vTemp1 );


    }

    Now use this safe array to create your chart.

  3. #3

    ms chart

    dear sir,
    your code was very useful. thank you very much.
    but RANGE and RowRange where it was declared.
    and also want to know the details of VT_VARIANT
    thank u
    minakannan

  4. #4
    Join Date
    Jul 2003
    Posts
    31

    Re: Mschart

    Hil,
    Did you figure out how to plot x-y values in vc++ using ms chart? I am starting to use the MS chart control in C++ for displaying a x-y plotter graph. But i am not able to figure out how to display a set of 32(x,y) values which range from 0-360 degrees. Could you please help me out? Also is there any help for using mschart in vc++?

    Awaiting your reply.

    Thanks a lot..
    Krishna.

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