JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<canvas id="myCanvas" height="300"></canvas>
JavaScript
var data = {
"labels": ["Label1", "Label2", "Label3", "Label4", "Label5"],
"datasets": [{
"label": "Variation",
"data": ["56", "-82.3", "25.7", "32.2", "49.99"],
"borderWidth": 1,
"backgroundColor": "rgba(231, 76, 60, 0.2)",
"borderColor": "rgba(231, 76, 60, 1)"
}]
};
var myBarChart = new Chart($("#myCanvas"), {
type: 'bar',
data: data,
maintainAspectRatio: false,
options: {
scales: {
yAxes: [{
ticks: {
// Create scientific notation labels
callback: function(value, index, values) {
return value + ' %';
}
}
}]
},
tooltips: {
callbacks: {
label: function(tooltipItem, data) {
return tooltipItem.yLabel + ' %';
}
}
}
}
});