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);
Hello,
Thank you for your post. I have been looking into the functionality that you are trying to achieve and what I can suggest is binding the Thickness to the WindowRect of the XamDataChart. When you zoom in and out, the WindowRect property of the XamDataChart is updated and you can use it to see the level of the zoom. You can use the Height property of the WindowRecr to get the vertical zoom. The value of the Height is between 0 and 1 and shows the vertical zoom level. Since you are using a MultiBindig, you can add another Binding for the WindowRect property of the XamDataChart, to the Bindings property of the MultiBinding. I have created sample application for you, that shows how you can bind the Thickness to the XamDataChart’s WindowRect.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thanks Krasimir, your guidance led me to the answer. Thanks so much for your help!
I ended up making a MultiValueConverter with five properties;
1. Depth Top2. Depth Bottom3. ActualWindowScaleVertical (XamDataChart)4. ActualMaximumValue (NumericYAxis) 5. ActualHeight (NumericYAxis)
The issue I was having trouble understanding was that it was all a function of the XamDataChart Height and the height the overlays were to consume after zooming.
The converters final equation, after validation, is shown below;
double thickness = (Math.Abs(depthTop - depthBottom)/actualMaximumValueOnAxis)*actualHeightInPixels*(1/actualWindowScaleVertical);