Custom drawing using TeeChart's Canvas

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
WD_Gordon
Newbie
Newbie
Posts: 49
Joined: Wed Jun 18, 2008 12:00 am

Custom drawing using TeeChart's Canvas

Post by WD_Gordon » Thu Feb 05, 2009 8:10 pm

When performing custom drawing in the TeeChart's Canvas, or in my case the AfterDraw event, I am allowing the user to drag the mouse and dynamically paint a Fibonacci Retracement.

My question is this, can I restrict the drawing to the series drawing area? Right now if the user drags over the value labels then it draws over the labels as well. I will like to keep the lines that I am drawing inside the actual chart area where my candles are displayed.

Thanks,
Kevin

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Fri Feb 06, 2009 11:17 am

Hi kevin!

Two things:

First:
In TeeChart exist the FibonacciTool, that paint Fibonacci Retracement, You could watch Demo "What's New?\Welcome !\New Chart Tools\Fibonacci Arcs" as exemple.

Second:

If solution first, not that you want You could do similar code as the exemple:

Code: Select all

        private void InitializeChart()
        {
     


            Steema.TeeChart.Styles.Candle candle1 = new Steema.TeeChart.Styles.Candle(tChart1.Chart);
            candle1.FillSampleValues(20);
            candle1.BeforeDrawValues += new Steema.TeeChart.PaintChartEventHandler(tChart1_BeforeDrawValues);
            candle1.Chart[0].AfterDrawValues += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDrawValues);
         }

Event BeforeDrawValues

Code: Select all

        private void tChart1_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
    
            g.ClipRectangle(tChart1.Chart.ChartRect);
            g.Line(0, 0, tChart1.Width, tChart1.Height); //exemple 
          
        }

Event AfterDrawValues

Code: Select all

   private void tChart1_AfterDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
          
            tChart1.Chart.Graphics3D.ClearClipRegions();
        }

I hope that you are help.
Best Regards,
Sandra Pazos / 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