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
Mahurrinah SimsMahurrinah Sims 

How would I add my custom SF fields to this chart?

I am creating a VF page with a google chart that I want to put on my account page layout. Right now I am testing in a sandbox. Here is the code:
<apex:page standardController="Account">
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {

  var data = google.visualization.arrayToDataTable([
    ['Year', 'Sales'],
    ['2011',  100],
    ['2012',  200],
    ['2013',  300],
    ['2014',  400]
  ]);

  var options = {
    title: 'Company Performance',
    hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
  };

  var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));

  chart.draw(data, options);

}
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>
   </apex:page>
This works fine. However, for the "sales" numbers I want to use my custom SF fields so that it will display the appropriate information for each account record. How would I do this?
KaranrajKaranraj
Check this sample code which helps you to build google chart with the dynamic data and fields  http://developer.force.com/cookbook/recipe/easy-visualforce-charts-with-javascript-remoting--google-charts-api