Hi there,
i started using xamdatachart with the 2020.1 release.
our final goal is to use it with .NET5, currently this demo targets .NET core 3.1
I have created a simple chart with one series and set IsTransitionInEnabled = True.
Data is being created in the viewmodel.
What i see now when opening the app is, that it starts renedering the series. after maybe a third it resets automatically to the beginning, after that it renders completely.
what could be the reason for this.
Thanks, Thomas
my xaml:
<Window.DataContext> <local:MainViewModel/> </Window.DataContext> <Grid> <Grid.RowDefinitions> <RowDefinition Height="20"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <ig:XamDataChart Grid.Row="1" x:Name="DataChart" VerticalZoomable="True" HorizontalZoomable="True" Background="#FFE0DEDE" HorizontalZoombarVisibility="Visible"> <ig:XamDataChart.Axes> <ig:CategoryXAxis x:Name="xAxis" ItemsSource="{Binding DataItems}" Label="{}{X}"> </ig:CategoryXAxis> <ig:NumericYAxis x:Name="yAxis" Opacity="0"> </ig:NumericYAxis> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:LineSeries x:Name="Sine" MarkerType="None" Thickness="1" ItemsSource="{Binding DataItems}" ValueMemberPath="Y" Resolution="0.5" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" IsTransitionInEnabled="True"/> </ig:XamDataChart.Series> </ig:XamDataChart> </Grid>
my viewmodel
public class MainViewModel : INotifyPropertyChanged { public MainViewModel() {
List<ChartData> lstDataItems = new List<ChartData>();
lstDataItems = GetSineWave(1000, 100, 44100);
dataItems = lstDataItems; }
private List<ChartData> GetSineWave(double freq, int durationMs, int sampleRate) { List<ChartData> lstDataItems = new List<ChartData>();
double sample_rate = 10000; double number_of_samples = 2500; double amplitude = 170; double frequency_in_hz = 60; double time_in_seconds; double sample;
for (int sample_number = 0; sample_number < number_of_samples; sample_number++) { time_in_seconds = sample_number / sample_rate; sample = amplitude * Math.Sin(2 * Math.PI * frequency_in_hz * time_in_seconds);
lstDataItems.Add(new ChartData(time_in_seconds, sample)); }
return lstDataItems; }
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName) { var handler = this.PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); }
public List<ChartData> dataItems; public List<ChartData> DataItems { set { dataItems = value; this.OnPropertyChanged("DataItems"); } get { return dataItems; } }
}
Hello Thomas,
Thank you for contacting Infragistics and providing code demonstrating the issue. I was able to quickly put together a sample however the chart animates as expected, (bottom left to top right) and doesn't reset. I am unsure how to replicate the behavior. I am using build 20.1.26. Please review my sample to ensure that everything is reproducible on your end and reattach it here if necessary. Let me know if you have any questions.
2570.WpfApp2.zip
Hi Michael,
i modified the project to draw more points and i have the series markers on.
What i see here in the beginning is a kind of flickering, thats the point where it resets, after that all is fine.
Due to the number of points the chart itself looks ugly, but i hope you can see the effect now.
I am using 20.1.26 too.
Attached find the modified project.
Thanks
7635.WpfApp2.zip
Thanks for this. never thought, that the behaviour is so different between debug and release.
Run the app without debugging and the chart animates/transitions smoothly without flickering.