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
close icon

setting X axis labels to display only integers

Hello,

I am currently using the chart control bound to a dataset. I have enabled X scrolling/zooming. Although my series contains only integers, sometimes when I zoom, the X axis labels are automatically set to non-integer values.

This makes sense, because the ValueType of the axis is Double, but is there a way to force the behavior to display only integer values?

I tried changing RoundingPlaces to 0, but this results in a divide-by-zero exception.

Thanks.

3 Replies

AD Administrator Syncfusion Team September 26, 2006 12:52 PM UTC


Hi BenT,

Thank you for choosing Syncfusion products.

It is possible to set the integer values for an Axis while Zooming using RoundingPlaces and Format property of an Axis. The following code illustrate this :


this.chartControl1.PrimaryYAxis.RoundingPlaces=0;
this.chartControl1.PrimaryXAxis.Format="###";

But I was not able to reproduce the divide-by-zero exception when setting RoundingPlaces to zero.

Please try the attached sample which helps you to display the Axis values in integers after zooming.

Kindly let me know if this helps.

Regards,
Jaya

ChartDataBindingSample.zip


BT Ben Tsai September 26, 2006 04:34 PM UTC

Thank you for your reply, Jaya.

Changing the PrimaryXAxis.Format property appears to achieve the behavior I wanted.

I wasn''t able to properly run your example - I receive a "Object reference not set to an instance of an object." when attempting to zoom. But my issue has been resolved.

Best regards.

>
Hi BenT,

Thank you for choosing Syncfusion products.

It is possible to set the integer values for an Axis while Zooming using RoundingPlaces and Format property of an Axis. The following code illustrate this :


this.chartControl1.PrimaryYAxis.RoundingPlaces=0;
this.chartControl1.PrimaryXAxis.Format="###";

But I was not able to reproduce the divide-by-zero exception when setting RoundingPlaces to zero.

Please try the attached sample which helps you to display the Axis values in integers after zooming.

Kindly let me know if this helps.

Regards,
Jaya

ChartDataBindingSample.zip


AD Administrator Syncfusion Team September 27, 2006 06:31 AM UTC


Hi BenT,

Glad to hear that your issue is resolved.

To avoid the exception you faced,you need to change the connection string according to the location where you stored the database file in your system.

Thank you for your continued interest in Syncfusion products.

Regards,
Jaya

Loader.
Live Chat Icon For mobile
Up arrow icon