com.jongsoft.highchart.axis.Marker Maven / Gradle / Ivy
/*
* The MIT License
*
* Copyright 2016 Jong Soft.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.jongsoft.highchart.axis;
import com.jongsoft.Builder;
import com.jongsoft.highchart.common.GraphColor;
public class Marker implements Builder {
public enum MarkerSymbol {
CIRCLE("circle"), SQUARE("square"), DIAMOND("diamond"), TRIANGLE("triangle"), TRIANGLE_DOWN("triangle-down"), RECTANGLE("rect");
private final String type;
private MarkerSymbol(String type) {
this.type = type;
}
@Override
public String toString() {
return type;
}
}
private Boolean enabled;
private GraphColor fillColor;
private GraphColor color;
private Number height;
private GraphColor lineColor;
private Number lineWidth;
private Number radius;
private MarkerSymbol symbol;
private Number width;
private final T parent;
public Marker(T parent) {
this.parent = parent;
}
/**
* Enable or disable the point marker. If null, the markers are hidden when the data is dense, and shown for more widespread data points.
*
* Default null
*/
public Marker setEnabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* The fill color of the point marker. When null, the series' or point's color is used.
*/
public Marker setColor(GraphColor color) {
this.color = color;
return this;
}
/**
* The fill color of the point marker. When null, the series' or point's color is used.
*/
public Marker setFillColor(GraphColor fillColor) {
this.fillColor = fillColor;
return this;
}
/**
* Image markers only. Set the image width explicitly. When using this option, a width must also be set.
*
* Default: null
*/
public Marker setHeight(Number height) {
this.height = height;
return this;
}
/**
* The color of the point marker's outline. When null, the series' or point's color is used.
*
* Default: #FFFFFF
*/
public Marker setLineColor(GraphColor lineColor) {
this.lineColor = lineColor;
return this;
}
/**
* The width of the point marker's outline.
*
* Default: 0
*/
public Marker setLineWidth(Number lineWidth) {
this.lineWidth = lineWidth;
return this;
}
/**
* The radius of the point marker.
*
* Default: 4
*/
public Marker setRadius(Number radius) {
this.radius = radius;
return this;
}
/**
* A predefined shape or symbol for the marker. When null, the symbol is pulled from options.symbols.
*/
public Marker setSymbol(MarkerSymbol symbol) {
this.symbol = symbol;
return this;
}
/**
* Image markers only. Set the image width explicitly. When using this option, a height must also be set.
*
* Default: null
*/
public void setWidth(Number width) {
this.width = width;
}
@Override
public T build() {
return parent;
}
public Boolean getEnabled() {
return enabled;
}
public GraphColor getColor() {
return color;
}
public Number getHeight() {
return height;
}
public GraphColor getLineColor() {
return lineColor;
}
public Number getLineWidth() {
return lineWidth;
}
public Number getRadius() {
return radius;
}
public MarkerSymbol getSymbol() {
return symbol;
}
public Number getWidth() {
return width;
}
public GraphColor getFillColor() {
return fillColor;
}
}