Page 1 of 1

Problem with ErrorPointSeries

Posted: Mon Dec 13, 2021 5:08 pm
by 16591853
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 3979 times

Re: Problem with ErrorPointSeries

Posted: Wed Dec 15, 2021 1:25 pm
by yeray
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);
--