User (Legacy) Posted July 23, 2004 Report Share Posted July 23, 2004 Annotations do not display correctly when the XAxis is inverted. For example, I have an arrow pointing from 4,10 to 2,6. When I invert the X Axis, the arrow now points from 2,4 to 4,6. The balloons and other assymetrical objects exhibit similar problems. Link to comment Share on other sites More sharing options...
Software FX Posted July 23, 2004 Report Share Posted July 23, 2004 Is the arrow attached to both ends (Attach Method) ? If not, the axis setting will not affect the annotation object. I tried with an attached object and Inverted axis and everything worked fine. -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted July 23, 2004 Author Report Share Posted July 23, 2004 I am drawing the arrow using the Annotation toolbar. It appears to be attached but confused about the endpoints. Link to comment Share on other sites More sharing options...
Software FX Posted July 26, 2004 Report Share Posted July 26, 2004 The default attachment for annotation objects created from the toolbar is to the center. This means the center of the rectangle surrounding the object will remain at the same logical position when the chart scales changes (e.g. the chart is resized). You can process the ObjectCreated event if you want to change this behavior, for example attach BOTH ends of the arrow to logical positions. I do not see any difference in behavior when using inverted axis. -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted July 27, 2004 Author Report Share Posted July 27, 2004 It seems like the default attach mode for assymetrical object would be at the ends and not in the center. In any case, I am able to change to attach points in the ObjectCreate event. When processing an arrow, how do I determine where the arrow starts and where it ends? The dimensions I see are based on the object bounds - left, top, height and width. Link to comment Share on other sites More sharing options...
Software FX Posted July 27, 2004 Report Share Posted July 27, 2004 Easy, You can convert Pixel Coordinates to Axis Coordinates using the PixelToValue method in the Axis object. For example: double dx1 = chart1.AxisX.PixelToValue(e.Object.Left); double dy1 = chart1.AxisY.PixelToValue(e.Object.Top); double dx2 = chart1.AxisX.PixelToValue(e.Object.Left+e.Object.Width); double dy2 = chart1.AxisY.PixelToValue(e.Object.Top+e.Object.Height); e.Object.Attach(dx1,dy1,dx2,dy2); -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted July 27, 2004 Author Report Share Posted July 27, 2004 Yes, but the problem is trying to figure out which end of the line has the arrowhead, ie. Top, Left, Width and Height give the bounds but not the start and end points. When I use this method, the arrowhead always ends up to the right no matter which way I drag on the canvas. I ended up using the MouseDown and MouseUp events to capture the actual start and end points: double left = this.AxisX.PixelToValue(mouseDown.X); double right = this.AxisX.PixelToValue(mouseUp.X); double top = this.AxisY.PixelToValue(mouseDown.Y); double bottom = this.AxisY.PixelToValue(mouseUp.Y); e.Object.Attach(left,top,right,bottom); It seems to me the information should be available from the object properties. Link to comment Share on other sites More sharing options...
User (Legacy) Posted July 28, 2004 Author Report Share Posted July 28, 2004 Yes, but this does not necessarily preserve the direction of the arrow. It always ends up going from left to right no matter how you drag the mouse. Are the start and end points available from the object? As a workaround, I used the mouse down and mouse up events to record the start and end points. Link to comment Share on other sites More sharing options...
Software FX Posted July 29, 2004 Report Share Posted July 29, 2004 The following code preserves the direction: Rectangle r = e.Object.ObjectBounds; double dx1 = chart1.AxisX.PixelToValue(r.Left); double dy1 = chart1.AxisY.PixelToValue(r.Top); double dx2 = chart1.AxisX.PixelToValue(r.Right); double dy2 = chart1.AxisY.PixelToValue(r.Bottom); e.Object.Attach(dx1,dy1,dx2,dy2); -- FP Software FX Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.