Divide a Tchart into equal parts and then draw rectangles on it in Firemonkey


I have a simple program in C++ builder with VCL that i need to migrate to Firemonkey. In this application i need to draw on a TChart, but i don’t know how to get it to work. My application is really simple; a user inputs data in a stringgrid and then the data is displayed in two different TChart by clicking two different buttons.
The first button click is to divide the TChart into equal parts (generally in two parts, but the user can divide the TChart into more than two parts). In the first example there is a column, with two long rectangles with texts, in it. In this example it’s two rectangles with “CH PL”.

The second button is supposed to draw on the same TChart this:

It’s essentially two or more rectangles which go from the beginning of the chart until the end.

To make it simple i need to divide the TChart into two or more equal parts horizontally and then draw rectangles with texts on it, which is the simplest solution.

I’m really lost because by searching on the net i came across a similar problem by simply using the TChart.AfterDraw() method, but I don’t know how to use it, it’s not really clear.

The drawing are generated once the user clicks a button, else there should be nothing.

My method for drawing so far:

void __fastcall TForm1::rbComprChange()
Series5->Clear(); //used for clearing the series to regenerate them from the user input

for(int i=0;i<StringGrid1->RowCount;i++)
// How and where should i draw these rectangles?!

Can someone guide me or explain to me how to do that either in C++ Builder or Delphi.

Comments are closed.