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
JN22JN22 

VF Charting

Hello,

 

I have created a VF page and a custom controller that creates some tables (similar to Salesforce reports) and a pie chart.  The controller and VF page below work fine for the tables.  The controller saves fine with the code as is, but when I uncomment the pie chart section in my VF page, I get the error below:

 

Error: ScorecardDB1: Invalid qname for tag 'apex:'

 

Does anyone know what causes this?

 

Controller:

 

public class theController1 {

 

public list<Client_Status_Scorecard__c> Scorecard { get; set; }
public list<Client_Status_Scorecard__c> Scorecard2 { get; set; }

 

public theController1() {
Scorecard = [SELECT id,Name,Client_Name__c,Type_of_Client__c,Projected_Annual_Revenue__c,Overall_Percent__c,Overall_Score__c,Overall_Status_Icon__c,Renewal_Date__c
FROM Client_Status_Scorecard__c
WHERE Type_of_Client__c <> 'Health Plan'
ORDER BY Projected_Annual_Revenue__c DESC limit 3];

 

Scorecard2 = [SELECT id,Name,Client_Name__c,Type_of_Client__c,Projected_Annual_Revenue__c,Overall_Percent__c,Overall_Score__c,Overall_Status_Icon__c,Renewal_Date__c
FROM Client_Status_Scorecard__c
WHERE Type_of_Client__c = 'Health Plan'
ORDER BY Projected_Annual_Revenue__c DESC limit 10];

 

}

public AggregateResult[] getChartData() {

 

return [SELECT Overall_Status__c Status, SUM(Projected_Annual_Revenue__c) Revenue
FROM Client_Status_Scorecard__c
WHERE Type_of_Client__c = 'Health Plan'
GROUP BY Overall_Status__c];

 

}

 

}

 

 

VF Page:

 

<apex:page controller="theController1" >

<apex:form >

<apex:pageBlock >

<style>

body .bPageBlock .pbBody .red .pbSubheader {
background-color:#8DA5C4;
font-size:12pt;
font-family:verdana;
}

body .bPageBlock .pbBody .red .pbSubheader h3
{
color:white;
}

