Line graph does not render (p: lineChart) [closed]

1

xhtml code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>
<h:body>
    <h:form id="form">
        <p:lineChart id="candidatosPesquisa" value="#{linhaBean.linhaModel}"
            legendPosition="e" title="Pesquisa Eleitoral" minY="0" maxY="100"
            style="height:500px;">
        </p:lineChart>
    </h:form>
</h:body>
</html>

java code

package graficopizza;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.primefaces.model.chart.CartesianChartModel;
import org.primefaces.model.chart.ChartSeries;

@SessionScoped
@ManagedBean(name="linhaBean")
public class LinhaBean {

    private CartesianChartModel linhaModel;

    public CartesianChartModel getLinhaModel() {
        return linhaModel;
    }

    public LinhaBean(){
        popularLinhaModel();
    }

    private void popularLinhaModel() {
        linhaModel = new CartesianChartModel();
        ChartSeries candidato1 = new ChartSeries();
        candidato1.setLabel("Candidato 1");
        candidato1.set("Pesquisa 1", 10);
        candidato1.set("Pesquisa 2", 20);
        candidato1.set("Pesquisa 3", 40);
        candidato1.set("Pesquisa 4", 50);

        ChartSeries candidato2 = new ChartSeries();
        candidato2.setLabel("Candidato 2");
        candidato2.set("Pesquisa 1", 15);
        candidato2.set("Pesquisa 2", 29);
        candidato2.set("Pesquisa 3", 12);
        candidato2.set("Pesquisa 4", 40);

        ChartSeries candidato3 = new ChartSeries();
        candidato3.setLabel("Candidato 3");
        candidato3.set("Pesquisa 1", 60);
        candidato3.set("Pesquisa 2", 70);
        candidato3.set("Pesquisa 3", 90);
        candidato3.set("Pesquisa 4", 10);


        linhaModel.addSeries(candidato1);
        linhaModel.addSeries(candidato2);
        linhaModel.addSeries(candidato3);
    }
}
    
asked by anonymous 16.01.2015 / 19:58

0 answers