In our project we are using the RadCartesianChart and we want to (dynamically) display some vertical lines.
For this we have code like the following in place:
var collection = GetSomeFilteredData();
foreach (var dateTime in collection)
{
var cartesianGridLineAnnotation = new CartesianGridLineAnnotation
{
ZIndex = -100,
Value = dateTime,
Stroke = new SolidColorBrush(Colors.Black),
StrokeThickness = 1,
Axis = this.HorizontalAxis
};
this.ChartControl.Annotations.Add(cartesianGridLineAnnotation);
}
When debugging I can verify that the data is loaded and added to the ChartControl.Annotations collection. But it doesn't display.
Other than that, everything works fine (e.g. display of static horizontal lines as declared in xaml, which are also in the Annotations collection).
Any idea what I am missing here?
Also, is there a "better" way of achieving our goal? I would like it if I could just bind a collection in the ViewModel to a property of the chart.
Thanks in advance for any help.