You need to sign in to do that
Don't have an account?
Line Chart not populating
Hi,
Am trying to create Line Chart but its not populating anything on VF page.
VF:
<apex:page controller="ChartController" showHeader="false" sidebar="false">
<apex:chart height="400" width="700" data="{!Data}">
<apex:axis type="Numeric" fields="data1" grid="true" title="No. of Opportunities" position="left" />
<apex:axis type="Category" fields="name" grid="true" title="Months" position="bottom" />
<apex:lineSeries title="abcd" axis="left" xField="name" yField="data1" fill="true" markerSize="4" markerFill="blue" markerType="cross"/>
</apex:chart>
</apex:page>
Class:
public with sharing class ChartController {
public static List<Data> getData() {
return ChartController.getChartData();
}
@RemoteAction
public static List<Data> getRemoteData() {
return ChartController.getChartData();
}
public static List<Data> getChartData() {
List<Data> data =new List<Data>();
data.add(new data('jan',10,20));
data.add(new data('feb',50,10));
data.add(new data('march',20,40));
data.add(new data('june',30,30));
data.add(new data('april',60,10));
return data;
}
public class Data {
public String Name{get; set;}
public Integer data1{get; set;}
public Integer data2{get; set;}
public Data(String name, Integer data1, Integer data2) {
this.name= name;
this.data1= data1;
this.data2= data2;
}
}
}
As i can see the code its a javaScript error.
Visualforce Chart: Error loading configuration for chart 'jid0jid1': Did not find required field 'name' in data for chart 'jid0jid1'. Make sure field was queried and/or provided and has a value."
Try this its working fine in my org :)
If answer helps you,Please mark it as best answer to help others :)
Thanks