JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.0.0-beta.3/chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.24.0"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@0.1.1"></script>
<div class="chart-container">
<canvas id="chart" style="height: 50px"></canvas>
</div>
CSS
.chart-container {
width: 100%;
height: 113px;
}
JavaScript
var ctx = document.getElementById("chart").getContext("2d");
var chart = new Chart(ctx, {
type: "line",
data: {
datasets: [{
label: "1",
data: [{x: 0, y: 0}, {x: 1588765215000, y: 1}],
}, {
label: "2",
data: [{x: 0, y: 0}, {x: 1588765215000, y: 1}],
}, {
label: "3",
data: [{x: 0, y: 0}, {x: 1588765215000, y: 1}],
}, {
label: "4",
data: [{x: 0, y: 0}, {x: 1588765215000, y: 1}],
}, {
label: "5",
data: [{x: 0, y: 0}, {x: 1588765215000, y: 1}],
}]
},
options: {
maintainAspectRatio: false,
legend: {
position: 'right',
align: 'center',
},
scales: {
x: {
display: true,
type: "time",
/* time: {
unit: "month",
} */
},
y: {
display: true,
}
}
}
});