i am trying to recreate a visualforce bar chart example as documented in here http://www.salesforce.com/us/developer/docs/pages/Content/pages_charting_overview_providing_data_controller_method.htm

I have copy pasted the code.and it doesnt give an error.But my result graph doesnt actually have any bars at all.Although can see is coming through.What should i change ?


public class oppcontro {
// Get a set of Opportunities
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [SELECT name, type, amount, closedate FROM Opportunity]));
            return setCon;

    public List<Opportunity> getOpportunities() {
         return (List<Opportunity>) setCon.getRecords();


    <apex:page controller="oppcontro">
        <apex:chart data="{!Opportunities}" width="600" height="400">
            <apex:axis type="Category" position="left" fields="Name" title="Opportunities"/>
            <apex:axis type="Numeric" position="bottom" fields="Amount" title="Amount"/>
            <apex:barSeries orientation="horizontal" axis="bottom" 
                xField="Name" yField="Amount"/>
        <apex:dataTable value="{!Opportunities}" var="opp">
            <apex:column headerValue="Opportunity" value="{!opp.name}"/>
            <apex:column headerValue="Amount" value="{!opp.amount}"/>


SCREENSHOT OF GRAPH enter image description here

JAVASCRIPT CONSOLE SCREENSHOTenter image description here

  • Do you see any javascript errors in the console? – Bob Buzzard May 13 '14 at 11:30
  • I should have checked that first..It says 'Visualforce Chart: Error loading configuration for chart 'jid0jid1': Did not find required field 'amount' in data for chart 'jid0jid1'. Make sure field was queried and/or provided and has a value.' ..Still dont understand why that error is thrown as amount is being passed through as per datatable display – sfdc99999 May 13 '14 at 11:37
  • Please ignore above..i was referring to an old log..i have attached a screenshot of log above..it looks no issues in it for me – sfdc99999 May 13 '14 at 11:44

Make this change (or the equivalent change in the axes) and the example will work:

<apex:barSeries orientation="horizontal" axis="bottom" xField="Amount" yField="Name"/>

This change ensures the correct type of value is used with the correct type of axis.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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