我有几个按小时和天显示数据的按钮。现在我只有按小时显示的图表。如何添加另一个带有数据的图表并在单击时显示它?
export const chartInitialize = (parent: any) => {
const canvas: any = document.getElementById("chart")
const ctx = canvas.getContext("2d")
chartHour = new Chart(ctx, {
type: "line",
data: {
datasets: [
{
label: "HourStamp",
backgroundColor: createGradientLineColor(ctx, "#5f8fd8"),
borderColor: "rgba(0, 0, 0, 0)",
data: getRandomData(0, 116),
},
],
},
options: {
title: {
display: true,
fontFamily: "'Montserrat', sans-serif",
},
legend: {
display: false,
},
},
})
}