nvd3/examples/sparkline.html
Nathanael Anderson 22225147ab Reworked library to remove jquery dependancies
renamed nvtooltip.js to tooltip.js and put it into the nv namespace
Added a batch file for building on windows.
2012-05-07 07:53:51 -05:00

57 lines
870 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/d3.css" rel="stylesheet" type="text/css">
<style>
.sparkline path {
fill: none;
stroke: #444;
}
text {
font: 10px sans-serif;
}
</style>
<body>
<h2>Sparkline: <span id="test1" class="sparkline"></span></h2>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/models/sparkline.js"></script>
<script>
//Format A
nv.addGraph({
generate: function() {
var chart = nv.models.sparkline()
.width(400)
.height(80)
d3.select("#test1")
.datum(sine())
.call(chart);
return chart;
},
callback: function(graph) {
//log("Sparkline rendered");
}
});
function sine() {
var sin = [];
for (var i = 0; i < 100; i++) {
sin.push({x: i, y: Math.sin(i/10)});
}
return sin;
}
</script>