Horizontal grid line not appearing on last major tick

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Horizontal grid line not appearing on last major tick

Post by BenW » Sun Nov 09, 2008 7:46 am

Hello.

I have uploaded an image to illustrate this issue. The uploaded file is called steemaGridIssue.bmp.

If you look at the chart, you'll notice 3 left y-axes configured in 'stacked' fashion. Also note that the grid is enabled for each of the y axes and that the grid line is being drawn for each major tick, except on the very last major tick of each y axis, giving a larger than desired gap between the stacked graphs. Is there any way to rectify this, specifically to be able to get the grid line to be drawn against the last major tick also?

thanks,
Ben.

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

Post by Narcís » Mon Nov 10, 2008 9:54 am

Hello Ben,

I'm not able to reproduce the issue here using code snippet below. Could you please modify it so that we can reproduce the issue?

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;

			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			Steema.TeeChart.Styles.Line line3 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			line1.FillSampleValues();
			line2.FillSampleValues();
			line3.FillSampleValues();

			Steema.TeeChart.Axis axis1 = new Steema.TeeChart.Axis(tChart1.Chart);			
			axis1.StartPosition = 0;
			axis1.EndPosition = 30;
			tChart1.Axes.Custom.Add(axis1);
			line1.CustomVertAxis = axis1;

			Steema.TeeChart.Axis axis2 = new Steema.TeeChart.Axis(tChart1.Chart);
			axis2.StartPosition = 35;
			axis2.EndPosition = 65;
			tChart1.Axes.Custom.Add(axis2);
			line2.CustomVertAxis = axis2;

			tChart1.Axes.Left.StartPosition = 70;
			tChart1.Axes.Left.EndPosition = 100;
		}
Thanks in advance.
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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Mon Nov 10, 2008 10:10 pm

Hi Narcís,

If I cut and paste the code you sent into the test application that I recently sent you (zip file was called SteemaExample.zip), and comment out the existing Form1() method, then the first y-axis drawn (the bottom one), has it's last label (100) drawn without the horizontal grid line next to it. This can be seen in the file I've uploaded. The name of the file is SteemaGridissue2.bmp.

Are you seeing the same thing?

Ben.

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 Nov 11, 2008 9:00 am

Hi Ben,

I can't reproduce this here using latest v2 and v3 builds available at the client area. Could you please check if you are using latest version available? Also notice that the code I posted uses FillSampleValues for populating series. Therefore every time the application is executed a different set of data for each series is used. Could you please modify the code snippet I posted so that we can reproduce the issue here in a consistent way?

Thanks in advance.
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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Tue Nov 11, 2008 5:26 pm

Hi Narcís,

I believe we are using the latest version,

TeeChart for .NET v2
Code for Binary build
2.0.3203.23271/2

Released Oct 8, 2008.

I have uploaded the sample project, which gerates the same samples for each of the the 3 line series. The uploaded zip file is called SteemaGridIssue3 and also includes a file called WhatIsee.bmp which shows what I'm seeing.

thanks,
Ben.

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 Nov 11, 2008 5:52 pm

Hello Ben,

Thanks for the information. Yes, the version you are using is latest v2 release available.

I could reproduce the issue here and added it (TF02013562) to the 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Tue Nov 11, 2008 6:15 pm

Hi Narcís,

Thanks very much for your efforts. Please understand that this is a new enhancement (stacked y axes) that will be released soon to our customers, and in order to introduce this enhancement with a good impression, it would be nice if this issue could be resolved sooner rather than later, for the benefit of our customers.

Regards,
Ben.

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 Nov 11, 2008 6:45 pm

Hi Ben,

Sorry but I'm not able to provide an estimate date for this fix. Also notice that since May 2007, current TeeChart version is number 3. Therefore, I can't promise that the fix will be implemented in v2.

As a workaround, you could use ColorLine tools or custom draw lines in TeeChart's canvas, for example:

Code: Select all

      void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
      {
        int y;

        if (tChart1[2].MaxYValue() == tChart1[2].GetVertAxis.Maximum)
        {
          g.Pen = tChart1.Axes.Left.Grid;
          y = tChart1.Axes.Left.CalcYPosValue(tChart1.Axes.Left.Maximum);
          g.Line(tChart1.Axes.Bottom.IStartPos, y, tChart1.Axes.Bottom.IEndPos, y); 
        }

        if (tChart1[1].MaxYValue() == tChart1[1].GetVertAxis.Maximum)
        {
          g.Pen = tChart1.Axes.Custom[1].Grid;
          y = tChart1.Axes.Custom[1].CalcYPosValue(tChart1.Axes.Custom[1].Maximum);
          g.Line(tChart1.Axes.Bottom.IStartPos, y, tChart1.Axes.Bottom.IEndPos, y); 
        }
      }
