jQWidgets Forums

jQuery UI Widgets Forums Chart Range axis values shows long value in between

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

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • Shailaja
    Member

    I have vertical bar chart, it range axis values in between shows long values, like the range axis values are 0, 5.4, 10.8, 16.200000000000003, 21.6, 27, 32.400000000000006, 37.800000000000004, 43.2, 48.6, 54

    I tried with format settings property decimalPlaces, doesn’t solves the problem, will you suggest on how could i resolve this issue.

    Thanks

    Shailaja


    Dimitar
    Participant

    Hello Shailaja,

    Please post a sample code so that we may determine the source of the issue.

    Best Regards,
    Dimitar

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


    Shailaja
    Member

    Hi Dimitar,

    Please check below my code i have in the value axis
    valueAxis:
    {

    showGridLines: ${reportData.rangeGridLine[0]},
    gridLinesColor :’#’+rangeGridColor,

    displayValueAxis: true,

    flip:true,

    axisSize: ‘auto’,
    formatSettings:
    {
    //decimalPlaces: 0
    },
    description: “${fn:replace(reportData.rangeAxisLabel, ‘\”‘, ‘\\\”‘)}”,
    minValue: ${reportData.minValue},
    maxValue: ${reportData.maxValue},
    unitInterval: ${reportData.unitInterval},
    formatFunction: function(value){
    for(i in primRangeAxisData){
    var val = primRangeAxisData[i];
    for(j in val){
    if(value == j){
    return primRangeAxisData[i][value];
    }
    }
    }
    return value;
    },
    },


    Dimitar
    Participant

    Hi Shailaja,

    The issue may come from your custom formatFunction. Try modifying/removing it and check if the issue persists.

    Best Regards,
    Dimitar

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


    Shailaja
    Member

    Hi Dimitar,

    Thanks for your feedback, I did some test research on it and found that on commenting the custom formatFunction, it shows proper avoiding those long decimal values.

    the concern is that on overriding this function, the formatSettings:{decimalPlaces: 2}, does not works because in new test set i just added
    formatFunction: function(value){
    return value;
    },
    this code doesn’t do anything returns as it is, so just want to confirm does any issue persist like such, or any workaround suggestion for I need to take care


    Dimitar
    Participant

    Hi Shailaja,

    The formatFunction indeed overrides the formatSettings. This is not an issue. If you want your formatFunction to return numbers with two decimal places, you would have to write a custom code that does it, e.g.:

    formatFunction: function(value){
    return value.toFixed(2);
    },

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.