JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
<canvas id="canvas" height="450" width="600"></canvas>
JavaScript
let ctx = document.getElementById("canvas").getContext("2d");
let mychart = new Chart(ctx, {
type: 'line',
data: {
labels: ["AAA", "BBB"],
datasets: [
//dummy bar dataset
//{
// type: 'bar',
// label: 'dummy',
// data: []
//},
{
type: 'line',
label: 'Test',
fill: false,
backgroundColor: 'transparent',
data: [5, 2],
pointBorderColor: 'black',
pointBackgroundColor: 'black'
}
]
},
options: {
scales: {
xAxes: [{
gridLines: {
offsetGridLines: true
}
}],
yAxes: [{
ticks: {
beginAtZero: true,
max: 6
}
}]
}
}
});