about the c++ bulider graph?

Posted on 2000-03-01
Last Modified: 2010-05-19
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!
Question by:tewehuang
  • 3

Author Comment

ID: 2575871
Adjusted points to 200

Expert Comment

ID: 2576115
if i'm not wrong there is a graph component in c++duilder or a component like excel try it

Author Comment

ID: 2578633
Adjusted points to 300
LVL 14

Accepted Solution

AlexVirochovsky earned 300 total points
ID: 2581127
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())
          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
                    //display Graph
     Image3->Canvas->Polyline((const TPoint*)tPoint, 255);
I hope, it helps. Alex

Author Comment

ID: 2585901
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!

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question