Page 1 of 1

Custom drawing using TeeChart's Canvas

Posted: Thu Feb 05, 2009 8:10 pm
by 14049416
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

Posted: Fri Feb 06, 2009 11:17 am
by 10050769
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.