Graphical Error on sides of chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
CAfIT
Newbie
Newbie
Posts: 5
Joined: Fri Dec 02, 2005 12:00 am
Contact:

Graphical Error on sides of chart

Post by CAfIT » Tue Jul 22, 2008 2:06 pm

We recently upgraded our systems from using your ActiveX version to the .NET version and found the following graphical error:

http://img291.imageshack.us/my.php?imag ... rorpx8.png

I can get the graphical error to disappear if I set the Frame.Visibility to false while I'm in debug mode, but if I set it in actual code (like in the InitializeComponent method) the graphical error is still present. I know that the Frame property is depricated and we don't actually use that property, I just noticed that the error disappeared when I changed its value. It could be because the chart is triggered to refresh once that value has been changed but that's what I'm hoping on that you guys will know :)

I'm running .NET 2.0 on Windows XP/x86 using VS2005 as dev environment by the way.

Cheers,
Erik

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 Jul 22, 2008 2:25 pm

Hi Erik,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here and let us know the exact TeeChart version you are using?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

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

CAfIT
Newbie
Newbie
Posts: 5
Joined: Fri Dec 02, 2005 12:00 am
Contact:

Post by CAfIT » Tue Jul 29, 2008 2:13 pm

I figured out what was causing the graphical error, namely:

Code: Select all

                    
private void barChart_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
  barChart.Graphics3D.MoveTo(barChart.Axes.Left.Position, barChart.Axes.Left.CalcYPosValue(0));
  barChart.Graphics3D.LineTo(barChart.Axes.Right.Position, barChart.Axes.Left.CalcYPosValue(0));
}
When looking at the points its getting from the chart, they seem to be ok, but line is still drawn from x=0 to the left axis position for some reason, any hints on why?

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 Jul 29, 2008 2:31 pm

Hi CAfIT,

Ok, now I see which is the problem here. You have 2 options:

1. Setting series' VertAxis to both default vertical axes:

Code: Select all

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

		private Steema.TeeChart.Styles.Line line1;

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

			line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.Pointer.Visible = true;
			line1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;

			for (int i = 0; i < 10; i++)
			{
				line1.Add(0);
			}

			tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
		}

		void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			g.MoveTo(tChart1.Axes.Left.Position, tChart1.Axes.Left.CalcYPosValue(0));
			g.LineTo(tChart1.Axes.Right.Position, tChart1.Axes.Left.CalcYPosValue(0)); 
		}
2. Use bottom axis end position:

Code: Select all

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

		private Steema.TeeChart.Styles.Line line1;

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

			line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.Pointer.Visible = true;
			//line1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;

			for (int i = 0; i < 10; i++)
			{
				line1.Add(0);
			}

			tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
		}

		void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			g.MoveTo(tChart1.Axes.Left.Position, tChart1.Axes.Left.CalcYPosValue(0));
			//g.LineTo(tChart1.Axes.Right.Position, tChart1.Axes.Left.CalcYPosValue(0)); 
			g.LineTo(tChart1.Axes.Bottom.IEndPos, tChart1.Axes.Left.CalcYPosValue(0)); 
		}
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

CAfIT
Newbie
Newbie
Posts: 5
Joined: Fri Dec 02, 2005 12:00 am
Contact:

Post by CAfIT » Tue Jul 29, 2008 2:39 pm

I ended up using the 2nd approach. Worked fine, thanks!


Cheers,
CAfIT

Post Reply