]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add type tests for float bar / object data arrays (#9348)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sun, 4 Jul 2021 11:26:22 +0000 (14:26 +0300)
committerGitHub <noreply@github.com>
Sun, 4 Jul 2021 11:26:22 +0000 (07:26 -0400)
types/tests/data_types.ts [new file with mode: 0644]

diff --git a/types/tests/data_types.ts b/types/tests/data_types.ts
new file mode 100644 (file)
index 0000000..1740d8e
--- /dev/null
@@ -0,0 +1,20 @@
+import { Chart } from '../index.esm';
+
+const chart = new Chart('chart', {
+  type: 'bar',
+  data: {
+    labels: ['1', '2', '3'],
+    datasets: [{ data: [[1, 2], [1, 2], [1, 2]] }],
+  }
+});
+
+const chart2 = new Chart('chart2', {
+  type: 'bar',
+  data: {
+    datasets: [{
+      data: [{ id: 'Sales', nested: { value: 1500 } }, { id: 'Purchases', nested: { value: 500 } }],
+    }],
+  },
+  options: { parsing: { xAxisKey: 'id', yAxisKey: 'nested.value' },
+  },
+});