Fill Peaks of sine wave

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Fill Peaks of sine wave

Post by asupriya » Thu Sep 24, 2009 3:24 am

I have an array of fastline series which display some sine waves. I like to know how i can optionally (user triggered) fill the peaks and through of the fastline series's sine wave.

Any help in this regard is greatly appreciated.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Fill Peaks of sine wave

Post by Yeray » Thu Sep 24, 2009 11:53 am

Hi asupriya,

I'm not sure to understand what are you exactly trying to draw here. Maybe a picture would help us to understand it better.

Anyway, have you seen the SeriesBand Tool and the SeriesRegion Tool?
- SeriesBandTool (All Features\Welcome !\Tools\SeriesBand Tool). Giving a line series to it, the are under the line until zero, will be painted.
- SeriesRegionTool (All Features\Welcome !\Tools\Area under the curve). With this, you'll be able to paint the area under a line but here you'll be able to set an XValue to start painting (the peak begin), an XValue to end painting (the peak finish) and an YValue (origin) to limit the drawing area under the line.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Re: Fill Peaks of sine wave

Post by asupriya » Thu Sep 24, 2009 12:34 pm

I am looking for something of effect shown in the image attached.

Thanks.
test.JPG
test.JPG (25.06 KiB) Viewed 9464 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Fill Peaks of sine wave

Post by Yeray » Thu Sep 24, 2009 2:57 pm

Hi asupriya,

If you have those sin waves horizontal, you'll be able to use SeriesRegionTool. Note that you should create a SeriesRegionTool for each zone to mark.

And note that I've added the possibility to use this tool with Horizontal Line series in the wish list to be implemented in a further release (TF02014442).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Re: Fill Peaks of sine wave

Post by asupriya » Sat Sep 26, 2009 2:30 am

SeriesBandTool, SeriesRegionTool are not the ones i am looking for. Is there anything that can draw as shown in the attached image?

Thanks
untitled.JPG
untitled.JPG (8.51 KiB) Viewed 9461 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Fill Peaks of sine wave

Post by Yeray » Mon Sep 28, 2009 12:12 pm

Hi asupriya,

You can use SeriesRegionTool to obtain a chart like in your picture with the following code:

Code: Select all

tChart1.Aspect.View3D = false;

            int nSeries = 4;

            int [] YPos = new int[nSeries];
            Steema.TeeChart.Styles.FastLine[] fast = new Steema.TeeChart.Styles.FastLine[nSeries];
            Steema.TeeChart.Tools.SeriesRegionTool[] region = new Steema.TeeChart.Tools.SeriesRegionTool[nSeries];

            for (int i = 0; i < nSeries; i++)
            {
                YPos[i] = i * 5;
                fast[i] = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
                if (i % 2 == 0)
                {
                    for (int j = 0; j < 200; j++) fast[i].Add(Math.Sin((double)j / 10) + YPos[i]);
                }
                else
                {
                    for (int j = 0; j < 200; j++) fast[i].Add(Math.Cos((double)j / 10) + YPos[i]);
                }

                region[i] = new Steema.TeeChart.Tools.SeriesRegionTool(tChart1.Chart);
                region[i].Series = fast[i];
                region[i].Origin = YPos[i];
                region[i].UseOrigin = true;
                region[i].Brush.Style = System.Drawing.Drawing2D.HatchStyle.Vertical;
                region[i].Brush.Transparency = 100;
                region[i].Pen.Visible = false;
                region[i].Brush.ForegroundColor = fast[i].Color;
            }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Re: Fill Peaks of sine wave

Post by asupriya » Mon Sep 28, 2009 6:41 pm

Great. Thanks alot. This is exactly what I needed.

Appreciate your help.

Post Reply