Old problem with 'text' for point series Marks.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
fano
Newbie
Newbie
Posts: 56
Joined: Wed Jun 22, 2005 4:00 am
Location: USA, California

Old problem with 'text' for point series Marks.

Post by fano » Thu Jun 15, 2006 11:24 pm

Hi,
This causes me some headache and some hint would be great:

There is no easy & reliable way to add text to point-marks. Let me demonstrate in an easy way a real problem with it:

1.
To show the text associated with a point-mark in a point series you have to do something like this (adding 4 points).

int iPoint = this.tChart2.Series[1].Add(1.0,3.33);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "First";

iPoint = this.tChart2.Series[1].Add(2.0,4.44);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "2nd";

iPoint = this.tChart2.Series[1].Add(3.0,5.55);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "3rd";

iPoint = this.tChart2.Series[1].Add(4.0,6.66);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "4th";

The "First", "2nd", etc appear properly IF you add ALSO the eventhandler:

private void points1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
{
if(e.ValueIndex > -1)
{
e.MarkText = series.Marks.Items[e.ValueIndex].Text;
}
}

NOW COMES THE PROBLEM!
Exchange the x-coordiante for the 2nd and 3rd point (so their order
on the X-axis is switched) and the graph should show the text:
"First", "3rd", "2nd", 4th" but actually it shows the point-mark-text
incorrectly:
"First" "3rd", then there is NO text for the next point, then "4th"

Is there any way to associate text with the marks of a point series
when the points are NOT all ordered in respect to the X-value?

Many thanks!
fano

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

Post by Narcís » Fri Jun 16, 2006 9:17 am

Hi fano,
To show the text associated with a point-mark in a point series you have to do something like this (adding 4 points).

int iPoint = this.tChart2.Series[1].Add(1.0,3.33);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "First";

iPoint = this.tChart2.Series[1].Add(2.0,4.44);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "2nd";

iPoint = this.tChart2.Series[1].Add(3.0,5.55);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "3rd";

iPoint = this.tChart2.Series[1].Add(4.0,6.66);
this.tChart2.Series[1].Marks.Items[iPoint].Text = "4th";

The "First", "2nd", etc appear properly IF you add ALSO the eventhandler:

private void points1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
{
if(e.ValueIndex > -1)
{
e.MarkText = series.Marks.Items[e.ValueIndex].Text;
}
}
It's a lot simpler, why don't you try using any of the add method overrides that allow you setting the marks text? Using only the code below the marks will be visible.

Code: Select all

      tChart1[0].Marks.Visible = true;
      tChart1[0].Add(1.0, 3.33,"First");
      tChart1[0].Add(2.0, 4.44,"2nd");
      tChart1[0].Add(3.0, 5.55,"3rd");
      tChart1[0].Add(4.0, 6.66,"4th");
NOW COMES THE PROBLEM!
Exchange the x-coordiante for the 2nd and 3rd point (so their order
on the X-axis is switched) and the graph should show the text:
"First", "3rd", "2nd", 4th" but actually it shows the point-mark-text
incorrectly:
"First" "3rd", then there is NO text for the next point, then "4th"

Is there any way to associate text with the marks of a point series
when the points are NOT all ordered in respect to the X-value?
Which TeeChart version are you using? This was fixed for latest TeeChart maintenance release from May 2006 (Builds 2.0.2306.26231 and 2.0.2306.26232).
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

fano
Newbie
Newbie
Posts: 56
Joined: Wed Jun 22, 2005 4:00 am
Location: USA, California

not quite fixed...

Post by fano » Fri Jun 16, 2006 2:55 pm

Hi,

1.
If you run the example I gave you will find that mark-text is NOT adjusted
in version 2.0.2306.26231. It is still a problem in that release. When you
use the Add overload with the text, then it is correct. BUT:

2. Your suggestion was to use the overloaded Add method .Add(x,y,text)
If I use that TeeChart will automatically change the bottom axis labels to the 'text' given in the overload method. I don't want it to do that. I want
the 'x' values to be the bottom axis. Is there a way to tell it to keep the original bottom axis, i.e. based on the 'x' values?

Thanks,
fano

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

Post by Narcís » Fri Jun 16, 2006 3:00 pm

Hi fano,

Yes, you can tell the axis to keep the x values in the labels using:

Code: Select all

      tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
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

fano
Newbie
Newbie
Posts: 56
Joined: Wed Jun 22, 2005 4:00 am
Location: USA, California

That works! Thanks.

Post by fano » Fri Jun 16, 2006 4:46 pm

Thanks!

That does the trick. I am glad to have this solution.
Thanks for the quick response!!

fano

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

Post by Narcís » Mon Jun 19, 2006 8:12 am

You're welcome fano.

I'm glad to hear that fits your needs.
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