Dynamic load data by Scrollbar

5 posts, 0 answers
  1. Chien Cheng
    Chien Cheng avatar
    8 posts
    Member since:
    Oct 2012

    Posted 27 Dec 2012 Link to this post

    Hi
    I'd like to do a stock chart like this page and use zoom to display scroll bar.
    I'm wondering how can I dynamic load data when I scroll to leftmost?
    is there scroll event to use?

    Thanks!
  2. Missing user
    Missing user avatar

    Posted 01 Jan 2013 Link to this post

    Hi Chien Cheng,

    RadCartesianChart doesn't expose such an event, but the behavior you describe is achievable. You can use the scrollbar's SelectionChanged event by following this example:
    public MainPage()
    {
        InitializeComponent();
        this.RadChart1.LayoutUpdated += new EventHandler(RadChart1_LayoutUpdated);
    }
     
    void RadChart1_LayoutUpdated(object sender, EventArgs e)
    {
        var panZoomBar = this.RadChart1.HorizontalAxis.ChildrenOfType<PanZoomBar>().FirstOrDefault();
        if (panZoomBar != null)
        {
            panZoomBar.SelectionChanged += new Telerik.Windows.RadRoutedEventHandler(MainPage_SelectionChanged);
            this.RadChart1.LayoutUpdated -= RadChart1_LayoutUpdated;
        }
    }
     
    void MainPage_SelectionChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
    }

    Note that the ChildrenOfType<T> method and the PanZoomBar type are members of the Telerik.Windows.Controls and Telerik.Windows.Controls.ChartView namespaces respectively and that this example assumes you've included them beforehand.

    Greetings,
    Ivan N.
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Chien Cheng
    Chien Cheng avatar
    8 posts
    Member since:
    Oct 2012

    Posted 02 Jan 2013 Link to this post

    Hi, Ivan
    Thaks for your reply. It may helped me a lot.

    I got another question.
    I added MovingAverageIndicator to ChartView's indicator like example class "FinancialIndicatorSwitch", but it only draw the line of selection.
    After I scroll to left, the indicator will disapper, but when I resize scroll bar, the indicator draw well.
    It seem's indicator redraw by selection range changed?

    Thanks :)



  5. Missing user
    Missing user avatar

    Posted 07 Jan 2013 Link to this post

    Hi Chien Cheng,

    Thank you for pointing out this problem to us. We managed to reproduce it and it is indeed a bug. It has been logged and you can track our progress on it by following this link. Naturally, your Telerik points have been updated.

    In the meantime, you can check out the workaround we've prepared in the attached project.

    Regards,
    Ivan N.
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Chien Cheng
    Chien Cheng avatar
    8 posts
    Member since:
    Oct 2012

    Posted 08 Jan 2013 Link to this post

    Hi Ivan,

    The workaround works well.
    Thakns a lot ! :)
Back to Top
DevCraft banner