.TableHeader1 {text-align:left;background-color:#9BC7FA;font-size:10pt;font-family:Arial;border-bottom-style:solid;border-color:#236FBD;border-width:2px}
.TableHeader2 {text-align:center;background-color:#9BC7FA;font-size:10pt;font-family:Arial;border-bottom-style:solid;border-color:#236FBD;border-width:2px}

</style>

 

<apex:outputPanel styleClass="red" layout="block">

 

<apex:pageBlockSection collapsible="true" columns="1" title="Top 10 By Market (Employers/Distributors)">

 

<apex:dataTable width="80%" columns="6" value="{!Scorecard}" var="csc">

 

<apex:column width="20%" headerValue="Scorecard #" headerClass="TableHeader1">
<apex:commandLink action="/{!csc.Id}" value="{!csc.Name}"/>
</apex:column>

<apex:column width="20%" Value="{!csc.Client_Name__c}" headerValue="Client Name" headerClass="TableHeader1"/>
<apex:column width="20%" Value="{!csc.Projected_Annual_Revenue__c}" headerValue="Revenue ($k)" headerClass="TableHeader2" style="text-align:center"/>
<apex:column width="20%" Value="{!csc.Overall_Percent__c}" headerValue="Score(%)" headerClass="TableHeader2" style="text-align:center"/>
<apex:column width="20%" Value="{!csc.Overall_Score__c}" headerValue="Score (pts)" headerClass="TableHeader2" style="text-align:center"/>
<apex:column width="20%" Value="{!csc.Overall_Status_Icon__c}" headerValue="Status" headerClass="TableHeader2" style="text-align:center"/>

 

</apex:dataTable>

 

</apex:pageBlockSection>

 

</apex:outputPanel>

 

</apex:pageBlock>

 

 

<apex:pageBlock >

<style>

body .bPageBlock .pbBody .red .pbSubheader {
background-color:#8DA5C4;
font-size:12pt;
font-family:verdana;
}

body .bPageBlock .pbBody .red .pbSubheader h3
{
color:white;
}

.TableHeader {background-color:#9BC7FA;font-size:10pt;font-family:Arial;border-bottom-style:solid;border-color:#236FBD;border-width:2px}

</style>


<apex:outputPanel styleClass="red" layout="block">

 

<apex:pageBlockSection collapsible="true" columns="1" title="Top 10 By Market (Health Plans)">

 

<apex:dataTable width="80%" columns="6" value="{!Scorecard2}" var="csc" >

 

<apex:column width="20%" headerValue="Scorecard #" headerClass="TableHeader1">
<apex:commandLink action="/{!csc.Id}" value="{!csc.Name}"/>
</apex:column>
<apex:column width="20%" Value="{!csc.Client_Name__c}" headerValue="Client Name" headerClass="TableHeader1"/>
<apex:column width="20%" Value="{!csc.Projected_Annual_Revenue__c}" headerValue="Revenue ($k)" headerClass="TableHeader2" style="text-align:center"/>
<apex:column width="20%" Value="{!csc.Overall_Percent__c}" headerValue="Score(%)" headerClass="TableHeader2" style="text-align:center"/>
<apex:column width="20%" Value="{!csc.Overall_Score__c}" headerValue="Score (pts)" headerClass="TableHeader2" style="text-align:center"/>
<apex:column width="20%" Value="{!csc.Overall_Status_Icon__c}" headerValue="Status" headerClass="TableHeader2" style="text-align:center"/>

 

</apex:dataTable>

 

</apex:pageBlockSection>

 

</apex:outputPanel>

 

</apex:pageBlock>

 


<apex:pageBlock >

<style>

body .bPageBlock .pbBody .red .pbSubheader {
background-color:#8DA5C4;
font-size:12pt;
font-family:verdana;
}

body .bPageBlock .pbBody .red .pbSubheader h3
{
color:white;
}

.TableHeader {background-color:#9BC7FA;font-size:10pt;font-family:Arial;border-bottom-style:solid;border-color:#236FBD;border-width:2px}

</style>


<apex:outputPanel styleClass="red" layout="block">
<apex:pageBlockSection collapsible="true" columns="1" title="At Risk">

 

<Table columns="1" width="100%">
<tr>
<td width="100%" >Revenue At Risk</td>
</tr>
<tr>
<td width="100%" >
<apex:chart height="300" width="600" data="{!chartData}">  /*FIXED LINE*/

*/<apex:
height="300" width="600" data="{!chartData}">  ORIGINAL INCORRECT LINE*/
<apex:pieSeries dataField="Revenue" labelField="Status" colorSet="#FF0000,#3EAD3E,#F6FF00"/>
<apex:legend position="bottom" font="10px Arial"/>
</apex:chart>
</td>
</tr>
</Table>

 

</apex:pageBlockSection>

 

</apex:outputPanel>

 

</apex:pageBlock>


</apex:form>

 

</apex:page>

 

 

Best Answer chosen by Admin (Salesforce Developers) 
JN22JN22

Nevermind, I figured out the error.  I was missing my <apex:chart> tag in my VF page.  Somehow I must have put in a return splitting up the tag and deleting the word chart.  Certainly a cryptic error for that.  For anyone interested, I updated the code and highlighted the section in red.  Thanks.

All Answers

JN22JN22

Nevermind, I figured out the error.  I was missing my <apex:chart> tag in my VF page.  Somehow I must have put in a return splitting up the tag and deleting the word chart.  Certainly a cryptic error for that.  For anyone interested, I updated the code and highlighted the section in red.  Thanks.

This was selected as the best answer
Vadm SfVadm Sf
Hello JN,
Can you just help me on below requirement of VF Chart.
Based on the data, If i click on each row of First Table, It has to show Line  & bar Chart.


User-added image 

Thank you so much for time.

Best Regards,