Fill a region under or over a series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
riskassessor
Newbie
Newbie
Posts: 29
Joined: Tue Oct 13, 2015 12:00 am

Fill a region under or over a series

Post by riskassessor » Thu Jul 21, 2016 6:21 am

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.

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Fill a region under or over a series

Post by Yeray » Thu Jul 21, 2016 7:41 am

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 11210 times
The Features Demo and the documentation are shipped with the binary installation.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

riskassessor
Newbie
Newbie
Posts: 29
Joined: Tue Oct 13, 2015 12:00 am

Re: Fill a region under or over a series

Post by riskassessor » Thu Jul 21, 2016 9:25 am

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?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Fill a region under or over a series

Post by Yeray » Fri Jul 22, 2016 6:42 am

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 11154 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

riskassessor
Newbie
Newbie
Posts: 29
Joined: Tue Oct 13, 2015 12:00 am

Re: Fill a region under or over a series

Post by riskassessor » Sun Jul 24, 2016 4:04 am

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?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Fill a region under or over a series

Post by Yeray » Tue Jul 26, 2016 9:44 am

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 11170 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply