2012-06-18 17:36:12 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
2012-07-13 19:25:19 +00:00
|
|
|
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
|
2012-06-18 17:36:12 +00:00
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
body {
|
|
|
|
overflow-y:scroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
text {
|
|
|
|
font: 12px sans-serif;
|
|
|
|
}
|
|
|
|
|
|
|
|
svg {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
#chart1 svg {
|
|
|
|
height: 500px;
|
|
|
|
min-width: 100px;
|
|
|
|
min-height: 100px;
|
|
|
|
/*
|
|
|
|
margin: 50px;
|
|
|
|
Minimum height and width is a good idea to prevent negative SVG dimensions...
|
|
|
|
For example width should be =< margin.left + margin.right + 1,
|
|
|
|
of course 1 pixel for the entire chart would not be very useful, BUT should not have errors
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="chart">
|
|
|
|
<svg style="height: 500px;"></svg>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script src="../lib/d3.v2.js"></script>
|
|
|
|
<script src="../nv.d3.js"></script>
|
|
|
|
<script src="../src/tooltip.js"></script>
|
|
|
|
<script src="../src/utils.js"></script>
|
|
|
|
<script src="../src/models/legend.js"></script>
|
|
|
|
<script src="../src/models/axis.js"></script>
|
|
|
|
<script src="../src/models/scatter.js"></script>
|
|
|
|
<script src="../src/models/line.js"></script>
|
|
|
|
<script src="../src/models/lineWithFocusChart.js"></script>
|
|
|
|
<script src="stream_layers.js"></script>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
nv.addGraph(function() {
|
|
|
|
var chart = nv.models.lineWithFocusChart();
|
|
|
|
|
|
|
|
chart.xAxis
|
2012-06-28 03:35:14 +00:00
|
|
|
.tickFormat(d3.format(',f'));
|
2012-07-12 05:07:36 +00:00
|
|
|
chart.x2Axis
|
|
|
|
.tickFormat(d3.format(',f'));
|
2012-06-18 17:36:12 +00:00
|
|
|
|
|
|
|
chart.yAxis
|
|
|
|
.tickFormat(d3.format(',.2f'));
|
2012-07-12 05:41:05 +00:00
|
|
|
chart.y2Axis
|
2012-07-12 05:07:36 +00:00
|
|
|
.tickFormat(d3.format(',.2f'));
|
2012-06-18 17:36:12 +00:00
|
|
|
|
|
|
|
d3.select('#chart svg')
|
|
|
|
.datum(testData())
|
|
|
|
.transition().duration(500)
|
|
|
|
.call(chart);
|
|
|
|
|
|
|
|
nv.utils.windowResize(chart.update);
|
|
|
|
|
|
|
|
return chart;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function testData() {
|
|
|
|
return stream_layers(3,128,.1).map(function(data, i) {
|
|
|
|
return {
|
|
|
|
key: 'Stream' + i,
|
|
|
|
values: data
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|