Click here to Skip to main content
15,888,802 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
Emilio Garavaglia24-Jul-09 7:50
Emilio Garavaglia24-Jul-09 7:50 
AnswerRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
Nemanja Trifunovic24-Jul-09 8:58
Nemanja Trifunovic24-Jul-09 8:58 
Questionflickering issues with GDI+ Pin
Adassus24-Jul-09 3:26
Adassus24-Jul-09 3:26 
AnswerRe: flickering issues with GDI+ Pin
Iain Clarke, Warrior Programmer24-Jul-09 3:35
Iain Clarke, Warrior Programmer24-Jul-09 3:35 
AnswerRe: flickering issues with GDI+ Pin
Randor 24-Jul-09 9:12
professional Randor 24-Jul-09 9:12 
QuestionRemote Desktop Access by using client/server architecture Pin
Madhu_Rani24-Jul-09 3:20
Madhu_Rani24-Jul-09 3:20 
QuestionRe: Remote Desktop Access by using client/server architecture Pin
Moak25-Jul-09 0:04
Moak25-Jul-09 0:04 
AnswerRe: Remote Desktop Access by using client/server architecture Pin
Bacon Ultimate Cheeseburger25-Jul-09 16:20
Bacon Ultimate Cheeseburger25-Jul-09 16:20 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Madhu_Rani26-Jul-09 20:10
Madhu_Rani26-Jul-09 20:10 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Bacon Ultimate Cheeseburger29-Jul-09 18:35
Bacon Ultimate Cheeseburger29-Jul-09 18:35 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Madhu_Rani29-Jul-09 19:46
Madhu_Rani29-Jul-09 19:46 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Bacon Ultimate Cheeseburger29-Jul-09 20:40
Bacon Ultimate Cheeseburger29-Jul-09 20:40 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Madhu_Rani30-Jul-09 3:55
Madhu_Rani30-Jul-09 3:55 
QuestionMenu deletion Pin
transoft24-Jul-09 3:13
transoft24-Jul-09 3:13 
AnswerRe: Menu deletion Pin
«_Superman_»24-Jul-09 4:04
professional«_Superman_»24-Jul-09 4:04 
GeneralRe: Menu deletion Pin
transoft24-Jul-09 4:21
transoft24-Jul-09 4:21 
Questiongetting table names from MS Access (.mdb file) in MFC Pin
suthakar5624-Jul-09 2:54
suthakar5624-Jul-09 2:54 
QuestionRe: getting table names from MS Access (.mdb file) in MFC Pin
Rajesh R Subramanian24-Jul-09 2:57
professionalRajesh R Subramanian24-Jul-09 2:57 
AnswerRe: getting table names from MS Access (.mdb file) in MFC Pin
suthakar5624-Jul-09 3:21
suthakar5624-Jul-09 3:21 
GeneralRe: getting table names from MS Access (.mdb file) in MFC Pin
Rajesh R Subramanian24-Jul-09 4:20
professionalRajesh R Subramanian24-Jul-09 4:20 
AnswerRe: getting table names from MS Access (.mdb file) in MFC Pin
Muhammad Mazhar24-Jul-09 3:21
Muhammad Mazhar24-Jul-09 3:21 
QuestionCString to long Pin
Davitor24-Jul-09 2:40
Davitor24-Jul-09 2:40 
AnswerRe: CString to long Pin
Rajesh R Subramanian24-Jul-09 2:54
professionalRajesh R Subramanian24-Jul-09 2:54 
QuestionHow To Reduce time for populating the Data in Graph Format Pin
prashant_lathigara from india24-Jul-09 1:42
prashant_lathigara from india24-Jul-09 1:42 
Hello, I am prashant workign with one company and doing the Graph Designing into my application. now the issue is that i create the function for populating the graph data but it takes to much time to populate data.

Can any body tell me how to reduce the time for populating data.

the following is my function from which i draw the graph data from one table.

