Free Support Forum - aspose.com

Y-axis scale formatting depends on data

I am using Aspose Charts to plot graphs.Y axis contains data that may be small numbers or some times big numbers like Millions.I have used following code to format it to millions.The issue is when the numbers are too small,say like 5,7 etc…it is showing in decimals(ie it is also converting to millions).How can I solve this?I want to format Y-axis values depends on there range.If small numbers it should be in integers not in decimals.

chart.ValueAxis.DisplayUnit = DisplayUnitType.Millions;

@anishsm,

Thanks for your query.

Well, I am afraid, there is no automatic way to accomplish the task. You have to write your own logic and code to evaluate the chart’s source data (for value axis), so you could apply appropriate DisplayUnitType.