Show a point that does not lie on a series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Lakshmi
Newbie
Newbie
Posts: 40
Joined: Fri Oct 07, 2005 4:00 am
Location: India
Contact:

Show a point that does not lie on a series

Post by Lakshmi » Tue Mar 07, 2006 10:20 am

In an application using tchart, is there anyway to show marker on some x and y value which is not on the series (line/curve)?

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 Mar 07, 2006 10:37 am

Hi Lakshmi,

Yes, you can do something like the code below custom drawing on TeeChart's canvas.

Code: Select all

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			int x=tChart1.Axes.Bottom.CalcPosValue(5.3);
			int y=tChart1.Axes.Left.CalcPosValue(76.2);

			g.TextOut(x,y,"My custom text");
		}
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

Lakshmi
Newbie
Newbie
Posts: 40
Joined: Fri Oct 07, 2005 4:00 am
Location: India
Contact:

Show a point that does not lie on a series

Post by Lakshmi » Thu Mar 09, 2006 6:37 am

Hi Narcis,
g.TextOut does solve the problem, but our requirement is to draw a mark such "X" or a circle at a given X & Y value. I guess we can do this using g.Ellipse or g.Line. But I was wondering if there was a easier way to do it, say by just giving X & Y value T-Chart should be able to draw the mark.

Also related question is, I use g.Ellipse or g.Line and draw the mark, I would need a way to even erase the mark, how can we achieve that? I guess one way would be to call invalidate, right?

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 Mar 09, 2006 8:54 am

Hi Lakshmi,
g.TextOut does solve the problem, but our requirement is to draw a mark such "X" or a circle at a given X & Y value. I guess we can do this using g.Ellipse or g.Line. But I was wondering if there was a easier way to do it, say by just giving X & Y value T-Chart should be able to draw the mark.
To achieve that you may like to use a bubble series which already have their own marks implemented. In a bubble series you can specify the X and Y coordinates for the center and the radius for each bubble.
Also related question is, I use g.Ellipse or g.Line and draw the mark, I would need a way to even erase the mark, how can we achieve that? I guess one way would be to call invalidate, right?
Then you should also consider using Annotation tools as I told you in previous posts.
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

Lakshmi
Newbie
Newbie
Posts: 40
Joined: Fri Oct 07, 2005 4:00 am
Location: India
Contact:

Show a point that does not lie on a series

Post by Lakshmi » Thu Mar 09, 2006 10:55 am

Hi Narcis,
If i use a bubble series and only one point in that series the bubble mark does not appear.
It needs more than one point to be added to the series for the marks to be visible. Am I right?
ANy thoughts?

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 Mar 09, 2006 12:32 pm

Hi Lakshmi,

No, it works fine using only one bubble in a chart but it's somewhat tricky as you need to use:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			bubble1.Add(0,0,10,"My bubble",Color.Red);
			bubble1.Marks.Visible=true;

			tChart1.Axes.Bottom.SetMinMax(bubble1.XValues[0]-bubble1.RadiusValues[0],bubble1.XValues[0]+bubble1.RadiusValues[0]);
			tChart1.Axes.Left.SetMinMax(bubble1.YValues[0]-bubble1.RadiusValues[0],bubble1.YValues[0]+bubble1.RadiusValues[0]);
		}
You could also try using a shape series instead of a bubble series.
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

Lakshmi
Newbie
Newbie
Posts: 40
Joined: Fri Oct 07, 2005 4:00 am
Location: India
Contact:

Show a point that does not lie on a series

Post by Lakshmi » Fri Mar 10, 2006 7:30 am

Thanks Narcis for suggesting shape series.

But I have a problem.

I have draw closely seperated vertical lines (0.1 distance) and the bubble/shape is drawn on the "band" of these closely seperated vertical lines.
So the bubble/shape gets hidden behind these vertical lines since they are so close. I tried setting the transparency value for the bubble/shape but it does not work.

Any ideas/suggestions?

Lakshmi
Newbie
Newbie
Posts: 40
Joined: Fri Oct 07, 2005 4:00 am
Location: India
Contact:

Show a point that does not lie on a series

Post by Lakshmi » Fri Mar 10, 2006 7:39 am

Hi Narcis,

Would there be anyway to show the bubble/shape series on top of the closely seperated line series?

Thanks

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 Mar 10, 2006 10:47 am

Hi Lakshmi,

Yes, you could try using:

Code: Select all

			tChart1.Series.Exchange(0,1);
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

Lakshmi
Newbie
Newbie
Posts: 40
Joined: Fri Oct 07, 2005 4:00 am
Location: India
Contact:

Show a point that does not lie on a series

Post by Lakshmi » Fri Mar 10, 2006 12:07 pm

How do I find out whether a given point exists on series?

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 Mar 10, 2006 12:40 pm

Hi Lakshmi,

You can try doing something like:

Code: Select all

      if (line1.YValues.IndexOf(value) != -1)
      {
        //Value exists
      }
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

Lakshmi
Newbie
Newbie
Posts: 40
Joined: Fri Oct 07, 2005 4:00 am
Location: India
Contact:

Show a point that does not lie on a series

Post by Lakshmi » Mon Mar 13, 2006 4:48 am

Thanks Narcis,

Is there a way to explicitly set the Z-Order of a series? (rather than doing an exchange later on).

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 Mar 13, 2006 11:51 am

Hi Lakshmi,

Yes, you can use something like this:

Code: Select all

    private void button1_Click(object sender, EventArgs e)
    {
      int old_order = line1.ZOrder;

      line1.ZOrder = line2.ZOrder;
      line2.ZOrder = old_order;
    }
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