Would like to place a vertical line at a certain datetime value against the CategoryDateTimeXAxis
So far no luck...
GetScaledValue does not return anything reasonable
Xaml:
<ig:ValueOverlay Axis="{Binding ElementName=xmXAxis}" Thickness="1" Brush="Red">
<ig:ValueOverlay.Value>
<MultiBinding Converter="{StaticResource DateTimeConverter}">
<Binding Path="DateValue"/>
<Binding ElementName="xmXAxis"/>
MultiBinding>
ig:ValueOverlay.Value>
ig:ValueOverlay>
Codebehind
public class DateTimeConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
if (values[0] != null && values[0] is DateTime)
var axis = values[1] as CategoryDateTimeXAxis;
if (axis != null)
//return ((DateTime)values[0]).Ticks;
var chart = axis.SeriesViewer;
return axis.GetScaledValue(((DateTime)values[0]).Ticks, chart.WindowRect, chart.ViewportRect);
}
return null;
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
throw new NotImplementedException();
Thanks
Good morning,
To give you some background, we've created a generic charting engine where the user can configure a chart according to given raw underlying data and metadata.
We've been using the posted example of DateTimeValueOverlay on top of CategoryDateTimeXAxis successfully for quite a while now.
Due to the CategoryDateTimeXAxis's inability to stack multiple column series next to instead of behind each other, we've recently had to change CategoryDateTimeXAxis to CategoryXAxis. This has broken the DateTimeValueOverlay in that the Axis.GetScaledValue returns a huge number when used with the date value's ticks property. Is there an elegant solution to be able to either fix the CategoryDateTimeXaxis multiple series issue, or the DateTimeValueOverlay?
I attach an edited version of your own DateTimeValueOverlay example.
Thanks!
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
I found this yesterday afternoon and it works.
http://ko.infragistics.com/community/forums/p/75441/381189.aspx
Thank you for your post. I have been looking into and I can suggest you use the CategoryDateTimeXAxis’ GetUnscaledValue instead of the GetScaledValue method. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.