Created
May 23, 2014 16:16
-
-
Save wsurles/7b54e776fc17e7034895 to your computer and use it in GitHub Desktop.
defect_detail
This file contains hidden or 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://nvd3.org/assets/css/nv.d3.css'> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script> | |
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script> | |
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script> | |
<script src='http://nvd3.org/assets/lib/fisheye.js' type='text/javascript'></script> | |
<style> | |
.rChart { | |
display: block; | |
margin-left: auto; | |
margin-right: auto; | |
width: 900px; | |
height: 500px; | |
} | |
</style> | |
</head> | |
<body > | |
<div id = 'chart10a256a3a9edd' class = 'rChart nvd3'></div> | |
<script type='text/javascript'> | |
$(document).ready(function(){ | |
drawchart10a256a3a9edd() | |
}); | |
function drawchart10a256a3a9edd(){ | |
var opts = { | |
"dom": "chart10a256a3a9edd", | |
"width": 900, | |
"height": 500, | |
"x": "slug", | |
"y": "hits", | |
"type": "multiBarHorizontalChart", | |
"id": "chart10a256a3a9edd" | |
}, | |
data = [ | |
{ | |
"slug": "/detail/defect_1/oid", | |
"hits": 767 | |
}, | |
{ | |
"slug": "/detail/defect_1/discussion", | |
"hits": 194 | |
}, | |
{ | |
"slug": "/detail/defect_1/revisions", | |
"hits": 173 | |
}, | |
{ | |
"slug": "/detail/defect_1/new", | |
"hits": 145 | |
}, | |
{ | |
"slug": "/detail/defect_1/tasks", | |
"hits": 130 | |
}, | |
{ | |
"slug": "/detail/defect_1/duplicates", | |
"hits": 31 | |
}, | |
{ | |
"slug": "/detail/defect_1/defectsuites", | |
"hits": 23 | |
}, | |
{ | |
"slug": "/detail/defect_1/changesets", | |
"hits": 17 | |
}, | |
{ | |
"slug": "/detail/defect_1/testcases", | |
"hits": 12 | |
}, | |
{ | |
"slug": "/detail/defect_1/testrun", | |
"hits": 7 | |
}, | |
{ | |
"slug": "/detail/defect_1/", | |
"hits": 1 | |
}, | |
{ | |
"slug": "/detail/defect_1/oid show", | |
"hits": 1 | |
} | |
] | |
if(!(opts.type==="pieChart" || opts.type==="sparklinePlus" || opts.type==="bulletChart")) { | |
var data = d3.nest() | |
.key(function(d){ | |
//return opts.group === undefined ? 'main' : d[opts.group] | |
//instead of main would think a better default is opts.x | |
return opts.group === undefined ? opts.y : d[opts.group]; | |
}) | |
.entries(data); | |
} | |
if (opts.disabled != undefined){ | |
data.map(function(d, i){ | |
d.disabled = opts.disabled[i] | |
}) | |
} | |
nv.addGraph(function() { | |
var chart = nv.models[opts.type]() | |
.width(opts.width) | |
.height(opts.height) | |
if (opts.type != "bulletChart"){ | |
chart | |
.x(function(d) { return d[opts.x] }) | |
.y(function(d) { return d[opts.y] }) | |
} | |
chart | |
.margin({ | |
"top": 100, | |
"right": 20, | |
"bottom": 50, | |
"left": 180 | |
}) | |
.showControls(false) | |
chart.yAxis | |
.tickFormat(function(d){return d3.format('.0')(d)}) | |
d3.select("#" + opts.id) | |
.append('svg') | |
.datum(data) | |
.transition().duration(500) | |
.call(chart); | |
nv.utils.windowResize(chart.update); | |
return chart; | |
}); | |
}; | |
</script> | |
<script></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment