Page 1 of 1

Questionable Precision in Display of Logarithmic Curves

Posted: Tue Aug 23, 2016 9:10 pm
by 9231205
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 = "?";
}
}
}

Re: Questionable Precision in Display of Logarithmic Curves

Posted: Wed Aug 24, 2016 9:24 am
by Christopher
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?

Re: Questionable Precision in Display of Logarithmic Curves

Posted: Wed Aug 24, 2016 7:30 pm
by 9231205
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.

Re: Questionable Precision in Display of Logarithmic Curves

Posted: Thu Aug 25, 2016 7:35 am
by Christopher
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.