kelias Posted March 31, 2009 Report Share Posted March 31, 2009 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? Quote Link to comment Share on other sites More sharing options...
JuanC Posted April 1, 2009 Report Share Posted April 1, 2009 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 Quote Link to comment Share on other sites More sharing options...
kelias Posted April 2, 2009 Author Report Share Posted April 2, 2009 <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> Quote Link to comment Share on other sites More sharing options...
JuanC Posted April 2, 2009 Report Share Posted April 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.