Jump to content
Software FX Community

Adding Custom properties to the PointAttributes Class


Recommended Posts

If I were to subclass the PointAttibutes Class so I could add some custom

properties, is there a way to make the Chart class use

MySubClassPointAttibutes rather the SoftwareFx implementation?

My ultimate goal is to have an id's assoiated with each specific point.

When the user selects a point the id would be used to retrieve some data.

I guess I could use the tag property to hold my id, but I think a subclass

would be a cleaner implentation.

Any suggestions are appreciated.

Regards,

Chris

Link to post
Share on other sites

This is exactly the scenario we had in mind when we added the tag property,

it is typed object so that you can store any information about your point.

If you prefer to derive, note that the PointAttributesCollection indexer has

the following behavior.

1) You can assign a PointAttributes object (or a derived class since

PointAttributes is not sealed).

class MyPointAttributes : PointAttributes

{

}

MyPointAttribute m = new MyPointAttributes();

chart1.PointAttributes[3,4] = m;

2) If you use the getter and no point attributes has been assigned to this

point we automatically create a PointAttributes object. We have debated

internally whether our collections should behave like this or just return

null. This was designed so that an inexperienced (VB3) programmer could set

these properties without allocating objects. Any feedback on this would be

appreciated.

Now. If you derive from PointAttributes you may need to write some code to

support our persistence model, because of limitations on how the built-in

persistence model work in low trust scenarios. If your Windows Forms

scenario does not include saving a chart that includes your derived class

you do not need to worry.

--

Regards,

JC

Software FX Support

"Chris Voeller" <cvoeller@energyvelocity.com> wrote in message

news:tYwK6rC7DHA.2336@webserver3.softwarefx.com...

> If I were to subclass the PointAttibutes Class so I could add some custom

> properties, is there a way to make the Chart class use

> MySubClassPointAttibutes rather the SoftwareFx implementation?

>

> My ultimate goal is to have an id's assoiated with each specific point.

> When the user selects a point the id would be used to retrieve some data.

>

> I guess I could use the tag property to hold my id, but I think a subclass

> would be a cleaner implentation.

>

> Any suggestions are appreciated.

>

> Regards,

> Chris

>

>

>

>

Link to post
Share on other sites

Cool thanks! I overlooked the fact that the tag was of type object.

I'll provide some feedback on the "getter" functionality after I've played

around with it a bit.

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:uVk0o7C7DHA.2468@webserver3.softwarefx.com...

> This is exactly the scenario we had in mind when we added the tag

property,

> it is typed object so that you can store any information about your point.

>

> If you prefer to derive, note that the PointAttributesCollection indexer

has

> the following behavior.

>

> 1) You can assign a PointAttributes object (or a derived class since

> PointAttributes is not sealed).

>

> class MyPointAttributes : PointAttributes

> {

> }

>

> MyPointAttribute m = new MyPointAttributes();

> chart1.PointAttributes[3,4] = m;

>

> 2) If you use the getter and no point attributes has been assigned to this

> point we automatically create a PointAttributes object. We have debated

> internally whether our collections should behave like this or just return

> null. This was designed so that an inexperienced (VB3) programmer could

set

> these properties without allocating objects. Any feedback on this would be

> appreciated.

>

> Now. If you derive from PointAttributes you may need to write some code to

> support our persistence model, because of limitations on how the built-in

> persistence model work in low trust scenarios. If your Windows Forms

> scenario does not include saving a chart that includes your derived class

> you do not need to worry.

>

> --

> Regards,

>

> JC

> Software FX Support

> "Chris Voeller" <cvoeller@energyvelocity.com> wrote in message

> news:tYwK6rC7DHA.2336@webserver3.softwarefx.com...

> > If I were to subclass the PointAttibutes Class so I could add some

custom

> > properties, is there a way to make the Chart class use

> > MySubClassPointAttibutes rather the SoftwareFx implementation?

> >

> > My ultimate goal is to have an id's assoiated with each specific point.

> > When the user selects a point the id would be used to retrieve some

data.

> >

> > I guess I could use the tag property to hold my id, but I think a

subclass

> > would be a cleaner implentation.

> >

> > Any suggestions are appreciated.

> >

> > Regards,

> > Chris

> >

> >

> >

> >

>

>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...