How to draw multiple line without adding series?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

How to draw multiple line without adding series?

Post by goodsj » Tue Dec 17, 2019 1:48 am

For example, I have a sales chart by item with teechart.
before.jpg
before.jpg (143.94 KiB) Viewed 521 times
I want to add break-even point line on 450.
after.jpg
after.jpg (150.85 KiB) Viewed 521 times
How can I implement it? I think it would be good if you give me a sample

Thank you.

Christopher
Guru
Posts: 1212
Joined: Fri Nov 15, 2002 12:00 am

Re: How to draw multiple line without adding series?

Post by Christopher » Wed Dec 18, 2019 7:34 am

goodsj wrote:
Tue Dec 17, 2019 1:48 am
How can I implement it? I think it would be good if you give me a sample
Of course - you can find the sample I refer to below in the TeeChart for .NET C# Windows Forms examples repo under the 'Feature Demo' folder. The sample shows TeeChart's canvas events which allow you to draw lines, shapes, text and images at any point of the chart at different times of its painting routine:
TeeChartNetExamples_Ek94xF71VG.png
TeeChartNetExamples_Ek94xF71VG.png (187.6 KiB) Viewed 500 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

Re: How to draw multiple line without adding series?

Post by goodsj » Fri Dec 20, 2019 2:36 am

Thanks for answering.

I could draw line with Graphics3D, Point.

but, I couldn't set 450 its line position dynamically regardless of chart size.

Christopher
Guru
Posts: 1212
Joined: Fri Nov 15, 2002 12:00 am

Re: How to draw multiple line without adding series?

Post by Christopher » Fri Dec 20, 2019 9:47 am

goodsj wrote:
Fri Dec 20, 2019 2:36 am
but, I couldn't set 450 its line position dynamically regardless of chart size.
You can fix the point by getting the Axis to calculate the pixel value of the Axis value for you, e.g.

Code: Select all

		private void TChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			var yVal = tChart1.Axes.Left.CalcPosValue(450);
			g.Pen.Color = Color.Red;
			g.HorizontalLine(tChart1.Chart.ChartRect.Left, tChart1.Chart.ChartRect.Right, yVal);
		}
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

Re: How to draw multiple line without adding series?

Post by goodsj » Mon Dec 23, 2019 7:04 am

Thanks to you, we solved the problem. :D

Post Reply