Questionable Precision in Display of Logarithmic Curves

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Questionable Precision in Display of Logarithmic Curves

Post by Little Mike » Tue Aug 23, 2016 9:10 pm

I have a question for the Support team. I have a simple application that displays a curve of values against a horizontal logarithmic scale from 0.2 to 2000. I notice, and I will try to attach a video, of the display showing that the curve values at certain points seem to be displaced almost always to the right of where they should be on that logarithmic scale. I'm asking if there's something that I'm doing wrong, or is there an issue with how TeeChart is displaying those values on a logarithmic scale.

Your system won't allow me to directly attach a WMV so I have the file in my dropbox here:

https://www.dropbox.com/s/gcd11qcs5603a ... n.wmv?dl=0

Also added a screen shot attached, but you cannot see my cursor in it. The value in question, for example, is 4955 / 3.8942.

Note that in the video, the value of 3.89 is clearly to the right of the minor grid line for 4.0 and shouldn't be, it should be to the left. Same with the other values I stop at. Visual precision is important for our application as it will be a point of criticism.

Here's the code that pulls the values. I have verified in the debugger that the correct value is being sampled.

private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (tChart1.Series.Count > 0)
{
int tmp = fastLineSeries1.Clicked(e.X, e.Y);
if (tmp != -1)
{
textBox1.Text = ((double)mapTheDoubles[tmp]).ToString();
textBox2.Text = ((double)secondCurve[tmp]).ToString();
}
else
{
textBox1.Text = "?";
textBox2.Text = "?";
}
}
}
Attachments
TChartLogDisplay.jpg
TChartLogDisplay.jpg (92.16 KiB) Viewed 9238 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Questionable Precision in Display of Logarithmic Curves

Post by Christopher » Wed Aug 24, 2016 9:24 am

Hello,

I'm not sure about this one. The following test code:

Code: Select all

    FastLine series;
    Annotation tool;
    private void InitializeChart()
    {
      Random rnd = new Random();
      tChart1.Aspect.View3D = false;
      series = new FastLine(tChart1.Chart);
      tool = new Annotation(tChart1.Chart);
      for (int t = 1; t < 10; t++)
      {
        series.Add(rnd.Next(100, 1000), rnd.Next(4950, 5000));
      }

      tChart1.Axes.Bottom.Logarithmic = true;
      tChart1.Axes.Bottom.SetMinMax(10, 10000);
      series.XValues.Order = ValueListOrder.Ascending;
      series.XValues.Sort();

      series.YValues.Order = ValueListOrder.Ascending;
      series.YValues.Sort();

      series.Marks.Visible = true;
      series.Marks.Style = MarksStyles.XY;

      tChart1.MouseMove += TChart1_MouseMove;
    }

    private void TChart1_MouseMove(object sender, MouseEventArgs e)
    {
      int clicked = series.Clicked(e.Location);
      tool.Text = "";

      if (clicked > -1)
      {
        double xval = series.XValues[clicked];
        double yval = series.YValues[clicked];

        tool.Text = "XVal=" + xval.ToString() + " YVal=" + yval.ToString();
      }
    }
seems to work as expected. Would you please be so kind as to modify it so that we can reproduce the problematic chart here?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Re: Questionable Precision in Display of Logarithmic Curves

Post by Little Mike » Wed Aug 24, 2016 7:30 pm

The complete project has been posted here:

https://www.dropbox.com/s/uudqfpudi0vou ... 2.zip?dl=0

My original project is posted here:

https://www.dropbox.com/s/amn27oxj43x9o ... 1.zip?dl=0

I am attaching a screen shot showing that a competing charting component is more accurate in positioning the curve.
Attachments
CompareTChartWithSyncfusion.jpg
CompareTChartWithSyncfusion.jpg (161.75 KiB) Viewed 9220 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Questionable Precision in Display of Logarithmic Curves

Post by Christopher » Thu Aug 25, 2016 7:35 am

Hello,

Before I look at your complete project, would you please be so kind as to confirm or not whether the code snippet I sent you works as expected? If it doesn't then there is a problem with the teechart source code. If it does then there is most likely a glitch in your code.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply