How to handle marks outside and change of series type

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
tomster
Newbie
Newbie
Posts: 20
Joined: Tue Aug 02, 2005 4:00 am
Location: Stockholm, Sweden

How to handle marks outside and change of series type

Post by tomster » Thu Oct 27, 2005 1:53 pm

I have the problem with marks for a series being displayed outside of the axis on bar series. I found this workaround:

Code: Select all

private void line1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
    {
      if ((series.XValues[e.ValueIndex]<tChart1.Axes.Bottom.Minimum) ||
          (series.XValues[e.ValueIndex]>tChart1.Axes.Bottom.Maximum))
        e.MarkText="";
    }
which works fine...

...except for when the user opens the chart editor and changes the type of series - since he actually replaces the existing series with a new one, that new one doesn't have the event wired up.

Do you have any idea how to accomplish this? One way would be to perhaps catch the CloseEditor event on the editor and loop through all the series in the chart and check if they have that event handler assigned - but you can't check for that, you can only assign or remove eventhandlers. So how do I accomplish this. I don't just want to add more new event handlers to each series, that could potentially lead to the handler being called ridicuosly many times - or am I misunderstanding that?

Any suggestions?

//Tommie

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 Oct 28, 2005 1:32 pm

Hi Tommie,

You could just reassign the event handler to the "new" series after changing the original type:

Code: Select all

tChart1[0].GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(this.line1_GetSeriesMark);
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

tomster
Newbie
Newbie
Posts: 20
Joined: Tue Aug 02, 2005 4:00 am
Location: Stockholm, Sweden

Post by tomster » Mon Oct 31, 2005 11:24 am

But is there a way to identify the new series if for instance the user has changed the type from the Chart Editor?

The problem, as I see it, is that I can have n number of series and the user might change the typ of one of them, n2 for instance. If I loop through all the series I will add event handlers more than once on every series but n2 which just will have it assigned.

Other than that, it seems to work fine.

//Tommie

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 Nov 02, 2005 12:29 pm

Hi Tommie,

Why don't you try using bar1.Marks.Clip = true; ? What, exactly, is the problem with the clipping of the marks in a bar series? Can you send an example we can run "as-is" or some code so that we can reproduce the problem here?

You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
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

tomster
Newbie
Newbie
Posts: 20
Joined: Tue Aug 02, 2005 4:00 am
Location: Stockholm, Sweden

Post by tomster » Thu Nov 03, 2005 9:07 am

Marks.Clip = true could be sufficient but I still have the problem with changing the series type with that strategy, don't I? Or are all properties transferred when a series type is changed? Event handlers are not, as far as I can tell.

My problem is this: The user can choose what column from a dataset to add to the chart at any time. He then has to be able to change the type of chart series on the fly as well, say from the default fastline (which gives us great performance even with 100 000+ points by the way) to a bar. When doing that change the series is replaced with a new instance, losing the event handlers, but if the clip property is kept, that will be fine - I will test this now.

Cheers,
Tommie

Post Reply