How to draw a mark near clicked point
How to draw a mark near clicked point
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.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
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
instead of
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?
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;
Code: Select all
foreach (Steema.TeeChart.Styles.MarksItem mark in lineAct.Marks.Items)
mark.Visible = false;
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.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi bairog,
I'm afraid this is a bug which I have added to the list (TF02013771) to be fixed for next releases.
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 |
Instructions - How to post in this forum |
-
- 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
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:
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 |
Instructions - How to post in this forum |
Re: How to draw a mark near clicked point
We are talking about different things. I mean that:Narcís wrote:if the index is greater than the number of present MarksItems, a new null MarksItem is added in
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());
}
Thank you.
-
- 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
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.
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 |
Instructions - How to post in this forum |