void D_ScripGraphWnd::OnDraw(CDC *pDC)
{

CRect crect;
BOOL b;
CPen CenterPen, AxisPen, SlotPen, DrawPenRise, DrawPenFall;
CBrush brush;
CFont font;
CPen* OldPen;
CFont *OldFont;
int left, right, top, bottom, Height, Width ;
b = CenterPen.CreatePen(PS_DASH, 0, m_GraphColor_ula[REFERENCE_DATA]);
GetClientRect(crect);
Height = m_YSlots_l * m_SlotWidthY_l + 2*m_MarginY_l ;
Width = m_XSlots_l * m_SlotWidthX_l + 2*m_MarginX_l ;
crect.left = 0;
SetScaleToFitSize;
if(crect.right < Width)
crect.right = Width;
crect.top = 0;
if(crect.bottom < Height)
crect.bottom = Height;
pDC->FillRect(crect, &brush);
pDC->SetBkMode(TRANSPARENT);
left = m_MarginX_l ;
right = Width - m_MarginX_l;
top = m_MarginY_l ;
bottom = Height - m_MarginY_l;
OldPen = pDC->SelectObject(&SlotPen);
OldFont = pDC->SelectObject(&font);
char l_StartTime_ca[TIME_STAMP_LEN] = "";
char l_CurrTime_ca[TIME_STAMP_LEN] = "";
CTimeSpan l_TimeSpan_cl(0,0,30,0);
CTime l_SeriesStartTime_cl, l_SeriesCurrTime_cl;
CTime l_IndexStartTime_cl, l_IndexCurrTime_cl;
CTime l_StartTime_cl, l_CurrTime_cl;
l_SeriesStartTime_cl = l_SeriesCurrTime_cl = NULL;
l_IndexStartTime_cl = l_IndexCurrTime_cl = NULL;
ScripGraphInfo_T* l_ScripGraphInfo_stp;
l_TimeSpan_cl = CTimeSpan(0,1,00,0);
int l_i_l;
int minutes;
if(m_ScripGraphTable_clp->m_maxEntries_l != 0 && m_ScripGraphTable_clp->m_IndexQuerySuccess_b == TRUE )
{
//To find out the starting time on X-Axis.
l_ScripGraphInfo_stp = (ScripGraphInfo_T *)m_ScripGraphTable_clp->GetAt(0);
if(l_ScripGraphInfo_stp == NULL)
return;
if(l_ScripGraphInfo_stp->TimeStamp_uca[MM] >= 30)
minutes = 30;
if(l_ScripGraphInfo_stp->TimeStamp_uca[MM] < 30)
minutes = 0;
l_IndexStartTime_cl = CTime(l_ScripGraphInfo_stp->TimeStamp_uca[CC]*100 + l_ScripGraphInfo_stp->TimeStamp_uca[YY],
l_ScripGraphInfo_stp->TimeStamp_uca[MO],
l_ScripGraphInfo_stp->TimeStamp_uca[DD],
l_ScripGraphInfo_stp->TimeStamp_uca[HH],
minutes,
0);


l_ScripGraphInfo_stp = (ScripGraphInfo_T *)m_ScripGraphTable_clp->GetAt(m_ScripGraphTable_clp->m_maxEntries_l-1);
if(l_ScripGraphInfo_stp == NULL)
return;

l_IndexCurrTime_cl = CTime(l_ScripGraphInfo_stp->TimeStamp_uca[CC]*100 + l_ScripGraphInfo_stp->TimeStamp_uca[YY],
l_ScripGraphInfo_stp->TimeStamp_uca[MO],
l_ScripGraphInfo_stp->TimeStamp_uca[DD],
l_ScripGraphInfo_stp->TimeStamp_uca[HH],
l_ScripGraphInfo_stp->TimeStamp_uca[MM],
0);

}
strcpy(l_StartTime_ca, l_IndexStartTime_cl.Format("%H:%M"));
l_StartTime_cl = l_IndexStartTime_cl;

strcpy(l_CurrTime_ca, l_IndexCurrTime_cl.Format("%H:%M"));
l_CurrTime_cl = l_IndexCurrTime_cl;

pDC->SetTextColor(m_GraphColor_ula[AXIS_LABELS]);

for(l_i_l = 0; l_i_l <= m_XSlots_l; l_i_l++)
{
pDC->MoveTo(left, top);
pDC->LineTo(left, bottom);
if(m_DisplayXScale_b)
{
if(m_InitTime_cl != NULL && (l_i_l %2 == 0))
{
CTimeSpan l_Span_cl = l_StartTime_cl - l_CurrTime_cl;
if(l_Span_cl <= l_TimeSpan_cl)
pDC->TextOut(left-10 , bottom+5, l_StartTime_ca);
l_StartTime_cl += l_TimeSpan_cl;
strcpy(l_StartTime_ca, l_StartTime_cl.Format("%H:%M"));
}
}
left += m_SlotWidthX_l;
}
char l_buff_ca[20];
int j = m_Origin_l + m_YSlots_l*SlotWidthY;
left = m_MarginX_l;
for(l_i_l=0; l_i_l<=m_YSlots_l; l_i_l++)
{
pDC->MoveTo(left, top);
pDC->LineTo(right, top);
sprintf(l_buff_ca, "%d", j);

if(m_DisplayYScale_b)
{
if ((strcmp(g_SystemInfo_st.BrokerCode_ca, "") != 0) &&
(strcmp(g_SystemInfo_st.TraderCode_ca, "") != 0))
{
if(m_ScripGraphTable_clp->m_maxEntries_l > 0 )
pDC->TextOut(left - m_MarginX_l, top-2 , l_buff_ca);

}
}
top += SlotWidthY;
j -= SlotWidthY;
}
top = m_MarginY_l ;
pDC->SelectObject(&AxisPen);
pDC->MoveTo(left, top);
pDC->LineTo(left, bottom);
pDC->MoveTo(left, bottom);
pDC->LineTo(right, bottom);
pDC->SelectObject(&CenterPen);

if ((strcmp(g_SystemInfo_st.BrokerCode_ca, "") != 0) &&
(strcmp(g_SystemInfo_st.TraderCode_ca, "") != 0))
{
PrevCloseY = int(l_ScripDayOpen1)- m_Origin_l;
PrevCloseY = bottom-PrevCloseY;
pDC->MoveTo(left, PrevCloseY);
pDC->LineTo(right,PrevCloseY);
}
CString key;
char temp[20];
int x,y;
m_tooltip.Activate(TRUE);
for(l_i_l = 0; (l_i_l < m_ScripGraphTable_clp->m_maxEntries_l && m_InitTime_cl != NULL); l_i_l++)
// for( pos = g_IndexMap_cl.GetStartPosition(); pos != NULL; )
{
if(m_MinY_l == -1 || m_MaxY_l == -1)
return;
l_ScripGraphInfo_stp = (ScripGraphInfo_T* )m_ScripGraphTable_clp->GetAt(l_i_l);
if(l_ScripGraphInfo_stp == NULL)
return;
strcpy(l_CurrTime_ca, "");
if(l_ScripGraphInfo_stp->TimeStamp_uca[HH] < 10)
strcpy(l_CurrTime_ca, "0");
sprintf(temp, "%d",l_ScripGraphInfo_stp->TimeStamp_uca[HH]);
strcat(l_CurrTime_ca, temp);

if(l_ScripGraphInfo_stp->TimeStamp_uca[MM] < 10)
strcat(l_CurrTime_ca, "0");
sprintf(temp, "%d",l_ScripGraphInfo_stp->TimeStamp_uca[MM]);
strcat(l_CurrTime_ca, temp);
l_CurrTime_cl = CTime(l_ScripGraphInfo_stp->TimeStamp_uca[CC]*100 + l_ScripGraphInfo_stp->TimeStamp_uca[YY],
l_ScripGraphInfo_stp->TimeStamp_uca[MO],
l_ScripGraphInfo_stp->TimeStamp_uca[DD],
l_ScripGraphInfo_stp->TimeStamp_uca[HH],
l_ScripGraphInfo_stp->TimeStamp_uca[MM],
0/*l_ScripGraphInfo_stp->TimeStamp_uca[SS]*/);
CString l_inittime_cl = m_InitTime_cl.Format("%H, %M, %S");
CString l_currtime_cl = l_CurrTime_cl.Format("%H, %M, %S");
l_TimeSpan_cl = l_CurrTime_cl - m_InitTime_cl;
CString l_timespan_cl = l_TimeSpan_cl.Format("%H, %M, %S");
x = l_TimeSpan_cl.GetTotalMinutes();
if(x < 0)
{
IF_ERROR1(1, "Invalid time rcvd.");
return;
}
y= (int)l_ScripGraphInfo_stp->ScripValue_l/10000 ;/// 100;
if(y == 0)
continue;
AdjustSlots(x, y);
y -= m_Origin_l;
if(l_i_l == 0)
{
pDC->MoveTo(left+x, bottom-y);
if(l_ScripGraphInfo_stp->ScripValue_l/10000< l_ScripDayOpen1)
pDC->SetPixel(left+x, bottom-y, m_GraphColor_ula[INDEX_FALLING]);
else
pDC->SetPixel(left+x, bottom-y, m_GraphColor_ula[INDEX_RISING]);
}

CPoint l_CurrPt_cl = pDC->GetCurrentPosition();

if(l_ScripGraphInfo_stp->ScripValue_l/10000 < l_ScripDayOpen1)//Prev Close
// if((long)indexval < m_ScripGraphTable_clp->l_ScripDayOpen1)
pDC->SelectObject(&DrawPenFall);
else
pDC->SelectObject(&DrawPenRise);


switch(m_GraphStyle_s)
{

case LINESTYLE :

//Consider origin as (left,top) of the window, so graph grows down.
if(l_CurrPt_cl.y < PrevCloseY && (bottom-y) >= PrevCloseY)
{
pDC->SelectObject(&DrawPenRise);
pDC->LineTo(left+x, PrevCloseY);
pDC->SelectObject(&DrawPenFall);
pDC->LineTo(left+x, bottom-y);

}

if(l_CurrPt_cl.y > PrevCloseY && (bottom-y) <= PrevCloseY)
{
pDC->SelectObject(&DrawPenFall);
pDC->LineTo(left+x, PrevCloseY);
pDC->SelectObject(&DrawPenRise);
pDC->LineTo(left+x, bottom-y);

}

pDC->LineTo(left+x, bottom-y);

break;

case BARSTYLE :

pDC->MoveTo(x+left, PrevCloseY);
pDC->LineTo(x+left, bottom-y);

break;

default :
if(l_ScripGraphInfo_stp->ScripValue_l/10000 < l_ScripDayOpen1)
pDC->SetPixel(x+MarginX, bottom-y, m_GraphColor_ula[INDEX_FALLING]);
else
pDC->SetPixel(x+MarginX, bottom-y, m_GraphColor_ula[INDEX_RISING]); break;
}

}
pDC->SelectObject(OldFont);
pDC->SelectObject(OldPen);

CenterPen.DeleteObject();
AxisPen.DeleteObject();
SlotPen.DeleteObject();
DrawPenRise.DeleteObject();
DrawPenFall.DeleteObject();
brush.DeleteObject();
font.DeleteObject();

return;
}
Can any body tell me how to reduce time to populating data.
AnswerRe: How To Reduce time for populating the Data in Graph Format Pin
Cedric Moonen24-Jul-09 2:39
Cedric Moonen24-Jul-09 2:39 

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.