I'm not sure when this started happening, but all of my visualizations 
(mostly line charts) have stopped working in my blogger blog posts. 
Instead, they display the following error (in browser, not the javascript 
console):

Object #<Ap> has no method 'G'×

When I take the HTML/Javascript code that I submitted as a blogpost and 
just create a standalone page locally, the chart works fine. It seems like 
there is something that Blogger is wrapping around my post that is mucking 
things up. I tried googling the error above with little success.

Here is an example page that is not working: 
http://www.inpredictable.com/2013/08/home-underdogs-are-no-longer-good-bet.html

Here is the code submitted through the blogger interface:

<script src="http://www.google.com/jsapi"; type="text/javascript"></script>
<script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
      function drawHun() {

  // Create and populate the data table.
  var dhun = new google.visualization.DataTable();
  dhun.addColumn('string', 'season');
  dhun.addColumn('number', '% covered');
  dhun.addColumn({type:'string', role:'annotation'});
  dhun.addColumn('number', 'break even');
  dhun.addRows([
['1989',0.500,null,0.5238],
['1990',0.500,null,0.5238],
['1991',0.537,null,0.5238],
['1992',0.531,null,0.5238],
['1993',0.534,null,0.5238],
['1994',0.516,null,0.5238],
['1995',0.533,null,0.5238],
['1996',0.609,null,0.5238],
['1997',0.522,null,0.5238],
['1998',0.545,null,0.5238],
['1999',0.565,null,0.5238],
['2000',0.486,null,0.5238],
['2001',0.553,null,0.5238],
['2002',0.593,null,0.5238],
['2003',0.486,null,0.5238],
['2004',0.469,'Levitt publishes paper',0.5238],
['2005',0.373,null,0.5238],
['2006',0.556,null,0.5238],
['2007',0.483,null,0.5238],
['2008',0.451,null,0.5238],
['2009',0.454,null,0.5238],
['2010',0.494,null,0.5238],
['2011',0.529,null,0.5238],
['2012',0.479,null,0.5238]
]);

        // Create and draw the visualization.
        new google.visualization.LineChart(document.getElementById('dhun')).
            draw(dhun, {width: 600, height: 400,
                        legend:{position:'top',fontName:'Verdana'},
                        
hAxis:{maxAlternation:1,title:'season',titleTextStyle:'Verdana',slantedText:false},
                        
series:{0:{pointSize:4},1:{pointSize:0,color:'gray'}},
                        chartArea: {left: 60, top: 40, width:"80%", height: 
"70%"},
                        title:'NFL Home Underdogs Against the Spread',
                        titleTextStyle:{fontName:'Verdana'}}
                );
      }

      google.setOnLoadCallback(drawHun);
</script>
<a href="http://commons.wikimedia.org/wiki/File%3AUnderdog-Macys-1979.jpg"; 
style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" 
title="By Jon Harder (User JonHarder) [GFDL 
(http://www.gnu.org/copyleft/fdl.html), CC-BY-SA-3.0 
(http://creativecommons.org/licenses/by-sa/3.0/) or CC-BY-2.5 
(http://creativecommons.org/licenses/by/2.5)], via Wikimedia Commons"><img 
alt="Underdog-Macys-1979" height="273" 
src="//upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Underdog-Macys-1979.jpg/512px-Underdog-Macys-1979.jpg"
 
width="320" /></a>In an <a 
href="http://pricetheory.uchicago.edu/levitt/Papers/LevittWhyAreGamblingMarkets2004.pdf";
 
target="_blank">oft-cited 2004 paper</a>, Steven Levitt (of <a 
href="http://freakonomics.com/"; target="_blank">Freakonomics</a> fame) 
investigated the behavior of gambling markets. Using a unique dataset 
comprised of bets made in an NFL handicapping contest, Levitt concluded 
that, contrary to conventional wisdom, bookmakers do not set point spreads 
to equalize the amount of money placed on either side of the spread. 
Instead, Levitt postulated that bookmakers willingly accept these 
imbalances in an effort to maximize their <i>own</i> profits.<br />
<br />
A bookmaker can increase profits beyond their nominal "<a 
href="http://en.wikipedia.org/wiki/Vigorish"; target="_blank">vig</a>" by 
exploiting bettor biases. Levitt cited home underdogs as one example of 
this bettor bias that bookmakers could exploit. Using data from the 
1980-2001 seasons, there were 1,483 games in which the home team was the 
underdog. Of those games, the home team covered 53.3% of the time 
(significant at the 0.5% level).<br />
<br />
<!--more--><br />
<h3>
Results from the 1989-2012 Seasons</h3>
<div>
I don't have data going back to 1980, but my dataset (from <a 
href="http://sportsdatabase.com/";>sportsdatabase.com</a>) does go back to 
1989, and the results from 1989-2003 (Levitt published in 2004) are 
consistent with the 1980-2001 data. From 1989-2003, there were 1,121 games 
in which the home team was the underdog. Of those games, the home team 
covered 53.5% of the time (significant at the 0.8% level).</div>
<div>
<br /></div>
<div>
So how have home underdogs fared since Levitt published his 2004 paper? Not 
so well. From 2004-2012, there were 766 games in which the home team was 
the underdog. They covered just 47.8% of the time, nearly significant at 
the 10% level (but in the wrong direction). The graph below summarizes the 
results by season and compares them to the "breakeven" percentage of 52.38% 
(how often a bettor would have to win in order to break even against the 
standard vig).</div>
<div>
<br /></div>
<div id="dhun">
<br /></div>
The above chart illustrates why gambling on sports can be so challenging to 
do successfully.  In 2004, you had a betting strategy with a plausible 
rationale and statistical significance out the wazoo. And you would have 
gone broke following it.

-- 
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