Chart.js の使い方メモ
Chart.js で線をプロットする
let x = nj.arange(-50, 50).divide(10)
let ctx = document.getElementById('chart').getContext('2d');
ctx.canvas.parentNode.style.height = "240px";
ctx.canvas.parentNode.style.width = "320px";
new Chart(ctx, {
type: 'line',
data: {
labels: x.selection.data,
datasets: [
{
label: "sin(x)",
data: nj.sin(x).selection.data,
fill: false,
borderColor: "#2196F3",
radius: 0,
},
{
label: "cos(x)",
data: nj.cos(x).selection.data,
fill: false,
borderColor: "#FF9800",
radius: 0,
}
]
},
options: {
responsive: true,
}
});