diff --git a/CHANGELOG.md b/CHANGELOG.md
index 018bf0f3..64775f60 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 2.6.0
+* Synced ``Doughnut/PieOptions`` from ChartJS source code #293
+
## 2.5.0
* Synced ``Legend`` from ChartJS source code #285
diff --git a/chartjs-java-model-demo/pom.xml b/chartjs-java-model-demo/pom.xml
index 15d5cea2..7a5aa258 100644
--- a/chartjs-java-model-demo/pom.xml
+++ b/chartjs-java-model-demo/pom.xml
@@ -7,11 +7,11 @@
software.xdev
chartjs-java-model-root
- 2.5.1-SNAPSHOT
+ 2.6.0-SNAPSHOT
chartjs-java-model-demo
- 2.5.1-SNAPSHOT
+ 2.6.0-SNAPSHOT
jar
diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml
index 2cb1091a..51984482 100644
--- a/chartjs-java-model/pom.xml
+++ b/chartjs-java-model/pom.xml
@@ -6,7 +6,7 @@
software.xdev
chartjs-java-model
- 2.5.1-SNAPSHOT
+ 2.6.0-SNAPSHOT
jar
chartjs-java-model
diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/DoughnutOptions.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/DoughnutOptions.java
index 4575c537..fa9b109b 100644
--- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/DoughnutOptions.java
+++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/DoughnutOptions.java
@@ -16,100 +16,8 @@
package software.xdev.chartjs.model.options;
import software.xdev.chartjs.model.options.animation.DoughnutAnimation;
-import software.xdev.chartjs.model.options.elements.ArcElements;
-public class DoughnutOptions extends Options
+public class DoughnutOptions extends DoughnutOptionsBase
{
- /**
- * Default {@code 50}
- *
- * @see #setCutout(Number cutout)
- */
- protected Number cutout;
-
- /**
- * Rotation in degrees. Default {@code 0}. {@code 0} is at the top.
- *
- * @see #setRotation(Number rotation)
- */
- protected Number rotation;
-
- /**
- * Circumference in degrees. Default {@code 360}.
- *
- * @see #setCircumference(Number circumference)
- */
- protected Number circumference;
-
- protected ArcElements elements;
-
- /**
- * @see #setCutout(Number cutoutPercentage)
- */
- public Number getCutout()
- {
- return this.cutout;
- }
-
- /**
- * The pixels as number of the chart that is cut out of the middle.
- */
- public DoughnutOptions setCutout(final Number cutout)
- {
- this.cutout = cutout;
- return this;
- }
-
- /**
- * @see #setRotation(Number rotation)
- */
- public Number getRotation()
- {
- return this.rotation;
- }
-
- /**
- * Starting angle to draw arcs from in degrees
- */
- public DoughnutOptions setRotation(final Number rotation)
- {
- this.rotation = rotation;
- return this;
- }
-
- /**
- * @see #setCircumference(Number circumference)
- */
- public Number getCircumference()
- {
- return this.circumference;
- }
-
- /**
- * Sweep to allow arcs to cover in degrees
- */
- public DoughnutOptions setCircumference(final Number circumference)
- {
- this.circumference = circumference;
- return this;
- }
-
- /**
- * @return {@link ArcElements} instance, or {@code null} if not set
- */
- public ArcElements getElements()
- {
- return this.elements;
- }
-
- /**
- * @param elements an {@link ArcElements} instance, or {@code null}
- * @return this instance for method chaining
- */
- public DoughnutOptions setElements(final ArcElements elements)
- {
- this.elements = elements;
- return this;
- }
}
diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/DoughnutOptionsBase.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/DoughnutOptionsBase.java
new file mode 100644
index 00000000..6acade3f
--- /dev/null
+++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/DoughnutOptionsBase.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright © 2023 XDEV Software (https://xdev.software)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package software.xdev.chartjs.model.options;
+
+import software.xdev.chartjs.model.options.animation.DoughnutAnimationBase;
+
+
+/**
+ * @see ChartJS Source
+ */
+public abstract class DoughnutOptionsBase, A extends DoughnutAnimationBase>
+ extends Options
+{
+ private Number circumference;
+ private Object cutout; // number or string
+ private Object offset; // number or number[]
+ private Object radius; // number or string
+ private Number rotation;
+ private Number spacing;
+
+ public Number getCircumference()
+ {
+ return this.circumference;
+ }
+
+ public DoughnutOptionsBase setCircumference(final Number circumference)
+ {
+ this.circumference = circumference;
+ return this.self();
+ }
+
+ public Object getCutout()
+ {
+ return this.cutout;
+ }
+
+ public DoughnutOptionsBase setCutout(final Object cutout)
+ {
+ this.cutout = cutout;
+ return this.self();
+ }
+
+ public Object getOffset()
+ {
+ return this.offset;
+ }
+
+ public DoughnutOptionsBase setOffset(final Object offset)
+ {
+ this.offset = offset;
+ return this.self();
+ }
+
+ public Object getRadius()
+ {
+ return this.radius;
+ }
+
+ public DoughnutOptionsBase setRadius(final Object radius)
+ {
+ this.radius = radius;
+ return this.self();
+ }
+
+ public Number getRotation()
+ {
+ return this.rotation;
+ }
+
+ public DoughnutOptionsBase setRotation(final Number rotation)
+ {
+ this.rotation = rotation;
+ return this.self();
+ }
+
+ public Number getSpacing()
+ {
+ return this.spacing;
+ }
+
+ public DoughnutOptionsBase setSpacing(final Number spacing)
+ {
+ this.spacing = spacing;
+ return this.self();
+ }
+}
diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java
index 9afdc3ac..619fe786 100644
--- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java
+++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java
@@ -28,7 +28,10 @@
/**
- * @see ChartJS Source
+ * @see
+ * ChartJS Source (Options)
+ * @see
+ * ChartJS Source (AnimationOptons)
*/
public class Options, A extends Animation>
{
@@ -43,7 +46,7 @@ public class Options, A extends Animation>
protected CoreInteractionOptions interaction;
protected CoreInteractionOptions hover;
protected Animations animations;
- protected Boolean animation = true;
+ protected Object animation; // Not supported by all charts, but usually a boolean or of Type
protected Layout layout;
protected Plugins plugins = new Plugins();
@@ -89,18 +92,12 @@ public T setResponsive(final Boolean responsive)
return this.self();
}
- /**
- * @see #setAnimation(Boolean)
- */
- public Boolean getAnimation()
+ public Object getAnimation()
{
return this.animation;
}
- /**
- * Default {@code true} Disables the Animation completely if set to {@code false}.
- */
- public T setAnimation(final Boolean animation)
+ public T setAnimation(final Object animation)
{
this.animation = animation;
return this.self();
diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/PieOptions.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/PieOptions.java
index 5d90e687..020d7bd3 100644
--- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/PieOptions.java
+++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/PieOptions.java
@@ -16,101 +16,8 @@
package software.xdev.chartjs.model.options;
import software.xdev.chartjs.model.options.animation.PieAnimation;
-import software.xdev.chartjs.model.options.elements.ArcElements;
-public class PieOptions extends Options
+public class PieOptions extends DoughnutOptionsBase
{
-
- /**
- * Default {@code 50 - for doughnut, 0 - for pie}
- *
- * @see #setCutoutPercentage(Number cutoutPercentage)
- */
- protected Number cutoutPercentage;
-
- /**
- * Default {@code -0.5 * Math.PI}
- *
- * @see #setRotation(Number rotation)
- */
- protected Number rotation;
-
- /**
- * Default {@code 2 * Math.PI}
- *
- * @see #setCircumference(Number circumference)
- */
- protected Number circumference;
-
- protected ArcElements elements;
-
- /**
- * @see #setCutoutPercentage(Number cutoutPercentage)
- */
- public Number getCutoutPercentage()
- {
- return this.cutoutPercentage;
- }
-
- /**
- * The percentage of the chart that is cut out of the middle.
- */
- public PieOptions setCutoutPercentage(final Number cutoutPercentage)
- {
- this.cutoutPercentage = cutoutPercentage;
- return this;
- }
-
- /**
- * @see #setRotation(Number rotation)
- */
- public Number getRotation()
- {
- return this.rotation;
- }
-
- /**
- * Starting angle to draw arcs from
- */
- public PieOptions setRotation(final Number rotation)
- {
- this.rotation = rotation;
- return this;
- }
-
- /**
- * @see #setCircumference(Number circumference)
- */
- public Number getCircumference()
- {
- return this.circumference;
- }
-
- /**
- * Sweep to allow arcs to cover
- */
- public PieOptions setCircumference(final Number circumference)
- {
- this.circumference = circumference;
- return this;
- }
-
- /**
- * @return {@link ArcElements} instance, or {@code null} if not set
- */
- public ArcElements getElements()
- {
- return this.elements;
- }
-
- /**
- * @param elements an {@link ArcElements} instance, or {@code null}
- * @return this instance for method chaining
- */
- public PieOptions setElements(final ArcElements elements)
- {
- this.elements = elements;
- return this;
- }
}
diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/DoughnutAnimation.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/DoughnutAnimation.java
index 591f3889..d90bf7a4 100644
--- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/DoughnutAnimation.java
+++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/DoughnutAnimation.java
@@ -15,53 +15,6 @@
*/
package software.xdev.chartjs.model.options.animation;
-public class DoughnutAnimation extends Animation
+public class DoughnutAnimation extends DoughnutAnimationBase
{
- /**
- * Default {@code true}
- *
- * @see #setAnimateRotate(Boolean)
- */
- protected Boolean animateRotate;
-
- /**
- * Default {@code true}
- *
- * @see #setAnimateScale(Boolean)
- */
- protected Boolean animateScale;
-
- /**
- * @see #setAnimateRotate(Boolean)
- */
- public Boolean getAnimateRotate()
- {
- return this.animateRotate;
- }
-
- /**
- * If true, will animate the rotation of the chart.
- */
- public DoughnutAnimation setAnimateRotate(final Boolean animateRotate)
- {
- this.animateRotate = animateRotate;
- return this;
- }
-
- /**
- * @see #setAnimateScale(Boolean)
- */
- public Boolean getAnimateScale()
- {
- return this.animateScale;
- }
-
- /**
- * If true, will animate scaling the chart.
- */
- public DoughnutAnimation setAnimateScale(final Boolean animateScale)
- {
- this.animateScale = animateScale;
- return this;
- }
}
diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/DoughnutAnimationBase.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/DoughnutAnimationBase.java
new file mode 100644
index 00000000..d210baac
--- /dev/null
+++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/DoughnutAnimationBase.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2023 XDEV Software (https://xdev.software)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package software.xdev.chartjs.model.options.animation;
+
+/**
+ * @see ChartJS Source
+ */
+public abstract class DoughnutAnimationBase> extends Animation
+{
+ private Boolean animateRotate;
+ private Boolean animateScale;
+
+ public Boolean getAnimateRotate()
+ {
+ return this.animateRotate;
+ }
+
+ public DoughnutAnimationBase setAnimateRotate(final Boolean animateRotate)
+ {
+ this.animateRotate = animateRotate;
+ return this.self();
+ }
+
+ public Boolean getAnimateScale()
+ {
+ return this.animateScale;
+ }
+
+ public DoughnutAnimationBase setAnimateScale(final Boolean animateScale)
+ {
+ this.animateScale = animateScale;
+ return this.self();
+ }
+}
diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/PieAnimation.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/PieAnimation.java
index 83b0321d..4285b7a8 100644
--- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/PieAnimation.java
+++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/animation/PieAnimation.java
@@ -15,54 +15,6 @@
*/
package software.xdev.chartjs.model.options.animation;
-public class PieAnimation extends Animation
+public class PieAnimation extends DoughnutAnimationBase
{
-
- /**
- * Default {@code true}
- *
- * @see #setAnimateRotate(Boolean)
- */
- protected Boolean animateRotate;
-
- /**
- * Default {@code true}
- *
- * @see #setAnimateScale(Boolean)
- */
- protected Boolean animateScale;
-
- /**
- * @see #setAnimateRotate(Boolean)
- */
- public Boolean getAnimateRotate()
- {
- return this.animateRotate;
- }
-
- /**
- * If true, will animate the rotation of the chart.
- */
- public PieAnimation setAnimateRotate(final Boolean animateRotate)
- {
- this.animateRotate = animateRotate;
- return this;
- }
-
- /**
- * @see #setAnimateScale(Boolean)
- */
- public Boolean getAnimateScale()
- {
- return this.animateScale;
- }
-
- /**
- * If true, will animate scaling the chart.
- */
- public PieAnimation setAnimateScale(final Boolean animateScale)
- {
- this.animateScale = animateScale;
- return this;
- }
}
diff --git a/pom.xml b/pom.xml
index 452e6c86..5b012e1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
software.xdev
chartjs-java-model-root
- 2.5.1-SNAPSHOT
+ 2.6.0-SNAPSHOT
pom