jsf - primefaces linechart not visible -


this .xhtml

<div id="detailed_div_graph" align="center">             <p:linechart id="linear" value="#{chartbean.linearmodel}" legendposition="e"                  title="medical data" miny="0" maxy="10" style="height:300px"/>         </div> 

this chartbean code:

public class chartbean implements serializable {  private cartesianchartmodel linearmodel;  public chartbean() {       createlinearmodel();   }  public cartesianchartmodel getlinearmodel() {       return linearmodel;   }   private void createlinearmodel() {       linearmodel = new cartesianchartmodel();        linechartseries series1 = new linechartseries();       series1.setlabel("bp");        series1.set(1, 2);       series1.set(2, 1);       series1.set(3, 3);       series1.set(4, 6);       series1.set(5, 8);        linearmodel.addseries(series1);   }    } 

what's wrong code?

here assume constructor called.

public chartbean() {       createlinearmodel();   } 

jsf has phases , should take account them.

if want createlinearmodel() method called @ first after bean first initialized, should annotate @postconstruct annotation

@postconstruct  private void createlinearmodel(){     ... } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -