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.
81 lines
1.7 KiB
HTML
81 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
|
|
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
|
|
|
|
<style>
|
|
|
|
body {
|
|
overflow-y:scroll;
|
|
}
|
|
|
|
text {
|
|
font: 12px sans-serif;
|
|
}
|
|
|
|
#chart1 {
|
|
height: 500px;
|
|
margin: 10px;
|
|
min-width: 100px;
|
|
min-height: 100px;
|
|
/*
|
|
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="chart1">
|
|
<svg></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/multiBar.js"></script>
|
|
<script src="../src/models/multiBarChart.js"></script>
|
|
<script src="stream_layers.js"></script>
|
|
<script>
|
|
|
|
var test_data = stream_layers(3,10+Math.random()*100,.1).map(function(data, i) {
|
|
//var test_data = stream_layers(3,1,.1).map(function(data, i) { //for testing single data point
|
|
return {
|
|
key: 'Stream' + i,
|
|
values: data
|
|
};
|
|
});
|
|
|
|
|
|
var chart;
|
|
nv.addGraph(function() {
|
|
chart = nv.models.multiBarChart();
|
|
|
|
chart.xAxis
|
|
.showMaxMin(true)
|
|
.tickFormat(d3.format(',f'));
|
|
|
|
chart.yAxis
|
|
.tickFormat(d3.format(',.1f'));
|
|
|
|
d3.select('#chart1 svg')
|
|
.datum(test_data)
|
|
.transition().duration(500).call(chart);
|
|
|
|
nv.utils.windowResize(chart.update);
|
|
|
|
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
|
|
|
|
return chart;
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|