Committed by
Gerrit Code Review
Add Chart.js and angular-chart.js libraries for Web GUI
Change-Id: Ibcbb9df8a8dc28273e731608ec3cdb1fc49b7ef1
Showing
9 changed files
with
92 additions
and
0 deletions
... | @@ -35,6 +35,9 @@ | ... | @@ -35,6 +35,9 @@ |
35 | <script src="tp/d3.js"></script> | 35 | <script src="tp/d3.js"></script> |
36 | <script src="tp/topojson.v1.min.js"></script> | 36 | <script src="tp/topojson.v1.min.js"></script> |
37 | 37 | ||
38 | + <script src="tp/Chart.min.js"></script> | ||
39 | + <script src="tp/angular-chart.min.js"></script> | ||
40 | + | ||
38 | <!-- ONOS UI Framework included here --> | 41 | <!-- ONOS UI Framework included here --> |
39 | <!-- TODO: use a single catenated-minified file here --> | 42 | <!-- TODO: use a single catenated-minified file here --> |
40 | <script src="onos.js"></script> | 43 | <script src="onos.js"></script> |
... | @@ -81,6 +84,8 @@ | ... | @@ -81,6 +84,8 @@ |
81 | <script src="app/fw/layer/loading.js"></script> | 84 | <script src="app/fw/layer/loading.js"></script> |
82 | 85 | ||
83 | <!-- Framework and library stylesheets included here --> | 86 | <!-- Framework and library stylesheets included here --> |
87 | + <link rel="stylesheet" href="tp/angular-chart.min.css"> | ||
88 | + | ||
84 | <!-- TODO: use a single catenated-minified file here --> | 89 | <!-- TODO: use a single catenated-minified file here --> |
85 | <link rel="stylesheet" href="app/onos.css"> | 90 | <link rel="stylesheet" href="app/onos.css"> |
86 | <link rel="stylesheet" href="app/common.css"> | 91 | <link rel="stylesheet" href="app/common.css"> | ... | ... |
web/gui/src/main/webapp/tp/Chart.LICENSE
0 → 100755
1 | +Copyright (c) 2013-2016 Nick Downie | ||
2 | + | ||
3 | +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: | ||
4 | + | ||
5 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
6 | + | ||
7 | +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. |
web/gui/src/main/webapp/tp/Chart.js
0 → 100755
This diff could not be displayed because it is too large.
web/gui/src/main/webapp/tp/Chart.min.js
0 → 100755
This diff is collapsed. Click to expand it.
1 | +Copyright (c) Jerome Touffe-Blin ("Author") | ||
2 | +All rights reserved. | ||
3 | + | ||
4 | +The BSD License | ||
5 | + | ||
6 | +Redistribution and use in source and binary forms, with or without | ||
7 | +modification, are permitted provided that the following conditions | ||
8 | +are met: | ||
9 | + | ||
10 | +1. Redistributions of source code must retain the above copyright | ||
11 | + notice, this list of conditions and the following disclaimer. | ||
12 | + | ||
13 | +2. Redistributions in binary form must reproduce the above copyright | ||
14 | + notice, this list of conditions and the following disclaimer in the | ||
15 | + documentation and/or other materials provided with the distribution. | ||
16 | + | ||
17 | +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
18 | +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
20 | +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | ||
21 | +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
22 | +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
23 | +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
24 | +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
25 | +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
26 | +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
27 | +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
web/gui/src/main/webapp/tp/angular-chart.css
0 → 100644
1 | +.chart-legend, | ||
2 | +.bar-legend, | ||
3 | +.line-legend, | ||
4 | +.pie-legend, | ||
5 | +.radar-legend, | ||
6 | +.polararea-legend, | ||
7 | +.doughnut-legend { | ||
8 | + list-style-type: none; | ||
9 | + margin-top: 5px; | ||
10 | + text-align: center; | ||
11 | + /* NOTE: Browsers automatically add 40px of padding-left to all lists, so we should offset that, otherwise the legend is off-center */ | ||
12 | + -webkit-padding-start: 0; | ||
13 | + /* Webkit */ | ||
14 | + -moz-padding-start: 0; | ||
15 | + /* Mozilla */ | ||
16 | + padding-left: 0; | ||
17 | + /* IE (handles all cases, really, but we should also include the vendor-specific properties just to be safe) */ | ||
18 | +} | ||
19 | +.chart-legend li, | ||
20 | +.bar-legend li, | ||
21 | +.line-legend li, | ||
22 | +.pie-legend li, | ||
23 | +.radar-legend li, | ||
24 | +.polararea-legend li, | ||
25 | +.doughnut-legend li { | ||
26 | + display: inline-block; | ||
27 | + white-space: nowrap; | ||
28 | + position: relative; | ||
29 | + margin-bottom: 4px; | ||
30 | + border-radius: 5px; | ||
31 | + padding: 2px 8px 2px 28px; | ||
32 | + font-size: smaller; | ||
33 | + cursor: default; | ||
34 | +} | ||
35 | +.chart-legend li span, | ||
36 | +.bar-legend li span, | ||
37 | +.line-legend li span, | ||
38 | +.pie-legend li span, | ||
39 | +.radar-legend li span, | ||
40 | +.polararea-legend li span, | ||
41 | +.doughnut-legend li span { | ||
42 | + display: block; | ||
43 | + position: absolute; | ||
44 | + left: 0; | ||
45 | + top: 0; | ||
46 | + width: 20px; | ||
47 | + height: 20px; | ||
48 | + border-radius: 5px; | ||
49 | +} |
web/gui/src/main/webapp/tp/angular-chart.js
0 → 100644
This diff is collapsed. Click to expand it.
1 | +.chart-legend,.bar-legend,.line-legend,.pie-legend,.radar-legend,.polararea-legend,.doughnut-legend{list-style-type:none;margin-top:5px;text-align:center;-webkit-padding-start:0;-moz-padding-start:0;padding-left:0}.chart-legend li,.bar-legend li,.line-legend li,.pie-legend li,.radar-legend li,.polararea-legend li,.doughnut-legend li{display:inline-block;white-space:nowrap;position:relative;margin-bottom:4px;border-radius:5px;padding:2px 8px 2px 28px;font-size:smaller;cursor:default}.chart-legend li span,.bar-legend li span,.line-legend li span,.pie-legend li span,.radar-legend li span,.polararea-legend li span,.doughnut-legend li span{display:block;position:absolute;left:0;top:0;width:20px;height:20px;border-radius:5px} | ||
2 | +/*# sourceMappingURL=angular-chart.min.css.map */ |
1 | +!function(t){"use strict";"object"==typeof exports?module.exports=t("undefined"!=typeof angular?angular:require("angular"),"undefined"!=typeof Chart?Chart:require("chart.js")):"function"==typeof define&&define.amd?define(["angular","chart"],t):t(angular,Chart)}(function(t,e){"use strict";function n(){var n={},r={Chart:e,getOptions:function(e){var r=e&&n[e]||{};return t.extend({},n,r)}};this.setOptions=function(e,r){return r?void(n[e]=t.extend(n[e]||{},r)):(r=e,void(n=t.extend(n,r)))},this.$get=function(){return r}}function r(n,r){function o(t,e){return t&&e&&t.length&&e.length?Array.isArray(t[0])?t.length===e.length&&t.every(function(t,n){return t.length===e[n].length}):e.reduce(i,0)>0?t.length===e.length:!1:!1}function i(t,e){return t+e}function c(e,n,r,a){var o=null;return function(i){var c=n.getPointsAtEvent||n.getBarsAtEvent||n.getSegmentsAtEvent;if(c){var l=c.call(n,i);(a===!1||t.equals(o,l)===!1)&&(o=l,e[r](l,i),e.$apply())}}}function l(r,a){for(var o=t.copy(a.colours||n.getOptions(r).colours||e.defaults.global.colours);o.length<a.data.length;)o.push(a.getColour());return o.map(u)}function u(t){return"object"==typeof t&&null!==t?t:"string"==typeof t&&"#"===t[0]?f(g(t.substr(1))):s()}function s(){var t=[h(0,255),h(0,255),h(0,255)];return f(t)}function f(t){return{fillColor:d(t,.2),strokeColor:d(t,1),pointColor:d(t,1),pointStrokeColor:"#fff",pointHighlightFill:"#fff",pointHighlightStroke:d(t,.8)}}function h(t,e){return Math.floor(Math.random()*(e-t+1))+t}function d(t,e){return a?"rgb("+t.join(",")+")":"rgba("+t.concat(e).join(",")+")"}function g(t){var e=parseInt(t,16),n=e>>16&255,r=e>>8&255,a=255&e;return[n,r,a]}function p(e,n,r,a){return{labels:e,datasets:n.map(function(e,n){return t.extend({},a[n],{label:r[n],data:e})})}}function v(e,n,r){return e.map(function(e,a){return t.extend({},r[a],{label:e,value:n[a],color:r[a].strokeColor,highlight:r[a].pointHighlightStroke})})}function y(t,e){var n=t.parent(),r=n.find("chart-legend"),a="<chart-legend>"+e.generateLegend()+"</chart-legend>";r.length?r.replaceWith(a):n.append(a)}function C(t,e,n,r){Array.isArray(n.data[0])?t.datasets.forEach(function(t,n){(t.points||t.bars).forEach(function(t,r){t.value=e[n][r]})}):t.segments.forEach(function(t,n){t.value=e[n]}),t.update(),n.$emit("update",t),n.legend&&"false"!==n.legend&&y(r,t)}function b(t){return!t||Array.isArray(t)&&!t.length||"object"==typeof t&&!Object.keys(t).length}function m(r,a){var o=t.extend({},e.defaults.global,n.getOptions(r),a.options);return o.responsive}return function(e){return{restrict:"CA",scope:{data:"=?",labels:"=?",options:"=?",series:"=?",colours:"=?",getColour:"=?",chartType:"=",legend:"@",click:"=?",hover:"=?",chartData:"=?",chartLabels:"=?",chartOptions:"=?",chartSeries:"=?",chartColours:"=?",chartLegend:"@",chartClick:"=?",chartHover:"=?"},link:function(i,u){function f(t,e){i.$watch(t,function(t){"undefined"!=typeof t&&(i[e]=t)})}function h(n,r){if(!b(n)&&!t.equals(n,r)){var a=e||i.chartType;a&&(w&&w.destroy(),d(a))}}function d(e){if(m(e,i)&&0===u[0].clientHeight&&0===A.clientHeight)return r(function(){d(e)},50,!1);if(i.data&&i.data.length){i.getColour="function"==typeof i.getColour?i.getColour:s,i.colours=l(e,i);var a=u[0],o=a.getContext("2d"),f=Array.isArray(i.data[0])?p(i.labels,i.data,i.series||[],i.colours):v(i.labels,i.data,i.colours),h=t.extend({},n.getOptions(e),i.options);w=new n.Chart(o)[e](f,h),i.$emit("create",w),a.onclick=i.click?c(i,w,"click",!1):t.noop,a.onmousemove=i.hover?c(i,w,"hover",!0):t.noop,i.legend&&"false"!==i.legend&&y(u,w)}}function g(t){if("undefined"!=typeof console&&"test"!==n.getOptions().env){var e="function"==typeof console.warn?console.warn:console.log;i[t]&&e.call(console,'"%s" is deprecated and will be removed in a future version. Please use "chart-%s" instead.',t,t)}}var w,A=document.createElement("div");A.className="chart-container",u.replaceWith(A),A.appendChild(u[0]),a&&window.G_vmlCanvasManager.initElement(u[0]),["data","labels","options","series","colours","legend","click","hover"].forEach(g),f("chartData","data"),f("chartLabels","labels"),f("chartOptions","options"),f("chartSeries","series"),f("chartColours","colours"),f("chartLegend","legend"),f("chartClick","click"),f("chartHover","hover"),i.$watch("data",function(t,n){if(t&&t.length&&(!Array.isArray(t[0])||t[0].length)){var r=e||i.chartType;if(r){if(w){if(o(t,n))return C(w,t,i,u);w.destroy()}d(r)}}},!0),i.$watch("series",h,!0),i.$watch("labels",h,!0),i.$watch("options",h,!0),i.$watch("colours",h,!0),i.$watch("chartType",function(e,n){b(e)||t.equals(e,n)||(w&&w.destroy(),d(e))}),i.$on("$destroy",function(){w&&w.destroy()})}}}}e.defaults.global.responsive=!0,e.defaults.global.multiTooltipTemplate="<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>",e.defaults.global.colours=["#97BBCD","#DCDCDC","#F7464A","#46BFBD","#FDB45C","#949FB1","#4D5360"];var a="object"==typeof window.G_vmlCanvasManager&&null!==window.G_vmlCanvasManager&&"function"==typeof window.G_vmlCanvasManager.initElement;return a&&(e.defaults.global.animation=!1),t.module("chart.js",[]).provider("ChartJs",n).factory("ChartJsFactory",["ChartJs","$timeout",r]).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("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")}])}); | ||
2 | +//# sourceMappingURL=angular-chart.min.js.map |
-
Please register or login to post a comment