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
kanavkhuranakanavkhurana 

Visualforce charting - Labels atop a grouped chart

Hi,

I am creating a grouped Visualforce chart as follows:

User-added image

The issue is that I am able to put a label, 'Low' in this case, only atop the first bar, ie, 'Attractiveness'. I need to able to do the same for the 'Our Presence' bar. My VF code is as follows:

<apex:page standardController="Account_Plan__c" extensions="LineAndBarController" showHeader="false" sidebar="false" readOnly="true">
    <apex:chart width="600" height="275" data="{!dataMap}">
        <apex:legend position="left"/>
        <apex:axis type="Numeric" position="left" fields="attractiveness,ourpresence"
            title="Rating" grid="true" minimum="0" maximum="3" steps="2">

        </apex:axis>
        <apex:axis type="Category" position="bottom" fields="buyingCentre"
            title="Corporate Buying Centres">
        </apex:axis>
        <apex:barSeries title="Attractiveness,Our Presence" orientation="vertical"
            axis="left" xField="buyingCentre" yField="attractiveness,ourpresence" tips="false" groupGutter="10" gutter="10">
            <apex:chartLabel field="label1" display="outside"/>
            <apex:chartLabel field="label2" display="outside"/>
            
        </apex:barSeries>
    </apex:chart>
</apex:page>

And the controller:
public with sharing class LineAndBarController {
    public class GraphData{
        public String buyingCentre;
        public Integer attractiveness;
        public Integer ourpresence;
        public String label1;
        public String label2;
        
    }
    public List<GraphData> dataMap{get;set;}
    public LineAndBarController(ApexPages.StandardController sc){

        dataMap = new List<GraphData>();

        
        GraphData graphData = new GraphData();
        graphData.buyingCentre = 'Global IT';
        graphData.attractiveness = 1;
        graphData.ourpresence = 2;
        graphData.label1='Low';
        graphData.label2='Medium';

        dataMap.add(graphData);

    }
    
  }
Note that I'm using two <apex:chartLabel> tags inside the <apex:barSeries> tag, however, only the first one seems to be taking effect.

Any help would be much appreciated! Thanks! :)