Page 1 of 1
how to draw digital on-off signal
Posted: Thu Sep 20, 2007 1:10 am
by 9644471
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?
Posted: Thu Sep 20, 2007 9:15 am
by narcis
Hi scott,
What about using horizontal bar series (Steema.TeeChart.Styles.HorizBar)?
Posted: Wed Sep 26, 2007 9:07 am
by 9644471
Sorry, I don't know how to draw like the picture use horizontal bar series.
Can you give me some example?
Posted: Wed Sep 26, 2007 9:36 am
by narcis
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.
Posted: Thu Sep 27, 2007 7:32 am
by 9644471
Thank you Narcís.
But I need to draw like hat.
It should have underline not a rectangle.
like this
Posted: Thu Sep 27, 2007 8:17 am
by narcis
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);
}
Posted: Fri Sep 28, 2007 1:52 am
by 9644471
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?
Posted: Fri Sep 28, 2007 8:14 am
by narcis
Hi scott,
Yes, you can set bottom axis minimum and maximum values like this:
Code: Select all
tChart1.Axes.Bottom.SetMinMax(-50, 50);
Posted: Fri Sep 28, 2007 8:55 am
by 9644471
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?
Posted: Fri Sep 28, 2007 9:15 am
by narcis
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;