默认
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

107 lines
3.0 KiB

package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
import com.fr.stable.StringUtils;
import java.util.List;
public class ChartOption implements OptionProvider {
private ToolTip tooltip;
private String backGroundColor;
private VisualMap visualMap;
private Axis3D axis3Dx;
private Axis3D axis3Dy;
private Axis3D axis3Dz;
private Grid3D grid3D;
private List<Series> series;
public ToolTip getTooltip() {
return tooltip;
}
public void setTooltip(ToolTip tooltip) {
this.tooltip = tooltip;
}
public String getBackGroundColor() {
return backGroundColor;
}
public void setBackGroundColor(String backGroundColor) {
this.backGroundColor = backGroundColor;
}
public VisualMap getVisualMap() {
return visualMap;
}
public void setVisualMap(VisualMap visualMap) {
this.visualMap = visualMap;
}
public Axis3D getAxis3Dx() {
return axis3Dx;
}
public void setAxis3Dx(Axis3D axis3Dx) {
this.axis3Dx = axis3Dx;
}
public Axis3D getAxis3Dy() {
return axis3Dy;
}
public void setAxis3Dy(Axis3D axis3Dy) {
this.axis3Dy = axis3Dy;
}
public Axis3D getAxis3Dz() {
return axis3Dz;
}
public void setAxis3Dz(Axis3D axis3Dz) {
this.axis3Dz = axis3Dz;
}
public Grid3D getGrid3D() {
return grid3D;
}
public void setGrid3D(Grid3D grid3D) {
this.grid3D = grid3D;
}
public List<Series> getSeries() {
return series;
}
public void setSeries(List<Series> series) {
this.series = series;
}
public JSONObject getJSONObject(){
JSONObject option = JSONKit.create();
option.put("tooltip",this.getTooltip() == null ? JSONKit.create() : this.getTooltip().getJSONObject());
if(!StringUtils.isBlank(this.getBackGroundColor())){
option.put("backgroundColor",this.getBackGroundColor());
}
option.put("visualMap",this.getVisualMap() == null ? new VisualMap().getJSONObject() : this.getVisualMap().getJSONObject());
option.put("xAxis3D",this.getAxis3Dx()==null ? new Axis3D().getJSONObject() : this.getAxis3Dx().getJSONObject());
option.put("yAxis3D",this.getAxis3Dy()==null ? new Axis3D().getJSONObject() : this.getAxis3Dy().getJSONObject());
option.put("zAxis3D",this.getAxis3Dz()==null ? new Axis3D().getJSONObject() : this.getAxis3Dz().getJSONObject());
option.put("grid3D",this.getGrid3D() == null ? JSONKit.create() : this.getGrid3D().getJSONObject());
JSONArray seriesJSONArray = JSONKit.createJSONArray();
if(this.getSeries() != null){
for (int i = 0; i < this.getSeries().size(); i++) {
seriesJSONArray.put(this.getSeries().get(i).getJSONObject());
}
}
option.put("series",seriesJSONArray);
return option;
}
}