I am using Primefaces Barchart and i want to show the data in the ChartSeries when link to any bar in barchart. My code is as below:
<p:chart type="bar" model="#{dailyreport.horizontalBarChart}" rendered="#{dailyreport.chartDate != null}" style="height:900px;width:900px;" widgetVar="bchart">
</p:chart>
and the horizontalBarChart i'm setting Map for Series and the values in the map is like ("00:14",10).
I know about primefaces interactive charts But how to get that particular item data which is clicked in the chart.I managed to do the below:
public void itemSelect(ItemSelectEvent event){
Integer seriesIndex = event.getSeriesIndex();
Integer itemIndex = event.getItemIndex();
HorizontalBarChartModel cModel = (HorizontalBarChartModel) ((org.primefaces.component.chart.Chart) event.getSource()).getModel();
List<ChartSeries> cData= cModel.getSeries();
Map<Object, Number> ct = cData.get(seriesIndex).getData();
}
How to get that particular item from map using itemIndex?