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

Zooming trouble

6 Answers 43 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Nikolai
Top achievements
Rank 1
Nikolai asked on 17 Nov 2014, 04:02 PM
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

6 Answers, 1 is accepted

Sort by
0
Nikolai
Top achievements
Rank 1
answered on 18 Nov 2014, 07:35 AM
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;
}
0
Nikolai
Top achievements
Rank 1
answered on 18 Nov 2014, 08:37 AM
Here is a sample demonstrating wrong ActualRange behaviour
0
Nikolai
Top achievements
Rank 1
answered on 18 Nov 2014, 08:46 AM
I think i know what is happened: templateselector works before the ActualVisibleRange event is catched. How can i solve this problem?
0
Nikolai
Top achievements
Rank 1
answered on 18 Nov 2014, 09:49 AM
UI for Silverlight Q3 2013 (October 16, 2013) works great, the last gets some errors
0
Nikolai
Top achievements
Rank 1
answered on 18 Nov 2014, 10:17 AM
When i change DataSource, LabelTemplateSelector does not update labels calling its SelectTemplate method. Works only for additional points, when dates range expanding
0
Martin Ivanov
Telerik team
answered on 20 Nov 2014, 10:09 AM
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.

 
Tags
ChartView
Asked by
Nikolai
Top achievements
Rank 1
Answers by
Nikolai
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or