Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
Google Visualization ComboChart Aggregation - Bar value is not reflecting rounded value

I'm using the average aggregation in a combo chart. The goal is to round that result to an integer.

I've tried formatted the number to no decimal after grouping. The resulting chart bar does not reflect the rounded value.

The coordinate pair (2021/05, 2) is what I would like it to be. Please explain how I can get the Yaxis to reflect the number 2, and not the un-rounded value 1.xx ?

enter image description here

 google.charts.load('current', {
        'packages': ['corechart']
      });
      google.charts.setOnLoadCallback(drawVisualization);

      function drawVisualization() {
        // Some raw data (not necessarily accurate)
        var data = google.visualization.arrayToDataTable([
          ['Month', 'Value'],
          ['2021/05', 1.1],
          ['2021/05', 2.1],
          ['2021/06', 3.1],
          ['2021/06', 4.1],
          ['2021/07', 5.1],
          ['2021/07', 6.1]
        ]);

    let group = google.visualization.data.group(data, [0], [{'column': 1, 'aggregation': google.visualization.data.avg, 'type': 'number'}]);

var formatter = new google.visualization.NumberFormat(
    {pattern:"###,###"});
formatter.format(group, 1); // Apply formatter to second column


        var options = {
          title: 'TITLE',
          vAxis: {
            title: 'AVERAGE'
          },
          hAxis: {
            title: 'MONTH'
          },
          seriesType: 'bars',
          series: { },
          isStacked: true
        };

        var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));

        chart.draw(group, options);

      }
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
       <div id="chart_div" style="width: 900px; height: 500px;"></div>
   

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!