Jump to content
Software FX Community

Movable Series?


kelias
 Share

Recommended Posts

The users of my charting application have asked for the ability to do basic trend-lines. They need horizontal trend lines. I can add a series to mimic a trend-line but I'm not sure if it's possible to let them move the series through a drag like operation. Any ideas if this is possible?

Link to comment
Share on other sites

I would suggest that instead of series you consider using Annotation objects to implement your trend lines. This will also allow you to implement drag&drop as you can attach easily to Mouse events on any visuals you add as anotations.

Regards,

JuanC

Link to comment
Share on other sites

<p> 

Do you have an example of using Annotations in the code behind? I haven't been able to find one. I'm trying this but it's not working.

 </p>

<pre>

Rectangle r = new Rectangle();r.Width = 80;

r.Height = 20;

r.Fill = new SolidColorBrush(Colors.Blue);

 

Annotations an = new Annotations();

an.Children.Add®;

Annotations.SetAttachX(r, 10);Annotations.SetAttachY(r, 10);

chart1.Extensions.Add(an);

</pre>

Link to comment
Share on other sites

Your code works but the AttachX and AttachY use "logical" axis values and not pixels. This means that if you do SetAttachX(r, 10), your rectangle will only be visible if you have more than 10 data items in your chart. If your chart is an XY chart then it will be visible if value 10 is visible in your X axis.

The same applies for AttachY if your Y axis goes from 0 to 5 then the rectangle will be clipped.

JuanC

Link to comment
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.

 Share

×
×
  • Create New...