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

Initial Bindings For Zoom Settings

3 Answers 122 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Katherine
Top achievements
Rank 1
Katherine asked on 23 Apr 2011, 09:35 PM
Hello,

I have a scenario where I'm trying to implement dynamic data loading for a RadChart instance. Essentially, I have a set of trend series where each series has a set of records between a known date and the current date. By calculating the minimum start date for each series, I can calculate the MinValue/MaxValue properties for AxisX.

I've also handled the PropertyChanged event on the Zoom settings for the x axis, and am loading the additionally needed data dynamically (pumping it through a custom ObservableCollection instance), and that seems to work well.

However, even though I know the range for the values, I'm having trouble setting initial zoom settings for the x axis. Even though the trend series has data for the last year (for example), I only want the graph to initially show the last 5 days (for example), and only load that data. I'm setting up bindings in my ViewModel for the ZoomScrollSettingsX object, but it does not seem to have any effect on the graph. (The graph shows the entire range, with only a certain portion of it loaded).

<telerik:RadChart x:Name="RadChart1" SeriesMappings="{Binding Mappings}" ItemsSource="{Binding Data}">
     <telerik:RadChart.DefaultView>
         <telerik:ChartDefaultView>
             <telerik:ChartDefaultView.ChartArea>
                 <telerik:ChartArea>
                     <telerik:ChartArea.AxisX>
                         <telerik:AxisX AutoRange="False" MinValue="{Binding MinValue}" MaxValue="{Binding MaxValue}" IsDateTime="True" StepLabelLevelCount="2" LabelStep="4"/>
                     </telerik:ChartArea.AxisX>
                     <telerik:ChartArea.ZoomScrollSettingsX>
                         <telerik:ZoomScrollSettings RangeStart="{Binding RangeStart}" RangeEnd="{Binding RangeEnd}" ScrollMode="ScrollAndZoom" />
                     </telerik:ChartArea.ZoomScrollSettingsX>
                 </telerik:ChartArea>
             </telerik:ChartDefaultView.ChartArea>
         </telerik:ChartDefaultView>
     </telerik:RadChart.DefaultView>
 </telerik:RadChart>

Hopefully that makes it obvious what I'm trying to do, and thank you for any help

3 Answers, 1 is accepted

Sort by
0
Katherine
Top achievements
Rank 1
answered on 23 Apr 2011, 11:14 PM
So I managed to figure out my issue. I was initially having some issues with directly supplying DateTime values as XAxis values for RadChart, so I began manually converting them to OADate double values in my ViewModel.

When you directly supply the chart with DateTime values, RangeStart and RangeEnd are OADate double values between MinValue.ToOADate() and MaxValue.ToOADate(), whereas if you supply MinValue and MaxValue as double OADate values, RangeStart and RangeEnd are double values between 0.0 and 1.0 . I just had to adapt my view model to return double values as a range rather than OADate values, and everything worked out great
0
Ves
Telerik team
answered on 27 Apr 2011, 09:30 AM
Hi Loren,

That's correct, when supplying data directly to MinValue and MaxValue -- it should be double and not DateTime. Just an idea here -- you can use a value converter in the bindings and keep the DateTime values in your ViewModel, especially if you need them elsewhere.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sunil
Top achievements
Rank 1
answered on 04 Jan 2012, 09:53 AM
Hi Loren,

I have a similar requirement. I am displaying stock market data on my chart. The initial view is at day level. If user zooms in then I need to display the data at hour / minute level depending on the zoom level. I am not able to get it working.

Can you post a sample project here? It would be of great help to me. Thanks in advace.
Tags
Chart
Asked by
Katherine
Top achievements
Rank 1
Answers by
Katherine
Top achievements
Rank 1
Ves
Telerik team
Sunil
Top achievements
Rank 1
Share this question
or