how to draw digital on-off signal

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
scott
Newbie
Newbie
Posts: 13
Joined: Fri Mar 09, 2007 12:00 am

how to draw digital on-off signal

Post by scott » Thu Sep 20, 2007 1:10 am

How can I draw like this picture
http://img507.imageshack.us/img507/677/46495697wc1.png

I use Area to draw but Area is hard to use.
I also draw two line and set width but can't do very well.
Is there other Object easy to use?

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 Sep 20, 2007 9:15 am

Hi scott,

What about using horizontal bar series (Steema.TeeChart.Styles.HorizBar)?
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

scott
Newbie
Newbie
Posts: 13
Joined: Fri Mar 09, 2007 12:00 am

Post by scott » Wed Sep 26, 2007 9:07 am

Sorry, I don't know how to draw like the picture use horizontal bar series.
Can you give me some example?

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 Sep 26, 2007 9:36 am

Hi scott,

Yes, you can try something like this:

Code: Select all

			Steema.TeeChart.Styles.HorizBar hBar1 = new Steema.TeeChart.Styles.HorizBar(tChart1.Chart);
			hBar1.Add(38, 0);
You'll also find some more examples at the features demo available at TeeChart's program group.
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

scott
Newbie
Newbie
Posts: 13
Joined: Fri Mar 09, 2007 12:00 am

Post by scott » Thu Sep 27, 2007 7:32 am

Thank you Narcís.
But I need to draw like hat.
It should have underline not a rectangle.
like this
Image

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 Sep 27, 2007 8:17 am

Hi scott,

In that case you can combine HorizBar series with ColorLine tool as shown here:

Code: Select all

		private Steema.TeeChart.Styles.HorizBar horizBar1;

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;
			
			horizBar1 = new Steema.TeeChart.Styles.HorizBar(tChart1.Chart);
			
			horizBar1.Add(38, 0);
			horizBar1.Add(25, 1);
			horizBar1.Add(32, 2);

			if (horizBar1.Count == 1)
			{
				tChart1.Axes.Left.SetMinMax(horizBar1.MinYValue()-1,horizBar1.MaxYValue()+1);
			}
			else
			{
				tChart1.Axes.Left.Automatic = true;
			}

			horizBar1.GetBarStyle += new Steema.TeeChart.Styles.CustomBar.GetBarStyleEventHandler(horizBar1_GetBarStyle);
		}

		void horizBar1_GetBarStyle(Steema.TeeChart.Styles.CustomBar sender, Steema.TeeChart.Styles.CustomBar.GetBarStyleEventArgs e)
		{
			Steema.TeeChart.Tools.ColorLine cl = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
			cl.Axis = horizBar1.GetVertAxis;
			cl.Pen.Color = horizBar1.Pen.Color;
			cl.Value = horizBar1.GetVertAxis.CalcPosPoint(horizBar1.BarBounds.Bottom);
		}
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

scott
Newbie
Newbie
Posts: 13
Joined: Fri Mar 09, 2007 12:00 am

Post by scott » Fri Sep 28, 2007 1:52 am

Thank you for reply. It works.
But HorizBar always start at the left axes.
Could I make HorizBar start at the middle like the picture?

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 Sep 28, 2007 8:14 am

Hi scott,

Yes, you can set bottom axis minimum and maximum values like this:

Code: Select all

			tChart1.Axes.Bottom.SetMinMax(-50, 50);
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

scott
Newbie
Newbie
Posts: 13
Joined: Fri Mar 09, 2007 12:00 am

Post by scott » Fri Sep 28, 2007 8:55 am

Thank you Narcís.
But if I need to draw this digital with analog single like the picture.
I can't use tChart1.Axes.Bottom.SetMinMax.
Is HorizBar must start at left or not? How can I do?
Image

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 Sep 28, 2007 9:15 am

Hi scott,

In that case, having another series in the chart you can use UseOrigin and Origin properties of HorizBar, for example:

Code: Select all

			horizBar1.UseOrigin = true;
			horizBar1.Origin = 5;
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