This is currently my code:
private void AddEventTimeOverlay()
{
ValueOverlay overlay = new ValueOverlay();
CategoryDateTimeXAxis xaxis = (CategoryDateTimeXAxis)MChart.Axes.First((axis) => axis.Name.Equals("SharedXAxis"));
overlay.Axis = xaxis;
double scaledx = xaxis.GetScaledValue(eventTime.Ticks, MChart.WindowRect, GetViewportRect(xaxis));
overlay.Name = "EventTimeOverlay";
overlay.Value = scaledx;
overlay.Thickness = 2;
overlay.Brush = new SolidColorBrush(Colors.Magenta);
//overlay.Axis = (NumericYAxis)MChart.Axes.First((axis) => axis.Name.Equals("SharedYAxis"));
//overlay.Value = 0.21;
//overlay.Thickness = 2;
//overlay.Brush = new SolidColorBrush(Colors.Purple);
MChart.Series.Add(overlay);
}
private Rect GetViewportRect(Axis axis)
double top = 0;
double bottom = axis.ActualHeight;
double left = 0;
double right = axis.ActualWidth;
double width = right - left;
double height = bottom - top;
if (width > 0.0 && height > 0.0)
return new Rect(left, top, width, height);
return Rect.Empty;
For some reason, no overlay is showing up for me. I'm not sure if the problem is the DateTime to Double value conversion, or if there's something else going on. When I try to display a horizontal valueOverlay, it shows up fine (I tested using the code that is commented out).
Suggestions?
Hello,
Thank you for your post. I have been looking into it and I can say that the ValueOverlay can be used only with NumericXAxis, NumerixYAxis, NumericAngleAxis and NumericRadiusAxis. Here you can read more about this:
http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=xamDataChart_Series_Value_Overlay.html
Also you can see this forum thread:
http://forums.infragistics.com/forums/p/70620/357469.aspx#
Where it is explained how to achieve the same functionality on other types of Axes.
Are there any updates regarding this issue?
We are currently using the method suggested in the post (Drawing a Rectangle everytime a size_changed event was raised)
and we believe it has a lot of overhead.
Do you think you will be able to add this to the built in functionality of ValueOverlay?
(Drawing a rectangle on XDateTime axis)?
Thank you in advanced,
Guy.