User (Legacy) Posted January 23, 2004 Report Share Posted January 23, 2004 I created a chart with annotation lines, arrows, and text grouped into annotation groups. There seem to be two problems. FIrst, when I zoom into a portion of the chart, the annotations extend beyond the chart borders (axis limits) on screen. Copying to the clipboard (using the toolbar) as a bitmap also shows the objects outside the chart borders Second, copying to the clipboard as an enhanced metafile includes the grouped annotation objects that lie outside the zoom plot area. Their full extent is included in the bounding area of the metafile, and I end up with objects off to the sides or top way outside the chart itself. Code to see these effects is listed below. It looks to me as if the annotation groups are being included in their entirety in the copy to clipboard operation, instead of being clipped at the chart zoom boundaries. If I don't group the annotation objects, the first effect still occurs: they overlap the axes' bounds upon zooming in. However, those that lie entirely outside the axes' bounds are not copied into the metafile any longer. Thanks for any feedback on how to get metafiles that reflect only what appears on the chart. -- John \=============================\ Imports softwareFX.ChartFX Imports SoftwareFX.ChartFX.Annotation Imports SoftwareFX.ChartFX.Data Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " ... #End Region Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load 'make a line Dim xvalues() As Double = {0, 1, 2, 3, 4, 5, 6} Dim yvalues() As Double = {0, 2, 4, 6, 8, 10, 12} Dim allvalues(1) As Object allvalues(0) = xvalues allvalues(1) = yvalues Chart1.Gallery = Gallery.Lines Chart1.DataSourceSettings.DataType(0) = DataType.XValue Chart1.DataSourceSettings.DataType(1) = DataType.Value Dim lstProvider As New ListProvider(allvalues) Chart1.DataSourceSettings.DataSource = lstProvider Dim group As New AnnotationGroup Dim annotx As New SoftwareFX.ChartFX.Annotation.AnnotationX Chart1.Extensions.Add(annotx) annotx.List.Add(group) Dim circle As New AnnotationCircle circle.Color = Color.Blue circle.Height = 30 circle.Width = 30 circle.Attach(5, 3) group.List.Add(circle) circle.Refresh() Dim balloon As New AnnotationBalloon balloon.Text = "a balloon" balloon.TailCorner = 1 balloon.ArrowFactor = 10 balloon.Border.Color = System.Drawing.Color.Black balloon.Color = System.Drawing.Color.Gold balloon.SizeToFit() balloon.Attach(2, 3) group.List.Add(balloon) balloon.Refresh() Dim text As New AnnotationText text.Text = "Some text" text.TextColor = System.Drawing.Color.Blue text.Color = System.Drawing.Color.Transparent text.Border.Color = System.Drawing.Color.Transparent text.SizeToFit() text.Attach(2, 5) group.List.Add(text) text.Refresh() Dim arrow As New AnnotationArrow arrow.Color = System.Drawing.Color.Salmon arrow.Height = 30 arrow.Width = 30 arrow.Attach(4, 8) arrow.Border.Color = System.Drawing.Color.Red group.List.Add(arrow) group.RecalcBounds() Chart1.Refresh() End Sub End Class Link to comment Share on other sites More sharing options...
Software FX Posted January 23, 2004 Report Share Posted January 23, 2004 1) in Chart FX 6.2 the Annotation object have a property called DrawingArea. When set to true, they will be clipped to the chart's drawing area (between the axes) 2) If the objects are properly attached, they will be moved/resized accordingly when you zoom-in or out. When this is combined with the DrawingArea property, they will also be restricted to the chart's drawing area. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted January 26, 2004 Author Report Share Posted January 26, 2004 Yes, the DrawingArea property has the desired effect on individual objects. However, when the drawing objects are added to a annotationx group.list, their individual DrawingArea vales are ignored, so that the original problem with the metafile occurs. Also, if I set the group.DrawingArea property to True, the entire group is neither displayed nor copied to the metafile at all, regardless of the zoom setting. The objects in the group all lie well within the chart boundaries. Checking the boundaries of the group that results from the code in the previous method, the group.left property is -37: does this then cause the group not to display? I'm using annotation groups to allow the user to show/hide the annotations by category as the chart is too complex with all the annotations displayed. I'm going to code the effect I want instead of using the built-in groups, unless there's a simple answer to this one. -- John "SoftwareFX Support" <support@softwarefx.com> wrote in message news:JVaX$Hf4DHA.2336@webserver3.softwarefx.com... > 1) in Chart FX 6.2 the Annotation object have a property called DrawingArea. > When set to true, they will be clipped to the chart's drawing area (between > the axes) > > 2) If the objects are properly attached, they will be moved/resized > accordingly when you zoom-in or out. When this is combined with the > DrawingArea property, they will also be restricted to the chart's drawing > area. > > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
Software FX Posted January 26, 2004 Report Share Posted January 26, 2004 Did you try setting DrawingArea to true to the Group object itself ? -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted January 26, 2004 Author Report Share Posted January 26, 2004 Yes, that's what I did. If group.DrawingArea == True then nothing in the group is displayed or copied to the metafile. If group.DrawingArea == False then the group is displayed and the objects in group.list behave as if each obj.DrawingArea = False. This is with the objects in the supplied code. -- John "SoftwareFX Support" <support@softwarefx.com> wrote in message news:baLafFE5DHA.2468@webserver3.softwarefx.com... > Did you try setting DrawingArea to true to the Group object itself ? > > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
Software FX Posted January 30, 2004 Report Share Posted January 30, 2004 Ok. The problem here seems to be the following: A group with attached objects inside is not able to correctly calculate its bounds. I will check to see whether or not this can be changed. I suggest the following workaround: 1) Call RecalcBounds after the objects have been drawn. This way, the logical position have already been translated to physical positions. 2) Do not use groups to group attached objects. -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted January 30, 2004 Author Report Share Posted January 30, 2004 Thanks for the suggestions. I added several annotx lists to the chart extensions, and used the individual annotx lists to hold the individual graphic items. Then, I traverse each list as required and enable or disable each item's visibility. The group route would be easier, but this is working fine now. -- John "SoftwareFX Support" <noreply@softwarefx.com> wrote in message news:WU4SAb25DHA.2468@webserver3.softwarefx.com... > Ok. > > The problem here seems to be the following: > > A group with attached objects inside is not able to correctly calculate its > bounds. > > I will check to see whether or not this can be changed. I suggest the > following workaround: > > 1) Call RecalcBounds after the objects have been drawn. This way, the > logical position have already been translated to physical positions. > > 2) Do not use groups to group attached objects. > > -- > 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.