How to draw a mark near clicked point

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
bairog
Newbie
Newbie
Posts: 72
Joined: Fri Jul 07, 2006 12:00 am
Location: Moscow, Russia
Contact:

How to draw a mark near clicked point

Post by bairog » Wed Jan 21, 2009 1:50 pm

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?
Last edited by bairog on Thu Jan 22, 2009 4:17 am, edited 1 time in total.
Thank you.

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 21, 2009 1:56 pm

Hi bairog,

You can try using ToolTips as shown here.

Hope this helps!
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

bairog
Newbie
Newbie
Posts: 72
Joined: Fri Jul 07, 2006 12:00 am
Location: Moscow, Russia
Contact:

Post by bairog » Wed Jan 21, 2009 4:19 pm

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?
Thank you.

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

Post by Narcís » Thu Jan 22, 2009 10:25 am

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.
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:

Re: How to draw a mark near clicked point

Post by Narcís » Thu Jun 25, 2009 1:13 pm

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());
		}
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

bairog
Newbie
Newbie
Posts: 72
Joined: Fri Jul 07, 2006 12:00 am
Location: Moscow, Russia
Contact:

Re: How to draw a mark near clicked point

Post by bairog » Tue Jul 14, 2009 9:37 am

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.
Thank you.

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

Re: How to draw a mark near clicked point

Post by Narcís » Fri Jul 17, 2009 10:02 am

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());
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