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

In x-axis how to give integer range, without making decimalPlace=0

In the attached picture, when we zoom in graph the x-axis values converts from integer to double. I want the x-axis value to be in integer without rounding the value. When I move horizontally the value should be in integer.

I have tried the decimalPlace = 0, but that's misleading the plotted points.

jjj.jpeg

7 Replies

LA Lavanya Anaimuthu Syncfusion Team February 10, 2023 09:37 AM UTC

Hi Syed Muzammil Ali,


Your requirement can be achieved with help of the number format property which is available in the axis. Please refer to the following code snippet.


NumericAxis(

     numberFormat: NumberFormat("#"),

)


For more details, refer to the UG:

https://help.syncfusion.com/flutter/backup/chart/axis-types#formatting-the-labels


Regards,

Lavanya A.



SM Syed Muzammil Ali February 13, 2023 06:23 AM UTC

After implementing this, it doesn't help in my case:
NumericAxis(

     numberFormat: NumberFormat("#"),

)

My problem statement is, when I zoom in, the clicked plotted points should be between 4 to 5 in x-axis but it shows between 3 to 4.

Screenshot 2023-02-13 at 11.09.42 AM.png

Reply
1 Reply

LALavanya AnaimuthuSyncfusion TeamFebruary 10, 2023 02:37 PM

Hi Syed Muzammil Ali,


Your requirement can be achieved with help of the number format property which is available in the axis. Please refer to the following code snippet.


NumericAxis(

     numberFormat: NumberFormat("#"),

)



Screenshot 2023-02-13 at 11.09.42 AM.png



YG Yuvaraj Gajaraj Syncfusion Team February 14, 2023 02:18 PM UTC

Hi Syed,


We are validating your query at our end and we will update further details tomorrow. We appreciate your patience until then.


Regards,

Yuvaraj.



SM Syed Muzammil Ali replied to Yuvaraj Gajaraj February 15, 2023 01:15 PM UTC

Following up on the problem.




YG Yuvaraj Gajaraj Syncfusion Team February 15, 2023 03:32 PM UTC

Hi Syed,


A TooltipBehavior will identify the nearest data point to the location that is tapped and display a tooltip for that data point. For example, if you tap between the values 4 and 5, but there is no data between 4 and 5, then the tooltip will be displayed at the nearest point between 3 and 4. This is the default behavior, and we have provided a sample for your reference.


If you are still facing any issues, we kindly request you to share more information on your requirement in detail along with screenshots and screen recordings, also try to reproduce the reported issue in the shared sample. So that it will help us assist you in a better way. 



Regards,

Yuvaraj.


Attachment: f180442_de2246cc.zip


SM Syed Muzammil Ali February 16, 2023 03:41 PM UTC

Hi Yuvaraj,


In the attached picture you can see x-axis values are shown in decimals, and

In img#1, we can see age: 9y 2m i.e, 9.2 plotted between 8.4 - 9.4 (x-axis) , which is technically accurate.

Now, in img#2, in code I added decimalPlace=0, we can see values are in integer, now see age: 9y 2m i.e, 9.2 plotted between 8 - 9 (x-axis),  which is misleadinginstead it should be between 9-10.

Can you pls suggest a solution for this problem?

Img#1,


Img#2




YG Yuvaraj Gajaraj Syncfusion Team February 17, 2023 03:23 PM UTC

Hi Syed,


Here we have only removed the decimal values in the axis label with the NumberFormat, but the actual value axis label in the second image is 8.4 and 9.4 only that is why the tooltip renders between 8 and 9 with the value of 9.2. This is the default behavior of the tooltip in the chart.


If you have any further queries please get back to us.


Regards,

Yuvaraj.



Loader.
Up arrow icon