I need to change the dashboard called “Sales Team Dashboard”. The first top left dashboard needs to show as a percentage of goal. The graph should look similar to the below. One thing to note is that each person has a different goal… so we need to be able to specify by user.
There is a Number field on User object named Goals which need to be utilized on this chart.
I am new to Visualforce charting, but if it is to be utilized, how can we group the records on axis based on the dates available.
See below is the controller code I may want to use. But I am not able to figure out how to write the visualforce code in order display in grouping. Please suggest.
////// Controller code
public class ChartController2 {
// Return a list of data points for a chart
public List<Data> getData() {
return ChartController2.getChartData();
}
// Make the chart data available via JavaScript remoting
@RemoteAction
public static List<Data> getRemoteData() {
return ChartController2.getChartData();
}
// The actual chart data; needs to be static to be
// called by a @RemoteAction method
public static List<Data> getChartData() {
List<Data> data = new List<Data>();
data.add(new Data('User1', 30, '25 Apr'));
data.add(new Data('User2', 44, '25 Apr'));
data.add(new Data('User3', 25, '25 Apr'));
data.add(new Data('User4', 74, '26 Apr'));
data.add(new Data('User5', 65, '26 Apr'));
data.add(new Data('User6', 33, '26 Apr'));
data.add(new Data('User7', 92, 27 Apr'));
data.add(new Data('User8', 87, '27 Apr'));
data.add(new Data('User9', 34, '27 Apr'));
data.add(new Data('User10', 78, '27 Apr'));
data.add(new Data('User11', 80, '28 Apr'));
data.add(new Data('User12', 17, '28 Apr'));
return data;
}
// Wrapper class
public class Data {
public String name { get; set; }
public Integer rating { get; set; }
public String ratingDate {get;set;}
public Data(String name, Integer rating, String ratingDate) {
this.name = name;
this.rating = rating;
this.ratingDate = ratingDate;
}
}
}
<!-- Visualforce page: -->
<apex:page controller="ChartController2">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:chart height="400" width="700" data="{!data}" >
<apex:legend position="left"/>
<!-- <apex:axis type="Numeric" position="right" fields="data1" title="Revenue (millions)" grid="true"/> -->
<apex:axis type="Category" position="left" fields="ratingDate" title="Day of the Week">
<apex:chartLabel rotate="315"/>
</apex:axis>
<apex:barSeries title="name" orientation="horizontal" axis="left" xField="name" yField="ratingDate" colorSet="red"/>
<!-- <apex:barSeries title="Data1" orientation="vertical" axis="right" xField="name" yField="data1" colorSet="red" stacked="false">
<apex:chartTips height="20" width="120"/>
</apex:barSeries>
<apex:barSeries title="Data2" orientation="vertical" axis="right" xField="name" yField="data2" colorSet="green" stacked="false">
<apex:chartTips height="20" width="120"/>
</apex:barSeries>
<apex:barSeries title="Data3" orientation="vertical" axis="right" xField="name" yField="data3" stacked="false">
<apex:chartTips height="20" width="120" />
</apex:barSeries> -->
<!-- <apex:barSeries title="Data1" orientation="vertical" axis="right" xField="name" yField="data1,data2,data3" colorSet="red"/> -->
</apex:chart>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
As you can see the output below, the date is not grouping here. Please suggest.