Page 1 of 1

Old problem with 'text' for point series Marks.

Posted: Thu Jun 15, 2006 11:24 pm
by 9637279
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

Posted: Fri Jun 16, 2006 9:17 am
by narcis
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).

not quite fixed...

Posted: Fri Jun 16, 2006 2:55 pm
by 9637279
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

Posted: Fri Jun 16, 2006 3:00 pm
by narcis
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;

That works! Thanks.

Posted: Fri Jun 16, 2006 4:46 pm
by 9637279
Thanks!

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

fano

Posted: Mon Jun 19, 2006 8:12 am
by narcis
You're welcome fano.

I'm glad to hear that fits your needs.