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

Dynamic load data by Scrollbar

4 Answers 94 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Chien Cheng
Top achievements
Rank 1
Chien Cheng asked on 27 Dec 2012, 07:18 AM
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!

4 Answers, 1 is accepted

Sort by
0
Missing User
answered on 01 Jan 2013, 08:35 AM
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.

0
Chien Cheng
Top achievements
Rank 1
answered on 02 Jan 2013, 10:56 AM
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 :)



0
Missing User
answered on 07 Jan 2013, 11:20 AM
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.

0
Chien Cheng
Top achievements
Rank 1
answered on 08 Jan 2013, 09:30 AM
Hi Ivan,

The workaround works well.
Thakns a lot ! :)
Tags
ChartView
Asked by
Chien Cheng
Top achievements
Rank 1
Answers by
Missing User
Chien Cheng
Top achievements
Rank 1
Share this question
or