Fill area between 2 series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
johnnix
Newbie
Newbie
Posts: 34
Joined: Tue Sep 18, 2018 12:00 am

Fill area between 2 series

Post by johnnix » Mon Apr 08, 2019 9:04 am

Hello,

I believe this question was asked many years ago but I could not retrieve anything from Search.

I need to fill the area between 2 series (e.g. Series1 and Series2) with a constraint that fill will apply only when Series1 values are smaller than Series 2 (see attached image), I tried using the available TChart tools but with no luck, any help would be mostly appreciated :)

Regards
Attachments
Annotation 2019-04-08 120016.png
Annotation 2019-04-08 120016.png (5.35 KiB) Viewed 17987 times

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

Re: Fill area between 2 series

Post by Yeray » Mon Apr 08, 2019 11:25 am

Hello,

Check the Series Band Tool. I've just run the "All features\Welcome !\Tools\Series Band" example in the New Features demo, changed the series from Line series to HorizLine series and reassigned the second series for the tool:
Tee9new_2019-04-08_13-23-26.png
Tee9new_2019-04-08_13-23-26.png (177.39 KiB) Viewed 17982 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

johnnix
Newbie
Newbie
Posts: 34
Joined: Tue Sep 18, 2018 12:00 am

Re: Fill area between 2 series

Post by johnnix » Mon Apr 08, 2019 12:35 pm

Hello,

I tried that, had to change both line series to Horizontal type however the result is not good.

Regards
Attachments
Annotation 2019-04-08 152955.png
Annotation 2019-04-08 152955.png (4.58 KiB) Viewed 17979 times

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

Re: Fill area between 2 series

Post by Yeray » Tue Apr 09, 2019 8:24 am

Hello,

Please, arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.
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

johnnix
Newbie
Newbie
Posts: 34
Joined: Tue Sep 18, 2018 12:00 am

Re: Fill area between 2 series

Post by johnnix » Tue Apr 09, 2019 2:33 pm

Here is a sample app
Attachments
test.zip
(51.92 KiB) Downloaded 1087 times

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

Re: Fill area between 2 series

Post by Yeray » Thu Apr 11, 2019 11:27 am

Hello,

I could reproduce the problem so I've added it tot he public tracker: #2182.

Note I've already fixed it.
The fix consists on modifying the TryAddCrossPoint function in TeeSeriesBandTool.pas, from this:

Code: Select all

  function TryAddCrossPoint(t:Integer; isStairs,isStairs2:Boolean):Boolean;
  //...

    if result then
       AddPointXY(Series.CalcXPosValue(X),Series.CalcYPosValue(Y))
    end
    else
    if IsStairs then
       AddPoint(Series,IsStairs,t);
  end;
To this:

Code: Select all

  function TryAddCrossPoint(t:Integer; isStairs,isStairs2:Boolean):Boolean;
  //...

    if result then
    begin
      if Series.YMandatory then
         AddPointXY(Series.CalcXPosValue(X),Series.CalcYPosValue(Y))
      else
         AddPointXY(Series.CalcXPosValue(Y),Series.CalcYPosValue(X));
    end
    else
    if IsStairs then
       AddPoint(Series,IsStairs,t);
  end;
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

johnnix
Newbie
Newbie
Posts: 34
Joined: Tue Sep 18, 2018 12:00 am

Re: Fill area between 2 series

Post by johnnix » Thu Apr 11, 2019 1:10 pm

Hello,

Thank you, will give it a try :)

Regards

Post Reply