org.primefaces.model.charts.optionconfig.elements.ElementsArc Maven / Gradle / Ivy
/*
* The MIT License
*
* Copyright (c) 2009-2023 PrimeTek Informatics
*
* 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 org.primefaces.model.charts.optionconfig.elements;
import java.io.IOException;
import java.io.Serializable;
import org.primefaces.util.ChartUtils;
import org.primefaces.util.FastStringWriter;
/**
* Arcs are used in the polar area, doughnut and pie charts.
*/
public class ElementsArc implements Serializable {
private static final long serialVersionUID = 1L;
private String backgroundColor;
private String borderColor;
private Number borderWidth = 2;
/**
* Gets the backgroundColor
*
* @return backgroundColor
*/
public String getBackgroundColor() {
return backgroundColor;
}
/**
* Sets the backgroundColor
*
* @param backgroundColor Arc fill color.
*/
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
/**
* Gets the borderColor
*
* @return borderColor
*/
public String getBorderColor() {
return borderColor;
}
/**
* Sets the borderColor
*
* @param borderColor Arc stroke color.
*/
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
/**
* Gets the borderWidth
*
* @return borderWidth
*/
public Number getBorderWidth() {
return borderWidth;
}
/**
* Sets the borderWidth
*
* @param borderWidth Arc stroke width.
*/
public void setBorderWidth(Number borderWidth) {
this.borderWidth = borderWidth;
}
/**
* Write the arc options of Elements
*
* @return options as JSON object
* @throws java.io.IOException If an I/O error occurs
*/
public String encode() throws IOException {
try (FastStringWriter fsw = new FastStringWriter()) {
ChartUtils.writeDataValue(fsw, "borderWidth", this.borderWidth, false);
ChartUtils.writeDataValue(fsw, "backgroundColor", this.backgroundColor, true);
ChartUtils.writeDataValue(fsw, "borderColor", this.borderColor, true);
return fsw.toString();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy