+ Start a Discussion

bar chart legend component of salesforce.( need urgent )

Below is my code . i just want to display a vertical bar chart categerised by location . here location is a custom object .

legend is not displaying all categery colors , only one color is displaying like "bluecolor - data" . why? 



<apex:page controller="barChartController" title="Bar Chart">
<apex:chart height="300" width="700" data="{!barData}" legend="true" >
<apex:barSeries colorSet="#0b6fce,#e27001,#78c953" colorsProgressWithinSeries="true" stacked="false" orientation="vertical" axis="bottom" xField="name" yField="data">
<apex:chartTips height="20" width="120"/>

<apex:axis type="Category" position="bottom" fields="name" title="location" grid="false" dashSize="1"/>

<apex:axis type="Numeric" position="left" fields="data" title="employees" grid="true" gridFill="true" steps="1"/>
<apex:legend position="right" />

<apex:lineSeries title="Closed-Won" axis="left" xField="name" yField="data"/>
<apex:lineSeries title="Closed-Lost" axis="left" xField="name" yField="data"/>


and the class is:

public class barChartController
    public List<wrapper> getBarData()
         list<location__c> l = [select id,name,no_of_employees__c,(Select Name From Employees__r) from location__c];
         List<wrapper> data = new List<wrapper>();
         for(location__c loc: l)
               data.add(new wrapper(loc.name,loc.no_of_employees__c));
    return data;

// Wrapper class
public class wrapper
    public String name { get; set; }
    public decimal data { get; set; }
    public wrapper(String name, decimal data)
    this.name = name;
    this.data = data;