Page 1 of 1

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

Posted: Tue Jul 15, 2008 11:20 am
by 14047415
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

Posted: Tue Jul 15, 2008 11:47 am
by narcis
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;
			}			
		}

Posted: Tue Jul 15, 2008 2:09 pm
by 14047415
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

Posted: Tue Jul 15, 2008 2:29 pm
by narcis
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.

Posted: Tue Jul 15, 2008 2:52 pm
by narcis
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 = "";
			}
		}

Problem in showing marks label

Posted: Fri Aug 08, 2008 9:05 am
by 14047415
Hi,

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

Please update on it.

Thanks,
Sanyog

Re: Problem in showing marks label

Posted: Fri Aug 08, 2008 9:10 am
by Chris
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?

Posted: Fri Aug 08, 2008 11:15 am
by 14047415
Hi,

I have uploaded the snap after applying the workaround.

Please look at this.

Thanks,
Sanyog

Posted: Mon Aug 11, 2008 7:24 am
by 14047415
Hi,

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

Thanks,
Sanyog

Posted: Mon Aug 11, 2008 2:14 pm
by Chris
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