Is there a tool to draw shapes on a chart?

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

Is there a tool to draw shapes on a chart?

Post by WD_Gordon » Wed Jan 21, 2009 7:04 pm

I have a chartwith a candle series. My employer wants me to add the capability to draw circles and ellipses on the candle chart. Is there such a tool?

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

Post by Sandra » Thu Jan 22, 2009 11:33 am

Hi WD_Gordon!

I propos one solution, you can help.

You, can use events OnMouseUp, and OnMouseDown as next exemple:

OnMouseDown

Code: Select all

        private void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            Steema.TeeChart.Styles.Shape sh = new Steema.TeeChart.Styles.Shape(tChart1.Chart);
            sh.Style = ShapeStyles.Circle;
            sh.Transparent = true;
            sh.X0 = tChart1.Axes.Bottom.CalcPosPoint(e.X);
            sh.Y0 = tChart1.Axes.Left.CalcPosPoint(e.Y);

        }
OnMouseUp

Code: Select all

        private void tChart1_MouseUp(object sender, MouseEventArgs e)
        {
            
            ((Steema.TeeChart.Styles.Shape)tChart1[tChart1.Series.Count - 1]).X1 = tChart1.Axes.Bottom.CalcPosPoint(e.X);
            ((Steema.TeeChart.Styles.Shape)tChart1[tChart1.Series.Count - 1]).Y1 = tChart1.Axes.Left.CalcPosPoint(e.Y);
            tChart1[tChart1.Series.Count - 1].Repaint();
        }
You needs assign X0,Y0,X1,Y1 values,because you does not draw correct circle. If you would draw an ellipse, you just have to draw the circle lying.

Thanks,

Best Regards
Sandra Pazos



Steema Support Central
http://support.steema.com

Post Reply