From 7181c06818f6d8984be23cca39038e685d11df36 Mon Sep 17 00:00:00 2001 From: Simon Sperlich Date: Wed, 6 Dec 2023 17:28:09 +0100 Subject: [PATCH] Added: Feature - Scale -> Ticks -> beginAtZero This adds the possibility to begin the scale at zero instead of at the minimum attribute value --- .../org/vaadin/addons/chartjs/options/scale/Ticks.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/vaadin/addons/chartjs/options/scale/Ticks.java b/src/main/java/org/vaadin/addons/chartjs/options/scale/Ticks.java index 924e41b..08dcbe6 100644 --- a/src/main/java/org/vaadin/addons/chartjs/options/scale/Ticks.java +++ b/src/main/java/org/vaadin/addons/chartjs/options/scale/Ticks.java @@ -16,6 +16,7 @@ public class Ticks extends And implements JsonBuilder { private static final long serialVersionUID = -4740687096401461147L; private Boolean autoSkip; + private Boolean beginAtZero; private Boolean display; private String fontColor; private String fontFamily; @@ -42,6 +43,12 @@ public Ticks autoSkip(boolean autoSkip) { return this; } + /** If true, scale starts at 0. */ + public Ticks beginAtZero(boolean beginAtZero) { + this.beginAtZero = beginAtZero; + return this; + } + /** If true, show the ticks. */ public Ticks display(boolean display) { this.display = display; @@ -155,6 +162,7 @@ public JsonObject buildJson() { JsonObject map = Json.createObject(); JUtils.putNotNull(map, "display", display); JUtils.putNotNull(map, "autoSkip", autoSkip); + JUtils.putNotNull(map, "beginAtZero", beginAtZero); JUtils.putNotNull(map, "fontColor", fontColor); JUtils.putNotNull(map, "fontFamily", fontFamily); JUtils.putNotNull(map, "fontSize", fontSize);