-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up initial play area for D3 chart test.
Also added D3 library, test pages, and dummy directive for calendar view.
- Loading branch information
Showing
12 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Support for interacting with D3 | ||
* Each d3 chart should have its own directive. | ||
* Each directive should require the D3 service. | ||
*/ | ||
var bawD3 = bawD3 || angular.module("bawApp.d3", []); | ||
/** | ||
* This wrapper is pretty simple. | ||
* We do this for modularity's sake and to fit in with the angular pattern. | ||
* This provider has the potential for runtime configuration: | ||
* (inject d3Provider into a config function). | ||
*/ | ||
bawD3.provider("d3", function () { | ||
|
||
// TODO: is there a better way to load d3, without it attaching to the window? | ||
var d3 = window.d3; | ||
|
||
this.$get = [function d3Factory() { | ||
return d3; | ||
}]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
baw-calendar-view { | ||
li { | ||
color: darkgreen; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* A d3 Calendar View directive | ||
* Created by Anthony on 23/08/2014. | ||
*/ | ||
angular.module("bawApp.d3.calendarView", ["bawApp.d3"]) | ||
.directive("bawCalendarView", ["d3", function(d3) { | ||
return { | ||
restrict: "EA", | ||
scope: { | ||
data: "=" | ||
}, | ||
templateUrl: "d3Bindings/caelndarView/calenderViewTemplate.tpl.html", | ||
link: function($scope, $element, attributes, controller, transcludeFunction) { | ||
// use this function to bind DOM events to angular scope | ||
// or d3 events to angular scope. | ||
// you can use the jQuery / d3 objects here (use the injected d3 instance) | ||
|
||
// where possible avoid jQuery | ||
var element = $element[0]; | ||
|
||
// d3.doSomething | ||
}, | ||
controller: "bawCalendarViewController" | ||
} | ||
}]) | ||
.controller("bawCalendarViewController", ["$scope", "$element", "$attrs", function($scope, $element, $attrs) { | ||
// The controller should host functionality native to angular | ||
// e.g. | ||
// - functions for button clicks | ||
// - API calls (not relevant in this case) | ||
// - scope modification | ||
// - iteraction with other services/providers | ||
// IT SHOULD NOT contain any reference to the d3 or jQuery objects | ||
|
||
$scope.example = "Hello world!"; | ||
|
||
}]); |
7 changes: 7 additions & 0 deletions
7
src/app/d3Bindings/caelndarView/calenderViewTemplate.tpl.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<b>I'm a fancy graph</b> | ||
<div> | ||
{{example}} | ||
</div> | ||
<ol ng-repeat="dataPoint in data"> | ||
<li>{{dataPoint}}</li> | ||
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var bawD3 = bawD3 || angular.module("bawApp.d3", []); | ||
bawD3.controller('D3TestPageCtrl', ['$scope', function($scope) { | ||
|
||
// use the REST API in here | ||
// assign the resulting data to scope (not great but it will do for now | ||
$scope.basicData = [0,1,2,3,4,5]; | ||
|
||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div id="content"> | ||
<h1>D3 Play area</h1> | ||
|
||
<h2>Calendar view</h2> | ||
<div> | ||
<baw-calendar-view data="basicData"></baw-calendar-view> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters