org.chartistjsf.component.chart.renderer.LineRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ChartistJSF Show documentation
Show all versions of ChartistJSF Show documentation
Highly Customizable Responsive Charts for JSF based on PrimeFaces
package org.chartistjsf.component.chart.renderer;
import java.io.IOException;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.chartistjsf.component.chart.Chart;
import org.chartistjsf.model.chart.Axis;
import org.chartistjsf.model.chart.AxisType;
import org.chartistjsf.model.chart.ChartSeries;
import org.chartistjsf.model.chart.LineChartModel;
import org.primefaces.util.ComponentUtils;
public class LineRenderer extends BaseChartistRenderer {
private static final Logger logger = Logger.getLogger(LineRenderer.class.getName());
@Override
protected void encodeData(FacesContext context, Chart chart) throws IOException {
ResponseWriter writer = context.getResponseWriter();
LineChartModel model = (LineChartModel) chart.getModel();
if (model.getLabels().isEmpty()) {
logger.log(Level.SEVERE,
"Make sure to set the required lables for LineChart, otherwise the chart won't render");
return;
}
writer.write(",data:{");
writer.write("labels: [");
for (Iterator
© 2015 - 2025 Weber Informatics LLC | Privacy Policy