ledgerrb/public/app/bower_components/angularjs-nvd3-directives/examples/scatterChart.with.automatic.resize.html
2014-07-31 18:00:20 +02:00

60 lines
No EOL
1.7 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<title>Scatter Chart Example</title>
<script src="js/angular.js"></script>
<script src="js/d3.js"></script>
<script src="js/nv.d3.js"></script>
<script src="../dist/angularjs-nvd3-directives.js"></script>
<link rel="stylesheet" href="stylesheets/nv.d3.css"/>
<script>
var app = angular.module("nvd3TestApp", ['nvd3ChartDirectives']);
function ExampleCtrl($scope){
var getData = function(groups, points) {
var data = [],
shapes = ['circle', 'cross', 'triangle-up', 'triangle-down', 'diamond', 'square'],
random = d3.random.normal();
for (i = 0; i < groups; i++) {
data.push({
key: 'Group ' + i,
values: []
});
for (j = 0; j < points; j++) {
data[i].values.push({
x: random()
, y: random()
, size: Math.random()
//, shape: shapes[j % 6]
});
}
}
console.log(JSON.stringify(data));
return data;
}
$scope.exampleData = getData(4, 40);
};
</script>
</head>
<body ng-app='nvd3TestApp'>
<div ng-controller="ExampleCtrl">
<nvd3-scatter-chart
data="exampleData"
margin="{left:150,top:100,bottom:100,right:150}"
id="exampleId">
</nvd3-scatter-chart>
</div>
</body>
</html>