Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda