This is a migrated thread and some comments may be shown as answers.

RadCartesianChart: Displaying of CartesianGridLineAnnotation

3 Answers 87 Views
Chart
This is a migrated thread and some comments may be shown as answers.
K.
Top achievements
Rank 1
K. asked on 24 Jul 2015, 02:09 PM

 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. 

 

 

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 28 Jul 2015, 10:30 AM
Hi,

Let me start with your last question - currently, the chart's Annotations collection cannot be data bound and the approach that you are using is the way to go. About the missing annotations, the code declaration seems correct, so I am afraid that without your implementation I cannot be sure what is causing this behavior. Can you please, send me a runnable code snippets or a project that demonstrates an isolated version of your implementation? This way I will be able to test it locally and investigate why the grid lines are missing. Thank you for the cooperation.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
K.
Top achievements
Rank 1
answered on 30 Jul 2015, 08:56 AM

Hello Martin

Thank you for trying to help, but creating an extra project didnt seem feasible since our project is highly complex.

However, I figured my problem out: it was a data-related problem.

In the future, will you add support for a collection of vertical lines (and horizontal lines aswell)? I think its not a too unusal use case :)

Best regards

Kosta

0
Martin Ivanov
Telerik team
answered on 31 Jul 2015, 06:33 AM
Hello Kosta,

I am glad to hear that you managed to resolve the issue. As for lines support you mentioned, actually we have a feature request logged in our feedback portal which concerns implementing annotations ItemsSource which once its implemented will be helpful for your case. If you follow the feedback item you will be notified as soon as there is any change in its status. 

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
K.
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
K.
Top achievements
Rank 1
Share this question
or