jsf - how to change line colors in primefaces 5.1 line chart -
i'm using primefaces 5.1 , tried create line chart,its working fine. want customize background color ,grids, line colors.
my xhtml:
<p:chart type="line" model="#{chartviewline.linemodel1}" style="height:300px; width:570px;"/>
my java file:
private linechartmodel linemodel1; @postconstruct public void init() { createlinemodels(); } public linechartmodel getlinemodel1() { return linemodel1; } private void createlinemodels() { linemodel1 = initlinearmodel(); linemodel1.setlegendcols(3); linemodel1.setlegendposition("e"); axis yaxis = linemodel1.getaxis(axistype.y); yaxis.setmin(0); yaxis.setmax(10); } private linechartmodel initlinearmodel() { linechartmodel model = new linechartmodel(); linechartseries series1 = new linechartseries(); series1.setlabel("series 1"); series1.set(1, 2); series1.set(2, 1); series1.set(3, 3); linechartseries series2 = new linechartseries(); series2.setlabel("series 2"); series2.set(1, 6); series2.set(2, 3); series2.set(3, 2); model.addseries(series1); model.addseries(series2); return model; }
the above code working fine need change ui. how can achieve this?
i suggest reading jqplot documentation
java code
linemodel.setseriescolors("58ba27,ffcc33,f74a4a,f52f2f,a30303"); linemodel.setextender("chartextender");
Comments
Post a Comment