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
AshleyMorrisAshleyMorris 

Creating charts with Winter 13 in a TabPanel tab

Hello, 

 

I have a problem with creating charts using the new feature from the Winter 13 release.  Using a SOQL query in a controller extension I can get the data to populate a line or bar chart on the page, no probelm.  However, when I put the chart into a Tab in a tabPanel block, it fails to create the chart if the following is true:

 

- When the chart is not on the first tab to be selected ( <apex:tabPanel selectedTab="notChartTab" ...)

- When the tab panel switch type is not set to server ( <apex:tabPanel switchType="client" ...)

 

I tested this in Firefox 15 and IE9.

 

Using the switch type 'server' is probably the better workaround, as this page is for an Account with the customer support case graph under a 'support' tab, the first tab being for the account details.  But using the 'server' setting makes moving from tab to tab very slow/unresponsive and therefore undesirable.  

 

I have also tried to use the <apex:tab rerender='chartid' ...   to see if that allows the chart to be drawn when the tab is selcted, but no luck.

 

AshleyMorrisAshleyMorris

this code allows you to reproduce what I see using the pie chart example from the developer guide:

 

<apex:page controller="PieChartController" title="Pie Chart">
    <style>
        .activeTab {
            background-color: #236fbd;
            background-image: none;
            color: white;
        }
        .inactiveTab {
            background-color: lightgrey;
            background-image: none;
            color: black;
        }
    </style>
    
new chart
<apex:tabPanel inactiveTabClass="inactiveTab" selectedTab="Chart" switchType="client" tabClass="activeTab" >
<apex:tab id="tabCont2" label="Other2" name="Other2">
First page
</apex:tab>
<apex:tab id="tabContact" label="Chart" name="Chart">
<apex:chart height="350" width="450" data="{!pieData}">
              <apex:axis type="Numeric" position="left" fields="data" title="stuff"/>
            <apex:axis type="Category" position="bottom" fields="name" title="Month of the Year"/>
          <!-- <apex:pieSeries dataField="data" labelField="name"/> -->
          <apex:lineSeries xField="name" yField="data" axis="left" />
         
<apex:legend position="right"/>
</apex:chart>
</apex:tab>
<apex:tab id="tabCont" label="Other" name="Other">
Hello
</apex:tab>
<apex:tab id="tabCont1" label="Other1" name="Other1">
Hello again
</apex:tab>
</apex:tabPanel>
</apex:page>
Soul AgesSoul Ages

No luck with this one? Have the same problem.

richard.brescia1.3909178856829783E12richard.brescia1.3909178856829783E12
We are seeing this same behavior.

https://developer.salesforce.com/forums/ForumsMain?id=906F000000098o2IAA - same issue another forum.

If we find anything out, will repost.