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
Old problem with 'text' for point series Marks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi fano,
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.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;
}
}
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");
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).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?
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 |
not quite fixed...
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
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
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi fano,
Yes, you can tell the axis to keep the x values in the labels using:
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 |
Instructions - How to post in this forum |
That works! Thanks.
Thanks!
That does the trick. I am glad to have this solution.
Thanks for the quick response!!
fano
That does the trick. I am glad to have this solution.
Thanks for the quick response!!
fano
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
You're welcome fano.
I'm glad to hear that fits your needs.
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 |
Instructions - How to post in this forum |