diff options
author | 2017-04-27 07:53:18 -0400 | |
---|---|---|
committer | 2017-04-27 08:31:27 -0400 | |
commit | 6beb446925c967aca92f5513adf36c5db77c00d6 (patch) | |
tree | 9392057ed0739de2445c5b2a2a8bee6dcdacbcf7 /ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js | |
parent | 246b225194e3e8dc1926294de591a94fd9787fa7 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: Ia1efa4deacdc5701e6205104ac021a6c80ed60ba
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js')
-rw-r--r-- | ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js deleted file mode 100644 index 912de8d8..00000000 --- a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js +++ /dev/null @@ -1,122 +0,0 @@ - -var nv = window.nv || {}; - - -nv.version = '1.1.13b'; -nv.dev = true //set false when in production - -window.nv = nv; - -nv.tooltip = {}; // For the tooltip system -nv.utils = nv.utils || {}; // Utility subsystem -nv.models = {}; //stores all the possible models/components -nv.charts = {}; //stores all the ready to use charts -nv.graphs = []; //stores all the graphs currently on the page -nv.logs = {}; //stores some statistics and potential error messages - -nv.dispatch = d3.dispatch('render_start', 'render_end'); - -// ************************************************************************* -// Development render timers - disabled if dev = false - -if (nv.dev) { - nv.dispatch.on('render_start', function(e) { - nv.logs.startTime = +new Date(); - }); - - nv.dispatch.on('render_end', function(e) { - nv.logs.endTime = +new Date(); - nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime; - nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times - }); -} - -// ******************************************** -// Public Core NV functions - -// Logs all arguments, and returns the last so you can test things in place -// Note: in IE8 console.log is an object not a function, and if modernizr is used -// then calling Function.prototype.bind with with anything other than a function -// causes a TypeError to be thrown. -nv.log = function() { - if (nv.dev && console.log && console.log.apply) - console.log.apply(console, arguments) - else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) { - var log = Function.prototype.bind.call(console.log, console); - log.apply(console, arguments); - } - return arguments[arguments.length - 1]; -}; - - -nv.render = function render(step) { - step = step || 1; // number of graphs to generate in each timeout loop - - nv.render.active = true; - nv.dispatch.render_start(); - - setTimeout(function() { - var chart, graph; - - for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) { - chart = graph.generate(); - if (typeof graph.callback == typeof(Function)) graph.callback(chart); - nv.graphs.push(chart); - } - - nv.render.queue.splice(0, i); - - if (nv.render.queue.length) setTimeout(arguments.callee, 0); - else { nv.render.active = false; nv.dispatch.render_end(); } - }, 0); -}; - -nv.render.active = false; -nv.render.queue = []; - -nv.addGraph = function(obj) { - if (typeof arguments[0] === typeof(Function)) - obj = {generate: arguments[0], callback: arguments[1]}; - - nv.render.queue.push(obj); - - if (!nv.render.active) nv.render(); -}; - -nv.identity = function(d) { return d; }; - -nv.strip = function(s) { return s.replace(/(\s|&)/g,''); }; - -function daysInMonth(month,year) { - return (new Date(year, month+1, 0)).getDate(); -} - -function d3_time_range(floor, step, number) { - return function(t0, t1, dt) { - var time = floor(t0), times = []; - if (time < t0) step(time); - if (dt > 1) { - while (time < t1) { - var date = new Date(+time); - if ((number(date) % dt === 0)) times.push(date); - step(time); - } - } else { - while (time < t1) { times.push(new Date(+time)); step(time); } - } - return times; - }; -} - -d3.time.monthEnd = function(date) { - return new Date(date.getFullYear(), date.getMonth(), 0); -}; - -d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) { - date.setUTCDate(date.getUTCDate() + 1); - date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear())); - }, function(date) { - return date.getMonth(); - } -); - |