C++C++11C++14C++17Introduction to C++Learn C++

Learn How To Draw Charts With Simple TeeChart (TChart) Examples in C++

Learn How To Draw Charts With Simple TeeChart TChart Examples in C++

The RAD Studio, C++ Builder 11 and C++ Builder CE Community Editions have a lot of amazing visual and nonvisual components that you can use in your modern applications for Windows and mobile. One of these is the free chart component for the VCL and FMX frameworks called TeeChart (TChart). TChart comes with RAD Studio including RAD Studio 10.x,11.x and the CE versions.

How To Install and Use TeeChart (TChart) in C++ Builder CE?

When you install RAD Studio on the second page of the “platforms” choices are some optional modules and components. One of those is “TeeChart Standard”. This is the free version of TChart which you can use in your applications.

Learn How To Draw Charts With Simple TeeChart TChart Examples in C++

If you want more detailed professional charts in your applications, there is also TeeChart Pro by Steema. The TeeChart Pro charting component library offers hundreds of Graph styles in 2D and 3D for data visualization, 56 mathematical, statistical, and financial functions for you to choose from together with an unlimited number of axes and 30 Palette components. Please visit their official Steema web page for more details.

How To Develop Apps With TeeChart (TChart) in C++?

If you installed TChart in C++ Builder, you can use this component in your VCL or FMX applications. To do this:

  • Create a New C++ Builder VCL Windows Application in RAD Studio
  • Go to Palette window, there is TChart component (under the TeeChart Lite category) to visualize many kind of chart graphics. Drag it on to form, or If you have a specific area like a panel, rectangle or a tab drag it on to this area. You can move, resize or align it by selecting Align->Client selection, you can also set its margins.
Learn How To Draw Charts With Simple TeeChart TChart Examples in C++ designing a chart
C++ Builder 11 CE Form Design with TChart component

Now you can modify its default settings and you can add your custom charts, Pie, Bars, y=f(x) series, etc.

How To Draw y = f(x) Series With TeeChart (TChart) in C++?

  • Double click to TChart to create your own Chart series.
  • Press “Add…” Button in Editing Chart Window, this will bring you to the Series Gallery as shown below.
Learn How To Draw Charts With Simple TeeChart TChart Examples in C++ the gallery
  • Select Functions tab and select y=f(x) series,
  • Press OK, and Close
  • When you are in form designer mode, be sure that there is Series1 in the Structure panel as below,
Learn How To Draw Charts With Simple TeeChart TChart Examples in C++ a chart in the structure view
  • Now you have a y =f(x) graph, add a Button (TButton)
  • Double Click to your button (i.e. Button1)
  • When user clicks this button we can clear and add series in this button click like so:

How To Draw Bar Series With TeeChart (TChart) in C++?

If you want you can add a new Bar Chart,

  • Double click to TChart to create your own Chart series.
  • Press “Add…” Button in Editing Chart Window, this will bring you Series Gallery as below,
  • In Series tab, select Bar Series,(i.e. this will be named as Series2)
Learn How To Draw Charts With Simple TeeChart TChart Examples in C++ the TChart Series Gallery
  • Press OK, and Close
  • Add a new Button (TButton), named as Button2
  • Double click to this button (i.e Button2)
  • When user clicks this button we can clear and add bar series in this button click as below here

that’s all! Now you can press F9 to run you application.

Is There A Full Example of how to use TeeChart (TChart) in C++?

Here is a full example that has Two TCharts (Chart1, Chart2), first chart has Series1 which is y=fx series, the second chart has Series2 has bar series, and there are two buttons (Button1, Button2), if you click both of them, you can modify your code like we show below.

Here is a simple example of our design and its outputs when we click Button1 and Button2,

Learn How To Draw Charts With Simple TeeChart TChart Examples in C++ an example graph

Note that, you can create a for loop for a specific function, or you can read data and set them here as above too. You can also visually bind database tables directly into teecharts, you don’t need to code as above.

Learn How To Draw Charts With Simple TeeChart TChart Examples in C++ C++ Builder logo

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise version.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?