BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
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
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,Sample: AutoScroolingRange100_(2)Regards,Devi