Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Chart axis with labels in m (millions) or b (billions)
posted

Hi,

I am working with UltraChart and I have large number of values (in billions). Do we have any built-in functionality in chart (scatter chart to be specific) such that it displays axis labels with millions or billion with number instead of showing large numbers? Please refer below snapshot for details:

So, instead of showing axis label as 160,000,000,000, I want 160B as axis label.

Also, chart scale do no adjust itself properly and most of data is displayed close to one point e.g. close to 0 in snapshot. Please note that I am using chart's default scaling. Any help please?

Thanks in anticipation.

Asim

Parents
No Data
Reply
  • 34830
    Offline posted

    Hello Asim,

    In order to achieve this requirement, I would recommend that you use the UltraDataChart instead of the UltraChart control. The UltraDataChart has a setting built-in that will do this formatting for you, in that its numeric axes have a bool property called AbbreviateLargeNumbers. When set to true, a number like 1,000,000,000 will be shown as 1B.

    Another reason that I recommend doing this with the UltraDataChart over the UltraChart is that I do not believe there is a way to do this with the UltraChart. The UltraChart’s label formats happen using the ItemFormatString of the corresponding Labels property of the Axis, as described in this documentation article. If you have points in your chart where the X-Axis needs to show both 1 million values and 1 billion values, you won’t be able to format the labels separately for 1M or 1B, for example. The UltraDataChart does this with a single property setting.

    I am attaching a sample project to demonstrate the UltraDataChart achieving this requirement.

    Regarding the clustering of your points, I put together a fully linear sample with both the UltraDataChart and the UltraChart, and I have found that this is likely a precision-issue. For example, in the sample project I am sending you, if you remove the cast of the integer “i” in the ViewModel’s “for” loop to a long, you will run into precision issues with that operation that cause the points to plot all over the place. Note, this is on the side of the multiplication operation, not the chart, and is not a bug with the UltraDataChart or UltraChart as this will happen with both controls. However, if you cast it, the points should plot normally.

    I hope this helps. Please let me know if you have any other questions or concerns on this matter.

    UltraDataChartLargeNumberDemo.zip

Children