From afaf79f8ef9ad328c342a92ac31649ea0ff45dc8 Mon Sep 17 00:00:00 2001 From: Robin Eggenkamp Date: Mon, 12 Feb 2018 14:05:20 +0100 Subject: [PATCH] Add support for TimeScale --- .../be/ceau/chart/options/scales/Time.java | 17 ++++----- .../ceau/chart/options/scales/TimeScale.java | 36 +++++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 src/main/java/be/ceau/chart/options/scales/TimeScale.java diff --git a/src/main/java/be/ceau/chart/options/scales/Time.java b/src/main/java/be/ceau/chart/options/scales/Time.java index 142b5ea..d9867aa 100644 --- a/src/main/java/be/ceau/chart/options/scales/Time.java +++ b/src/main/java/be/ceau/chart/options/scales/Time.java @@ -16,6 +16,7 @@ package be.ceau.chart.options.scales; import java.math.BigDecimal; +import java.util.Date; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonInclude; @@ -45,14 +46,14 @@ public class Time { * * @see #setMax(Time) */ - private Time max; + private Date max; /** * Default {@code -} * * @see #setMin(Time) */ - private Time min; + private Date min; /** * Default {@code -} @@ -120,31 +121,31 @@ public Time setIsoWeekday(Boolean isoWeekday) { } /** - * @see #setMax(Time) + * @see #setMax(Date) */ - public Time getMax() { + public Date getMax() { return this.max; } /** * If defined, this will override the data maximum */ - public Time setMax(Time max) { + public Time setMax(Date max) { this.max = max; return this; } /** - * @see #setMin(Time) + * @see #setMin(Date) */ - public Time getMin() { + public Date getMin() { return this.min; } /** * If defined, this will override the data minimum */ - public Time setMin(Time min) { + public Time setMin(Date min) { this.min = min; return this; } diff --git a/src/main/java/be/ceau/chart/options/scales/TimeScale.java b/src/main/java/be/ceau/chart/options/scales/TimeScale.java new file mode 100644 index 0000000..9fd2eb8 --- /dev/null +++ b/src/main/java/be/ceau/chart/options/scales/TimeScale.java @@ -0,0 +1,36 @@ +package be.ceau.chart.options.scales; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_EMPTY) +@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE) +public class TimeScale extends LinearScale { + + private final String type = "time"; + + private Time time; + private String distribution; + + public String getType() { + return this.type; + } + + public Time getTime() { + return time; + } + + public void setTime(Time time) { + this.time = time; + } + + public String getDistribution() { + return distribution; + } + + public void setDistribution(String distribution) { + this.distribution = distribution; + } +}