Grid lines incorrect on logarithmic scale?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Heraclitus
Newbie
Newbie
Posts: 10
Joined: Thu Jul 07, 2005 4:00 am

Grid lines incorrect on logarithmic scale?

Post by Heraclitus » Mon Aug 29, 2005 6:17 pm

I am using TeeChart ver. 2 (2.0.1992.14012), and I am trying to display the grid lines for a vertical logarithmic scale. What I noticed is that the spacing on the grid lines doesn't seem to look correct. That is, there is too much space between grid lines towards the top of the next decade of logarithmic units.

Is this a known problem, or am I just not understanding something?

I displayed the grid lines by setting the grid to visible with a count of 9 in the design editor. This was set under the Chart->Axes->Minor->Grid... dialog.

As a slight bit of background, I took and modified some of the code from the "All Features -> Axes -> Custom logarithmic axis" example and tried to draw the lines myself. This code draws the grid marks with what seems the correct amount of space between them.

Code: Select all

private void historicalBoxPlots_BeforeDrawAxes(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{

   // get rectangle occupied by chart
   Rectangle chartRect = g.Chart.ChartRect;
			
   // get axis and use same pen style as minor grid
   Axis leftAxis = g.Chart.Axes.Left;
   g.Pen.Style = leftAxis.MinorGrid.Style;
   g.Pen.Color = leftAxis.MinorGrid.Color;

   // get start and end position for minor line
   int start = chartRect.Left - leftAxis.MinorTicks.Length;
   int end = chartRect.Right;

   double currentPos = 0;

   // hardcoded the decades to simplify code
   for(int i = 1; i <= 3; i++)
   {
      // loop to draw minor grid lines
      for(int k = 2; k <= 9; k++)
      {
          currentPos = Math.Log10(k) * Math.Pow(10, i);
          int tickPos = leftAxis.CalcPosValue(currentPos);
				
          g.Line(start, tickPos, end, tickPos);  // horizontal minor tick marks
       }
    }
}

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Aug 30, 2005 10:54 am

Hi Heraclitus,

Thanks for the report. I've been able to reproduce that and it is a bug. I've added this issue to our defect list to be fixed for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Heraclitus
Newbie
Newbie
Posts: 10
Joined: Thu Jul 07, 2005 4:00 am

Post by Heraclitus » Tue Aug 30, 2005 3:49 pm

Hi Narcis,

Thank you for the quick reply.

I just wanted to mention that the code I included in my post also incorrectly spaces the grid lines on a logarithmic vertical axis. Someone at my job pointed out my mistake.

In any case, I wanted to be sure that my incorrect code was not used by anyone.

Thanks again.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Aug 31, 2005 8:50 am

Hi Heraclitus,

Thanks for advising, I've added this to the bug report.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply