in assets/ml.js [69:115]
function createLineChart(ctx, dataPoints, unit) {
ctx = clearChart(ctx);
const dates = dataPoints.map((point) => new Date(point.date));
charts[ctx.id] = new Chart(ctx, {
type: "line",
data: {
labels: dates.map((date) =>
date.toLocaleDateString("en-US", { day: "numeric", month: "short" })
),
datasets: [
{
data: dataPoints.map((point) => point.value),
borderColor: ctx.id.includes("ram")
? "rgba(255, 99, 132, 1)"
: "rgba(54, 162, 235, 1)",
backgroundColor: ctx.id.includes("ram")
? "rgba(255, 99, 132, 0.2)"
: "rgba(54, 162, 235, 0.2)",
fill: true,
tension: 0.3
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
type: "category",
ticks: { autoSkip: true, maxTicksLimit: 10 }
},
y: { beginAtZero: true }
},
plugins: {
legend: { display: false },
tooltip: {
callbacks: {
label: function(tooltipItem) {
return tooltipItem.raw + " " + unit;
}
}
}
}
}
});
}