Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am trying to construct a basic line graph. I have a Visualforce page, and a Component I put inside this page. The idea is, once the search button is clicked, the section with the component becomes visible by setting a boolean variable in the controller.

In the component, I have two things: an outputText which says "hello", and an apex:chart. The weird thing is, the outputText is shown, but the apex chart is not when the button is pressed. The only way I can get the chart to show is by showing it at all times, not just when the button is pressed. Why would one element rerender and not the other? The apex:chart isn't throwing any firebug errors...

VF Page Code:

<apex:pageBlockSectionItem >
       <apex:commandButton value="Search" action="{!methodx}" rerender="container, container2, thePageBlock"/>
 </apex:pageBlockSectionItem>


<apex:outputPanel id="container2">  
   <apex:pageBlock rendered="{!showChart}">
      <apex:pageBlockSection id="myChart">
        <c:myComponent param="{!param}"/> 
      </apex:pageBlockSection>
   </apex:pageBlock>                        
 </apex:outputPanel>

Component Code:

<apex:component controller="MyChartController">
    <apex:attribute name="param" type="String" assignTo="{!myparam}" description="none"/>
    <apex:outputText value="hello"/>
    <apex:chart height="400" width="700" data="{!axisData}">
         <apex:axis type="Numeric" position="left" fields="field1" 
                grid="true"/>
         <apex:axis type="Category" position="bottom" fields="name"/>
         <apex:lineSeries axis="left" fill="true" xField="name" yField="field1"
             markerType="circle" markerSize="3" markerFill="#FF0000"/>
    </apex:chart>
</apex:component>
share|improve this question
    
Some controller code would be nice to see :) –  mast0r Jan 29 '13 at 20:17
    
If I remove the rendered="{!showChart}", the chart displays fine. So I don't think it's a problem with the controller :) –  George S. Jan 30 '13 at 11:20
add comment

2 Answers 2

up vote 2 down vote accepted

I solved it by extracting the apex:chart from the Component and putting it in the VF Page in the same place. Shouldn't make a difference afaik but it did.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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