Anybody know why the following code does not work in SharePoint:
Here's the error:

*Message: Script error*
*Line: 0*
*Char: 0*
*Code: 0*
*URI: 
https://www.google.com/uds/api/visualization/1.0/4ea8b4974b307a4ef65cf50fe2dc4df2/format+en,default+en,ui+en,corechart+en.I.js*

Here's the SharePoint site:
http://isaac.issharepoint.com/Shared%20Documents/pieChart.aspx


Here's the code:

<!-- Step 1 - Load libraries -->
<script type="text/javascript" 
src="http://isaac.issharepoint.com/Script/jquery-1.8.2.min.js"; 
language="javascript"></script>
<script type="text/javascript" 
src="http://isaac.issharepoint.com/Script/jquery.SPServices-0.7.2.min.js"; 
language="javascript"></script>
<script type="text/javascript" 
src="http://isaac.issharepoint.com/Script/utilityFunctions.js"; 
language="javascript"></script>
<script type="text/javascript" src="https://www.google.com/jsapi";></script>


<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("buildChartFunc");
//The Google Visualization library implements several classes and methods that 
you'll need to manipulate all charts
google.load("visualization", "1", {packages:["corechart"]});

//$(document).ready(function() { 
function buildChartFunc()
{

var Over30=0;
var Under30=0;

var anArray = new Array();

   // Initialize data object to hold chart data
    var dataAn = new google.visualization.DataTable();
    dataAn.addColumn('string', 'Month');
    dataAn.addColumn('string', 'Analyst');
    dataAn.addColumn('number', 'Correspondence Closed Over 30');
        
<!-- Step 2 - Prepare your data -->     
//push names of analyst into an array to use later
$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Analyst",
        CAMLViewFields: "<ViewFields><FieldRef 
Name='Title'></FieldRef></ViewFields>",
        CAMLQuery: "<Query><OrderBy><FieldRef Name='Title' 
/></OrderBy></Query>",
    completefunc: function (xData, Status) {
        //alert(xData.responseXML.xml);
      $(xData.responseXML).SPFilterNode("z:row").each(function() { 
                        anArray.push({
                                Analyst: $(this).attr("ows_Title"),
                                Count:   0
                                });                     
      });
     }
  }); 
  
$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Log",
        CAMLViewFields: "<ViewFields><FieldRef Name='Days'></FieldRef><FieldRef 
Name='Analyst'></FieldRef></ViewFields>",
        CAMLQuery: "<Query><OrderBy><FieldRef Name='Days' /></OrderBy></Query>",
    completefunc: function (xData, Status) {
        //alert(xData.responseXML.xml);
      $(xData.responseXML).SPFilterNode("z:row").each(function() {              
//As you loop through the array, if 'Analyst' name equals what's in the array, 
then increment
                for (var x=0; x<anArray.length; x++)
                {
                        if ($(this).attr("ows_Analyst") == anArray[x].Analyst)
                        {
                                anArray[x].Count += 1;
                        }
                }                               
      });
     }
  });
  
   $.each(anArray, function (index, value) {                                    
                                                                                
                                                                                
                                
        dataAn.addRow([anArray[index].Analyst,anArray[index].Count]);
    }); 

          
         // Create and draw the visualization.
        new 
google.visualization.ColumnChart(document.getElementById('visualization')).
            draw(dataAn,
                 {title:"Conformance Log",
                  width:900, height:400,
                  hAxis: {title: "Analyst"}}
            );    

}
</script>
<table>
        <tr><td><div id="visualization" style="width: 650px; height: 
400px;"></div></td></tr>
</table>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to