Hope this helps!
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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Tue Nov 11, 2008 11:47 pm

Hi Narcís.

Thanks for the suggested workaround, but this wont' work in our situation. Note the extra line needs to be drawn such that it is spaced based on the existing grid spacing for the associated y-axis. Is there a way of calculating exactly where to draw the missing grid line based on this requirement. Note for our y-axes we are setting the MaximumOffset and MinimumOffset properties also, and so we can not base the grid line simply on the Maximum value on the y axis both for equal spacing reasons and the fact that the label against which the grid line needs to be drawn is never going to be the maximum value on the y-axis.

Also, are you saying that you are not longer officially supporting this version of TeeChart?

Ben.

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 Nov 12, 2008 8:17 am

Hi Ben,
Thanks for the suggested workaround, but this wont' work in our situation. Note the extra line needs to be drawn such that it is spaced based on the existing grid spacing for the associated y-axis. Is there a way of calculating exactly where to draw the missing grid line based on this requirement. Note for our y-axes we are setting the MaximumOffset and MinimumOffset properties also, and so we can not base the grid line simply on the Maximum value on the y axis both for equal spacing reasons and the fact that the label against which the grid line needs to be drawn is never going to be the maximum value on the y-axis.
Ok, in that case you can try calculating line's Y position using axes IStartPos, for example:

Code: Select all

          y = tChart1.Axes.Left.IStartPos;
          g.Line(tChart1.Axes.Bottom.IStartPos, y, tChart1.Axes.Bottom.IEndPos, y); 
Also, are you saying that you are not longer officially supporting this version of TeeChart?


No, I'm not saying that. However, our main efforts are on supporting v3 and developing future version. We may only make little bug fixing in v2. Issues that have a workaround available are less likely to be fixed in v2.
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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Wed Nov 12, 2008 4:39 pm

Hmmm ?

Can you provide more information on how your last proposed technique is going to solve the problem that we're experiencing?

I don't see how using a y-axis iStartPos property is going to help with being able to determine where the last missing grid line should be placed?? Again, our need is to be able to draw the missing grid line on the last label that is drawn on a y axis, in the case where we have multiple custom y-axes spaced vertically.

Essentially we need to be able to find the y-pos of the major tick for which the last drawn label is associated...possible?

Ben.

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

Post by Narcís » Thu Nov 13, 2008 9:02 am

Hi Ben,

My impression was that grid line was not drawn only when last label was on the very top of the axis. Therefore the code I used uses IStartPos, the top position of an axis to always draw a grid line there.

Do you think this solves your problem or there are other cases when grid lines are not drawn?

Thanks in advance.
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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Thu Nov 13, 2008 5:29 pm

Hi Narcís,

I think you may be right, although I'm sure I saw the last (or first) grid line not display under other circumstances. Working on this assumption, I'll use your suggestions to see if I can make it work for us.

I have another question. I have uploaded a file called CurvedLineChart.bmp. Is it possible for the Steema chart to draw something like this? The main thing is to be able to draw the points and have a curved line joining them, with the curved line bending back on itself. The text on the chart is not critical, but it would be nice... possible?

thanks,
Ben.

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

Post by Narcís » Fri Nov 14, 2008 8:28 am

Hi Ben,

The only way I can think of to achieve that is using a Points series and then a Line series with a Smoothing function associated. For example:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;
			
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);			
			Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);

			points1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
			line1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
						
			Steema.TeeChart.Functions.Smoothing smoothing1 = new Steema.TeeChart.Functions.Smoothing(tChart1.Chart);

			smoothing1.Factor = 10;
			line1.Function = smoothing1;
			line1.DataSource = points1;						

			points1.Add(3, 0);
			points1.Add(4, 1);
			points1.Add(5, 2);
			points1.Add(6, 3);
			points1.Add(5, 4);
			points1.Add(5, 4);
			points1.Add(4, 3);
			points1.Add(3, 2);
			points1.Add(0, 1);

			line1.CheckDataSource();

			tChart1.Axes.Bottom.SetMinMax(0, 10);
			tChart1.Axes.Left.SetMinMax(0, 10);
		}
Notice that you need to set series' XValues.Order to None. Also, smoothing function is not specifically designed for this kind of plot and you may notice it bending on itself depending on axes scale, series points, etc.

Regarding the texts, you could use series marks and Annotation tools for that.

Hope this helps!
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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Nov 14, 2008 4:40 pm

Hi Narcís,

Great, I think this solution might work for us.

Narcís, if you didn't already know, I just wanted to convey to you how much I appreciate the level of timely and comprehensive support you always provide. It doesn't go unnoticed, and is key in allowing us to enable our customers. It's always a pleasure to interact with you.

Regards,
Ben.

Post Reply