Page 1 of 1

Event serie added or removed?

Posted: Thu Feb 11, 2010 11:55 am
by 15654539
Hello,

Is there any event in the chart, to detect when a serie has been added or removed from the chart with the chart editor?

Thanks in advance,

Re: Event serie added or removed?

Posted: Thu Feb 11, 2010 12:44 pm
by narcis
Hi wakeup,

There are no specific events for that but you can do it using existing editor events, for example:

Code: Select all

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

		private Steema.TeeChart.Editor editor1;
		private int numSeries;

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.FillSampleValues();

			editor1 = new Steema.TeeChart.Editor(tChart1);
			editor1.ShowEditor += new EventHandler(editor1_ShowEditor);
			editor1.CloseEditor += new EventHandler(editor1_CloseEditor);
			tChart1.DoubleClick += new EventHandler(tChart1_DoubleClick);
		}

		void tChart1_DoubleClick(object sender, EventArgs e)
		{
			editor1.ShowModal();
		}

		void editor1_ShowEditor(object sender, EventArgs e)
		{
			numSeries = tChart1.Series.Count;
		}

		void editor1_CloseEditor(object sender, EventArgs e)
		{
			if (numSeries > tChart1.Series.Count)
			{
				this.Text = "series removed";
			}
			else
			{
				if (numSeries < tChart1.Series.Count)
				{
					this.Text = "series added";
				}
				else
				{
					this.Text = "same series number";
				}
			}
		}
Hope this helps!

Re: Event serie added or removed?

Posted: Thu Feb 11, 2010 1:34 pm
by 15654539
I think it will be enought.

Thanks!