Working JavaScript charts
[gpl/argeo-suite.git] / js / src / chart / TestGraph.js
diff --git a/js/src/chart/TestGraph.js b/js/src/chart/TestGraph.js
new file mode 100644 (file)
index 0000000..9cc67db
--- /dev/null
@@ -0,0 +1,27 @@
+import Chart from 'chart.js/auto';
+
+export default class TestGraph {
+
+       init() {
+               const ctx = document.getElementById('myChart');
+
+               new Chart(ctx, {
+                       type: 'bar',
+                       data: {
+                               labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
+                               datasets: [{
+                                       label: '# of Votes',
+                                       data: [12, 19, 3, 5, 2, 3],
+                                       borderWidth: 1
+                               }]
+                       },
+                       options: {
+                               scales: {
+                                       y: {
+                                               beginAtZero: true
+                                       }
+                               }
+                       }
+               });
+       }
+}