We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

how to auto-scroll axis x in a chart when using wpf ?

Thread ID:

Created:

Updated:

Platform:

Replies:

125311 Aug 7,2016 11:01 PM Aug 9,2016 11:40 PM WPF 3
loading
Tags: Chart
Wang Qi
Asked On August 7, 2016 11:01 PM

hi,  i'm using syncfusion chart to display a  polyline for  real-time.  i want to see the lastest 100 data in the chart and make the x axis scrolling automaticlly when receiving datas. how can i do it?

this is my xaml:

<syncfusion:SfChart Name="chart" Header="Demands Comparison" HorizontalAlignment="Center" Margin="10" VerticalAlignment="Center" Width="500" Height="300">         

            <syncfusion:SfChart.PrimaryAxis>

                <syncfusion:NumericalAxis  FontSize="10" Header="Primary Axis"  Minimum="0"  Maximum="100" ShowGridLines="True" />

            </syncfusion:SfChart.PrimaryAxis> 

            <syncfusion:SfChart.SecondaryAxis>

                <syncfusion:NumericalAxis FontSize="10" Header="Secondary Axis" Maximum="15000" Minimum="0"/>

            </syncfusion:SfChart.SecondaryAxis>

            <syncfusion:LineSeries Label="acc_x" ItemsSource="{Binding accdat}" XBindingPath="counts" YBindingPath="x" />

            <syncfusion:LineSeries Label="acc_y" ItemsSource="{Binding accdat}" XBindingPath="counts" YBindingPath="y" />

            <syncfusion:LineSeries Label="acc_z" ItemsSource="{Binding accdat}" XBindingPath="counts" YBindingPath="z"/>

            <syncfusion:SfChart.Legend>

                <syncfusion:ChartLegend/>

            </syncfusion:SfChart.Legend>

        </syncfusion:SfChart>

and C#:

    public class acc

    {

        public int x { get; set; }

        public int y { get; set; }

        public int z { get; set; }

        public int counts { get; set; }

    }

public ObservableCollection<acc> accdat { get; set; }

// in other thread 

this.chart.Dispatcher.Invoke

                        (

                            new Action

                                (

                                    delegate()

                                    {

                                        accdat.Add(new acc()

                                        {

                                            x = (data[2] << 8) | data[3],

                                            y = (data[4] << 8) | data[5],

                                            z = (data[6] << 8) | data[7],

                                            counts = c

                                        });

                                    }

                            )

                    );


thanks 


Devi Aruna Maharasi Murugan [Syncfusion]
Replied On August 8, 2016 06:23 AM

Hi Wang Qi, 
  
Thanks for contacting Syncfusion Support. 
  
We have analyzed your requirement. Your requirement has been attained with the help of the “Auto Scrolling” feature. We have prepared a demo sample based on your requirement and it can be downloaded from below link, 
  
  
Regards, 
Devi 




Wang Qi
Replied On August 9, 2016 12:49 AM

Hi Wang Qi, 
  
Thanks for contacting Syncfusion Support. 
  
We have analyzed your requirement. Your requirement has been attained with the help of the “Auto Scrolling” feature. We have prepared a demo sample based on your requirement and it can be downloaded from below link, 
  
  
Regards, 
Devi 




That's what i want , Thanks. 

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On August 9, 2016 11:40 PM

Hi Wang Qi, 
  
Thanks for your update. 
  
Please contact us, if you need any further assistance. 
  
Regards, 
Devi 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;