Skip to content

Commit 2e89752

Browse files
committed
Add example and integration test for scatter chart
1 parent a4c4e92 commit 2e89752

7 files changed

Lines changed: 126 additions & 7 deletions

File tree

examples/scatter.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title>Bubble chart</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="ScatterCtrl">
12+
<div class="col-lg-6 col-sm-12">
13+
<div class="panel panel-default">
14+
<div class="panel-heading">Scatter chart</div>
15+
<div class="panel-body">
16+
<canvas class="chart chart-line" chart-data="data"
17+
chart-options="options"></canvas>
18+
</div>
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
24+
<script src="../node_modules/angular/angular.min.js"></script>
25+
<script src="../node_modules/chart.js/dist/Chart.min.js"></script>
26+
<script src="../angular-chart.js"></script>
27+
<script src="scatter.js"></script>
28+
</body>
29+
</html>

examples/scatter.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
(function () {
2+
'use strict';
3+
4+
var app = angular.module("app", ["chart.js"]);
5+
6+
app.controller("ScatterCtrl", ['$scope', function ($scope) {
7+
$scope.data = [[{
8+
x: -10,
9+
y: -5
10+
}, {
11+
x: 0,
12+
y: 10
13+
}, {
14+
x: 10,
15+
y: 5
16+
}]];
17+
18+
$scope.options = {
19+
scales: {
20+
xAxes: [{
21+
type: 'linear',
22+
position: 'bottom'
23+
}]
24+
}
25+
};
26+
27+
}]);
28+
29+
30+
})();

test/fixtures/coverage.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/scatter.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title>Bubble chart</title>
6+
<link href="../../examples/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="ScatterCtrl">
12+
<div class="col-lg-6 col-sm-12">
13+
<div class="panel panel-default">
14+
<div class="panel-heading">Scatter chart</div>
15+
<div class="panel-body">
16+
<canvas class="chart chart-line" chart-data="data"
17+
chart-options="options"></canvas>
18+
</div>
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
24+
<script src="../../node_modules/angular/angular.min.js"></script>
25+
<script src="../../node_modules/chart.js/dist/Chart.min.js"></script>
26+
<script src="../../angular-chart.js"></script>
27+
<script src="scatter.js"></script>
28+
</body>
29+
</html>

test/fixtures/scatter.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
(function () {
2+
'use strict';
3+
4+
var app = angular.module('app', ['chart.js']);
5+
6+
app.controller('ScatterCtrl', ['$scope', function ($scope) {
7+
$scope.data = [[{
8+
x: -10,
9+
y: -5
10+
}, {
11+
x: 0,
12+
y: 10
13+
}, {
14+
x: 10,
15+
y: 5
16+
}]];
17+
18+
$scope.options = {
19+
scales: {
20+
xAxes: [{
21+
type: 'linear',
22+
position: 'bottom'
23+
}]
24+
}
25+
};
26+
27+
}]);
28+
29+
30+
})();

test/fixtures/scatter.png

35.8 KB
Loading

test/test.integration.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describe('integration', function () {
3333

3434
[
3535
'bubble',
36+
'scatter',
3637
'dataset-override',
3738
'horizontal-bar-chart',
3839
'29-tabs',

0 commit comments

Comments
 (0)