Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
ValueOverlay Thickness when Zooming
posted

I'm adding multiple ValueOverlays to the xamDataChart via Code Behind based on the DataContext (VM). If I zoom in to the ValueOverlays they seem to plot perfectly. When I am zoomed completely out the Overlays overlap because Thickness is not scaling correctly. The code snippet below shows what I'm trying to accomplish; I am trying to plot a Depth Zone over a Scatter Line Series. I use the average as the Value Property (middle) and the difference as the Thickness Property.

ValueOverlay overlay = new ValueOverlay();

Binding binding = new Binding("Description");
binding.Source = zone;
binding.Converter = new ZoneTitleConverter();
BindingOperations.SetBinding(overlay, Series.TitleProperty, binding);                   
overlay.Axis = LineYAxis;
overlay.ToolTip = string.Format("Zone from {0} to {1}", zone.DepthTop, zone.DepthBottom);

MultiBinding multibinding1 = new MultiBinding();
multibinding1.Converter = new AverageConverter();
multibinding1.Bindings.Add(new Binding("DepthTop") { Source = zone });
multibinding1.Bindings.Add(new Binding("DepthBottom") { Source = zone });
BindingOperations.SetBinding(overlay, ValueOverlay.ValueProperty, multibinding1);

MultiBinding multibinding2 = new MultiBinding();
multibinding2.Converter = new DifferenceConverter();
multibinding2.Bindings.Add(new Binding("DepthTop") { Source = zone });
multibinding2.Bindings.Add(new Binding("DepthBottom") { Source = zone });
BindingOperations.SetBinding(overlay, Series.ThicknessProperty, multibinding2);

Chart.Series.Add(overlay);

Parents Reply Children
No Data