]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Doughnut chart options have an offset property (#9916)
authorEvert Timberg <evert.timberg+github@gmail.com>
Sun, 28 Nov 2021 18:01:00 +0000 (13:01 -0500)
committerGitHub <noreply@github.com>
Sun, 28 Nov 2021 18:01:00 +0000 (13:01 -0500)
types/index.esm.d.ts
types/tests/controllers/doughnut_offset.ts [new file with mode: 0644]

index d8759fa6b9281596cd9afd4a32f98e765ab11c00..df69eb02eea884d063761fc60119268ef263c424 100644 (file)
@@ -244,6 +244,11 @@ export interface DoughnutControllerDatasetOptions
    */
   circumference: number;
 
+  /**
+   * Arc offset (in pixels).
+   */
+  offset: number;
+
   /**
    * Starting angle to draw this dataset from.
    * @default 0
@@ -292,6 +297,11 @@ export interface DoughnutControllerChartOptions {
    */
   cutout: Scriptable<number | string, ScriptableContext<'doughnut'>>;
 
+  /**
+   * Arc offset (in pixels).
+   */
+  offset: number;
+
   /**
    * The outer radius of the chart. String ending with '%' means percentage of maximum radius, number means pixels.
    * @default '100%'
diff --git a/types/tests/controllers/doughnut_offset.ts b/types/tests/controllers/doughnut_offset.ts
new file mode 100644 (file)
index 0000000..58f7546
--- /dev/null
@@ -0,0 +1,15 @@
+import { Chart, ChartMeta, Element } from '../../index.esm';
+
+const chart = new Chart('id', {
+  type: 'doughnut',
+  data: {
+    labels: [],
+    datasets: [{
+      data: [],
+      offset: 40,
+    }]
+  },
+  options: {
+    offset: 20,
+  }
+});