C++ MFC MSChart - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17

Thread: C++ MFC MSChart

  1. #16
    Join Date
    Apr 2013
    Posts
    2

    Re: C++ MFC MSChart

    Quote Originally Posted by plac88 View Post
    Hi, you mean multiple charts or multiple lines on one chart?

    if you're talking about multiple lines, thats simple, here's an example of multiple lines (2) in one chart:

    Code:
            COleSafeArray saRet;
    
    	DWORD numElements[] = {360, 4}; 
    
    	saRet.Create(VT_R8, 2, numElements);
    
    	long index[2] = { 0 , 0 };
    
    	double value = 0;
    	double vx = 0;
    
    	for(long i = 0; i < 360; i++)
    	{
    		// curve 1
    		index[1] = 0;
    
    		vx = i;
    
    		saRet.PutElement(index, &vx);
    
    		index[1] = 1;
    
    		value = sin(i * 0.35);
    
    		saRet.PutElement(index, &value);
    
    		// curve 2
    		index[1] = 2;
    
    		saRet.PutElement(index, &vx);
    
    		index[1] = 3;
    
    		value = - sin(i * 0.35);
    
    		saRet.PutElement(index, &value);
    
    
    		index[0]++;
    	}
    
    	m_chart.put_ChartData(saRet.Detach());
    Cheers

    thnx for reply....but m_chart.put_ChartData(saRet.Detach());....put_ChartData is not available in mschart...

  2. #17
    Join Date
    Apr 2013
    Posts
    5

    Re: C++ MFC MSChart

    Did you make the wrapper for the class?

    Try to use:

    #import <msdatsrc.tlb> no_namespace
    #import <mschrt20.ocx> no_namespace

    Then make a member variable for the chart, via Resources Dialog Designer, by assigning the chart to the class wrapper, something like CDMSChart class.

    Cheers,

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center