CartesianCustomAnnotation with Zoom ability

7 posts, 0 answers
  1. Majid
    Majid avatar
    6 posts
    Member since:
    Jan 2014

    Posted 06 Jan 2014 Link to this post

    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 >
    then I programmatically added a triangle as CartesianCustomAnnotation
    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
                } );
    As the below figure shows, the problem is  when I changed the chart's zoom, the shape size does not change, actually I want the vertexes of triangles sticks to their initial coordinates, and triangle resize itself with changing zoom.

  2. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 07 Jan 2014 Link to this post

    Hello,

    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
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Majid
    Majid avatar
    6 posts
    Member since:
    Jan 2014

    Posted 07 Jan 2014 Link to this post

    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?







  5. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 08 Jan 2014 Link to this post

    Hi,

    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
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    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 >>
  6. Majid
    Majid avatar
    6 posts
    Member since:
    Jan 2014

    Posted 21 Jan 2014 Link to this post

    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>


  7. Majid
    Majid avatar
    6 posts
    Member since:
    Jan 2014

    Posted 21 Jan 2014 Link to this post

    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 chartIs there a way to force DateTimeContinuousAxis to don't show these days where does not include any useable data?



  8. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 23 Jan 2014 Link to this post

    Hi,

    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);

    }
    and set its value there.

    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
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready