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. Image for the cookie policy date

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

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 


3 Replies

DA Devi Aruna Maharasi Murugan Syncfusion Team August 8, 2016 10:23 AM UTC

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 





WQ Wang Qi replied to Devi Aruna Maharasi Murugan August 9, 2016 04:49 AM UTC

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. 


DA Devi Aruna Maharasi Murugan Syncfusion Team August 10, 2016 03:40 AM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon