You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.0 KiB
HTML
64 lines
1.0 KiB
HTML
12 years ago
|
<!DOCTYPE html>
|
||
|
<meta charset="utf-8">
|
||
12 years ago
|
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
|
||
12 years ago
|
<style>
|
||
|
|
||
|
.sparkline path {
|
||
|
fill: none;
|
||
|
stroke: #444;
|
||
|
}
|
||
|
|
||
|
text {
|
||
|
font: 10px sans-serif;
|
||
|
}
|
||
|
|
||
|
#chart1 {
|
||
|
width: 400px;
|
||
12 years ago
|
height: 50px;
|
||
12 years ago
|
}
|
||
|
|
||
|
</style>
|
||
|
<body>
|
||
|
|
||
|
<h2>SparklinePlus: <svg id="chart1" class="sparkline"></svg></h2>
|
||
|
|
||
|
<script src="../lib/d3.v2.js"></script>
|
||
|
<script src="../nv.d3.js"></script>
|
||
12 years ago
|
<script src="../src/utils.js"></script>
|
||
12 years ago
|
<script src="../src/models/sparkline.js"></script>
|
||
|
<script src="../src/models/sparklinePlus.js"></script>
|
||
|
<script>
|
||
|
|
||
|
//Format A
|
||
|
nv.addGraph({
|
||
|
generate: function() {
|
||
|
var chart = nv.models.sparklinePlus()
|
||
|
.width(400)
|
||
12 years ago
|
.height(50)
|
||
12 years ago
|
|
||
|
d3.select("#chart1")
|
||
|
.datum(sine())
|
||
|
.call(chart);
|
||
|
|
||
|
return chart;
|
||
|
},
|
||
|
callback: function(graph) {
|
||
|
//log("Sparkline rendered");
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
function sine() {
|
||
|
var sin = [];
|
||
|
|
||
|
for (var i = 0; i < 100; i++) {
|
||
12 years ago
|
sin.push({x: i + 100, y: Math.sin(i/10)});
|
||
12 years ago
|
}
|
||
|
|
||
|
return sin;
|
||
|
}
|
||
|
|
||
|
|
||
|
</script>
|