diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/LineOptions.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/LineOptions.java index ffd6006..b137ed4 100644 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/LineOptions.java +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/LineOptions.java @@ -17,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.JsonValue; import software.xdev.chartjs.model.options.animation.DefaultAnimation; import software.xdev.chartjs.model.options.elements.LineElements; @@ -37,6 +38,11 @@ public class LineOptions extends Options protected Boolean spanGaps; protected LineElements elements; + /** + * The base axis of the dataset. 'x' for horizontal lines and 'y' for vertical lines. + */ + protected IndexAxis indexAxis; + /** * @see #setShowLine(Boolean) */ @@ -100,4 +106,35 @@ public LineOptions setElements(final LineElements elements) this.elements = elements; return this; } + + /** + * @return {@link IndexAxis} value or {@code null} if not set + */ + public IndexAxis getIndexAxis() + { + return indexAxis; + } + + /** + * @param indexAxis {@link IndexAxis} value or {@code null} + * @return this instance for method chaining + */ + public LineOptions setIndexAxis(IndexAxis indexAxis) + { + this.indexAxis = indexAxis; + return this; + } + + public enum IndexAxis + { + X, + Y; + + @JsonValue + @Override + public String toString() + { + return super.toString().toLowerCase(); + } + } }