Change Y-axis values in Chart js

Asked

Viewed 904 times

0

How to change these values of the Y axis in Chart js, these values from 5 to 50 were automatically placed by the plugin, wanted to modify them.

chart js

1 answer

0


In Chart.js the Y axis is determined by the property datasets see the documentation which can come from the bank or inserted in hard code as is done in the example below.

var barData = {
  labels: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho"],
  datasets: [{
    fillColor: "#48A497",
    strokeColor: "#48A4D1",
    data: [10, 20, 30, 40, 50, 60, 80]
  }]
}
var income = document.getElementById("graficoBar").getContext("2d");

new Chart(income).Bar(barData);
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
<canvas id="graficoBar" width="600" height="400"></canvas>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.