CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Posts
    5

    how to use MS chart control

    hi.
    i want use to mschart control
    so i insert chart control for my application.
    next step i do not know what i do
    please send me sample code
    thanks
    email : [email protected]



  2. #2
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: how to use MS chart control

    Hi.

    This is a crucial top on GUI application, but codeguru never answer
    this question. I can't find any clue on search or Last updates.

    So, now I'm working this top on my project for the future enhancement.
    1) Explorer the property page of chart control.
    2) Subclass the chart control like m_chart by class wizard.

    I set three rows,rowindex and VtChChartType2dBar as chart type at property page of the chart control.
    m_chart.SetShowLegend(TRUE);
    short Colnum = m_chart.GetColumn();
    TRACE1("Col Num is %d", Colnum);
    // short RowNum = m_chart.GetRow();
    // TRACE1("Col Num is %d", RowNum);
    m_chart.SetRow(1);//put SetRow() at first.
    m_chart.SetData("56");//the chart value as string
    m_chart.SetRowLabel("Row 2");

    m_chart.SetRow(2);
    m_chart.SetData("80");
    m_chart.SetRowLabel("Row 1");

    m_chart.SetRow(3);
    m_chart.SetData("100");

    I just starts this and show you the simple one. So, try to do more
    complicated approach.
    In fact, I was surprised that there are many classes when I insert
    the chart control to my project.

    HTH.
    -Masaaki Onishi-


  3. #3
    Join Date
    May 1999
    Posts
    5

    Re: how to use MS chart control

    THANK YOU !
    i remember that chart type is about 13
    by the way i have to use the outer surface chart because my data number is 400000
    Do you know chart number of outer suface shown on top?
    EXCEL have it.
    but this conponent may not be have it.
    i have another question.
    my data is array (ex : int a[200][200])
    how this data display?
    thank you very much..
    you! number one..
    take care..
    email : [email protected]




  4. #4
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: how to use MS chart control

    Hi.

    Because I just starts MSChart ActvieX control, my suggestion is just
    one which I posted. However, I think that MSChart supports array
    object as Visaul Basic can do.
    I explored MSChart at MSDN help, but I found only VB reference.
    But VB reference will help us partly because VB made by VC++?

    void SetChartData(const VARIANT& newValue);
    I guess that this function will deal with your desire, but i'm not yet sure how we will use this function.

    HTH.
    -Masaaki Onishi-





  5. #5
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: At last, I figured out how to use SetChartData()

    Hi.

    At last, I figured out how to use SetChartData().
    COleSafeArray is key point here.

    /* //This is one dimension array.

    int data[5] = {56, 80, 100, 49, 31};
    COleSafeArray varArray;
    varArray.CreateOneDim(VT_I4, 5, &data , 0);

    */ //This is two dimension array.
    int data[2][3] = { {56, 80, 100}, {50,60,40}};

    COleSafeArray varArray;

    long index[2];
    DWORD numElements[]={2,3};
    varArray.Create(VT_I4, 2, numElements);
    VARIANT v;
    VariantInit(&v);
    v.vt = VT_I4;

    for(int i = 0; i < 2;i++)
    for(int j = 0; j < 3; j++)
    {
    index[0] = i;
    index[1] = j;
    v.intVal = data[i][j];
    varArray.PutElement(index, &v.intVal);
    }

    m_chart.SetChartData(varArray);

    This time, we don't need caring about the propery of Chart control.
    I am so sleepy now. 2 AM at Atlanta local time.

    HTH.
    -Masaaki Onishi-




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