Zooming trouble

7 posts, 0 answers
  1. Nikolai
    Nikolai avatar
    13 posts
    Member since:
    Oct 2010

    Posted 17 Nov 2014 Link to this post

    Hi, there is a problem with DateTimeContinuousAxis zoom. When I load two years of data, templateselector shows labels in format dd.MM - it's OK, but when i try to load more data,  meaning that template will be 'yyyy',

    -the templateselector works only on new Data, previous datarange does not catches by templateselector in debugger;
    -ActualVisibleRange and ActualRange are like with previous dataset - only two years.

    this code worked perfect before last update to latest UI for Silverlight Q3

    thanks
  2. Nikolai
    Nikolai avatar
    13 posts
    Member since:
    Oct 2010

    Posted 18 Nov 2014 Link to this post

    There is something wrong with ActualVisibleRange

    In LabelTemplateSelector, i try to get visible range, but get minDate for both Minimum and Maximum
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
     var axis = container as DateTimeContinuousAxis;
    var
    span =
    ((((Telerik.Windows.Controls.RadCartesianChart)(axis.Chart)).HorizontalAxis
    as DateTimeContinuousAxis).ActualVisibleRange.Maximum -
    (((Telerik.Windows.Controls.RadCartesianChart)(axis.Chart)).HorizontalAxis
    as DateTimeContinuousAxis).ActualVisibleRange.Minimum);
                       
    var minYear =
    (((Telerik.Windows.Controls.RadCartesianChart)(axis.Chart)).HorizontalAxis
    as DateTimeContinuousAxis).ActualRange.Minimum.Year;
                       
    var maxYear =
    (((Telerik.Windows.Controls.RadCartesianChart)(axis.Chart)).HorizontalAxis
    as DateTimeContinuousAxis).ActualRange.Maximum.Year;
    }
  3. DevCraft banner
  4. Nikolai
    Nikolai avatar
    13 posts
    Member since:
    Oct 2010

    Posted 18 Nov 2014 Link to this post

    Here is a sample demonstrating wrong ActualRange behaviour
  5. Nikolai
    Nikolai avatar
    13 posts
    Member since:
    Oct 2010

    Posted 18 Nov 2014 Link to this post

    I think i know what is happened: templateselector works before the ActualVisibleRange event is catched. How can i solve this problem?
  6. Nikolai
    Nikolai avatar
    13 posts
    Member since:
    Oct 2010

    Posted 18 Nov 2014 Link to this post

    UI for Silverlight Q3 2013 (October 16, 2013) works great, the last gets some errors
  7. Nikolai
    Nikolai avatar
    13 posts
    Member since:
    Oct 2010

    Posted 18 Nov 2014 Link to this post

    When i change DataSource, LabelTemplateSelector does not update labels calling its SelectTemplate method. Works only for additional points, when dates range expanding
  8. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 20 Nov 2014 Link to this post

    Hi Nikolai,

    Your questions was answered in the support ticket related to the same behavior that you post in our ticketing system. However, I will paste the answer in this forum so that it can be available for the rest of our community.

    As a side note, please try to keep the communication on a single thread. This will help us to organize our history and assist to our customers better.

    "What you are describing sounds like a result of a fix we made some time ago. The behavior you observe is actually expected.

    The axis keeps a collection of cached labels (content and template). So when an old content is present - the template is not reevaluated.  When a new value appears - the template selector is called to get a template, and the new value-template pair is cached. Previously the template selector was used too often, every time the chart was resized, panned and zoomed. I hope you understand that this is a very nice improvement we made. 

    If you need new templates for the new zoom level you have (or data range) - you should set a new LabelTemplateSelector whenever you need a different template. Note, you should only change the LabelTemplateSelector when you require new templates, otherwise if you change the template selector too often - the optimizations in the axis will not work."


    Regards,
    Martin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner