I have showing chart on a Visualforce Page in an <apex:outputPanel> pop up. It works the first time when the page is loaded. This first time also I do a re-render. But when I change the data based on conditions and rerender the outputpanel, it goes blank. But I am using outputText in same outputputPanel the chart is in and it works fine.

After clicking on submit button, it does not work.

Visualforce Page
I have used custom popup here..on that popup i need to show charts

<apex:outputPanel styleClass="customPopup" layout="block"   rendered="{!displayImpactPopup }" id="outputpanel1"> **//some code for displaying popup**
    <apex:chart id="chart1" height="150" width="400" data="{!dlist }" name="chartbar">
        <apex:axis type="Numeric" position="bottom" fields="data"
            grid="true" maximum="1500" minimum="0" />
             <apex:axis type="Category" position="left" fields="name"
                                       title="" grid="true" />
             <apex:barSeries orientation="horizontal" axis="left"
                              xField="data" yField="name">
             <apex:chartTips height="20" width="120" />

I have tried do many things for 3 days..Just not getting the chart displayed.

public static List<String> test()
    dlist = new List<String>();

    dlist .add(new dlist (32,'test1 '));
    dlist .add(new dlist (21,'test 2 '));
    dlist .add(new dlist (11,'test 3 ');
    dlist .add(new dlist (30,'test 4 '));

    return dlist ;
  • I have also tried using sample data...Its still didn't work..Data1 is normal wrapper from which i m passing data...
    – miku
    Mar 11 '14 at 17:45

What happens if you take the rendered="{!displayImpactPopup }" attribute out? My guess is for some reason, due to the rendered attribute, your chart is not rerendering properly. The rendered attribute can be somewhat finnicky with Visualforce.

First, try removing the rendered attribute to see if you can reload with the chart displayed. If that works, then try debugging the rendered attribute. A few things you can try are:

  1. Make sure displayImpactPopup is of type boolean, and is getting set correctly. To verify this, output it in your visualforce page for testing.
  2. Removing the space in the attribute (shouldn't matter but may effect it somehow)
  3. Change the attribute to rendered="{!IF(displayImpactPopup,true,false)}" (May not matter, but again, rendered attributes are finnicky with the way they handle boolean values)

Hope that helps.

  • Thanks James..You saved my day..Thanks for your help.It worked...I don't know why this issue was there...but it worked..You are a genius..:):) –
    – miku
    Mar 12 '14 at 4:19
  • How did you do that ? Can you share your code ?
    – user26482
    Nov 19 '15 at 14:10

I have still found out issues in rendering the chart conditionally toggling the "rendered" attribute. The other alternative which helped me was the "hidden" attribute in which case the chart would be rendered always but it's visibility is toggled.

Hope this helps.

  • I can also confirm this. There seems to be some issue with the apex:chart rendered attribute. This almost drove me nuts as the rendered toggling stopped working after a few iterations. Use the hidden attribute instead.
    – Richard N
    Dec 29 '15 at 18:06

Wrap it in a div and use the following inline style:

<div style="display: {!IF([you field here]=='Level System Program', 'always', 'none')};">
  • Wrap it in a div and use the following inline style: <div style="display: {!IF([you field here]=='Level System Program', 'always', 'none')};">
    – Brent
    Oct 17 '16 at 20:51
  • 1
    You can edit this into your answer.
    – Dave Humm
    Oct 17 '16 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.