Initial Bindings For Zoom Settings

4 posts, 0 answers
  1. Katherine
    Katherine avatar
    5 posts
    Member since:
    Aug 2012

    Posted 23 Apr 2011 Link to this post


    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:AxisX AutoRange="False" MinValue="{Binding MinValue}" MaxValue="{Binding MaxValue}" IsDateTime="True" StepLabelLevelCount="2" LabelStep="4"/>
                             <telerik:ZoomScrollSettings RangeStart="{Binding RangeStart}" RangeEnd="{Binding RangeEnd}" ScrollMode="ScrollAndZoom" />

    Hopefully that makes it obvious what I'm trying to do, and thank you for any help
  2. Katherine
    Katherine avatar
    5 posts
    Member since:
    Aug 2012

    Posted 23 Apr 2011 Link to this post

    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
  3. Ves
    Ves avatar
    2926 posts

    Posted 27 Apr 2011 Link to this post

    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,
    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
  4. Sunil
    Sunil avatar
    1 posts
    Member since:
    Nov 2011

    Posted 04 Jan 2012 Link to this post

    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.
Back to Top