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

Annotations visibility

5 Answers 148 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Jean-Pierre
Top achievements
Rank 1
Jean-Pierre asked on 10 Jan 2013, 04:52 PM
Hi,

I would like to bind the visibility property of an annotaiton to a property of my DataContext binded to a checkbox.
It seems that setting the Visibility property of an annotation has no effects.
Is it a bug ? Do i need to remove it from annotation's collection and reinsert it ?

Regards.

5 Answers, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 15 Jan 2013, 04:27 PM
Hi Jean-Pierre,

Due to the specifics of the RadChartView, you need to use TwoWay binding for the Visiblity properties of the annotations. I have attached a sample project demonstrating that. In it I directly bind the Visibility of the annotations to the IsChecked property of the CheckBoxes (without having properties in the ViewModel).

I hope this helps.
 
Regards,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jean-Pierre
Top achievements
Rank 1
answered on 15 Jan 2013, 04:43 PM
Hi

Thanks for the reply and the sample.
Indeed, it seems to work but there is still an issue;
Try uncheck all the radiobutton and resize the window.
All annotations become visible again. At least in my version (2012.3.1017.40)

Regards
0
Dana
Top achievements
Rank 1
answered on 17 Jan 2013, 03:11 PM
I can confirm that this is indeed the case.
I had already bound a number of annotations to a checkbox in the manner suggested.

However, it appears that anything that causes the chart to re-render will make the annotations visible again.
[window resize, changing the zoom of the chart]

I can also confirm that setting the visibility of an annotation explicitly in markup to 'Hidden' of 'Collapse' has no effect.
0
Accepted
Petar Kirov
Telerik team
answered on 18 Jan 2013, 12:13 PM
Hi,

Excuse me for not seeing this earlier.

I believe that the cause of the problem is that the RadChartView internally sets the visibility of its visual elements in code. If an element is outside of the visible plot area its visibility is set to collapsed, and if it is in range its visibility is set to visible. This occurs when something causes the chart layout to be updated. 

The solution to this is to use the opacity property, instead of the visibility. I have attached a modified version of the previous project to demonstrate this.

Regards,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jean-Pierre
Top achievements
Rank 1
answered on 21 Jan 2013, 07:59 AM
That should do the trick !

Thanks.
Tags
ChartView
Asked by
Jean-Pierre
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Jean-Pierre
Top achievements
Rank 1
Dana
Top achievements
Rank 1
Share this question
or