Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for TimeScale #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/main/java/be/ceau/chart/options/scales/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 -}
Expand Down Expand Up @@ -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;
}
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/be/ceau/chart/options/scales/TimeScale.java
Original file line number Diff line number Diff line change
@@ -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;
}
}