瀏覽代碼

Upload New File

Handiri Amine 5 年之前
父節點
當前提交
15d281c7ed
共有 1 個文件被更改,包括 68 次插入0 次删除
  1. 68 0
      WebContent/js/mixChart.js

+ 68 - 0
WebContent/js/mixChart.js

@@ -0,0 +1,68 @@
+var labels = [
+    "sunday",
+    "monday",
+    "tuesday",
+    "wednesday",
+    "thursday",
+    "friday",
+    "saturday"
+];
+var frequentations = [
+    20,
+    14,
+    12,
+    15,
+    18,
+    19,
+    22
+];
+var moyennes = [
+    15,
+    17,
+    17,
+    19,
+    18,
+    26,
+    31
+];
+var mix = document.getElementById("mixChart").getContext('2d');
+var mixChart = new Chart(mix, {
+    type: 'bar',
+    data: {
+        labels: labels,
+        datasets: [
+            {
+                type: 'line',
+                label: "monthly average",
+                data: moyennes,
+                borderColor: 'rgba(75, 192, 192, 1)',
+                backgroundColor: 'rgba(0, 0, 0, 0)',
+                yAxisID: 'frequentations',
+            },
+            {
+                label: "This week",
+                data: frequentations,
+                borderColor: 'rgba(0, 0, 0, 0)',
+                backgroundColor: 'rgba(192, 75, 192, 0.5)',
+                yAxisID: 'frequentations',
+            }
+        ]
+    },
+    options: {
+        scales: {
+            yAxes: [
+                {
+                    id: "frequentations",
+                    ticks: {
+                        beginAtZero: true,
+                    },
+                    scaleLabel: {
+                        display: true,
+                        labelString: 'Frequentation '
+                      }
+                },
+                
+            ]
+        },
+    }
+});