Solved

about the c++ bulider graph?

Posted on 2000-03-01
5
189 Views
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!
 
0
Comment
Question by:tewehuang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 

Author Comment

by:tewehuang
ID: 2575871
Adjusted points to 200
0
 
LVL 1

Expert Comment

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

Author Comment

by:tewehuang
ID: 2578633
Adjusted points to 300
0
 
LVL 14

Accepted Solution

by:
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())
    {
     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
 

Author Comment

by:tewehuang
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!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

718 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