Page 1 of 1

Fill a region under or over a series

Posted: Thu Jul 21, 2016 6:21 am
by 17576646
I have a line series. I would like to fill a region between X1 and X2, above Y1 and below the series. I would also like to fill another region between X3 and X4, above the series and below Y2. (Actually, there are many such regions, but for the sake of the example, suppose there are only two.)

Is it possible? I am using the latest TeeChart VCL Pro. Thank you.

Re: Fill a region under or over a series

Posted: Thu Jul 21, 2016 7:41 am
by yeray
Hello,

This sounds exactly as what the TSeriesRegionTool does:
Tee9New_win64Delphi24_2016-07-21_09-38-09.png
Tee9New_win64Delphi24_2016-07-21_09-38-09.png (173.02 KiB) Viewed 10894 times
The Features Demo and the documentation are shipped with the binary installation.

Re: Fill a region under or over a series

Posted: Thu Jul 21, 2016 9:25 am
by 17576646
Thank you. Is it possible to limit the filling to certain discrete ranges of X? I.e. can the SeriesRegion be turned on and off at various X-values?

Re: Fill a region under or over a series

Posted: Fri Jul 22, 2016 6:42 am
by yeray
Hi,

As you can see in the demo, the TSeriesRegionTool has LowerBound and UpperBound. This is X0 and X1 if it is associated to a "vertical" series (it would be Y0 and Y1 if it was associated to a THorizLineSeries ie).
This means you can only set a region with a tool; but you can create as many regions as you wish adding more TSeriesRegionTools.
Ie, taking the example in the Features Demo and playing a bit with the editor:
Tee9New_win64Delphi24_2016-07-22_08-43-42.png
Tee9New_win64Delphi24_2016-07-22_08-43-42.png (174.03 KiB) Viewed 10838 times

Re: Fill a region under or over a series

Posted: Sun Jul 24, 2016 4:04 am
by 17576646
Thanks again. It is working really well for me!

One further question please - do you know of an easy way to calculate the area of a SeriesRegion? I have been exploring doing it by establishing a list of points that approximates the region and then applying Green's Theorem in the plane to calculate the area. This is proving a lot of work and I wondered if you knew of an easier way or had maybe already established a function to do this?

Re: Fill a region under or over a series

Posted: Tue Jul 26, 2016 9:44 am
by yeray
Hello,

Have you tried to spit the polygon and calculate the area of the rectangle and the right triangle? Ie:
area.png
area.png (161.98 KiB) Viewed 10854 times