X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=js%2Fsrc%2Fgraph%2FTestGraph.js;h=9cc67db4fa4061561fe3ba53bab78c12cb73db17;hb=7b8a247e57b447fc2a758b1d2e38251321f1575c;hp=5236657db397be82f38686b2e44e12d41021e70e;hpb=d902e68befce67faf8d118f71adc7aafdadd0b56;p=gpl%2Fargeo-suite.git diff --git a/js/src/graph/TestGraph.js b/js/src/graph/TestGraph.js index 5236657..9cc67db 100644 --- a/js/src/graph/TestGraph.js +++ b/js/src/graph/TestGraph.js @@ -1,12 +1,27 @@ -import * as Plot from "@observablehq/plot"; +import Chart from 'chart.js/auto'; export default class TestGraph { init() { + const ctx = document.getElementById('myChart'); - const plot = Plot.rectY({ length: 10000 }, Plot.binX({ y: "count" }, { x: Math.random })).plot(); - const div = document.querySelector("#myplot"); - div.append(plot); - + 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 + } + } + } + }); } }