Place a Shape on Webchart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Woehr.Mi
Newbie
Newbie
Posts: 38
Joined: Mon Jun 23, 2008 12:00 am

Place a Shape on Webchart

Post by Woehr.Mi » Tue Jan 20, 2009 10:13 am

Hello,

how is it possible to place a Shape on a Webchart?.

I'm using a triangle-Shape and I want to place it on a fixed Pixel-Position on my Webchart. And how can I increase or decraese the size of the shape-Series?

Best regards
Michael

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jan 20, 2009 10:43 am

Hi Michael,

You can do something like this:

Code: Select all

	protected void Page_Load(object sender, EventArgs e)
	{
		Steema.TeeChart.Chart ch1 = this.WebChart1.Chart;

		ch1.Aspect.View3D = false;
		ch1.Chart.Legend.Visible = false;
		ch1.Axes.Left.SetMinMax(0, 100);
		ch1.Axes.Bottom.SetMinMax(0, 100);

		DrawShape(ch1, 100, 100, 200, 200);
	}

	private void DrawShape(Steema.TeeChart.Chart ch1, int x0, int y0, int x1, int y1)
	{
		System.Drawing.Bitmap bmp = ch1.Bitmap((int)WebChart1.Width.Value, (int)WebChart1.Height.Value);

		Steema.TeeChart.Styles.Shape shape1;

		if (ch1.Series.Count == 0)
		{
			shape1 = new Steema.TeeChart.Styles.Shape(ch1);
			shape1.Style = Steema.TeeChart.Styles.ShapeStyles.Triangle;
		}
		else 
		{
			shape1 = (Steema.TeeChart.Styles.Shape)ch1[0];
		}

		shape1.X0 = ch1.Axes.Bottom.CalcPosPoint(x0);
		shape1.Y0 = ch1.Axes.Left.CalcPosPoint(y0);
		shape1.X1 = ch1.Axes.Bottom.CalcPosPoint(x1);
		shape1.Y1 = ch1.Axes.Left.CalcPosPoint(y1); 
	}
Calling DrawShape method with new dimensions should be enough for resizing it.
Best Regards,
Narcís Calvet / 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