function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vijaymindvijaymind 

apex:chart reRedner issue

Hi All,
I am having an issue with apex:chart reRendering, it does not work, each and every varible value getting set as expected but data does not display inside chart even data is there in controller.

Please help me out, development has been stuck. I have read many blogs but solution.
Sagar PareekSagar Pareek
Can you please share some code here?
vijaymindvijaymind
Hi Sagar Pareek,
Thanks for attentions
Below is the code

<apex:outputPanel layout="block" styleclass="boxScroll" style=" border:1px solid black; height:200px;">
                
                <table width="100%" border="0">
                    <tr>
                        <td><apex:commandButton value="Open Vs Close" style="background:lightblue;" action="{!chartDisplayOpenVsClose}" id="OpenVsCloseBtnID"/></td>
                        <td><apex:commandButton value="Engineers Performance" action="{!chartDisplayEngPerformance}" id="EnginnerID"/><!--reRender="outputPanelIdNew"--></td>
                        <td><apex:commandButton value="Target Actual Vs Achievement" action="{!chartDisplayTargetVsActual}" id="TargetActualID"/> <!--reRender="outputPanelIdNew"--></td>
                    </tr>
                    <tr>
                        <td colspan="3">                        
                            <apex:outputpanel layout="block" style="width:220px;Height:160px;">                                                                                                                                          
                                    <apex:outputPanel id="outputPanelIdNew">                                   
                                    <c:Chart chartName="{!chartType}"/>
                                    </apex:outputPanel>
                            </apex:outputpanel>
                        </td>
                    </tr>                                     
                </table>                
            </apex:outputPanel>


Controller methods.

public void chartDisplayOpenVsClose(){
        chartType = 'OpenVsClose';    
    }
    public void chartDisplayEngPerformance(){
        chartType = 'EngPerformance';
    }
    public void chartDisplayTargetVsActual(){
        chartType = 'TargetVsActual';   
    }

Component -



<apex:component controller="clsDashboardForService"> <apex:attribute name="chartName" type="string" description="Test"/> On Component - {!chartName} <apex:chart height="160" width="400" data="{!ChartOpenvsClose}" resizable="true" rendered="{!if(chartName='OpenVsClose',true,false)}"> <apex:axis type="Numeric" position="left" fields="count" title="Count"/> <apex:axis type="Category" position="bottom" fields="status" title="Case Status" grid="true"/> <apex:barSeries orientation="vertical" axis="bottom" xField="status" yField="count"/> </apex:chart> <apex:chart height="160" width="400" data="{!ChartEngineersPerformance}" resizable="true" rendered="{!if(chartName='EngPerformance',true,false)}"> <apex:axis type="Numeric" position="bottom" fields="overAllRating" title="Rating" maximum="10" minimum="0"/> <apex:axis type="Category" position="left" fields="engineerName" title="Engineers" grid="true"/> <apex:barSeries orientation="horizontal" axis="bottom" xField="overAllRating" yField="engineerName"/> </apex:chart> <apex:chart height="160" width="400" data="{!ChartTargetAcVsAch}" resizable="true" rendered="{!if(chartName='TargetVsActual',true,false)}"> <apex:axis type="Numeric" position="left" fields="totalAmount" title="Amount"/> <apex:axis type="Category" position="bottom" fields="ActualOrTarget" title="Target Vs Actual" grid="true"/> <apex:barSeries orientation="vertical" axis="bottom" xField="ActualOrTarget" yField="totalAmount"/> </apex:chart> </apex:component>


When I am cliking on butttons this highlighted {!chartName}  values is getting change to  (OpenVsClose/EngPerformance/ChartTargetAcVsAch) but still no data visible in chart even data exist into controller.


Thanks
Vijay
 
vijaymindvijaymind
I removed reRender atttibute later. I was adding reRender attribut Id outputPanelIdNew.
Sagar PareekSagar Pareek
Have you tried this without the component and rerendering the output panel? Try using the apex:chart within the output panel and rerender it.