3 Replies Latest reply on Aug 4, 2011 6:25 AM by ogerou_screenname

    Data tips in column chart - show strange numbers

    martinjconnolly Level 1

      Hi all

      quite often the data tip on a column chart shows loads of decimal places, even if that is not present in the data that it is representing. My application has data stored to only 3 decimal places but the chart often shows 12 (if I count them right) in the data tip. Why does this happen and is writing my own data tip function the only solution?

      Thanks

        • 1. Re: Data tips in column chart - show strange numbers
          Yogi_ACE Level 2

          Till the time you found correct solution for this, you can use NumberFormatter and set precision value for the number.

           

          e.g.

          var value:* = 6.1649999999...;

          var _numFormatterObj:NumberFormatter = new NumberFormatter();

          _numFormatterObj.precision = 3;

          var num:String = _numFormatterObj.format(value);

           

           

          Regards,

          Yogesh

          1 person found this helpful
          • 2. Re: Data tips in column chart - show strange numbers
            BrianIreland

            The above suggestion works fine, but you can also use:

             

            var:value: Number = int(yourNumber * 1000)/1000;

             

            or if using a string value first:

             

            var value:Number = int(Number(stringValue)*1000)/1000

            1 person found this helpful
            • 3. Re: Data tips in column chart - show strange numbers
              ogerou_screenname

              Hello,

               

              Sorry about resurecting an old post, but I'm having the same issue. My original numbers have unknow number of decimals, and when storing them in my ArrayCollection, I was originally using Math.round(myNumber*100)/100 to keep only 2 decimals. To my surprise, chart datatips show some numbers with 10 decimals (38.4899999999 for example).

               

              I switched to using Number(nfToVal.format(myNumber)), since I already use the same NumberFormatter to display those numbers in a datagrid.

              For info, nfToVal is:

              var nfToVal:NumberFormatter = new NumberFormatter();

              nfToVal.decimalSeparatorFrom=".";
              nfToVal.decimalSeparatorTo = ".";
              nfToVal.useNegativeSign="true";
              nfToVal.thousandsSeparatorFrom="";
              nfToVal.thousandsSeparatorTo="";
              nfToVal.precision="2";
              nfToVal.rounding="nearest";

               

              Problem still there! Numbers display correctly as strings after being formatted, but get decimals again when converted back to numbers ...

               

              Any hints ????

               

              Thanks,

               

              Olivier