+ Start a Discussion
RarLopzRarLopz 

Visualforce Charting - Chart looks different than sample example

Why does my chart has month names on wedges but the sample example doesn't ? 

In my sandbox I  copied and pasted exact code from the salesforce documentation as shown here https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_charting_overview_simple_example.htm

Created a Apex Controller, Created a Wrapper Class, Created a VFP.
 
The output as shown in this example doesn't have month names on the wedges. However the output I get has month names on the wedges. This example doesn't uses rendererFn property. I am wondering why i see month names and the example shown does'nt?

This is my output 
User-added imageHowever I was expecting to see this 

User-added image

Here the Code exactly as copied from the documentation 
 
<apex:page controller="PieChartController" title="Pie Chart">
    <apex:chart height="350" width="450" data="{!pieData}">
        <apex:pieSeries dataField="data" labelField="name"/>
        <apex:legend position="right"/>
    </apex:chart>
</apex:page>



public class PieChartController {
    public List<PieWedgeData> getPieData() {
        List<PieWedgeData> data = new List<PieWedgeData>();
        data.add(new PieWedgeData('Jan', 30));
        data.add(new PieWedgeData('Feb', 15));
        data.add(new PieWedgeData('Mar', 10));
        data.add(new PieWedgeData('Apr', 20));
        data.add(new PieWedgeData('May', 20));
        data.add(new PieWedgeData('Jun', 5));
        return data;
    }

    // Wrapper class
    public class PieWedgeData {

        public String name { get; set; }
        public Integer data { get; set; }

        public PieWedgeData(String name, Integer data) {
            this.name = name;
            this.data = data;
        }
    }
}

 
Best Answer chosen by RarLopz
Dushyant SonwarDushyant Sonwar
Hi RarLopz,

You need to use apex:chartLabel tag to remove the label.
<apex:chartLabel display="none" />

After using this your code will be something like this below.
<apex:page controller="PieChartController" title="Pie Chart">
    <apex:chart height="350" width="450" data="{!pieData}" >
        <apex:pieSeries dataField="data" labelField="name">
            <apex:chartLabel display="none" />
        </apex:pieSeries>
        <apex:legend position="right"/>
    </apex:chart>
</apex:page>

Hope this helps.

All Answers

Dushyant SonwarDushyant Sonwar
Hi RarLopz,

You need to use apex:chartLabel tag to remove the label.
<apex:chartLabel display="none" />

After using this your code will be something like this below.
<apex:page controller="PieChartController" title="Pie Chart">
    <apex:chart height="350" width="450" data="{!pieData}" >
        <apex:pieSeries dataField="data" labelField="name">
            <apex:chartLabel display="none" />
        </apex:pieSeries>
        <apex:legend position="right"/>
    </apex:chart>
</apex:page>

Hope this helps.
This was selected as the best answer
RarLopzRarLopz
Thanks @DushyantSonwar. That worked.