i've got a exception when i zoomed charts over and over.
i have multiple charts in one screen and panning gesture is synchronized, my implementation might be inappropriate..
is there any way to avoid this NaN exception at my end.
syncfusion_flutter_charts version: 20.1.50
======== Exception caught by gesture library =======================================================
The following UnsupportedError was thrown while dispatching a pointer event:
Unsupported operation: Infinity or NaN toInt
Attachment: exception_message_11ba76fa.zip
Hi Ai,
Greetings from Syncfusion. We have checked the reported issue regarding getting NaN toInt exception while zooming the chart max level. But the issue is not reproduced at our end, and we have attached the sample below, which is used in the testing phase for your reference. We have also ensured in the chart package is in the latest version. If you are still facing the issue, please try to reproduce the reported issue in the attached sample and get back to us.
Regards,
Yuvaraj.
hi, Yuvaraj.
thank you for the reply.
i was not able to run your sample because of a gradle error, so i copied your main.dart in my project and run.
your original code works fine, no errors.
but the issue was reproduced when i commented out all zoomMode and enableDoubleTapZooming lines.
please see the attached files(mov and edited main.dart).
my environment is like...
environment:
sdk: ">=2.13.0 <3.0.0"
dependencies:
syncfusion_flutter_charts: 20.1.50
zoomMode might be the cause? i cannot use scroll feature with ZoomMode.xy?
Hi Ai,
We have analyzed the code snippet you have attached in the last query and found that you have set the zoomMode as default XY and updated the zoomFactor and zoomPosition value in the x-axis alone. So please try to update the zoomFactor and zoomPosition value in the y-axis too to avoid the exception. We hope it will help you to resolve the exception.
If you have any further queries, please get back to us.
Regards,
Yuvaraj.
hello, Yuvaraj.
i will update both xaxis and yaxis values or just set ZoomMode.x.
thank you for your help and sample source. :)
Hi Jaehyeok,
We have checked your code snippet in the last query, and we suspect that you want to show the 200 data in the viewport and remove the first point. But in your code snippet, you have removed the data from the list when its length reaches 100, so the data source will not reach 200. So, could you please change the condition like the below code snippet it will help you achieve your requirement.
Code snippet:
|
void updateData(Timer timer) { chartData.add(ChartData(chartData.last.x + 1, Random().nextInt(90))); if (chartData.length >= 200) { chartData.removeAt(0); chartSeriesController!.updateDataSource( addedDataIndexes: <int>[chartData.length - 1], removedDataIndexes: [0]); } else { chartSeriesController! .updateDataSource(addedDataIndexes: <int>[chartData.length - 1]); } } |
Regards,
Yuvaraj.
Hi Ai,
Kindly ignore the previous response.
Thanks for the update. If you have any other further queries, please get back to us, we are always happy to assist you.
Regards,
Yuvaraj.