Force bar chart Y axis scale to be integer-only
Force bar chart Y axis scale to be integer-only
Tags:
ReQtest Dev11 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?
-
1 Solution
Alessandro (DevExpress Support)11 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.
-
ReQtest Dev11 years ago
Thanks - that did the trick (combined with a check for the axis range).
-
ReQtest Dev11 years ago
Resolved
-
hbax4505 months ago
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. -
John (DevExpress Support)5 months 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.