jQuery UI Widgets Forums Getting Started valueAxis (y axis) integer

This topic contains 2 replies, has 2 voices, and was last updated by  jb 11 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • valueAxis (y axis) integer #30556

    jb
    Participant

    My webpage allows a user to select a day in a calendar and a graph is then created using that day’s csv file (on the server). Works pretty well actually, thanks…  I cannot hard code the unitInterval as my data varies from a day to another. All my values are integer (they are call counts). The autoscalling functionality works, but it adds in decimal to the y axis, which makes it look messy (for instance the ticks can look like this:  0, 871.80, 1743.60, 2615.40, 3487.20, 3487.20, 4359, 5230.80, 6102.60, 6974.40, 6974.40, 7846.20, 8718, 9589.80 for data that goes from 428 to 9146.)  There’s gotta be a way to force it to only display integer without assigning a unitInterval… help!

    valueAxis (y axis) integer #30588

    Dimitar
    Participant

    Hello jb,

    This is the default behaviour and it cannot be altered. However, you may set a formatFunction which to round the displayed numbers to the nearest integer:

    valueAxis:
    {
    displayValueAxis: true,
    description: 'GDP & Debt per Capita($)',
    formatFunction: function (value) {
    return Math.round(value);
    }
    },

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    valueAxis (y axis) integer #30603

    jb
    Participant

    Works like a charm, many thanks Dimitar, you rock!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.