Page 1 of 1

Fill area between 2 series

Posted: Mon Apr 08, 2019 9:04 am
by 16584466
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

Re: Fill area between 2 series

Posted: Mon Apr 08, 2019 11:25 am
by yeray
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 17991 times

Re: Fill area between 2 series

Posted: Mon Apr 08, 2019 12:35 pm
by 16584466
Hello,

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

Regards

Re: Fill area between 2 series

Posted: Tue Apr 09, 2019 8:24 am
by yeray
Hello,

Please, arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.

Re: Fill area between 2 series

Posted: Tue Apr 09, 2019 2:33 pm
by 16584466
Here is a sample app

Re: Fill area between 2 series

Posted: Thu Apr 11, 2019 11:27 am
by yeray
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;

Re: Fill area between 2 series

Posted: Thu Apr 11, 2019 1:10 pm
by 16584466
Hello,

Thank you, will give it a try :)

Regards