Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda