Make google-charts bar preview start from scratch

0

I have a chart of google charts in the system that may be reset, if it is reset I need to start from 0, but I can not configure it, I tried to use viewWindow.min , but it does not work.

documentation does not cite anything about it.

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

function drawBasic() {

  var data = google.visualization.arrayToDataTable([
    [
      "",
      "",
      {
        "role": "style"
      },
      {
        "role": "annotation"
      }
    ],
    [
      "A",
      0,
      "#64BBF6",
      "0 | R$ 0,00"
    ],
    [
      "B",
      0,
      "#2A8FD7",
      "0 | R$ 0,00"
    ],
    [
      "C",
      0,
      "#0862A2",
      "0 | R$ 0,00"
    ],
    [
      "D",
      0,
      "#64BBF6",
      "0 | R$ 0,00"
    ]
  ]);

  var options = {
    title: '',
    chartArea: {
      width: '60%'
    },
    height: 100,
    hAxis: {
      title: '',
      viewWindow: {
        min: 0,
      },
    },
    vAxis: {
      title: '',
      viewWindow: {
        min: 0,
      },
    },
    legend: {
      position: "none"
    },
    annotations: {
      textStyle: {
        bold: true
      },
      alwaysOutside: true
    },
    tooltip: {
      trigger: "none"
    }
  };

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

  chart.draw(data, options);
}
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script><divid="chart_div"></div>

In the example above it starts from -1, I need to make it start from 0 even when there is no data

    
asked by anonymous 27.11.2018 / 14:40

0 answers