Hello,
Looks like <rich:chartXAxis label="Year"/> always considered the last one.I have created it to display based on the rendered condition But it is not working as expected.
There is no help from Flot Chart Forum too...
https://groups.google.com/forum/#!forum/flot-graphs
<a4j:outputPanel rendered="#{!chartreport.hiddenMonthsTextSelected.isEmpty()}"> <rich:chartXAxis label="ShortId-Pages" id="yearxaxisMonth" style="color:black !important;" rendered="#{!chartreport.hiddenMonthsTextSelected.isEmpty()}"/> </a4j:outputPanel> <a4j:outputPanel rendered="#{chartreport.hiddenMonthsTextSelected.isEmpty()}"> <rich:chartXAxis label="Year" id="yearxaxis" style="color:black !important;" rendered="#{chartreport.hiddenMonthsTextSelected.isEmpty()}"/> </a4j:outputPanel> <rich:chartYAxis label="Total Visitor Count" style="color:black !important;"/>
See the below image for your Reference,Always display Year.
To avoid the above problem ,If i create 2 <rich:chart in the same xhtml page means error like ,
SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost/127.0.0.1:8080-5) Error Rendering View[/chartreport.xhtml]: java.lang.IllegalArgumentException: Data model is not valid for this chart type.
at org.richfaces.renderkit.ChartRendererBase$VisitChart.visit(ChartRendererBase.java:428) [richfaces-4.5.16.Final.jar:4.5.16.Final]
at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1652) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1]
So how to resolve the label issue for chart with dynamic labels.????
Thank you.
Why don't you put the condition into the label? label="#{bean.isEmpty() ? 'label1' : 'label2'}" or better yet set the proper label in the bean when you click on the radio button?