Skip to content

Commit 132102d

Browse files
committed
Add example with {x, y} data from #387
1 parent aa2dc93 commit 132102d

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

examples/xy.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title>Charts with { x, y }</title>
6+
<link href="bootstrap.css" rel="stylesheet">
7+
</head>
8+
<body ng-app="app">
9+
<br/>
10+
<div id="container" class="container">
11+
<div class="row" ng-controller="LineCtrl">
12+
<div class="col-lg-6 col-sm-12">
13+
<div class="panel panel-default">
14+
<div class="panel-heading">x y</div>
15+
<div class="panel-body">
16+
<canvas class="chart chart-line" chart-data="data" chart-series="series" chart-options="options"></canvas>
17+
</div>
18+
</div>
19+
</div>
20+
</div>
21+
</div>
22+
23+
<script src="../node_modules/angular/angular.js"></script>
24+
<script src="../node_modules/chart.js/dist/Chart.min.js"></script>
25+
<script src="../angular-chart.js"></script>
26+
<script src="xy.js"></script>
27+
</body>
28+
</html>

examples/xy.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
angular.module("app", ["chart.js"]).controller("LineCtrl", ['$scope', function ($scope) {
2+
$scope.series = ['Series A', 'Series B'];
3+
$scope.data = [
4+
[ {x: 0, y: 10}, {x: 0, y: 1}, {x: 1, y: 6}, {x: 4, y: 2} ],
5+
[ {x: 0, y: 2}, {x: 5, y: 7}, {x: 4, y: 2}, {x: 2, y: 9} ]
6+
];
7+
$scope.options = {
8+
scales: {
9+
xAxes: [{
10+
type: 'linear',
11+
position: 'bottom'
12+
}]
13+
}
14+
};
15+
}]);

0 commit comments

Comments
 (0)