Skip to main content
2 de 4
se añadieron 852 caracteres en el cuerpo
lois6b
  • 7.6k
  • 5
  • 33
  • 54

Como dicen en esta respuesta tienes que sobreescribir scales:

Añadiendo:

scaleOverride : true,
scaleStartValue : 0,

<script type="text/javascript">
var ctx = document.getElementById("reporte_tecnicos").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
scaleOverride : true,
scaleStartValue : 0,
data: {
labels: [<?php while($count<$i){echo $data_n[$count]; $count++;} ?>],
datasets: [{
    label: '',
    backgroundColor: [
        "rgba(0, 150, 254, 0.5)",
        "rgba(150, 100, 50, 0.5)",
        "rgba(50, 50, 50, 0.5)",
        "rgba(255, 100, 0, 0.5)",
        "rgba(150, 100, 50, 0.5)",
        "rgba(100, 254, 0.5)",
        "rgba(25, 100, 200, 0.5)",
        "rgba(75, 75, 75, 0.5)",
        "rgba(80, 20, 0, 0.5)",
        "rgba(255, 50, 254, 0.5)"
    ],
    data: [<?php while($count2<$i){echo $data_r[$count2]; $count2++;} ?>],
    options: {
    scales: {
        yAxes: [{
            beginAtZero: true
        }]
        }
    }
    }],
}
});
lois6b
  • 7.6k
  • 5
  • 33
  • 54