Problem with ErrorPointSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
PKH
Newbie
Newbie
Posts: 1
Joined: Fri Sep 24, 2021 12:00 am

Problem with ErrorPointSeries

Post by PKH » Mon Dec 13, 2021 5:08 pm

I am using an ErrorPointSeries to display a statistic by "group" and the lower and upper confidence limits. The code is below

Series1 is a TErrorPointSeries

Code: Select all

for i:=0 to N-1 do begin
  Series1.Add( Stat[i], i+1, Statistic[i] - LCL[i], UCL[i] - Statistic[i], 0,0);
  chart1.Axes.Left.Items.Add( i+1, Name[i] );                      // add group name to Y-axis
  chart1.Axes.Right.Items.Add(i+1, 'n='+IntToStr( N[i]) );  // add Ni to right Y-axis
end;
The error bars show as expected ( see first chart). When I change the x-axis to logarithmic the markers are correctly positioned, but the lower and upper error bars have changed (see second chart).

Any suggestions?
Charts.jpg
Charts.jpg (34.29 KiB) Viewed 1082 times

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

Re: Problem with ErrorPointSeries

Post by Yeray » Wed Dec 15, 2021 1:25 pm

Hello,

I've been able to reproduce the problem and I've already fixed it for the next release (#2491).

Since you own the sources, you can apply the fix to your copy. Find below the diff:

Code: Select all

---
 TeeErrorPoint.pas | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/TeeErrorPoint.pas b/TeeErrorPoint.pas
index 2fc7792f..b367386b 100644
--- a/TeeErrorPoint.pas
+++ b/TeeErrorPoint.pas
@@ -704,7 +704,7 @@ var
   begin
     with Errors do
     begin
-      tmpX:=GetHorizAxis.CalcSizeValue(FLeft.Value[ValueIndex]);
+      tmpX:=Abs(GetHorizAxis.CalcSizeValue(XValue[ValueIndex],XValue[ValueIndex]-FLeft.Value[ValueIndex]));
       if Format.Left.Visible and (Pointer.HorizSize < tmpX) then
       begin
         PreparePen(ValueIndex, Format.Left);
@@ -719,7 +719,7 @@ var
   begin
     with Errors do
     begin
-      tmpX:=GetHorizAxis.CalcSizeValue(FRight.Value[ValueIndex]);
+      tmpX:=Abs(GetHorizAxis.CalcSizeValue(XValue[ValueIndex],XValue[ValueIndex]+FRight.Value[ValueIndex]));
       if Format.Right.Visible and (Pointer.HorizSize < tmpX) then
       begin
         PreparePen(ValueIndex, Format.Right);
@@ -734,7 +734,7 @@ var
   begin
     with Errors do
     begin
-      tmpY:=GetVertAxis.CalcSizeValue(FTop.Value[ValueIndex]);
+      tmpY:=Abs(GetVertAxis.CalcSizeValue(YValue[ValueIndex],YValue[ValueIndex]-FTop.Value[ValueIndex]));
       if Format.Top.Visible and (Pointer.VertSize < tmpY) then
       begin
         PreparePen(ValueIndex, Format.Top);
@@ -750,7 +750,7 @@ var
   begin
     with Errors do
     begin
-      tmpY:=GetVertAxis.CalcSizeValue(FBottom.Value[ValueIndex]);
+      tmpY:=Abs(GetVertAxis.CalcSizeValue(YValue[ValueIndex],YValue[ValueIndex]+FBottom.Value[ValueIndex]));
       if Format.Bottom.Visible and (Pointer.VertSize < tmpY) then
       begin
         PreparePen(ValueIndex, Format.Bottom);
-- 
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