summaryrefslogtreecommitdiff
path: root/www/lib/tc-angular-chartjs
diff options
context:
space:
mode:
Diffstat (limited to 'www/lib/tc-angular-chartjs')
-rw-r--r--www/lib/tc-angular-chartjs/.bower.json48
-rw-r--r--www/lib/tc-angular-chartjs/LICENSE-APACHE-2.013
-rw-r--r--www/lib/tc-angular-chartjs/LICENSE-MIT25
-rw-r--r--www/lib/tc-angular-chartjs/README.md126
-rw-r--r--www/lib/tc-angular-chartjs/bower.json39
-rw-r--r--www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.js161
-rw-r--r--www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.min.js6
-rw-r--r--www/lib/tc-angular-chartjs/index.js2
8 files changed, 420 insertions, 0 deletions
diff --git a/www/lib/tc-angular-chartjs/.bower.json b/www/lib/tc-angular-chartjs/.bower.json
new file mode 100644
index 00000000..4345f3cb
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/.bower.json
@@ -0,0 +1,48 @@
+{
+ "name": "tc-angular-chartjs",
+ "version": "1.0.15",
+ "description": "Add Chart.js charts to your angular application",
+ "homepage": "http://carlcraig.github.io/tc-angular-chartjs/",
+ "author": "Carl Craig <carlcraig@3c-studios.com>",
+ "main": "dist/tc-angular-chartjs.min.js",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "demo",
+ "src",
+ "bower_components",
+ "test",
+ "Gruntfile.js",
+ "package.json"
+ ],
+ "dependencies": {
+ "angular": "~1.x",
+ "Chart.js": "^1.0.0-beta"
+ },
+ "devDependencies": {
+ "angular-mocks": "~1.x"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://raw.github.com/carlcraig/tc-angular-chartjs/master/LICENSE-MIT"
+ },
+ {
+ "type": "Apache-2.0",
+ "url": "https://raw.github.com/carlcraig/tc-angular-chartjs/master/LICENSE-APACHE-2.0"
+ }
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/carlcraig/tc-angular-chartjs.git"
+ },
+ "_release": "1.0.15",
+ "_resolution": {
+ "type": "version",
+ "tag": "v1.0.15",
+ "commit": "37edd47299679b5d3a6a2b253342e7a567a16463"
+ },
+ "_source": "https://github.com/carlcraig/tc-angular-chartjs.git",
+ "_target": "~1.0.11",
+ "_originalSource": "tc-angular-chartjs"
+} \ No newline at end of file
diff --git a/www/lib/tc-angular-chartjs/LICENSE-APACHE-2.0 b/www/lib/tc-angular-chartjs/LICENSE-APACHE-2.0
new file mode 100644
index 00000000..36fb5bbe
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/LICENSE-APACHE-2.0
@@ -0,0 +1,13 @@
+Copyright (c) 2014 Carl Craig
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. \ No newline at end of file
diff --git a/www/lib/tc-angular-chartjs/LICENSE-MIT b/www/lib/tc-angular-chartjs/LICENSE-MIT
new file mode 100644
index 00000000..84c82a69
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Carl Craig
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/www/lib/tc-angular-chartjs/README.md b/www/lib/tc-angular-chartjs/README.md
new file mode 100644
index 00000000..74191e37
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/README.md
@@ -0,0 +1,126 @@
+tc-angular-chartjs
+==================
+
+[![Build Status](https://travis-ci.org/carlcraig/tc-angular-chartjs.svg)](https://travis-ci.org/carlcraig/tc-angular-chartjs)
+
+[Documentation](http://carlcraig.github.io/tc-angular-chartjs/)
+
+### Add Chart.js to your angular applications
+
+tc-angular-chartjs provides you with directives for all chartjs chart types.
+
+- Line Charts
+- Bar Charts
+- Radar Charts
+- Polar Area Charts
+- Pie Charts
+- Doughnut Charts
+
+You can see all the [Chart.js Documentation](http://www.chartjs.org/docs/) on their website.
+
+Installation
+============
+
+Grab the latest version of `Chart.js` and `tc-angular-chartjs`.
+
+Load `Chart.js` and `tc-angular-chartjs` as you would with normal scripts.
+
+```html
+<script type="text/javascript" src="js/Chart.js"></script>
+<script type="text/javascript" src="js/angular.js"></script>
+<script type="text/javascript" src="js/tc-angular-chartjs.js"></script>
+```
+
+Make sure you use `dist/tc-angular-chartjs.js` or `dist/tc-angular-chartjs.min.js`
+
+Require `tc.chartjs` in your application modules where you require `Chart.js`.
+
+```javascript
+angular.module( 'app', ['tc.chartjs']);
+```
+
+Basic Usage
+===========
+
+There are 6 different directives.
+
+- tc-chartjs
+- tc-chartjs-line
+- tc-chartjs-bar
+- tc-chartjs-radar
+- tc-chartjs-polararea
+- tc-chartjs-pie
+- tc-chartjs-doughnut
+
+Just place one of these directives on a `canvas` element to create a Chart.js chart.
+
+```html
+<canvas tc-chartjs-doughnut width="350" height="350"></canvas>
+```
+
+You will also want to give the chart some `data` and `options`. These can be provided
+by assigning $scope variables to `chart-options` and `chart-data` attributes on the same canvas element.
+
+```html
+<canvas tc-chartjs-doughnut chart-data="myData" chart-options="myOptions" chart-click="onChartClick(data, event)" width="350" height="350"></canvas>
+```
+```javascript
+$scope.myData = [
+ { value : 50, color : "#F7464A" },
+ { value : 90, color : "#E2EAE9" },
+ { value : 75, color : "#D4CCC5" },
+ { value : 30, color : "#949FB1"}
+];
+
+$scope.myOptions = {
+ // Chart.js options can go here.
+};
+
+$scope.onChartClick = function (data, event) {
+ console.log(data, event);
+};
+
+```
+
+Using the `tc-chartjs` directive
+================================
+
+When using the `tc-chartjs` directive you will need to add an additional attribute to
+say which type of chart should be created.
+
+Just attach a `chart-type=""` attribute to the canvas element.
+
+```html
+<canvas tc-chartjs chart-type="doughnut" chart-data="data" chart-options="options" width="350" height="350"></canvas>
+```
+
+Available Types:
+
+- line
+- bar
+- radar
+- polararea
+- pie
+- doughnut
+
+Passing another value to chart-type than the above will try to create a chart of
+that type, which is useful if you have extended Chart.js with custom chart types,
+e.g. through plugins.
+
+Contributing
+============
+
+- [Open a Pull Request (PR)](https://github.com/carlcraig/tc-angular-chartjs/pull/new/master)
+- Make sure your PR is on a new branch you created from the latest version of master branch
+- Please do not open a PR from your master branch
+- Open a PR even if your code is incomplete to start a discussion and to collect feedback
+- Please make sure all unit tests pass, and add new tests for any added features.
+
+
+License
+=======
+
+tc-angular-chartjs is dual licensed with the Apache-2.0 or MIT license.
+
+See LICENSE-APACHE-2.0 and LICENSE-MIT for more details.
+
diff --git a/www/lib/tc-angular-chartjs/bower.json b/www/lib/tc-angular-chartjs/bower.json
new file mode 100644
index 00000000..ca3b7556
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/bower.json
@@ -0,0 +1,39 @@
+{
+ "name": "tc-angular-chartjs",
+ "version": "1.0.15",
+ "description": "Add Chart.js charts to your angular application",
+ "homepage": "http://carlcraig.github.io/tc-angular-chartjs/",
+ "author": "Carl Craig <carlcraig@3c-studios.com>",
+ "main": "dist/tc-angular-chartjs.min.js",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "demo",
+ "src",
+ "bower_components",
+ "test",
+ "Gruntfile.js",
+ "package.json"
+ ],
+ "dependencies": {
+ "angular": "~1.x",
+ "Chart.js": "^1.0.0-beta"
+ },
+ "devDependencies": {
+ "angular-mocks": "~1.x"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://raw.github.com/carlcraig/tc-angular-chartjs/master/LICENSE-MIT"
+ },
+ {
+ "type": "Apache-2.0",
+ "url": "https://raw.github.com/carlcraig/tc-angular-chartjs/master/LICENSE-APACHE-2.0"
+ }
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/carlcraig/tc-angular-chartjs.git"
+ }
+}
diff --git a/www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.js b/www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.js
new file mode 100644
index 00000000..3ff3025f
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.js
@@ -0,0 +1,161 @@
+/**
+ * tc-angular-chartjs - v1.0.15 - 2016-02-15
+ * Copyright (c) 2016 Carl Craig <carlcraig.threeceestudios@gmail.com>
+ * Dual licensed with the Apache-2.0 or MIT license.
+ */
+(function() {
+ "use strict";
+ angular.module("tc.chartjs", []).directive("tcChartjs", TcChartjs).directive("tcChartjsLine", TcChartjsLine).directive("tcChartjsBar", TcChartjsBar).directive("tcChartjsRadar", TcChartjsRadar).directive("tcChartjsPolararea", TcChartjsPolararea).directive("tcChartjsPie", TcChartjsPie).directive("tcChartjsDoughnut", TcChartjsDoughnut).directive("tcChartjsLegend", TcChartjsLegend).factory("TcChartjsFactory", TcChartjsFactory);
+ function TcChartjs(TcChartjsFactory) {
+ return new TcChartjsFactory();
+ }
+ TcChartjs.$inject = [ "TcChartjsFactory" ];
+ function TcChartjsLine(TcChartjsFactory) {
+ return new TcChartjsFactory("line");
+ }
+ TcChartjsLine.$inject = [ "TcChartjsFactory" ];
+ function TcChartjsBar(TcChartjsFactory) {
+ return new TcChartjsFactory("bar");
+ }
+ TcChartjsBar.$inject = [ "TcChartjsFactory" ];
+ function TcChartjsRadar(TcChartjsFactory) {
+ return new TcChartjsFactory("radar");
+ }
+ TcChartjsRadar.$inject = [ "TcChartjsFactory" ];
+ function TcChartjsPolararea(TcChartjsFactory) {
+ return new TcChartjsFactory("polararea");
+ }
+ TcChartjsPolararea.$inject = [ "TcChartjsFactory" ];
+ function TcChartjsPie(TcChartjsFactory) {
+ return new TcChartjsFactory("pie");
+ }
+ TcChartjsPie.$inject = [ "TcChartjsFactory" ];
+ function TcChartjsDoughnut(TcChartjsFactory) {
+ return new TcChartjsFactory("doughnut");
+ }
+ TcChartjsDoughnut.$inject = [ "TcChartjsFactory" ];
+ function TcChartjsFactory() {
+ return function(chartType) {
+ return {
+ restrict: "A",
+ scope: {
+ data: "=chartData",
+ options: "=chartOptions",
+ type: "@chartType",
+ legend: "=?chartLegend",
+ chart: "=?chart",
+ click: "&chartClick"
+ },
+ link: link
+ };
+ function link($scope, $elem, $attrs) {
+ var ctx = $elem[0].getContext("2d");
+ var chart = new Chart(ctx);
+ var chartObj;
+ var showLegend = false;
+ var autoLegend = false;
+ var exposeChart = false;
+ var legendElem = null;
+ for (var attr in $attrs) {
+ if (attr === "chartLegend") {
+ showLegend = true;
+ } else if (attr === "chart") {
+ exposeChart = true;
+ } else if (attr === "autoLegend") {
+ autoLegend = true;
+ }
+ }
+ $scope.$on("$destroy", function() {
+ if (chartObj && typeof chartObj.destroy === "function") {
+ chartObj.destroy();
+ }
+ });
+ if ($scope.click) {
+ $elem[0].onclick = function(evt) {
+ var segment;
+ if (chartObj.getSegmentsAtEvent !== undefined) {
+ segment = chartObj.getSegmentsAtEvent(evt);
+ } else if (chartObj.getPointsAtEvent !== undefined) {
+ segment = chartObj.getPointsAtEvent(evt);
+ } else if (chartObj.getBarsAtEvent !== undefined) {
+ segment = chartObj.getBarsAtEvent(evt);
+ }
+ $scope.click({
+ data: segment,
+ event: evt
+ });
+ };
+ }
+ $scope.$watch("data", function(value) {
+ if (value) {
+ if (chartObj && typeof chartObj.destroy === "function") {
+ chartObj.destroy();
+ }
+ if (chartType) {
+ chartObj = chart[cleanChartName(chartType)]($scope.data, $scope.options);
+ } else if ($scope.type) {
+ chartObj = chart[cleanChartName($scope.type)]($scope.data, $scope.options);
+ } else {
+ throw "Error creating chart: Chart type required.";
+ }
+ if (showLegend) {
+ $scope.legend = chartObj.generateLegend();
+ }
+ if (autoLegend) {
+ if (legendElem) {
+ legendElem.remove();
+ }
+ angular.element($elem[0]).after(chartObj.generateLegend());
+ legendElem = angular.element($elem[0]).next();
+ }
+ if (exposeChart) {
+ $scope.chart = chartObj;
+ }
+ chartObj.resize();
+ }
+ }, true);
+ }
+ function cleanChartName(type) {
+ var typeLowerCase = type.toLowerCase();
+ switch (typeLowerCase) {
+ case "line":
+ return "Line";
+
+ case "bar":
+ return "Bar";
+
+ case "radar":
+ return "Radar";
+
+ case "polararea":
+ return "PolarArea";
+
+ case "pie":
+ return "Pie";
+
+ case "doughnut":
+ return "Doughnut";
+
+ default:
+ return type;
+ }
+ }
+ };
+ }
+ function TcChartjsLegend() {
+ return {
+ restrict: "A",
+ scope: {
+ legend: "=?chartLegend"
+ },
+ link: link
+ };
+ function link($scope, $elem) {
+ $scope.$watch("legend", function(value) {
+ if (value) {
+ $elem.html(value);
+ }
+ }, true);
+ }
+ }
+})(); \ No newline at end of file
diff --git a/www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.min.js b/www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.min.js
new file mode 100644
index 00000000..3255d926
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/dist/tc-angular-chartjs.min.js
@@ -0,0 +1,6 @@
+/**
+ * tc-angular-chartjs - v1.0.15 - 2016-02-15
+ * Copyright (c) 2016 Carl Craig <carlcraig.threeceestudios@gmail.com>
+ * Dual licensed with the Apache-2.0 or MIT license.
+ */
+!function(){"use strict";function a(a){return new a}function b(a){return new a("line")}function c(a){return new a("bar")}function d(a){return new a("radar")}function e(a){return new a("polararea")}function f(a){return new a("pie")}function g(a){return new a("doughnut")}function h(){return function(a){function b(b,d,e){var f,g=d[0].getContext("2d"),h=new Chart(g),i=!1,j=!1,k=!1,l=null;for(var m in e)"chartLegend"===m?i=!0:"chart"===m?k=!0:"autoLegend"===m&&(j=!0);b.$on("$destroy",function(){f&&"function"==typeof f.destroy&&f.destroy()}),b.click&&(d[0].onclick=function(a){var c;void 0!==f.getSegmentsAtEvent?c=f.getSegmentsAtEvent(a):void 0!==f.getPointsAtEvent?c=f.getPointsAtEvent(a):void 0!==f.getBarsAtEvent&&(c=f.getBarsAtEvent(a)),b.click({data:c,event:a})}),b.$watch("data",function(e){if(e){if(f&&"function"==typeof f.destroy&&f.destroy(),a)f=h[c(a)](b.data,b.options);else{if(!b.type)throw"Error creating chart: Chart type required.";f=h[c(b.type)](b.data,b.options)}i&&(b.legend=f.generateLegend()),j&&(l&&l.remove(),angular.element(d[0]).after(f.generateLegend()),l=angular.element(d[0]).next()),k&&(b.chart=f),f.resize()}},!0)}function c(a){var b=a.toLowerCase();switch(b){case"line":return"Line";case"bar":return"Bar";case"radar":return"Radar";case"polararea":return"PolarArea";case"pie":return"Pie";case"doughnut":return"Doughnut";default:return a}}return{restrict:"A",scope:{data:"=chartData",options:"=chartOptions",type:"@chartType",legend:"=?chartLegend",chart:"=?chart",click:"&chartClick"},link:b}}}function i(){function a(a,b){a.$watch("legend",function(a){a&&b.html(a)},!0)}return{restrict:"A",scope:{legend:"=?chartLegend"},link:a}}angular.module("tc.chartjs",[]).directive("tcChartjs",a).directive("tcChartjsLine",b).directive("tcChartjsBar",c).directive("tcChartjsRadar",d).directive("tcChartjsPolararea",e).directive("tcChartjsPie",f).directive("tcChartjsDoughnut",g).directive("tcChartjsLegend",i).factory("TcChartjsFactory",h),a.$inject=["TcChartjsFactory"],b.$inject=["TcChartjsFactory"],c.$inject=["TcChartjsFactory"],d.$inject=["TcChartjsFactory"],e.$inject=["TcChartjsFactory"],f.$inject=["TcChartjsFactory"],g.$inject=["TcChartjsFactory"]}(); \ No newline at end of file
diff --git a/www/lib/tc-angular-chartjs/index.js b/www/lib/tc-angular-chartjs/index.js
new file mode 100644
index 00000000..e124f0b6
--- /dev/null
+++ b/www/lib/tc-angular-chartjs/index.js
@@ -0,0 +1,2 @@
+require('./dist/tc-angular-chartjs.js');
+module.exports = 'tc.chartjs';