Page 1 of 1

How to draw a mark near clicked point

Posted: Wed Jan 21, 2009 1:50 pm
by 9641771
I have a chart and line series on it. I need to draw a standart teeChart mark near clicked point and hide it after enother click. How can I do this?

Posted: Wed Jan 21, 2009 1:56 pm
by narcis
Hi bairog,

You can try using ToolTips as shown here.

Hope this helps!

Posted: Wed Jan 21, 2009 4:19 pm
by 9641771
But I want to have multiple marks (user can click all even points for example :) ). Mark should hide after enother click at the SAME point. Besides I also need to be able to drag this marks. As I suppose using ToolTips doesn't allow me to drag them.

UPDATE
A had an idea and today I've tested it.
The idea was to draw a line with marks enabled at every point, then make all of them inactive while loading form(accessing them with line1.Marks.Items[Index] property) and then activate and deactivate clicked points' marks the same way.
But there was a problem.
line1.Marks.Items.Count was ALWAYS zero (inside line1_AfterDrawValues, teeChart1_AfterDrawSeries and
lineAct_GetSeriesMark events and everywhere in project). So I can't access definite mark at runtime.
And inside OnGetSeriesMark event I have access only to mark text and that is not enough :(

What I'm doing wrong and what should I do?

UPDATE
Problem solved
My idea was right and I've implemented it.
Using

Code: Select all

for (i = 0; i < lineAct.Count; i++)
                lineAct.Marks.Items[i].Visible = false;
instead of

Code: Select all

foreach (Steema.TeeChart.Styles.MarksItem mark in lineAct.Marks.Items)
                    mark.Visible = false;
worked perfectly.

So could you explain me how could it be that lineAct.Marks.Items.Count is always zero but I can access lineAct.Marks.Items?

Posted: Thu Jan 22, 2009 10:25 am
by narcis
Hi bairog,
So could you explain me how could it be that lineAct.Marks.Items.Count is always zero but I can access lineAct.Marks.Items,


I'm afraid this is a bug which I have added to the list (TF02013771) to be fixed for next releases.

Re: How to draw a mark near clicked point

Posted: Thu Jun 25, 2009 1:13 pm
by narcis
Hi bairog,

After investigating this issue we found this is not a bug. In Steema.TeeChart.Styles.MarksItems.this[int index]... if the index is greater than the number of present MarksItems, a new null MarksItem is added in, for example:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
			bar1.FillSampleValues();
						
			MessageBox.Show(bar1.Marks.Items.Count.ToString());
			bar1.Marks.Items[2].Color = Color.Red;
			MessageBox.Show(bar1.Marks.Items.Count.ToString());
		}

Re: How to draw a mark near clicked point

Posted: Tue Jul 14, 2009 9:37 am
by 9641771
NarcĂ­s wrote:if the index is greater than the number of present MarksItems, a new null MarksItem is added in
We are talking about different things. I mean that:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
                      bar1.Marks.Visible = True;		
                      bar1.FillSampleValues(5);
					
			MessageBox.Show(bar1.Marks.Items.Count.ToString());
			
			
		}
returnes 0. In that example I'm not accessing index greater than 5 but bar1.Marks.Items.Count is 0.

Re: How to draw a mark near clicked point

Posted: Fri Jul 17, 2009 10:02 am
by narcis
Hi bairog,

Yes, but what I meant is that SeriesMarks.Items is only initialized when you customize a series mark accessing to it. For example, using code below will return Count=3 as 3rd mark is edited and null MarksItems for 0 and 1 are added since they didn't exist before.

Code: Select all

			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
			bar1.Marks.Visible = true;
			bar1.FillSampleValues(5);
			bar1.Marks.Items[2].Color = Color.Red;

			MessageBox.Show(bar1.Marks.Items.Count.ToString());