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.
Unfortunately, activation email could not send to your email. Please try again.

setting X axis labels to display only integers

Thread ID:

Created:

Updated:

Platform:

Replies:

49725 Sep 25,2006 03:20 PM Sep 27,2006 02:31 AM Windows Forms 3
loading
Tags: Chart
Ben Tsai
Asked On September 25, 2006 03:20 PM

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.

Administrator [Syncfusion]
Replied On September 26, 2006 08:52 AM


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

Ben Tsai
Replied On September 26, 2006 12:34 PM

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

Administrator [Syncfusion]
Replied On September 27, 2006 02:31 AM


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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;