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. 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. 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. 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, 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: Series1->Clear(); Series1->Add( 0.0, 55.0, clTeeColor ); Series1->Add( 10.0, 72.0, clTeeColor ); Series1->Add( 30.0, 95.0, clTeeColor ); Series1->Add( 40.0, 123.0, clTeeColor ); 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) 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 Series2->Clear(); Series2->Add( 88.0, “Jan”, clTeeColor ); Series2->Add( 72.0, “Feb”, clTeeColor ); Series2->Add( 95.0, “Mar”, clTeeColor ); Series2->Add( 123.0, “Apr”, clTeeColor ); that’s […]
