Created
October 12, 2013 13:39
-
-
Save patilv/6950116 to your computer and use it in GitHub Desktop.
Horizontal Stack Bar 100% Storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialize libraries required | |
library(rCharts) | |
library(reshape2) | |
meansconferences=read.csv("https://raw.github.com/patilv/ESPNBball/master/meansconferences.csv") | |
# Mean statistics for all WCC and Big 12 teams for seasons 2001-2002 through 2012-2013 | |
# mean Points.Per.Game, mean Games.Played, mean Minutes,mean Rebounds.Per.Game, mean Assists.Per.Game, mean Steals.Per.Game,mean Blocks.Per.Game, | |
# mean Turnovers.Per.Game, mean Field.Goal.Percent, mean Free.Throw.Percent, mean Three.Point.FieldGoal.Percent | |
# For more info on how this dataset was generated, | |
# please see blog post at http://analyticsandvisualization.blogspot.com/2013/08/short-tales-of-two-ncaa-basketball.html | |
meltmeansconferences=melt(meansconferences[-c(1,10:14)], id.vars=c("Conference","Year")) # Remove the first irrelevant index column and few additional ones to keep this clean | |
# Horizontal Stacked bars chart 100% Storyboard | |
d1=dPlot(y="Year", x="value",data=meltmeansconferences, groups="variable",type="bar") # looking at the entire data instead of subset | |
d1$yAxis(type="addCategoryAxis", orderRule="Year") | |
d1$xAxis(type="addPctAxis") # instead of addMeasureAxis used in the Horizontal Stacked Bar | |
d1$set(storyboard = "Conference") # chart changes by conference | |
d1$legend( | |
x = 0, | |
y = 0, | |
width = 500, | |
height = 75, | |
horizontalAlign = "right" | |
) | |
d1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<link rel='stylesheet' href="http://netdna.bootstrapcdn.com/bootswatch/2.3.1/cosmo/bootstrap.min.css"> | |
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css" > | |
<link rel='stylesheet' href="http://getbootstrap.com/2.3.2/assets/js/google-code-prettify/prettify.css"> | |
<link rel='stylesheet' href="http://aozora.github.io/bootplus/assets/css/docs.css"> | |
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script> | |
<script src='http://dimplejs.org/dist/dimple.v1.min.js' type='text/javascript'></script> | |
<style> | |
.rChart { | |
display: block | |
margin: auto auto; | |
width: 100%; | |
height: 400px; | |
} | |
/* | |
body { | |
margin-top: 60px; | |
} | |
*/ | |
</style> | |
</head> | |
<body> | |
<div class='container'> | |
<div class='row'> | |
<div class='span8'> | |
<div class="bs-docs-example"> | |
<div id='chart191c1189404' class='rChart dimple'> | |
</div> | |
<br/> | |
<pre><code class='r'># Initialize libraries required | |
library(rCharts) | |
library(reshape2) | |
meansconferences=read.csv("https://raw.github.com/patilv/ESPNBball/master/meansconferences.csv") | |
# Mean statistics for all WCC and Big 12 teams for seasons 2001-2002 through 2012-2013 | |
# mean Points.Per.Game, mean Games.Played, mean Minutes,mean Rebounds.Per.Game, mean Assists.Per.Game, mean Steals.Per.Game,mean Blocks.Per.Game, | |
# mean Turnovers.Per.Game, mean Field.Goal.Percent, mean Free.Throw.Percent, mean Three.Point.FieldGoal.Percent | |
# For more info on how this dataset was generated, | |
# please see blog post at http://analyticsandvisualization.blogspot.com/2013/08/short-tales-of-two-ncaa-basketball.html | |
meltmeansconferences=melt(meansconferences[-c(1,10:14)], id.vars=c("Conference","Year")) # Remove the first irrelevant index column and few additional ones to keep this clean | |
# Horizontal Stacked bars chart 100% Storyboard | |
d1=dPlot(y="Year", x="value",data=meltmeansconferences, groups="variable",type="bar") # looking at the entire data instead of subset | |
d1$yAxis(type="addCategoryAxis", orderRule="Year") | |
d1$xAxis(type="addPctAxis") # instead of addMeasureAxis used in the Horizontal Stacked Bar | |
d1$set(storyboard = "Conference") # chart changes by conference | |
d1$legend( | |
x = 0, | |
y = 0, | |
width = 500, | |
height = 75, | |
horizontalAlign = "right" | |
) | |
d1 | |
</code></pre> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
var opts = { | |
"dom": "chart191c1189404", | |
"width": 700, | |
"height": 400, | |
"x": "value", | |
"y": "Year", | |
"groups": "variable", | |
"type": "bar", | |
"storyboard": "Conference", | |
"id": "chart191c1189404" | |
}, | |
data = [ | |
{ | |
"Conference": "Big 12", | |
"Year": "2001-2002", | |
"variable": "Points.Per.Game", | |
"value": 6.1312 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2002-2003", | |
"variable": "Points.Per.Game", | |
"value": 6.0194 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2003-2004", | |
"variable": "Points.Per.Game", | |
"value": 5.6993 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2004-2005", | |
"variable": "Points.Per.Game", | |
"value": 6.0481 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2005-2006", | |
"variable": "Points.Per.Game", | |
"value": 5.6291 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2006-2007", | |
"variable": "Points.Per.Game", | |
"value": 5.7265 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2007-2008", | |
"variable": "Points.Per.Game", | |
"value": 5.7159 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2008-2009", | |
"variable": "Points.Per.Game", | |
"value": 5.9037 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2009-2010", | |
"variable": "Points.Per.Game", | |
"value": 6.0588 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2010-2011", | |
"variable": "Points.Per.Game", | |
"value": 5.8793 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2011-2012", | |
"variable": "Points.Per.Game", | |
"value": 5.9682 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2012-2013", | |
"variable": "Points.Per.Game", | |
"value": 5.4843 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2001-2002", | |
"variable": "Points.Per.Game", | |
"value": 5.7096 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2002-2003", | |
"variable": "Points.Per.Game", | |
"value": 6.1101 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2003-2004", | |
"variable": "Points.Per.Game", | |
"value": 5.9015 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2004-2005", | |
"variable": "Points.Per.Game", | |
"value": 5.7985 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2005-2006", | |
"variable": "Points.Per.Game", | |
"value": 5.8382 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2006-2007", | |
"variable": "Points.Per.Game", | |
"value": 6.1341 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2007-2008", | |
"variable": "Points.Per.Game", | |
"value": 5.6439 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2008-2009", | |
"variable": "Points.Per.Game", | |
"value": 5.9086 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2009-2010", | |
"variable": "Points.Per.Game", | |
"value": 5.8532 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2010-2011", | |
"variable": "Points.Per.Game", | |
"value": 5.9925 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2011-2012", | |
"variable": "Points.Per.Game", | |
"value": 5.5357 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2012-2013", | |
"variable": "Points.Per.Game", | |
"value": 5.7382 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2001-2002", | |
"variable": "Games.Played", | |
"value": 23.848 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2002-2003", | |
"variable": "Games.Played", | |
"value": 24.333 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2003-2004", | |
"variable": "Games.Played", | |
"value": 23.985 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2004-2005", | |
"variable": "Games.Played", | |
"value": 23.797 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2005-2006", | |
"variable": "Games.Played", | |
"value": 22.619 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2006-2007", | |
"variable": "Games.Played", | |
"value": 24.691 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2007-2008", | |
"variable": "Games.Played", | |
"value": 26.188 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2008-2009", | |
"variable": "Games.Played", | |
"value": 26.066 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2009-2010", | |
"variable": "Games.Played", | |
"value": 26.044 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2010-2011", | |
"variable": "Games.Played", | |
"value": 24.111 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2011-2012", | |
"variable": "Games.Played", | |
"value": 25.597 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2012-2013", | |
"variable": "Games.Played", | |
"value": 25.107 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2001-2002", | |
"variable": "Games.Played", | |
"value": 23.481 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2002-2003", | |
"variable": "Games.Played", | |
"value": 23.078 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2003-2004", | |
"variable": "Games.Played", | |
"value": 22.919 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2004-2005", | |
"variable": "Games.Played", | |
"value": 22.912 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2005-2006", | |
"variable": "Games.Played", | |
"value": 21.853 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2006-2007", | |
"variable": "Games.Played", | |
"value": 24.523 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2007-2008", | |
"variable": "Games.Played", | |
"value": 25.333 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2008-2009", | |
"variable": "Games.Played", | |
"value": 25.266 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2009-2010", | |
"variable": "Games.Played", | |
"value": 24.23 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2010-2011", | |
"variable": "Games.Played", | |
"value": 25.172 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2011-2012", | |
"variable": "Games.Played", | |
"value": 23.807 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2012-2013", | |
"variable": "Games.Played", | |
"value": 27.153 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2001-2002", | |
"variable": "Minutes", | |
"value": 16.391 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2002-2003", | |
"variable": "Minutes", | |
"value": 16.931 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2003-2004", | |
"variable": "Minutes", | |
"value": 16.533 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2004-2005", | |
"variable": "Minutes", | |
"value": 16.946 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2005-2006", | |
"variable": "Minutes", | |
"value": 16.581 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2006-2007", | |
"variable": "Minutes", | |
"value": 16.349 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2007-2008", | |
"variable": "Minutes", | |
"value": 16.187 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2008-2009", | |
"variable": "Minutes", | |
"value": 16.328 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2009-2010", | |
"variable": "Minutes", | |
"value": 16.586 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2010-2011", | |
"variable": "Minutes", | |
"value": 16.758 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2011-2012", | |
"variable": "Minutes", | |
"value": 17.393 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2012-2013", | |
"variable": "Minutes", | |
"value": 16.257 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2001-2002", | |
"variable": "Minutes", | |
"value": 16.264 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2002-2003", | |
"variable": "Minutes", | |
"value": 17.643 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2003-2004", | |
"variable": "Minutes", | |
"value": 17.093 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2004-2005", | |
"variable": "Minutes", | |
"value": 16.701 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2005-2006", | |
"variable": "Minutes", | |
"value": 16.921 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2006-2007", | |
"variable": "Minutes", | |
"value": 17.609 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2007-2008", | |
"variable": "Minutes", | |
"value": 16.721 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2008-2009", | |
"variable": "Minutes", | |
"value": 17.971 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2009-2010", | |
"variable": "Minutes", | |
"value": 16.566 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2010-2011", | |
"variable": "Minutes", | |
"value": 17.087 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2011-2012", | |
"variable": "Minutes", | |
"value": 16.193 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2012-2013", | |
"variable": "Minutes", | |
"value": 17.077 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2001-2002", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.9457 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2002-2003", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.8868 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2003-2004", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6526 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2004-2005", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.697 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2005-2006", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6037 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2006-2007", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6118 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2007-2008", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6449 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2008-2009", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7412 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2009-2010", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.8221 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2010-2011", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7496 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2011-2012", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7907 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2012-2013", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6321 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2001-2002", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.66 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2002-2003", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7705 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2003-2004", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6807 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2004-2005", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6301 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2005-2006", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7191 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2006-2007", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7364 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2007-2008", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6174 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2008-2009", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7867 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2009-2010", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.6576 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2010-2011", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7784 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2011-2012", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.5321 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2012-2013", | |
"variable": "Rebounds.Per.Game", | |
"value": 2.7031 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2001-2002", | |
"variable": "Assists.Per.Game", | |
"value": 1.229 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2002-2003", | |
"variable": "Assists.Per.Game", | |
"value": 1.2047 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2003-2004", | |
"variable": "Assists.Per.Game", | |
"value": 1.1263 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2004-2005", | |
"variable": "Assists.Per.Game", | |
"value": 1.2398 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2005-2006", | |
"variable": "Assists.Per.Game", | |
"value": 1.2261 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2006-2007", | |
"variable": "Assists.Per.Game", | |
"value": 1.1301 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2007-2008", | |
"variable": "Assists.Per.Game", | |
"value": 1.0514 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2008-2009", | |
"variable": "Assists.Per.Game", | |
"value": 1.1125 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2009-2010", | |
"variable": "Assists.Per.Game", | |
"value": 1.1713 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2010-2011", | |
"variable": "Assists.Per.Game", | |
"value": 1.1319 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2011-2012", | |
"variable": "Assists.Per.Game", | |
"value": 1.1597 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2012-2013", | |
"variable": "Assists.Per.Game", | |
"value": 1.0586 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2001-2002", | |
"variable": "Assists.Per.Game", | |
"value": 1.1237 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2002-2003", | |
"variable": "Assists.Per.Game", | |
"value": 1.1915 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2003-2004", | |
"variable": "Assists.Per.Game", | |
"value": 1.1933 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2004-2005", | |
"variable": "Assists.Per.Game", | |
"value": 1.1324 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2005-2006", | |
"variable": "Assists.Per.Game", | |
"value": 1.1456 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2006-2007", | |
"variable": "Assists.Per.Game", | |
"value": 1.1955 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2007-2008", | |
"variable": "Assists.Per.Game", | |
"value": 1.0962 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2008-2009", | |
"variable": "Assists.Per.Game", | |
"value": 1.1695 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2009-2010", | |
"variable": "Assists.Per.Game", | |
"value": 1.0496 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2010-2011", | |
"variable": "Assists.Per.Game", | |
"value": 1.1552 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2011-2012", | |
"variable": "Assists.Per.Game", | |
"value": 1.0836 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2012-2013", | |
"variable": "Assists.Per.Game", | |
"value": 1.1092 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2001-2002", | |
"variable": "Steals.Per.Game", | |
"value": 0.60797 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2002-2003", | |
"variable": "Steals.Per.Game", | |
"value": 0.61085 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2003-2004", | |
"variable": "Steals.Per.Game", | |
"value": 0.5927 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2004-2005", | |
"variable": "Steals.Per.Game", | |
"value": 0.64662 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2005-2006", | |
"variable": "Steals.Per.Game", | |
"value": 0.61567 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2006-2007", | |
"variable": "Steals.Per.Game", | |
"value": 0.56103 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2007-2008", | |
"variable": "Steals.Per.Game", | |
"value": 0.58333 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2008-2009", | |
"variable": "Steals.Per.Game", | |
"value": 0.51765 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2009-2010", | |
"variable": "Steals.Per.Game", | |
"value": 0.53897 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2010-2011", | |
"variable": "Steals.Per.Game", | |
"value": 0.51778 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2011-2012", | |
"variable": "Steals.Per.Game", | |
"value": 0.55426 | |
}, | |
{ | |
"Conference": "Big 12", | |
"Year": "2012-2013", | |
"variable": "Steals.Per.Game", | |
"value": 0.555 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2001-2002", | |
"variable": "Steals.Per.Game", | |
"value": 0.49333 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2002-2003", | |
"variable": "Steals.Per.Game", | |
"value": 0.56202 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2003-2004", | |
"variable": "Steals.Per.Game", | |
"value": 0.56 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2004-2005", | |
"variable": "Steals.Per.Game", | |
"value": 0.56912 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2005-2006", | |
"variable": "Steals.Per.Game", | |
"value": 0.55956 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2006-2007", | |
"variable": "Steals.Per.Game", | |
"value": 0.56515 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2007-2008", | |
"variable": "Steals.Per.Game", | |
"value": 0.54394 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2008-2009", | |
"variable": "Steals.Per.Game", | |
"value": 0.56328 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2009-2010", | |
"variable": "Steals.Per.Game", | |
"value": 0.52734 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2010-2011", | |
"variable": "Steals.Per.Game", | |
"value": 0.53881 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2011-2012", | |
"variable": "Steals.Per.Game", | |
"value": 0.52429 | |
}, | |
{ | |
"Conference": "West Coast", | |
"Year": "2012-2013", | |
"variable": "Steals.Per.Game", | |
"value": 0.55191 | |
} | |
], | |
xAxis = { | |
"type": "addPctAxis", | |
"showPercent": false | |
}, | |
yAxis = { | |
"type": "addCategoryAxis", | |
"showPercent": false, | |
"orderRule": "Year" | |
}, | |
zAxis = [], | |
colorAxis = [], | |
legend = { | |
"x": 0, | |
"y": 0, | |
"width": 500, | |
"height": 75, | |
"horizontalAlign": "right" | |
}; | |
var svg = dimple.newSvg("#" + opts.id, opts.width, opts.height); | |
//data = dimple.filterData(data, "Owner", ["Aperture", "Black Mesa"]) | |
var myChart = new dimple.chart(svg, data); | |
if (opts.bounds) { | |
myChart.setBounds(opts.bounds.x, opts.bounds.y, opts.bounds.width, opts.bounds.height);//myChart.setBounds(80, 30, 480, 330); | |
} | |
//dimple allows use of custom CSS with noFormats | |
if(opts.noFormats) { myChart.noFormats = opts.noFormats; }; | |
//for markimekko and addAxis also have third parameter measure | |
//so need to evaluate if measure provided | |
//x axis | |
var x; | |
if(xAxis.measure) { | |
x = myChart[xAxis.type]("x",opts.x,xAxis.measure); | |
} else { | |
x = myChart[xAxis.type]("x", opts.x); | |
}; | |
if(!(xAxis.type === "addPctAxis")) x.showPercent = xAxis.showPercent; | |
if (xAxis.orderRule) x.addOrderRule(xAxis.orderRule); | |
if (xAxis.grouporderRule) x.addGroupOrderRule(xAxis.grouporderRule); | |
if (xAxis.overrideMin) x.overrideMin = xAxis.overrideMin; | |
if (xAxis.overrideMax) x.overrideMax = xAxis.overrideMax; | |
if (xAxis.overrideMax) x.overrideMax = xAxis.overrideMax; | |
if (xAxis.inputFormat) x.dateParseFormat = xAxis.inputFormat; | |
if (xAxis.outputFormat) x.tickFormat = xAxis.outputFormat; | |
//y axis | |
var y; | |
if(yAxis.measure) { | |
y = myChart[yAxis.type]("y",opts.y,yAxis.measure); | |
} else { | |
y = myChart[yAxis.type]("y", opts.y); | |
}; | |
if(!(yAxis.type === "addPctAxis")) y.showPercent = yAxis.showPercent; | |
if (yAxis.orderRule) y.addOrderRule(yAxis.orderRule); | |
if (yAxis.grouporderRule) y.addGroupOrderRule(yAxis.grouporderRule); | |
if (yAxis.overrideMin) y.overrideMin = yAxis.overrideMin; | |
if (yAxis.overrideMax) y.overrideMax = yAxis.overrideMax; | |
if (yAxis.inputFormat) y.dateParseFormat = yAxis.inputFormat; | |
if (yAxis.outputFormat) y.tickFormat = yAxis.outputFormat; | |
//z for bubbles | |
var z; | |
if (!(typeof(zAxis) === 'undefined') && zAxis.type){ | |
if(zAxis.measure) { | |
z = myChart[zAxis.type]("z",opts.z,zAxis.measure); | |
} else { | |
z = myChart[zAxis.type]("z", opts.z); | |
}; | |
if(!(zAxis.type === "addPctAxis")) z.showPercent = zAxis.showPercent; | |
if (zAxis.orderRule) z.addOrderRule(zAxis.orderRule); | |
if (zAxis.overrideMin) z.overrideMin = zAxis.overrideMin; | |
if (zAxis.overrideMax) z.overrideMax = zAxis.overrideMax; | |
} | |
if(d3.keys(colorAxis).length > 0) { | |
myChart[colorAxis.type](colorAxis.colorSeries,colorAxis.palette) ; | |
} | |
//here need think I need to evaluate group and if missing do null | |
//as the first argument | |
//if provided need to use groups from opts | |
if(opts.hasOwnProperty("groups")) { | |
var s = myChart.addSeries( opts.groups, dimple.plot[opts.type] ); | |
//series offers an aggregate method that we will also need to check if available | |
//options available are avg, count, max, min, sum | |
if (!(typeof(opts.aggregate) === 'undefined')) { | |
s.aggregate = eval(opts.aggregate); | |
} | |
if (!(typeof(opts.lineWeight) === 'undefined')) { | |
s.lineWeight = eval(opts.lineWeight); | |
} | |
if (!(typeof(opts.barGap) === 'undefined')) { | |
s.barGap = eval(opts.barGap); | |
} | |
} else var s = myChart.addSeries( null, dimple.plot[opts.type] ); | |
//unsure if this is best but if legend is provided (not empty) then evaluate | |
if(d3.keys(legend).length > 0) { | |
var l =myChart.addLegend(); | |
d3.keys(legend).forEach(function(d){ | |
l[d] = legend[d]; | |
}); | |
} | |
//quick way to get this going but need to make this cleaner | |
if(opts.storyboard) { | |
myChart.setStoryboard(opts.storyboard); | |
}; | |
myChart.draw(); | |
</script> | |
</body> | |
<!-- Google Prettify --> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/188.0.0/prettify.js"></script> | |
<script | |
src='https://google-code-prettify.googlecode.com/svn-history/r232/trunk/src/lang-r.js'> | |
</script> | |
<script> | |
var pres = document.getElementsByTagName("pre"); | |
for (var i=0; i < pres.length; ++i) { | |
pres[i].className = "prettyprint linenums"; | |
} | |
prettyPrint(); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment