From 4f3947179eab34fda795bab0e2a8e1241e3783d3 Mon Sep 17 00:00:00 2001 From: Sakurai Date: Sun, 9 Feb 2025 11:48:40 +0900 Subject: [PATCH] Fix --- Uriagekun/Views/Good/View.cshtml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Uriagekun/Views/Good/View.cshtml b/Uriagekun/Views/Good/View.cshtml index 5eb0389..3e59e7e 100644 --- a/Uriagekun/Views/Good/View.cshtml +++ b/Uriagekun/Views/Good/View.cshtml @@ -38,10 +38,27 @@ document.addEventListener('DOMContentLoaded', () => { const chartData = JSON.parse(document.getElementById('chartData').textContent); console.log(chartData); - const canvas = document.getElement('lineChart'); + const canvas = document.getElementById('lineChart'); const lineChart = new Chart(canvas, { type: 'line', data: { + labels: chartData.map(d => d.Date), + datasets: [ + { + label: "販売個数", + data: chartData.map(d => d.Count), + borderColor: 'rgba(255, 255, 0, 1)', + backgroundColor: 'rgba(0, 0, 0, 0)', + }, + { + label: "販売金額", + data: chartData.map(d => d.Price), + borderColor: 'rgba(255, 0, 0, 1)', + backgroundColor: 'rgba(0, 0, 0, 0)', + }, + ], + }, + options: { }, }); });