Click to See Complete Forum and Search --> : What`s the ideal solution for this?


C#er
July 14th, 2006, 02:05 PM
Hi fellows

I'm creating a app that reads data from a database and creates a graphic to show the results. I have a problem with this. I'll have a lot of registers, about 50000. I've think to sum the quantities of the registers and adjust the x-axis and the y-axis according this values. But for this I need to have a big screen resolution. How can I do this to show for the user adjusting in the window program? If anyone knows please tell me. I just want to get an idea, only this, not the entire solution.
I put a piece of code if anyone gets interesting

RECT tempRect, myRect;
GetClientRect(hwnd, &tempRect);
HBRUSH rectBrush;
char cTemp3[10];
int iSize = sizeof(tempPoint)/sizeof(POINT);
int iXMarquees, iYMarquees, iXSpace, iYSpace = 0;
POINT points[iSize], tmpPoint;
LOGPEN LogPen;
HPEN GraphicPen, LinesPen;
tmpPoint.x = 2;
LogPen.lopnStyle = PS_SOLID;
LogPen.lopnWidth = tmpPoint;
LogPen.lopnColor = 0x00000000;
GraphicPen = CreatePenIndirect(&LogPen);
for(int i = 0 ; i < iSize ; i++)
{
points[i].x = (ixClient * tempPoint[i].x)/400;
points[i].y = (int)(((iyClient * tempPoint[i].y)/450)-iLine)+iYConst;
}
hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, GraphicPen);
SetBkMode(hdc, TRANSPARENT);
TextOut(hdc, ixClient/2, iLine, TEXT("Olá"), sizeof("Olá"));
Polyline(hdc, points, (sizeof(points)/sizeof(POINT)));
//Eixo x-y
iXGraphLine = tempRect.right-80;
iYGraphLine = (tempRect.bottom-150)-iLine;
//Pen do eixo x-y
tmpPoint.x = 2;
LogPen.lopnStyle = PS_SOLID;
LogPen.lopnWidth = tmpPoint;
LogPen.lopnColor = 0x00FF0000;
LinesPen = CreatePenIndirect(&LogPen);
SelectObject(hdc, LinesPen);
iXSpace = iXGraphLine/(iSize*2);
iYSpace = iYGraphLine/(iSize*2);
for(int i = 0, iXpos = iXSpace, iYpos = iYSpace, iXFont = 10 ; i < iSize*2 ; i++)
{
SelectObject(hdc, LinesPen);
char cTemp10[5];
//Desenha as linhas divisórias do eixo X
MoveToEx(hdc, (iXpos-15), iYGraphLine-10-iLine, NULL);
LineTo(hdc, (iXpos-15), iYGraphLine+10-iLine);
itoa(iXpos, cTemp10, 10);
cTemp10[5]='\0';
/* Calcula a posição do texto de acordo com o tamanho entre *
* as divisões da linha horizontal e do tamanho do texto */
SetTextAlign(hdc, TA_CENTER);
TextOut(hdc, iXpos-(((strlen(cTemp10)*iXCaps)+iXChar)/strlen(cTemp10))-2, iYGraphLine+10-iLine, cTemp10, strlen(cTemp10));
iXFont+=iXSpace/2;
iXpos+=iXSpace;
//Desenha as linhas divisórias do eixo Y
MoveToEx(hdc, 5, (iYpos-15)-iLine, NULL);
LineTo(hdc, 25, (iYpos-15)-iLine);
itoa(iYpos, cTemp10, 10);
TextOut(hdc, 40, (((iYSpace*((iSize*2)-i))-4)-(((strlen(cTemp10)*iXCaps)+iYChar)/strlen(cTemp10))-2)-iLine, cTemp10, strlen(cTemp10));
iYpos+=iYSpace;
SelectObject(hdc, GraphicPen);
SelectObject(hdc, CreateSolidBrush(0x00000000));
if(i < 5)Pie(hdc, points[i].x-4, points[i].y-4, points[i].x+4, points[i].y+4, 10,10,0,0);
}
SelectObject(hdc, LinesPen);
//Linha Vertical
MoveToEx(hdc, 15, -iLine, NULL);
LineTo(hdc, 15, iYGraphLine-iLine);
//Linha Horizontal
MoveToEx(hdc, 15, iYGraphLine-iLine, NULL);
LineTo(hdc, iXGraphLine, iYGraphLine-iLine);
rectBrush = CreateSolidBrush(0x00FFFFFF);
myRect.top = (tempRect.bottom-100-iLine*2);
myRect.bottom = (tempRect.bottom-10-iLine*2);
myRect.left = 50;
myRect.right = 200;
FillRect(hdc, &myRect, rectBrush);
SelectObject(hdc, GraphicPen);
MoveToEx(hdc, 60, ((myRect.bottom+myRect.top)/2)-30, NULL);
LineTo(hdc, 130, ((myRect.bottom+myRect.top)/2)-30);
TextOut(hdc, 160, ((myRect.bottom+myRect.top)/2-30-(((strlen("Lalala")*iXCaps)+iYChar)/strlen("Lalala"))+2), "Lalala", strlen("Lalala"));
EndPaint(hwnd, &ps);
DeleteObject(GraphicPen);
DeleteObject(LinesPen);
DeleteObject(rectBrush);
ReleaseDC(hwnd, hdc);