Reputation: 2174
I want to show the value (not percent, but the real value before calculating percentage) of each part of pieChart when I hover each one
here is my pieChart :
<p:pieChart id="mypie" extender="ext" value="#{statistiquesMB.pieModelRegions}"
legendPosition="e"
showDataLabels="true"
seriesColors="FFFFFF, FFFF00, FF00FF, FF0000, C0C0C0, 808080, 808000, 800080, 800000, 00FFFF, 00FF00, 008080, 008000, 0000FF, 000080, 000000"
style="width:900px;height:500px" sliceMargin="5" diameter="440" />
I don't find this option in the user guide of Primefaces.
Upvotes: 2
Views: 6011
Reputation: 1241
You have to do it manually with javascript as ska explain here.
They are using Primefaces 5.x, in your case you have to use the tag extender="pieExtender"
where pieExtender is the javascript function.
Better late than never...
Upvotes: 0
Reputation: 6383
Primefaces PieChart seems to based on jqPlot.
On the jqPlot site there is an example that shows the option: dataLabels: 'value'
.
So just set this attribute on your pieChart
component:
<p:pieChart
id="mypie"
dataFormat="value"
extender="ext"
value="#{statistiquesMB.pieModelRegions}"
legendPosition="e"
showDataLabels="true"
seriesColors="FFFFFF, FFFF00, FF00FF, FF0000, C0C0C0, 808080, 808000, 800080, 800000, 00FFFF, 00FF00, 008080, 008000, 0000FF, 000080, 000000"
style="width:900px;height:500px" sliceMargin="5" diameter="440" />
Upvotes: 3