Series marks

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Series marks

Post by UserLS » Wed Jan 07, 2009 4:17 am

There are different styles you can choose from for your marks. But here is my puzzle: "Value" and "Label" seem to produce the same marks, so why I would like to use "Label and Value" style? It is just useless. Another observation: "X value" and "X and Y values" work just fine for "normal" series. But if I have horizontal bar, area or line series I again am back to x value duplicated. So for those series, how can I show both coordinates without any custom code and catching any events?

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

Post by Narcís » Wed Jan 07, 2009 10:13 am

Hi UserLS,
There are different styles you can choose from for your marks. But here is my puzzle: "Value" and "Label" seem to produce the same marks, so why I would like to use "Label and Value" style? It is just useless.
No, this can be used when you have a string label for each point in the series, for example:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.Marks.Visible = true;
			line1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.LabelValue;

			Random y = new Random();

			for (int i = 0; i < 10; i++)
			{
				line1.Add(y.Next(), "point " + (i + 1).ToString());
			}
		}
Another observation: "X value" and "X and Y values" work just fine for "normal" series. But if I have horizontal bar, area or line series I again am back to x value duplicated. So for those series, how can I show both coordinates without any custom code and catching any events?
This is a bug which I have added to the list to be fixed (TF02013685). There's no way of achieving that without using events nor custom code.

An option is doing this:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.HorizLine horizLine1 = new Steema.TeeChart.Styles.HorizLine(tChart1.Chart);
			horizLine1.Marks.Visible = true;			
			horizLine1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Label;
			horizLine1.FillSampleValues();

			for (int i = 0; i < horizLine1.Count; i++)
			{
				horizLine1.Labels[i] = horizLine1.YValues[i].ToString() + " - " + horizLine1.XValues[i].ToString();
			}
		}
Another one is customizing marks using the GetSeriesMark event:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.HorizLine horizLine1 = new Steema.TeeChart.Styles.HorizLine(tChart1.Chart);
			horizLine1.Marks.Visible = true;			
			horizLine1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Label;
			horizLine1.FillSampleValues();
			horizLine1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(horizLine1_GetSeriesMark);
		}

		void horizLine1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
		{
			e.MarkText = series.YValues[e.ValueIndex].ToString() + " - " + series.XValues[e.ValueIndex].ToString();
		}
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