Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

about the c++ bulider graph?

if i want to use the c++ builder to create the stock market graph?how will
i do?the step is?thank you very much!
 
0
tewehuang
Asked:
tewehuang
  • 3
1 Solution
 
tewehuangAuthor Commented:
Adjusted points to 200
0
 
ntdragonCommented:
if i'm not wrong there is a graph component in c++duilder or a component like excel try it
0
 
tewehuangAuthor Commented:
Adjusted points to 300
0
 
AlexVirochovskyCommented:
Hi. You must use standart TImage control for display
graph. Next is example displaying some graph(histogramm
of Picture , loaded in Image1, graph displayed
in Image3). In you example X may be Time, Y: size of rent:

void __fastcall TForm1::Open1Click(TObject *Sender)
{
  if (OpenPictureDialog1->Execute())
    {
     Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
          POINT tPoint[256];                //coordinates
     int nHist[256];
                                       //clear all
     memset(nHist,0, sizeof(nHist));
     memset(tPoint,0, sizeof(tPoint));
                                       //create Hist: for all pixels
     for (int i = 0; i < Image1->Picture->Bitmap->Width; i++)
     {
      for (int j = 0; j < Image1->Picture->Bitmap->Height; j++)
      {
       long tColor1 = Image1->Picture->Bitmap->Canvas->Pixels[i][j];
       BYTE tColor = (BYTE)tColor1;
       nHist[tColor]++;                          //+1
      }
              //find Max of nHist
      int nMax = nHist[0];
      for (int i = 1; i < 256; i++)
       nMax = max(nMax,nHist[i]);
           //make point with coordinates
      for (int i = 0; i < 256; i++)
      {
       tPoint[i].x = (float)Image3->Width/ (float)(255)*(float)i;
       tPoint[i].y =  (float)Image3->Height*(1. - (float)nHist[i]/(float)nMax);
      }
     }
                    //display image
     Image1->Picture->Bitmap;
                    //display Graph
     Image3->Canvas->Polyline((const TPoint*)tPoint, 255);
  }
}
I hope, it helps. Alex
0
 
tewehuangAuthor Commented:
thank you for your answer!i will try this method !if i have any problem that
i think you will help me again!thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now