Jump to content
Software FX Community

Map style Zoom causes exception when chart contains Annotation


Recommended Posts

I have version 8.0.3629.29517.

When I try to zoom a chart with Zoom.Style set to Map and my chart contains an Annotation I get an exception.  Here is an example.  Double-click the chart to enter zoom selection mode.

With this object defined...private class DateValue{   public DateTime Date { get; set; }   public double Value { get; set; }   public DateValue(DateTime date, double value)   {   Date = date;   Value = value;   }}This recreates the problem...Chart chart1 = new Chart();chart1.Width = 1024.0;chart1.Height = 768.0;chart1.LegendBox.Visibility = Visibility.Collapsed;Random rnd = new Random(123);List<DateValue> list1 = new List<DateValue>();for (int i = 0; i < 100; i++){   list1.Add(new DateValue(DateTime.Today.AddYears(-2).AddDays(i * 7), (double)rnd.Next(0, 200)));}Axis axisX = new Axis();Axis axisY = new Axis();axisX.DataFormat.Format = AxisFormat.Date;axisX.Labels.HorizontalAlignment = HorizontalAlignment.Right;axisX.Labels.Position = AxisLabelPosition.Center;axisX.Labels.Format = AxisFormat.Date;axisX.Min = DateTime.Today.AddYears(-2);axisX.Max = DateTime.Today;axisX.FontSize = 14;axisX.Title.Content = "Test";axisX.Title.FontSize = 14.0;axisY.Min = 0.0;axisY.Max = 200.0;axisY.AxisStyle = AxisStyles.ShowEnds | AxisStyles.AutoFirstLabel;axisY.Labels.Decimals = 1;chart1.AxesX.Clear();chart1.AxesY.Clear();chart1.AxesX.Add(axisX);chart1.AxesY.Add(axisY);SeriesAttributes sa = new SeriesAttributes();sa.Gallery = chart1.Gallery = Gallery.Line;sa.ItemsSource = list1;sa.BindingPath = "Value";sa.BindingPathX = "Date";sa.Content = "Test";sa.AxisX = axisX;sa.AxisY = axisY;chart1.Series.Add(sa);chart1.MouseDoubleClick += delegate{   chart1.Zoom.Style = ZoomStyle.Map;   chart1.Zoom.Mode = ZoomMode.Selection;};Annotations anno = new Annotations();TextBlock tb = new TextBlock();tb.Text = "Test";tb.HorizontalAlignment = HorizontalAlignment.Left;tb.VerticalAlignment = VerticalAlignment.Bottom;tb.FontSize = 20.0;Annotations.SetAttachX(tb, axisX.Min);Annotations.SetAttachY(tb, axisY.Min);Annotations.SetAxisX(tb, axisX);Annotations.SetAxisY(tb, axisY);anno.Children.Add(tb);chart1.Extensions.Add(anno);

Link to comment
Share on other sites

  • 3 months later...

This issue will be fixed on build 3784 or later which should be available in a day or two. Please note that the annotations will show on the zoomed area but not the map, this is similar to our current behavior when using zoom stripe. To show it in both would require cloning all the annotation objects which might not be always possible.

I apologize for our delay fixing this issue, even though the original posting was done on January, this issue was never added to our bug database so we were not actively working on it.


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.

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.

  • Create New...