Page 1 of 1

Place a Shape on Webchart

Posted: Tue Jan 20, 2009 10:13 am
by 10549438
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

Posted: Tue Jan 20, 2009 10:43 am
by narcis
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.