Paging Data in sfCartesianChart

Hello,

Somewhere I remember seeing we can do Paging of data in sfCartesianChart as user navigates to left of the of the charts.


Assuming there are 5000 data point of chart data.

We would like to show the 1st 1000 data points as user navigate to close to 1000th point, we can retrieve and show 2nd/Next 1000 data point and so on. 


Possible to enable chart paging based on number data points i,e X Axis?


thanks

Praveen




2 Replies

NT Nitheeshkumar Thangaraj Syncfusion Team August 30, 2024 12:56 PM UTC

Hi Praveen,


We would like to inform you that data points can be dynamically added in the desired count (perform lazy loading) while scrolling to the end of the chart by using the Scroll event in the .NET MAUI Cartesian chart. We will prepare a sample demonstrating this functionality and provide it to you within two business days (by September 3, 2024).

Regards,

Nitheeshkumar.



NT Nitheeshkumar Thangaraj Syncfusion Team September 3, 2024 12:57 PM UTC

Hi Praveen,


We would like to let you know that we have prepared a sample to demonstrate adding data points while reaching the end of the chart, similar to lazy loading. This is achieved using the scroll event and setting the X-axis zoom factor to 0.5. When the visible maximum equals the actual maximum, additional data points are added. We have attached the code snippet, sample, and a demo for your reference.

<chart:SfCartesianChart x:Name="chart" Scroll="chart_Scroll">


private async void chart_Scroll(object sender, ChartScrollEventArgs e)

 {  

     actualMaximum = xAxis.ActualMaximum;

     var visibleMaximum = xAxis.VisibleMaximum;

     if (visibleMaximum == actualMaximum)

     {

         busyIndicator.IsRunning = true;

         await Task.Delay(2000);  //Delayed just to indicate the update of data. 

         busyIndicator.IsRunning = false;

 

         // Update the data based on your requirement

         for (int i = 0; i < 4; i++)

         {

             viewModel.Data.Add(new Model(startValue, new Random().Next(10, 40)));

             startValue++;

         }               

     }

 }

 


We hope this helps! If you need any further assistance or have any concerns, please feel free to ask.

Regards,

Nitheeshkumar.


Attachment: LazyLoadingSample_452dc473.zip

Loader.
Up arrow icon