Graph counter correction

0

I have a chart and my system that I need it to report the exact value of the search results.

Due to lots of data, the results come out 1.1K .

Intheplacewhere1.1K

Iwantedyoutoshowtheexactvaluethatwouldbe1057.

HereisthegraphfunctioninJS:

functionChartConstructor(title,dados,totalText){window.google.charts.load('current',{'packages':['bar']});window.google.charts.setOnLoadCallback(drawStuff);functiondrawStuff(){vartable=JSON.parse(dados);varrows="";

        var array = [["", "Total"]];

        for (var i = 0; i < table.length; i++) {
            array.push([table[i].Title, table[i].Count]);
        }

        var data = new google.visualization.arrayToDataTable(array);

        var options = {
            width: '100%',
            height: 400,            
            chart: {
                title: title,
            },
            bar: { groupWidth: '95%' },
            bars: 'horizontal',
            series: {
                0: { axis: 'distance' }, 
            }
        };

        var chart = new google.charts.Bar(document.getElementById("chart-content"));
        chart.draw(data, options);

        $("#chart-type").val("");
    }
}
    
asked by anonymous 04.12.2017 / 20:06

1 answer

0

Now, try to get the value and multiply it according to the string.

It would look like this:

function getVal (val) { 
   multiplier = val.substr(-1).toLowerCase(); 

   if (multiplier == "k") 
      return parseFloat(val) * 1000; 
  else if (multiplier == "m") 
      return parseFloat(val) * 1000000; 
}
    
04.12.2017 / 20:13