From 9eef1983875dcf9666d57619d844ad2130fd1c00 Mon Sep 17 00:00:00 2001 From: Jerome Touffe-Blin Date: Sun, 19 Jun 2016 12:21:28 +1000 Subject: [PATCH] Dataset override chartjs 2.0 (#418) * add attribute `chart-dataset-overload` * complete support for `dataset-override` * rename `datasetOverload` to `datasetOverride` * use `datasetOverride` for pie and doughnut charts as well * add unit and integration tests * add examples * fix #370, #336, #391 * remove `y-axis` attribute as it can now be implemented using the `dataset-override` attribute * compile assets and minor fixes for jshint --- README.md | 14 ++- angular-chart.js | 28 ++++-- dist/angular-chart.js | 28 ++++-- dist/angular-chart.min.js | 2 +- dist/angular-chart.min.js.map | 2 +- examples/app.js | 30 ++++++- examples/charts.html | 90 ++++++++++++++++--- examples/charts.template.html | 90 ++++++++++++++++--- examples/dataset-override.html | 38 +++++++++ examples/dataset-override.js | 32 +++++++ examples/xy.js | 5 +- test/fixtures/coverage.js | 4 +- test/fixtures/dataset-override.html | 41 +++++++++ test/fixtures/dataset-override.js | 32 +++++++ test/fixtures/dataset-override.png | Bin 0 -> 62303 bytes test/test.integration.js | 1 + test/test.unit.js | 128 +++++++++++++++------------- 17 files changed, 448 insertions(+), 117 deletions(-) create mode 100644 examples/dataset-override.html create mode 100644 examples/dataset-override.js create mode 100644 test/fixtures/dataset-override.html create mode 100644 test/fixtures/dataset-override.js create mode 100644 test/fixtures/dataset-override.png diff --git a/README.md b/README.md index a66b2898..b5b9314f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ Beautiful, reactive, responsive charts for Angular.JS using [Chart.js](http://www.chartjs.org/). -[Demo](http://jtblin.github.io/angular-chart.js/) +Have a look at the [demo site](http://jtblin.github.io/angular-chart.js/) to see examples with detailed markup, +script and options. # Installation @@ -34,6 +35,10 @@ there are numerous breaking changes in this version notably: //cdn.jsdelivr.net/angular.chartjs/latest/angular-chart.min.js +### bower + + bower install --save angular-chart.js + ### manually or copy the files from `dist/`. @@ -55,7 +60,7 @@ adding the dependencies for Angular and Chart.js first: # Utilisation -There are 6 types of charts so 6 directives: `chart-line`, `chart-bar`, `chart-horizontal-bar`, `chart-radar`, +There are 7 types of charts so 7 directives: `chart-line`, `chart-bar`, `chart-horizontal-bar`, `chart-radar`, `chart-pie`, `chart-polar-area`, `chart-doughnut`. - `chart-data`: series data @@ -66,10 +71,13 @@ There are 6 types of charts so 6 directives: `chart-line`, `chart-bar`, `chart-h - `chart-get-color`: function that returns a color in case there are not enough (will use random colors if not specified) - `chart-click`: onclick event handler - `chart-hover`: onmousemove event handler +- `chart-dataset-override`: override individual datasets to allow per dataset configuration e.g. y-axis, mixed type chart There is another directive `chart-base` that takes an extra attribute `chart-type` to define the type dynamically, see [stacked bar example](http://jtblin.github.io/angular-chart.js/examples/stacked-bars.html). +You can create mixed type chart using the `chart-dataset-override`, see [example](examples/dataset-override.html). + # Example ## Markup @@ -92,7 +100,7 @@ angular.module("app", ["chart.js"]) }); // Configure all line charts ChartJsProvider.setOptions('line', { - datasetFill: false + showLines: false }); }]) .controller("LineCtrl", ['$scope', '$timeout', function ($scope, $timeout) { diff --git a/angular-chart.js b/angular-chart.js index b90e8dbc..3ebee04b 100644 --- a/angular-chart.js +++ b/angular-chart.js @@ -102,7 +102,7 @@ chartColors: '=?', chartClick: '=?', chartHover: '=?', - chartYAxes: '=?' + chartDatasetOverride: '=?' }, link: function (scope, elem/*, attrs */) { var chart; @@ -129,6 +129,7 @@ scope.$watch('chartLabels', resetChart, true); scope.$watch('chartOptions', resetChart, true); scope.$watch('chartColors', resetChart, true); + scope.$watch('chartDatasetOverride', resetChart, true); scope.$watch('chartType', function (newVal, oldVal) { if (isEmpty(newVal)) return; @@ -162,13 +163,13 @@ createChart(type); }, 50, false); } - if (! scope.chartData || ! scope.chartData.length) return; + if (! hasData(scope)) return; scope.chartGetColor = typeof scope.chartGetColor === 'function' ? scope.chartGetColor : getRandomColor; var colors = getColors(type, scope); var cvs = elem[0], ctx = cvs.getContext('2d'); var data = Array.isArray(scope.chartData[0]) ? - getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartYAxes) : - getData(scope.chartLabels, scope.chartData, colors); + getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartDatasetOverride) : + getData(scope.chartLabels, scope.chartData, colors, scope.chartDatasetOverride); var options = angular.extend({}, ChartJs.getOptions(type), scope.chartOptions); // Destroy old chart if it exists to avoid ghost charts issue @@ -274,7 +275,12 @@ return [r, g, b]; } - function getDataSets (labels, data, series, colors, yaxis) { + function hasData (scope) { + return scope.chartData && scope.chartData.length && + scope.chartLabels && scope.chartLabels.length; + } + + function getDataSets (labels, data, series, colors, datasetOverride) { return { labels: labels, datasets: data.map(function (item, i) { @@ -282,16 +288,16 @@ label: series[i], data: item }); - if (yaxis) { - dataset.yAxisID = yaxis[i]; + if (datasetOverride && datasetOverride.length >= i) { + angular.merge(dataset, datasetOverride[i]); } return dataset; }) }; } - function getData (labels, data, colors) { - return { + function getData (labels, data, colors, datasetOverride) { + var dataset = { labels: labels, datasets: [{ data: data, @@ -303,6 +309,10 @@ }) }] }; + if (datasetOverride) { + angular.merge(dataset.datasets[0], datasetOverride); + } + return dataset; } function updateChart (chart, values, scope) { diff --git a/dist/angular-chart.js b/dist/angular-chart.js index b90e8dbc..3ebee04b 100644 --- a/dist/angular-chart.js +++ b/dist/angular-chart.js @@ -102,7 +102,7 @@ chartColors: '=?', chartClick: '=?', chartHover: '=?', - chartYAxes: '=?' + chartDatasetOverride: '=?' }, link: function (scope, elem/*, attrs */) { var chart; @@ -129,6 +129,7 @@ scope.$watch('chartLabels', resetChart, true); scope.$watch('chartOptions', resetChart, true); scope.$watch('chartColors', resetChart, true); + scope.$watch('chartDatasetOverride', resetChart, true); scope.$watch('chartType', function (newVal, oldVal) { if (isEmpty(newVal)) return; @@ -162,13 +163,13 @@ createChart(type); }, 50, false); } - if (! scope.chartData || ! scope.chartData.length) return; + if (! hasData(scope)) return; scope.chartGetColor = typeof scope.chartGetColor === 'function' ? scope.chartGetColor : getRandomColor; var colors = getColors(type, scope); var cvs = elem[0], ctx = cvs.getContext('2d'); var data = Array.isArray(scope.chartData[0]) ? - getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartYAxes) : - getData(scope.chartLabels, scope.chartData, colors); + getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartDatasetOverride) : + getData(scope.chartLabels, scope.chartData, colors, scope.chartDatasetOverride); var options = angular.extend({}, ChartJs.getOptions(type), scope.chartOptions); // Destroy old chart if it exists to avoid ghost charts issue @@ -274,7 +275,12 @@ return [r, g, b]; } - function getDataSets (labels, data, series, colors, yaxis) { + function hasData (scope) { + return scope.chartData && scope.chartData.length && + scope.chartLabels && scope.chartLabels.length; + } + + function getDataSets (labels, data, series, colors, datasetOverride) { return { labels: labels, datasets: data.map(function (item, i) { @@ -282,16 +288,16 @@ label: series[i], data: item }); - if (yaxis) { - dataset.yAxisID = yaxis[i]; + if (datasetOverride && datasetOverride.length >= i) { + angular.merge(dataset, datasetOverride[i]); } return dataset; }) }; } - function getData (labels, data, colors) { - return { + function getData (labels, data, colors, datasetOverride) { + var dataset = { labels: labels, datasets: [{ data: data, @@ -303,6 +309,10 @@ }) }] }; + if (datasetOverride) { + angular.merge(dataset.datasets[0], datasetOverride); + } + return dataset; } function updateChart (chart, values, scope) { diff --git a/dist/angular-chart.min.js b/dist/angular-chart.min.js index a28b684f..5038061e 100644 --- a/dist/angular-chart.min.js +++ b/dist/angular-chart.min.js @@ -1,2 +1,2 @@ -!function(t){"use strict";if("object"==typeof exports)module.exports=t("undefined"!=typeof angular?angular:require("angular"),"undefined"!=typeof Chart?Chart:require("chart.js"));else if("function"==typeof define&&define.amd)define(["angular","chart"],t);else{if("undefined"==typeof angular||"undefined"==typeof Chart)throw new Error("Chart.js library needs to included, see http://jtblin.github.io/angular-chart.js/");t(angular,Chart)}}(function(t,r){"use strict";function e(){var e={},a={Chart:r,getOptions:function(r){var a=r&&e[r]||{};return t.extend({},e,a)}};this.setOptions=function(r,a){return a?void(e[r]=t.extend(e[r]||{},a)):(a=r,void(e=t.extend(e,a)))},this.$get=function(){return a}}function a(e,a){function o(t,r){return t&&r&&t.length&&r.length?Array.isArray(t[0])?t.length===r.length&&t.every(function(t,e){return t.length===r[e].length}):r.reduce(c,0)>0?t.length===r.length:!1:!1}function c(t,r){return t+r}function i(r,e,a,n){var o=null;return function(c){var i=e.getElementsAtEvent||e.getPointsAtEvent;if(i){var u=i.call(e,c);n!==!1&&t.equals(o,u)!==!1||(o=u,r[a](u,c))}}}function u(a,n){for(var o=t.copy(n.chartColors||e.getOptions(a).chartColors||r.defaults.global.colors),c=o.length>16&255,a=r>>8&255,n=255&r;return[e,a,n]}function p(r,e,a,n,o){return{labels:r,datasets:e.map(function(r,e){var c=t.extend({},n[e],{label:a[e],data:r});return o&&(c.yAxisID=o[e]),c})}}function C(t,r,e){return{labels:t,datasets:[{data:r,backgroundColor:e.map(function(t){return t.pointBackgroundColor}),hoverBackgroundColor:e.map(function(t){return t.backgroundColor})}]}}function v(t,r,e){Array.isArray(e.chartData[0])?t.data.datasets.forEach(function(t,e){t.data=r[e]}):t.data.datasets[0].data=r,t.update(),e.$emit("chart-update",t)}function y(t){return!t||Array.isArray(t)&&!t.length||"object"==typeof t&&!Object.keys(t).length}function b(a,n){var o=t.extend({},r.defaults.global,e.getOptions(a),n.chartOptions);return o.responsive}function m(t,r){t&&(t.destroy(),r.$emit("chart-destroy",t))}return function(r){return{restrict:"CA",scope:{chartGetColor:"=?",chartType:"=",chartData:"=?",chartLabels:"=?",chartOptions:"=?",chartSeries:"=?",chartColors:"=?",chartClick:"=?",chartHover:"=?",chartYAxes:"=?"},link:function(c,l){function s(e,a){if(!y(e)&&!t.equals(e,a)){var n=r||c.chartType;n&&f(n)}}function f(r){if(b(r,c)&&0===l[0].clientHeight)return a(function(){f(r)},50,!1);if(c.chartData&&c.chartData.length){c.chartGetColor="function"==typeof c.chartGetColor?c.chartGetColor:h;var n=u(r,c),o=l[0],s=o.getContext("2d"),g=Array.isArray(c.chartData[0])?p(c.chartLabels,c.chartData,c.chartSeries||[],n,c.chartYAxes):C(c.chartLabels,c.chartData,n),v=t.extend({},e.getOptions(r),c.chartOptions);m(d,c),d=new e.Chart(s,{type:r,data:g,options:v}),c.$emit("chart-create",d),o.onclick=c.chartClick?i(c,d,"chartClick",!1):t.noop,o.onmousemove=c.chartHover?i(c,d,"chartHover",!0):t.noop}}var d;n&&window.G_vmlCanvasManager.initElement(l[0]),c.$watch("chartData",function(t,e){if(!t||!t.length||Array.isArray(t[0])&&!t[0].length)return void m(d,c);var a=r||c.chartType;if(a)return d&&o(t,e)?v(d,t,c):void f(a)},!0),c.$watch("chartSeries",s,!0),c.$watch("chartLabels",s,!0),c.$watch("chartOptions",s,!0),c.$watch("chartColors",s,!0),c.$watch("chartType",function(r,e){y(r)||t.equals(r,e)||f(r)}),c.$on("$destroy",function(){m(d,c)}),c.$on("$resize",function(){d&&d.resize()})}}}}r.defaults.global.multiTooltipTemplate="<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>",r.defaults.global.tooltips.mode="label",r.defaults.global.elements.line.borderWidth=2,r.defaults.global.elements.rectangle.borderWidth=2,r.defaults.global.legend.display=!1,r.defaults.global.colors=["#97BBCD","#DCDCDC","#F7464A","#46BFBD","#FDB45C","#949FB1","#4D5360"];var n="object"==typeof window.G_vmlCanvasManager&&null!==window.G_vmlCanvasManager&&"function"==typeof window.G_vmlCanvasManager.initElement;return n&&(r.defaults.global.animation=!1),t.module("chart.js",[]).provider("ChartJs",e).factory("ChartJsFactory",["ChartJs","$timeout",a]).directive("chartBase",["ChartJsFactory",function(t){return new t}]).directive("chartLine",["ChartJsFactory",function(t){return new t("line")}]).directive("chartBar",["ChartJsFactory",function(t){return new t("bar")}]).directive("chartHorizontalBar",["ChartJsFactory",function(t){return new t("horizontalBar")}]).directive("chartRadar",["ChartJsFactory",function(t){return new t("radar")}]).directive("chartDoughnut",["ChartJsFactory",function(t){return new t("doughnut")}]).directive("chartPie",["ChartJsFactory",function(t){return new t("pie")}]).directive("chartPolarArea",["ChartJsFactory",function(t){return new t("polarArea")}])}); +!function(t){"use strict";if("object"==typeof exports)module.exports=t("undefined"!=typeof angular?angular:require("angular"),"undefined"!=typeof Chart?Chart:require("chart.js"));else if("function"==typeof define&&define.amd)define(["angular","chart"],t);else{if("undefined"==typeof angular||"undefined"==typeof Chart)throw new Error("Chart.js library needs to included, see http://jtblin.github.io/angular-chart.js/");t(angular,Chart)}}(function(t,r){"use strict";function e(){var e={},a={Chart:r,getOptions:function(r){var a=r&&e[r]||{};return t.extend({},e,a)}};this.setOptions=function(r,a){return a?void(e[r]=t.extend(e[r]||{},a)):(a=r,void(e=t.extend(e,a)))},this.$get=function(){return a}}function a(e,a){function o(t,r){return t&&r&&t.length&&r.length?Array.isArray(t[0])?t.length===r.length&&t.every(function(t,e){return t.length===r[e].length}):r.reduce(c,0)>0?t.length===r.length:!1:!1}function c(t,r){return t+r}function i(r,e,a,n){var o=null;return function(c){var i=e.getElementsAtEvent||e.getPointsAtEvent;if(i){var u=i.call(e,c);n!==!1&&t.equals(o,u)!==!1||(o=u,r[a](u,c))}}}function u(a,n){for(var o=t.copy(n.chartColors||e.getOptions(a).chartColors||r.defaults.global.colors),c=o.length>16&255,a=r>>8&255,n=255&r;return[e,a,n]}function p(t){return t.chartData&&t.chartData.length&&t.chartLabels&&t.chartLabels.length}function v(r,e,a,n,o){return{labels:r,datasets:e.map(function(r,e){var c=t.extend({},n[e],{label:a[e],data:r});return o&&o.length>=e&&t.merge(c,o[e]),c})}}function C(r,e,a,n){var o={labels:r,datasets:[{data:e,backgroundColor:a.map(function(t){return t.pointBackgroundColor}),hoverBackgroundColor:a.map(function(t){return t.backgroundColor})}]};return n&&t.merge(o.datasets[0],n),o}function y(t,r,e){Array.isArray(e.chartData[0])?t.data.datasets.forEach(function(t,e){t.data=r[e]}):t.data.datasets[0].data=r,t.update(),e.$emit("chart-update",t)}function b(t){return!t||Array.isArray(t)&&!t.length||"object"==typeof t&&!Object.keys(t).length}function m(a,n){var o=t.extend({},r.defaults.global,e.getOptions(a),n.chartOptions);return o.responsive}function w(t,r){t&&(t.destroy(),r.$emit("chart-destroy",t))}return function(r){return{restrict:"CA",scope:{chartGetColor:"=?",chartType:"=",chartData:"=?",chartLabels:"=?",chartOptions:"=?",chartSeries:"=?",chartColors:"=?",chartClick:"=?",chartHover:"=?",chartDatasetOverride:"=?"},link:function(c,l){function s(e,a){if(!b(e)&&!t.equals(e,a)){var n=r||c.chartType;n&&d(n)}}function d(r){if(m(r,c)&&0===l[0].clientHeight)return a(function(){d(r)},50,!1);if(p(c)){c.chartGetColor="function"==typeof c.chartGetColor?c.chartGetColor:h;var n=u(r,c),o=l[0],s=o.getContext("2d"),g=Array.isArray(c.chartData[0])?v(c.chartLabels,c.chartData,c.chartSeries||[],n,c.chartDatasetOverride):C(c.chartLabels,c.chartData,n,c.chartDatasetOverride),y=t.extend({},e.getOptions(r),c.chartOptions);w(f,c),f=new e.Chart(s,{type:r,data:g,options:y}),c.$emit("chart-create",f),o.onclick=c.chartClick?i(c,f,"chartClick",!1):t.noop,o.onmousemove=c.chartHover?i(c,f,"chartHover",!0):t.noop}}var f;n&&window.G_vmlCanvasManager.initElement(l[0]),c.$watch("chartData",function(t,e){if(!t||!t.length||Array.isArray(t[0])&&!t[0].length)return void w(f,c);var a=r||c.chartType;if(a)return f&&o(t,e)?y(f,t,c):void d(a)},!0),c.$watch("chartSeries",s,!0),c.$watch("chartLabels",s,!0),c.$watch("chartOptions",s,!0),c.$watch("chartColors",s,!0),c.$watch("chartDatasetOverride",s,!0),c.$watch("chartType",function(r,e){b(r)||t.equals(r,e)||d(r)}),c.$on("$destroy",function(){w(f,c)}),c.$on("$resize",function(){f&&f.resize()})}}}}r.defaults.global.multiTooltipTemplate="<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>",r.defaults.global.tooltips.mode="label",r.defaults.global.elements.line.borderWidth=2,r.defaults.global.elements.rectangle.borderWidth=2,r.defaults.global.legend.display=!1,r.defaults.global.colors=["#97BBCD","#DCDCDC","#F7464A","#46BFBD","#FDB45C","#949FB1","#4D5360"];var n="object"==typeof window.G_vmlCanvasManager&&null!==window.G_vmlCanvasManager&&"function"==typeof window.G_vmlCanvasManager.initElement;return n&&(r.defaults.global.animation=!1),t.module("chart.js",[]).provider("ChartJs",e).factory("ChartJsFactory",["ChartJs","$timeout",a]).directive("chartBase",["ChartJsFactory",function(t){return new t}]).directive("chartLine",["ChartJsFactory",function(t){return new t("line")}]).directive("chartBar",["ChartJsFactory",function(t){return new t("bar")}]).directive("chartHorizontalBar",["ChartJsFactory",function(t){return new t("horizontalBar")}]).directive("chartRadar",["ChartJsFactory",function(t){return new t("radar")}]).directive("chartDoughnut",["ChartJsFactory",function(t){return new t("doughnut")}]).directive("chartPie",["ChartJsFactory",function(t){return new t("pie")}]).directive("chartPolarArea",["ChartJsFactory",function(t){return new t("polarArea")}])}); //# sourceMappingURL=angular-chart.min.js.map diff --git a/dist/angular-chart.min.js.map b/dist/angular-chart.min.js.map index b3892afa..d1b5d5a1 100644 --- a/dist/angular-chart.min.js.map +++ b/dist/angular-chart.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["angular-chart.min.js"],"names":["factory","exports","module","angular","require","Chart","define","amd","Error","ChartJsProvider","options","ChartJs","getOptions","type","typeOptions","extend","this","setOptions","customOptions","$get","ChartJsFactory","$timeout","canUpdateChart","newVal","oldVal","length","Array","isArray","every","element","index","reduce","sum","carry","val","getEventHandler","scope","chart","action","triggerOnlyOnChange","lastState","evt","atEvent","getElementsAtEvent","getPointsAtEvent","activePoints","call","equals","getColors","colors","copy","chartColors","defaults","global","notEnoughColors","chartData","push","chartGetColor","map","convertColor","color","getColor","hexToRgb","substr","getRandomColor","getRandomInt","backgroundColor","rgba","pointBackgroundColor","pointHoverBackgroundColor","borderColor","pointBorderColor","pointHoverBorderColor","min","max","Math","floor","random","alpha","useExcanvas","join","concat","hex","bigint","parseInt","r","g","b","getDataSets","labels","data","series","yaxis","datasets","item","i","dataset","label","yAxisID","getData","hoverBackgroundColor","updateChart","values","forEach","update","$emit","isEmpty","value","Object","keys","isResponsive","chartOptions","responsive","destroyChart","destroy","restrict","chartType","chartLabels","chartSeries","chartClick","chartHover","chartYAxes","link","elem","resetChart","createChart","clientHeight","cvs","ctx","getContext","onclick","noop","onmousemove","window","G_vmlCanvasManager","initElement","$watch","$on","resize","multiTooltipTemplate","tooltips","mode","elements","line","borderWidth","rectangle","legend","display","animation","provider","directive"],"mappings":"CAAC,SAAUA,GACT,YACA,IAAuB,gBAAZC,SAETC,OAAOD,QAAUD,EACI,mBAAZG,SAA0BA,QAAUC,QAAQ,WAClC,mBAAVC,OAAwBA,MAAQD,QAAQ,iBAC3C,IAAsB,kBAAXE,SAAyBA,OAAOC,IAEjDD,QAAQ,UAAW,SAAUN,OACxB,CAEL,GAAuB,mBAAZG,UAA4C,mBAAVE,OAAuB,KAAM,IAAIG,OAAM,oFAEpFR,GAAQG,QAASE,SAEnB,SAAUF,EAASE,GACnB,YA4CA,SAASI,KACP,GAAIC,MACAC,GACFN,MAAOA,EACPO,WAAY,SAAUC,GACpB,GAAIC,GAAcD,GAAQH,EAAQG,MAClC,OAAOV,GAAQY,UAAWL,EAASI,IAOvCE,MAAKC,WAAa,SAAUJ,EAAMK,GAEhC,MAAMA,QAMNR,EAAQG,GAAQV,EAAQY,OAAOL,EAAQG,OAAaK,KALlDA,EAAgBL,OAChBH,EAAUP,EAAQY,OAAOL,EAASQ,MAOtCF,KAAKG,KAAO,WACV,MAAOR,IAIX,QAASS,GAAgBT,EAASU,GAsGhC,QAASC,GAAgBC,EAAQC,GAC/B,MAAID,IAAUC,GAAUD,EAAOE,QAAUD,EAAOC,OACvCC,MAAMC,QAAQJ,EAAO,IAC5BA,EAAOE,SAAWD,EAAOC,QAAUF,EAAOK,MAAM,SAAUC,EAASC,GACjE,MAAOD,GAAQJ,SAAWD,EAAOM,GAA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AA1CD,QAAOC,mBAAmBC,WAInC,OAFIxD,KAAa1E,EAAM+C,SAASC,OAAO+F,WAAY,GAE5CjJ,EAAQD,OAAO,eACnBmJ,SAAS,UAAW5I,GACpBT,QAAQ,kBAAmB,UAAW,WAAYoB,IAClDkI,UAAU,aAAc,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,MACjFkI,UAAU,aAAc,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,GAAe,WAChGkI,UAAU,YAAa,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,GAAe,UAC/FkI,UAAU,sBAAuB,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,GAAe,oBACzGkI,UAAU,cAAe,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,GAAe,YACjGkI,UAAU,iBAAkB,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,GAAe,eACpGkI,UAAU,YAAa,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,GAAe,UAC/FkI,UAAU,kBAAmB,iBAAkB,SAAUlI,GAAkB,MAAO,IAAIA,GAAe","file":"angular-chart.min.js","sourcesContent":["(function (factory) {\n 'use strict';\n if (typeof exports === 'object') {\n // Node/CommonJS\n module.exports = factory(\n typeof angular !== 'undefined' ? angular : require('angular'),\n typeof Chart !== 'undefined' ? Chart : require('chart.js'));\n } else if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['angular', 'chart'], factory);\n } else {\n // Browser globals\n if (typeof angular === 'undefined' || typeof Chart === 'undefined') throw new Error('Chart.js library needs to included, ' +\n 'see http://jtblin.github.io/angular-chart.js/');\n factory(angular, Chart);\n }\n}(function (angular, Chart) {\n 'use strict';\n\n Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';\n Chart.defaults.global.tooltips.mode = 'label';\n Chart.defaults.global.elements.line.borderWidth = 2;\n Chart.defaults.global.elements.rectangle.borderWidth = 2;\n Chart.defaults.global.legend.display = false;\n Chart.defaults.global.colors = [\n '#97BBCD', // blue\n '#DCDCDC', // light grey\n '#F7464A', // red\n '#46BFBD', // green\n '#FDB45C', // yellow\n '#949FB1', // grey\n '#4D5360' // dark grey\n ];\n\n var useExcanvas = typeof window.G_vmlCanvasManager === 'object' &&\n window.G_vmlCanvasManager !== null &&\n typeof window.G_vmlCanvasManager.initElement === 'function';\n\n if (useExcanvas) Chart.defaults.global.animation = false;\n\n return angular.module('chart.js', [])\n .provider('ChartJs', ChartJsProvider)\n .factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])\n .directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }])\n .directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('line'); }])\n .directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bar'); }])\n .directive('chartHorizontalBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('horizontalBar'); }])\n .directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('radar'); }])\n .directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('doughnut'); }])\n .directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('pie'); }])\n .directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }]);\n\n /**\n * Wrapper for chart.js\n * Allows configuring chart js using the provider\n *\n * angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {\n * ChartJsProvider.setOptions({ responsive: true });\n * ChartJsProvider.setOptions('Line', { responsive: false });\n * })))\n */\n function ChartJsProvider () {\n var options = {};\n var ChartJs = {\n Chart: Chart,\n getOptions: function (type) {\n var typeOptions = type && options[type] || {};\n return angular.extend({}, options, typeOptions);\n }\n };\n\n /**\n * Allow to set global options during configuration\n */\n this.setOptions = function (type, customOptions) {\n // If no type was specified set option for the global object\n if (! customOptions) {\n customOptions = type;\n options = angular.extend(options, customOptions);\n return;\n }\n // Set options for the specific chart\n options[type] = angular.extend(options[type] || {}, customOptions);\n };\n\n this.$get = function () {\n return ChartJs;\n };\n }\n\n function ChartJsFactory (ChartJs, $timeout) {\n return function chart (type) {\n return {\n restrict: 'CA',\n scope: {\n chartGetColor: '=?',\n chartType: '=',\n chartData: '=?',\n chartLabels: '=?',\n chartOptions: '=?',\n chartSeries: '=?',\n chartColors: '=?',\n chartClick: '=?',\n chartHover: '=?',\n chartYAxes: '=?'\n },\n link: function (scope, elem/*, attrs */) {\n var chart;\n\n if (useExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);\n\n // Order of setting \"watch\" matter\n\n scope.$watch('chartData', function (newVal, oldVal) {\n if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) {\n destroyChart(chart, scope);\n return;\n }\n var chartType = type || scope.chartType;\n if (! chartType) return;\n\n if (chart && canUpdateChart(newVal, oldVal))\n return updateChart(chart, newVal, scope);\n\n createChart(chartType);\n }, true);\n\n scope.$watch('chartSeries', resetChart, true);\n scope.$watch('chartLabels', resetChart, true);\n scope.$watch('chartOptions', resetChart, true);\n scope.$watch('chartColors', resetChart, true);\n\n scope.$watch('chartType', function (newVal, oldVal) {\n if (isEmpty(newVal)) return;\n if (angular.equals(newVal, oldVal)) return;\n createChart(newVal);\n });\n\n scope.$on('$destroy', function () {\n destroyChart(chart, scope);\n });\n\n scope.$on('$resize', function () {\n if (chart) chart.resize();\n });\n\n function resetChart (newVal, oldVal) {\n if (isEmpty(newVal)) return;\n if (angular.equals(newVal, oldVal)) return;\n var chartType = type || scope.chartType;\n if (! chartType) return;\n\n // chart.update() doesn't work for series and labels\n // so we have to re-create the chart entirely\n createChart(chartType);\n }\n\n function createChart (type) {\n // TODO: check parent?\n if (isResponsive(type, scope) && elem[0].clientHeight === 0) {\n return $timeout(function () {\n createChart(type);\n }, 50, false);\n }\n if (! scope.chartData || ! scope.chartData.length) return;\n scope.chartGetColor = typeof scope.chartGetColor === 'function' ? scope.chartGetColor : getRandomColor;\n var colors = getColors(type, scope);\n var cvs = elem[0], ctx = cvs.getContext('2d');\n var data = Array.isArray(scope.chartData[0]) ?\n getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartYAxes) :\n getData(scope.chartLabels, scope.chartData, colors);\n\n var options = angular.extend({}, ChartJs.getOptions(type), scope.chartOptions);\n // Destroy old chart if it exists to avoid ghost charts issue\n // https://github.com/jtblin/angular-chart.js/issues/187\n destroyChart(chart, scope);\n\n chart = new ChartJs.Chart(ctx, {\n type: type,\n data: data,\n options: options\n });\n scope.$emit('chart-create', chart);\n\n // Bind events\n cvs.onclick = scope.chartClick ? getEventHandler(scope, chart, 'chartClick', false) : angular.noop;\n cvs.onmousemove = scope.chartHover ? getEventHandler(scope, chart, 'chartHover', true) : angular.noop;\n }\n }\n };\n };\n\n function canUpdateChart (newVal, oldVal) {\n if (newVal && oldVal && newVal.length && oldVal.length) {\n return Array.isArray(newVal[0]) ?\n newVal.length === oldVal.length && newVal.every(function (element, index) {\n return element.length === oldVal[index].length; }) :\n oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;\n }\n return false;\n }\n\n function sum (carry, val) {\n return carry + val;\n }\n\n function getEventHandler (scope, chart, action, triggerOnlyOnChange) {\n var lastState = null;\n return function (evt) {\n var atEvent = chart.getElementsAtEvent || chart.getPointsAtEvent;\n if (atEvent) {\n var activePoints = atEvent.call(chart, evt);\n if (triggerOnlyOnChange === false || angular.equals(lastState, activePoints) === false) {\n lastState = activePoints;\n scope[action](activePoints, evt);\n }\n }\n };\n }\n\n function getColors (type, scope) {\n var colors = angular.copy(scope.chartColors ||\n ChartJs.getOptions(type).chartColors ||\n Chart.defaults.global.colors\n );\n var notEnoughColors = colors.length < scope.chartData.length;\n while (colors.length < scope.chartData.length) {\n colors.push(scope.chartGetColor());\n }\n // mutate colors in this case as we don't want\n // the colors to change on each refresh\n if (notEnoughColors) scope.chartColors = colors;\n return colors.map(convertColor);\n }\n\n function convertColor (color) {\n if (typeof color === 'object' && color !== null) return color;\n if (typeof color === 'string' && color[0] === '#') return getColor(hexToRgb(color.substr(1)));\n return getRandomColor();\n }\n\n function getRandomColor () {\n var color = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];\n return getColor(color);\n }\n\n function getColor (color) {\n return {\n backgroundColor: rgba(color, 0.2),\n pointBackgroundColor: rgba(color, 1),\n pointHoverBackgroundColor: rgba(color, 0.8),\n borderColor: rgba(color, 1),\n pointBorderColor: '#fff',\n pointHoverBorderColor: rgba(color, 1)\n };\n }\n\n function getRandomInt (min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n }\n\n function rgba (color, alpha) {\n // rgba not supported by IE8\n return useExcanvas ? 'rgb(' + color.join(',') + ')' : 'rgba(' + color.concat(alpha).join(',') + ')';\n }\n\n // Credit: http://stackoverflow.com/a/11508164/1190235\n function hexToRgb (hex) {\n var bigint = parseInt(hex, 16),\n r = (bigint >> 16) & 255,\n g = (bigint >> 8) & 255,\n b = bigint & 255;\n\n return [r, g, b];\n }\n\n function getDataSets (labels, data, series, colors, yaxis) {\n return {\n labels: labels,\n datasets: data.map(function (item, i) {\n var dataset = angular.extend({}, colors[i], {\n label: series[i],\n data: item\n });\n if (yaxis) {\n dataset.yAxisID = yaxis[i];\n }\n return dataset;\n })\n };\n }\n\n function getData (labels, data, colors) {\n return {\n labels: labels,\n datasets: [{\n data: data,\n backgroundColor: colors.map(function (color) {\n return color.pointBackgroundColor;\n }),\n hoverBackgroundColor: colors.map(function (color) {\n return color.backgroundColor;\n })\n }]\n };\n }\n\n function updateChart (chart, values, scope) {\n if (Array.isArray(scope.chartData[0])) {\n chart.data.datasets.forEach(function (dataset, i) {\n dataset.data = values[i];\n });\n } else {\n chart.data.datasets[0].data = values;\n }\n\n chart.update();\n scope.$emit('chart-update', chart);\n }\n\n function isEmpty (value) {\n return ! value ||\n (Array.isArray(value) && ! value.length) ||\n (typeof value === 'object' && ! Object.keys(value).length);\n }\n\n function isResponsive (type, scope) {\n var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.chartOptions);\n return options.responsive;\n }\n\n function destroyChart(chart, scope) {\n if(! chart) return;\n chart.destroy();\n scope.$emit('chart-destroy', chart);\n }\n }\n}));\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["angular-chart.min.js"],"names":["factory","exports","module","angular","require","Chart","define","amd","Error","ChartJsProvider","options","ChartJs","getOptions","type","typeOptions","extend","this","setOptions","customOptions","$get","ChartJsFactory","$timeout","canUpdateChart","newVal","oldVal","length","Array","isArray","every","element","index","reduce","sum","carry","val","getEventHandler","scope","chart","action","triggerOnlyOnChange","lastState","evt","atEvent","getElementsAtEvent","getPointsAtEvent","activePoints","call","equals","getColors","colors","copy","chartColors","defaults","global","notEnoughColors","chartData","push","chartGetColor","map","convertColor","color","getColor","hexToRgb","substr","getRandomColor","getRandomInt","backgroundColor","rgba","pointBackgroundColor","pointHoverBackgroundColor","borderColor","pointBorderColor","pointHoverBorderColor","min","max","Math","floor","random","alpha","useExcanvas","join","concat","hex","bigint","parseInt","r","g","b","hasData","chartLabels","getDataSets","labels","data","series","datasetOverride","datasets","item","i","dataset","label","merge","getData","hoverBackgroundColor","updateChart","values","forEach","update","$emit","isEmpty","value","Object","keys","isResponsive","chartOptions","responsive","destroyChart","destroy","restrict","chartType","chartSeries","chartClick","chartHover","chartDatasetOverride","link","elem","resetChart","createChart","clientHeight","cvs","ctx","getContext","onclick","noop","onmousemove","window","G_vmlCanvasManager","initElement","$watch","$on","resize","multiTooltipTemplate","tooltips","mode","elements","line","borderWidth","rectangle","legend","display","animation","provider","directive"],"mappings":"CAAC,SAAUA,GACT,YACA,IAAuB,gBAAZC,SAETC,OAAOD,QAAUD,EACI,mBAAZG,SAA0BA,QAAUC,QAAQ,WAClC,mBAAVC,OAAwBA,MAAQD,QAAQ,iBAC3C,IAAsB,kBAAXE,SAAyBA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GAAkB,MAAO,IAAIA,GAAe,WAChGmI,UAAU,YAAa,iBAAkB,SAAUnI,GAAkB,MAAO,IAAIA,GAAe,UAC/FmI,UAAU,sBAAuB,iBAAkB,SAAUnI,GAAkB,MAAO,IAAIA,GAAe,oBACzGmI,UAAU,cAAe,iBAAkB,SAAUnI,GAAkB,MAAO,IAAIA,GAAe,YACjGmI,UAAU,iBAAkB,iBAAkB,SAAUnI,GAAkB,MAAO,IAAIA,GAAe,eACpGmI,UAAU,YAAa,iBAAkB,SAAUnI,GAAkB,MAAO,IAAIA,GAAe,UAC/FmI,UAAU,kBAAmB,iBAAkB,SAAUnI,GAAkB,MAAO,IAAIA,GAAe","file":"angular-chart.min.js","sourcesContent":["(function (factory) {\n 'use strict';\n if (typeof exports === 'object') {\n // Node/CommonJS\n module.exports = factory(\n typeof angular !== 'undefined' ? angular : require('angular'),\n typeof Chart !== 'undefined' ? Chart : require('chart.js'));\n } else if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['angular', 'chart'], factory);\n } else {\n // Browser globals\n if (typeof angular === 'undefined' || typeof Chart === 'undefined') throw new Error('Chart.js library needs to included, ' +\n 'see http://jtblin.github.io/angular-chart.js/');\n factory(angular, Chart);\n }\n}(function (angular, Chart) {\n 'use strict';\n\n Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';\n Chart.defaults.global.tooltips.mode = 'label';\n Chart.defaults.global.elements.line.borderWidth = 2;\n Chart.defaults.global.elements.rectangle.borderWidth = 2;\n Chart.defaults.global.legend.display = false;\n Chart.defaults.global.colors = [\n '#97BBCD', // blue\n '#DCDCDC', // light grey\n '#F7464A', // red\n '#46BFBD', // green\n '#FDB45C', // yellow\n '#949FB1', // grey\n '#4D5360' // dark grey\n ];\n\n var useExcanvas = typeof window.G_vmlCanvasManager === 'object' &&\n window.G_vmlCanvasManager !== null &&\n typeof window.G_vmlCanvasManager.initElement === 'function';\n\n if (useExcanvas) Chart.defaults.global.animation = false;\n\n return angular.module('chart.js', [])\n .provider('ChartJs', ChartJsProvider)\n .factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])\n .directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }])\n .directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('line'); }])\n .directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bar'); }])\n .directive('chartHorizontalBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('horizontalBar'); }])\n .directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('radar'); }])\n .directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('doughnut'); }])\n .directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('pie'); }])\n .directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }]);\n\n /**\n * Wrapper for chart.js\n * Allows configuring chart js using the provider\n *\n * angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {\n * ChartJsProvider.setOptions({ responsive: true });\n * ChartJsProvider.setOptions('Line', { responsive: false });\n * })))\n */\n function ChartJsProvider () {\n var options = {};\n var ChartJs = {\n Chart: Chart,\n getOptions: function (type) {\n var typeOptions = type && options[type] || {};\n return angular.extend({}, options, typeOptions);\n }\n };\n\n /**\n * Allow to set global options during configuration\n */\n this.setOptions = function (type, customOptions) {\n // If no type was specified set option for the global object\n if (! customOptions) {\n customOptions = type;\n options = angular.extend(options, customOptions);\n return;\n }\n // Set options for the specific chart\n options[type] = angular.extend(options[type] || {}, customOptions);\n };\n\n this.$get = function () {\n return ChartJs;\n };\n }\n\n function ChartJsFactory (ChartJs, $timeout) {\n return function chart (type) {\n return {\n restrict: 'CA',\n scope: {\n chartGetColor: '=?',\n chartType: '=',\n chartData: '=?',\n chartLabels: '=?',\n chartOptions: '=?',\n chartSeries: '=?',\n chartColors: '=?',\n chartClick: '=?',\n chartHover: '=?',\n chartDatasetOverride: '=?'\n },\n link: function (scope, elem/*, attrs */) {\n var chart;\n\n if (useExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);\n\n // Order of setting \"watch\" matter\n\n scope.$watch('chartData', function (newVal, oldVal) {\n if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) {\n destroyChart(chart, scope);\n return;\n }\n var chartType = type || scope.chartType;\n if (! chartType) return;\n\n if (chart && canUpdateChart(newVal, oldVal))\n return updateChart(chart, newVal, scope);\n\n createChart(chartType);\n }, true);\n\n scope.$watch('chartSeries', resetChart, true);\n scope.$watch('chartLabels', resetChart, true);\n scope.$watch('chartOptions', resetChart, true);\n scope.$watch('chartColors', resetChart, true);\n scope.$watch('chartDatasetOverride', resetChart, true);\n\n scope.$watch('chartType', function (newVal, oldVal) {\n if (isEmpty(newVal)) return;\n if (angular.equals(newVal, oldVal)) return;\n createChart(newVal);\n });\n\n scope.$on('$destroy', function () {\n destroyChart(chart, scope);\n });\n\n scope.$on('$resize', function () {\n if (chart) chart.resize();\n });\n\n function resetChart (newVal, oldVal) {\n if (isEmpty(newVal)) return;\n if (angular.equals(newVal, oldVal)) return;\n var chartType = type || scope.chartType;\n if (! chartType) return;\n\n // chart.update() doesn't work for series and labels\n // so we have to re-create the chart entirely\n createChart(chartType);\n }\n\n function createChart (type) {\n // TODO: check parent?\n if (isResponsive(type, scope) && elem[0].clientHeight === 0) {\n return $timeout(function () {\n createChart(type);\n }, 50, false);\n }\n if (! hasData(scope)) return;\n scope.chartGetColor = typeof scope.chartGetColor === 'function' ? scope.chartGetColor : getRandomColor;\n var colors = getColors(type, scope);\n var cvs = elem[0], ctx = cvs.getContext('2d');\n var data = Array.isArray(scope.chartData[0]) ?\n getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartDatasetOverride) :\n getData(scope.chartLabels, scope.chartData, colors, scope.chartDatasetOverride);\n\n var options = angular.extend({}, ChartJs.getOptions(type), scope.chartOptions);\n // Destroy old chart if it exists to avoid ghost charts issue\n // https://github.com/jtblin/angular-chart.js/issues/187\n destroyChart(chart, scope);\n\n chart = new ChartJs.Chart(ctx, {\n type: type,\n data: data,\n options: options\n });\n scope.$emit('chart-create', chart);\n\n // Bind events\n cvs.onclick = scope.chartClick ? getEventHandler(scope, chart, 'chartClick', false) : angular.noop;\n cvs.onmousemove = scope.chartHover ? getEventHandler(scope, chart, 'chartHover', true) : angular.noop;\n }\n }\n };\n };\n\n function canUpdateChart (newVal, oldVal) {\n if (newVal && oldVal && newVal.length && oldVal.length) {\n return Array.isArray(newVal[0]) ?\n newVal.length === oldVal.length && newVal.every(function (element, index) {\n return element.length === oldVal[index].length; }) :\n oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;\n }\n return false;\n }\n\n function sum (carry, val) {\n return carry + val;\n }\n\n function getEventHandler (scope, chart, action, triggerOnlyOnChange) {\n var lastState = null;\n return function (evt) {\n var atEvent = chart.getElementsAtEvent || chart.getPointsAtEvent;\n if (atEvent) {\n var activePoints = atEvent.call(chart, evt);\n if (triggerOnlyOnChange === false || angular.equals(lastState, activePoints) === false) {\n lastState = activePoints;\n scope[action](activePoints, evt);\n }\n }\n };\n }\n\n function getColors (type, scope) {\n var colors = angular.copy(scope.chartColors ||\n ChartJs.getOptions(type).chartColors ||\n Chart.defaults.global.colors\n );\n var notEnoughColors = colors.length < scope.chartData.length;\n while (colors.length < scope.chartData.length) {\n colors.push(scope.chartGetColor());\n }\n // mutate colors in this case as we don't want\n // the colors to change on each refresh\n if (notEnoughColors) scope.chartColors = colors;\n return colors.map(convertColor);\n }\n\n function convertColor (color) {\n if (typeof color === 'object' && color !== null) return color;\n if (typeof color === 'string' && color[0] === '#') return getColor(hexToRgb(color.substr(1)));\n return getRandomColor();\n }\n\n function getRandomColor () {\n var color = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];\n return getColor(color);\n }\n\n function getColor (color) {\n return {\n backgroundColor: rgba(color, 0.2),\n pointBackgroundColor: rgba(color, 1),\n pointHoverBackgroundColor: rgba(color, 0.8),\n borderColor: rgba(color, 1),\n pointBorderColor: '#fff',\n pointHoverBorderColor: rgba(color, 1)\n };\n }\n\n function getRandomInt (min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n }\n\n function rgba (color, alpha) {\n // rgba not supported by IE8\n return useExcanvas ? 'rgb(' + color.join(',') + ')' : 'rgba(' + color.concat(alpha).join(',') + ')';\n }\n\n // Credit: http://stackoverflow.com/a/11508164/1190235\n function hexToRgb (hex) {\n var bigint = parseInt(hex, 16),\n r = (bigint >> 16) & 255,\n g = (bigint >> 8) & 255,\n b = bigint & 255;\n\n return [r, g, b];\n }\n\n function hasData (scope) {\n return scope.chartData && scope.chartData.length &&\n scope.chartLabels && scope.chartLabels.length;\n }\n\n function getDataSets (labels, data, series, colors, datasetOverride) {\n return {\n labels: labels,\n datasets: data.map(function (item, i) {\n var dataset = angular.extend({}, colors[i], {\n label: series[i],\n data: item\n });\n if (datasetOverride && datasetOverride.length >= i) {\n angular.merge(dataset, datasetOverride[i]);\n }\n return dataset;\n })\n };\n }\n\n function getData (labels, data, colors, datasetOverride) {\n var dataset = {\n labels: labels,\n datasets: [{\n data: data,\n backgroundColor: colors.map(function (color) {\n return color.pointBackgroundColor;\n }),\n hoverBackgroundColor: colors.map(function (color) {\n return color.backgroundColor;\n })\n }]\n };\n if (datasetOverride) {\n angular.merge(dataset.datasets[0], datasetOverride);\n }\n return dataset;\n }\n\n function updateChart (chart, values, scope) {\n if (Array.isArray(scope.chartData[0])) {\n chart.data.datasets.forEach(function (dataset, i) {\n dataset.data = values[i];\n });\n } else {\n chart.data.datasets[0].data = values;\n }\n\n chart.update();\n scope.$emit('chart-update', chart);\n }\n\n function isEmpty (value) {\n return ! value ||\n (Array.isArray(value) && ! value.length) ||\n (typeof value === 'object' && ! Object.keys(value).length);\n }\n\n function isResponsive (type, scope) {\n var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.chartOptions);\n return options.responsive;\n }\n\n function destroyChart(chart, scope) {\n if(! chart) return;\n chart.destroy();\n scope.$emit('chart-destroy', chart);\n }\n }\n}));\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/examples/app.js b/examples/app.js index 0a25a6b6..cbdca50c 100644 --- a/examples/app.js +++ b/examples/app.js @@ -9,8 +9,8 @@ colors: ['#97BBCD', '#DCDCDC', '#F7464A', '#46BFBD', '#FDB45C', '#949FB1', '#4D5360'] }); // Configure all doughnut charts - ChartJsProvider.setOptions('Doughnut', { - animateScale: true + ChartJsProvider.setOptions('doughnut', { + cutoutPercentage: 60 }); }); @@ -36,7 +36,7 @@ console.log('No point'); } }; - $scope.multiAxis = ['y-axis-1', 'y-axis-2']; + $scope.datasetOverride = [{ yAxisID: 'y-axis-1' }, { yAxisID: 'y-axis-2' }]; $scope.options = { scales: { @@ -143,6 +143,30 @@ ]; }); + app.controller('MixedChartCtrl', ['$scope', function ($scope) { + $scope.colors = ['#45b7cd', '#ff6384', '#ff8e72']; + + $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; + $scope.data = [ + [65, -59, 80, 81, -56, 55, -40], + [28, 48, -40, 19, 86, 27, 90] + ]; + $scope.datasetOverride = [ + { + label: 'Bar chart', + borderWidth: 1, + type: 'bar' + }, + { + label: 'Line chart', + borderWidth: 3, + hoverBackgroundColor: 'rgba(255,99,132,0.4)', + hoverBorderColor: 'rgba(255,99,132,1)', + type: 'line' + } + ]; + }]); + app.controller('DataTablesCtrl', function ($scope) { $scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; $scope.data = [ diff --git a/examples/charts.html b/examples/charts.html index c9f62f70..7312581f 100644 --- a/examples/charts.html +++ b/examples/charts.html @@ -70,6 +70,7 @@
  • Getting started
  • Reactive
  • +
  • Mixed type charts