package binky.ofc2plugin.charts.config;
import org.json.simple.JSONObject;
import binky.ofc2plugin.charts.json.OFCNumber;
public class YAxis extends Axis {
private Number tickLength = 1;
private Number offset = 0;
private Number max;
private Number min;
@SuppressWarnings("unchecked")
@Override
public JSONObject encode() {
JSONObject axis = new JSONObject();
// encode the y-axis data
axis.put("stroke", super.getStroke());
axis.put("tick_length", this.tickLength);
axis.put("colour", super.getColourHex());
axis.put("grid_colour", super.getGridColourHex());
axis.put("offset", offset);
if (max != null) {
axis.put("max", new OFCNumber(max));
}
if (min != null) {
axis.put("min", new OFCNumber(min));
}
if (super.getLabels() != null) {
JSONObject labels = new JSONObject();
labels.put("labels", super.getLabels());
axis.put("labels", labels);
}
return axis;
}
public Number getTickLength() {
return tickLength;
}
public void setTickLength(Number tickLength) {
this.tickLength = tickLength;
}
public Number getOffset() {
return offset;
}
public void setOffset(Number offset) {
this.offset = offset;
}
public Number getMax() {
return max;
}
public void setMax(Number max) {
this.max = max;
}
public Number getMin() {
return min;
}
public void setMin(Number min) {
this.min = min;
}
}