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
arandallarandall 

Having trouble using Visualforce charting in Sandbox

Hi all,

 

I'm trying to experiment with the new generally available Visualforce charting in one of my sandboxes, and I've found myself stumped.  Here's the situation:

 

I've got an object called Teacher Implementation that has a master-detail relationship with an object called Class Implementation.  The Class Implementation object has a field called "# of students in class".  I would like to display a line graph on the Teacher Implementation record showing the number of students in the related classes, ordered by the created dates of the classes.

 

Here's my controller:

 

public class testTIControllerExtension {

private final Teacher_Implementation__c TI;

public testTIControllerExtension(ApexPages.StandardController stdController) {
this.TI = (Teacher_Implementation__c)stdController.getRecord();
}

 

//Create a method that retrieves the related classes
public List<Class_Implementation__c> getClasses() {
        return [SELECT name, createddate, Teacher_Implementation__c, of_Students_in_Class__c FROM Class_Implementation__c WHERE Teacher_Implementation__c = :ApexPages.currentPage().getParameters().get('id')];
}
}

 

and here is my VF page:

 

<apex:page standardController="Teacher_Implementation__c" extensions="testTIControllerExtension">
<apex:chart data="{!classes}" width="600" height="400">
<apex:axis type="Category" position="left" fields="createddate" title="Created Date"/>
<apex:axis type="Numeric" position="bottom" fields="of_Students_in_Class__c" title="Students"/>
<apex:lineSeries title="Closed-Lost" axis="left" xField="createddate" yField="of_Students_in_Class__c"
markerType="circle" markerSize="4" markerFill="#8E35EF"/>
</apex:chart>
<apex:dataTable value="{!classes}" var="c">
<apex:column headerValue="Created Date" value="{!c.createddate}"/>
<apex:column headerValue="Students" value="{!c.of_Students_in_Class__c}"/>
</apex:dataTable>
</apex:page>

 

Currently, this displays only a table of data, no chart.  This makes me think that my controller's working okay, but that there is something amiss with my VF page.  Then again, I don't feel like I have a great grasp of controller extensions, so something could certainly be wrong there, too.

 

I'd greatly appreciate any insight!

asish1989asish1989

Hi

   you need to raise a case for enable to apex:chart .After that You can use apex:chart.

  how to create case

     1-Go help link after login 

     3-click on Contact Support 

     4-create open case

 After two days You can use apex:chart happily

 

Did this post answers your questions if so please mark it solved.

 

Thnks

asish

 

 

arandallarandall

Even though my Sandbox has been upgraded to include the Winter '13 release?  Since charting's generally available in the Winter '13 release, I figure it should work in the sandbox.  Also, I'm not receiving any errors pertaining to <apex: chart> - is that common if I can't use <apex: chart> yet?

asish1989asish1989

Hi

  make sure that this field of_Students_in_Class__c never be blank in any record .

  Try to use bar chat and verticular column chart for date field .

 

 

 

Did this post answers your question if so please mark it solved.

 

 

Thanks

asish

cwall_sfdccwall_sfdc

Do you have your x and y axes reversed?  I think you want to plot the dates at the bottom and count on the left.  Over time chart.

 

See Javascript Console (Chrome Dev Tools, Firebug, etc) for Javascript errors.