Ticket Q143332
Visible to All Users

Force bar chart Y axis scale to be integer-only

created 16 years ago

I have a bar chart that shows a count of items, by category. When the counts are small, the axis tickmark values show non-integer values - for example when the axis scale is 0 to 5, there is a major tickmark for every 0.5 units. Is there a way to force the axis scale to show integer values only?

Answers

created 16 years ago

Hello Christer,
Please use the following code snippet to accomplish this task:
            (chartControl.Diagram as XYDiagram).AxisY.GridSpacingAuto = false;
            (chartControl.Diagram as XYDiagram).AxisY.GridSpacing = 1;
I've attached a sample project demonstrating this in action. Please let me know if you experience any further difficulty.
Thanks,
Alessandro.

    Show previous comments (1)

      Resolved

        Is there any way to have gridspacingauto = true, but have the grid NOT show decimals when y-axes values are low?

        I like the function of the auto, but when the values are less than 5, for instance, the y-axes starts showing decimals.  This confuses my users who expect to see whole units (integers) only.

        DevExpress Support Team 6 years ago

          Hello,

          I've created a separate ticket on your behalf (T714453: How to display integer axis values with automatic GridSpacing settings). It has been placed in our processing queue and will be answered shortly.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.