I
have a problem with CartesianCustomAnnotation. there is a RadCartesianChart with zoom ability,
<
telerik:RadCartesianChart
x:Name
=
"chart"
Zoom
=
"{Binding Zoom, Mode=TwoWay}"
>
<
telerik:RadCartesianChart.Behaviors
>
<
telerik:ChartPanAndZoomBehavior
ZoomMode
=
"Both"
PanMode
=
"Horizontal"
MouseWheelMode
=
"Zoom"
/>
</
telerik:RadCartesianChart.Behaviors
>
<!--some codes-->
</<
telerik:RadCartesianChart
>
System.Windows.Shapes.Polygon triangle =
new
Polygon();
//some codes
chart.Annotations.Add(
new
Telerik.Windows.Controls.ChartView.CartesianCustomAnnotation
{ HorizontalValue = somePointX,
//DateTime
VerticalValue=.somePointY,
Content = triangle
} );
6 Answers, 1 is accepted
The annotation is a visual element positioned on the chart plot area. The Cartesian Custom Annotation renders its Content starting at the specified (HorizontalValue, VerticalValue) position. It cannot change its size according to the area you have zoomed. This behavior of the annotation is not supported out of the box. It will always have the size that is initially set. You will need to calculate the size of your annotation element depending on your calculations and the way it best works for you.
Regards,
Peshito
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

I used chartZoomChanged event and now the shape can resize itself, thanks. But now I encounter another weird problem. sometimes after panning, such that part of certain annotations gone out of box, suddenly some of the annotations disappeared while half of it should be visible, (take a look the following image) and when I panned back the annotations appear again. is there a bug related to annotations?
This does not seem like a bug. The custom annotation is a singular point representation which will change its place on the plot area depending on the panning you have performed. This is why this annotation is not positioned next to the other. The plot area has changed as well as the annotation's place on the plot area.
Regards,
Peshito
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

My problem relating to sunndenly disappearing
CustomAnnotaion doesn't solve. moreover, I encounter the problem in some new cases. when I pan through horizontal axis, and stop in certain points, the whole of customAnnotaion disappears,while the whole shape is in view box and should be visible, What shoud I do? I used
DateTimeCategoricalAxis, may be the problem is related to horizontal axis.
<
chart:RadCartesianChart.HorizontalAxis
>
<
chartView:DateTimeCategoricalAxis
PlotMode
=
"OnTicksPadded"
GapLength
=
"0.4"
LabelTemplate
=
"{StaticResource axisLabelTemplate}"
DateTimeComponent
=
"Date"
MajorTickInterval
=
"15"
>
<
telerik:CategoricalAxis.MajorTickStyle
>
<
Style
TargetType
=
"Rectangle"
>
<
Setter
Property
=
"Fill"
Value
=
"Orange"
/>
</
Style
>
</
telerik:CategoricalAxis.MajorTickStyle
>
</
chartView:DateTimeCategoricalAxis
>
</
chart:RadCartesianChart.HorizontalAxis
>

I found some issues,:
First of all, when I replace DateTimeContinuousAxis to DateTimeCategoricalAxis, the occurrences of Annotation's disappearing, due to panning, reduced, actually only when the point where annotation sticks to (HorizontalValue, VerticalValue) go out of the view box such action happens. I guess in this situation, some behind codes changes the visibility of annotation to collapsed, is there any way to disable this action?
second: In the horizontal axis I have data include 4 days of week, when I use DateTimeContinuousAxis instead of DateTimeCategoricalAxis, a gap appears on the chart. Is there a way to force DateTimeContinuousAxis to don't show these days where does not include any useable data?
When using DateTimeCategorical axis along with annotations you need to be sure that the value of the annotation match the exact same category value used for creating the chart. To solve this, you can attach for the Loaded annotation's event like shown below:
private void customAnnotation_Loaded(object sender, RoutedEventArgs e)
{
var customAnnotation = sender as Telerik.Windows.Controls.ChartView.CartesianCustomAnnotation;
customAnnotation.HorizontalValue = new DateTime(2013, 11, 12, 04, 30, 00);
}
Onto your other issue, the DateTimeContinuous axis is like a numerical axis but the axis value range consists of DateTime values which are always sorted chronologically. You can use use MajorStepUnit and MajorStep properties to further customize it.
Regards,
Peshito
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>