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>