I am developing a web application in JSF in which I am using PrimeFaces bar chart. I want to change the legend position. I verified Primefaces: Charts and Legend position in that post they use,
<p:barChart id="stackedKWH"
value="#{kwhSalesBeanManager.kwhSalesChart}"
legendPosition="e" style="height:300px;width:800px"
title="kWh Sales by Type"
stacked="true"
barMargin="10"
min="0"
max="125000000"/>
but in primeface 5.1 there is not <p:barchart/>
<p:chart type="bar" model="#{chartView.barModel}" style="height:300px"/>
My output is look like,
Expected output:
How can I achieve this? Does someone suggest me the correct way?
You can do it on the bean:
You can still use the model.setLegendPosition("w"); in your bean. If you want more specific control you can modify the css of the legend table. The class is called table.jqplot-table-legend.
Something like this:
XHTML:
CSS:
Perhaps you can make it work without the !important, but i had no luck. But i still hope it helps :)