Click here to Skip to main content
15,909,530 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to see CString values Pin
dharani7-Feb-06 23:11
dharani7-Feb-06 23:11 
GeneralRe: how to see CString values Pin
Rage8-Feb-06 1:28
professionalRage8-Feb-06 1:28 
AnswerRe: how to see CString values Pin
James R. Twine8-Feb-06 3:37
James R. Twine8-Feb-06 3:37 
GeneralRe: how to see CString values Pin
Rage8-Feb-06 3:49
professionalRage8-Feb-06 3:49 
AnswerRe: how to see CString values Pin
ahmet07038-Feb-06 2:31
ahmet07038-Feb-06 2:31 
AnswerRe: how to see CString values Pin
David Crow8-Feb-06 3:56
David Crow8-Feb-06 3:56 
QuestionPlotting Graph Pin
Anu_Bala7-Feb-06 22:57
Anu_Bala7-Feb-06 22:57 
AnswerRe: Plotting Graph Pin
_anil_7-Feb-06 23:41
_anil_7-Feb-06 23:41 
Just giving a simple process

This is the drawing method
<code>// Calculate the actual point in the screen
	INT nY1 = LPtoDP(AXIS_Y, dblDataY.GetAt(0));
	INT nX1 = LPtoDP(AXIS_X, dblDataX.GetAt(0));
	pDC->MoveTo(nX1, nY1);
	for (int i=0; i < dblDataX.GetCount();i++)
	{
		// Calculate the actual point in the screen
		INT nY2 = LPtoDP(AXIS_Y, dblDataY.GetAt(i));
		INT nX2 = LPtoDP(AXIS_X, dblDataX.GetAt(i));
		// Draw  graph Line
		pDC->LineTo(nX2, nY2);
	}
</code>

besides this you need two additional funtion for converting form actual data to sceen coordinate and vise versa





<code>
LPtoDP( AXIS_TYPE AxisType, DOUBLE dblData)
{
	
	switch(AxisType)
	{
		case AXIS_X:
			nPos = (INT)(m_dblOrgX + ( dblData * m_dblScaleFactorX ));
			break;
		case AXIS_Y:
			nPos = (INT)(m_dblOrgY + ( dblData * dblScaleFactorY ));
			break;
		default:
			return 0;
	}
	return nPos;
}
</code>


DPtoLP( AXIS_TYPE AxisType, DOUBLE dblData )
{

switch(AxisType)
{
	case AXIS_X:
		wdPos = (WORD)( (dblData - m_dblOrgX) / m_dblScaleFactorX);
		break;
	case AXIS_Y:
		wdPos = (WORD)((m_dblOrgY - dblData)  / m_dblScaleFactorY);
		break;
	default:
		return 0;
}
return wdPos;
}


And also find minmum and maximum of all the data and use this to calculate the scale factor

CalcScaleFactor( CRect rctDrawArea )
{
	DOUBLE dblScaleRangeX =   m_dblScaleMaxX - m_dblScaleMinX;
	DOUBLE dblScaleRangeY =   m_dblScaleMaxY - m_dblScaleMinY;
	
	m_dblScaleFactorX = ( dblScaleRangeX == 0 ) ?
		0 : (DOUBLE)rctDrawArea.Width() / dblScaleRangeX;
        m_dblScaleFactorY = ( dblScaleRangeY == 0.0 ) ?
		0 : (DOUBLE)rctDrawArea.Height() / dblScaleRangeY;
	
	m_dblOrgX = rctDrawArea.left   -	( m_dblScaleMinX * dblScaleFactorX );
	m_dblOrgY = rctDrawArea.bottom + ( m_dblScaleMinY * dblScaleFactorY );
	}
}


There are some member variables in the code you can understand by close look at the code. Just simple of drawing graph is convert your points to screen coordiante and then simple line draw between points.
GeneralRe: Plotting Graph Pin
Anu_Bala8-Feb-06 0:52
Anu_Bala8-Feb-06 0:52 
QuestionPass events through windows Pin
leliup7-Feb-06 22:46
leliup7-Feb-06 22:46 
AnswerRe: Pass events through windows Pin
pol_ice7-Feb-06 23:00
pol_ice7-Feb-06 23:00 
QuestionCSIDL_NETHOOD Pin
ragavan7-Feb-06 22:15
ragavan7-Feb-06 22:15 
QuestionDifferent MDI App. Pin
bantisk7-Feb-06 22:04
bantisk7-Feb-06 22:04 
GeneralRe: Network Connection status monotoring Pin
Tony Kurishunkal7-Feb-06 21:57
Tony Kurishunkal7-Feb-06 21:57 
GeneralRe: Network Connection status monotoring Pin
David Crow8-Feb-06 2:26
David Crow8-Feb-06 2:26 
Questionimplement MS SAPI Pin
bluey127-Feb-06 21:53
bluey127-Feb-06 21:53 
QuestionAutomation, how to retrieve all text from current documen in VS98 Pin
hicks227-Feb-06 21:31
hicks227-Feb-06 21:31 
AnswerRe: Automation, how to retrieve all text from current documen in VS98 Pin
Rage7-Feb-06 21:59
professionalRage7-Feb-06 21:59 
GeneralRe: Automation, how to retrieve all text from current documen in VS98 Pin
hicks228-Feb-06 2:31
hicks228-Feb-06 2:31 
QuestionHow to print message on console in mfc program? Pin
David.YueZuo7-Feb-06 20:52
David.YueZuo7-Feb-06 20:52 
AnswerRe: How to print message on console in mfc program? Pin
Rage7-Feb-06 21:21
professionalRage7-Feb-06 21:21 
GeneralRe: How to print message on console in mfc program? Pin
David.YueZuo7-Feb-06 21:39
David.YueZuo7-Feb-06 21:39 
GeneralRe: How to print message on console in mfc program? Pin
Wim Engberts7-Feb-06 22:09
Wim Engberts7-Feb-06 22:09 
GeneralRe: How to print message on console in mfc program? Pin
David.YueZuo7-Feb-06 22:17
David.YueZuo7-Feb-06 22:17 
GeneralRe: How to print message on console in mfc program? Pin
Wim Engberts7-Feb-06 23:31
Wim Engberts7-Feb-06 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.