Problem in showing more than one marks as text at a point

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
drillright40
Newbie
Newbie
Posts: 57
Joined: Mon Nov 19, 2007 12:00 am

Problem in showing more than one marks as text at a point

Post by drillright40 » Tue Jul 15, 2008 11:20 am

Hi,

I am using TChart Suface class to draw a 3D surface. Here is code

Surface.Marks.Visible = true;
Surface.Add(x,y,z,numeral);

numeral - as text in function.

On display, this numeral is shown as marks. This way I can display only

a single numeral at a point.

Problem is, how can we show two numerals at a single point having

different formats like color, bold and fonts?

-Raed

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 Jul 15, 2008 11:47 am

Hi Raed,

You can use GetSeriesMark event like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();		
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Surface surface1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);

			Random y = new Random();
			int count = 1;

			for (int x = 0; x < 10; x++)
			{
				for (int z = 0; z < 10; z++)
				{
					surface1.Add(x, y.Next(), z, "point " + count.ToString());
					count++;
				}
			}

			surface1.Marks.Visible = true;		

			surface1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(surface1_GetSeriesMark);
		}

		void surface1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
		{
			if (e.ValueIndex == 5)
			{
				e.MarkText = series.Labels[e.ValueIndex - 1] + " - " + series.Labels[e.ValueIndex];
				series.Marks.Items[e.ValueIndex].Font.Bold = true;
				series.Marks.Items[e.ValueIndex].Font.Color = Color.Red;
				series.Marks.Items[e.ValueIndex].Color = Color.White;
			}			
		}
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

drillright40
Newbie
Newbie
Posts: 57
Joined: Mon Nov 19, 2007 12:00 am

Post by drillright40 » Tue Jul 15, 2008 2:09 pm

Hi,

Sorry this is not working.

I want to show two numerals with different colors as marks.

Let say,
e.markText = "numeral1" + "\n" + "numeral2";

numeral1 should be red in color
numeral2 should be green in color

But marktext should be containing both.

-Raed

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 Jul 15, 2008 2:29 pm

Hi Raed,

I'm afraid this is not possible. I've added your request to our wish-list to be considered for inclusion in future releases.
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

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 Jul 15, 2008 2:52 pm

Hi Raed,

As an update, the only solution I can think of now to achieve what you request is setting mark text as you wish, set font color to transparent and then manually draw the text on TeeChart's canvas as shown here:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();		
		}

		private Steema.TeeChart.Styles.Surface surface1;

		private void InitializeChart()
		{
			surface1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);

			Random y = new Random();
			int count = 1;

			for (int x = 0; x < 10; x++)
			{
				for (int z = 0; z < 10; z++)
				{
					surface1.Add(x, y.Next(), z, "point " + count.ToString());
					count++;
				}
			}

			surface1.Marks.Visible = true;
			surface1.Marks.Font.Color = Color.Transparent;

			surface1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(surface1_GetSeriesMark);
			tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
		}

		void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			g.Font.Color = Color.Red;
			g.Font.Size = surface1.Marks.Font.Size;
			g.Font.Bold = surface1.Marks.Font.Bold;

			Steema.TeeChart.Styles.SeriesMarks.Position mp1 = surface1.Marks.Positions[5];

			g.TextOut(mp1.LeftTop.X, mp1.LeftTop.Y + 1, surface1.CalcZPos(5), surface1.Labels[4]);

			g.Font.Color = Color.Blue;
			g.TextOut(mp1.LeftTop.X + mp1.Width/2, mp1.LeftTop.Y + 1, surface1.CalcZPos(5), surface1.Labels[5]);
		}

		void surface1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
		{
			if (e.ValueIndex == 5)
			{
				e.MarkText = series.Labels[e.ValueIndex - 1] + series.Labels[e.ValueIndex];
			}
			else
			{
				e.MarkText = "";
			}
		}
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

drillright40
Newbie
Newbie
Posts: 57
Joined: Mon Nov 19, 2007 12:00 am

Problem in showing marks label

Post by drillright40 » Fri Aug 08, 2008 9:05 am

Hi,

I have uploaded one image which describes the subject line problem.

Please update on it.

Thanks,
Sanyog

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Re: Problem in showing marks label

Post by Christopher » Fri Aug 08, 2008 9:10 am

Hello,
drillright40 wrote:I have uploaded one image which describes the subject line problem.

Please update on it.
Thank you for you file 3Dplot.BMP.

I think Narcís understood your problem. As he said, he has entered the issue as a feature request (NOT as a defect). Can you not use the workaround he suggested?
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

drillright40
Newbie
Newbie
Posts: 57
Joined: Mon Nov 19, 2007 12:00 am

Post by drillright40 » Fri Aug 08, 2008 11:15 am

Hi,

I have uploaded the snap after applying the workaround.

Please look at this.

Thanks,
Sanyog

drillright40
Newbie
Newbie
Posts: 57
Joined: Mon Nov 19, 2007 12:00 am

Post by drillright40 » Mon Aug 11, 2008 7:24 am

Hi,

In continuous with previous reply, I have uploaded the src code also.

Thanks,
Sanyog

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Aug 11, 2008 2:14 pm

Hello,
drillright40 wrote: In continuous with previous reply, I have uploaded the src code also.
Thank you for the demonstration. I think I mentioned a possibly complicated workaround to this issue in the last message in this thread:
http://www.teechart.net/support/viewtop ... 8&start=30
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply