diff --git a/.npmignore b/.npmignore index b453f43f..46dd1f7d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,5 @@ misc node_modules -src test tools .idea diff --git a/HISTORY.md b/HISTORY.md index 9b46741f..03bb5783 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,54 @@ http://visjs.org +## 2014-07-22, version 3.1.0 + +### General + +- Refactored the code to commonjs modules, which are browserifyable. This allows + to create custom builds. + +### Timeline + +- Implemented function `getVisibleItems()`, which returns the items visible + in the current window. +- Added options `margin.item.horizontal` and `margin.item.vertical`, which + allows to specify different margins horizontally/vertically. +- Removed check for number of arguments in callbacks `onAdd`, `onUpdate`, + `onRemove`, and `onMove`. +- Fixed items in groups sometimes being displayed but not positioned correctly. +- Fixed range where the `end` of the first is equal to the `start` of the second + sometimes being stacked instead of put besides each other when `item.margin=0` + due to round-off errors. + +### Network (formerly named Graph) + +- Expanded smoothCurves options for improved support for large clusters. +- Added multiple types of smoothCurve drawing for greatly improved performance. +- Option for inherited edge colors from connected nodes. +- Option to disable the drawing of nodes or edges on drag. +- Fixed support nodes not being cleaned up if edges are removed. +- Improved edge selection detection for long smooth curves. +- Fixed dot radius bug. +- Updated max velocity of nodes to three times it's original value. +- Made "stabilized" event fire every time the network stabilizes. +- Fixed drift in dragging nodes while zooming. +- Fixed recursively constructing of hierarchical layouts. +- Added borderWidth option for nodes. +- Implemented new Hierarchical view solver. +- Fixed an issue with selecting nodes when the web page is scrolled down. +- Added Gephi JSON parser +- Added Neighbour Highlight example +- Added Import From Gephi example +- Enabled color parsing for nodes when supplied with rgb(xxx,xxx,xxx) value. + +### DataSet + +- Added .get() returnType option to return as JSON object, Array or Google + DataTable. + + + ## 2014-07-07, version 3.0.0 ### Timeline diff --git a/Jakefile.js b/Jakefile.js deleted file mode 100644 index 53945f6d..00000000 --- a/Jakefile.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Jake build script - */ -var jake = require('jake'), - browserify = require('browserify'), - wrench = require('wrench'), - CleanCSS = require('clean-css'), - fs = require('fs'); - -require('jake-utils'); - -// constants -var DIST = './dist'; -var VIS = DIST + '/vis.js'; -var VIS_CSS = DIST + '/vis.css'; -var VIS_TMP = DIST + '/vis.js.tmp'; -var VIS_MIN = DIST + '/vis.min.js'; -var VIS_MIN_CSS = DIST + '/vis.min.css'; - -/** - * default task - */ -desc('Default task: build all libraries'); -task('default', ['build', 'minify'], function () { - console.log('done'); -}); - -/** - * build the visualization library vis.js - */ -desc('Build the visualization library vis.js'); -task('build', {async: true}, function () { - jake.mkdirP(DIST); - jake.mkdirP(DIST + '/img'); - - // concatenate and stringify the css files - concat({ - src: [ - './src/timeline/component/css/timeline.css', - './src/timeline/component/css/panel.css', - './src/timeline/component/css/labelset.css', - './src/timeline/component/css/itemset.css', - './src/timeline/component/css/item.css', - './src/timeline/component/css/timeaxis.css', - './src/timeline/component/css/currenttime.css', - './src/timeline/component/css/customtime.css', - './src/timeline/component/css/animation.css', - - './src/timeline/component/css/dataaxis.css', - './src/timeline/component/css/pathStyles.css', - - './src/network/css/network-manipulation.css', - './src/network/css/network-navigation.css' - ], - dest: VIS_CSS, - separator: '\n' - }); - console.log('created ' + VIS_CSS); - - // concatenate the script files - concat({ - dest: VIS_TMP, - src: [ - './src/module/imports.js', - - './src/shim.js', - './src/util.js', - './src/DOMutil.js', - './src/DataSet.js', - './src/DataView.js', - - './src/timeline/component/GraphGroup.js', - './src/timeline/component/Legend.js', - './src/timeline/component/DataAxis.js', - './src/timeline/component/LineGraph.js', - './src/timeline/DataStep.js', - - './src/timeline/Stack.js', - './src/timeline/TimeStep.js', - './src/timeline/Range.js', - './src/timeline/component/Component.js', - './src/timeline/component/TimeAxis.js', - './src/timeline/component/CurrentTime.js', - './src/timeline/component/CustomTime.js', - './src/timeline/component/ItemSet.js', - './src/timeline/component/item/*.js', - './src/timeline/component/Group.js', - './src/timeline/Timeline.js', - './src/timeline/Graph2d.js', - - './src/network/dotparser.js', - './src/network/shapes.js', - './src/network/Node.js', - './src/network/Edge.js', - './src/network/Popup.js', - './src/network/Groups.js', - './src/network/Images.js', - './src/network/networkMixins/physics/PhysicsMixin.js', - './src/network/networkMixins/physics/HierarchialRepulsion.js', - './src/network/networkMixins/physics/BarnesHut.js', - './src/network/networkMixins/physics/Repulsion.js', - './src/network/networkMixins/HierarchicalLayoutMixin.js', - './src/network/networkMixins/ManipulationMixin.js', - './src/network/networkMixins/SectorsMixin.js', - './src/network/networkMixins/ClusterMixin.js', - './src/network/networkMixins/SelectionMixin.js', - './src/network/networkMixins/NavigationMixin.js', - './src/network/networkMixins/MixinLoader.js', - './src/network/Network.js', - - './src/graph3d/Graph3d.js', - - './src/module/exports.js' - ], - - separator: '\n' - }); - - // copy images - wrench.copyDirSyncRecursive('./src/network/img', DIST + '/img/network', { - forceDelete: true - }); - wrench.copyDirSyncRecursive('./src/timeline/img', DIST + '/img/timeline', { - forceDelete: true - }); - - var timeStart = Date.now(); - // bundle the concatenated script and dependencies into one file - var b = browserify(); - b.add(VIS_TMP); - b.bundle({ - standalone: 'vis' - }, function (err, code) { - if(err) { - throw err; - } - console.log("browserify",Date.now() - timeStart); timeStart = Date.now(); - // add header and footer - var lib = read('./src/module/header.js') + code; - - // write bundled file - write(VIS, lib); - console.log('created js' + VIS); - - // remove temporary file - fs.unlinkSync(VIS_TMP); - - // update version number and stuff in the javascript files - replacePlaceholders(VIS); - - complete(); - }); -}); - -/** - * minify the visualization library vis.js - */ -desc('Minify the visualization library vis.js'); -task('minify', {async: true}, function () { - // minify javascript - minify({ - src: VIS, - dest: VIS_MIN, - header: read('./src/module/header.js') - }); - - // update version number and stuff in the javascript files - replacePlaceholders(VIS_MIN); - - console.log('created minified ' + VIS_MIN); - - var minified = new CleanCSS().minify(read(VIS_CSS)); - write(VIS_MIN_CSS, minified); - console.log('created minified ' + VIS_MIN_CSS); -}); - -/** - * test task - */ -desc('Test the library'); -task('test', function () { - // TODO: use a testing suite for testing: nodeunit, mocha, tap, ... - var filelist = new jake.FileList(); - filelist.include([ - './test/**/*.js' - ]); - - var files = filelist.toArray(); - files.forEach(function (file) { - require('./' + file); - }); - - console.log('Executed ' + files.length + ' test files successfully'); -}); - -/** - * replace version, date, and name placeholders in the provided file - * @param {String} filename - */ -var replacePlaceholders = function (filename) { - replace({ - replacements: [ - {pattern: '@@date', replacement: today()}, - {pattern: '@@version', replacement: version()} - ], - src: filename - }); -}; diff --git a/README.md b/README.md index f2727a89..2fe36fcb 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ or load vis.js using require.js. Note that vis.css must be loaded too. ```js require.config({ paths: { - vis: 'path/to/vis', + vis: 'path/to/vis/dist', } }); require(['vis'], function (math) { @@ -124,15 +124,9 @@ To build the library from source, clone the project from github git clone git://github.com/almende/vis.git -The project uses [jake](https://github.com/mde/jake) as build tool. -The build script uses [Browserify](http://browserify.org/) to -bundle the source code into a library, -and uses [UglifyJS](http://lisperator.net/uglifyjs/) to minify the code. The source code uses the module style of node (require and module.exports) to -organize dependencies. - -To install all dependencies and build the library, run `npm install` in the -root of the project. +organize dependencies. To install all dependencies and build the library, +run `npm install` in the root of the project. cd vis npm install @@ -141,6 +135,132 @@ Then, the project can be build running: npm run build +To automatically rebuild on changes in the source files, once can use + + npm run watch + +This will both build and minify the library on changes. Minifying is relatively +slow, so when only the non-minified library is needed, one can use the +`watch-dev` script instead: + + npm run watch-dev + + +## Custom builds + +The folder `dist` contains bundled versions of vis.js for direct use in the browser. These bundles contain the all visualizations and includes external dependencies such as hammer.js and moment.js. + +The source code of vis.js consists of commonjs modules, which makes it possible to create custom bundles using tools like [Browserify](http://browserify.org/) or [Webpack](http://webpack.github.io/). This can be bundling just one visualization like the Timeline, or bundling vis.js as part of your own browserified web application. Note that hammer.js v1.0.6 or newer is required. + +#### Example 1: Bundle a single visualization + +For example, to create a bundle with just the Timeline and DataSet, create an index file named **custom.js** in the root of the project, containing: + +```js +exports.DataSet = require('./lib/DataSet'); +exports.Timeline = require('./lib/timeline/Timeline'); +``` + +Install browserify globally via `[sudo] npm install -g browserify`, then create a custom bundle like: + + browserify custom.js -o vis-custom.js -s vis + +This will generate a custom bundle *vis-custom.js*, which exposes the namespace `vis` containing only `DataSet` and `Timeline`. The generated bundle can be minified with uglifyjs (installed globally with `[sudo] npm install -g uglify-js`): + + uglifyjs vis-custom.js -o vis-custom.min.js + +The custom bundle can now be loaded like: + +```html + + + + + + + + ... + + +``` + +#### Example 2: Exclude external libraries + +The default bundle `vis.js` is standalone and includes external dependencies such as hammer.js and moment.js. When these libraries are already loaded by the application, vis.js does not need to include these dependencies itself too. To build a custom bundle of vis.js excluding moment.js and hammer.js, run browserify in the root of the project: + + browserify index.js -o vis-custom.js -s vis -x moment -x hammerjs + +This will generate a custom bundle *vis-custom.js*, which exposes the namespace `vis`, and has moment and hammerjs excluded. The generated bundle can be minified with uglifyjs: + + uglifyjs vis-custom.js -o vis-custom.min.js + +The custom bundle can now be loaded as: + +```html + + + + + + + + + + + + + ... + + +``` + +#### Example 3: Bundle vis.js as part of your (commonjs) application + +When writing a web application with commonjs modules, vis.js can be packaged automatically into the application. Create a file **app.js** containing: + +```js +var moment = require('moment'); +var DataSet = require('vis/lib/DataSet'); +var Timeline = require('vis/lib/timeline/Timeline'); + +var container = document.getElementById('visualization'); +var data = new DataSet([ + {id: 1, content: 'item 1', start: moment('2013-04-20')}, + {id: 2, content: 'item 2', start: moment('2013-04-14')}, + {id: 3, content: 'item 3', start: moment('2013-04-18')}, + {id: 4, content: 'item 4', start: moment('2013-04-16'), end: moment('2013-04-19')}, + {id: 5, content: 'item 5', start: moment('2013-04-25')}, + {id: 6, content: 'item 6', start: moment('2013-04-27')} +]); +var options = {}; +var timeline = new Timeline(container, data, options); +``` + +Install the application dependencies via npm: + + npm install vis moment + +The application can be bundled and minified: + + browserify app.js -o app-bundle.js + uglifyjs app-bundle.js -o app-bundle.min.js + +And loaded into a webpage: + +```html + + + + + + +
+ + + + +``` + ## Test diff --git a/bower.json b/bower.json index e4b9c545..c995b1ad 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "vis", - "version": "3.0.0", + "version": "3.1.0", "description": "A dynamic, browser-based visualization library.", "homepage": "http://visjs.org/", "repository": { @@ -10,11 +10,10 @@ "ignore": [ "misc", "node_modules", - "src", "test", "tools", ".idea", - "Jakefile.js", + "gulpfile.js", "package.json", ".npmignore", ".gitignore" diff --git a/dist/vis-light.js b/dist/vis-light.js new file mode 100644 index 00000000..043071b2 --- /dev/null +++ b/dist/vis-light.js @@ -0,0 +1,26664 @@ +/** + * vis.js + * https://github.com/almende/vis + * + * A dynamic, browser-based visualization library. + * + * @version 3.0.1-SNAPSHOT + * @date 2014-07-22 + * + * @license + * Copyright (C) 2011-2014 Almende B.V, http://almende.com + * + * 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. + */ + +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("moment"), require("hammerjs")); + else if(typeof define === 'function' && define.amd) + define(["moment", "hammerjs"], factory); + else if(typeof exports === 'object') + exports["vis"] = factory(require("moment"), require("hammerjs")); + else + root["vis"] = factory(root["moment"], root["hammerjs"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_17__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + // utils + exports.util = __webpack_require__(1); + exports.DOMutil = __webpack_require__(4); + + // data + exports.DataSet = __webpack_require__(5); + exports.DataView = __webpack_require__(6); + + // Graph3d + exports.Graph3d = __webpack_require__(7); + exports.graph3d = { + Camera: __webpack_require__(11), + Filter: __webpack_require__(12), + Point2d: __webpack_require__(10), + Point3d: __webpack_require__(9), + Slider: __webpack_require__(13), + StepNumber: __webpack_require__(14) + }; + + // Timeline + exports.Timeline = __webpack_require__(15); + exports.Graph2d = __webpack_require__(32); + exports.timeline = { + DataStep: __webpack_require__(35), + Range: __webpack_require__(18), + stack: __webpack_require__(27), + TimeStep: __webpack_require__(22), + + components: { + items: { + Item: __webpack_require__(29), + ItemBox: __webpack_require__(30), + ItemPoint: __webpack_require__(31), + ItemRange: __webpack_require__(28) + }, + + Component: __webpack_require__(20), + CurrentTime: __webpack_require__(23), + CustomTime: __webpack_require__(24), + DataAxis: __webpack_require__(34), + GraphGroup: __webpack_require__(36), + Group: __webpack_require__(26), + ItemSet: __webpack_require__(25), + Legend: __webpack_require__(37), + LineGraph: __webpack_require__(33), + TimeAxis: __webpack_require__(21) + } + }; + + // Network + exports.Network = __webpack_require__(38); + exports.network = { + Edge: __webpack_require__(45), + Groups: __webpack_require__(42), + Images: __webpack_require__(43), + Node: __webpack_require__(44), + Popup: __webpack_require__(46), + dotparser: __webpack_require__(40), + gephiParser: __webpack_require__(41) + }; + + // Deprecated since v3.0.0 + exports.Graph = function () { + throw new Error('Graph is renamed to Network. Please create a graph as new vis.Network(...)'); + }; + + // bundled external libraries + exports.moment = __webpack_require__(2); + exports.hammer = __webpack_require__(16); + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + // utility functions + + // first check if moment.js is already loaded in the browser window, if so, + // use this instance. Else, load via commonjs. + var moment = __webpack_require__(2); + + /** + * Test whether given object is a number + * @param {*} object + * @return {Boolean} isNumber + */ + exports.isNumber = function(object) { + return (object instanceof Number || typeof object == 'number'); + }; + + /** + * Test whether given object is a string + * @param {*} object + * @return {Boolean} isString + */ + exports.isString = function(object) { + return (object instanceof String || typeof object == 'string'); + }; + + /** + * Test whether given object is a Date, or a String containing a Date + * @param {Date | String} object + * @return {Boolean} isDate + */ + exports.isDate = function(object) { + if (object instanceof Date) { + return true; + } + else if (exports.isString(object)) { + // test whether this string contains a date + var match = ASPDateRegex.exec(object); + if (match) { + return true; + } + else if (!isNaN(Date.parse(object))) { + return true; + } + } + + return false; + }; + + /** + * Test whether given object is an instance of google.visualization.DataTable + * @param {*} object + * @return {Boolean} isDataTable + */ + exports.isDataTable = function(object) { + return (typeof (google) !== 'undefined') && + (google.visualization) && + (google.visualization.DataTable) && + (object instanceof google.visualization.DataTable); + }; + + /** + * Create a semi UUID + * source: http://stackoverflow.com/a/105074/1262753 + * @return {String} uuid + */ + exports.randomUUID = function() { + var S4 = function () { + return Math.floor( + Math.random() * 0x10000 /* 65536 */ + ).toString(16); + }; + + return ( + S4() + S4() + '-' + + S4() + '-' + + S4() + '-' + + S4() + '-' + + S4() + S4() + S4() + ); + }; + + /** + * Extend object a with the properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Object} a + * @param {... Object} b + * @return {Object} a + */ + exports.extend = function (a, b) { + for (var i = 1, len = arguments.length; i < len; i++) { + var other = arguments[i]; + for (var prop in other) { + if (other.hasOwnProperty(prop)) { + a[prop] = other[prop]; + } + } + } + + return a; + }; + + /** + * Extend object a with selected properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Array.} props + * @param {Object} a + * @param {... Object} b + * @return {Object} a + */ + exports.selectiveExtend = function (props, a, b) { + if (!Array.isArray(props)) { + throw new Error('Array with property names expected as first argument'); + } + + for (var i = 2; i < arguments.length; i++) { + var other = arguments[i]; + + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (other.hasOwnProperty(prop)) { + a[prop] = other[prop]; + } + } + } + return a; + }; + + /** + * Extend object a with selected properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Array.} props + * @param {Object} a + * @param {... Object} b + * @return {Object} a + */ + exports.selectiveDeepExtend = function (props, a, b) { + // TODO: add support for Arrays to deepExtend + if (Array.isArray(b)) { + throw new TypeError('Arrays are not supported by deepExtend'); + } + for (var i = 2; i < arguments.length; i++) { + var other = arguments[i]; + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (other.hasOwnProperty(prop)) { + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + exports.deepExtend(a[prop], b[prop]); + } + else { + a[prop] = b[prop]; + } + } else if (Array.isArray(b[prop])) { + throw new TypeError('Arrays are not supported by deepExtend'); + } else { + a[prop] = b[prop]; + } + + } + } + } + return a; + }; + + /** + * Deep extend an object a with the properties of object b + * @param {Object} a + * @param {Object} b + * @returns {Object} + */ + exports.deepExtend = function(a, b) { + // TODO: add support for Arrays to deepExtend + if (Array.isArray(b)) { + throw new TypeError('Arrays are not supported by deepExtend'); + } + + for (var prop in b) { + if (b.hasOwnProperty(prop)) { + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + exports.deepExtend(a[prop], b[prop]); + } + else { + a[prop] = b[prop]; + } + } else if (Array.isArray(b[prop])) { + throw new TypeError('Arrays are not supported by deepExtend'); + } else { + a[prop] = b[prop]; + } + } + } + return a; + }; + + /** + * Test whether all elements in two arrays are equal. + * @param {Array} a + * @param {Array} b + * @return {boolean} Returns true if both arrays have the same length and same + * elements. + */ + exports.equalArray = function (a, b) { + if (a.length != b.length) return false; + + for (var i = 0, len = a.length; i < len; i++) { + if (a[i] != b[i]) return false; + } + + return true; + }; + + /** + * Convert an object to another type + * @param {Boolean | Number | String | Date | Moment | Null | undefined} object + * @param {String | undefined} type Name of the type. Available types: + * 'Boolean', 'Number', 'String', + * 'Date', 'Moment', ISODate', 'ASPDate'. + * @return {*} object + * @throws Error + */ + exports.convert = function(object, type) { + var match; + + if (object === undefined) { + return undefined; + } + if (object === null) { + return null; + } + + if (!type) { + return object; + } + if (!(typeof type === 'string') && !(type instanceof String)) { + throw new Error('Type must be a string'); + } + + //noinspection FallthroughInSwitchStatementJS + switch (type) { + case 'boolean': + case 'Boolean': + return Boolean(object); + + case 'number': + case 'Number': + return Number(object.valueOf()); + + case 'string': + case 'String': + return String(object); + + case 'Date': + if (exports.isNumber(object)) { + return new Date(object); + } + if (object instanceof Date) { + return new Date(object.valueOf()); + } + else if (moment.isMoment(object)) { + return new Date(object.valueOf()); + } + if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return new Date(Number(match[1])); // parse number + } + else { + return moment(object).toDate(); // parse string + } + } + else { + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type Date'); + } + + case 'Moment': + if (exports.isNumber(object)) { + return moment(object); + } + if (object instanceof Date) { + return moment(object.valueOf()); + } + else if (moment.isMoment(object)) { + return moment(object); + } + if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return moment(Number(match[1])); // parse number + } + else { + return moment(object); // parse string + } + } + else { + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type Date'); + } + + case 'ISODate': + if (exports.isNumber(object)) { + return new Date(object); + } + else if (object instanceof Date) { + return object.toISOString(); + } + else if (moment.isMoment(object)) { + return object.toDate().toISOString(); + } + else if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return new Date(Number(match[1])).toISOString(); // parse number + } + else { + return new Date(object).toISOString(); // parse string + } + } + else { + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type ISODate'); + } + + case 'ASPDate': + if (exports.isNumber(object)) { + return '/Date(' + object + ')/'; + } + else if (object instanceof Date) { + return '/Date(' + object.valueOf() + ')/'; + } + else if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + var value; + if (match) { + // object is an ASP date + value = new Date(Number(match[1])).valueOf(); // parse number + } + else { + value = new Date(object).valueOf(); // parse string + } + return '/Date(' + value + ')/'; + } + else { + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type ASPDate'); + } + + default: + throw new Error('Unknown type "' + type + '"'); + } + }; + + // parse ASP.Net Date pattern, + // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/' + // code from http://momentjs.com/ + var ASPDateRegex = /^\/?Date\((\-?\d+)/i; + + /** + * Get the type of an object, for example exports.getType([]) returns 'Array' + * @param {*} object + * @return {String} type + */ + exports.getType = function(object) { + var type = typeof object; + + if (type == 'object') { + if (object == null) { + return 'null'; + } + if (object instanceof Boolean) { + return 'Boolean'; + } + if (object instanceof Number) { + return 'Number'; + } + if (object instanceof String) { + return 'String'; + } + if (object instanceof Array) { + return 'Array'; + } + if (object instanceof Date) { + return 'Date'; + } + return 'Object'; + } + else if (type == 'number') { + return 'Number'; + } + else if (type == 'boolean') { + return 'Boolean'; + } + else if (type == 'string') { + return 'String'; + } + + return type; + }; + + /** + * Retrieve the absolute left value of a DOM element + * @param {Element} elem A dom element, for example a div + * @return {number} left The absolute left position of this element + * in the browser page. + */ + exports.getAbsoluteLeft = function(elem) { + return elem.getBoundingClientRect().left + window.pageXOffset; + }; + + /** + * Retrieve the absolute top value of a DOM element + * @param {Element} elem A dom element, for example a div + * @return {number} top The absolute top position of this element + * in the browser page. + */ + exports.getAbsoluteTop = function(elem) { + return elem.getBoundingClientRect().top + window.pageYOffset; + }; + + /** + * add a className to the given elements style + * @param {Element} elem + * @param {String} className + */ + exports.addClassName = function(elem, className) { + var classes = elem.className.split(' '); + if (classes.indexOf(className) == -1) { + classes.push(className); // add the class to the array + elem.className = classes.join(' '); + } + }; + + /** + * add a className to the given elements style + * @param {Element} elem + * @param {String} className + */ + exports.removeClassName = function(elem, className) { + var classes = elem.className.split(' '); + var index = classes.indexOf(className); + if (index != -1) { + classes.splice(index, 1); // remove the class from the array + elem.className = classes.join(' '); + } + }; + + /** + * For each method for both arrays and objects. + * In case of an array, the built-in Array.forEach() is applied. + * In case of an Object, the method loops over all properties of the object. + * @param {Object | Array} object An Object or Array + * @param {function} callback Callback method, called for each item in + * the object or array with three parameters: + * callback(value, index, object) + */ + exports.forEach = function(object, callback) { + var i, + len; + if (object instanceof Array) { + // array + for (i = 0, len = object.length; i < len; i++) { + callback(object[i], i, object); + } + } + else { + // object + for (i in object) { + if (object.hasOwnProperty(i)) { + callback(object[i], i, object); + } + } + } + }; + + /** + * Convert an object into an array: all objects properties are put into the + * array. The resulting array is unordered. + * @param {Object} object + * @param {Array} array + */ + exports.toArray = function(object) { + var array = []; + + for (var prop in object) { + if (object.hasOwnProperty(prop)) array.push(object[prop]); + } + + return array; + } + + /** + * Update a property in an object + * @param {Object} object + * @param {String} key + * @param {*} value + * @return {Boolean} changed + */ + exports.updateProperty = function(object, key, value) { + if (object[key] !== value) { + object[key] = value; + return true; + } + else { + return false; + } + }; + + /** + * Add and event listener. Works for all browsers + * @param {Element} element An html element + * @param {string} action The action, for example "click", + * without the prefix "on" + * @param {function} listener The callback function to be executed + * @param {boolean} [useCapture] + */ + exports.addEventListener = function(element, action, listener, useCapture) { + if (element.addEventListener) { + if (useCapture === undefined) + useCapture = false; + + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox + } + + element.addEventListener(action, listener, useCapture); + } else { + element.attachEvent("on" + action, listener); // IE browsers + } + }; + + /** + * Remove an event listener from an element + * @param {Element} element An html dom element + * @param {string} action The name of the event, for example "mousedown" + * @param {function} listener The listener function + * @param {boolean} [useCapture] + */ + exports.removeEventListener = function(element, action, listener, useCapture) { + if (element.removeEventListener) { + // non-IE browsers + if (useCapture === undefined) + useCapture = false; + + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox + } + + element.removeEventListener(action, listener, useCapture); + } else { + // IE browsers + element.detachEvent("on" + action, listener); + } + }; + + /** + * Cancels the event if it is cancelable, without stopping further propagation of the event. + */ + exports.preventDefault = function (event) { + if (!event) + event = window.event; + + if (event.preventDefault) { + event.preventDefault(); // non-IE browsers + } + else { + event.returnValue = false; // IE browsers + } + }; + + /** + * Get HTML element which is the target of the event + * @param {Event} event + * @return {Element} target element + */ + exports.getTarget = function(event) { + // code from http://www.quirksmode.org/js/events_properties.html + if (!event) { + event = window.event; + } + + var target; + + if (event.target) { + target = event.target; + } + else if (event.srcElement) { + target = event.srcElement; + } + + if (target.nodeType != undefined && target.nodeType == 3) { + // defeat Safari bug + target = target.parentNode; + } + + return target; + }; + + exports.option = {}; + + /** + * Convert a value into a boolean + * @param {Boolean | function | undefined} value + * @param {Boolean} [defaultValue] + * @returns {Boolean} bool + */ + exports.option.asBoolean = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } + + if (value != null) { + return (value != false); + } + + return defaultValue || null; + }; + + /** + * Convert a value into a number + * @param {Boolean | function | undefined} value + * @param {Number} [defaultValue] + * @returns {Number} number + */ + exports.option.asNumber = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } + + if (value != null) { + return Number(value) || defaultValue || null; + } + + return defaultValue || null; + }; + + /** + * Convert a value into a string + * @param {String | function | undefined} value + * @param {String} [defaultValue] + * @returns {String} str + */ + exports.option.asString = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } + + if (value != null) { + return String(value); + } + + return defaultValue || null; + }; + + /** + * Convert a size or location into a string with pixels or a percentage + * @param {String | Number | function | undefined} value + * @param {String} [defaultValue] + * @returns {String} size + */ + exports.option.asSize = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } + + if (exports.isString(value)) { + return value; + } + else if (exports.isNumber(value)) { + return value + 'px'; + } + else { + return defaultValue || null; + } + }; + + /** + * Convert a value into a DOM element + * @param {HTMLElement | function | undefined} value + * @param {HTMLElement} [defaultValue] + * @returns {HTMLElement | null} dom + */ + exports.option.asElement = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } + + return value || defaultValue || null; + }; + + + + exports.GiveDec = function(Hex) { + var Value; + + if (Hex == "A") + Value = 10; + else if (Hex == "B") + Value = 11; + else if (Hex == "C") + Value = 12; + else if (Hex == "D") + Value = 13; + else if (Hex == "E") + Value = 14; + else if (Hex == "F") + Value = 15; + else + Value = eval(Hex); + + return Value; + }; + + exports.GiveHex = function(Dec) { + var Value; + + if(Dec == 10) + Value = "A"; + else if (Dec == 11) + Value = "B"; + else if (Dec == 12) + Value = "C"; + else if (Dec == 13) + Value = "D"; + else if (Dec == 14) + Value = "E"; + else if (Dec == 15) + Value = "F"; + else + Value = "" + Dec; + + return Value; + }; + + /** + * Parse a color property into an object with border, background, and + * highlight colors + * @param {Object | String} color + * @return {Object} colorObject + */ + exports.parseColor = function(color) { + var c; + if (exports.isString(color)) { + if (exports.isValidRGB(color)) { + var rgb = color.substr(4).substr(0,color.length-5).split(','); + color = exports.RGBToHex(rgb[0],rgb[1],rgb[2]); + } + if (exports.isValidHex(color)) { + var hsv = exports.hexToHSV(color); + var lighterColorHSV = {h:hsv.h,s:hsv.s * 0.45,v:Math.min(1,hsv.v * 1.05)}; + var darkerColorHSV = {h:hsv.h,s:Math.min(1,hsv.v * 1.25),v:hsv.v*0.6}; + var darkerColorHex = exports.HSVToHex(darkerColorHSV.h ,darkerColorHSV.h ,darkerColorHSV.v); + var lighterColorHex = exports.HSVToHex(lighterColorHSV.h,lighterColorHSV.s,lighterColorHSV.v); + + c = { + background: color, + border:darkerColorHex, + highlight: { + background:lighterColorHex, + border:darkerColorHex + }, + hover: { + background:lighterColorHex, + border:darkerColorHex + } + }; + } + else { + c = { + background:color, + border:color, + highlight: { + background:color, + border:color + }, + hover: { + background:color, + border:color + } + }; + } + } + else { + c = {}; + c.background = color.background || 'white'; + c.border = color.border || c.background; + + if (exports.isString(color.highlight)) { + c.highlight = { + border: color.highlight, + background: color.highlight + } + } + else { + c.highlight = {}; + c.highlight.background = color.highlight && color.highlight.background || c.background; + c.highlight.border = color.highlight && color.highlight.border || c.border; + } + + if (exports.isString(color.hover)) { + c.hover = { + border: color.hover, + background: color.hover + } + } + else { + c.hover = {}; + c.hover.background = color.hover && color.hover.background || c.background; + c.hover.border = color.hover && color.hover.border || c.border; + } + } + + return c; + }; + + /** + * http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php + * + * @param {String} hex + * @returns {{r: *, g: *, b: *}} + */ + exports.hexToRGB = function(hex) { + hex = hex.replace("#","").toUpperCase(); + + var a = exports.GiveDec(hex.substring(0, 1)); + var b = exports.GiveDec(hex.substring(1, 2)); + var c = exports.GiveDec(hex.substring(2, 3)); + var d = exports.GiveDec(hex.substring(3, 4)); + var e = exports.GiveDec(hex.substring(4, 5)); + var f = exports.GiveDec(hex.substring(5, 6)); + + var r = (a * 16) + b; + var g = (c * 16) + d; + var b = (e * 16) + f; + + return {r:r,g:g,b:b}; + }; + + exports.RGBToHex = function(red,green,blue) { + var a = exports.GiveHex(Math.floor(red / 16)); + var b = exports.GiveHex(red % 16); + var c = exports.GiveHex(Math.floor(green / 16)); + var d = exports.GiveHex(green % 16); + var e = exports.GiveHex(Math.floor(blue / 16)); + var f = exports.GiveHex(blue % 16); + + var hex = a + b + c + d + e + f; + return "#" + hex; + }; + + + /** + * http://www.javascripter.net/faq/rgb2hsv.htm + * + * @param red + * @param green + * @param blue + * @returns {*} + * @constructor + */ + exports.RGBToHSV = function(red,green,blue) { + red=red/255; green=green/255; blue=blue/255; + var minRGB = Math.min(red,Math.min(green,blue)); + var maxRGB = Math.max(red,Math.max(green,blue)); + + // Black-gray-white + if (minRGB == maxRGB) { + return {h:0,s:0,v:minRGB}; + } + + // Colors other than black-gray-white: + var d = (red==minRGB) ? green-blue : ((blue==minRGB) ? red-green : blue-red); + var h = (red==minRGB) ? 3 : ((blue==minRGB) ? 1 : 5); + var hue = 60*(h - d/(maxRGB - minRGB))/360; + var saturation = (maxRGB - minRGB)/maxRGB; + var value = maxRGB; + return {h:hue,s:saturation,v:value}; + }; + + + /** + * https://gist.github.com/mjijackson/5311256 + * @param h + * @param s + * @param v + * @returns {{r: number, g: number, b: number}} + * @constructor + */ + exports.HSVToRGB = function(h, s, v) { + var r, g, b; + + var i = Math.floor(h * 6); + var f = h * 6 - i; + var p = v * (1 - s); + var q = v * (1 - f * s); + var t = v * (1 - (1 - f) * s); + + switch (i % 6) { + case 0: r = v, g = t, b = p; break; + case 1: r = q, g = v, b = p; break; + case 2: r = p, g = v, b = t; break; + case 3: r = p, g = q, b = v; break; + case 4: r = t, g = p, b = v; break; + case 5: r = v, g = p, b = q; break; + } + + return {r:Math.floor(r * 255), g:Math.floor(g * 255), b:Math.floor(b * 255) }; + }; + + exports.HSVToHex = function(h, s, v) { + var rgb = exports.HSVToRGB(h, s, v); + return exports.RGBToHex(rgb.r, rgb.g, rgb.b); + }; + + exports.hexToHSV = function(hex) { + var rgb = exports.hexToRGB(hex); + return exports.RGBToHSV(rgb.r, rgb.g, rgb.b); + }; + + exports.isValidHex = function(hex) { + var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); + return isOk; + }; + + exports.isValidRGB = function(rgb) { + rgb = rgb.replace(" ",""); + var isOk = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(rgb); + return isOk; + } + + /** + * This recursively redirects the prototype of JSON objects to the referenceObject + * This is used for default options. + * + * @param referenceObject + * @returns {*} + */ + exports.selectiveBridgeObject = function(fields, referenceObject) { + if (typeof referenceObject == "object") { + var objectTo = Object.create(referenceObject); + for (var i = 0; i < fields.length; i++) { + if (referenceObject.hasOwnProperty(fields[i])) { + if (typeof referenceObject[fields[i]] == "object") { + objectTo[fields[i]] = exports.bridgeObject(referenceObject[fields[i]]); + } + } + } + return objectTo; + } + else { + return null; + } + }; + + /** + * This recursively redirects the prototype of JSON objects to the referenceObject + * This is used for default options. + * + * @param referenceObject + * @returns {*} + */ + exports.bridgeObject = function(referenceObject) { + if (typeof referenceObject == "object") { + var objectTo = Object.create(referenceObject); + for (var i in referenceObject) { + if (referenceObject.hasOwnProperty(i)) { + if (typeof referenceObject[i] == "object") { + objectTo[i] = exports.bridgeObject(referenceObject[i]); + } + } + } + return objectTo; + } + else { + return null; + } + }; + + + /** + * this is used to set the options of subobjects in the options object. A requirement of these subobjects + * is that they have an 'enabled' element which is optional for the user but mandatory for the program. + * + * @param [object] mergeTarget | this is either this.options or the options used for the groups. + * @param [object] options | options + * @param [String] option | this is the option key in the options argument + * @private + */ + exports.mergeOptions = function (mergeTarget, options, option) { + if (options[option] !== undefined) { + if (typeof options[option] == 'boolean') { + mergeTarget[option].enabled = options[option]; + } + else { + mergeTarget[option].enabled = true; + for (prop in options[option]) { + if (options[option].hasOwnProperty(prop)) { + mergeTarget[option][prop] = options[option][prop]; + } + } + } + } + } + + + /** + * this is used to set the options of subobjects in the options object. A requirement of these subobjects + * is that they have an 'enabled' element which is optional for the user but mandatory for the program. + * + * @param [object] mergeTarget | this is either this.options or the options used for the groups. + * @param [object] options | options + * @param [String] option | this is the option key in the options argument + * @private + */ + exports.mergeOptions = function (mergeTarget, options, option) { + if (options[option] !== undefined) { + if (typeof options[option] == 'boolean') { + mergeTarget[option].enabled = options[option]; + } + else { + mergeTarget[option].enabled = true; + for (prop in options[option]) { + if (options[option].hasOwnProperty(prop)) { + mergeTarget[option][prop] = options[option][prop]; + } + } + } + } + } + + + + + /** + * This function does a binary search for a visible item. The user can select either the this.orderedItems.byStart or .byEnd + * arrays. This is done by giving a boolean value true if you want to use the byEnd. + * This is done to be able to select the correct if statement (we do not want to check if an item is visible, we want to check + * if the time we selected (start or end) is within the current range). + * + * The trick is that every interval has to either enter the screen at the initial load or by dragging. The case of the ItemRange that is + * before and after the current range is handled by simply checking if it was in view before and if it is again. For all the rest, + * either the start OR end time has to be in the range. + * + * @param {Item[]} orderedItems Items ordered by start + * @param {{start: number, end: number}} range + * @param {String} field + * @param {String} field2 + * @returns {number} + * @private + */ + exports.binarySearch = function(orderedItems, range, field, field2) { + var array = orderedItems; + + var maxIterations = 10000; + var iteration = 0; + var found = false; + var low = 0; + var high = array.length; + var newLow = low; + var newHigh = high; + var guess = Math.floor(0.5*(high+low)); + var value; + + if (high == 0) { + guess = -1; + } + else if (high == 1) { + if (array[guess].isVisible(range)) { + guess = 0; + } + else { + guess = -1; + } + } + else { + high -= 1; + + while (found == false && iteration < maxIterations) { + value = field2 === undefined ? array[guess][field] : array[guess][field][field2]; + + if (array[guess].isVisible(range)) { + found = true; + } + else { + if (value < range.start) { // it is too small --> increase low + newLow = Math.floor(0.5*(high+low)); + } + else { // it is too big --> decrease high + newHigh = Math.floor(0.5*(high+low)); + } + // not in list; + if (low == newLow && high == newHigh) { + guess = -1; + found = true; + } + else { + high = newHigh; low = newLow; + guess = Math.floor(0.5*(high+low)); + } + } + iteration++; + } + if (iteration >= maxIterations) { + console.log("BinarySearch too many iterations. Aborting."); + } + } + return guess; + }; + + /** + * This function does a binary search for a visible item. The user can select either the this.orderedItems.byStart or .byEnd + * arrays. This is done by giving a boolean value true if you want to use the byEnd. + * This is done to be able to select the correct if statement (we do not want to check if an item is visible, we want to check + * if the time we selected (start or end) is within the current range). + * + * The trick is that every interval has to either enter the screen at the initial load or by dragging. The case of the ItemRange that is + * before and after the current range is handled by simply checking if it was in view before and if it is again. For all the rest, + * either the start OR end time has to be in the range. + * + * @param {Array} orderedItems + * @param {{start: number, end: number}} target + * @param {String} field + * @param {String} sidePreference 'before' or 'after' + * @returns {number} + * @private + */ + exports.binarySearchGeneric = function(orderedItems, target, field, sidePreference) { + var maxIterations = 10000; + var iteration = 0; + var array = orderedItems; + var found = false; + var low = 0; + var high = array.length; + var newLow = low; + var newHigh = high; + var guess = Math.floor(0.5*(high+low)); + var newGuess; + var prevValue, value, nextValue; + + if (high == 0) {guess = -1;} + else if (high == 1) { + value = array[guess][field]; + if (value == target) { + guess = 0; + } + else { + guess = -1; + } + } + else { + high -= 1; + while (found == false && iteration < maxIterations) { + prevValue = array[Math.max(0,guess - 1)][field]; + value = array[guess][field]; + nextValue = array[Math.min(array.length-1,guess + 1)][field]; + + if (value == target || prevValue < target && value > target || value < target && nextValue > target) { + found = true; + if (value != target) { + if (sidePreference == 'before') { + if (prevValue < target && value > target) { + guess = Math.max(0,guess - 1); + } + } + else { + if (value < target && nextValue > target) { + guess = Math.min(array.length-1,guess + 1); + } + } + } + } + else { + if (value < target) { // it is too small --> increase low + newLow = Math.floor(0.5*(high+low)); + } + else { // it is too big --> decrease high + newHigh = Math.floor(0.5*(high+low)); + } + newGuess = Math.floor(0.5*(high+low)); + // not in list; + if (low == newLow && high == newHigh) { + guess = -1; + found = true; + } + else { + high = newHigh; low = newLow; + guess = Math.floor(0.5*(high+low)); + } + } + iteration++; + } + if (iteration >= maxIterations) { + console.log("BinarySearch too many iterations. Aborting."); + } + } + return guess; + }; + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + // first check if moment.js is already loaded in the browser window, if so, + // use this instance. Else, load via commonjs. + module.exports = (typeof window !== 'undefined') && window['moment'] || __webpack_require__(3); + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_3__; + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + // DOM utility methods + + /** + * this prepares the JSON container for allocating SVG elements + * @param JSONcontainer + * @private + */ + exports.prepareElements = function(JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + JSONcontainer[elementType].redundant = JSONcontainer[elementType].used; + JSONcontainer[elementType].used = []; + } + } + }; + + /** + * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from + * which to remove the redundant elements. + * + * @param JSONcontainer + * @private + */ + exports.cleanupElements = function(JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + if (JSONcontainer[elementType].redundant) { + for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) { + JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]); + } + JSONcontainer[elementType].redundant = []; + } + } + } + }; + + /** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param elementType + * @param JSONcontainer + * @param svgContainer + * @returns {*} + * @private + */ + exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) { + var element; + // allocate SVG element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } + else { + // create a new element and add it to the SVG + element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + svgContainer.appendChild(element); + } + } + else { + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. + element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + JSONcontainer[elementType] = {used: [], redundant: []}; + svgContainer.appendChild(element); + } + JSONcontainer[elementType].used.push(element); + return element; + }; + + + /** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param elementType + * @param JSONcontainer + * @param DOMContainer + * @returns {*} + * @private + */ + exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer) { + var element; + // allocate SVG element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } + else { + // create a new element and add it to the SVG + element = document.createElement(elementType); + DOMContainer.appendChild(element); + } + } + else { + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. + element = document.createElement(elementType); + JSONcontainer[elementType] = {used: [], redundant: []}; + DOMContainer.appendChild(element); + } + JSONcontainer[elementType].used.push(element); + return element; + }; + + + + + /** + * draw a point object. this is a seperate function because it can also be called by the legend. + * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions + * as well. + * + * @param x + * @param y + * @param group + * @param JSONcontainer + * @param svgContainer + * @returns {*} + */ + exports.drawPoint = function(x, y, group, JSONcontainer, svgContainer) { + var point; + if (group.options.drawPoints.style == 'circle') { + point = exports.getSVGElement('circle',JSONcontainer,svgContainer); + point.setAttributeNS(null, "cx", x); + point.setAttributeNS(null, "cy", y); + point.setAttributeNS(null, "r", 0.5 * group.options.drawPoints.size); + point.setAttributeNS(null, "class", group.className + " point"); + } + else { + point = exports.getSVGElement('rect',JSONcontainer,svgContainer); + point.setAttributeNS(null, "x", x - 0.5*group.options.drawPoints.size); + point.setAttributeNS(null, "y", y - 0.5*group.options.drawPoints.size); + point.setAttributeNS(null, "width", group.options.drawPoints.size); + point.setAttributeNS(null, "height", group.options.drawPoints.size); + point.setAttributeNS(null, "class", group.className + " point"); + } + return point; + }; + + /** + * draw a bar SVG element centered on the X coordinate + * + * @param x + * @param y + * @param className + */ + exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer) { + var rect = exports.getSVGElement('rect',JSONcontainer, svgContainer); + rect.setAttributeNS(null, "x", x - 0.5 * width); + rect.setAttributeNS(null, "y", y); + rect.setAttributeNS(null, "width", width); + rect.setAttributeNS(null, "height", height); + rect.setAttributeNS(null, "class", className); + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + + /** + * DataSet + * + * Usage: + * var dataSet = new DataSet({ + * fieldId: '_id', + * type: { + * // ... + * } + * }); + * + * dataSet.add(item); + * dataSet.add(data); + * dataSet.update(item); + * dataSet.update(data); + * dataSet.remove(id); + * dataSet.remove(ids); + * var data = dataSet.get(); + * var data = dataSet.get(id); + * var data = dataSet.get(ids); + * var data = dataSet.get(ids, options, data); + * dataSet.clear(); + * + * A data set can: + * - add/remove/update data + * - gives triggers upon changes in the data + * - can import/export data in various data formats + * + * @param {Array | DataTable} [data] Optional array with initial data + * @param {Object} [options] Available options: + * {String} fieldId Field name of the id in the + * items, 'id' by default. + * {Object.} [type] + * {String[]} [fields] field names to be returned + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * {Array | DataTable} [data] If provided, items will be appended to this + * array or table. Required in case of Google + * DataTable. + * + * @throws Error + */ + DataSet.prototype.get = function (args) { + var me = this; + + // parse the arguments + var id, ids, options, data; + var firstType = util.getType(arguments[0]); + if (firstType == 'String' || firstType == 'Number') { + // get(id [, options] [, data]) + id = arguments[0]; + options = arguments[1]; + data = arguments[2]; + } + else if (firstType == 'Array') { + // get(ids [, options] [, data]) + ids = arguments[0]; + options = arguments[1]; + data = arguments[2]; + } + else { + // get([, options] [, data]) + options = arguments[0]; + data = arguments[1]; + } + + // determine the return type + var returnType; + if (options && options.returnType) { + var allowedValues = ["DataTable", "Array", "Object"]; + returnType = allowedValues.indexOf(options.returnType) == -1 ? "Array" : options.returnType; + + if (data && (returnType != util.getType(data))) { + throw new Error('Type of parameter "data" (' + util.getType(data) + ') ' + + 'does not correspond with specified options.type (' + options.type + ')'); + } + if (returnType == 'DataTable' && !util.isDataTable(data)) { + throw new Error('Parameter "data" must be a DataTable ' + + 'when options.type is "DataTable"'); + } + } + else if (data) { + returnType = (util.getType(data) == 'DataTable') ? 'DataTable' : 'Array'; + } + else { + returnType = 'Array'; + } + + // build options + var type = options && options.type || this._options.type; + var filter = options && options.filter; + var items = [], item, itemId, i, len; + + // convert items + if (id != undefined) { + // return a single item + item = me._getItem(id, type); + if (filter && !filter(item)) { + item = null; + } + } + else if (ids != undefined) { + // return a subset of items + for (i = 0, len = ids.length; i < len; i++) { + item = me._getItem(ids[i], type); + if (!filter || filter(item)) { + items.push(item); + } + } + } + else { + // return all items + for (itemId in this._data) { + if (this._data.hasOwnProperty(itemId)) { + item = me._getItem(itemId, type); + if (!filter || filter(item)) { + items.push(item); + } + } + } + } + + // order the results + if (options && options.order && id == undefined) { + this._sort(items, options.order); + } + + // filter fields of the items + if (options && options.fields) { + var fields = options.fields; + if (id != undefined) { + item = this._filterFields(item, fields); + } + else { + for (i = 0, len = items.length; i < len; i++) { + items[i] = this._filterFields(items[i], fields); + } + } + } + + // return the results + if (returnType == 'DataTable') { + var columns = this._getColumnNames(data); + if (id != undefined) { + // append a single item to the data table + me._appendRow(data, columns, item); + } + else { + // copy the items to the provided data table + for (i = 0; i < items.length; i++) { + me._appendRow(data, columns, items[i]); + } + } + return data; + } + else if (returnType == "Object") { + var result = {}; + for (i = 0; i < items.length; i++) { + result[items[i].id] = items[i]; + } + return result; + } + else { + // return an array + if (id != undefined) { + // a single item + return item; + } + else { + // multiple items + if (data) { + // copy the items to the provided array + for (i = 0, len = items.length; i < len; i++) { + data.push(items[i]); + } + return data; + } + else { + // just return our array + return items; + } + } + } + }; + + /** + * Get ids of all items or from a filtered set of items. + * @param {Object} [options] An Object with options. Available options: + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * @return {Array} ids + */ + DataSet.prototype.getIds = function (options) { + var data = this._data, + filter = options && options.filter, + order = options && options.order, + type = options && options.type || this._options.type, + i, + len, + id, + item, + items, + ids = []; + + if (filter) { + // get filtered items + if (order) { + // create ordered list + items = []; + for (id in data) { + if (data.hasOwnProperty(id)) { + item = this._getItem(id, type); + if (filter(item)) { + items.push(item); + } + } + } + + this._sort(items, order); + + for (i = 0, len = items.length; i < len; i++) { + ids[i] = items[i][this._fieldId]; + } + } + else { + // create unordered list + for (id in data) { + if (data.hasOwnProperty(id)) { + item = this._getItem(id, type); + if (filter(item)) { + ids.push(item[this._fieldId]); + } + } + } + } + } + else { + // get all items + if (order) { + // create an ordered list + items = []; + for (id in data) { + if (data.hasOwnProperty(id)) { + items.push(data[id]); + } + } + + this._sort(items, order); + + for (i = 0, len = items.length; i < len; i++) { + ids[i] = items[i][this._fieldId]; + } + } + else { + // create unordered list + for (id in data) { + if (data.hasOwnProperty(id)) { + item = data[id]; + ids.push(item[this._fieldId]); + } + } + } + } + + return ids; + }; + + /** + * Returns the DataSet itself. Is overwritten for example by the DataView, + * which returns the DataSet it is connected to instead. + */ + DataSet.prototype.getDataSet = function () { + return this; + }; + + /** + * Execute a callback function for every item in the dataset. + * @param {function} callback + * @param {Object} [options] Available options: + * {Object.} [type] + * {String[]} [fields] filter fields + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + */ + DataSet.prototype.forEach = function (callback, options) { + var filter = options && options.filter, + type = options && options.type || this._options.type, + data = this._data, + item, + id; + + if (options && options.order) { + // execute forEach on ordered list + var items = this.get(options); + + for (var i = 0, len = items.length; i < len; i++) { + item = items[i]; + id = item[this._fieldId]; + callback(item, id); + } + } + else { + // unordered + for (id in data) { + if (data.hasOwnProperty(id)) { + item = this._getItem(id, type); + if (!filter || filter(item)) { + callback(item, id); + } + } + } + } + }; + + /** + * Map every item in the dataset. + * @param {function} callback + * @param {Object} [options] Available options: + * {Object.} [type] + * {String[]} [fields] filter fields + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * @return {Object[]} mappedItems + */ + DataSet.prototype.map = function (callback, options) { + var filter = options && options.filter, + type = options && options.type || this._options.type, + mappedItems = [], + data = this._data, + item; + + // convert and filter items + for (var id in data) { + if (data.hasOwnProperty(id)) { + item = this._getItem(id, type); + if (!filter || filter(item)) { + mappedItems.push(callback(item, id)); + } + } + } + + // order items + if (options && options.order) { + this._sort(mappedItems, options.order); + } + + return mappedItems; + }; + + /** + * Filter the fields of an item + * @param {Object} item + * @param {String[]} fields Field names + * @return {Object} filteredItem + * @private + */ + DataSet.prototype._filterFields = function (item, fields) { + var filteredItem = {}; + + for (var field in item) { + if (item.hasOwnProperty(field) && (fields.indexOf(field) != -1)) { + filteredItem[field] = item[field]; + } + } + + return filteredItem; + }; + + /** + * Sort the provided array with items + * @param {Object[]} items + * @param {String | function} order A field name or custom sort function. + * @private + */ + DataSet.prototype._sort = function (items, order) { + if (util.isString(order)) { + // order by provided field name + var name = order; // field name + items.sort(function (a, b) { + var av = a[name]; + var bv = b[name]; + return (av > bv) ? 1 : ((av < bv) ? -1 : 0); + }); + } + else if (typeof order === 'function') { + // order by sort function + items.sort(order); + } + // TODO: extend order by an Object {field:String, direction:String} + // where direction can be 'asc' or 'desc' + else { + throw new TypeError('Order must be a function or a string'); + } + }; + + /** + * Remove an object by pointer or by id + * @param {String | Number | Object | Array} id Object or id, or an array with + * objects or ids to be removed + * @param {String} [senderId] Optional sender id + * @return {Array} removedIds + */ + DataSet.prototype.remove = function (id, senderId) { + var removedIds = [], + i, len, removedId; + + if (Array.isArray(id)) { + for (i = 0, len = id.length; i < len; i++) { + removedId = this._remove(id[i]); + if (removedId != null) { + removedIds.push(removedId); + } + } + } + else { + removedId = this._remove(id); + if (removedId != null) { + removedIds.push(removedId); + } + } + + if (removedIds.length) { + this._trigger('remove', {items: removedIds}, senderId); + } + + return removedIds; + }; + + /** + * Remove an item by its id + * @param {Number | String | Object} id id or item + * @returns {Number | String | null} id + * @private + */ + DataSet.prototype._remove = function (id) { + if (util.isNumber(id) || util.isString(id)) { + if (this._data[id]) { + delete this._data[id]; + return id; + } + } + else if (id instanceof Object) { + var itemId = id[this._fieldId]; + if (itemId && this._data[itemId]) { + delete this._data[itemId]; + return itemId; + } + } + return null; + }; + + /** + * Clear the data + * @param {String} [senderId] Optional sender id + * @return {Array} removedIds The ids of all removed items + */ + DataSet.prototype.clear = function (senderId) { + var ids = Object.keys(this._data); + + this._data = {}; + + this._trigger('remove', {items: ids}, senderId); + + return ids; + }; + + /** + * Find the item with maximum value of a specified field + * @param {String} field + * @return {Object | null} item Item containing max value, or null if no items + */ + DataSet.prototype.max = function (field) { + var data = this._data, + max = null, + maxField = null; + + for (var id in data) { + if (data.hasOwnProperty(id)) { + var item = data[id]; + var itemField = item[field]; + if (itemField != null && (!max || itemField > maxField)) { + max = item; + maxField = itemField; + } + } + } + + return max; + }; + + /** + * Find the item with minimum value of a specified field + * @param {String} field + * @return {Object | null} item Item containing max value, or null if no items + */ + DataSet.prototype.min = function (field) { + var data = this._data, + min = null, + minField = null; + + for (var id in data) { + if (data.hasOwnProperty(id)) { + var item = data[id]; + var itemField = item[field]; + if (itemField != null && (!min || itemField < minField)) { + min = item; + minField = itemField; + } + } + } + + return min; + }; + + /** + * Find all distinct values of a specified field + * @param {String} field + * @return {Array} values Array containing all distinct values. If data items + * do not contain the specified field are ignored. + * The returned array is unordered. + */ + DataSet.prototype.distinct = function (field) { + var data = this._data; + var values = []; + var fieldType = this._options.type && this._options.type[field] || null; + var count = 0; + var i; + + for (var prop in data) { + if (data.hasOwnProperty(prop)) { + var item = data[prop]; + var value = item[field]; + var exists = false; + for (i = 0; i < count; i++) { + if (values[i] == value) { + exists = true; + break; + } + } + if (!exists && (value !== undefined)) { + values[count] = value; + count++; + } + } + } + + if (fieldType) { + for (i = 0; i < values.length; i++) { + values[i] = util.convert(values[i], fieldType); + } + } + + return values; + }; + + /** + * Add a single item. Will fail when an item with the same id already exists. + * @param {Object} item + * @return {String} id + * @private + */ + DataSet.prototype._addItem = function (item) { + var id = item[this._fieldId]; + + if (id != undefined) { + // check whether this id is already taken + if (this._data[id]) { + // item already exists + throw new Error('Cannot add item: item with id ' + id + ' already exists'); + } + } + else { + // generate an id + id = util.randomUUID(); + item[this._fieldId] = id; + } + + var d = {}; + for (var field in item) { + if (item.hasOwnProperty(field)) { + var fieldType = this._type[field]; // type may be undefined + d[field] = util.convert(item[field], fieldType); + } + } + this._data[id] = d; + + return id; + }; + + /** + * Get an item. Fields can be converted to a specific type + * @param {String} id + * @param {Object.} [types] field types to convert + * @return {Object | null} item + * @private + */ + DataSet.prototype._getItem = function (id, types) { + var field, value; + + // get the item from the dataset + var raw = this._data[id]; + if (!raw) { + return null; + } + + // convert the items field types + var converted = {}; + if (types) { + for (field in raw) { + if (raw.hasOwnProperty(field)) { + value = raw[field]; + converted[field] = util.convert(value, types[field]); + } + } + } + else { + // no field types specified, no converting needed + for (field in raw) { + if (raw.hasOwnProperty(field)) { + value = raw[field]; + converted[field] = value; + } + } + } + return converted; + }; + + /** + * Update a single item: merge with existing item. + * Will fail when the item has no id, or when there does not exist an item + * with the same id. + * @param {Object} item + * @return {String} id + * @private + */ + DataSet.prototype._updateItem = function (item) { + var id = item[this._fieldId]; + if (id == undefined) { + throw new Error('Cannot update item: item has no id (item: ' + JSON.stringify(item) + ')'); + } + var d = this._data[id]; + if (!d) { + // item doesn't exist + throw new Error('Cannot update item: no item with id ' + id + ' found'); + } + + // merge with current item + for (var field in item) { + if (item.hasOwnProperty(field)) { + var fieldType = this._type[field]; // type may be undefined + d[field] = util.convert(item[field], fieldType); + } + } + + return id; + }; + + /** + * Get an array with the column names of a Google DataTable + * @param {DataTable} dataTable + * @return {String[]} columnNames + * @private + */ + DataSet.prototype._getColumnNames = function (dataTable) { + var columns = []; + for (var col = 0, cols = dataTable.getNumberOfColumns(); col < cols; col++) { + columns[col] = dataTable.getColumnId(col) || dataTable.getColumnLabel(col); + } + return columns; + }; + + /** + * Append an item as a row to the dataTable + * @param dataTable + * @param columns + * @param item + * @private + */ + DataSet.prototype._appendRow = function (dataTable, columns, item) { + var row = dataTable.addRow(); + + for (var col = 0, cols = columns.length; col < cols; col++) { + var field = columns[col]; + dataTable.setValue(row, col, item[field]); + } + }; + + module.exports = DataSet; + + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var DataSet = __webpack_require__(5); + + /** + * DataView + * + * a dataview offers a filtered view on a dataset or an other dataview. + * + * @param {DataSet | DataView} data + * @param {Object} [options] Available options: see method get + * + * @constructor DataView + */ + function DataView (data, options) { + this._data = null; + this._ids = {}; // ids of the items currently in memory (just contains a boolean true) + this._options = options || {}; + this._fieldId = 'id'; // name of the field containing id + this._subscribers = {}; // event subscribers + + var me = this; + this.listener = function () { + me._onEvent.apply(me, arguments); + }; + + this.setData(data); + } + + // TODO: implement a function .config() to dynamically update things like configured filter + // and trigger changes accordingly + + /** + * Set a data source for the view + * @param {DataSet | DataView} data + */ + DataView.prototype.setData = function (data) { + var ids, i, len; + + if (this._data) { + // unsubscribe from current dataset + if (this._data.unsubscribe) { + this._data.unsubscribe('*', this.listener); + } + + // trigger a remove of all items in memory + ids = []; + for (var id in this._ids) { + if (this._ids.hasOwnProperty(id)) { + ids.push(id); + } + } + this._ids = {}; + this._trigger('remove', {items: ids}); + } + + this._data = data; + + if (this._data) { + // update fieldId + this._fieldId = this._options.fieldId || + (this._data && this._data.options && this._data.options.fieldId) || + 'id'; + + // trigger an add of all added items + ids = this._data.getIds({filter: this._options && this._options.filter}); + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + this._ids[id] = true; + } + this._trigger('add', {items: ids}); + + // subscribe to new dataset + if (this._data.on) { + this._data.on('*', this.listener); + } + } + }; + + /** + * Get data from the data view + * + * Usage: + * + * get() + * get(options: Object) + * get(options: Object, data: Array | DataTable) + * + * get(id: Number) + * get(id: Number, options: Object) + * get(id: Number, options: Object, data: Array | DataTable) + * + * get(ids: Number[]) + * get(ids: Number[], options: Object) + * get(ids: Number[], options: Object, data: Array | DataTable) + * + * Where: + * + * {Number | String} id The id of an item + * {Number[] | String{}} ids An array with ids of items + * {Object} options An Object with options. Available options: + * {String} [type] Type of data to be returned. Can + * be 'DataTable' or 'Array' (default) + * {Object.} [convert] + * {String[]} [fields] field names to be returned + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * {Array | DataTable} [data] If provided, items will be appended to this + * array or table. Required in case of Google + * DataTable. + * @param args + */ + DataView.prototype.get = function (args) { + var me = this; + + // parse the arguments + var ids, options, data; + var firstType = util.getType(arguments[0]); + if (firstType == 'String' || firstType == 'Number' || firstType == 'Array') { + // get(id(s) [, options] [, data]) + ids = arguments[0]; // can be a single id or an array with ids + options = arguments[1]; + data = arguments[2]; + } + else { + // get([, options] [, data]) + options = arguments[0]; + data = arguments[1]; + } + + // extend the options with the default options and provided options + var viewOptions = util.extend({}, this._options, options); + + // create a combined filter method when needed + if (this._options.filter && options && options.filter) { + viewOptions.filter = function (item) { + return me._options.filter(item) && options.filter(item); + } + } + + // build up the call to the linked data set + var getArguments = []; + if (ids != undefined) { + getArguments.push(ids); + } + getArguments.push(viewOptions); + getArguments.push(data); + + return this._data && this._data.get.apply(this._data, getArguments); + }; + + /** + * Get ids of all items or from a filtered set of items. + * @param {Object} [options] An Object with options. Available options: + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * @return {Array} ids + */ + DataView.prototype.getIds = function (options) { + var ids; + + if (this._data) { + var defaultFilter = this._options.filter; + var filter; + + if (options && options.filter) { + if (defaultFilter) { + filter = function (item) { + return defaultFilter(item) && options.filter(item); + } + } + else { + filter = options.filter; + } + } + else { + filter = defaultFilter; + } + + ids = this._data.getIds({ + filter: filter, + order: options && options.order + }); + } + else { + ids = []; + } + + return ids; + }; + + /** + * Get the DataSet to which this DataView is connected. In case there is a chain + * of multiple DataViews, the root DataSet of this chain is returned. + * @return {DataSet} dataSet + */ + DataView.prototype.getDataSet = function () { + var dataSet = this; + while (dataSet instanceof DataView) { + dataSet = dataSet._data; + } + return dataSet || null; + }; + + /** + * Event listener. Will propagate all events from the connected data set to + * the subscribers of the DataView, but will filter the items and only trigger + * when there are changes in the filtered data set. + * @param {String} event + * @param {Object | null} params + * @param {String} senderId + * @private + */ + DataView.prototype._onEvent = function (event, params, senderId) { + var i, len, id, item, + ids = params && params.items, + data = this._data, + added = [], + updated = [], + removed = []; + + if (ids && data) { + switch (event) { + case 'add': + // filter the ids of the added items + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + item = this.get(id); + if (item) { + this._ids[id] = true; + added.push(id); + } + } + + break; + + case 'update': + // determine the event from the views viewpoint: an updated + // item can be added, updated, or removed from this view. + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + item = this.get(id); + + if (item) { + if (this._ids[id]) { + updated.push(id); + } + else { + this._ids[id] = true; + added.push(id); + } + } + else { + if (this._ids[id]) { + delete this._ids[id]; + removed.push(id); + } + else { + // nothing interesting for me :-( + } + } + } + + break; + + case 'remove': + // filter the ids of the removed items + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + if (this._ids[id]) { + delete this._ids[id]; + removed.push(id); + } + } + + break; + } + + if (added.length) { + this._trigger('add', {items: added}, senderId); + } + if (updated.length) { + this._trigger('update', {items: updated}, senderId); + } + if (removed.length) { + this._trigger('remove', {items: removed}, senderId); + } + } + }; + + // copy subscription functionality from DataSet + DataView.prototype.on = DataSet.prototype.on; + DataView.prototype.off = DataSet.prototype.off; + DataView.prototype._trigger = DataSet.prototype._trigger; + + // TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5) + DataView.prototype.subscribe = DataView.prototype.on; + DataView.prototype.unsubscribe = DataView.prototype.off; + + module.exports = DataView; + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + var Emitter = __webpack_require__(8); + var DataSet = __webpack_require__(5); + var DataView = __webpack_require__(6); + var util = __webpack_require__(1); + var Point3d = __webpack_require__(9); + var Point2d = __webpack_require__(10); + var Camera = __webpack_require__(11); + var Filter = __webpack_require__(12); + var Slider = __webpack_require__(13); + var StepNumber = __webpack_require__(14); + + /** + * @constructor Graph3d + * Graph3d displays data in 3d. + * + * Graph3d is developed in javascript as a Google Visualization Chart. + * + * @param {Element} container The DOM element in which the Graph3d will + * be created. Normally a div element. + * @param {DataSet | DataView | Array} [data] + * @param {Object} [options] + */ + function Graph3d(container, data, options) { + if (!(this instanceof Graph3d)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + + // create variables and set default values + this.containerElement = container; + this.width = '400px'; + this.height = '400px'; + this.margin = 10; // px + this.defaultXCenter = '55%'; + this.defaultYCenter = '50%'; + + this.xLabel = 'x'; + this.yLabel = 'y'; + this.zLabel = 'z'; + this.filterLabel = 'time'; + this.legendLabel = 'value'; + + this.style = Graph3d.STYLE.DOT; + this.showPerspective = true; + this.showGrid = true; + this.keepAspectRatio = true; + this.showShadow = false; + this.showGrayBottom = false; // TODO: this does not work correctly + this.showTooltip = false; + this.verticalRatio = 0.5; // 0.1 to 1.0, where 1.0 results in a 'cube' + + this.animationInterval = 1000; // milliseconds + this.animationPreload = false; + + this.camera = new Camera(); + this.eye = new Point3d(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window? + + this.dataTable = null; // The original data table + this.dataPoints = null; // The table with point objects + + // the column indexes + this.colX = undefined; + this.colY = undefined; + this.colZ = undefined; + this.colValue = undefined; + this.colFilter = undefined; + + this.xMin = 0; + this.xStep = undefined; // auto by default + this.xMax = 1; + this.yMin = 0; + this.yStep = undefined; // auto by default + this.yMax = 1; + this.zMin = 0; + this.zStep = undefined; // auto by default + this.zMax = 1; + this.valueMin = 0; + this.valueMax = 1; + this.xBarWidth = 1; + this.yBarWidth = 1; + // TODO: customize axis range + + // constants + this.colorAxis = '#4D4D4D'; + this.colorGrid = '#D3D3D3'; + this.colorDot = '#7DC1FF'; + this.colorDotBorder = '#3267D2'; + + // create a frame and canvas + this.create(); + + // apply options (also when undefined) + this.setOptions(options); + + // apply data + if (data) { + this.setData(data); + } + } + + // Extend Graph3d with an Emitter mixin + Emitter(Graph3d.prototype); + + /** + * Calculate the scaling values, dependent on the range in x, y, and z direction + */ + Graph3d.prototype._setScale = function() { + this.scale = new Point3d(1 / (this.xMax - this.xMin), + 1 / (this.yMax - this.yMin), + 1 / (this.zMax - this.zMin)); + + // keep aspect ration between x and y scale if desired + if (this.keepAspectRatio) { + if (this.scale.x < this.scale.y) { + //noinspection JSSuspiciousNameCombination + this.scale.y = this.scale.x; + } + else { + //noinspection JSSuspiciousNameCombination + this.scale.x = this.scale.y; + } + } + + // scale the vertical axis + this.scale.z *= this.verticalRatio; + // TODO: can this be automated? verticalRatio? + + // determine scale for (optional) value + this.scale.value = 1 / (this.valueMax - this.valueMin); + + // position the camera arm + var xCenter = (this.xMax + this.xMin) / 2 * this.scale.x; + var yCenter = (this.yMax + this.yMin) / 2 * this.scale.y; + var zCenter = (this.zMax + this.zMin) / 2 * this.scale.z; + this.camera.setArmLocation(xCenter, yCenter, zCenter); + }; + + + /** + * Convert a 3D location to a 2D location on screen + * http://en.wikipedia.org/wiki/3D_projection + * @param {Point3d} point3d A 3D point with parameters x, y, z + * @return {Point2d} point2d A 2D point with parameters x, y + */ + Graph3d.prototype._convert3Dto2D = function(point3d) { + var translation = this._convertPointToTranslation(point3d); + return this._convertTranslationToScreen(translation); + }; + + /** + * Convert a 3D location its translation seen from the camera + * http://en.wikipedia.org/wiki/3D_projection + * @param {Point3d} point3d A 3D point with parameters x, y, z + * @return {Point3d} translation A 3D point with parameters x, y, z This is + * the translation of the point, seen from the + * camera + */ + Graph3d.prototype._convertPointToTranslation = function(point3d) { + var ax = point3d.x * this.scale.x, + ay = point3d.y * this.scale.y, + az = point3d.z * this.scale.z, + + cx = this.camera.getCameraLocation().x, + cy = this.camera.getCameraLocation().y, + cz = this.camera.getCameraLocation().z, + + // calculate angles + sinTx = Math.sin(this.camera.getCameraRotation().x), + cosTx = Math.cos(this.camera.getCameraRotation().x), + sinTy = Math.sin(this.camera.getCameraRotation().y), + cosTy = Math.cos(this.camera.getCameraRotation().y), + sinTz = Math.sin(this.camera.getCameraRotation().z), + cosTz = Math.cos(this.camera.getCameraRotation().z), + + // calculate translation + dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz), + dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax-cx)), + dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax-cx)); + + return new Point3d(dx, dy, dz); + }; + + /** + * Convert a translation point to a point on the screen + * @param {Point3d} translation A 3D point with parameters x, y, z This is + * the translation of the point, seen from the + * camera + * @return {Point2d} point2d A 2D point with parameters x, y + */ + Graph3d.prototype._convertTranslationToScreen = function(translation) { + var ex = this.eye.x, + ey = this.eye.y, + ez = this.eye.z, + dx = translation.x, + dy = translation.y, + dz = translation.z; + + // calculate position on screen from translation + var bx; + var by; + if (this.showPerspective) { + bx = (dx - ex) * (ez / dz); + by = (dy - ey) * (ez / dz); + } + else { + bx = dx * -(ez / this.camera.getArmLength()); + by = dy * -(ez / this.camera.getArmLength()); + } + + // shift and scale the point to the center of the screen + // use the width of the graph to scale both horizontally and vertically. + return new Point2d( + this.xcenter + bx * this.frame.canvas.clientWidth, + this.ycenter - by * this.frame.canvas.clientWidth); + }; + + /** + * Set the background styling for the graph + * @param {string | {fill: string, stroke: string, strokeWidth: string}} backgroundColor + */ + Graph3d.prototype._setBackgroundColor = function(backgroundColor) { + var fill = 'white'; + var stroke = 'gray'; + var strokeWidth = 1; + + if (typeof(backgroundColor) === 'string') { + fill = backgroundColor; + stroke = 'none'; + strokeWidth = 0; + } + else if (typeof(backgroundColor) === 'object') { + if (backgroundColor.fill !== undefined) fill = backgroundColor.fill; + if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke; + if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth; + } + else if (backgroundColor === undefined) { + // use use defaults + } + else { + throw 'Unsupported type of backgroundColor'; + } + + this.frame.style.backgroundColor = fill; + this.frame.style.borderColor = stroke; + this.frame.style.borderWidth = strokeWidth + 'px'; + this.frame.style.borderStyle = 'solid'; + }; + + + /// enumerate the available styles + Graph3d.STYLE = { + BAR: 0, + BARCOLOR: 1, + BARSIZE: 2, + DOT : 3, + DOTLINE : 4, + DOTCOLOR: 5, + DOTSIZE: 6, + GRID : 7, + LINE: 8, + SURFACE : 9 + }; + + /** + * Retrieve the style index from given styleName + * @param {string} styleName Style name such as 'dot', 'grid', 'dot-line' + * @return {Number} styleNumber Enumeration value representing the style, or -1 + * when not found + */ + Graph3d.prototype._getStyleNumber = function(styleName) { + switch (styleName) { + case 'dot': return Graph3d.STYLE.DOT; + case 'dot-line': return Graph3d.STYLE.DOTLINE; + case 'dot-color': return Graph3d.STYLE.DOTCOLOR; + case 'dot-size': return Graph3d.STYLE.DOTSIZE; + case 'line': return Graph3d.STYLE.LINE; + case 'grid': return Graph3d.STYLE.GRID; + case 'surface': return Graph3d.STYLE.SURFACE; + case 'bar': return Graph3d.STYLE.BAR; + case 'bar-color': return Graph3d.STYLE.BARCOLOR; + case 'bar-size': return Graph3d.STYLE.BARSIZE; + } + + return -1; + }; + + /** + * Determine the indexes of the data columns, based on the given style and data + * @param {DataSet} data + * @param {Number} style + */ + Graph3d.prototype._determineColumnIndexes = function(data, style) { + if (this.style === Graph3d.STYLE.DOT || + this.style === Graph3d.STYLE.DOTLINE || + this.style === Graph3d.STYLE.LINE || + this.style === Graph3d.STYLE.GRID || + this.style === Graph3d.STYLE.SURFACE || + this.style === Graph3d.STYLE.BAR) { + // 3 columns expected, and optionally a 4th with filter values + this.colX = 0; + this.colY = 1; + this.colZ = 2; + this.colValue = undefined; + + if (data.getNumberOfColumns() > 3) { + this.colFilter = 3; + } + } + else if (this.style === Graph3d.STYLE.DOTCOLOR || + this.style === Graph3d.STYLE.DOTSIZE || + this.style === Graph3d.STYLE.BARCOLOR || + this.style === Graph3d.STYLE.BARSIZE) { + // 4 columns expected, and optionally a 5th with filter values + this.colX = 0; + this.colY = 1; + this.colZ = 2; + this.colValue = 3; + + if (data.getNumberOfColumns() > 4) { + this.colFilter = 4; + } + } + else { + throw 'Unknown style "' + this.style + '"'; + } + }; + + Graph3d.prototype.getNumberOfRows = function(data) { + return data.length; + } + + + Graph3d.prototype.getNumberOfColumns = function(data) { + var counter = 0; + for (var column in data[0]) { + if (data[0].hasOwnProperty(column)) { + counter++; + } + } + return counter; + } + + + Graph3d.prototype.getDistinctValues = function(data, column) { + var distinctValues = []; + for (var i = 0; i < data.length; i++) { + if (distinctValues.indexOf(data[i][column]) == -1) { + distinctValues.push(data[i][column]); + } + } + return distinctValues; + } + + + Graph3d.prototype.getColumnRange = function(data,column) { + var minMax = {min:data[0][column],max:data[0][column]}; + for (var i = 0; i < data.length; i++) { + if (minMax.min > data[i][column]) { minMax.min = data[i][column]; } + if (minMax.max < data[i][column]) { minMax.max = data[i][column]; } + } + return minMax; + }; + + /** + * Initialize the data from the data table. Calculate minimum and maximum values + * and column index values + * @param {Array | DataSet | DataView} rawData The data containing the items for the Graph. + * @param {Number} style Style Number + */ + Graph3d.prototype._dataInitialize = function (rawData, style) { + var me = this; + + // unsubscribe from the dataTable + if (this.dataSet) { + this.dataSet.off('*', this._onChange); + } + + if (rawData === undefined) + return; + + if (Array.isArray(rawData)) { + rawData = new DataSet(rawData); + } + + var data; + if (rawData instanceof DataSet || rawData instanceof DataView) { + data = rawData.get(); + } + else { + throw new Error('Array, DataSet, or DataView expected'); + } + + if (data.length == 0) + return; + + this.dataSet = rawData; + this.dataTable = data; + + // subscribe to changes in the dataset + this._onChange = function () { + me.setData(me.dataSet); + }; + this.dataSet.on('*', this._onChange); + + // _determineColumnIndexes + // getNumberOfRows (points) + // getNumberOfColumns (x,y,z,v,t,t1,t2...) + // getDistinctValues (unique values?) + // getColumnRange + + // determine the location of x,y,z,value,filter columns + this.colX = 'x'; + this.colY = 'y'; + this.colZ = 'z'; + this.colValue = 'style'; + this.colFilter = 'filter'; + + + + // check if a filter column is provided + if (data[0].hasOwnProperty('filter')) { + if (this.dataFilter === undefined) { + this.dataFilter = new Filter(rawData, this.colFilter, this); + this.dataFilter.setOnLoadCallback(function() {me.redraw();}); + } + } + + + var withBars = this.style == Graph3d.STYLE.BAR || + this.style == Graph3d.STYLE.BARCOLOR || + this.style == Graph3d.STYLE.BARSIZE; + + // determine barWidth from data + if (withBars) { + if (this.defaultXBarWidth !== undefined) { + this.xBarWidth = this.defaultXBarWidth; + } + else { + var dataX = this.getDistinctValues(data,this.colX); + this.xBarWidth = (dataX[1] - dataX[0]) || 1; + } + + if (this.defaultYBarWidth !== undefined) { + this.yBarWidth = this.defaultYBarWidth; + } + else { + var dataY = this.getDistinctValues(data,this.colY); + this.yBarWidth = (dataY[1] - dataY[0]) || 1; + } + } + + // calculate minimums and maximums + var xRange = this.getColumnRange(data,this.colX); + if (withBars) { + xRange.min -= this.xBarWidth / 2; + xRange.max += this.xBarWidth / 2; + } + this.xMin = (this.defaultXMin !== undefined) ? this.defaultXMin : xRange.min; + this.xMax = (this.defaultXMax !== undefined) ? this.defaultXMax : xRange.max; + if (this.xMax <= this.xMin) this.xMax = this.xMin + 1; + this.xStep = (this.defaultXStep !== undefined) ? this.defaultXStep : (this.xMax-this.xMin)/5; + + var yRange = this.getColumnRange(data,this.colY); + if (withBars) { + yRange.min -= this.yBarWidth / 2; + yRange.max += this.yBarWidth / 2; + } + this.yMin = (this.defaultYMin !== undefined) ? this.defaultYMin : yRange.min; + this.yMax = (this.defaultYMax !== undefined) ? this.defaultYMax : yRange.max; + if (this.yMax <= this.yMin) this.yMax = this.yMin + 1; + this.yStep = (this.defaultYStep !== undefined) ? this.defaultYStep : (this.yMax-this.yMin)/5; + + var zRange = this.getColumnRange(data,this.colZ); + this.zMin = (this.defaultZMin !== undefined) ? this.defaultZMin : zRange.min; + this.zMax = (this.defaultZMax !== undefined) ? this.defaultZMax : zRange.max; + if (this.zMax <= this.zMin) this.zMax = this.zMin + 1; + this.zStep = (this.defaultZStep !== undefined) ? this.defaultZStep : (this.zMax-this.zMin)/5; + + if (this.colValue !== undefined) { + var valueRange = this.getColumnRange(data,this.colValue); + this.valueMin = (this.defaultValueMin !== undefined) ? this.defaultValueMin : valueRange.min; + this.valueMax = (this.defaultValueMax !== undefined) ? this.defaultValueMax : valueRange.max; + if (this.valueMax <= this.valueMin) this.valueMax = this.valueMin + 1; + } + + // set the scale dependent on the ranges. + this._setScale(); + }; + + + + /** + * Filter the data based on the current filter + * @param {Array} data + * @return {Array} dataPoints Array with point objects which can be drawn on screen + */ + Graph3d.prototype._getDataPoints = function (data) { + // TODO: store the created matrix dataPoints in the filters instead of reloading each time + var x, y, i, z, obj, point; + + var dataPoints = []; + + if (this.style === Graph3d.STYLE.GRID || + this.style === Graph3d.STYLE.SURFACE) { + // copy all values from the google data table to a matrix + // the provided values are supposed to form a grid of (x,y) positions + + // create two lists with all present x and y values + var dataX = []; + var dataY = []; + for (i = 0; i < this.getNumberOfRows(data); i++) { + x = data[i][this.colX] || 0; + y = data[i][this.colY] || 0; + + if (dataX.indexOf(x) === -1) { + dataX.push(x); + } + if (dataY.indexOf(y) === -1) { + dataY.push(y); + } + } + + function sortNumber(a, b) { + return a - b; + } + dataX.sort(sortNumber); + dataY.sort(sortNumber); + + // create a grid, a 2d matrix, with all values. + var dataMatrix = []; // temporary data matrix + for (i = 0; i < data.length; i++) { + x = data[i][this.colX] || 0; + y = data[i][this.colY] || 0; + z = data[i][this.colZ] || 0; + + var xIndex = dataX.indexOf(x); // TODO: implement Array().indexOf() for Internet Explorer + var yIndex = dataY.indexOf(y); + + if (dataMatrix[xIndex] === undefined) { + dataMatrix[xIndex] = []; + } + + var point3d = new Point3d(); + point3d.x = x; + point3d.y = y; + point3d.z = z; + + obj = {}; + obj.point = point3d; + obj.trans = undefined; + obj.screen = undefined; + obj.bottom = new Point3d(x, y, this.zMin); + + dataMatrix[xIndex][yIndex] = obj; + + dataPoints.push(obj); + } + + // fill in the pointers to the neighbors. + for (x = 0; x < dataMatrix.length; x++) { + for (y = 0; y < dataMatrix[x].length; y++) { + if (dataMatrix[x][y]) { + dataMatrix[x][y].pointRight = (x < dataMatrix.length-1) ? dataMatrix[x+1][y] : undefined; + dataMatrix[x][y].pointTop = (y < dataMatrix[x].length-1) ? dataMatrix[x][y+1] : undefined; + dataMatrix[x][y].pointCross = + (x < dataMatrix.length-1 && y < dataMatrix[x].length-1) ? + dataMatrix[x+1][y+1] : + undefined; + } + } + } + } + else { // 'dot', 'dot-line', etc. + // copy all values from the google data table to a list with Point3d objects + for (i = 0; i < data.length; i++) { + point = new Point3d(); + point.x = data[i][this.colX] || 0; + point.y = data[i][this.colY] || 0; + point.z = data[i][this.colZ] || 0; + + if (this.colValue !== undefined) { + point.value = data[i][this.colValue] || 0; + } + + obj = {}; + obj.point = point; + obj.bottom = new Point3d(point.x, point.y, this.zMin); + obj.trans = undefined; + obj.screen = undefined; + + dataPoints.push(obj); + } + } + + return dataPoints; + }; + + /** + * Create the main frame for the Graph3d. + * This function is executed once when a Graph3d object is created. The frame + * contains a canvas, and this canvas contains all objects like the axis and + * nodes. + */ + Graph3d.prototype.create = function () { + // remove all elements from the container element. + while (this.containerElement.hasChildNodes()) { + this.containerElement.removeChild(this.containerElement.firstChild); + } + + this.frame = document.createElement('div'); + this.frame.style.position = 'relative'; + this.frame.style.overflow = 'hidden'; + + // create the graph canvas (HTML canvas element) + this.frame.canvas = document.createElement( 'canvas' ); + this.frame.canvas.style.position = 'relative'; + this.frame.appendChild(this.frame.canvas); + //if (!this.frame.canvas.getContext) { + { + var noCanvas = document.createElement( 'DIV' ); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold' ; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.frame.canvas.appendChild(noCanvas); + } + + this.frame.filter = document.createElement( 'div' ); + this.frame.filter.style.position = 'absolute'; + this.frame.filter.style.bottom = '0px'; + this.frame.filter.style.left = '0px'; + this.frame.filter.style.width = '100%'; + this.frame.appendChild(this.frame.filter); + + // add event listeners to handle moving and zooming the contents + var me = this; + var onmousedown = function (event) {me._onMouseDown(event);}; + var ontouchstart = function (event) {me._onTouchStart(event);}; + var onmousewheel = function (event) {me._onWheel(event);}; + var ontooltip = function (event) {me._onTooltip(event);}; + // TODO: these events are never cleaned up... can give a 'memory leakage' + + util.addEventListener(this.frame.canvas, 'keydown', onkeydown); + util.addEventListener(this.frame.canvas, 'mousedown', onmousedown); + util.addEventListener(this.frame.canvas, 'touchstart', ontouchstart); + util.addEventListener(this.frame.canvas, 'mousewheel', onmousewheel); + util.addEventListener(this.frame.canvas, 'mousemove', ontooltip); + + // add the new graph to the container element + this.containerElement.appendChild(this.frame); + }; + + + /** + * Set a new size for the graph + * @param {string} width Width in pixels or percentage (for example '800px' + * or '50%') + * @param {string} height Height in pixels or percentage (for example '400px' + * or '30%') + */ + Graph3d.prototype.setSize = function(width, height) { + this.frame.style.width = width; + this.frame.style.height = height; + + this._resizeCanvas(); + }; + + /** + * Resize the canvas to the current size of the frame + */ + Graph3d.prototype._resizeCanvas = function() { + this.frame.canvas.style.width = '100%'; + this.frame.canvas.style.height = '100%'; + + this.frame.canvas.width = this.frame.canvas.clientWidth; + this.frame.canvas.height = this.frame.canvas.clientHeight; + + // adjust with for margin + this.frame.filter.style.width = (this.frame.canvas.clientWidth - 2 * 10) + 'px'; + }; + + /** + * Start animation + */ + Graph3d.prototype.animationStart = function() { + if (!this.frame.filter || !this.frame.filter.slider) + throw 'No animation available'; + + this.frame.filter.slider.play(); + }; + + + /** + * Stop animation + */ + Graph3d.prototype.animationStop = function() { + if (!this.frame.filter || !this.frame.filter.slider) return; + + this.frame.filter.slider.stop(); + }; + + + /** + * Resize the center position based on the current values in this.defaultXCenter + * and this.defaultYCenter (which are strings with a percentage or a value + * in pixels). The center positions are the variables this.xCenter + * and this.yCenter + */ + Graph3d.prototype._resizeCenter = function() { + // calculate the horizontal center position + if (this.defaultXCenter.charAt(this.defaultXCenter.length-1) === '%') { + this.xcenter = + parseFloat(this.defaultXCenter) / 100 * + this.frame.canvas.clientWidth; + } + else { + this.xcenter = parseFloat(this.defaultXCenter); // supposed to be in px + } + + // calculate the vertical center position + if (this.defaultYCenter.charAt(this.defaultYCenter.length-1) === '%') { + this.ycenter = + parseFloat(this.defaultYCenter) / 100 * + (this.frame.canvas.clientHeight - this.frame.filter.clientHeight); + } + else { + this.ycenter = parseFloat(this.defaultYCenter); // supposed to be in px + } + }; + + /** + * Set the rotation and distance of the camera + * @param {Object} pos An object with the camera position. The object + * contains three parameters: + * - horizontal {Number} + * The horizontal rotation, between 0 and 2*PI. + * Optional, can be left undefined. + * - vertical {Number} + * The vertical rotation, between 0 and 0.5*PI + * if vertical=0.5*PI, the graph is shown from the + * top. Optional, can be left undefined. + * - distance {Number} + * The (normalized) distance of the camera to the + * center of the graph, a value between 0.71 and 5.0. + * Optional, can be left undefined. + */ + Graph3d.prototype.setCameraPosition = function(pos) { + if (pos === undefined) { + return; + } + + if (pos.horizontal !== undefined && pos.vertical !== undefined) { + this.camera.setArmRotation(pos.horizontal, pos.vertical); + } + + if (pos.distance !== undefined) { + this.camera.setArmLength(pos.distance); + } + + this.redraw(); + }; + + + /** + * Retrieve the current camera rotation + * @return {object} An object with parameters horizontal, vertical, and + * distance + */ + Graph3d.prototype.getCameraPosition = function() { + var pos = this.camera.getArmRotation(); + pos.distance = this.camera.getArmLength(); + return pos; + }; + + /** + * Load data into the 3D Graph + */ + Graph3d.prototype._readData = function(data) { + // read the data + this._dataInitialize(data, this.style); + + + if (this.dataFilter) { + // apply filtering + this.dataPoints = this.dataFilter._getDataPoints(); + } + else { + // no filtering. load all data + this.dataPoints = this._getDataPoints(this.dataTable); + } + + // draw the filter + this._redrawFilter(); + }; + + /** + * Replace the dataset of the Graph3d + * @param {Array | DataSet | DataView} data + */ + Graph3d.prototype.setData = function (data) { + this._readData(data); + this.redraw(); + + // start animation when option is true + if (this.animationAutoStart && this.dataFilter) { + this.animationStart(); + } + }; + + /** + * Update the options. Options will be merged with current options + * @param {Object} options + */ + Graph3d.prototype.setOptions = function (options) { + var cameraPosition = undefined; + + this.animationStop(); + + if (options !== undefined) { + // retrieve parameter values + if (options.width !== undefined) this.width = options.width; + if (options.height !== undefined) this.height = options.height; + + if (options.xCenter !== undefined) this.defaultXCenter = options.xCenter; + if (options.yCenter !== undefined) this.defaultYCenter = options.yCenter; + + if (options.filterLabel !== undefined) this.filterLabel = options.filterLabel; + if (options.legendLabel !== undefined) this.legendLabel = options.legendLabel; + if (options.xLabel !== undefined) this.xLabel = options.xLabel; + if (options.yLabel !== undefined) this.yLabel = options.yLabel; + if (options.zLabel !== undefined) this.zLabel = options.zLabel; + + if (options.style !== undefined) { + var styleNumber = this._getStyleNumber(options.style); + if (styleNumber !== -1) { + this.style = styleNumber; + } + } + if (options.showGrid !== undefined) this.showGrid = options.showGrid; + if (options.showPerspective !== undefined) this.showPerspective = options.showPerspective; + if (options.showShadow !== undefined) this.showShadow = options.showShadow; + if (options.tooltip !== undefined) this.showTooltip = options.tooltip; + if (options.showAnimationControls !== undefined) this.showAnimationControls = options.showAnimationControls; + if (options.keepAspectRatio !== undefined) this.keepAspectRatio = options.keepAspectRatio; + if (options.verticalRatio !== undefined) this.verticalRatio = options.verticalRatio; + + if (options.animationInterval !== undefined) this.animationInterval = options.animationInterval; + if (options.animationPreload !== undefined) this.animationPreload = options.animationPreload; + if (options.animationAutoStart !== undefined)this.animationAutoStart = options.animationAutoStart; + + if (options.xBarWidth !== undefined) this.defaultXBarWidth = options.xBarWidth; + if (options.yBarWidth !== undefined) this.defaultYBarWidth = options.yBarWidth; + + if (options.xMin !== undefined) this.defaultXMin = options.xMin; + if (options.xStep !== undefined) this.defaultXStep = options.xStep; + if (options.xMax !== undefined) this.defaultXMax = options.xMax; + if (options.yMin !== undefined) this.defaultYMin = options.yMin; + if (options.yStep !== undefined) this.defaultYStep = options.yStep; + if (options.yMax !== undefined) this.defaultYMax = options.yMax; + if (options.zMin !== undefined) this.defaultZMin = options.zMin; + if (options.zStep !== undefined) this.defaultZStep = options.zStep; + if (options.zMax !== undefined) this.defaultZMax = options.zMax; + if (options.valueMin !== undefined) this.defaultValueMin = options.valueMin; + if (options.valueMax !== undefined) this.defaultValueMax = options.valueMax; + + if (options.cameraPosition !== undefined) cameraPosition = options.cameraPosition; + + if (cameraPosition !== undefined) { + this.camera.setArmRotation(cameraPosition.horizontal, cameraPosition.vertical); + this.camera.setArmLength(cameraPosition.distance); + } + else { + this.camera.setArmRotation(1.0, 0.5); + this.camera.setArmLength(1.7); + } + } + + this._setBackgroundColor(options && options.backgroundColor); + + this.setSize(this.width, this.height); + + // re-load the data + if (this.dataTable) { + this.setData(this.dataTable); + } + + // start animation when option is true + if (this.animationAutoStart && this.dataFilter) { + this.animationStart(); + } + }; + + /** + * Redraw the Graph. + */ + Graph3d.prototype.redraw = function() { + if (this.dataPoints === undefined) { + throw 'Error: graph data not initialized'; + } + + this._resizeCanvas(); + this._resizeCenter(); + this._redrawSlider(); + this._redrawClear(); + this._redrawAxis(); + + if (this.style === Graph3d.STYLE.GRID || + this.style === Graph3d.STYLE.SURFACE) { + this._redrawDataGrid(); + } + else if (this.style === Graph3d.STYLE.LINE) { + this._redrawDataLine(); + } + else if (this.style === Graph3d.STYLE.BAR || + this.style === Graph3d.STYLE.BARCOLOR || + this.style === Graph3d.STYLE.BARSIZE) { + this._redrawDataBar(); + } + else { + // style is DOT, DOTLINE, DOTCOLOR, DOTSIZE + this._redrawDataDot(); + } + + this._redrawInfo(); + this._redrawLegend(); + }; + + /** + * Clear the canvas before redrawing + */ + Graph3d.prototype._redrawClear = function() { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + + ctx.clearRect(0, 0, canvas.width, canvas.height); + }; + + + /** + * Redraw the legend showing the colors + */ + Graph3d.prototype._redrawLegend = function() { + var y; + + if (this.style === Graph3d.STYLE.DOTCOLOR || + this.style === Graph3d.STYLE.DOTSIZE) { + + var dotSize = this.frame.clientWidth * 0.02; + + var widthMin, widthMax; + if (this.style === Graph3d.STYLE.DOTSIZE) { + widthMin = dotSize / 2; // px + widthMax = dotSize / 2 + dotSize * 2; // Todo: put this in one function + } + else { + widthMin = 20; // px + widthMax = 20; // px + } + + var height = Math.max(this.frame.clientHeight * 0.25, 100); + var top = this.margin; + var right = this.frame.clientWidth - this.margin; + var left = right - widthMax; + var bottom = top + height; + } + + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + ctx.lineWidth = 1; + ctx.font = '14px arial'; // TODO: put in options + + if (this.style === Graph3d.STYLE.DOTCOLOR) { + // draw the color bar + var ymin = 0; + var ymax = height; // Todo: make height customizable + for (y = ymin; y < ymax; y++) { + var f = (y - ymin) / (ymax - ymin); + + //var width = (dotSize / 2 + (1-f) * dotSize * 2); // Todo: put this in one function + var hue = f * 240; + var color = this._hsv2rgb(hue, 1, 1); + + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(left, top + y); + ctx.lineTo(right, top + y); + ctx.stroke(); + } + + ctx.strokeStyle = this.colorAxis; + ctx.strokeRect(left, top, widthMax, height); + } + + if (this.style === Graph3d.STYLE.DOTSIZE) { + // draw border around color bar + ctx.strokeStyle = this.colorAxis; + ctx.fillStyle = this.colorDot; + ctx.beginPath(); + ctx.moveTo(left, top); + ctx.lineTo(right, top); + ctx.lineTo(right - widthMax + widthMin, bottom); + ctx.lineTo(left, bottom); + ctx.closePath(); + ctx.fill(); + ctx.stroke(); + } + + if (this.style === Graph3d.STYLE.DOTCOLOR || + this.style === Graph3d.STYLE.DOTSIZE) { + // print values along the color bar + var gridLineLen = 5; // px + var step = new StepNumber(this.valueMin, this.valueMax, (this.valueMax-this.valueMin)/5, true); + step.start(); + if (step.getCurrent() < this.valueMin) { + step.next(); + } + while (!step.end()) { + y = bottom - (step.getCurrent() - this.valueMin) / (this.valueMax - this.valueMin) * height; + + ctx.beginPath(); + ctx.moveTo(left - gridLineLen, y); + ctx.lineTo(left, y); + ctx.stroke(); + + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.colorAxis; + ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y); + + step.next(); + } + + ctx.textAlign = 'right'; + ctx.textBaseline = 'top'; + var label = this.legendLabel; + ctx.fillText(label, right, bottom + this.margin); + } + }; + + /** + * Redraw the filter + */ + Graph3d.prototype._redrawFilter = function() { + this.frame.filter.innerHTML = ''; + + if (this.dataFilter) { + var options = { + 'visible': this.showAnimationControls + }; + var slider = new Slider(this.frame.filter, options); + this.frame.filter.slider = slider; + + // TODO: css here is not nice here... + this.frame.filter.style.padding = '10px'; + //this.frame.filter.style.backgroundColor = '#EFEFEF'; + + slider.setValues(this.dataFilter.values); + slider.setPlayInterval(this.animationInterval); + + // create an event handler + var me = this; + var onchange = function () { + var index = slider.getIndex(); + + me.dataFilter.selectValue(index); + me.dataPoints = me.dataFilter._getDataPoints(); + + me.redraw(); + }; + slider.setOnChangeCallback(onchange); + } + else { + this.frame.filter.slider = undefined; + } + }; + + /** + * Redraw the slider + */ + Graph3d.prototype._redrawSlider = function() { + if ( this.frame.filter.slider !== undefined) { + this.frame.filter.slider.redraw(); + } + }; + + + /** + * Redraw common information + */ + Graph3d.prototype._redrawInfo = function() { + if (this.dataFilter) { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + + ctx.font = '14px arial'; // TODO: put in options + ctx.lineStyle = 'gray'; + ctx.fillStyle = 'gray'; + ctx.textAlign = 'left'; + ctx.textBaseline = 'top'; + + var x = this.margin; + var y = this.margin; + ctx.fillText(this.dataFilter.getLabel() + ': ' + this.dataFilter.getSelectedValue(), x, y); + } + }; + + + /** + * Redraw the axis + */ + Graph3d.prototype._redrawAxis = function() { + var canvas = this.frame.canvas, + ctx = canvas.getContext('2d'), + from, to, step, prettyStep, + text, xText, yText, zText, + offset, xOffset, yOffset, + xMin2d, xMax2d; + + // TODO: get the actual rendered style of the containerElement + //ctx.font = this.containerElement.style.font; + ctx.font = 24 / this.camera.getArmLength() + 'px arial'; + + // calculate the length for the short grid lines + var gridLenX = 0.025 / this.scale.x; + var gridLenY = 0.025 / this.scale.y; + var textMargin = 5 / this.camera.getArmLength(); // px + var armAngle = this.camera.getArmRotation().horizontal; + + // draw x-grid lines + ctx.lineWidth = 1; + prettyStep = (this.defaultXStep === undefined); + step = new StepNumber(this.xMin, this.xMax, this.xStep, prettyStep); + step.start(); + if (step.getCurrent() < this.xMin) { + step.next(); + } + while (!step.end()) { + var x = step.getCurrent(); + + if (this.showGrid) { + from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorGrid; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } + else { + from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(x, this.yMin+gridLenX, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + + from = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); + to = this._convert3Dto2D(new Point3d(x, this.yMax-gridLenX, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } + + yText = (Math.cos(armAngle) > 0) ? this.yMin : this.yMax; + text = this._convert3Dto2D(new Point3d(x, yText, this.zMin)); + if (Math.cos(armAngle * 2) > 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + text.y += textMargin; + } + else if (Math.sin(armAngle * 2) < 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } + else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + } + ctx.fillStyle = this.colorAxis; + ctx.fillText(' ' + step.getCurrent() + ' ', text.x, text.y); + + step.next(); + } + + // draw y-grid lines + ctx.lineWidth = 1; + prettyStep = (this.defaultYStep === undefined); + step = new StepNumber(this.yMin, this.yMax, this.yStep, prettyStep); + step.start(); + if (step.getCurrent() < this.yMin) { + step.next(); + } + while (!step.end()) { + if (this.showGrid) { + from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); + ctx.strokeStyle = this.colorGrid; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } + else { + from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMin+gridLenY, step.getCurrent(), this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + + from = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMax-gridLenY, step.getCurrent(), this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } + + xText = (Math.sin(armAngle ) > 0) ? this.xMin : this.xMax; + text = this._convert3Dto2D(new Point3d(xText, step.getCurrent(), this.zMin)); + if (Math.cos(armAngle * 2) < 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + text.y += textMargin; + } + else if (Math.sin(armAngle * 2) > 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } + else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + } + ctx.fillStyle = this.colorAxis; + ctx.fillText(' ' + step.getCurrent() + ' ', text.x, text.y); + + step.next(); + } + + // draw z-grid lines and axis + ctx.lineWidth = 1; + prettyStep = (this.defaultZStep === undefined); + step = new StepNumber(this.zMin, this.zMax, this.zStep, prettyStep); + step.start(); + if (step.getCurrent() < this.zMin) { + step.next(); + } + xText = (Math.cos(armAngle ) > 0) ? this.xMin : this.xMax; + yText = (Math.sin(armAngle ) < 0) ? this.yMin : this.yMax; + while (!step.end()) { + // TODO: make z-grid lines really 3d? + from = this._convert3Dto2D(new Point3d(xText, yText, step.getCurrent())); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(from.x - textMargin, from.y); + ctx.stroke(); + + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.colorAxis; + ctx.fillText(step.getCurrent() + ' ', from.x - 5, from.y); + + step.next(); + } + ctx.lineWidth = 1; + from = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); + to = this._convert3Dto2D(new Point3d(xText, yText, this.zMax)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + + // draw x-axis + ctx.lineWidth = 1; + // line at yMin + xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); + xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(xMin2d.x, xMin2d.y); + ctx.lineTo(xMax2d.x, xMax2d.y); + ctx.stroke(); + // line at ymax + xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); + xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(xMin2d.x, xMin2d.y); + ctx.lineTo(xMax2d.x, xMax2d.y); + ctx.stroke(); + + // draw y-axis + ctx.lineWidth = 1; + // line at xMin + from = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + // line at xMax + from = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + + // draw x-label + var xLabel = this.xLabel; + if (xLabel.length > 0) { + yOffset = 0.1 / this.scale.y; + xText = (this.xMin + this.xMax) / 2; + yText = (Math.cos(armAngle) > 0) ? this.yMin - yOffset: this.yMax + yOffset; + text = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); + if (Math.cos(armAngle * 2) > 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + } + else if (Math.sin(armAngle * 2) < 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } + else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + } + ctx.fillStyle = this.colorAxis; + ctx.fillText(xLabel, text.x, text.y); + } + + // draw y-label + var yLabel = this.yLabel; + if (yLabel.length > 0) { + xOffset = 0.1 / this.scale.x; + xText = (Math.sin(armAngle ) > 0) ? this.xMin - xOffset : this.xMax + xOffset; + yText = (this.yMin + this.yMax) / 2; + text = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); + if (Math.cos(armAngle * 2) < 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + } + else if (Math.sin(armAngle * 2) > 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } + else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + } + ctx.fillStyle = this.colorAxis; + ctx.fillText(yLabel, text.x, text.y); + } + + // draw z-label + var zLabel = this.zLabel; + if (zLabel.length > 0) { + offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis? + xText = (Math.cos(armAngle ) > 0) ? this.xMin : this.xMax; + yText = (Math.sin(armAngle ) < 0) ? this.yMin : this.yMax; + zText = (this.zMin + this.zMax) / 2; + text = this._convert3Dto2D(new Point3d(xText, yText, zText)); + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.colorAxis; + ctx.fillText(zLabel, text.x - offset, text.y); + } + }; + + /** + * Calculate the color based on the given value. + * @param {Number} H Hue, a value be between 0 and 360 + * @param {Number} S Saturation, a value between 0 and 1 + * @param {Number} V Value, a value between 0 and 1 + */ + Graph3d.prototype._hsv2rgb = function(H, S, V) { + var R, G, B, C, Hi, X; + + C = V * S; + Hi = Math.floor(H/60); // hi = 0,1,2,3,4,5 + X = C * (1 - Math.abs(((H/60) % 2) - 1)); + + switch (Hi) { + case 0: R = C; G = X; B = 0; break; + case 1: R = X; G = C; B = 0; break; + case 2: R = 0; G = C; B = X; break; + case 3: R = 0; G = X; B = C; break; + case 4: R = X; G = 0; B = C; break; + case 5: R = C; G = 0; B = X; break; + + default: R = 0; G = 0; B = 0; break; + } + + return 'RGB(' + parseInt(R*255) + ',' + parseInt(G*255) + ',' + parseInt(B*255) + ')'; + }; + + + /** + * Draw all datapoints as a grid + * This function can be used when the style is 'grid' + */ + Graph3d.prototype._redrawDataGrid = function() { + var canvas = this.frame.canvas, + ctx = canvas.getContext('2d'), + point, right, top, cross, + i, + topSideVisible, fillStyle, strokeStyle, lineWidth, + h, s, v, zAvg; + + + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? + + // calculate the translations and screen position of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); + + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; + + // calculate the translation of the point at the bottom (needed for sorting) + var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); + this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; + } + + // sort the points on depth of their (x,y) position (not on z) + var sortDepth = function (a, b) { + return b.dist - a.dist; + }; + this.dataPoints.sort(sortDepth); + + if (this.style === Graph3d.STYLE.SURFACE) { + for (i = 0; i < this.dataPoints.length; i++) { + point = this.dataPoints[i]; + right = this.dataPoints[i].pointRight; + top = this.dataPoints[i].pointTop; + cross = this.dataPoints[i].pointCross; + + if (point !== undefined && right !== undefined && top !== undefined && cross !== undefined) { + + if (this.showGrayBottom || this.showShadow) { + // calculate the cross product of the two vectors from center + // to left and right, in order to know whether we are looking at the + // bottom or at the top side. We can also use the cross product + // for calculating light intensity + var aDiff = Point3d.subtract(cross.trans, point.trans); + var bDiff = Point3d.subtract(top.trans, right.trans); + var crossproduct = Point3d.crossProduct(aDiff, bDiff); + var len = crossproduct.length(); + // FIXME: there is a bug with determining the surface side (shadow or colored) + + topSideVisible = (crossproduct.z > 0); + } + else { + topSideVisible = true; + } + + if (topSideVisible) { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + zAvg = (point.point.z + right.point.z + top.point.z + cross.point.z) / 4; + h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; + s = 1; // saturation + + if (this.showShadow) { + v = Math.min(1 + (crossproduct.x / len) / 2, 1); // value. TODO: scale + fillStyle = this._hsv2rgb(h, s, v); + strokeStyle = fillStyle; + } + else { + v = 1; + fillStyle = this._hsv2rgb(h, s, v); + strokeStyle = this.colorAxis; + } + } + else { + fillStyle = 'gray'; + strokeStyle = this.colorAxis; + } + lineWidth = 0.5; + + ctx.lineWidth = lineWidth; + ctx.fillStyle = fillStyle; + ctx.strokeStyle = strokeStyle; + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); + ctx.lineTo(right.screen.x, right.screen.y); + ctx.lineTo(cross.screen.x, cross.screen.y); + ctx.lineTo(top.screen.x, top.screen.y); + ctx.closePath(); + ctx.fill(); + ctx.stroke(); + } + } + } + else { // grid style + for (i = 0; i < this.dataPoints.length; i++) { + point = this.dataPoints[i]; + right = this.dataPoints[i].pointRight; + top = this.dataPoints[i].pointTop; + + if (point !== undefined) { + if (this.showPerspective) { + lineWidth = 2 / -point.trans.z; + } + else { + lineWidth = 2 * -(this.eye.z / this.camera.getArmLength()); + } + } + + if (point !== undefined && right !== undefined) { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + zAvg = (point.point.z + right.point.z) / 2; + h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; + + ctx.lineWidth = lineWidth; + ctx.strokeStyle = this._hsv2rgb(h, 1, 1); + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); + ctx.lineTo(right.screen.x, right.screen.y); + ctx.stroke(); + } + + if (point !== undefined && top !== undefined) { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + zAvg = (point.point.z + top.point.z) / 2; + h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; + + ctx.lineWidth = lineWidth; + ctx.strokeStyle = this._hsv2rgb(h, 1, 1); + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); + ctx.lineTo(top.screen.x, top.screen.y); + ctx.stroke(); + } + } + } + }; + + + /** + * Draw all datapoints as dots. + * This function can be used when the style is 'dot' or 'dot-line' + */ + Graph3d.prototype._redrawDataDot = function() { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + var i; + + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? + + // calculate the translations of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; + + // calculate the distance from the point at the bottom to the camera + var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); + this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; + } + + // order the translated points by depth + var sortDepth = function (a, b) { + return b.dist - a.dist; + }; + this.dataPoints.sort(sortDepth); + + // draw the datapoints as colored circles + var dotSize = this.frame.clientWidth * 0.02; // px + for (i = 0; i < this.dataPoints.length; i++) { + var point = this.dataPoints[i]; + + if (this.style === Graph3d.STYLE.DOTLINE) { + // draw a vertical line from the bottom to the graph value + //var from = this._convert3Dto2D(new Point3d(point.point.x, point.point.y, this.zMin)); + var from = this._convert3Dto2D(point.bottom); + ctx.lineWidth = 1; + ctx.strokeStyle = this.colorGrid; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(point.screen.x, point.screen.y); + ctx.stroke(); + } + + // calculate radius for the circle + var size; + if (this.style === Graph3d.STYLE.DOTSIZE) { + size = dotSize/2 + 2*dotSize * (point.point.value - this.valueMin) / (this.valueMax - this.valueMin); + } + else { + size = dotSize; + } + + var radius; + if (this.showPerspective) { + radius = size / -point.trans.z; + } + else { + radius = size * -(this.eye.z / this.camera.getArmLength()); + } + if (radius < 0) { + radius = 0; + } + + var hue, color, borderColor; + if (this.style === Graph3d.STYLE.DOTCOLOR ) { + // calculate the color based on the value + hue = (1 - (point.point.value - this.valueMin) * this.scale.value) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } + else if (this.style === Graph3d.STYLE.DOTSIZE) { + color = this.colorDot; + borderColor = this.colorDotBorder; + } + else { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + hue = (1 - (point.point.z - this.zMin) * this.scale.z / this.verticalRatio) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } + + // draw the circle + ctx.lineWidth = 1.0; + ctx.strokeStyle = borderColor; + ctx.fillStyle = color; + ctx.beginPath(); + ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI*2, true); + ctx.fill(); + ctx.stroke(); + } + }; + + /** + * Draw all datapoints as bars. + * This function can be used when the style is 'bar', 'bar-color', or 'bar-size' + */ + Graph3d.prototype._redrawDataBar = function() { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + var i, j, surface, corners; + + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? + + // calculate the translations of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; + + // calculate the distance from the point at the bottom to the camera + var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); + this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; + } + + // order the translated points by depth + var sortDepth = function (a, b) { + return b.dist - a.dist; + }; + this.dataPoints.sort(sortDepth); + + // draw the datapoints as bars + var xWidth = this.xBarWidth / 2; + var yWidth = this.yBarWidth / 2; + for (i = 0; i < this.dataPoints.length; i++) { + var point = this.dataPoints[i]; + + // determine color + var hue, color, borderColor; + if (this.style === Graph3d.STYLE.BARCOLOR ) { + // calculate the color based on the value + hue = (1 - (point.point.value - this.valueMin) * this.scale.value) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } + else if (this.style === Graph3d.STYLE.BARSIZE) { + color = this.colorDot; + borderColor = this.colorDotBorder; + } + else { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + hue = (1 - (point.point.z - this.zMin) * this.scale.z / this.verticalRatio) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } + + // calculate size for the bar + if (this.style === Graph3d.STYLE.BARSIZE) { + xWidth = (this.xBarWidth / 2) * ((point.point.value - this.valueMin) / (this.valueMax - this.valueMin) * 0.8 + 0.2); + yWidth = (this.yBarWidth / 2) * ((point.point.value - this.valueMin) / (this.valueMax - this.valueMin) * 0.8 + 0.2); + } + + // calculate all corner points + var me = this; + var point3d = point.point; + var top = [ + {point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, point3d.z)}, + {point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, point3d.z)}, + {point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, point3d.z)}, + {point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, point3d.z)} + ]; + var bottom = [ + {point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, this.zMin)}, + {point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, this.zMin)}, + {point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, this.zMin)}, + {point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, this.zMin)} + ]; + + // calculate screen location of the points + top.forEach(function (obj) { + obj.screen = me._convert3Dto2D(obj.point); + }); + bottom.forEach(function (obj) { + obj.screen = me._convert3Dto2D(obj.point); + }); + + // create five sides, calculate both corner points and center points + var surfaces = [ + {corners: top, center: Point3d.avg(bottom[0].point, bottom[2].point)}, + {corners: [top[0], top[1], bottom[1], bottom[0]], center: Point3d.avg(bottom[1].point, bottom[0].point)}, + {corners: [top[1], top[2], bottom[2], bottom[1]], center: Point3d.avg(bottom[2].point, bottom[1].point)}, + {corners: [top[2], top[3], bottom[3], bottom[2]], center: Point3d.avg(bottom[3].point, bottom[2].point)}, + {corners: [top[3], top[0], bottom[0], bottom[3]], center: Point3d.avg(bottom[0].point, bottom[3].point)} + ]; + point.surfaces = surfaces; + + // calculate the distance of each of the surface centers to the camera + for (j = 0; j < surfaces.length; j++) { + surface = surfaces[j]; + var transCenter = this._convertPointToTranslation(surface.center); + surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z; + // TODO: this dept calculation doesn't work 100% of the cases due to perspective, + // but the current solution is fast/simple and works in 99.9% of all cases + // the issue is visible in example 14, with graph.setCameraPosition({horizontal: 2.97, vertical: 0.5, distance: 0.9}) + } + + // order the surfaces by their (translated) depth + surfaces.sort(function (a, b) { + var diff = b.dist - a.dist; + if (diff) return diff; + + // if equal depth, sort the top surface last + if (a.corners === top) return 1; + if (b.corners === top) return -1; + + // both are equal + return 0; + }); + + // draw the ordered surfaces + ctx.lineWidth = 1; + ctx.strokeStyle = borderColor; + ctx.fillStyle = color; + // NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside + for (j = 2; j < surfaces.length; j++) { + surface = surfaces[j]; + corners = surface.corners; + ctx.beginPath(); + ctx.moveTo(corners[3].screen.x, corners[3].screen.y); + ctx.lineTo(corners[0].screen.x, corners[0].screen.y); + ctx.lineTo(corners[1].screen.x, corners[1].screen.y); + ctx.lineTo(corners[2].screen.x, corners[2].screen.y); + ctx.lineTo(corners[3].screen.x, corners[3].screen.y); + ctx.fill(); + ctx.stroke(); + } + } + }; + + + /** + * Draw a line through all datapoints. + * This function can be used when the style is 'line' + */ + Graph3d.prototype._redrawDataLine = function() { + var canvas = this.frame.canvas, + ctx = canvas.getContext('2d'), + point, i; + + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? + + // calculate the translations of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); + + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; + } + + // start the line + if (this.dataPoints.length > 0) { + point = this.dataPoints[0]; + + ctx.lineWidth = 1; // TODO: make customizable + ctx.strokeStyle = 'blue'; // TODO: make customizable + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); + } + + // draw the datapoints as colored circles + for (i = 1; i < this.dataPoints.length; i++) { + point = this.dataPoints[i]; + ctx.lineTo(point.screen.x, point.screen.y); + } + + // finish the line + if (this.dataPoints.length > 0) { + ctx.stroke(); + } + }; + + /** + * Start a moving operation inside the provided parent element + * @param {Event} event The event that occurred (required for + * retrieving the mouse position) + */ + Graph3d.prototype._onMouseDown = function(event) { + event = event || window.event; + + // check if mouse is still down (may be up when focus is lost for example + // in an iframe) + if (this.leftButtonDown) { + this._onMouseUp(event); + } + + // only react on left mouse button down + this.leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); + if (!this.leftButtonDown && !this.touchDown) return; + + // get mouse position (different code for IE and all other browsers) + this.startMouseX = getMouseX(event); + this.startMouseY = getMouseY(event); + + this.startStart = new Date(this.start); + this.startEnd = new Date(this.end); + this.startArmRotation = this.camera.getArmRotation(); + + this.frame.style.cursor = 'move'; + + // add event listeners to handle moving the contents + // we store the function onmousemove and onmouseup in the graph, so we can + // remove the eventlisteners lateron in the function mouseUp() + var me = this; + this.onmousemove = function (event) {me._onMouseMove(event);}; + this.onmouseup = function (event) {me._onMouseUp(event);}; + util.addEventListener(document, 'mousemove', me.onmousemove); + util.addEventListener(document, 'mouseup', me.onmouseup); + util.preventDefault(event); + }; + + + /** + * Perform moving operating. + * This function activated from within the funcion Graph.mouseDown(). + * @param {Event} event Well, eehh, the event + */ + Graph3d.prototype._onMouseMove = function (event) { + event = event || window.event; + + // calculate change in mouse position + var diffX = parseFloat(getMouseX(event)) - this.startMouseX; + var diffY = parseFloat(getMouseY(event)) - this.startMouseY; + + var horizontalNew = this.startArmRotation.horizontal + diffX / 200; + var verticalNew = this.startArmRotation.vertical + diffY / 200; + + var snapAngle = 4; // degrees + var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); + + // snap horizontally to nice angles at 0pi, 0.5pi, 1pi, 1.5pi, etc... + // the -0.001 is to take care that the vertical axis is always drawn at the left front corner + if (Math.abs(Math.sin(horizontalNew)) < snapValue) { + horizontalNew = Math.round((horizontalNew / Math.PI)) * Math.PI - 0.001; + } + if (Math.abs(Math.cos(horizontalNew)) < snapValue) { + horizontalNew = (Math.round((horizontalNew/ Math.PI - 0.5)) + 0.5) * Math.PI - 0.001; + } + + // snap vertically to nice angles + if (Math.abs(Math.sin(verticalNew)) < snapValue) { + verticalNew = Math.round((verticalNew / Math.PI)) * Math.PI; + } + if (Math.abs(Math.cos(verticalNew)) < snapValue) { + verticalNew = (Math.round((verticalNew/ Math.PI - 0.5)) + 0.5) * Math.PI; + } + + this.camera.setArmRotation(horizontalNew, verticalNew); + this.redraw(); + + // fire a cameraPositionChange event + var parameters = this.getCameraPosition(); + this.emit('cameraPositionChange', parameters); + + util.preventDefault(event); + }; + + + /** + * Stop moving operating. + * This function activated from within the funcion Graph.mouseDown(). + * @param {event} event The event + */ + Graph3d.prototype._onMouseUp = function (event) { + this.frame.style.cursor = 'auto'; + this.leftButtonDown = false; + + // remove event listeners here + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); + }; + + /** + * After having moved the mouse, a tooltip should pop up when the mouse is resting on a data point + * @param {Event} event A mouse move event + */ + Graph3d.prototype._onTooltip = function (event) { + var delay = 300; // ms + var mouseX = getMouseX(event) - util.getAbsoluteLeft(this.frame); + var mouseY = getMouseY(event) - util.getAbsoluteTop(this.frame); + + if (!this.showTooltip) { + return; + } + + if (this.tooltipTimeout) { + clearTimeout(this.tooltipTimeout); + } + + // (delayed) display of a tooltip only if no mouse button is down + if (this.leftButtonDown) { + this._hideTooltip(); + return; + } + + if (this.tooltip && this.tooltip.dataPoint) { + // tooltip is currently visible + var dataPoint = this._dataPointFromXY(mouseX, mouseY); + if (dataPoint !== this.tooltip.dataPoint) { + // datapoint changed + if (dataPoint) { + this._showTooltip(dataPoint); + } + else { + this._hideTooltip(); + } + } + } + else { + // tooltip is currently not visible + var me = this; + this.tooltipTimeout = setTimeout(function () { + me.tooltipTimeout = null; + + // show a tooltip if we have a data point + var dataPoint = me._dataPointFromXY(mouseX, mouseY); + if (dataPoint) { + me._showTooltip(dataPoint); + } + }, delay); + } + }; + + /** + * Event handler for touchstart event on mobile devices + */ + Graph3d.prototype._onTouchStart = function(event) { + this.touchDown = true; + + var me = this; + this.ontouchmove = function (event) {me._onTouchMove(event);}; + this.ontouchend = function (event) {me._onTouchEnd(event);}; + util.addEventListener(document, 'touchmove', me.ontouchmove); + util.addEventListener(document, 'touchend', me.ontouchend); + + this._onMouseDown(event); + }; + + /** + * Event handler for touchmove event on mobile devices + */ + Graph3d.prototype._onTouchMove = function(event) { + this._onMouseMove(event); + }; + + /** + * Event handler for touchend event on mobile devices + */ + Graph3d.prototype._onTouchEnd = function(event) { + this.touchDown = false; + + util.removeEventListener(document, 'touchmove', this.ontouchmove); + util.removeEventListener(document, 'touchend', this.ontouchend); + + this._onMouseUp(event); + }; + + + /** + * Event handler for mouse wheel event, used to zoom the graph + * Code from http://adomas.org/javascript-mouse-wheel/ + * @param {event} event The event + */ + Graph3d.prototype._onWheel = function(event) { + if (!event) /* For IE. */ + event = window.event; + + // retrieve delta + var delta = 0; + if (event.wheelDelta) { /* IE/Opera. */ + delta = event.wheelDelta/120; + } else if (event.detail) { /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail/3; + } + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + var oldLength = this.camera.getArmLength(); + var newLength = oldLength * (1 - delta / 10); + + this.camera.setArmLength(newLength); + this.redraw(); + + this._hideTooltip(); + } + + // fire a cameraPositionChange event + var parameters = this.getCameraPosition(); + this.emit('cameraPositionChange', parameters); + + // Prevent default actions caused by mouse wheel. + // That might be ugly, but we handle scrolls somehow + // anyway, so don't bother here.. + util.preventDefault(event); + }; + + /** + * Test whether a point lies inside given 2D triangle + * @param {Point2d} point + * @param {Point2d[]} triangle + * @return {boolean} Returns true if given point lies inside or on the edge of the triangle + * @private + */ + Graph3d.prototype._insideTriangle = function (point, triangle) { + var a = triangle[0], + b = triangle[1], + c = triangle[2]; + + function sign (x) { + return x > 0 ? 1 : x < 0 ? -1 : 0; + } + + var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x)); + var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x)); + var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x)); + + // each of the three signs must be either equal to each other or zero + return (as == 0 || bs == 0 || as == bs) && + (bs == 0 || cs == 0 || bs == cs) && + (as == 0 || cs == 0 || as == cs); + }; + + /** + * Find a data point close to given screen position (x, y) + * @param {Number} x + * @param {Number} y + * @return {Object | null} The closest data point or null if not close to any data point + * @private + */ + Graph3d.prototype._dataPointFromXY = function (x, y) { + var i, + distMax = 100, // px + dataPoint = null, + closestDataPoint = null, + closestDist = null, + center = new Point2d(x, y); + + if (this.style === Graph3d.STYLE.BAR || + this.style === Graph3d.STYLE.BARCOLOR || + this.style === Graph3d.STYLE.BARSIZE) { + // the data points are ordered from far away to closest + for (i = this.dataPoints.length - 1; i >= 0; i--) { + dataPoint = this.dataPoints[i]; + var surfaces = dataPoint.surfaces; + if (surfaces) { + for (var s = surfaces.length - 1; s >= 0; s--) { + // split each surface in two triangles, and see if the center point is inside one of these + var surface = surfaces[s]; + var corners = surface.corners; + var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen]; + var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen]; + if (this._insideTriangle(center, triangle1) || + this._insideTriangle(center, triangle2)) { + // return immediately at the first hit + return dataPoint; + } + } + } + } + } + else { + // find the closest data point, using distance to the center of the point on 2d screen + for (i = 0; i < this.dataPoints.length; i++) { + dataPoint = this.dataPoints[i]; + var point = dataPoint.screen; + if (point) { + var distX = Math.abs(x - point.x); + var distY = Math.abs(y - point.y); + var dist = Math.sqrt(distX * distX + distY * distY); + + if ((closestDist === null || dist < closestDist) && dist < distMax) { + closestDist = dist; + closestDataPoint = dataPoint; + } + } + } + } + + + return closestDataPoint; + }; + + /** + * Display a tooltip for given data point + * @param {Object} dataPoint + * @private + */ + Graph3d.prototype._showTooltip = function (dataPoint) { + var content, line, dot; + + if (!this.tooltip) { + content = document.createElement('div'); + content.style.position = 'absolute'; + content.style.padding = '10px'; + content.style.border = '1px solid #4d4d4d'; + content.style.color = '#1a1a1a'; + content.style.background = 'rgba(255,255,255,0.7)'; + content.style.borderRadius = '2px'; + content.style.boxShadow = '5px 5px 10px rgba(128,128,128,0.5)'; + + line = document.createElement('div'); + line.style.position = 'absolute'; + line.style.height = '40px'; + line.style.width = '0'; + line.style.borderLeft = '1px solid #4d4d4d'; + + dot = document.createElement('div'); + dot.style.position = 'absolute'; + dot.style.height = '0'; + dot.style.width = '0'; + dot.style.border = '5px solid #4d4d4d'; + dot.style.borderRadius = '5px'; + + this.tooltip = { + dataPoint: null, + dom: { + content: content, + line: line, + dot: dot + } + }; + } + else { + content = this.tooltip.dom.content; + line = this.tooltip.dom.line; + dot = this.tooltip.dom.dot; + } + + this._hideTooltip(); + + this.tooltip.dataPoint = dataPoint; + if (typeof this.showTooltip === 'function') { + content.innerHTML = this.showTooltip(dataPoint.point); + } + else { + content.innerHTML = '' + + '' + + '' + + '' + + '
x:' + dataPoint.point.x + '
y:' + dataPoint.point.y + '
z:' + dataPoint.point.z + '
'; + } + + content.style.left = '0'; + content.style.top = '0'; + this.frame.appendChild(content); + this.frame.appendChild(line); + this.frame.appendChild(dot); + + // calculate sizes + var contentWidth = content.offsetWidth; + var contentHeight = content.offsetHeight; + var lineHeight = line.offsetHeight; + var dotWidth = dot.offsetWidth; + var dotHeight = dot.offsetHeight; + + var left = dataPoint.screen.x - contentWidth / 2; + left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth); + + line.style.left = dataPoint.screen.x + 'px'; + line.style.top = (dataPoint.screen.y - lineHeight) + 'px'; + content.style.left = left + 'px'; + content.style.top = (dataPoint.screen.y - lineHeight - contentHeight) + 'px'; + dot.style.left = (dataPoint.screen.x - dotWidth / 2) + 'px'; + dot.style.top = (dataPoint.screen.y - dotHeight / 2) + 'px'; + }; + + /** + * Hide the tooltip when displayed + * @private + */ + Graph3d.prototype._hideTooltip = function () { + if (this.tooltip) { + this.tooltip.dataPoint = null; + + for (var prop in this.tooltip.dom) { + if (this.tooltip.dom.hasOwnProperty(prop)) { + var elem = this.tooltip.dom[prop]; + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + } + } + } + }; + + /**--------------------------------------------------------------------------**/ + + + /** + * Get the horizontal mouse position from a mouse event + * @param {Event} event + * @return {Number} mouse x + */ + getMouseX = function(event) { + if ('clientX' in event) return event.clientX; + return event.targetTouches[0] && event.targetTouches[0].clientX || 0; + }; + + /** + * Get the vertical mouse position from a mouse event + * @param {Event} event + * @return {Number} mouse y + */ + getMouseY = function(event) { + if ('clientY' in event) return event.clientY; + return event.targetTouches[0] && event.targetTouches[0].clientY || 0; + }; + + module.exports = Graph3d; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * Expose `Emitter`. + */ + + module.exports = Emitter; + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + }; + + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks[event] = this._callbacks[event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + var self = this; + this._callbacks = this._callbacks || {}; + + function on() { + self.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks[event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks[event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks[event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks[event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * @prototype Point3d + * @param {Number} [x] + * @param {Number} [y] + * @param {Number} [z] + */ + function Point3d(x, y, z) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; + this.z = z !== undefined ? z : 0; + }; + + /** + * Subtract the two provided points, returns a-b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a-b + */ + Point3d.subtract = function(a, b) { + var sub = new Point3d(); + sub.x = a.x - b.x; + sub.y = a.y - b.y; + sub.z = a.z - b.z; + return sub; + }; + + /** + * Add the two provided points, returns a+b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a+b + */ + Point3d.add = function(a, b) { + var sum = new Point3d(); + sum.x = a.x + b.x; + sum.y = a.y + b.y; + sum.z = a.z + b.z; + return sum; + }; + + /** + * Calculate the average of two 3d points + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} The average, (a+b)/2 + */ + Point3d.avg = function(a, b) { + return new Point3d( + (a.x + b.x) / 2, + (a.y + b.y) / 2, + (a.z + b.z) / 2 + ); + }; + + /** + * Calculate the cross product of the two provided points, returns axb + * Documentation: http://en.wikipedia.org/wiki/Cross_product + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} cross product axb + */ + Point3d.crossProduct = function(a, b) { + var crossproduct = new Point3d(); + + crossproduct.x = a.y * b.z - a.z * b.y; + crossproduct.y = a.z * b.x - a.x * b.z; + crossproduct.z = a.x * b.y - a.y * b.x; + + return crossproduct; + }; + + + /** + * Rtrieve the length of the vector (or the distance from this point to the origin + * @return {Number} length + */ + Point3d.prototype.length = function() { + return Math.sqrt( + this.x * this.x + + this.y * this.y + + this.z * this.z + ); + }; + + module.exports = Point3d; + + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * @prototype Point2d + * @param {Number} [x] + * @param {Number} [y] + */ + Point2d = function (x, y) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; + }; + + module.exports = Point2d; + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + var Point3d = __webpack_require__(9); + + /** + * @class Camera + * The camera is mounted on a (virtual) camera arm. The camera arm can rotate + * The camera is always looking in the direction of the origin of the arm. + * This way, the camera always rotates around one fixed point, the location + * of the camera arm. + * + * Documentation: + * http://en.wikipedia.org/wiki/3D_projection + */ + Camera = function () { + this.armLocation = new Point3d(); + this.armRotation = {}; + this.armRotation.horizontal = 0; + this.armRotation.vertical = 0; + this.armLength = 1.7; + + this.cameraLocation = new Point3d(); + this.cameraRotation = new Point3d(0.5*Math.PI, 0, 0); + + this.calculateCameraOrientation(); + }; + + /** + * Set the location (origin) of the arm + * @param {Number} x Normalized value of x + * @param {Number} y Normalized value of y + * @param {Number} z Normalized value of z + */ + Camera.prototype.setArmLocation = function(x, y, z) { + this.armLocation.x = x; + this.armLocation.y = y; + this.armLocation.z = z; + + this.calculateCameraOrientation(); + }; + + /** + * Set the rotation of the camera arm + * @param {Number} horizontal The horizontal rotation, between 0 and 2*PI. + * Optional, can be left undefined. + * @param {Number} vertical The vertical rotation, between 0 and 0.5*PI + * if vertical=0.5*PI, the graph is shown from the + * top. Optional, can be left undefined. + */ + Camera.prototype.setArmRotation = function(horizontal, vertical) { + if (horizontal !== undefined) { + this.armRotation.horizontal = horizontal; + } + + if (vertical !== undefined) { + this.armRotation.vertical = vertical; + if (this.armRotation.vertical < 0) this.armRotation.vertical = 0; + if (this.armRotation.vertical > 0.5*Math.PI) this.armRotation.vertical = 0.5*Math.PI; + } + + if (horizontal !== undefined || vertical !== undefined) { + this.calculateCameraOrientation(); + } + }; + + /** + * Retrieve the current arm rotation + * @return {object} An object with parameters horizontal and vertical + */ + Camera.prototype.getArmRotation = function() { + var rot = {}; + rot.horizontal = this.armRotation.horizontal; + rot.vertical = this.armRotation.vertical; + + return rot; + }; + + /** + * Set the (normalized) length of the camera arm. + * @param {Number} length A length between 0.71 and 5.0 + */ + Camera.prototype.setArmLength = function(length) { + if (length === undefined) + return; + + this.armLength = length; + + // Radius must be larger than the corner of the graph, + // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the + // graph + if (this.armLength < 0.71) this.armLength = 0.71; + if (this.armLength > 5.0) this.armLength = 5.0; + + this.calculateCameraOrientation(); + }; + + /** + * Retrieve the arm length + * @return {Number} length + */ + Camera.prototype.getArmLength = function() { + return this.armLength; + }; + + /** + * Retrieve the camera location + * @return {Point3d} cameraLocation + */ + Camera.prototype.getCameraLocation = function() { + return this.cameraLocation; + }; + + /** + * Retrieve the camera rotation + * @return {Point3d} cameraRotation + */ + Camera.prototype.getCameraRotation = function() { + return this.cameraRotation; + }; + + /** + * Calculate the location and rotation of the camera based on the + * position and orientation of the camera arm + */ + Camera.prototype.calculateCameraOrientation = function() { + // calculate location of the camera + this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); + + // calculate rotation of the camera + this.cameraRotation.x = Math.PI/2 - this.armRotation.vertical; + this.cameraRotation.y = 0; + this.cameraRotation.z = -this.armRotation.horizontal; + }; + + module.exports = Camera; + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + var DataView = __webpack_require__(6); + + /** + * @class Filter + * + * @param {DataSet} data The google data table + * @param {Number} column The index of the column to be filtered + * @param {Graph} graph The graph + */ + function Filter (data, column, graph) { + this.data = data; + this.column = column; + this.graph = graph; // the parent graph + + this.index = undefined; + this.value = undefined; + + // read all distinct values and select the first one + this.values = graph.getDistinctValues(data.get(), this.column); + + // sort both numeric and string values correctly + this.values.sort(function (a, b) { + return a > b ? 1 : a < b ? -1 : 0; + }); + + if (this.values.length > 0) { + this.selectValue(0); + } + + // create an array with the filtered datapoints. this will be loaded afterwards + this.dataPoints = []; + + this.loaded = false; + this.onLoadCallback = undefined; + + if (graph.animationPreload) { + this.loaded = false; + this.loadInBackground(); + } + else { + this.loaded = true; + } + }; + + + /** + * Return the label + * @return {string} label + */ + Filter.prototype.isLoaded = function() { + return this.loaded; + }; + + + /** + * Return the loaded progress + * @return {Number} percentage between 0 and 100 + */ + Filter.prototype.getLoadedProgress = function() { + var len = this.values.length; + + var i = 0; + while (this.dataPoints[i]) { + i++; + } + + return Math.round(i / len * 100); + }; + + + /** + * Return the label + * @return {string} label + */ + Filter.prototype.getLabel = function() { + return this.graph.filterLabel; + }; + + + /** + * Return the columnIndex of the filter + * @return {Number} columnIndex + */ + Filter.prototype.getColumn = function() { + return this.column; + }; + + /** + * Return the currently selected value. Returns undefined if there is no selection + * @return {*} value + */ + Filter.prototype.getSelectedValue = function() { + if (this.index === undefined) + return undefined; + + return this.values[this.index]; + }; + + /** + * Retrieve all values of the filter + * @return {Array} values + */ + Filter.prototype.getValues = function() { + return this.values; + }; + + /** + * Retrieve one value of the filter + * @param {Number} index + * @return {*} value + */ + Filter.prototype.getValue = function(index) { + if (index >= this.values.length) + throw 'Error: index out of range'; + + return this.values[index]; + }; + + + /** + * Retrieve the (filtered) dataPoints for the currently selected filter index + * @param {Number} [index] (optional) + * @return {Array} dataPoints + */ + Filter.prototype._getDataPoints = function(index) { + if (index === undefined) + index = this.index; + + if (index === undefined) + return []; + + var dataPoints; + if (this.dataPoints[index]) { + dataPoints = this.dataPoints[index]; + } + else { + var f = {}; + f.column = this.column; + f.value = this.values[index]; + + var dataView = new DataView(this.data,{filter: function (item) {return (item[f.column] == f.value);}}).get(); + dataPoints = this.graph._getDataPoints(dataView); + + this.dataPoints[index] = dataPoints; + } + + return dataPoints; + }; + + + + /** + * Set a callback function when the filter is fully loaded. + */ + Filter.prototype.setOnLoadCallback = function(callback) { + this.onLoadCallback = callback; + }; + + + /** + * Add a value to the list with available values for this filter + * No double entries will be created. + * @param {Number} index + */ + Filter.prototype.selectValue = function(index) { + if (index >= this.values.length) + throw 'Error: index out of range'; + + this.index = index; + this.value = this.values[index]; + }; + + /** + * Load all filtered rows in the background one by one + * Start this method without providing an index! + */ + Filter.prototype.loadInBackground = function(index) { + if (index === undefined) + index = 0; + + var frame = this.graph.frame; + + if (index < this.values.length) { + var dataPointsTemp = this._getDataPoints(index); + //this.graph.redrawInfo(); // TODO: not neat + + // create a progress box + if (frame.progress === undefined) { + frame.progress = document.createElement('DIV'); + frame.progress.style.position = 'absolute'; + frame.progress.style.color = 'gray'; + frame.appendChild(frame.progress); + } + var progress = this.getLoadedProgress(); + frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; + // TODO: this is no nice solution... + frame.progress.style.bottom = 60 + 'px'; // TODO: use height of slider + frame.progress.style.left = 10 + 'px'; + + var me = this; + setTimeout(function() {me.loadInBackground(index+1);}, 10); + this.loaded = false; + } + else { + this.loaded = true; + + // remove the progress box + if (frame.progress !== undefined) { + frame.removeChild(frame.progress); + frame.progress = undefined; + } + + if (this.onLoadCallback) + this.onLoadCallback(); + } + }; + + module.exports = Filter; + + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + + /** + * @constructor Slider + * + * An html slider control with start/stop/prev/next buttons + * @param {Element} container The element where the slider will be created + * @param {Object} options Available options: + * {boolean} visible If true (default) the + * slider is visible. + */ + function Slider(container, options) { + if (container === undefined) { + throw 'Error: No container element defined'; + } + this.container = container; + this.visible = (options && options.visible != undefined) ? options.visible : true; + + if (this.visible) { + this.frame = document.createElement('DIV'); + //this.frame.style.backgroundColor = '#E5E5E5'; + this.frame.style.width = '100%'; + this.frame.style.position = 'relative'; + this.container.appendChild(this.frame); + + this.frame.prev = document.createElement('INPUT'); + this.frame.prev.type = 'BUTTON'; + this.frame.prev.value = 'Prev'; + this.frame.appendChild(this.frame.prev); + + this.frame.play = document.createElement('INPUT'); + this.frame.play.type = 'BUTTON'; + this.frame.play.value = 'Play'; + this.frame.appendChild(this.frame.play); + + this.frame.next = document.createElement('INPUT'); + this.frame.next.type = 'BUTTON'; + this.frame.next.value = 'Next'; + this.frame.appendChild(this.frame.next); + + this.frame.bar = document.createElement('INPUT'); + this.frame.bar.type = 'BUTTON'; + this.frame.bar.style.position = 'absolute'; + this.frame.bar.style.border = '1px solid red'; + this.frame.bar.style.width = '100px'; + this.frame.bar.style.height = '6px'; + this.frame.bar.style.borderRadius = '2px'; + this.frame.bar.style.MozBorderRadius = '2px'; + this.frame.bar.style.border = '1px solid #7F7F7F'; + this.frame.bar.style.backgroundColor = '#E5E5E5'; + this.frame.appendChild(this.frame.bar); + + this.frame.slide = document.createElement('INPUT'); + this.frame.slide.type = 'BUTTON'; + this.frame.slide.style.margin = '0px'; + this.frame.slide.value = ' '; + this.frame.slide.style.position = 'relative'; + this.frame.slide.style.left = '-100px'; + this.frame.appendChild(this.frame.slide); + + // create events + var me = this; + this.frame.slide.onmousedown = function (event) {me._onMouseDown(event);}; + this.frame.prev.onclick = function (event) {me.prev(event);}; + this.frame.play.onclick = function (event) {me.togglePlay(event);}; + this.frame.next.onclick = function (event) {me.next(event);}; + } + + this.onChangeCallback = undefined; + + this.values = []; + this.index = undefined; + + this.playTimeout = undefined; + this.playInterval = 1000; // milliseconds + this.playLoop = true; + } + + /** + * Select the previous index + */ + Slider.prototype.prev = function() { + var index = this.getIndex(); + if (index > 0) { + index--; + this.setIndex(index); + } + }; + + /** + * Select the next index + */ + Slider.prototype.next = function() { + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } + }; + + /** + * Select the next index + */ + Slider.prototype.playNext = function() { + var start = new Date(); + + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } + else if (this.playLoop) { + // jump to the start + index = 0; + this.setIndex(index); + } + + var end = new Date(); + var diff = (end - start); + + // calculate how much time it to to set the index and to execute the callback + // function. + var interval = Math.max(this.playInterval - diff, 0); + // document.title = diff // TODO: cleanup + + var me = this; + this.playTimeout = setTimeout(function() {me.playNext();}, interval); + }; + + /** + * Toggle start or stop playing + */ + Slider.prototype.togglePlay = function() { + if (this.playTimeout === undefined) { + this.play(); + } else { + this.stop(); + } + }; + + /** + * Start playing + */ + Slider.prototype.play = function() { + // Test whether already playing + if (this.playTimeout) return; + + this.playNext(); + + if (this.frame) { + this.frame.play.value = 'Stop'; + } + }; + + /** + * Stop playing + */ + Slider.prototype.stop = function() { + clearInterval(this.playTimeout); + this.playTimeout = undefined; + + if (this.frame) { + this.frame.play.value = 'Play'; + } + }; + + /** + * Set a callback function which will be triggered when the value of the + * slider bar has changed. + */ + Slider.prototype.setOnChangeCallback = function(callback) { + this.onChangeCallback = callback; + }; + + /** + * Set the interval for playing the list + * @param {Number} interval The interval in milliseconds + */ + Slider.prototype.setPlayInterval = function(interval) { + this.playInterval = interval; + }; + + /** + * Retrieve the current play interval + * @return {Number} interval The interval in milliseconds + */ + Slider.prototype.getPlayInterval = function(interval) { + return this.playInterval; + }; + + /** + * Set looping on or off + * @pararm {boolean} doLoop If true, the slider will jump to the start when + * the end is passed, and will jump to the end + * when the start is passed. + */ + Slider.prototype.setPlayLoop = function(doLoop) { + this.playLoop = doLoop; + }; + + + /** + * Execute the onchange callback function + */ + Slider.prototype.onChange = function() { + if (this.onChangeCallback !== undefined) { + this.onChangeCallback(); + } + }; + + /** + * redraw the slider on the correct place + */ + Slider.prototype.redraw = function() { + if (this.frame) { + // resize the bar + this.frame.bar.style.top = (this.frame.clientHeight/2 - + this.frame.bar.offsetHeight/2) + 'px'; + this.frame.bar.style.width = (this.frame.clientWidth - + this.frame.prev.clientWidth - + this.frame.play.clientWidth - + this.frame.next.clientWidth - 30) + 'px'; + + // position the slider button + var left = this.indexToLeft(this.index); + this.frame.slide.style.left = (left) + 'px'; + } + }; + + + /** + * Set the list with values for the slider + * @param {Array} values A javascript array with values (any type) + */ + Slider.prototype.setValues = function(values) { + this.values = values; + + if (this.values.length > 0) + this.setIndex(0); + else + this.index = undefined; + }; + + /** + * Select a value by its index + * @param {Number} index + */ + Slider.prototype.setIndex = function(index) { + if (index < this.values.length) { + this.index = index; + + this.redraw(); + this.onChange(); + } + else { + throw 'Error: index out of range'; + } + }; + + /** + * retrieve the index of the currently selected vaue + * @return {Number} index + */ + Slider.prototype.getIndex = function() { + return this.index; + }; + + + /** + * retrieve the currently selected value + * @return {*} value + */ + Slider.prototype.get = function() { + return this.values[this.index]; + }; + + + Slider.prototype._onMouseDown = function(event) { + // only react on left mouse button down + var leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); + if (!leftButtonDown) return; + + this.startClientX = event.clientX; + this.startSlideX = parseFloat(this.frame.slide.style.left); + + this.frame.style.cursor = 'move'; + + // add event listeners to handle moving the contents + // we store the function onmousemove and onmouseup in the graph, so we can + // remove the eventlisteners lateron in the function mouseUp() + var me = this; + this.onmousemove = function (event) {me._onMouseMove(event);}; + this.onmouseup = function (event) {me._onMouseUp(event);}; + util.addEventListener(document, 'mousemove', this.onmousemove); + util.addEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); + }; + + + Slider.prototype.leftToIndex = function (left) { + var width = parseFloat(this.frame.bar.style.width) - + this.frame.slide.clientWidth - 10; + var x = left - 3; + + var index = Math.round(x / width * (this.values.length-1)); + if (index < 0) index = 0; + if (index > this.values.length-1) index = this.values.length-1; + + return index; + }; + + Slider.prototype.indexToLeft = function (index) { + var width = parseFloat(this.frame.bar.style.width) - + this.frame.slide.clientWidth - 10; + + var x = index / (this.values.length-1) * width; + var left = x + 3; + + return left; + }; + + + + Slider.prototype._onMouseMove = function (event) { + var diff = event.clientX - this.startClientX; + var x = this.startSlideX + diff; + + var index = this.leftToIndex(x); + + this.setIndex(index); + + util.preventDefault(); + }; + + + Slider.prototype._onMouseUp = function (event) { + this.frame.style.cursor = 'auto'; + + // remove event listeners + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); + + util.preventDefault(); + }; + + module.exports = Slider; + + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * @prototype StepNumber + * The class StepNumber is an iterator for Numbers. You provide a start and end + * value, and a best step size. StepNumber itself rounds to fixed values and + * a finds the step that best fits the provided step. + * + * If prettyStep is true, the step size is chosen as close as possible to the + * provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... + * + * Example usage: + * var step = new StepNumber(0, 10, 2.5, true); + * step.start(); + * while (!step.end()) { + * alert(step.getCurrent()); + * step.next(); + * } + * + * Version: 1.0 + * + * @param {Number} start The start value + * @param {Number} end The end value + * @param {Number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ + function StepNumber(start, end, step, prettyStep) { + // set default values + this._start = 0; + this._end = 0; + this._step = 1; + this.prettyStep = true; + this.precision = 5; + + this._current = 0; + this.setRange(start, end, step, prettyStep); + }; + + /** + * Set a new range: start, end and step. + * + * @param {Number} start The start value + * @param {Number} end The end value + * @param {Number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ + StepNumber.prototype.setRange = function(start, end, step, prettyStep) { + this._start = start ? start : 0; + this._end = end ? end : 0; + + this.setStep(step, prettyStep); + }; + + /** + * Set a new step size + * @param {Number} step New step size. Must be a positive value + * @param {boolean} prettyStep Optional. If true, the provided step is rounded + * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ + StepNumber.prototype.setStep = function(step, prettyStep) { + if (step === undefined || step <= 0) + return; + + if (prettyStep !== undefined) + this.prettyStep = prettyStep; + + if (this.prettyStep === true) + this._step = StepNumber.calculatePrettyStep(step); + else + this._step = step; + }; + + /** + * Calculate a nice step size, closest to the desired step size. + * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an + * integer Number. For example 1, 2, 5, 10, 20, 50, etc... + * @param {Number} step Desired step size + * @return {Number} Nice step size + */ + StepNumber.calculatePrettyStep = function (step) { + var log10 = function (x) {return Math.log(x) / Math.LN10;}; + + // try three steps (multiple of 1, 2, or 5 + var step1 = Math.pow(10, Math.round(log10(step))), + step2 = 2 * Math.pow(10, Math.round(log10(step / 2))), + step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); + + // choose the best step (closest to minimum step) + var prettyStep = step1; + if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2; + if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; + + // for safety + if (prettyStep <= 0) { + prettyStep = 1; + } + + return prettyStep; + }; + + /** + * returns the current value of the step + * @return {Number} current value + */ + StepNumber.prototype.getCurrent = function () { + return parseFloat(this._current.toPrecision(this.precision)); + }; + + /** + * returns the current step size + * @return {Number} current step size + */ + StepNumber.prototype.getStep = function () { + return this._step; + }; + + /** + * Set the current value to the largest value smaller than start, which + * is a multiple of the step size + */ + StepNumber.prototype.start = function() { + this._current = this._start - this._start % this._step; + }; + + /** + * Do a step, add the step size to the current value + */ + StepNumber.prototype.next = function () { + this._current += this._step; + }; + + /** + * Returns true whether the end is reached + * @return {boolean} True if the current value has passed the end value. + */ + StepNumber.prototype.end = function () { + return (this._current > this._end); + }; + + module.exports = StepNumber; + + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + var Emitter = __webpack_require__(8); + var Hammer = __webpack_require__(16); + var util = __webpack_require__(1); + var DataSet = __webpack_require__(5); + var DataView = __webpack_require__(6); + var Range = __webpack_require__(18); + var TimeAxis = __webpack_require__(21); + var CurrentTime = __webpack_require__(23); + var CustomTime = __webpack_require__(24); + var ItemSet = __webpack_require__(25); + + /** + * Create a timeline visualization + * @param {HTMLElement} container + * @param {vis.DataSet | Array | google.visualization.DataTable} [items] + * @param {Object} [options] See Timeline.setOptions for the available options. + * @constructor + */ + function Timeline (container, items, options) { + if (!(this instanceof Timeline)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + + var me = this; + this.defaultOptions = { + start: null, + end: null, + + autoResize: true, + + orientation: 'bottom', + width: null, + height: null, + maxHeight: null, + minHeight: null + }; + this.options = util.deepExtend({}, this.defaultOptions); + + // Create the DOM, props, and emitter + this._create(container); + + // all components listed here will be repainted automatically + this.components = []; + + this.body = { + dom: this.dom, + domProps: this.props, + emitter: { + on: this.on.bind(this), + off: this.off.bind(this), + emit: this.emit.bind(this) + }, + util: { + snap: null, // will be specified after TimeAxis is created + toScreen: me._toScreen.bind(me), + toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width + toTime: me._toTime.bind(me), + toGlobalTime : me._toGlobalTime.bind(me) + } + }; + + // range + this.range = new Range(this.body); + this.components.push(this.range); + this.body.range = this.range; + + // time axis + this.timeAxis = new TimeAxis(this.body); + this.components.push(this.timeAxis); + this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); + + // current time bar + this.currentTime = new CurrentTime(this.body); + this.components.push(this.currentTime); + + // custom time bar + // Note: time bar will be attached in this.setOptions when selected + this.customTime = new CustomTime(this.body); + this.components.push(this.customTime); + + // item set + this.itemSet = new ItemSet(this.body); + this.components.push(this.itemSet); + + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet + + // apply options + if (options) { + this.setOptions(options); + } + + // create itemset + if (items) { + this.setItems(items); + } + else { + this.redraw(); + } + } + + // turn Timeline into an event emitter + Emitter(Timeline.prototype); + + /** + * Create the main DOM for the Timeline: a root panel containing left, right, + * top, bottom, content, and background panel. + * @param {Element} container The container element where the Timeline will + * be attached. + * @private + */ + Timeline.prototype._create = function (container) { + this.dom = {}; + + this.dom.root = document.createElement('div'); + this.dom.background = document.createElement('div'); + this.dom.backgroundVertical = document.createElement('div'); + this.dom.backgroundHorizontal = document.createElement('div'); + this.dom.centerContainer = document.createElement('div'); + this.dom.leftContainer = document.createElement('div'); + this.dom.rightContainer = document.createElement('div'); + this.dom.center = document.createElement('div'); + this.dom.left = document.createElement('div'); + this.dom.right = document.createElement('div'); + this.dom.top = document.createElement('div'); + this.dom.bottom = document.createElement('div'); + this.dom.shadowTop = document.createElement('div'); + this.dom.shadowBottom = document.createElement('div'); + this.dom.shadowTopLeft = document.createElement('div'); + this.dom.shadowBottomLeft = document.createElement('div'); + this.dom.shadowTopRight = document.createElement('div'); + this.dom.shadowBottomRight = document.createElement('div'); + + this.dom.background.className = 'vispanel background'; + this.dom.backgroundVertical.className = 'vispanel background vertical'; + this.dom.backgroundHorizontal.className = 'vispanel background horizontal'; + this.dom.centerContainer.className = 'vispanel center'; + this.dom.leftContainer.className = 'vispanel left'; + this.dom.rightContainer.className = 'vispanel right'; + this.dom.top.className = 'vispanel top'; + this.dom.bottom.className = 'vispanel bottom'; + this.dom.left.className = 'content'; + this.dom.center.className = 'content'; + this.dom.right.className = 'content'; + this.dom.shadowTop.className = 'shadow top'; + this.dom.shadowBottom.className = 'shadow bottom'; + this.dom.shadowTopLeft.className = 'shadow top'; + this.dom.shadowBottomLeft.className = 'shadow bottom'; + this.dom.shadowTopRight.className = 'shadow top'; + this.dom.shadowBottomRight.className = 'shadow bottom'; + + this.dom.root.appendChild(this.dom.background); + this.dom.root.appendChild(this.dom.backgroundVertical); + this.dom.root.appendChild(this.dom.backgroundHorizontal); + this.dom.root.appendChild(this.dom.centerContainer); + this.dom.root.appendChild(this.dom.leftContainer); + this.dom.root.appendChild(this.dom.rightContainer); + this.dom.root.appendChild(this.dom.top); + this.dom.root.appendChild(this.dom.bottom); + + this.dom.centerContainer.appendChild(this.dom.center); + this.dom.leftContainer.appendChild(this.dom.left); + this.dom.rightContainer.appendChild(this.dom.right); + + this.dom.centerContainer.appendChild(this.dom.shadowTop); + this.dom.centerContainer.appendChild(this.dom.shadowBottom); + this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); + this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); + this.dom.rightContainer.appendChild(this.dom.shadowTopRight); + this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); + + this.on('rangechange', this.redraw.bind(this)); + this.on('change', this.redraw.bind(this)); + this.on('touch', this._onTouch.bind(this)); + this.on('pinch', this._onPinch.bind(this)); + this.on('dragstart', this._onDragStart.bind(this)); + this.on('drag', this._onDrag.bind(this)); + + // create event listeners for all interesting events, these events will be + // emitted via emitter + this.hammer = Hammer(this.dom.root, { + prevent_default: true + }); + this.listeners = {}; + + var me = this; + var events = [ + 'touch', 'pinch', + 'tap', 'doubletap', 'hold', + 'dragstart', 'drag', 'dragend', + 'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox + ]; + events.forEach(function (event) { + var listener = function () { + var args = [event].concat(Array.prototype.slice.call(arguments, 0)); + me.emit.apply(me, args); + }; + me.hammer.on(event, listener); + me.listeners[event] = listener; + }); + + // size properties of each of the panels + this.props = { + root: {}, + background: {}, + centerContainer: {}, + leftContainer: {}, + rightContainer: {}, + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + border: {}, + scrollTop: 0, + scrollTopMin: 0 + }; + this.touch = {}; // store state information needed for touch events + + // attach the root panel to the provided container + if (!container) throw new Error('No container provided'); + container.appendChild(this.dom.root); + }; + + /** + * Destroy the Timeline, clean up all DOM elements and event listeners. + */ + Timeline.prototype.destroy = function () { + // unbind datasets + this.clear(); + + // remove all event listeners + this.off(); + + // stop checking for changed size + this._stopAutoResize(); + + // remove from DOM + if (this.dom.root.parentNode) { + this.dom.root.parentNode.removeChild(this.dom.root); + } + this.dom = null; + + // cleanup hammer touch events + for (var event in this.listeners) { + if (this.listeners.hasOwnProperty(event)) { + delete this.listeners[event]; + } + } + this.listeners = null; + this.hammer = null; + + // give all components the opportunity to cleanup + this.components.forEach(function (component) { + component.destroy(); + }); + + this.body = null; + }; + + /** + * Set options. Options will be passed to all components loaded in the Timeline. + * @param {Object} [options] + * {String} orientation + * Vertical orientation for the Timeline, + * can be 'bottom' (default) or 'top'. + * {String | Number} width + * Width for the timeline, a number in pixels or + * a css string like '1000px' or '75%'. '100%' by default. + * {String | Number} height + * Fixed height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. If undefined, + * The Timeline will automatically size such that + * its contents fit. + * {String | Number} minHeight + * Minimum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {String | Number} maxHeight + * Maximum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {Number | Date | String} start + * Start date for the visible window + * {Number | Date | String} end + * End date for the visible window + */ + Timeline.prototype.setOptions = function (options) { + if (options) { + // copy the known options + var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation']; + util.selectiveExtend(fields, this.options, options); + + // enable/disable autoResize + this._initAutoResize(); + } + + // propagate options to all components + this.components.forEach(function (component) { + component.setOptions(options); + }); + + // TODO: remove deprecation error one day (deprecated since version 0.8.0) + if (options && options.order) { + throw new Error('Option order is deprecated. There is no replacement for this feature.'); + } + + // redraw everything + this.redraw(); + }; + + /** + * Set a custom time bar + * @param {Date} time + */ + Timeline.prototype.setCustomTime = function (time) { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); + } + + this.customTime.setCustomTime(time); + }; + + /** + * Retrieve the current custom time. + * @return {Date} customTime + */ + Timeline.prototype.getCustomTime = function() { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); + } + + return this.customTime.getCustomTime(); + }; + + /** + * Set items + * @param {vis.DataSet | Array | google.visualization.DataTable | null} items + */ + Timeline.prototype.setItems = function(items) { + var initialLoad = (this.itemsData == null); + + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; + } + else if (items instanceof DataSet || items instanceof DataView) { + newDataSet = items; + } + else { + // turn an array into a dataset + newDataSet = new DataSet(items, { + type: { + start: 'Date', + end: 'Date' + } + }); + } + + // set items + this.itemsData = newDataSet; + this.itemSet && this.itemSet.setItems(newDataSet); + + if (initialLoad && ('start' in this.options || 'end' in this.options)) { + this.fit(); + + var start = ('start' in this.options) ? util.convert(this.options.start, 'Date') : null; + var end = ('end' in this.options) ? util.convert(this.options.end, 'Date') : null; + + this.setWindow(start, end); + } + }; + + /** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ + Timeline.prototype.getVisibleItems = function() { + return this.itemSet && this.itemSet.getVisibleItems() || []; + }; + + + /** + * Set groups + * @param {vis.DataSet | Array | google.visualization.DataTable} groups + */ + Timeline.prototype.setGroups = function(groups) { + // convert to type DataSet when needed + var newDataSet; + if (!groups) { + newDataSet = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + newDataSet = groups; + } + else { + // turn an array into a dataset + newDataSet = new DataSet(groups); + } + + this.groupsData = newDataSet; + this.itemSet.setGroups(newDataSet); + }; + + /** + * Clear the Timeline. By Default, items, groups and options are cleared. + * Example usage: + * + * timeline.clear(); // clear items, groups, and options + * timeline.clear({options: true}); // clear options only + * + * @param {Object} [what] Optionally specify what to clear. By default: + * {items: true, groups: true, options: true} + */ + Timeline.prototype.clear = function(what) { + // clear items + if (!what || what.items) { + this.setItems(null); + } + + // clear groups + if (!what || what.groups) { + this.setGroups(null); + } + + // clear options of timeline and of each of the components + if (!what || what.options) { + this.components.forEach(function (component) { + component.setOptions(component.defaultOptions); + }); + + this.setOptions(this.defaultOptions); // this will also do a redraw + } + }; + + /** + * Set Timeline window such that it fits all items + */ + Timeline.prototype.fit = function() { + // apply the data range as range + var dataRange = this.getItemRange(); + + // add 5% space on both sides + var start = dataRange.min; + var end = dataRange.max; + if (start != null && end != null) { + var interval = (end.valueOf() - start.valueOf()); + if (interval <= 0) { + // prevent an empty interval + interval = 24 * 60 * 60 * 1000; // 1 day + } + start = new Date(start.valueOf() - interval * 0.05); + end = new Date(end.valueOf() + interval * 0.05); + } + + // skip range set if there is no start and end date + if (start === null && end === null) { + return; + } + + this.range.setRange(start, end); + }; + + /** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ + Timeline.prototype.getItemRange = function() { + // calculate min from start filed + var dataset = this.itemsData.getDataSet(), + min = null, + max = null; + + if (dataset) { + // calculate the minimum value of the field 'start' + var minItem = dataset.min('start'); + min = minItem ? util.convert(minItem.start, 'Date').valueOf() : null; + // Note: we convert first to Date and then to number because else + // a conversion from ISODate to Number will fail + + // calculate maximum value of fields 'start' and 'end' + var maxStartItem = dataset.max('start'); + if (maxStartItem) { + max = util.convert(maxStartItem.start, 'Date').valueOf(); + } + var maxEndItem = dataset.max('end'); + if (maxEndItem) { + if (max == null) { + max = util.convert(maxEndItem.end, 'Date').valueOf(); + } + else { + max = Math.max(max, util.convert(maxEndItem.end, 'Date').valueOf()); + } + } + } + + return { + min: (min != null) ? new Date(min) : null, + max: (max != null) ? new Date(max) : null + }; + }; + + /** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {Array} [ids] An array with zero or more id's of the items to be + * selected. If ids is an empty array, all items will be + * unselected. + */ + Timeline.prototype.setSelection = function(ids) { + this.itemSet && this.itemSet.setSelection(ids); + }; + + /** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ + Timeline.prototype.getSelection = function() { + return this.itemSet && this.itemSet.getSelection() || []; + }; + + /** + * Set the visible window. Both parameters are optional, you can change only + * start or only end. Syntax: + * + * TimeLine.setWindow(start, end) + * TimeLine.setWindow(range) + * + * Where start and end can be a Date, number, or string, and range is an + * object with properties start and end. + * + * @param {Date | Number | String | Object} [start] Start date of visible window + * @param {Date | Number | String} [end] End date of visible window + */ + Timeline.prototype.setWindow = function(start, end) { + if (arguments.length == 1) { + var range = arguments[0]; + this.range.setRange(range.start, range.end); + } + else { + this.range.setRange(start, end); + } + }; + + /** + * Get the visible window + * @return {{start: Date, end: Date}} Visible range + */ + Timeline.prototype.getWindow = function() { + var range = this.range.getRange(); + return { + start: new Date(range.start), + end: new Date(range.end) + }; + }; + + /** + * Force a redraw of the Timeline. Can be useful to manually redraw when + * option autoResize=false + */ + Timeline.prototype.redraw = function() { + var resized = false, + options = this.options, + props = this.props, + dom = this.dom; + + if (!dom) return; // when destroyed + + // update class names + dom.root.className = 'vis timeline root ' + options.orientation; + + // update root width and height options + dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); + dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); + dom.root.style.width = util.option.asSize(options.width, ''); + + // calculate border widths + props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; + props.border.right = props.border.left; + props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; + props.border.bottom = props.border.top; + var borderRootHeight= dom.root.offsetHeight - dom.root.clientHeight; + var borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; + + // calculate the heights. If any of the side panels is empty, we set the height to + // minus the border width, such that the border will be invisible + props.center.height = dom.center.offsetHeight; + props.left.height = dom.left.offsetHeight; + props.right.height = dom.right.offsetHeight; + props.top.height = dom.top.clientHeight || -props.border.top; + props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; + + // TODO: compensate borders when any of the panels is empty. + + // apply auto height + // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) + var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); + var autoHeight = props.top.height + contentHeight + props.bottom.height + + borderRootHeight + props.border.top + props.border.bottom; + dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); + + // calculate heights of the content panels + props.root.height = dom.root.offsetHeight; + props.background.height = props.root.height - borderRootHeight; + var containerHeight = props.root.height - props.top.height - props.bottom.height - + borderRootHeight; + props.centerContainer.height = containerHeight; + props.leftContainer.height = containerHeight; + props.rightContainer.height = props.leftContainer.height; + + // calculate the widths of the panels + props.root.width = dom.root.offsetWidth; + props.background.width = props.root.width - borderRootWidth; + props.left.width = dom.leftContainer.clientWidth || -props.border.left; + props.leftContainer.width = props.left.width; + props.right.width = dom.rightContainer.clientWidth || -props.border.right; + props.rightContainer.width = props.right.width; + var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; + props.center.width = centerWidth; + props.centerContainer.width = centerWidth; + props.top.width = centerWidth; + props.bottom.width = centerWidth; + + // resize the panels + dom.background.style.height = props.background.height + 'px'; + dom.backgroundVertical.style.height = props.background.height + 'px'; + dom.backgroundHorizontal.style.height = props.centerContainer.height + 'px'; + dom.centerContainer.style.height = props.centerContainer.height + 'px'; + dom.leftContainer.style.height = props.leftContainer.height + 'px'; + dom.rightContainer.style.height = props.rightContainer.height + 'px'; + + dom.background.style.width = props.background.width + 'px'; + dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; + dom.backgroundHorizontal.style.width = props.background.width + 'px'; + dom.centerContainer.style.width = props.center.width + 'px'; + dom.top.style.width = props.top.width + 'px'; + dom.bottom.style.width = props.bottom.width + 'px'; + + // reposition the panels + dom.background.style.left = '0'; + dom.background.style.top = '0'; + dom.backgroundVertical.style.left = props.left.width + 'px'; + dom.backgroundVertical.style.top = '0'; + dom.backgroundHorizontal.style.left = '0'; + dom.backgroundHorizontal.style.top = props.top.height + 'px'; + dom.centerContainer.style.left = props.left.width + 'px'; + dom.centerContainer.style.top = props.top.height + 'px'; + dom.leftContainer.style.left = '0'; + dom.leftContainer.style.top = props.top.height + 'px'; + dom.rightContainer.style.left = (props.left.width + props.center.width) + 'px'; + dom.rightContainer.style.top = props.top.height + 'px'; + dom.top.style.left = props.left.width + 'px'; + dom.top.style.top = '0'; + dom.bottom.style.left = props.left.width + 'px'; + dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px'; + + // update the scrollTop, feasible range for the offset can be changed + // when the height of the Timeline or of the contents of the center changed + this._updateScrollTop(); + + // reposition the scrollable contents + var offset = this.props.scrollTop; + if (options.orientation == 'bottom') { + offset += Math.max(this.props.centerContainer.height - this.props.center.height - + this.props.border.top - this.props.border.bottom, 0); + } + dom.center.style.left = '0'; + dom.center.style.top = offset + 'px'; + dom.left.style.left = '0'; + dom.left.style.top = offset + 'px'; + dom.right.style.left = '0'; + dom.right.style.top = offset + 'px'; + + // show shadows when vertical scrolling is available + var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; + var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; + dom.shadowTop.style.visibility = visibilityTop; + dom.shadowBottom.style.visibility = visibilityBottom; + dom.shadowTopLeft.style.visibility = visibilityTop; + dom.shadowBottomLeft.style.visibility = visibilityBottom; + dom.shadowTopRight.style.visibility = visibilityTop; + dom.shadowBottomRight.style.visibility = visibilityBottom; + + // redraw all components + this.components.forEach(function (component) { + resized = component.redraw() || resized; + }); + if (resized) { + // keep repainting until all sizes are settled + this.redraw(); + } + }; + + // TODO: deprecated since version 1.1.0, remove some day + Timeline.prototype.repaint = function () { + throw new Error('Function repaint is deprecated. Use redraw instead.'); + }; + + /** + * Convert a position on screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toTime = function(x) { + var conversion = this.range.conversion(this.props.center.width); + return new Date(x / conversion.scale + conversion.offset); + }; + + + /** + * Convert a position on the global screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toGlobalTime = function(x) { + var conversion = this.range.conversion(this.props.root.width); + return new Date(x / conversion.scale + conversion.offset); + }; + + /** + * Convert a datetime (Date object) into a position on the screen + * @param {Date} time A date + * @return {int} x The position on the screen in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toScreen = function(time) { + var conversion = this.range.conversion(this.props.center.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; + + + /** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toGlobalScreen = function(time) { + var conversion = this.range.conversion(this.props.root.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; + + + /** + * Initialize watching when option autoResize is true + * @private + */ + Timeline.prototype._initAutoResize = function () { + if (this.options.autoResize == true) { + this._startAutoResize(); + } + else { + this._stopAutoResize(); + } + }; + + /** + * Watch for changes in the size of the container. On resize, the Panel will + * automatically redraw itself. + * @private + */ + Timeline.prototype._startAutoResize = function () { + var me = this; + + this._stopAutoResize(); + + this._onResize = function() { + if (me.options.autoResize != true) { + // stop watching when the option autoResize is changed to false + me._stopAutoResize(); + return; + } + + if (me.dom.root) { + // check whether the frame is resized + if ((me.dom.root.clientWidth != me.props.lastWidth) || + (me.dom.root.clientHeight != me.props.lastHeight)) { + me.props.lastWidth = me.dom.root.clientWidth; + me.props.lastHeight = me.dom.root.clientHeight; + + me.emit('change'); + } + } + }; + + // add event listener to window resize + util.addEventListener(window, 'resize', this._onResize); + + this.watchTimer = setInterval(this._onResize, 1000); + }; + + /** + * Stop watching for a resize of the frame. + * @private + */ + Timeline.prototype._stopAutoResize = function () { + if (this.watchTimer) { + clearInterval(this.watchTimer); + this.watchTimer = undefined; + } + + // remove event listener on window.resize + util.removeEventListener(window, 'resize', this._onResize); + this._onResize = null; + }; + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onTouch = function (event) { + this.touch.allowDragging = true; + }; + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onPinch = function (event) { + this.touch.allowDragging = false; + }; + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onDragStart = function (event) { + this.touch.initialScrollTop = this.props.scrollTop; + }; + + /** + * Move the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onDrag = function (event) { + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.touch.allowDragging) return; + + var delta = event.gesture.deltaY; + + var oldScrollTop = this._getScrollTop(); + var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); + + if (newScrollTop != oldScrollTop) { + this.redraw(); // TODO: this causes two redraws when dragging, the other is triggered by rangechange already + } + }; + + /** + * Apply a scrollTop + * @param {Number} scrollTop + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Timeline.prototype._setScrollTop = function (scrollTop) { + this.props.scrollTop = scrollTop; + this._updateScrollTop(); + return this.props.scrollTop; + }; + + /** + * Update the current scrollTop when the height of the containers has been changed + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Timeline.prototype._updateScrollTop = function () { + // recalculate the scrollTopMin + var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero + if (scrollTopMin != this.props.scrollTopMin) { + // in case of bottom orientation, change the scrollTop such that the contents + // do not move relative to the time axis at the bottom + if (this.options.orientation == 'bottom') { + this.props.scrollTop += (scrollTopMin - this.props.scrollTopMin); + } + this.props.scrollTopMin = scrollTopMin; + } + + // limit the scrollTop to the feasible scroll range + if (this.props.scrollTop > 0) this.props.scrollTop = 0; + if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; + + return this.props.scrollTop; + }; + + /** + * Get the current scrollTop + * @returns {number} scrollTop + * @private + */ + Timeline.prototype._getScrollTop = function () { + return this.props.scrollTop; + }; + + module.exports = Timeline; + + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + // Only load hammer.js when in a browser environment + // (loading hammer.js in a node.js environment gives errors) + if (typeof window !== 'undefined') { + module.exports = window['Hammer'] || __webpack_require__(17); + } + else { + module.exports = function () { + throw Error('hammer.js is only available in a browser, not in node.js.'); + } + } + + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_17__; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var hammerUtil = __webpack_require__(19); + var moment = __webpack_require__(2); + var Component = __webpack_require__(20); + + /** + * @constructor Range + * A Range controls a numeric range with a start and end value. + * The Range adjusts the range based on mouse events or programmatic changes, + * and triggers events when the range is changing or has been changed. + * @param {{dom: Object, domProps: Object, emitter: Emitter}} body + * @param {Object} [options] See description at Range.setOptions + */ + function Range(body, options) { + var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0); + this.start = now.clone().add('days', -3).valueOf(); // Number + this.end = now.clone().add('days', 4).valueOf(); // Number + + this.body = body; + + // default options + this.defaultOptions = { + start: null, + end: null, + direction: 'horizontal', // 'horizontal' or 'vertical' + moveable: true, + zoomable: true, + min: null, + max: null, + zoomMin: 10, // milliseconds + zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000 // milliseconds + }; + this.options = util.extend({}, this.defaultOptions); + + this.props = { + touch: {} + }; + + // drag listeners for dragging + this.body.emitter.on('dragstart', this._onDragStart.bind(this)); + this.body.emitter.on('drag', this._onDrag.bind(this)); + this.body.emitter.on('dragend', this._onDragEnd.bind(this)); + + // ignore dragging when holding + this.body.emitter.on('hold', this._onHold.bind(this)); + + // mouse wheel for zooming + this.body.emitter.on('mousewheel', this._onMouseWheel.bind(this)); + this.body.emitter.on('DOMMouseScroll', this._onMouseWheel.bind(this)); // For FF + + // pinch to zoom + this.body.emitter.on('touch', this._onTouch.bind(this)); + this.body.emitter.on('pinch', this._onPinch.bind(this)); + + this.setOptions(options); + } + + Range.prototype = new Component(); + + /** + * Set options for the range controller + * @param {Object} options Available options: + * {Number | Date | String} start Start date for the range + * {Number | Date | String} end End date for the range + * {Number} min Minimum value for start + * {Number} max Maximum value for end + * {Number} zoomMin Set a minimum value for + * (end - start). + * {Number} zoomMax Set a maximum value for + * (end - start). + * {Boolean} moveable Enable moving of the range + * by dragging. True by default + * {Boolean} zoomable Enable zooming of the range + * by pinching/scrolling. True by default + */ + Range.prototype.setOptions = function (options) { + if (options) { + // copy the options that we know + var fields = ['direction', 'min', 'max', 'zoomMin', 'zoomMax', 'moveable', 'zoomable']; + util.selectiveExtend(fields, this.options, options); + + if ('start' in options || 'end' in options) { + // apply a new range. both start and end are optional + this.setRange(options.start, options.end); + } + } + }; + + /** + * Test whether direction has a valid value + * @param {String} direction 'horizontal' or 'vertical' + */ + function validateDirection (direction) { + if (direction != 'horizontal' && direction != 'vertical') { + throw new TypeError('Unknown direction "' + direction + '". ' + + 'Choose "horizontal" or "vertical".'); + } + } + + /** + * Set a new start and end range + * @param {Number} [start] + * @param {Number} [end] + */ + Range.prototype.setRange = function(start, end) { + var changed = this._applyRange(start, end); + if (changed) { + var params = { + start: new Date(this.start), + end: new Date(this.end) + }; + this.body.emitter.emit('rangechange', params); + this.body.emitter.emit('rangechanged', params); + } + }; + + /** + * Set a new start and end range. This method is the same as setRange, but + * does not trigger a range change and range changed event, and it returns + * true when the range is changed + * @param {Number} [start] + * @param {Number} [end] + * @return {Boolean} changed + * @private + */ + Range.prototype._applyRange = function(start, end) { + var newStart = (start != null) ? util.convert(start, 'Date').valueOf() : this.start, + newEnd = (end != null) ? util.convert(end, 'Date').valueOf() : this.end, + max = (this.options.max != null) ? util.convert(this.options.max, 'Date').valueOf() : null, + min = (this.options.min != null) ? util.convert(this.options.min, 'Date').valueOf() : null, + diff; + + // check for valid number + if (isNaN(newStart) || newStart === null) { + throw new Error('Invalid start "' + start + '"'); + } + if (isNaN(newEnd) || newEnd === null) { + throw new Error('Invalid end "' + end + '"'); + } + + // prevent start < end + if (newEnd < newStart) { + newEnd = newStart; + } + + // prevent start < min + if (min !== null) { + if (newStart < min) { + diff = (min - newStart); + newStart += diff; + newEnd += diff; + + // prevent end > max + if (max != null) { + if (newEnd > max) { + newEnd = max; + } + } + } + } + + // prevent end > max + if (max !== null) { + if (newEnd > max) { + diff = (newEnd - max); + newStart -= diff; + newEnd -= diff; + + // prevent start < min + if (min != null) { + if (newStart < min) { + newStart = min; + } + } + } + } + + // prevent (end-start) < zoomMin + if (this.options.zoomMin !== null) { + var zoomMin = parseFloat(this.options.zoomMin); + if (zoomMin < 0) { + zoomMin = 0; + } + if ((newEnd - newStart) < zoomMin) { + if ((this.end - this.start) === zoomMin) { + // ignore this action, we are already zoomed to the minimum + newStart = this.start; + newEnd = this.end; + } + else { + // zoom to the minimum + diff = (zoomMin - (newEnd - newStart)); + newStart -= diff / 2; + newEnd += diff / 2; + } + } + } + + // prevent (end-start) > zoomMax + if (this.options.zoomMax !== null) { + var zoomMax = parseFloat(this.options.zoomMax); + if (zoomMax < 0) { + zoomMax = 0; + } + if ((newEnd - newStart) > zoomMax) { + if ((this.end - this.start) === zoomMax) { + // ignore this action, we are already zoomed to the maximum + newStart = this.start; + newEnd = this.end; + } + else { + // zoom to the maximum + diff = ((newEnd - newStart) - zoomMax); + newStart += diff / 2; + newEnd -= diff / 2; + } + } + } + + var changed = (this.start != newStart || this.end != newEnd); + + this.start = newStart; + this.end = newEnd; + + return changed; + }; + + /** + * Retrieve the current range. + * @return {Object} An object with start and end properties + */ + Range.prototype.getRange = function() { + return { + start: this.start, + end: this.end + }; + }; + + /** + * Calculate the conversion offset and scale for current range, based on + * the provided width + * @param {Number} width + * @returns {{offset: number, scale: number}} conversion + */ + Range.prototype.conversion = function (width) { + return Range.conversion(this.start, this.end, width); + }; + + /** + * Static method to calculate the conversion offset and scale for a range, + * based on the provided start, end, and width + * @param {Number} start + * @param {Number} end + * @param {Number} width + * @returns {{offset: number, scale: number}} conversion + */ + Range.conversion = function (start, end, width) { + if (width != 0 && (end - start != 0)) { + return { + offset: start, + scale: width / (end - start) + } + } + else { + return { + offset: 0, + scale: 1 + }; + } + }; + + /** + * Start dragging horizontally or vertically + * @param {Event} event + * @private + */ + Range.prototype._onDragStart = function(event) { + // only allow dragging when configured as movable + if (!this.options.moveable) return; + + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + + this.props.touch.start = this.start; + this.props.touch.end = this.end; + + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'move'; + } + }; + + /** + * Perform dragging operation + * @param {Event} event + * @private + */ + Range.prototype._onDrag = function (event) { + // only allow dragging when configured as movable + if (!this.options.moveable) return; + var direction = this.options.direction; + validateDirection(direction); + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + var delta = (direction == 'horizontal') ? event.gesture.deltaX : event.gesture.deltaY, + interval = (this.props.touch.end - this.props.touch.start), + width = (direction == 'horizontal') ? this.body.domProps.center.width : this.body.domProps.center.height, + diffRange = -delta / width * interval; + this._applyRange(this.props.touch.start + diffRange, this.props.touch.end + diffRange); + this.body.emitter.emit('rangechange', { + start: new Date(this.start), + end: new Date(this.end) + }); + }; + + /** + * Stop dragging operation + * @param {event} event + * @private + */ + Range.prototype._onDragEnd = function (event) { + // only allow dragging when configured as movable + if (!this.options.moveable) return; + + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'auto'; + } + + // fire a rangechanged event + this.body.emitter.emit('rangechanged', { + start: new Date(this.start), + end: new Date(this.end) + }); + }; + + /** + * Event handler for mouse wheel event, used to zoom + * Code from http://adomas.org/javascript-mouse-wheel/ + * @param {Event} event + * @private + */ + Range.prototype._onMouseWheel = function(event) { + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; + + // retrieve delta + var delta = 0; + if (event.wheelDelta) { /* IE/Opera. */ + delta = event.wheelDelta / 120; + } else if (event.detail) { /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail / 3; + } + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + // perform the zoom action. Delta is normally 1 or -1 + + // adjust a negative delta such that zooming in with delta 0.1 + // equals zooming out with a delta -0.1 + var scale; + if (delta < 0) { + scale = 1 - (delta / 5); + } + else { + scale = 1 / (1 + (delta / 5)) ; + } + + // calculate center, the date to zoom around + var gesture = hammerUtil.fakeGesture(this, event), + pointer = getPointer(gesture.center, this.body.dom.center), + pointerDate = this._pointerToDate(pointer); + + this.zoom(scale, pointerDate); + } + + // Prevent default actions caused by mouse wheel + // (else the page and timeline both zoom and scroll) + event.preventDefault(); + }; + + /** + * Start of a touch gesture + * @private + */ + Range.prototype._onTouch = function (event) { + this.props.touch.start = this.start; + this.props.touch.end = this.end; + this.props.touch.allowDragging = true; + this.props.touch.center = null; + }; + + /** + * On start of a hold gesture + * @private + */ + Range.prototype._onHold = function () { + this.props.touch.allowDragging = false; + }; + + /** + * Handle pinch event + * @param {Event} event + * @private + */ + Range.prototype._onPinch = function (event) { + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; + + this.props.touch.allowDragging = false; + + if (event.gesture.touches.length > 1) { + if (!this.props.touch.center) { + this.props.touch.center = getPointer(event.gesture.center, this.body.dom.center); + } + + var scale = 1 / event.gesture.scale, + initDate = this._pointerToDate(this.props.touch.center); + + // calculate new start and end + var newStart = parseInt(initDate + (this.props.touch.start - initDate) * scale); + var newEnd = parseInt(initDate + (this.props.touch.end - initDate) * scale); + + // apply new range + this.setRange(newStart, newEnd); + } + }; + + /** + * Helper function to calculate the center date for zooming + * @param {{x: Number, y: Number}} pointer + * @return {number} date + * @private + */ + Range.prototype._pointerToDate = function (pointer) { + var conversion; + var direction = this.options.direction; + + validateDirection(direction); + + if (direction == 'horizontal') { + var width = this.body.domProps.center.width; + conversion = this.conversion(width); + return pointer.x / conversion.scale + conversion.offset; + } + else { + var height = this.body.domProps.center.height; + conversion = this.conversion(height); + return pointer.y / conversion.scale + conversion.offset; + } + }; + + /** + * Get the pointer location relative to the location of the dom element + * @param {{pageX: Number, pageY: Number}} touch + * @param {Element} element HTML DOM element + * @return {{x: Number, y: Number}} pointer + * @private + */ + function getPointer (touch, element) { + return { + x: touch.pageX - util.getAbsoluteLeft(element), + y: touch.pageY - util.getAbsoluteTop(element) + }; + } + + /** + * Zoom the range the given scale in or out. Start and end date will + * be adjusted, and the timeline will be redrawn. You can optionally give a + * date around which to zoom. + * For example, try scale = 0.9 or 1.1 + * @param {Number} scale Scaling factor. Values above 1 will zoom out, + * values below 1 will zoom in. + * @param {Number} [center] Value representing a date around which will + * be zoomed. + */ + Range.prototype.zoom = function(scale, center) { + // if centerDate is not provided, take it half between start Date and end Date + if (center == null) { + center = (this.start + this.end) / 2; + } + + // calculate new start and end + var newStart = center + (this.start - center) * scale; + var newEnd = center + (this.end - center) * scale; + + this.setRange(newStart, newEnd); + }; + + /** + * Move the range with a given delta to the left or right. Start and end + * value will be adjusted. For example, try delta = 0.1 or -0.1 + * @param {Number} delta Moving amount. Positive value will move right, + * negative value will move left + */ + Range.prototype.move = function(delta) { + // zoom start Date and end Date relative to the centerDate + var diff = (this.end - this.start); + + // apply new values + var newStart = this.start + diff * delta; + var newEnd = this.end + diff * delta; + + // TODO: reckon with min and max range + + this.start = newStart; + this.end = newEnd; + }; + + /** + * Move the range to a new center point + * @param {Number} moveTo New center point of the range + */ + Range.prototype.moveTo = function(moveTo) { + var center = (this.start + this.end) / 2; + + var diff = center - moveTo; + + // calculate new start and end + var newStart = this.start - diff; + var newEnd = this.end - diff; + + this.setRange(newStart, newEnd); + }; + + module.exports = Range; + + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + var Hammer = __webpack_require__(16); + + /** + * Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent + * @param {Element} element + * @param {Event} event + */ + exports.fakeGesture = function(element, event) { + var eventType = null; + + // for hammer.js 1.0.5 + // var gesture = Hammer.event.collectEventData(this, eventType, event); + + // for hammer.js 1.0.6+ + var touches = Hammer.event.getTouchList(event, eventType); + var gesture = Hammer.event.collectEventData(this, eventType, touches, event); + + // on IE in standards mode, no touches are recognized by hammer.js, + // resulting in NaN values for center.pageX and center.pageY + if (isNaN(gesture.center.pageX)) { + gesture.center.pageX = event.pageX; + } + if (isNaN(gesture.center.pageY)) { + gesture.center.pageY = event.pageY; + } + + return gesture; + }; + + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Prototype for visual components + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body] + * @param {Object} [options] + */ + function Component (body, options) { + this.options = null; + this.props = null; + } + + /** + * Set options for the component. The new options will be merged into the + * current options. + * @param {Object} options + */ + Component.prototype.setOptions = function(options) { + if (options) { + util.extend(this.options, options); + } + }; + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + Component.prototype.redraw = function() { + // should be implemented by the component + return false; + }; + + /** + * Destroy the component. Cleanup DOM and event listeners + */ + Component.prototype.destroy = function() { + // should be implemented by the component + }; + + /** + * Test whether the component is resized since the last time _isResized() was + * called. + * @return {Boolean} Returns true if the component is resized + * @protected + */ + Component.prototype._isResized = function() { + var resized = (this.props._previousWidth !== this.props.width || + this.props._previousHeight !== this.props.height); + + this.props._previousWidth = this.props.width; + this.props._previousHeight = this.props.height; + + return resized; + }; + + module.exports = Component; + + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var Component = __webpack_require__(20); + var TimeStep = __webpack_require__(22); + + /** + * A horizontal time axis + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See TimeAxis.setOptions for the available + * options. + * @constructor TimeAxis + * @extends Component + */ + function TimeAxis (body, options) { + this.dom = { + foreground: null, + majorLines: [], + majorTexts: [], + minorLines: [], + minorTexts: [], + redundant: { + majorLines: [], + majorTexts: [], + minorLines: [], + minorTexts: [] + } + }; + this.props = { + range: { + start: 0, + end: 0, + minimumStep: 0 + }, + lineTop: 0 + }; + + this.defaultOptions = { + orientation: 'bottom', // supported: 'top', 'bottom' + // TODO: implement timeaxis orientations 'left' and 'right' + showMinorLabels: true, + showMajorLabels: true + }; + this.options = util.extend({}, this.defaultOptions); + + this.body = body; + + // create the HTML DOM + this._create(); + + this.setOptions(options); + } + + TimeAxis.prototype = new Component(); + + /** + * Set options for the TimeAxis. + * Parameters will be merged in current options. + * @param {Object} options Available options: + * {string} [orientation] + * {boolean} [showMinorLabels] + * {boolean} [showMajorLabels] + */ + TimeAxis.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['orientation', 'showMinorLabels', 'showMajorLabels'], this.options, options); + } + }; + + /** + * Create the HTML DOM for the TimeAxis + */ + TimeAxis.prototype._create = function() { + this.dom.foreground = document.createElement('div'); + this.dom.background = document.createElement('div'); + + this.dom.foreground.className = 'timeaxis foreground'; + this.dom.background.className = 'timeaxis background'; + }; + + /** + * Destroy the TimeAxis + */ + TimeAxis.prototype.destroy = function() { + // remove from DOM + if (this.dom.foreground.parentNode) { + this.dom.foreground.parentNode.removeChild(this.dom.foreground); + } + if (this.dom.background.parentNode) { + this.dom.background.parentNode.removeChild(this.dom.background); + } + + this.body = null; + }; + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + TimeAxis.prototype.redraw = function () { + var options = this.options, + props = this.props, + foreground = this.dom.foreground, + background = this.dom.background; + + // determine the correct parent DOM element (depending on option orientation) + var parent = (options.orientation == 'top') ? this.body.dom.top : this.body.dom.bottom; + var parentChanged = (foreground.parentNode !== parent); + + // calculate character width and height + this._calculateCharSize(); + + // TODO: recalculate sizes only needed when parent is resized or options is changed + var orientation = this.options.orientation, + showMinorLabels = this.options.showMinorLabels, + showMajorLabels = this.options.showMajorLabels; + + // determine the width and height of the elemens for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; + props.height = props.minorLabelHeight + props.majorLabelHeight; + props.width = foreground.offsetWidth; + + props.minorLineHeight = this.body.domProps.root.height - props.majorLabelHeight - + (options.orientation == 'top' ? this.body.domProps.bottom.height : this.body.domProps.top.height); + props.minorLineWidth = 1; // TODO: really calculate width + props.majorLineHeight = props.minorLineHeight + props.majorLabelHeight; + props.majorLineWidth = 1; // TODO: really calculate width + + // take foreground and background offline while updating (is almost twice as fast) + var foregroundNextSibling = foreground.nextSibling; + var backgroundNextSibling = background.nextSibling; + foreground.parentNode && foreground.parentNode.removeChild(foreground); + background.parentNode && background.parentNode.removeChild(background); + + foreground.style.height = this.props.height + 'px'; + + this._repaintLabels(); + + // put DOM online again (at the same place) + if (foregroundNextSibling) { + parent.insertBefore(foreground, foregroundNextSibling); + } + else { + parent.appendChild(foreground) + } + if (backgroundNextSibling) { + this.body.dom.backgroundVertical.insertBefore(background, backgroundNextSibling); + } + else { + this.body.dom.backgroundVertical.appendChild(background) + } + + return this._isResized() || parentChanged; + }; + + /** + * Repaint major and minor text labels and vertical grid lines + * @private + */ + TimeAxis.prototype._repaintLabels = function () { + var orientation = this.options.orientation; + + // calculate range and step (step such that we have space for 7 characters per label) + var start = util.convert(this.body.range.start, 'Number'), + end = util.convert(this.body.range.end, 'Number'), + minimumStep = this.body.util.toTime((this.props.minorCharWidth || 10) * 7).valueOf() + -this.body.util.toTime(0).valueOf(); + var step = new TimeStep(new Date(start), new Date(end), minimumStep); + this.step = step; + + // Move all DOM elements to a "redundant" list, where they + // can be picked for re-use, and clear the lists with lines and texts. + // At the end of the function _repaintLabels, left over elements will be cleaned up + var dom = this.dom; + dom.redundant.majorLines = dom.majorLines; + dom.redundant.majorTexts = dom.majorTexts; + dom.redundant.minorLines = dom.minorLines; + dom.redundant.minorTexts = dom.minorTexts; + dom.majorLines = []; + dom.majorTexts = []; + dom.minorLines = []; + dom.minorTexts = []; + + step.first(); + var xFirstMajorLabel = undefined; + var max = 0; + while (step.hasNext() && max < 1000) { + max++; + var cur = step.getCurrent(), + x = this.body.util.toScreen(cur), + isMajor = step.isMajor(); + + // TODO: lines must have a width, such that we can create css backgrounds + + if (this.options.showMinorLabels) { + this._repaintMinorText(x, step.getLabelMinor(), orientation); + } + + if (isMajor && this.options.showMajorLabels) { + if (x > 0) { + if (xFirstMajorLabel == undefined) { + xFirstMajorLabel = x; + } + this._repaintMajorText(x, step.getLabelMajor(), orientation); + } + this._repaintMajorLine(x, orientation); + } + else { + this._repaintMinorLine(x, orientation); + } + + step.next(); + } + + // create a major label on the left when needed + if (this.options.showMajorLabels) { + var leftTime = this.body.util.toTime(0), + leftText = step.getLabelMajor(leftTime), + widthText = leftText.length * (this.props.majorCharWidth || 10) + 10; // upper bound estimation + + if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) { + this._repaintMajorText(0, leftText, orientation); + } + } + + // Cleanup leftover DOM elements from the redundant list + util.forEach(this.dom.redundant, function (arr) { + while (arr.length) { + var elem = arr.pop(); + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + } + }); + }; + + /** + * Create a minor label for the axis at position x + * @param {Number} x + * @param {String} text + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMinorText = function (x, text, orientation) { + // reuse redundant label + var label = this.dom.redundant.minorTexts.shift(); + + if (!label) { + // create new label + var content = document.createTextNode(''); + label = document.createElement('div'); + label.appendChild(content); + label.className = 'text minor'; + this.dom.foreground.appendChild(label); + } + this.dom.minorTexts.push(label); + + label.childNodes[0].nodeValue = text; + + label.style.top = (orientation == 'top') ? (this.props.majorLabelHeight + 'px') : '0'; + label.style.left = x + 'px'; + //label.title = title; // TODO: this is a heavy operation + }; + + /** + * Create a Major label for the axis at position x + * @param {Number} x + * @param {String} text + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMajorText = function (x, text, orientation) { + // reuse redundant label + var label = this.dom.redundant.majorTexts.shift(); + + if (!label) { + // create label + var content = document.createTextNode(text); + label = document.createElement('div'); + label.className = 'text major'; + label.appendChild(content); + this.dom.foreground.appendChild(label); + } + this.dom.majorTexts.push(label); + + label.childNodes[0].nodeValue = text; + //label.title = title; // TODO: this is a heavy operation + + label.style.top = (orientation == 'top') ? '0' : (this.props.minorLabelHeight + 'px'); + label.style.left = x + 'px'; + }; + + /** + * Create a minor line for the axis at position x + * @param {Number} x + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMinorLine = function (x, orientation) { + // reuse redundant line + var line = this.dom.redundant.minorLines.shift(); + + if (!line) { + // create vertical line + line = document.createElement('div'); + line.className = 'grid vertical minor'; + this.dom.background.appendChild(line); + } + this.dom.minorLines.push(line); + + var props = this.props; + if (orientation == 'top') { + line.style.top = props.majorLabelHeight + 'px'; + } + else { + line.style.top = this.body.domProps.top.height + 'px'; + } + line.style.height = props.minorLineHeight + 'px'; + line.style.left = (x - props.minorLineWidth / 2) + 'px'; + }; + + /** + * Create a Major line for the axis at position x + * @param {Number} x + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMajorLine = function (x, orientation) { + // reuse redundant line + var line = this.dom.redundant.majorLines.shift(); + + if (!line) { + // create vertical line + line = document.createElement('DIV'); + line.className = 'grid vertical major'; + this.dom.background.appendChild(line); + } + this.dom.majorLines.push(line); + + var props = this.props; + if (orientation == 'top') { + line.style.top = '0'; + } + else { + line.style.top = this.body.domProps.top.height + 'px'; + } + line.style.left = (x - props.majorLineWidth / 2) + 'px'; + line.style.height = props.majorLineHeight + 'px'; + }; + + /** + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private + */ + TimeAxis.prototype._calculateCharSize = function () { + // Note: We calculate char size with every redraw. Size may change, for + // example when any of the timelines parents had display:none for example. + + // determine the char width and height on the minor axis + if (!this.dom.measureCharMinor) { + this.dom.measureCharMinor = document.createElement('DIV'); + this.dom.measureCharMinor.className = 'text minor measure'; + this.dom.measureCharMinor.style.position = 'absolute'; + + this.dom.measureCharMinor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMinor); + } + this.props.minorCharHeight = this.dom.measureCharMinor.clientHeight; + this.props.minorCharWidth = this.dom.measureCharMinor.clientWidth; + + // determine the char width and height on the major axis + if (!this.dom.measureCharMajor) { + this.dom.measureCharMajor = document.createElement('DIV'); + this.dom.measureCharMajor.className = 'text minor measure'; + this.dom.measureCharMajor.style.position = 'absolute'; + + this.dom.measureCharMajor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMajor); + } + this.props.majorCharHeight = this.dom.measureCharMajor.clientHeight; + this.props.majorCharWidth = this.dom.measureCharMajor.clientWidth; + }; + + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate + */ + TimeAxis.prototype.snap = function(date) { + return this.step.snap(date); + }; + + module.exports = TimeAxis; + + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + var moment = __webpack_require__(2); + + /** + * @constructor TimeStep + * The class TimeStep is an iterator for dates. You provide a start date and an + * end date. The class itself determines the best scale (step size) based on the + * provided start Date, end Date, and minimumStep. + * + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * + * Alternatively, you can set a scale by hand. + * After creation, you can initialize the class by executing first(). Then you + * can iterate from the start date to the end date via next(). You can check if + * the end date is reached with the function hasNext(). After each step, you can + * retrieve the current date via getCurrent(). + * The TimeStep has scales ranging from milliseconds, seconds, minutes, hours, + * days, to years. + * + * Version: 1.2 + * + * @param {Date} [start] The start date, for example new Date(2010, 9, 21) + * or new Date(2010, 9, 21, 23, 45, 00) + * @param {Date} [end] The end date + * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds + */ + function TimeStep(start, end, minimumStep) { + // variables + this.current = new Date(); + this._start = new Date(); + this._end = new Date(); + + this.autoScale = true; + this.scale = TimeStep.SCALE.DAY; + this.step = 1; + + // initialize the range + this.setRange(start, end, minimumStep); + } + + /// enum scale + TimeStep.SCALE = { + MILLISECOND: 1, + SECOND: 2, + MINUTE: 3, + HOUR: 4, + DAY: 5, + WEEKDAY: 6, + MONTH: 7, + YEAR: 8 + }; + + + /** + * Set a new range + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * @param {Date} [start] The start date and time. + * @param {Date} [end] The end date and time. + * @param {int} [minimumStep] Optional. Minimum step size in milliseconds + */ + TimeStep.prototype.setRange = function(start, end, minimumStep) { + if (!(start instanceof Date) || !(end instanceof Date)) { + throw "No legal start or end date in method setRange"; + } + + this._start = (start != undefined) ? new Date(start.valueOf()) : new Date(); + this._end = (end != undefined) ? new Date(end.valueOf()) : new Date(); + + if (this.autoScale) { + this.setMinimumStep(minimumStep); + } + }; + + /** + * Set the range iterator to the start date. + */ + TimeStep.prototype.first = function() { + this.current = new Date(this._start.valueOf()); + this.roundToMinor(); + }; + + /** + * Round the current date to the first minor date value + * This must be executed once when the current date is set to start Date + */ + TimeStep.prototype.roundToMinor = function() { + // round to floor + // IMPORTANT: we have no breaks in this switch! (this is no bug) + //noinspection FallthroughInSwitchStatementJS + switch (this.scale) { + case TimeStep.SCALE.YEAR: + this.current.setFullYear(this.step * Math.floor(this.current.getFullYear() / this.step)); + this.current.setMonth(0); + case TimeStep.SCALE.MONTH: this.current.setDate(1); + case TimeStep.SCALE.DAY: // intentional fall through + case TimeStep.SCALE.WEEKDAY: this.current.setHours(0); + case TimeStep.SCALE.HOUR: this.current.setMinutes(0); + case TimeStep.SCALE.MINUTE: this.current.setSeconds(0); + case TimeStep.SCALE.SECOND: this.current.setMilliseconds(0); + //case TimeStep.SCALE.MILLISECOND: // nothing to do for milliseconds + } + + if (this.step != 1) { + // round down to the first minor value that is a multiple of the current step size + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: this.current.setMilliseconds(this.current.getMilliseconds() - this.current.getMilliseconds() % this.step); break; + case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() - this.current.getSeconds() % this.step); break; + case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() - this.current.getMinutes() % this.step); break; + case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() - this.current.getHours() % this.step); break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: this.current.setDate((this.current.getDate()-1) - (this.current.getDate()-1) % this.step + 1); break; + case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() - this.current.getMonth() % this.step); break; + case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() - this.current.getFullYear() % this.step); break; + default: break; + } + } + }; + + /** + * Check if the there is a next step + * @return {boolean} true if the current date has not passed the end date + */ + TimeStep.prototype.hasNext = function () { + return (this.current.valueOf() <= this._end.valueOf()); + }; + + /** + * Do the next step + */ + TimeStep.prototype.next = function() { + var prev = this.current.valueOf(); + + // Two cases, needed to prevent issues with switching daylight savings + // (end of March and end of October) + if (this.current.getMonth() < 6) { + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: + + this.current = new Date(this.current.valueOf() + this.step); break; + case TimeStep.SCALE.SECOND: this.current = new Date(this.current.valueOf() + this.step * 1000); break; + case TimeStep.SCALE.MINUTE: this.current = new Date(this.current.valueOf() + this.step * 1000 * 60); break; + case TimeStep.SCALE.HOUR: + this.current = new Date(this.current.valueOf() + this.step * 1000 * 60 * 60); + // in case of skipping an hour for daylight savings, adjust the hour again (else you get: 0h 5h 9h ... instead of 0h 4h 8h ...) + var h = this.current.getHours(); + this.current.setHours(h - (h % this.step)); + break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break; + case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break; + case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break; + default: break; + } + } + else { + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: this.current = new Date(this.current.valueOf() + this.step); break; + case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() + this.step); break; + case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() + this.step); break; + case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() + this.step); break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break; + case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break; + case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break; + default: break; + } + } + + if (this.step != 1) { + // round down to the correct major value + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: if(this.current.getMilliseconds() < this.step) this.current.setMilliseconds(0); break; + case TimeStep.SCALE.SECOND: if(this.current.getSeconds() < this.step) this.current.setSeconds(0); break; + case TimeStep.SCALE.MINUTE: if(this.current.getMinutes() < this.step) this.current.setMinutes(0); break; + case TimeStep.SCALE.HOUR: if(this.current.getHours() < this.step) this.current.setHours(0); break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: if(this.current.getDate() < this.step+1) this.current.setDate(1); break; + case TimeStep.SCALE.MONTH: if(this.current.getMonth() < this.step) this.current.setMonth(0); break; + case TimeStep.SCALE.YEAR: break; // nothing to do for year + default: break; + } + } + + // safety mechanism: if current time is still unchanged, move to the end + if (this.current.valueOf() == prev) { + this.current = new Date(this._end.valueOf()); + } + }; + + + /** + * Get the current datetime + * @return {Date} current The current date + */ + TimeStep.prototype.getCurrent = function() { + return this.current; + }; + + /** + * Set a custom scale. Autoscaling will be disabled. + * For example setScale(SCALE.MINUTES, 5) will result + * in minor steps of 5 minutes, and major steps of an hour. + * + * @param {TimeStep.SCALE} newScale + * A scale. Choose from SCALE.MILLISECOND, + * SCALE.SECOND, SCALE.MINUTE, SCALE.HOUR, + * SCALE.WEEKDAY, SCALE.DAY, SCALE.MONTH, + * SCALE.YEAR. + * @param {Number} newStep A step size, by default 1. Choose for + * example 1, 2, 5, or 10. + */ + TimeStep.prototype.setScale = function(newScale, newStep) { + this.scale = newScale; + + if (newStep > 0) { + this.step = newStep; + } + + this.autoScale = false; + }; + + /** + * Enable or disable autoscaling + * @param {boolean} enable If true, autoascaling is set true + */ + TimeStep.prototype.setAutoScale = function (enable) { + this.autoScale = enable; + }; + + + /** + * Automatically determine the scale that bests fits the provided minimum step + * @param {Number} [minimumStep] The minimum step size in milliseconds + */ + TimeStep.prototype.setMinimumStep = function(minimumStep) { + if (minimumStep == undefined) { + return; + } + + var stepYear = (1000 * 60 * 60 * 24 * 30 * 12); + var stepMonth = (1000 * 60 * 60 * 24 * 30); + var stepDay = (1000 * 60 * 60 * 24); + var stepHour = (1000 * 60 * 60); + var stepMinute = (1000 * 60); + var stepSecond = (1000); + var stepMillisecond= (1); + + // find the smallest step that is larger than the provided minimumStep + if (stepYear*1000 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1000;} + if (stepYear*500 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 500;} + if (stepYear*100 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 100;} + if (stepYear*50 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 50;} + if (stepYear*10 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 10;} + if (stepYear*5 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 5;} + if (stepYear > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1;} + if (stepMonth*3 > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 3;} + if (stepMonth > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 1;} + if (stepDay*5 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 5;} + if (stepDay*2 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 2;} + if (stepDay > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 1;} + if (stepDay/2 > minimumStep) {this.scale = TimeStep.SCALE.WEEKDAY; this.step = 1;} + if (stepHour*4 > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 4;} + if (stepHour > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 1;} + if (stepMinute*15 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 15;} + if (stepMinute*10 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 10;} + if (stepMinute*5 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 5;} + if (stepMinute > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 1;} + if (stepSecond*15 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 15;} + if (stepSecond*10 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 10;} + if (stepSecond*5 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 5;} + if (stepSecond > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 1;} + if (stepMillisecond*200 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 200;} + if (stepMillisecond*100 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 100;} + if (stepMillisecond*50 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 50;} + if (stepMillisecond*10 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 10;} + if (stepMillisecond*5 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 5;} + if (stepMillisecond > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 1;} + }; + + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate + */ + TimeStep.prototype.snap = function(date) { + var clone = new Date(date.valueOf()); + + if (this.scale == TimeStep.SCALE.YEAR) { + var year = clone.getFullYear() + Math.round(clone.getMonth() / 12); + clone.setFullYear(Math.round(year / this.step) * this.step); + clone.setMonth(0); + clone.setDate(0); + clone.setHours(0); + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.MONTH) { + if (clone.getDate() > 15) { + clone.setDate(1); + clone.setMonth(clone.getMonth() + 1); + // important: first set Date to 1, after that change the month. + } + else { + clone.setDate(1); + } + + clone.setHours(0); + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.DAY) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 5: + case 2: + clone.setHours(Math.round(clone.getHours() / 24) * 24); break; + default: + clone.setHours(Math.round(clone.getHours() / 12) * 12); break; + } + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.WEEKDAY) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 5: + case 2: + clone.setHours(Math.round(clone.getHours() / 12) * 12); break; + default: + clone.setHours(Math.round(clone.getHours() / 6) * 6); break; + } + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.HOUR) { + switch (this.step) { + case 4: + clone.setMinutes(Math.round(clone.getMinutes() / 60) * 60); break; + default: + clone.setMinutes(Math.round(clone.getMinutes() / 30) * 30); break; + } + clone.setSeconds(0); + clone.setMilliseconds(0); + } else if (this.scale == TimeStep.SCALE.MINUTE) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 15: + case 10: + clone.setMinutes(Math.round(clone.getMinutes() / 5) * 5); + clone.setSeconds(0); + break; + case 5: + clone.setSeconds(Math.round(clone.getSeconds() / 60) * 60); break; + default: + clone.setSeconds(Math.round(clone.getSeconds() / 30) * 30); break; + } + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.SECOND) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 15: + case 10: + clone.setSeconds(Math.round(clone.getSeconds() / 5) * 5); + clone.setMilliseconds(0); + break; + case 5: + clone.setMilliseconds(Math.round(clone.getMilliseconds() / 1000) * 1000); break; + default: + clone.setMilliseconds(Math.round(clone.getMilliseconds() / 500) * 500); break; + } + } + else if (this.scale == TimeStep.SCALE.MILLISECOND) { + var step = this.step > 5 ? this.step / 2 : 1; + clone.setMilliseconds(Math.round(clone.getMilliseconds() / step) * step); + } + + return clone; + }; + + /** + * Check if the current value is a major value (for example when the step + * is DAY, a major value is each first day of the MONTH) + * @return {boolean} true if current date is major, else false. + */ + TimeStep.prototype.isMajor = function() { + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: + return (this.current.getMilliseconds() == 0); + case TimeStep.SCALE.SECOND: + return (this.current.getSeconds() == 0); + case TimeStep.SCALE.MINUTE: + return (this.current.getHours() == 0) && (this.current.getMinutes() == 0); + // Note: this is no bug. Major label is equal for both minute and hour scale + case TimeStep.SCALE.HOUR: + return (this.current.getHours() == 0); + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: + return (this.current.getDate() == 1); + case TimeStep.SCALE.MONTH: + return (this.current.getMonth() == 0); + case TimeStep.SCALE.YEAR: + return false; + default: + return false; + } + }; + + + /** + * Returns formatted text for the minor axislabel, depending on the current + * date and the scale. For example when scale is MINUTE, the current time is + * formatted as "hh:mm". + * @param {Date} [date] custom date. if not provided, current date is taken + */ + TimeStep.prototype.getLabelMinor = function(date) { + if (date == undefined) { + date = this.current; + } + + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: return moment(date).format('SSS'); + case TimeStep.SCALE.SECOND: return moment(date).format('s'); + case TimeStep.SCALE.MINUTE: return moment(date).format('HH:mm'); + case TimeStep.SCALE.HOUR: return moment(date).format('HH:mm'); + case TimeStep.SCALE.WEEKDAY: return moment(date).format('ddd D'); + case TimeStep.SCALE.DAY: return moment(date).format('D'); + case TimeStep.SCALE.MONTH: return moment(date).format('MMM'); + case TimeStep.SCALE.YEAR: return moment(date).format('YYYY'); + default: return ''; + } + }; + + + /** + * Returns formatted text for the major axis label, depending on the current + * date and the scale. For example when scale is MINUTE, the major scale is + * hours, and the hour will be formatted as "hh". + * @param {Date} [date] custom date. if not provided, current date is taken + */ + TimeStep.prototype.getLabelMajor = function(date) { + if (date == undefined) { + date = this.current; + } + + //noinspection FallthroughInSwitchStatementJS + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND:return moment(date).format('HH:mm:ss'); + case TimeStep.SCALE.SECOND: return moment(date).format('D MMMM HH:mm'); + case TimeStep.SCALE.MINUTE: + case TimeStep.SCALE.HOUR: return moment(date).format('ddd D MMMM'); + case TimeStep.SCALE.WEEKDAY: + case TimeStep.SCALE.DAY: return moment(date).format('MMMM YYYY'); + case TimeStep.SCALE.MONTH: return moment(date).format('YYYY'); + case TimeStep.SCALE.YEAR: return ''; + default: return ''; + } + }; + + module.exports = TimeStep; + + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var Component = __webpack_require__(20); + + /** + * A current time bar + * @param {{range: Range, dom: Object, domProps: Object}} body + * @param {Object} [options] Available parameters: + * {Boolean} [showCurrentTime] + * @constructor CurrentTime + * @extends Component + */ + function CurrentTime (body, options) { + this.body = body; + + // default options + this.defaultOptions = { + showCurrentTime: true + }; + this.options = util.extend({}, this.defaultOptions); + + this._create(); + + this.setOptions(options); + } + + CurrentTime.prototype = new Component(); + + /** + * Create the HTML DOM for the current time bar + * @private + */ + CurrentTime.prototype._create = function() { + var bar = document.createElement('div'); + bar.className = 'currenttime'; + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + + this.bar = bar; + }; + + /** + * Destroy the CurrentTime bar + */ + CurrentTime.prototype.destroy = function () { + this.options.showCurrentTime = false; + this.redraw(); // will remove the bar from the DOM and stop refreshing + + this.body = null; + }; + + /** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {boolean} [showCurrentTime] + */ + CurrentTime.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['showCurrentTime'], this.options, options); + } + }; + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + CurrentTime.prototype.redraw = function() { + if (this.options.showCurrentTime) { + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); + + this.start(); + } + + var now = new Date(); + var x = this.body.util.toScreen(now); + + this.bar.style.left = x + 'px'; + this.bar.title = 'Current time: ' + now; + } + else { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + this.stop(); + } + + return false; + }; + + /** + * Start auto refreshing the current time bar + */ + CurrentTime.prototype.start = function() { + var me = this; + + function update () { + me.stop(); + + // determine interval to refresh + var scale = me.body.range.conversion(me.body.domProps.center.width).scale; + var interval = 1 / scale / 10; + if (interval < 30) interval = 30; + if (interval > 1000) interval = 1000; + + me.redraw(); + + // start a timer to adjust for the new time + me.currentTimeTimer = setTimeout(update, interval); + } + + update(); + }; + + /** + * Stop auto refreshing the current time bar + */ + CurrentTime.prototype.stop = function() { + if (this.currentTimeTimer !== undefined) { + clearTimeout(this.currentTimeTimer); + delete this.currentTimeTimer; + } + }; + + module.exports = CurrentTime; + + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + var Hammer = __webpack_require__(16); + var util = __webpack_require__(1); + var Component = __webpack_require__(20); + + /** + * A custom time bar + * @param {{range: Range, dom: Object}} body + * @param {Object} [options] Available parameters: + * {Boolean} [showCustomTime] + * @constructor CustomTime + * @extends Component + */ + + function CustomTime (body, options) { + this.body = body; + + // default options + this.defaultOptions = { + showCustomTime: false + }; + this.options = util.extend({}, this.defaultOptions); + + this.customTime = new Date(); + this.eventParams = {}; // stores state parameters while dragging the bar + + // create the DOM + this._create(); + + this.setOptions(options); + } + + CustomTime.prototype = new Component(); + + /** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {boolean} [showCustomTime] + */ + CustomTime.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['showCustomTime'], this.options, options); + } + }; + + /** + * Create the DOM for the custom time + * @private + */ + CustomTime.prototype._create = function() { + var bar = document.createElement('div'); + bar.className = 'customtime'; + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + this.bar = bar; + + var drag = document.createElement('div'); + drag.style.position = 'relative'; + drag.style.top = '0px'; + drag.style.left = '-10px'; + drag.style.height = '100%'; + drag.style.width = '20px'; + bar.appendChild(drag); + + // attach event listeners + this.hammer = Hammer(bar, { + prevent_default: true + }); + this.hammer.on('dragstart', this._onDragStart.bind(this)); + this.hammer.on('drag', this._onDrag.bind(this)); + this.hammer.on('dragend', this._onDragEnd.bind(this)); + }; + + /** + * Destroy the CustomTime bar + */ + CustomTime.prototype.destroy = function () { + this.options.showCustomTime = false; + this.redraw(); // will remove the bar from the DOM + + this.hammer.enable(false); + this.hammer = null; + + this.body = null; + }; + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + CustomTime.prototype.redraw = function () { + if (this.options.showCustomTime) { + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); + } + + var x = this.body.util.toScreen(this.customTime); + + this.bar.style.left = x + 'px'; + this.bar.title = 'Time: ' + this.customTime; + } + else { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + } + + return false; + }; + + /** + * Set custom time. + * @param {Date} time + */ + CustomTime.prototype.setCustomTime = function(time) { + this.customTime = new Date(time.valueOf()); + this.redraw(); + }; + + /** + * Retrieve the current custom time. + * @return {Date} customTime + */ + CustomTime.prototype.getCustomTime = function() { + return new Date(this.customTime.valueOf()); + }; + + /** + * Start moving horizontally + * @param {Event} event + * @private + */ + CustomTime.prototype._onDragStart = function(event) { + this.eventParams.dragging = true; + this.eventParams.customTime = this.customTime; + + event.stopPropagation(); + event.preventDefault(); + }; + + /** + * Perform moving operating. + * @param {Event} event + * @private + */ + CustomTime.prototype._onDrag = function (event) { + if (!this.eventParams.dragging) return; + + var deltaX = event.gesture.deltaX, + x = this.body.util.toScreen(this.eventParams.customTime) + deltaX, + time = this.body.util.toTime(x); + + this.setCustomTime(time); + + // fire a timechange event + this.body.emitter.emit('timechange', { + time: new Date(this.customTime.valueOf()) + }); + + event.stopPropagation(); + event.preventDefault(); + }; + + /** + * Stop moving operating. + * @param {event} event + * @private + */ + CustomTime.prototype._onDragEnd = function (event) { + if (!this.eventParams.dragging) return; + + // fire a timechanged event + this.body.emitter.emit('timechanged', { + time: new Date(this.customTime.valueOf()) + }); + + event.stopPropagation(); + event.preventDefault(); + }; + + module.exports = CustomTime; + + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + var Hammer = __webpack_require__(16); + var util = __webpack_require__(1); + var DataSet = __webpack_require__(5); + var DataView = __webpack_require__(6); + var Component = __webpack_require__(20); + var Group = __webpack_require__(26); + var ItemBox = __webpack_require__(30); + var ItemPoint = __webpack_require__(31); + var ItemRange = __webpack_require__(28); + + + var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items + + /** + * An ItemSet holds a set of items and ranges which can be displayed in a + * range. The width is determined by the parent of the ItemSet, and the height + * is determined by the size of the items. + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See ItemSet.setOptions for the available options. + * @constructor ItemSet + * @extends Component + */ + function ItemSet(body, options) { + this.body = body; + + this.defaultOptions = { + type: null, // 'box', 'point', 'range' + orientation: 'bottom', // 'top' or 'bottom' + align: 'center', // alignment of box items + stack: true, + groupOrder: null, + + selectable: true, + editable: { + updateTime: false, + updateGroup: false, + add: false, + remove: false + }, + + onAdd: function (item, callback) { + callback(item); + }, + onUpdate: function (item, callback) { + callback(item); + }, + onMove: function (item, callback) { + callback(item); + }, + onRemove: function (item, callback) { + callback(item); + }, + + margin: { + item: { + horizontal: 10, + vertical: 10 + }, + axis: 20 + }, + padding: 5 + }; + + // options is shared by this ItemSet and all its items + this.options = util.extend({}, this.defaultOptions); + + // options for getting items from the DataSet with the correct type + this.itemOptions = { + type: {start: 'Date', end: 'Date'} + }; + + this.conversion = { + toScreen: body.util.toScreen, + toTime: body.util.toTime + }; + this.dom = {}; + this.props = {}; + this.hammer = null; + + var me = this; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet + + // listeners for the DataSet of the items + this.itemListeners = { + 'add': function (event, params, senderId) { + me._onAdd(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdate(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemove(params.items); + } + }; + + // listeners for the DataSet of the groups + this.groupListeners = { + 'add': function (event, params, senderId) { + me._onAddGroups(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdateGroups(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemoveGroups(params.items); + } + }; + + this.items = {}; // object with an Item for every data item + this.groups = {}; // Group object for every group + this.groupIds = []; + + this.selection = []; // list with the ids of all selected nodes + this.stackDirty = true; // if true, all items will be restacked on next redraw + + this.touchParams = {}; // stores properties while dragging + // create the HTML DOM + + this._create(); + + this.setOptions(options); + } + + ItemSet.prototype = new Component(); + + // available item types will be registered here + ItemSet.types = { + box: ItemBox, + range: ItemRange, + point: ItemPoint + }; + + /** + * Create the HTML DOM for the ItemSet + */ + ItemSet.prototype._create = function(){ + var frame = document.createElement('div'); + frame.className = 'itemset'; + frame['timeline-itemset'] = this; + this.dom.frame = frame; + + // create background panel + var background = document.createElement('div'); + background.className = 'background'; + frame.appendChild(background); + this.dom.background = background; + + // create foreground panel + var foreground = document.createElement('div'); + foreground.className = 'foreground'; + frame.appendChild(foreground); + this.dom.foreground = foreground; + + // create axis panel + var axis = document.createElement('div'); + axis.className = 'axis'; + this.dom.axis = axis; + + // create labelset + var labelSet = document.createElement('div'); + labelSet.className = 'labelset'; + this.dom.labelSet = labelSet; + + // create ungrouped Group + this._updateUngrouped(); + + // attach event listeners + // Note: we bind to the centerContainer for the case where the height + // of the center container is larger than of the ItemSet, so we + // can click in the empty area to create a new item or deselect an item. + this.hammer = Hammer(this.body.dom.centerContainer, { + prevent_default: true + }); + + // drag items when selected + this.hammer.on('touch', this._onTouch.bind(this)); + this.hammer.on('dragstart', this._onDragStart.bind(this)); + this.hammer.on('drag', this._onDrag.bind(this)); + this.hammer.on('dragend', this._onDragEnd.bind(this)); + + // single select (or unselect) when tapping an item + this.hammer.on('tap', this._onSelectItem.bind(this)); + + // multi select when holding mouse/touch, or on ctrl+click + this.hammer.on('hold', this._onMultiSelectItem.bind(this)); + + // add item on doubletap + this.hammer.on('doubletap', this._onAddItem.bind(this)); + + // attach to the DOM + this.show(); + }; + + /** + * Set options for the ItemSet. Existing options will be extended/overwritten. + * @param {Object} [options] The following options are available: + * {String} type + * Default type for the items. Choose from 'box' + * (default), 'point', or 'range'. The default + * Style can be overwritten by individual items. + * {String} align + * Alignment for the items, only applicable for + * ItemBox. Choose 'center' (default), 'left', or + * 'right'. + * {String} orientation + * Orientation of the item set. Choose 'top' or + * 'bottom' (default). + * {Function} groupOrder + * A sorting function for ordering groups + * {Boolean} stack + * If true (deafult), items will be stacked on + * top of each other. + * {Number} margin.axis + * Margin between the axis and the items in pixels. + * Default is 20. + * {Number} margin.item.horizontal + * Horizontal margin between items in pixels. + * Default is 10. + * {Number} margin.item.vertical + * Vertical Margin between items in pixels. + * Default is 10. + * {Number} margin.item + * Margin between items in pixels in both horizontal + * and vertical direction. Default is 10. + * {Number} margin + * Set margin for both axis and items in pixels. + * {Number} padding + * Padding of the contents of an item in pixels. + * Must correspond with the items css. Default is 5. + * {Boolean} selectable + * If true (default), items can be selected. + * {Boolean} editable + * Set all editable options to true or false + * {Boolean} editable.updateTime + * Allow dragging an item to an other moment in time + * {Boolean} editable.updateGroup + * Allow dragging an item to an other group + * {Boolean} editable.add + * Allow creating new items on double tap + * {Boolean} editable.remove + * Allow removing items by clicking the delete button + * top right of a selected item. + * {Function(item: Item, callback: Function)} onAdd + * Callback function triggered when an item is about to be added: + * when the user double taps an empty space in the Timeline. + * {Function(item: Item, callback: Function)} onUpdate + * Callback function fired when an item is about to be updated. + * This function typically has to show a dialog where the user + * change the item. If not implemented, nothing happens. + * {Function(item: Item, callback: Function)} onMove + * Fired when an item has been moved. If not implemented, + * the move action will be accepted. + * {Function(item: Item, callback: Function)} onRemove + * Fired when an item is about to be deleted. + * If not implemented, the item will be always removed. + */ + ItemSet.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + var fields = ['type', 'align', 'orientation', 'padding', 'stack', 'selectable', 'groupOrder']; + util.selectiveExtend(fields, this.options, options); + + if ('margin' in options) { + if (typeof options.margin === 'number') { + this.options.margin.axis = options.margin; + this.options.margin.item.horizontal = options.margin; + this.options.margin.item.vertical = options.margin; + } + else if (typeof options.margin === 'object') { + util.selectiveExtend(['axis'], this.options.margin, options.margin); + if ('item' in options.margin) { + if (typeof options.margin.item === 'number') { + this.options.margin.item.horizontal = options.margin.item; + this.options.margin.item.vertical = options.margin.item; + } + else if (typeof options.margin.item === 'object') { + util.selectiveExtend(['horizontal', 'vertical'], this.options.margin.item, options.margin.item); + } + } + } + } + + if ('editable' in options) { + if (typeof options.editable === 'boolean') { + this.options.editable.updateTime = options.editable; + this.options.editable.updateGroup = options.editable; + this.options.editable.add = options.editable; + this.options.editable.remove = options.editable; + } + else if (typeof options.editable === 'object') { + util.selectiveExtend(['updateTime', 'updateGroup', 'add', 'remove'], this.options.editable, options.editable); + } + } + + // callback functions + var addCallback = (function (name) { + if (name in options) { + var fn = options[name]; + if (!(fn instanceof Function)) { + throw new Error('option ' + name + ' must be a function ' + name + '(item, callback)'); + } + this.options[name] = fn; + } + }).bind(this); + ['onAdd', 'onUpdate', 'onRemove', 'onMove'].forEach(addCallback); + + // force the itemSet to refresh: options like orientation and margins may be changed + this.markDirty(); + } + }; + + /** + * Mark the ItemSet dirty so it will refresh everything with next redraw + */ + ItemSet.prototype.markDirty = function() { + this.groupIds = []; + this.stackDirty = true; + }; + + /** + * Destroy the ItemSet + */ + ItemSet.prototype.destroy = function() { + this.hide(); + this.setItems(null); + this.setGroups(null); + + this.hammer = null; + + this.body = null; + this.conversion = null; + }; + + /** + * Hide the component from the DOM + */ + ItemSet.prototype.hide = function() { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + + // remove the axis with dots + if (this.dom.axis.parentNode) { + this.dom.axis.parentNode.removeChild(this.dom.axis); + } + + // remove the labelset containing all group labels + if (this.dom.labelSet.parentNode) { + this.dom.labelSet.parentNode.removeChild(this.dom.labelSet); + } + }; + + /** + * Show the component in the DOM (when not already visible). + * @return {Boolean} changed + */ + ItemSet.prototype.show = function() { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + + // show axis with dots + if (!this.dom.axis.parentNode) { + this.body.dom.backgroundVertical.appendChild(this.dom.axis); + } + + // show labelset containing labels + if (!this.dom.labelSet.parentNode) { + this.body.dom.left.appendChild(this.dom.labelSet); + } + }; + + /** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {Array} [ids] An array with zero or more id's of the items to be + * selected. If ids is an empty array, all items will be + * unselected. + */ + ItemSet.prototype.setSelection = function(ids) { + var i, ii, id, item; + + if (ids) { + if (!Array.isArray(ids)) { + throw new TypeError('Array expected'); + } + + // unselect currently selected items + for (i = 0, ii = this.selection.length; i < ii; i++) { + id = this.selection[i]; + item = this.items[id]; + if (item) item.unselect(); + } + + // select items + this.selection = []; + for (i = 0, ii = ids.length; i < ii; i++) { + id = ids[i]; + item = this.items[id]; + if (item) { + this.selection.push(id); + item.select(); + } + } + } + }; + + /** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ + ItemSet.prototype.getSelection = function() { + return this.selection.concat([]); + }; + + /** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ + ItemSet.prototype.getVisibleItems = function() { + var range = this.body.range.getRange(); + var left = this.body.util.toScreen(range.start); + var right = this.body.util.toScreen(range.end); + + var ids = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + var rawVisibleItems = group.visibleItems; + + // filter the "raw" set with visibleItems into a set which is really + // visible by pixels + for (var i = 0; i < rawVisibleItems.length; i++) { + var item = rawVisibleItems[i]; + // TODO: also check whether visible vertically + if ((item.left < right) && (item.left + item.width > left)) { + ids.push(item.id); + } + } + } + } + + return ids; + }; + + /** + * Deselect a selected item + * @param {String | Number} id + * @private + */ + ItemSet.prototype._deselect = function(id) { + var selection = this.selection; + for (var i = 0, ii = selection.length; i < ii; i++) { + if (selection[i] == id) { // non-strict comparison! + selection.splice(i, 1); + break; + } + } + }; + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + ItemSet.prototype.redraw = function() { + var margin = this.options.margin, + range = this.body.range, + asSize = util.option.asSize, + options = this.options, + orientation = options.orientation, + resized = false, + frame = this.dom.frame, + editable = options.editable.updateTime || options.editable.updateGroup; + + // update class name + frame.className = 'itemset' + (editable ? ' editable' : ''); + + // reorder the groups (if needed) + resized = this._orderGroups() || resized; + + // check whether zoomed (in that case we need to re-stack everything) + // TODO: would be nicer to get this as a trigger from Range + var visibleInterval = range.end - range.start; + var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.props.width != this.props.lastWidth); + if (zoomed) this.stackDirty = true; + this.lastVisibleInterval = visibleInterval; + this.props.lastWidth = this.props.width; + + // redraw all groups + var restack = this.stackDirty, + firstGroup = this._firstGroup(), + firstMargin = { + item: margin.item, + axis: margin.axis + }, + nonFirstMargin = { + item: margin.item, + axis: margin.item.vertical / 2 + }, + height = 0, + minHeight = margin.axis + margin.item.vertical; + util.forEach(this.groups, function (group) { + var groupMargin = (group == firstGroup) ? firstMargin : nonFirstMargin; + var groupResized = group.redraw(range, groupMargin, restack); + resized = groupResized || resized; + height += group.height; + }); + height = Math.max(height, minHeight); + this.stackDirty = false; + + // update frame height + frame.style.height = asSize(height); + + // calculate actual size and position + this.props.top = frame.offsetTop; + this.props.left = frame.offsetLeft; + this.props.width = frame.offsetWidth; + this.props.height = height; + + // reposition axis + this.dom.axis.style.top = asSize((orientation == 'top') ? + (this.body.domProps.top.height + this.body.domProps.border.top) : + (this.body.domProps.top.height + this.body.domProps.centerContainer.height)); + this.dom.axis.style.left = this.body.domProps.border.left + 'px'; + + // check if this component is resized + resized = this._isResized() || resized; + + return resized; + }; + + /** + * Get the first group, aligned with the axis + * @return {Group | null} firstGroup + * @private + */ + ItemSet.prototype._firstGroup = function() { + var firstGroupIndex = (this.options.orientation == 'top') ? 0 : (this.groupIds.length - 1); + var firstGroupId = this.groupIds[firstGroupIndex]; + var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED]; + + return firstGroup || null; + }; + + /** + * Create or delete the group holding all ungrouped items. This group is used when + * there are no groups specified. + * @protected + */ + ItemSet.prototype._updateUngrouped = function() { + var ungrouped = this.groups[UNGROUPED]; + + if (this.groupsData) { + // remove the group holding all ungrouped items + if (ungrouped) { + ungrouped.hide(); + delete this.groups[UNGROUPED]; + } + } + else { + // create a group holding all (unfiltered) items + if (!ungrouped) { + var id = null; + var data = null; + ungrouped = new Group(id, data, this); + this.groups[UNGROUPED] = ungrouped; + + for (var itemId in this.items) { + if (this.items.hasOwnProperty(itemId)) { + ungrouped.add(this.items[itemId]); + } + } + + ungrouped.show(); + } + } + }; + + /** + * Get the element for the labelset + * @return {HTMLElement} labelSet + */ + ItemSet.prototype.getLabelSet = function() { + return this.dom.labelSet; + }; + + /** + * Set items + * @param {vis.DataSet | null} items + */ + ItemSet.prototype.setItems = function(items) { + var me = this, + ids, + oldItemsData = this.itemsData; + + // replace the dataset + if (!items) { + this.itemsData = null; + } + else if (items instanceof DataSet || items instanceof DataView) { + this.itemsData = items; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } + + if (oldItemsData) { + // unsubscribe from old dataset + util.forEach(this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); + + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } + + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); + + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); + + // update the group holding all ungrouped items + this._updateUngrouped(); + } + }; + + /** + * Get the current items + * @returns {vis.DataSet | null} + */ + ItemSet.prototype.getItems = function() { + return this.itemsData; + }; + + /** + * Set groups + * @param {vis.DataSet} groups + */ + ItemSet.prototype.setGroups = function(groups) { + var me = this, + ids; + + // unsubscribe from current dataset + if (this.groupsData) { + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.unsubscribe(event, callback); + }); + + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + this._onRemoveGroups(ids); // note: this will cause a redraw + } + + // replace the dataset + if (!groups) { + this.groupsData = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + this.groupsData = groups; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } + + if (this.groupsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); + + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); + } + + // update the group holding all ungrouped items + this._updateUngrouped(); + + // update the order of all items in each group + this._order(); + + this.body.emitter.emit('change'); + }; + + /** + * Get the current groups + * @returns {vis.DataSet | null} groups + */ + ItemSet.prototype.getGroups = function() { + return this.groupsData; + }; + + /** + * Remove an item by its id + * @param {String | Number} id + */ + ItemSet.prototype.removeItem = function(id) { + var item = this.itemsData.get(id), + dataset = this.itemsData.getDataSet(); + + if (item) { + // confirm deletion + this.options.onRemove(item, function (item) { + if (item) { + // remove by id here, it is possible that an item has no id defined + // itself, so better not delete by the item itself + dataset.remove(id); + } + }); + } + }; + + /** + * Handle updated items + * @param {Number[]} ids + * @protected + */ + ItemSet.prototype._onUpdate = function(ids) { + var me = this; + + ids.forEach(function (id) { + var itemData = me.itemsData.get(id, me.itemOptions), + item = me.items[id], + type = itemData.type || me.options.type || (itemData.end ? 'range' : 'box'); + + var constructor = ItemSet.types[type]; + + if (item) { + // update item + if (!constructor || !(item instanceof constructor)) { + // item type has changed, delete the item and recreate it + me._removeItem(item); + item = null; + } + else { + me._updateItem(item, itemData); + } + } + + if (!item) { + // create item + if (constructor) { + item = new constructor(itemData, me.conversion, me.options); + item.id = id; // TODO: not so nice setting id afterwards + me._addItem(item); + } + else if (type == 'rangeoverflow') { + // TODO: deprecated since version 2.1.0 (or 3.0.0?). cleanup some day + throw new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: ' + + '.vis.timeline .item.range .content {overflow: visible;}'); + } + else { + throw new TypeError('Unknown item type "' + type + '"'); + } + } + }); + + this._order(); + this.stackDirty = true; // force re-stacking of all items next redraw + this.body.emitter.emit('change'); + }; + + /** + * Handle added items + * @param {Number[]} ids + * @protected + */ + ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate; + + /** + * Handle removed items + * @param {Number[]} ids + * @protected + */ + ItemSet.prototype._onRemove = function(ids) { + var count = 0; + var me = this; + ids.forEach(function (id) { + var item = me.items[id]; + if (item) { + count++; + me._removeItem(item); + } + }); + + if (count) { + // update order + this._order(); + this.stackDirty = true; // force re-stacking of all items next redraw + this.body.emitter.emit('change'); + } + }; + + /** + * Update the order of item in all groups + * @private + */ + ItemSet.prototype._order = function() { + // reorder the items in all groups + // TODO: optimization: only reorder groups affected by the changed items + util.forEach(this.groups, function (group) { + group.order(); + }); + }; + + /** + * Handle updated groups + * @param {Number[]} ids + * @private + */ + ItemSet.prototype._onUpdateGroups = function(ids) { + this._onAddGroups(ids); + }; + + /** + * Handle changed groups + * @param {Number[]} ids + * @private + */ + ItemSet.prototype._onAddGroups = function(ids) { + var me = this; + + ids.forEach(function (id) { + var groupData = me.groupsData.get(id); + var group = me.groups[id]; + + if (!group) { + // check for reserved ids + if (id == UNGROUPED) { + throw new Error('Illegal group id. ' + id + ' is a reserved id.'); + } + + var groupOptions = Object.create(me.options); + util.extend(groupOptions, { + height: null + }); + + group = new Group(id, groupData, me); + me.groups[id] = group; + + // add items with this groupId to the new group + for (var itemId in me.items) { + if (me.items.hasOwnProperty(itemId)) { + var item = me.items[itemId]; + if (item.data.group == id) { + group.add(item); + } + } + } + + group.order(); + group.show(); + } + else { + // update group + group.setData(groupData); + } + }); + + this.body.emitter.emit('change'); + }; + + /** + * Handle removed groups + * @param {Number[]} ids + * @private + */ + ItemSet.prototype._onRemoveGroups = function(ids) { + var groups = this.groups; + ids.forEach(function (id) { + var group = groups[id]; + + if (group) { + group.hide(); + delete groups[id]; + } + }); + + this.markDirty(); + + this.body.emitter.emit('change'); + }; + + /** + * Reorder the groups if needed + * @return {boolean} changed + * @private + */ + ItemSet.prototype._orderGroups = function () { + if (this.groupsData) { + // reorder the groups + var groupIds = this.groupsData.getIds({ + order: this.options.groupOrder + }); + + var changed = !util.equalArray(groupIds, this.groupIds); + if (changed) { + // hide all groups, removes them from the DOM + var groups = this.groups; + groupIds.forEach(function (groupId) { + groups[groupId].hide(); + }); + + // show the groups again, attach them to the DOM in correct order + groupIds.forEach(function (groupId) { + groups[groupId].show(); + }); + + this.groupIds = groupIds; + } + + return changed; + } + else { + return false; + } + }; + + /** + * Add a new item + * @param {Item} item + * @private + */ + ItemSet.prototype._addItem = function(item) { + this.items[item.id] = item; + + // add to group + var groupId = this.groupsData ? item.data.group : UNGROUPED; + var group = this.groups[groupId]; + if (group) group.add(item); + }; + + /** + * Update an existing item + * @param {Item} item + * @param {Object} itemData + * @private + */ + ItemSet.prototype._updateItem = function(item, itemData) { + var oldGroupId = item.data.group; + + item.data = itemData; + if (item.displayed) { + item.redraw(); + } + + // update group + if (oldGroupId != item.data.group) { + var oldGroup = this.groups[oldGroupId]; + if (oldGroup) oldGroup.remove(item); + + var groupId = this.groupsData ? item.data.group : UNGROUPED; + var group = this.groups[groupId]; + if (group) group.add(item); + } + }; + + /** + * Delete an item from the ItemSet: remove it from the DOM, from the map + * with items, and from the map with visible items, and from the selection + * @param {Item} item + * @private + */ + ItemSet.prototype._removeItem = function(item) { + // remove from DOM + item.hide(); + + // remove from items + delete this.items[item.id]; + + // remove from selection + var index = this.selection.indexOf(item.id); + if (index != -1) this.selection.splice(index, 1); + + // remove from group + var groupId = this.groupsData ? item.data.group : UNGROUPED; + var group = this.groups[groupId]; + if (group) group.remove(item); + }; + + /** + * Create an array containing all items being a range (having an end date) + * @param array + * @returns {Array} + * @private + */ + ItemSet.prototype._constructByEndArray = function(array) { + var endArray = []; + + for (var i = 0; i < array.length; i++) { + if (array[i] instanceof ItemRange) { + endArray.push(array[i]); + } + } + return endArray; + }; + + /** + * Register the clicked item on touch, before dragStart is initiated. + * + * dragStart is initiated from a mousemove event, which can have left the item + * already resulting in an item == null + * + * @param {Event} event + * @private + */ + ItemSet.prototype._onTouch = function (event) { + // store the touched item, used in _onDragStart + this.touchParams.item = ItemSet.itemFromTarget(event); + }; + + /** + * Start dragging the selected events + * @param {Event} event + * @private + */ + ItemSet.prototype._onDragStart = function (event) { + if (!this.options.editable.updateTime && !this.options.editable.updateGroup) { + return; + } + + var item = this.touchParams.item || null, + me = this, + props; + + if (item && item.selected) { + var dragLeftItem = event.target.dragLeftItem; + var dragRightItem = event.target.dragRightItem; + + if (dragLeftItem) { + props = { + item: dragLeftItem + }; + + if (me.options.editable.updateTime) { + props.start = item.data.start.valueOf(); + } + if (me.options.editable.updateGroup) { + if ('group' in item.data) props.group = item.data.group; + } + + this.touchParams.itemProps = [props]; + } + else if (dragRightItem) { + props = { + item: dragRightItem + }; + + if (me.options.editable.updateTime) { + props.end = item.data.end.valueOf(); + } + if (me.options.editable.updateGroup) { + if ('group' in item.data) props.group = item.data.group; + } + + this.touchParams.itemProps = [props]; + } + else { + this.touchParams.itemProps = this.getSelection().map(function (id) { + var item = me.items[id]; + var props = { + item: item + }; + + if (me.options.editable.updateTime) { + if ('start' in item.data) props.start = item.data.start.valueOf(); + if ('end' in item.data) props.end = item.data.end.valueOf(); + } + if (me.options.editable.updateGroup) { + if ('group' in item.data) props.group = item.data.group; + } + + return props; + }); + } + + event.stopPropagation(); + } + }; + + /** + * Drag selected items + * @param {Event} event + * @private + */ + ItemSet.prototype._onDrag = function (event) { + if (this.touchParams.itemProps) { + var range = this.body.range, + snap = this.body.util.snap || null, + deltaX = event.gesture.deltaX, + scale = (this.props.width / (range.end - range.start)), + offset = deltaX / scale; + + // move + this.touchParams.itemProps.forEach(function (props) { + if ('start' in props) { + var start = new Date(props.start + offset); + props.item.data.start = snap ? snap(start) : start; + } + + if ('end' in props) { + var end = new Date(props.end + offset); + props.item.data.end = snap ? snap(end) : end; + } + + if ('group' in props) { + // drag from one group to another + var group = ItemSet.groupFromTarget(event); + if (group && group.groupId != props.item.data.group) { + var oldGroup = props.item.parent; + oldGroup.remove(props.item); + oldGroup.order(); + group.add(props.item); + group.order(); + + props.item.data.group = group.groupId; + } + } + }); + + // TODO: implement onMoving handler + + this.stackDirty = true; // force re-stacking of all items next redraw + this.body.emitter.emit('change'); + + event.stopPropagation(); + } + }; + + /** + * End of dragging selected items + * @param {Event} event + * @private + */ + ItemSet.prototype._onDragEnd = function (event) { + if (this.touchParams.itemProps) { + // prepare a change set for the changed items + var changes = [], + me = this, + dataset = this.itemsData.getDataSet(); + + this.touchParams.itemProps.forEach(function (props) { + var id = props.item.id, + itemData = me.itemsData.get(id, me.itemOptions); + + var changed = false; + if ('start' in props.item.data) { + changed = (props.start != props.item.data.start.valueOf()); + itemData.start = util.convert(props.item.data.start, + dataset._options.type && dataset._options.type.start || 'Date'); + } + if ('end' in props.item.data) { + changed = changed || (props.end != props.item.data.end.valueOf()); + itemData.end = util.convert(props.item.data.end, + dataset._options.type && dataset._options.type.end || 'Date'); + } + if ('group' in props.item.data) { + changed = changed || (props.group != props.item.data.group); + itemData.group = props.item.data.group; + } + + // only apply changes when start or end is actually changed + if (changed) { + me.options.onMove(itemData, function (itemData) { + if (itemData) { + // apply changes + itemData[dataset._fieldId] = id; // ensure the item contains its id (can be undefined) + changes.push(itemData); + } + else { + // restore original values + if ('start' in props) props.item.data.start = props.start; + if ('end' in props) props.item.data.end = props.end; + + me.stackDirty = true; // force re-stacking of all items next redraw + me.body.emitter.emit('change'); + } + }); + } + }); + this.touchParams.itemProps = null; + + // apply the changes to the data (if there are changes) + if (changes.length) { + dataset.update(changes); + } + + event.stopPropagation(); + } + }; + + /** + * Handle selecting/deselecting an item when tapping it + * @param {Event} event + * @private + */ + ItemSet.prototype._onSelectItem = function (event) { + if (!this.options.selectable) return; + + var ctrlKey = event.gesture.srcEvent && event.gesture.srcEvent.ctrlKey; + var shiftKey = event.gesture.srcEvent && event.gesture.srcEvent.shiftKey; + if (ctrlKey || shiftKey) { + this._onMultiSelectItem(event); + return; + } + + var oldSelection = this.getSelection(); + + var item = ItemSet.itemFromTarget(event); + var selection = item ? [item.id] : []; + this.setSelection(selection); + + var newSelection = this.getSelection(); + + // emit a select event, + // except when old selection is empty and new selection is still empty + if (newSelection.length > 0 || oldSelection.length > 0) { + this.body.emitter.emit('select', { + items: this.getSelection() + }); + } + + event.stopPropagation(); + }; + + /** + * Handle creation and updates of an item on double tap + * @param event + * @private + */ + ItemSet.prototype._onAddItem = function (event) { + if (!this.options.selectable) return; + if (!this.options.editable.add) return; + + var me = this, + snap = this.body.util.snap || null, + item = ItemSet.itemFromTarget(event); + + if (item) { + // update item + + // execute async handler to update the item (or cancel it) + var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset + this.options.onUpdate(itemData, function (itemData) { + if (itemData) { + me.itemsData.update(itemData); + } + }); + } + else { + // add item + var xAbs = util.getAbsoluteLeft(this.dom.frame); + var x = event.gesture.center.pageX - xAbs; + var start = this.body.util.toTime(x); + var newItem = { + start: snap ? snap(start) : start, + content: 'new item' + }; + + // when default type is a range, add a default end date to the new item + if (this.options.type === 'range') { + var end = this.body.util.toTime(x + this.props.width / 5); + newItem.end = snap ? snap(end) : end; + } + + newItem[this.itemsData.fieldId] = util.randomUUID(); + + var group = ItemSet.groupFromTarget(event); + if (group) { + newItem.group = group.groupId; + } + + // execute async handler to customize (or cancel) adding an item + this.options.onAdd(newItem, function (item) { + if (item) { + me.itemsData.add(newItem); + // TODO: need to trigger a redraw? + } + }); + } + }; + + /** + * Handle selecting/deselecting multiple items when holding an item + * @param {Event} event + * @private + */ + ItemSet.prototype._onMultiSelectItem = function (event) { + if (!this.options.selectable) return; + + var selection, + item = ItemSet.itemFromTarget(event); + + if (item) { + // multi select items + selection = this.getSelection(); // current selection + var index = selection.indexOf(item.id); + if (index == -1) { + // item is not yet selected -> select it + selection.push(item.id); + } + else { + // item is already selected -> deselect it + selection.splice(index, 1); + } + this.setSelection(selection); + + this.body.emitter.emit('select', { + items: this.getSelection() + }); + + event.stopPropagation(); + } + }; + + /** + * Find an item from an event target: + * searches for the attribute 'timeline-item' in the event target's element tree + * @param {Event} event + * @return {Item | null} item + */ + ItemSet.itemFromTarget = function(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('timeline-item')) { + return target['timeline-item']; + } + target = target.parentNode; + } + + return null; + }; + + /** + * Find the Group from an event target: + * searches for the attribute 'timeline-group' in the event target's element tree + * @param {Event} event + * @return {Group | null} group + */ + ItemSet.groupFromTarget = function(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('timeline-group')) { + return target['timeline-group']; + } + target = target.parentNode; + } + + return null; + }; + + /** + * Find the ItemSet from an event target: + * searches for the attribute 'timeline-itemset' in the event target's element tree + * @param {Event} event + * @return {ItemSet | null} item + */ + ItemSet.itemSetFromTarget = function(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('timeline-itemset')) { + return target['timeline-itemset']; + } + target = target.parentNode; + } + + return null; + }; + + module.exports = ItemSet; + + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var stack = __webpack_require__(27); + var ItemRange = __webpack_require__(28); + + /** + * @constructor Group + * @param {Number | String} groupId + * @param {Object} data + * @param {ItemSet} itemSet + */ + function Group (groupId, data, itemSet) { + this.groupId = groupId; + + this.itemSet = itemSet; + + this.dom = {}; + this.props = { + label: { + width: 0, + height: 0 + } + }; + this.className = null; + + this.items = {}; // items filtered by groupId of this group + this.visibleItems = []; // items currently visible in window + this.orderedItems = { // items sorted by start and by end + byStart: [], + byEnd: [] + }; + + this._create(); + + this.setData(data); + } + + /** + * Create DOM elements for the group + * @private + */ + Group.prototype._create = function() { + var label = document.createElement('div'); + label.className = 'vlabel'; + this.dom.label = label; + + var inner = document.createElement('div'); + inner.className = 'inner'; + label.appendChild(inner); + this.dom.inner = inner; + + var foreground = document.createElement('div'); + foreground.className = 'group'; + foreground['timeline-group'] = this; + this.dom.foreground = foreground; + + this.dom.background = document.createElement('div'); + this.dom.background.className = 'group'; + + this.dom.axis = document.createElement('div'); + this.dom.axis.className = 'group'; + + // create a hidden marker to detect when the Timelines container is attached + // to the DOM, or the style of a parent of the Timeline is changed from + // display:none is changed to visible. + this.dom.marker = document.createElement('div'); + this.dom.marker.style.visibility = 'hidden'; + this.dom.marker.innerHTML = '?'; + this.dom.background.appendChild(this.dom.marker); + }; + + /** + * Set the group data for this group + * @param {Object} data Group data, can contain properties content and className + */ + Group.prototype.setData = function(data) { + // update contents + var content = data && data.content; + if (content instanceof Element) { + this.dom.inner.appendChild(content); + } + else if (content != undefined) { + this.dom.inner.innerHTML = content; + } + else { + this.dom.inner.innerHTML = this.groupId; + } + + // update title + this.dom.label.title = data && data.title || ''; + + if (!this.dom.inner.firstChild) { + util.addClassName(this.dom.inner, 'hidden'); + } + else { + util.removeClassName(this.dom.inner, 'hidden'); + } + + // update className + var className = data && data.className || null; + if (className != this.className) { + if (this.className) { + util.removeClassName(this.dom.label, className); + util.removeClassName(this.dom.foreground, className); + util.removeClassName(this.dom.background, className); + util.removeClassName(this.dom.axis, className); + } + util.addClassName(this.dom.label, className); + util.addClassName(this.dom.foreground, className); + util.addClassName(this.dom.background, className); + util.addClassName(this.dom.axis, className); + } + }; + + /** + * Get the width of the group label + * @return {number} width + */ + Group.prototype.getLabelWidth = function() { + return this.props.label.width; + }; + + + /** + * Repaint this group + * @param {{start: number, end: number}} range + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @param {boolean} [restack=false] Force restacking of all items + * @return {boolean} Returns true if the group is resized + */ + Group.prototype.redraw = function(range, margin, restack) { + var resized = false; + + this.visibleItems = this._updateVisibleItems(this.orderedItems, this.visibleItems, range); + + // force recalculation of the height of the items when the marker height changed + // (due to the Timeline being attached to the DOM or changed from display:none to visible) + var markerHeight = this.dom.marker.clientHeight; + if (markerHeight != this.lastMarkerHeight) { + this.lastMarkerHeight = markerHeight; + + util.forEach(this.items, function (item) { + item.dirty = true; + if (item.displayed) item.redraw(); + }); + + restack = true; + } + + // reposition visible items vertically + if (this.itemSet.options.stack) { // TODO: ugly way to access options... + stack.stack(this.visibleItems, margin, restack); + } + else { // no stacking + stack.nostack(this.visibleItems, margin); + } + + // recalculate the height of the group + var height; + var visibleItems = this.visibleItems; + if (visibleItems.length) { + var min = visibleItems[0].top; + var max = visibleItems[0].top + visibleItems[0].height; + util.forEach(visibleItems, function (item) { + min = Math.min(min, item.top); + max = Math.max(max, (item.top + item.height)); + }); + if (min > margin.axis) { + // there is an empty gap between the lowest item and the axis + var offset = min - margin.axis; + max -= offset; + util.forEach(visibleItems, function (item) { + item.top -= offset; + }); + } + height = max + margin.item.vertical / 2; + } + else { + height = margin.axis + margin.item.vertical; + } + height = Math.max(height, this.props.label.height); + + // calculate actual size and position + var foreground = this.dom.foreground; + this.top = foreground.offsetTop; + this.left = foreground.offsetLeft; + this.width = foreground.offsetWidth; + resized = util.updateProperty(this, 'height', height) || resized; + + // recalculate size of label + resized = util.updateProperty(this.props.label, 'width', this.dom.inner.clientWidth) || resized; + resized = util.updateProperty(this.props.label, 'height', this.dom.inner.clientHeight) || resized; + + // apply new height + this.dom.background.style.height = height + 'px'; + this.dom.foreground.style.height = height + 'px'; + this.dom.label.style.height = height + 'px'; + + // update vertical position of items after they are re-stacked and the height of the group is calculated + for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { + var item = this.visibleItems[i]; + item.repositionY(); + } + + return resized; + }; + + /** + * Show this group: attach to the DOM + */ + Group.prototype.show = function() { + if (!this.dom.label.parentNode) { + this.itemSet.dom.labelSet.appendChild(this.dom.label); + } + + if (!this.dom.foreground.parentNode) { + this.itemSet.dom.foreground.appendChild(this.dom.foreground); + } + + if (!this.dom.background.parentNode) { + this.itemSet.dom.background.appendChild(this.dom.background); + } + + if (!this.dom.axis.parentNode) { + this.itemSet.dom.axis.appendChild(this.dom.axis); + } + }; + + /** + * Hide this group: remove from the DOM + */ + Group.prototype.hide = function() { + var label = this.dom.label; + if (label.parentNode) { + label.parentNode.removeChild(label); + } + + var foreground = this.dom.foreground; + if (foreground.parentNode) { + foreground.parentNode.removeChild(foreground); + } + + var background = this.dom.background; + if (background.parentNode) { + background.parentNode.removeChild(background); + } + + var axis = this.dom.axis; + if (axis.parentNode) { + axis.parentNode.removeChild(axis); + } + }; + + /** + * Add an item to the group + * @param {Item} item + */ + Group.prototype.add = function(item) { + this.items[item.id] = item; + item.setParent(this); + + if (item instanceof ItemRange && this.visibleItems.indexOf(item) == -1) { + var range = this.itemSet.body.range; // TODO: not nice accessing the range like this + this._checkIfVisible(item, this.visibleItems, range); + } + }; + + /** + * Remove an item from the group + * @param {Item} item + */ + Group.prototype.remove = function(item) { + delete this.items[item.id]; + item.setParent(this.itemSet); + + // remove from visible items + var index = this.visibleItems.indexOf(item); + if (index != -1) this.visibleItems.splice(index, 1); + + // TODO: also remove from ordered items? + }; + + /** + * Remove an item from the corresponding DataSet + * @param {Item} item + */ + Group.prototype.removeFromDataSet = function(item) { + this.itemSet.removeItem(item.id); + }; + + /** + * Reorder the items + */ + Group.prototype.order = function() { + var array = util.toArray(this.items); + this.orderedItems.byStart = array; + this.orderedItems.byEnd = this._constructByEndArray(array); + + stack.orderByStart(this.orderedItems.byStart); + stack.orderByEnd(this.orderedItems.byEnd); + }; + + /** + * Create an array containing all items being a range (having an end date) + * @param {Item[]} array + * @returns {ItemRange[]} + * @private + */ + Group.prototype._constructByEndArray = function(array) { + var endArray = []; + + for (var i = 0; i < array.length; i++) { + if (array[i] instanceof ItemRange) { + endArray.push(array[i]); + } + } + return endArray; + }; + + /** + * Update the visible items + * @param {{byStart: Item[], byEnd: Item[]}} orderedItems All items ordered by start date and by end date + * @param {Item[]} visibleItems The previously visible items. + * @param {{start: number, end: number}} range Visible range + * @return {Item[]} visibleItems The new visible items. + * @private + */ + Group.prototype._updateVisibleItems = function(orderedItems, visibleItems, range) { + var initialPosByStart, + newVisibleItems = [], + i; + + // first check if the items that were in view previously are still in view. + // this handles the case for the ItemRange that is both before and after the current one. + if (visibleItems.length > 0) { + for (i = 0; i < visibleItems.length; i++) { + this._checkIfVisible(visibleItems[i], newVisibleItems, range); + } + } + + // If there were no visible items previously, use binarySearch to find a visible ItemPoint or ItemRange (based on startTime) + if (newVisibleItems.length == 0) { + initialPosByStart = util.binarySearch(orderedItems.byStart, range, 'data','start'); + } + else { + initialPosByStart = orderedItems.byStart.indexOf(newVisibleItems[0]); + } + + // use visible search to find a visible ItemRange (only based on endTime) + var initialPosByEnd = util.binarySearch(orderedItems.byEnd, range, 'data','end'); + + // if we found a initial ID to use, trace it up and down until we meet an invisible item. + if (initialPosByStart != -1) { + for (i = initialPosByStart; i >= 0; i--) { + if (this._checkIfInvisible(orderedItems.byStart[i], newVisibleItems, range)) {break;} + } + for (i = initialPosByStart + 1; i < orderedItems.byStart.length; i++) { + if (this._checkIfInvisible(orderedItems.byStart[i], newVisibleItems, range)) {break;} + } + } + + // if we found a initial ID to use, trace it up and down until we meet an invisible item. + if (initialPosByEnd != -1) { + for (i = initialPosByEnd; i >= 0; i--) { + if (this._checkIfInvisible(orderedItems.byEnd[i], newVisibleItems, range)) {break;} + } + for (i = initialPosByEnd + 1; i < orderedItems.byEnd.length; i++) { + if (this._checkIfInvisible(orderedItems.byEnd[i], newVisibleItems, range)) {break;} + } + } + + return newVisibleItems; + }; + + + + /** + * this function checks if an item is invisible. If it is NOT we make it visible + * and add it to the global visible items. If it is, return true. + * + * @param {Item} item + * @param {Item[]} visibleItems + * @param {{start:number, end:number}} range + * @returns {boolean} + * @private + */ + Group.prototype._checkIfInvisible = function(item, visibleItems, range) { + if (item.isVisible(range)) { + if (!item.displayed) item.show(); + item.repositionX(); + if (visibleItems.indexOf(item) == -1) { + visibleItems.push(item); + } + return false; + } + else { + if (item.displayed) item.hide(); + return true; + } + }; + + /** + * this function is very similar to the _checkIfInvisible() but it does not + * return booleans, hides the item if it should not be seen and always adds to + * the visibleItems. + * this one is for brute forcing and hiding. + * + * @param {Item} item + * @param {Array} visibleItems + * @param {{start:number, end:number}} range + * @private + */ + Group.prototype._checkIfVisible = function(item, visibleItems, range) { + if (item.isVisible(range)) { + if (!item.displayed) item.show(); + // reposition item horizontally + item.repositionX(); + visibleItems.push(item); + } + else { + if (item.displayed) item.hide(); + } + }; + + module.exports = Group; + + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + // Utility functions for ordering and stacking of items + var EPSILON = 0.001; // used when checking collisions, to prevent round-off errors + + /** + * Order items by their start data + * @param {Item[]} items + */ + exports.orderByStart = function(items) { + items.sort(function (a, b) { + return a.data.start - b.data.start; + }); + }; + + /** + * Order items by their end date. If they have no end date, their start date + * is used. + * @param {Item[]} items + */ + exports.orderByEnd = function(items) { + items.sort(function (a, b) { + var aTime = ('end' in a.data) ? a.data.end : a.data.start, + bTime = ('end' in b.data) ? b.data.end : b.data.start; + + return aTime - bTime; + }); + }; + + /** + * Adjust vertical positions of the items such that they don't overlap each + * other. + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {boolean} [force=false] + * If true, all items will be repositioned. If false (default), only + * items having a top===null will be re-stacked + */ + exports.stack = function(items, margin, force) { + var i, iMax; + + if (force) { + // reset top position of all items + for (i = 0, iMax = items.length; i < iMax; i++) { + items[i].top = null; + } + } + + // calculate new, non-overlapping positions + for (i = 0, iMax = items.length; i < iMax; i++) { + var item = items[i]; + if (item.top === null) { + // initialize top position + item.top = margin.axis; + + do { + // TODO: optimize checking for overlap. when there is a gap without items, + // you only need to check for items from the next item on, not from zero + var collidingItem = null; + for (var j = 0, jj = items.length; j < jj; j++) { + var other = items[j]; + if (other.top !== null && other !== item && exports.collision(item, other, margin.item)) { + collidingItem = other; + break; + } + } + + if (collidingItem != null) { + // There is a collision. Reposition the items above the colliding element + item.top = collidingItem.top + collidingItem.height + margin.item.vertical; + } + } while (collidingItem); + } + } + }; + + /** + * Adjust vertical positions of the items without stacking them + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + */ + exports.nostack = function(items, margin) { + var i, iMax; + + // reset top position of all items + for (i = 0, iMax = items.length; i < iMax; i++) { + items[i].top = margin.axis; + } + }; + + /** + * Test if the two provided items collide + * The items must have parameters left, width, top, and height. + * @param {Item} a The first item + * @param {Item} b The second item + * @param {{horizontal: number, vertical: number}} margin + * An object containing a horizontal and vertical + * minimum required margin. + * @return {boolean} true if a and b collide, else false + */ + exports.collision = function(a, b, margin) { + return ((a.left - margin.horizontal + EPSILON) < (b.left + b.width) && + (a.left + a.width + margin.horizontal - EPSILON) > b.left && + (a.top - margin.vertical + EPSILON) < (b.top + b.height) && + (a.top + a.height + margin.vertical - EPSILON) > b.top); + }; + + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + var Hammer = __webpack_require__(16); + var Item = __webpack_require__(29); + + /** + * @constructor ItemRange + * @extends Item + * @param {Object} data Object containing parameters start, end + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe options + */ + function ItemRange (data, conversion, options) { + this.props = { + content: { + width: 0 + } + }; + this.overflow = false; // if contents can overflow (css styling), this flag is set to true + + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data.id); + } + if (data.end == undefined) { + throw new Error('Property "end" missing in item ' + data.id); + } + } + + Item.call(this, data, conversion, options); + } + + ItemRange.prototype = new Item (null, null, null); + + ItemRange.prototype.baseClassName = 'item range'; + + /** + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + ItemRange.prototype.isVisible = function(range) { + // determine visibility + return (this.data.start < range.end) && (this.data.end > range.start); + }; + + /** + * Repaint the item + */ + ItemRange.prototype.redraw = function() { + var dom = this.dom; + if (!dom) { + // create DOM + this.dom = {}; + dom = this.dom; + + // background box + dom.box = document.createElement('div'); + // className is updated in redraw() + + // contents box + dom.content = document.createElement('div'); + dom.content.className = 'content'; + dom.box.appendChild(dom.content); + + // attach this item as attribute + dom.box['timeline-item'] = this; + } + + // append DOM to parent DOM + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw time axis: parent has no foreground container element'); + } + foreground.appendChild(dom.box); + } + this.displayed = true; + + // update contents + if (this.data.content != this.content) { + this.content = this.data.content; + if (this.content instanceof Element) { + dom.content.innerHTML = ''; + dom.content.appendChild(this.content); + } + else if (this.data.content != undefined) { + dom.content.innerHTML = this.content; + } + else { + throw new Error('Property "content" missing in item ' + this.data.id); + } + + this.dirty = true; + } + + // update title + if (this.data.title != this.title) { + dom.box.title = this.data.title; + this.title = this.data.title; + } + + // update class + var className = (this.data.className ? (' ' + this.data.className) : '') + + (this.selected ? ' selected' : ''); + if (this.className != className) { + this.className = className; + dom.box.className = this.baseClassName + className; + + this.dirty = true; + } + + // recalculate size + if (this.dirty) { + // determine from css whether this box has overflow + this.overflow = window.getComputedStyle(dom.content).overflow !== 'hidden'; + + this.props.content.width = this.dom.content.offsetWidth; + this.height = this.dom.box.offsetHeight; + + this.dirty = false; + } + + this._repaintDeleteButton(dom.box); + this._repaintDragLeft(); + this._repaintDragRight(); + }; + + /** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + */ + ItemRange.prototype.show = function() { + if (!this.displayed) { + this.redraw(); + } + }; + + /** + * Hide the item from the DOM (when visible) + * @return {Boolean} changed + */ + ItemRange.prototype.hide = function() { + if (this.displayed) { + var box = this.dom.box; + + if (box.parentNode) { + box.parentNode.removeChild(box); + } + + this.top = null; + this.left = null; + + this.displayed = false; + } + }; + + /** + * Reposition the item horizontally + * @Override + */ + // TODO: delete the old function + ItemRange.prototype.repositionX = function() { + var props = this.props, + parentWidth = this.parent.width, + start = this.conversion.toScreen(this.data.start), + end = this.conversion.toScreen(this.data.end), + padding = this.options.padding, + contentLeft; + + // limit the width of the this, as browsers cannot draw very wide divs + if (start < -parentWidth) { + start = -parentWidth; + } + if (end > 2 * parentWidth) { + end = 2 * parentWidth; + } + var boxWidth = Math.max(end - start, 1); + + if (this.overflow) { + // when range exceeds left of the window, position the contents at the left of the visible area + contentLeft = Math.max(-start, 0); + + this.left = start; + this.width = boxWidth + this.props.content.width; + // Note: The calculation of width is an optimistic calculation, giving + // a width which will not change when moving the Timeline + // So no restacking needed, which is nicer for the eye; + } + else { // no overflow + // when range exceeds left of the window, position the contents at the left of the visible area + if (start < 0) { + contentLeft = Math.min(-start, + (end - start - props.content.width - 2 * padding)); + // TODO: remove the need for options.padding. it's terrible. + } + else { + contentLeft = 0; + } + + this.left = start; + this.width = boxWidth; + } + + this.dom.box.style.left = this.left + 'px'; + this.dom.box.style.width = boxWidth + 'px'; + this.dom.content.style.left = contentLeft + 'px'; + }; + + /** + * Reposition the item vertically + * @Override + */ + ItemRange.prototype.repositionY = function() { + var orientation = this.options.orientation, + box = this.dom.box; + + if (orientation == 'top') { + box.style.top = this.top + 'px'; + } + else { + box.style.top = (this.parent.height - this.top - this.height) + 'px'; + } + }; + + /** + * Repaint a drag area on the left side of the range when the range is selected + * @protected + */ + ItemRange.prototype._repaintDragLeft = function () { + if (this.selected && this.options.editable.updateTime && !this.dom.dragLeft) { + // create and show drag area + var dragLeft = document.createElement('div'); + dragLeft.className = 'drag-left'; + dragLeft.dragLeftItem = this; + + // TODO: this should be redundant? + Hammer(dragLeft, { + preventDefault: true + }).on('drag', function () { + //console.log('drag left') + }); + + this.dom.box.appendChild(dragLeft); + this.dom.dragLeft = dragLeft; + } + else if (!this.selected && this.dom.dragLeft) { + // delete drag area + if (this.dom.dragLeft.parentNode) { + this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft); + } + this.dom.dragLeft = null; + } + }; + + /** + * Repaint a drag area on the right side of the range when the range is selected + * @protected + */ + ItemRange.prototype._repaintDragRight = function () { + if (this.selected && this.options.editable.updateTime && !this.dom.dragRight) { + // create and show drag area + var dragRight = document.createElement('div'); + dragRight.className = 'drag-right'; + dragRight.dragRightItem = this; + + // TODO: this should be redundant? + Hammer(dragRight, { + preventDefault: true + }).on('drag', function () { + //console.log('drag right') + }); + + this.dom.box.appendChild(dragRight); + this.dom.dragRight = dragRight; + } + else if (!this.selected && this.dom.dragRight) { + // delete drag area + if (this.dom.dragRight.parentNode) { + this.dom.dragRight.parentNode.removeChild(this.dom.dragRight); + } + this.dom.dragRight = null; + } + }; + + module.exports = ItemRange; + + +/***/ }, +/* 29 */ +/***/ function(module, exports, __webpack_require__) { + + var Hammer = __webpack_require__(16); + + /** + * @constructor Item + * @param {Object} data Object containing (optional) parameters type, + * start, end, content, group, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} options Configuration options + * // TODO: describe available options + */ + function Item (data, conversion, options) { + this.id = null; + this.parent = null; + this.data = data; + this.dom = null; + this.conversion = conversion || {}; + this.options = options || {}; + + this.selected = false; + this.displayed = false; + this.dirty = true; + + this.top = null; + this.left = null; + this.width = null; + this.height = null; + } + + /** + * Select current item + */ + Item.prototype.select = function() { + this.selected = true; + if (this.displayed) this.redraw(); + }; + + /** + * Unselect current item + */ + Item.prototype.unselect = function() { + this.selected = false; + if (this.displayed) this.redraw(); + }; + + /** + * Set a parent for the item + * @param {ItemSet | Group} parent + */ + Item.prototype.setParent = function(parent) { + if (this.displayed) { + this.hide(); + this.parent = parent; + if (this.parent) { + this.show(); + } + } + else { + this.parent = parent; + } + }; + + /** + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + Item.prototype.isVisible = function(range) { + // Should be implemented by Item implementations + return false; + }; + + /** + * Show the Item in the DOM (when not already visible) + * @return {Boolean} changed + */ + Item.prototype.show = function() { + return false; + }; + + /** + * Hide the Item from the DOM (when visible) + * @return {Boolean} changed + */ + Item.prototype.hide = function() { + return false; + }; + + /** + * Repaint the item + */ + Item.prototype.redraw = function() { + // should be implemented by the item + }; + + /** + * Reposition the Item horizontally + */ + Item.prototype.repositionX = function() { + // should be implemented by the item + }; + + /** + * Reposition the Item vertically + */ + Item.prototype.repositionY = function() { + // should be implemented by the item + }; + + /** + * Repaint a delete button on the top right of the item when the item is selected + * @param {HTMLElement} anchor + * @protected + */ + Item.prototype._repaintDeleteButton = function (anchor) { + if (this.selected && this.options.editable.remove && !this.dom.deleteButton) { + // create and show button + var me = this; + + var deleteButton = document.createElement('div'); + deleteButton.className = 'delete'; + deleteButton.title = 'Delete this item'; + + Hammer(deleteButton, { + preventDefault: true + }).on('tap', function (event) { + me.parent.removeFromDataSet(me); + event.stopPropagation(); + }); + + anchor.appendChild(deleteButton); + this.dom.deleteButton = deleteButton; + } + else if (!this.selected && this.dom.deleteButton) { + // remove button + if (this.dom.deleteButton.parentNode) { + this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton); + } + this.dom.deleteButton = null; + } + }; + + module.exports = Item; + + +/***/ }, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + var Item = __webpack_require__(29); + + /** + * @constructor ItemBox + * @extends Item + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options + */ + function ItemBox (data, conversion, options) { + this.props = { + dot: { + width: 0, + height: 0 + }, + line: { + width: 0, + height: 0 + } + }; + + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data); + } + } + + Item.call(this, data, conversion, options); + } + + ItemBox.prototype = new Item (null, null, null); + + /** + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + ItemBox.prototype.isVisible = function(range) { + // determine visibility + // TODO: account for the real width of the item. Right now we just add 1/4 to the window + var interval = (range.end - range.start) / 4; + return (this.data.start > range.start - interval) && (this.data.start < range.end + interval); + }; + + /** + * Repaint the item + */ + ItemBox.prototype.redraw = function() { + var dom = this.dom; + if (!dom) { + // create DOM + this.dom = {}; + dom = this.dom; + + // create main box + dom.box = document.createElement('DIV'); + + // contents box (inside the background box). used for making margins + dom.content = document.createElement('DIV'); + dom.content.className = 'content'; + dom.box.appendChild(dom.content); + + // line to axis + dom.line = document.createElement('DIV'); + dom.line.className = 'line'; + + // dot on axis + dom.dot = document.createElement('DIV'); + dom.dot.className = 'dot'; + + // attach this item as attribute + dom.box['timeline-item'] = this; + } + + // append DOM to parent DOM + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) throw new Error('Cannot redraw time axis: parent has no foreground container element'); + foreground.appendChild(dom.box); + } + if (!dom.line.parentNode) { + var background = this.parent.dom.background; + if (!background) throw new Error('Cannot redraw time axis: parent has no background container element'); + background.appendChild(dom.line); + } + if (!dom.dot.parentNode) { + var axis = this.parent.dom.axis; + if (!background) throw new Error('Cannot redraw time axis: parent has no axis container element'); + axis.appendChild(dom.dot); + } + this.displayed = true; + + // update contents + if (this.data.content != this.content) { + this.content = this.data.content; + if (this.content instanceof Element) { + dom.content.innerHTML = ''; + dom.content.appendChild(this.content); + } + else if (this.data.content != undefined) { + dom.content.innerHTML = this.content; + } + else { + throw new Error('Property "content" missing in item ' + this.data.id); + } + + this.dirty = true; + } + + // update title + if (this.data.title != this.title) { + dom.box.title = this.data.title; + this.title = this.data.title; + } + + // update class + var className = (this.data.className? ' ' + this.data.className : '') + + (this.selected ? ' selected' : ''); + if (this.className != className) { + this.className = className; + dom.box.className = 'item box' + className; + dom.line.className = 'item line' + className; + dom.dot.className = 'item dot' + className; + + this.dirty = true; + } + + // recalculate size + if (this.dirty) { + this.props.dot.height = dom.dot.offsetHeight; + this.props.dot.width = dom.dot.offsetWidth; + this.props.line.width = dom.line.offsetWidth; + this.width = dom.box.offsetWidth; + this.height = dom.box.offsetHeight; + + this.dirty = false; + } + + this._repaintDeleteButton(dom.box); + }; + + /** + * Show the item in the DOM (when not already displayed). The items DOM will + * be created when needed. + */ + ItemBox.prototype.show = function() { + if (!this.displayed) { + this.redraw(); + } + }; + + /** + * Hide the item from the DOM (when visible) + */ + ItemBox.prototype.hide = function() { + if (this.displayed) { + var dom = this.dom; + + if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box); + if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line); + if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot); + + this.top = null; + this.left = null; + + this.displayed = false; + } + }; + + /** + * Reposition the item horizontally + * @Override + */ + ItemBox.prototype.repositionX = function() { + var start = this.conversion.toScreen(this.data.start), + align = this.options.align, + left, + box = this.dom.box, + line = this.dom.line, + dot = this.dom.dot; + + // calculate left position of the box + if (align == 'right') { + this.left = start - this.width; + } + else if (align == 'left') { + this.left = start; + } + else { + // default or 'center' + this.left = start - this.width / 2; + } + + // reposition box + box.style.left = this.left + 'px'; + + // reposition line + line.style.left = (start - this.props.line.width / 2) + 'px'; + + // reposition dot + dot.style.left = (start - this.props.dot.width / 2) + 'px'; + }; + + /** + * Reposition the item vertically + * @Override + */ + ItemBox.prototype.repositionY = function() { + var orientation = this.options.orientation, + box = this.dom.box, + line = this.dom.line, + dot = this.dom.dot; + + if (orientation == 'top') { + box.style.top = (this.top || 0) + 'px'; + + line.style.top = '0'; + line.style.height = (this.parent.top + this.top + 1) + 'px'; + line.style.bottom = ''; + } + else { // orientation 'bottom' + var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty + var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top; + + box.style.top = (this.parent.height - this.top - this.height || 0) + 'px'; + line.style.top = (itemSetHeight - lineHeight) + 'px'; + line.style.bottom = '0'; + } + + dot.style.top = (-this.props.dot.height / 2) + 'px'; + }; + + module.exports = ItemBox; + + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + var Item = __webpack_require__(29); + + /** + * @constructor ItemPoint + * @extends Item + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options + */ + function ItemPoint (data, conversion, options) { + this.props = { + dot: { + top: 0, + width: 0, + height: 0 + }, + content: { + height: 0, + marginLeft: 0 + } + }; + + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data); + } + } + + Item.call(this, data, conversion, options); + } + + ItemPoint.prototype = new Item (null, null, null); + + /** + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + ItemPoint.prototype.isVisible = function(range) { + // determine visibility + // TODO: account for the real width of the item. Right now we just add 1/4 to the window + var interval = (range.end - range.start) / 4; + return (this.data.start > range.start - interval) && (this.data.start < range.end + interval); + }; + + /** + * Repaint the item + */ + ItemPoint.prototype.redraw = function() { + var dom = this.dom; + if (!dom) { + // create DOM + this.dom = {}; + dom = this.dom; + + // background box + dom.point = document.createElement('div'); + // className is updated in redraw() + + // contents box, right from the dot + dom.content = document.createElement('div'); + dom.content.className = 'content'; + dom.point.appendChild(dom.content); + + // dot at start + dom.dot = document.createElement('div'); + dom.point.appendChild(dom.dot); + + // attach this item as attribute + dom.point['timeline-item'] = this; + } + + // append DOM to parent DOM + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!dom.point.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw time axis: parent has no foreground container element'); + } + foreground.appendChild(dom.point); + } + this.displayed = true; + + // update contents + if (this.data.content != this.content) { + this.content = this.data.content; + if (this.content instanceof Element) { + dom.content.innerHTML = ''; + dom.content.appendChild(this.content); + } + else if (this.data.content != undefined) { + dom.content.innerHTML = this.content; + } + else { + throw new Error('Property "content" missing in item ' + this.data.id); + } + + this.dirty = true; + } + + // update title + if (this.data.title != this.title) { + dom.point.title = this.data.title; + this.title = this.data.title; + } + + // update class + var className = (this.data.className? ' ' + this.data.className : '') + + (this.selected ? ' selected' : ''); + if (this.className != className) { + this.className = className; + dom.point.className = 'item point' + className; + dom.dot.className = 'item dot' + className; + + this.dirty = true; + } + + // recalculate size + if (this.dirty) { + this.width = dom.point.offsetWidth; + this.height = dom.point.offsetHeight; + this.props.dot.width = dom.dot.offsetWidth; + this.props.dot.height = dom.dot.offsetHeight; + this.props.content.height = dom.content.offsetHeight; + + // resize contents + dom.content.style.marginLeft = 2 * this.props.dot.width + 'px'; + //dom.content.style.marginRight = ... + 'px'; // TODO: margin right + + dom.dot.style.top = ((this.height - this.props.dot.height) / 2) + 'px'; + dom.dot.style.left = (this.props.dot.width / 2) + 'px'; + + this.dirty = false; + } + + this._repaintDeleteButton(dom.point); + }; + + /** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + */ + ItemPoint.prototype.show = function() { + if (!this.displayed) { + this.redraw(); + } + }; + + /** + * Hide the item from the DOM (when visible) + */ + ItemPoint.prototype.hide = function() { + if (this.displayed) { + if (this.dom.point.parentNode) { + this.dom.point.parentNode.removeChild(this.dom.point); + } + + this.top = null; + this.left = null; + + this.displayed = false; + } + }; + + /** + * Reposition the item horizontally + * @Override + */ + ItemPoint.prototype.repositionX = function() { + var start = this.conversion.toScreen(this.data.start); + + this.left = start - this.props.dot.width; + + // reposition point + this.dom.point.style.left = this.left + 'px'; + }; + + /** + * Reposition the item vertically + * @Override + */ + ItemPoint.prototype.repositionY = function() { + var orientation = this.options.orientation, + point = this.dom.point; + + if (orientation == 'top') { + point.style.top = this.top + 'px'; + } + else { + point.style.top = (this.parent.height - this.top - this.height) + 'px'; + } + }; + + module.exports = ItemPoint; + + +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { + + var Emitter = __webpack_require__(8); + var Hammer = __webpack_require__(16); + var util = __webpack_require__(1); + var DataSet = __webpack_require__(5); + var DataView = __webpack_require__(6); + var Range = __webpack_require__(18); + var TimeAxis = __webpack_require__(21); + var CurrentTime = __webpack_require__(23); + var CustomTime = __webpack_require__(24); + var LineGraph = __webpack_require__(33); + + /** + * Create a timeline visualization + * @param {HTMLElement} container + * @param {vis.DataSet | Array | google.visualization.DataTable} [items] + * @param {Object} [options] See Graph2d.setOptions for the available options. + * @constructor + */ + function Graph2d (container, items, options, groups) { + var me = this; + this.defaultOptions = { + start: null, + end: null, + + autoResize: true, + + orientation: 'bottom', + width: null, + height: null, + maxHeight: null, + minHeight: null + }; + this.options = util.deepExtend({}, this.defaultOptions); + + // Create the DOM, props, and emitter + this._create(container); + + // all components listed here will be repainted automatically + this.components = []; + + this.body = { + dom: this.dom, + domProps: this.props, + emitter: { + on: this.on.bind(this), + off: this.off.bind(this), + emit: this.emit.bind(this) + }, + util: { + snap: null, // will be specified after TimeAxis is created + toScreen: me._toScreen.bind(me), + toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width + toTime: me._toTime.bind(me), + toGlobalTime : me._toGlobalTime.bind(me) + } + }; + + // range + this.range = new Range(this.body); + this.components.push(this.range); + this.body.range = this.range; + + // time axis + this.timeAxis = new TimeAxis(this.body); + this.components.push(this.timeAxis); + this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); + + // current time bar + this.currentTime = new CurrentTime(this.body); + this.components.push(this.currentTime); + + // custom time bar + // Note: time bar will be attached in this.setOptions when selected + this.customTime = new CustomTime(this.body); + this.components.push(this.customTime); + + // item set + this.linegraph = new LineGraph(this.body); + this.components.push(this.linegraph); + + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet + + // apply options + if (options) { + this.setOptions(options); + } + + // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! + if (groups) { + this.setGroups(groups); + } + + // create itemset + if (items) { + this.setItems(items); + } + else { + this.redraw(); + } + } + + // turn Graph2d into an event emitter + Emitter(Graph2d.prototype); + + /** + * Create the main DOM for the Graph2d: a root panel containing left, right, + * top, bottom, content, and background panel. + * @param {Element} container The container element where the Graph2d will + * be attached. + * @private + */ + Graph2d.prototype._create = function (container) { + this.dom = {}; + + this.dom.root = document.createElement('div'); + this.dom.background = document.createElement('div'); + this.dom.backgroundVertical = document.createElement('div'); + this.dom.backgroundHorizontalContainer = document.createElement('div'); + this.dom.centerContainer = document.createElement('div'); + this.dom.leftContainer = document.createElement('div'); + this.dom.rightContainer = document.createElement('div'); + this.dom.backgroundHorizontal = document.createElement('div'); + this.dom.center = document.createElement('div'); + this.dom.left = document.createElement('div'); + this.dom.right = document.createElement('div'); + this.dom.top = document.createElement('div'); + this.dom.bottom = document.createElement('div'); + this.dom.shadowTop = document.createElement('div'); + this.dom.shadowBottom = document.createElement('div'); + this.dom.shadowTopLeft = document.createElement('div'); + this.dom.shadowBottomLeft = document.createElement('div'); + this.dom.shadowTopRight = document.createElement('div'); + this.dom.shadowBottomRight = document.createElement('div'); + + this.dom.background.className = 'vispanel background'; + this.dom.backgroundVertical.className = 'vispanel background vertical'; + this.dom.backgroundHorizontalContainer.className = 'vispanel background horizontal'; + this.dom.backgroundHorizontal.className = 'vispanel background horizontal'; + this.dom.centerContainer.className = 'vispanel center'; + this.dom.leftContainer.className = 'vispanel left'; + this.dom.rightContainer.className = 'vispanel right'; + this.dom.top.className = 'vispanel top'; + this.dom.bottom.className = 'vispanel bottom'; + this.dom.left.className = 'content'; + this.dom.center.className = 'content'; + this.dom.right.className = 'content'; + this.dom.shadowTop.className = 'shadow top'; + this.dom.shadowBottom.className = 'shadow bottom'; + this.dom.shadowTopLeft.className = 'shadow top'; + this.dom.shadowBottomLeft.className = 'shadow bottom'; + this.dom.shadowTopRight.className = 'shadow top'; + this.dom.shadowBottomRight.className = 'shadow bottom'; + + this.dom.root.appendChild(this.dom.background); + this.dom.root.appendChild(this.dom.backgroundVertical); + this.dom.root.appendChild(this.dom.backgroundHorizontalContainer); + this.dom.root.appendChild(this.dom.centerContainer); + this.dom.root.appendChild(this.dom.leftContainer); + this.dom.root.appendChild(this.dom.rightContainer); + this.dom.root.appendChild(this.dom.top); + this.dom.root.appendChild(this.dom.bottom); + + this.dom.backgroundHorizontalContainer.appendChild(this.dom.backgroundHorizontal); + this.dom.centerContainer.appendChild(this.dom.center); + this.dom.leftContainer.appendChild(this.dom.left); + this.dom.rightContainer.appendChild(this.dom.right); + + this.dom.centerContainer.appendChild(this.dom.shadowTop); + this.dom.centerContainer.appendChild(this.dom.shadowBottom); + this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); + this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); + this.dom.rightContainer.appendChild(this.dom.shadowTopRight); + this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); + + this.on('rangechange', this.redraw.bind(this)); + this.on('change', this.redraw.bind(this)); + this.on('touch', this._onTouch.bind(this)); + this.on('pinch', this._onPinch.bind(this)); + this.on('dragstart', this._onDragStart.bind(this)); + this.on('drag', this._onDrag.bind(this)); + + // create event listeners for all interesting events, these events will be + // emitted via emitter + this.hammer = Hammer(this.dom.root, { + prevent_default: true + }); + this.listeners = {}; + + var me = this; + var events = [ + 'touch', 'pinch', + 'tap', 'doubletap', 'hold', + 'dragstart', 'drag', 'dragend', + 'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox + ]; + events.forEach(function (event) { + var listener = function () { + var args = [event].concat(Array.prototype.slice.call(arguments, 0)); + me.emit.apply(me, args); + }; + me.hammer.on(event, listener); + me.listeners[event] = listener; + }); + + // size properties of each of the panels + this.props = { + root: {}, + background: {}, + centerContainer: {}, + leftContainer: {}, + rightContainer: {}, + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + border: {}, + scrollTop: 0, + scrollTopMin: 0 + }; + this.touch = {}; // store state information needed for touch events + + // attach the root panel to the provided container + if (!container) throw new Error('No container provided'); + container.appendChild(this.dom.root); + }; + + /** + * Destroy the Graph2d, clean up all DOM elements and event listeners. + */ + Graph2d.prototype.destroy = function () { + // unbind datasets + this.clear(); + + // remove all event listeners + this.off(); + + // stop checking for changed size + this._stopAutoResize(); + + // remove from DOM + if (this.dom.root.parentNode) { + this.dom.root.parentNode.removeChild(this.dom.root); + } + this.dom = null; + + // cleanup hammer touch events + for (var event in this.listeners) { + if (this.listeners.hasOwnProperty(event)) { + delete this.listeners[event]; + } + } + this.listeners = null; + this.hammer = null; + + // give all components the opportunity to cleanup + this.components.forEach(function (component) { + component.destroy(); + }); + + this.body = null; + }; + + /** + * Set options. Options will be passed to all components loaded in the Graph2d. + * @param {Object} [options] + * {String} orientation + * Vertical orientation for the Graph2d, + * can be 'bottom' (default) or 'top'. + * {String | Number} width + * Width for the timeline, a number in pixels or + * a css string like '1000px' or '75%'. '100%' by default. + * {String | Number} height + * Fixed height for the Graph2d, a number in pixels or + * a css string like '400px' or '75%'. If undefined, + * The Graph2d will automatically size such that + * its contents fit. + * {String | Number} minHeight + * Minimum height for the Graph2d, a number in pixels or + * a css string like '400px' or '75%'. + * {String | Number} maxHeight + * Maximum height for the Graph2d, a number in pixels or + * a css string like '400px' or '75%'. + * {Number | Date | String} start + * Start date for the visible window + * {Number | Date | String} end + * End date for the visible window + */ + Graph2d.prototype.setOptions = function (options) { + if (options) { + // copy the known options + var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation']; + util.selectiveExtend(fields, this.options, options); + + // enable/disable autoResize + this._initAutoResize(); + } + + // propagate options to all components + this.components.forEach(function (component) { + component.setOptions(options); + }); + + // TODO: remove deprecation error one day (deprecated since version 0.8.0) + if (options && options.order) { + throw new Error('Option order is deprecated. There is no replacement for this feature.'); + } + + // redraw everything + this.redraw(); + }; + + /** + * Set a custom time bar + * @param {Date} time + */ + Graph2d.prototype.setCustomTime = function (time) { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); + } + + this.customTime.setCustomTime(time); + }; + + /** + * Retrieve the current custom time. + * @return {Date} customTime + */ + Graph2d.prototype.getCustomTime = function() { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); + } + + return this.customTime.getCustomTime(); + }; + + /** + * Set items + * @param {vis.DataSet | Array | google.visualization.DataTable | null} items + */ + Graph2d.prototype.setItems = function(items) { + var initialLoad = (this.itemsData == null); + + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; + } + else if (items instanceof DataSet || items instanceof DataView) { + newDataSet = items; + } + else { + // turn an array into a dataset + newDataSet = new DataSet(items, { + type: { + start: 'Date', + end: 'Date' + } + }); + } + + // set items + this.itemsData = newDataSet; + this.linegraph && this.linegraph.setItems(newDataSet); + + if (initialLoad && ('start' in this.options || 'end' in this.options)) { + this.fit(); + + var start = ('start' in this.options) ? util.convert(this.options.start, 'Date') : null; + var end = ('end' in this.options) ? util.convert(this.options.end, 'Date') : null; + + this.setWindow(start, end); + } + }; + + /** + * Set groups + * @param {vis.DataSet | Array | google.visualization.DataTable} groups + */ + Graph2d.prototype.setGroups = function(groups) { + // convert to type DataSet when needed + var newDataSet; + if (!groups) { + newDataSet = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + newDataSet = groups; + } + else { + // turn an array into a dataset + newDataSet = new DataSet(groups); + } + + this.groupsData = newDataSet; + this.linegraph.setGroups(newDataSet); + }; + + /** + * Clear the Graph2d. By Default, items, groups and options are cleared. + * Example usage: + * + * timeline.clear(); // clear items, groups, and options + * timeline.clear({options: true}); // clear options only + * + * @param {Object} [what] Optionally specify what to clear. By default: + * {items: true, groups: true, options: true} + */ + Graph2d.prototype.clear = function(what) { + // clear items + if (!what || what.items) { + this.setItems(null); + } + + // clear groups + if (!what || what.groups) { + this.setGroups(null); + } + + // clear options of timeline and of each of the components + if (!what || what.options) { + this.components.forEach(function (component) { + component.setOptions(component.defaultOptions); + }); + + this.setOptions(this.defaultOptions); // this will also do a redraw + } + }; + + /** + * Set Graph2d window such that it fits all items + */ + Graph2d.prototype.fit = function() { + // apply the data range as range + var dataRange = this.getItemRange(); + + // add 5% space on both sides + var start = dataRange.min; + var end = dataRange.max; + if (start != null && end != null) { + var interval = (end.valueOf() - start.valueOf()); + if (interval <= 0) { + // prevent an empty interval + interval = 24 * 60 * 60 * 1000; // 1 day + } + start = new Date(start.valueOf() - interval * 0.05); + end = new Date(end.valueOf() + interval * 0.05); + } + + // skip range set if there is no start and end date + if (start === null && end === null) { + return; + } + + this.range.setRange(start, end); + }; + + /** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ + Graph2d.prototype.getItemRange = function() { + // calculate min from start filed + var itemsData = this.itemsData, + min = null, + max = null; + + if (itemsData) { + // calculate the minimum value of the field 'start' + var minItem = itemsData.min('start'); + min = minItem ? util.convert(minItem.start, 'Date').valueOf() : null; + // Note: we convert first to Date and then to number because else + // a conversion from ISODate to Number will fail + + // calculate maximum value of fields 'start' and 'end' + var maxStartItem = itemsData.max('start'); + if (maxStartItem) { + max = util.convert(maxStartItem.start, 'Date').valueOf(); + } + var maxEndItem = itemsData.max('end'); + if (maxEndItem) { + if (max == null) { + max = util.convert(maxEndItem.end, 'Date').valueOf(); + } + else { + max = Math.max(max, util.convert(maxEndItem.end, 'Date').valueOf()); + } + } + } + + return { + min: (min != null) ? new Date(min) : null, + max: (max != null) ? new Date(max) : null + }; + }; + + /** + * Set the visible window. Both parameters are optional, you can change only + * start or only end. Syntax: + * + * TimeLine.setWindow(start, end) + * TimeLine.setWindow(range) + * + * Where start and end can be a Date, number, or string, and range is an + * object with properties start and end. + * + * @param {Date | Number | String | Object} [start] Start date of visible window + * @param {Date | Number | String} [end] End date of visible window + */ + Graph2d.prototype.setWindow = function(start, end) { + if (arguments.length == 1) { + var range = arguments[0]; + this.range.setRange(range.start, range.end); + } + else { + this.range.setRange(start, end); + } + }; + + /** + * Get the visible window + * @return {{start: Date, end: Date}} Visible range + */ + Graph2d.prototype.getWindow = function() { + var range = this.range.getRange(); + return { + start: new Date(range.start), + end: new Date(range.end) + }; + }; + + /** + * Force a redraw of the Graph2d. Can be useful to manually redraw when + * option autoResize=false + */ + Graph2d.prototype.redraw = function() { + var resized = false, + options = this.options, + props = this.props, + dom = this.dom; + + if (!dom) return; // when destroyed + + // update class names + dom.root.className = 'vis timeline root ' + options.orientation; + + // update root width and height options + dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); + dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); + dom.root.style.width = util.option.asSize(options.width, ''); + + // calculate border widths + props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; + props.border.right = props.border.left; + props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; + props.border.bottom = props.border.top; + var borderRootHeight= dom.root.offsetHeight - dom.root.clientHeight; + var borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; + + // calculate the heights. If any of the side panels is empty, we set the height to + // minus the border width, such that the border will be invisible + props.center.height = dom.center.offsetHeight; + props.left.height = dom.left.offsetHeight; + props.right.height = dom.right.offsetHeight; + props.top.height = dom.top.clientHeight || -props.border.top; + props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; + + // TODO: compensate borders when any of the panels is empty. + + // apply auto height + // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) + var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); + var autoHeight = props.top.height + contentHeight + props.bottom.height + + borderRootHeight + props.border.top + props.border.bottom; + dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); + + // calculate heights of the content panels + props.root.height = dom.root.offsetHeight; + props.background.height = props.root.height - borderRootHeight; + var containerHeight = props.root.height - props.top.height - props.bottom.height - + borderRootHeight; + props.centerContainer.height = containerHeight; + props.leftContainer.height = containerHeight; + props.rightContainer.height = props.leftContainer.height; + + // calculate the widths of the panels + props.root.width = dom.root.offsetWidth; + props.background.width = props.root.width - borderRootWidth; + props.left.width = dom.leftContainer.clientWidth || -props.border.left; + props.leftContainer.width = props.left.width; + props.right.width = dom.rightContainer.clientWidth || -props.border.right; + props.rightContainer.width = props.right.width; + var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; + props.center.width = centerWidth; + props.centerContainer.width = centerWidth; + props.top.width = centerWidth; + props.bottom.width = centerWidth; + + // resize the panels + dom.background.style.height = props.background.height + 'px'; + dom.backgroundVertical.style.height = props.background.height + 'px'; + dom.backgroundHorizontalContainer.style.height = props.centerContainer.height + 'px'; + dom.centerContainer.style.height = props.centerContainer.height + 'px'; + dom.leftContainer.style.height = props.leftContainer.height + 'px'; + dom.rightContainer.style.height = props.rightContainer.height + 'px'; + + dom.background.style.width = props.background.width + 'px'; + dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; + dom.backgroundHorizontalContainer.style.width = props.background.width + 'px'; + dom.backgroundHorizontal.style.width = props.background.width + 'px'; + dom.centerContainer.style.width = props.center.width + 'px'; + dom.top.style.width = props.top.width + 'px'; + dom.bottom.style.width = props.bottom.width + 'px'; + + // reposition the panels + dom.background.style.left = '0'; + dom.background.style.top = '0'; + dom.backgroundVertical.style.left = props.left.width + 'px'; + dom.backgroundVertical.style.top = '0'; + dom.backgroundHorizontalContainer.style.left = '0'; + dom.backgroundHorizontalContainer.style.top = props.top.height + 'px'; + dom.centerContainer.style.left = props.left.width + 'px'; + dom.centerContainer.style.top = props.top.height + 'px'; + dom.leftContainer.style.left = '0'; + dom.leftContainer.style.top = props.top.height + 'px'; + dom.rightContainer.style.left = (props.left.width + props.center.width) + 'px'; + dom.rightContainer.style.top = props.top.height + 'px'; + dom.top.style.left = props.left.width + 'px'; + dom.top.style.top = '0'; + dom.bottom.style.left = props.left.width + 'px'; + dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px'; + + // update the scrollTop, feasible range for the offset can be changed + // when the height of the Graph2d or of the contents of the center changed + this._updateScrollTop(); + + // reposition the scrollable contents + var offset = this.props.scrollTop; + if (options.orientation == 'bottom') { + offset += Math.max(this.props.centerContainer.height - this.props.center.height - + this.props.border.top - this.props.border.bottom, 0); + } + dom.center.style.left = '0'; + dom.center.style.top = offset + 'px'; + dom.backgroundHorizontal.style.left = '0'; + dom.backgroundHorizontal.style.top = offset + 'px'; + dom.left.style.left = '0'; + dom.left.style.top = offset + 'px'; + dom.right.style.left = '0'; + dom.right.style.top = offset + 'px'; + + // show shadows when vertical scrolling is available + var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; + var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; + dom.shadowTop.style.visibility = visibilityTop; + dom.shadowBottom.style.visibility = visibilityBottom; + dom.shadowTopLeft.style.visibility = visibilityTop; + dom.shadowBottomLeft.style.visibility = visibilityBottom; + dom.shadowTopRight.style.visibility = visibilityTop; + dom.shadowBottomRight.style.visibility = visibilityBottom; + + // redraw all components + this.components.forEach(function (component) { + resized = component.redraw() || resized; + }); + if (resized) { + // keep redrawing until all sizes are settled + this.redraw(); + } + }; + + /** + * Convert a position on screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toTime = function(x) { + var conversion = this.range.conversion(this.props.center.width); + return new Date(x / conversion.scale + conversion.offset); + }; + + /** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toGlobalTime = function(x) { + var conversion = this.range.conversion(this.props.root.width); + return new Date(x / conversion.scale + conversion.offset); + }; + + /** + * Convert a datetime (Date object) into a position on the screen + * @param {Date} time A date + * @return {int} x The position on the screen in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toScreen = function(time) { + var conversion = this.range.conversion(this.props.center.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; + + + /** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toGlobalScreen = function(time) { + var conversion = this.range.conversion(this.props.root.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; + + /** + * Initialize watching when option autoResize is true + * @private + */ + Graph2d.prototype._initAutoResize = function () { + if (this.options.autoResize == true) { + this._startAutoResize(); + } + else { + this._stopAutoResize(); + } + }; + + /** + * Watch for changes in the size of the container. On resize, the Panel will + * automatically redraw itself. + * @private + */ + Graph2d.prototype._startAutoResize = function () { + var me = this; + + this._stopAutoResize(); + + this._onResize = function() { + if (me.options.autoResize != true) { + // stop watching when the option autoResize is changed to false + me._stopAutoResize(); + return; + } + + if (me.dom.root) { + // check whether the frame is resized + if ((me.dom.root.clientWidth != me.props.lastWidth) || + (me.dom.root.clientHeight != me.props.lastHeight)) { + me.props.lastWidth = me.dom.root.clientWidth; + me.props.lastHeight = me.dom.root.clientHeight; + + me.emit('change'); + } + } + }; + + // add event listener to window resize + util.addEventListener(window, 'resize', this._onResize); + + this.watchTimer = setInterval(this._onResize, 1000); + }; + + /** + * Stop watching for a resize of the frame. + * @private + */ + Graph2d.prototype._stopAutoResize = function () { + if (this.watchTimer) { + clearInterval(this.watchTimer); + this.watchTimer = undefined; + } + + // remove event listener on window.resize + util.removeEventListener(window, 'resize', this._onResize); + this._onResize = null; + }; + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onTouch = function (event) { + this.touch.allowDragging = true; + }; + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onPinch = function (event) { + this.touch.allowDragging = false; + }; + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onDragStart = function (event) { + this.touch.initialScrollTop = this.props.scrollTop; + }; + + /** + * Move the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onDrag = function (event) { + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.touch.allowDragging) return; + + var delta = event.gesture.deltaY; + + var oldScrollTop = this._getScrollTop(); + var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); + + if (newScrollTop != oldScrollTop) { + this.redraw(); // TODO: this causes two redraws when dragging, the other is triggered by rangechange already + } + }; + + /** + * Apply a scrollTop + * @param {Number} scrollTop + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Graph2d.prototype._setScrollTop = function (scrollTop) { + this.props.scrollTop = scrollTop; + this._updateScrollTop(); + return this.props.scrollTop; + }; + + /** + * Update the current scrollTop when the height of the containers has been changed + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Graph2d.prototype._updateScrollTop = function () { + // recalculate the scrollTopMin + var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero + if (scrollTopMin != this.props.scrollTopMin) { + // in case of bottom orientation, change the scrollTop such that the contents + // do not move relative to the time axis at the bottom + if (this.options.orientation == 'bottom') { + this.props.scrollTop += (scrollTopMin - this.props.scrollTopMin); + } + this.props.scrollTopMin = scrollTopMin; + } + + // limit the scrollTop to the feasible scroll range + if (this.props.scrollTop > 0) this.props.scrollTop = 0; + if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; + + return this.props.scrollTop; + }; + + /** + * Get the current scrollTop + * @returns {number} scrollTop + * @private + */ + Graph2d.prototype._getScrollTop = function () { + return this.props.scrollTop; + }; + + module.exports = Graph2d; + + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(4); + var DataSet = __webpack_require__(5); + var DataView = __webpack_require__(6); + var Component = __webpack_require__(20); + var DataAxis = __webpack_require__(34); + var GraphGroup = __webpack_require__(36); + var Legend = __webpack_require__(37); + + var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items + + /** + * This is the constructor of the LineGraph. It requires a Timeline body and options. + * + * @param body + * @param options + * @constructor + */ + function LineGraph(body, options) { + this.id = util.randomUUID(); + this.body = body; + + this.defaultOptions = { + yAxisOrientation: 'left', + defaultGroup: 'default', + sort: true, + sampling: true, + graphHeight: '400px', + shaded: { + enabled: false, + orientation: 'bottom' // top, bottom + }, + style: 'line', // line, bar + barChart: { + width: 50, + align: 'center' // left, center, right + }, + catmullRom: { + enabled: true, + parametrization: 'centripetal', // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + alpha: 0.5 + }, + drawPoints: { + enabled: true, + size: 6, + style: 'square' // square, circle + }, + dataAxis: { + showMinorLabels: true, + showMajorLabels: true, + icons: false, + width: '40px', + visible: true + }, + legend: { + enabled: false, + icons: true, + left: { + visible: true, + position: 'top-left' // top/bottom - left,right + }, + right: { + visible: true, + position: 'top-right' // top/bottom - left,right + } + } + }; + + // options is shared by this ItemSet and all its items + this.options = util.extend({}, this.defaultOptions); + this.dom = {}; + this.props = {}; + this.hammer = null; + this.groups = {}; + + var me = this; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet + + // listeners for the DataSet of the items + this.itemListeners = { + 'add': function (event, params, senderId) { + me._onAdd(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdate(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemove(params.items); + } + }; + + // listeners for the DataSet of the groups + this.groupListeners = { + 'add': function (event, params, senderId) { + me._onAddGroups(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdateGroups(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemoveGroups(params.items); + } + }; + + this.items = {}; // object with an Item for every data item + this.selection = []; // list with the ids of all selected nodes + this.lastStart = this.body.range.start; + this.touchParams = {}; // stores properties while dragging + + this.svgElements = {}; + this.setOptions(options); + this.groupsUsingDefaultStyles = [0]; + + this.body.emitter.on("rangechange",function() { + if (me.lastStart != 0) { + var offset = me.body.range.start - me.lastStart; + var range = me.body.range.end - me.body.range.start; + if (me.width != 0) { + var rangePerPixelInv = me.width/range; + var xOffset = offset * rangePerPixelInv; + me.svg.style.left = (-me.width - xOffset) + "px"; + } + } + }); + this.body.emitter.on("rangechanged", function() { + me.lastStart = me.body.range.start; + me.svg.style.left = util.option.asSize(-me.width); + me._updateGraph.apply(me); + }); + + // create the HTML DOM + this._create(); + this.body.emitter.emit("change"); + } + + LineGraph.prototype = new Component(); + + /** + * Create the HTML DOM for the ItemSet + */ + LineGraph.prototype._create = function(){ + var frame = document.createElement('div'); + frame.className = 'LineGraph'; + this.dom.frame = frame; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); + this.svg.style.position = "relative"; + this.svg.style.height = ('' + this.options.graphHeight).replace("px",'') + 'px'; + this.svg.style.display = "block"; + frame.appendChild(this.svg); + + // data axis + this.options.dataAxis.orientation = 'left'; + this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg); + + this.options.dataAxis.orientation = 'right'; + this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg); + delete this.options.dataAxis.orientation; + + // legends + this.legendLeft = new Legend(this.body, this.options.legend, 'left'); + this.legendRight = new Legend(this.body, this.options.legend, 'right'); + + this.show(); + }; + + /** + * set the options of the LineGraph. the mergeOptions is used for subObjects that have an enabled element. + * @param options + */ + LineGraph.prototype.setOptions = function(options) { + if (options) { + var fields = ['sampling','defaultGroup','graphHeight','yAxisOrientation','style','barChart','dataAxis','sort']; + util.selectiveDeepExtend(fields, this.options, options); + util.mergeOptions(this.options, options,'catmullRom'); + util.mergeOptions(this.options, options,'drawPoints'); + util.mergeOptions(this.options, options,'shaded'); + util.mergeOptions(this.options, options,'legend'); + + if (options.catmullRom) { + if (typeof options.catmullRom == 'object') { + if (options.catmullRom.parametrization) { + if (options.catmullRom.parametrization == 'uniform') { + this.options.catmullRom.alpha = 0; + } + else if (options.catmullRom.parametrization == 'chordal') { + this.options.catmullRom.alpha = 1.0; + } + else { + this.options.catmullRom.parametrization = 'centripetal'; + this.options.catmullRom.alpha = 0.5; + } + } + } + } + + if (this.yAxisLeft) { + if (options.dataAxis !== undefined) { + this.yAxisLeft.setOptions(this.options.dataAxis); + this.yAxisRight.setOptions(this.options.dataAxis); + } + } + + if (this.legendLeft) { + if (options.legend !== undefined) { + this.legendLeft.setOptions(this.options.legend); + this.legendRight.setOptions(this.options.legend); + } + } + + if (this.groups.hasOwnProperty(UNGROUPED)) { + this.groups[UNGROUPED].setOptions(options); + } + } + if (this.dom.frame) { + this._updateGraph(); + } + }; + + /** + * Hide the component from the DOM + */ + LineGraph.prototype.hide = function() { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + }; + + /** + * Show the component in the DOM (when not already visible). + * @return {Boolean} changed + */ + LineGraph.prototype.show = function() { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + }; + + + /** + * Set items + * @param {vis.DataSet | null} items + */ + LineGraph.prototype.setItems = function(items) { + var me = this, + ids, + oldItemsData = this.itemsData; + + // replace the dataset + if (!items) { + this.itemsData = null; + } + else if (items instanceof DataSet || items instanceof DataView) { + this.itemsData = items; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } + + if (oldItemsData) { + // unsubscribe from old dataset + util.forEach(this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); + + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } + + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); + + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); + } + this._updateUngrouped(); + this._updateGraph(); + this.redraw(); + }; + + /** + * Set groups + * @param {vis.DataSet} groups + */ + LineGraph.prototype.setGroups = function(groups) { + var me = this, + ids; + + // unsubscribe from current dataset + if (this.groupsData) { + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.unsubscribe(event, callback); + }); + + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + this._onRemoveGroups(ids); // note: this will cause a redraw + } + + // replace the dataset + if (!groups) { + this.groupsData = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + this.groupsData = groups; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } + + if (this.groupsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); + + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); + } + this._onUpdate(); + }; + + + + LineGraph.prototype._onUpdate = function(ids) { + this._updateUngrouped(); + this._updateAllGroupData(); + this._updateGraph(); + this.redraw(); + }; + LineGraph.prototype._onAdd = function (ids) {this._onUpdate(ids);}; + LineGraph.prototype._onRemove = function (ids) {this._onUpdate(ids);}; + LineGraph.prototype._onUpdateGroups = function (groupIds) { + for (var i = 0; i < groupIds.length; i++) { + var group = this.groupsData.get(groupIds[i]); + this._updateGroup(group, groupIds[i]); + } + + this._updateGraph(); + this.redraw(); + }; + LineGraph.prototype._onAddGroups = function (groupIds) {this._onUpdateGroups(groupIds);}; + + LineGraph.prototype._onRemoveGroups = function (groupIds) { + for (var i = 0; i < groupIds.length; i++) { + if (!this.groups.hasOwnProperty(groupIds[i])) { + if (this.groups[groupIds[i]].options.yAxisOrientation == 'right') { + this.yAxisRight.removeGroup(groupIds[i]); + this.legendRight.removeGroup(groupIds[i]); + this.legendRight.redraw(); + } + else { + this.yAxisLeft.removeGroup(groupIds[i]); + this.legendLeft.removeGroup(groupIds[i]); + this.legendLeft.redraw(); + } + delete this.groups[groupIds[i]]; + } + } + this._updateUngrouped(); + this._updateGraph(); + this.redraw(); + }; + + /** + * update a group object + * + * @param group + * @param groupId + * @private + */ + LineGraph.prototype._updateGroup = function (group, groupId) { + if (!this.groups.hasOwnProperty(groupId)) { + this.groups[groupId] = new GraphGroup(group, groupId, this.options, this.groupsUsingDefaultStyles); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.addGroup(groupId, this.groups[groupId]); + this.legendRight.addGroup(groupId, this.groups[groupId]); + } + else { + this.yAxisLeft.addGroup(groupId, this.groups[groupId]); + this.legendLeft.addGroup(groupId, this.groups[groupId]); + } + } + else { + this.groups[groupId].update(group); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.updateGroup(groupId, this.groups[groupId]); + this.legendRight.updateGroup(groupId, this.groups[groupId]); + } + else { + this.yAxisLeft.updateGroup(groupId, this.groups[groupId]); + this.legendLeft.updateGroup(groupId, this.groups[groupId]); + } + } + this.legendLeft.redraw(); + this.legendRight.redraw(); + }; + + LineGraph.prototype._updateAllGroupData = function () { + if (this.itemsData != null) { + // ~450 ms @ 500k + + var groupsContent = {}; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + groupsContent[groupId] = []; + } + } + for (var itemId in this.itemsData._data) { + if (this.itemsData._data.hasOwnProperty(itemId)) { + var item = this.itemsData._data[itemId]; + item.x = util.convert(item.x,"Date"); + groupsContent[item.group].push(item); + } + } + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + this.groups[groupId].setItems(groupsContent[groupId]); + } + } + // // ~4500ms @ 500k + // for (var groupId in this.groups) { + // if (this.groups.hasOwnProperty(groupId)) { + // this.groups[groupId].setItems(this.itemsData.get({filter: + // function (item) { + // return (item.group == groupId); + // }, type:{x:"Date"}} + // )); + // } + // } + } + }; + + /** + * Create or delete the group holding all ungrouped items. This group is used when + * there are no groups specified. This anonymous group is called 'graph'. + * @protected + */ + LineGraph.prototype._updateUngrouped = function() { + if (this.itemsData != null) { + // var t0 = new Date(); + var group = {id: UNGROUPED, content: this.options.defaultGroup}; + this._updateGroup(group, UNGROUPED); + var ungroupedCounter = 0; + if (this.itemsData) { + for (var itemId in this.itemsData._data) { + if (this.itemsData._data.hasOwnProperty(itemId)) { + var item = this.itemsData._data[itemId]; + if (item != undefined) { + if (item.hasOwnProperty('group')) { + if (item.group === undefined) { + item.group = UNGROUPED; + } + } + else { + item.group = UNGROUPED; + } + ungroupedCounter = item.group == UNGROUPED ? ungroupedCounter + 1 : ungroupedCounter; + } + } + } + } + + // much much slower + // var datapoints = this.itemsData.get({ + // filter: function (item) {return item.group === undefined;}, + // showInternalIds:true + // }); + // if (datapoints.length > 0) { + // var updateQuery = []; + // for (var i = 0; i < datapoints.length; i++) { + // updateQuery.push({id:datapoints[i].id, group: UNGROUPED}); + // } + // this.itemsData.update(updateQuery, true); + // } + // var t1 = new Date(); + // var pointInUNGROUPED = this.itemsData.get({filter: function (item) {return item.group == UNGROUPED;}}); + if (ungroupedCounter == 0) { + delete this.groups[UNGROUPED]; + this.legendLeft.removeGroup(UNGROUPED); + this.legendRight.removeGroup(UNGROUPED); + this.yAxisLeft.removeGroup(UNGROUPED); + this.yAxisRight.removeGroup(UNGROUPED); + } + // console.log("getting amount ungrouped",new Date() - t1); + // console.log("putting in ungrouped",new Date() - t0); + } + else { + delete this.groups[UNGROUPED]; + this.legendLeft.removeGroup(UNGROUPED); + this.legendRight.removeGroup(UNGROUPED); + this.yAxisLeft.removeGroup(UNGROUPED); + this.yAxisRight.removeGroup(UNGROUPED); + } + + this.legendLeft.redraw(); + this.legendRight.redraw(); + }; + + + /** + * Redraw the component, mandatory function + * @return {boolean} Returns true if the component is resized + */ + LineGraph.prototype.redraw = function() { + var resized = false; + + this.svg.style.height = ('' + this.options.graphHeight).replace('px','') + 'px'; + if (this.lastWidth === undefined && this.width || this.lastWidth != this.width) { + resized = true; + } + // check if this component is resized + resized = this._isResized() || resized; + // check whether zoomed (in that case we need to re-stack everything) + var visibleInterval = this.body.range.end - this.body.range.start; + var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.width != this.lastWidth); + this.lastVisibleInterval = visibleInterval; + this.lastWidth = this.width; + + // calculate actual size and position + this.width = this.dom.frame.offsetWidth; + + // the svg element is three times as big as the width, this allows for fully dragging left and right + // without reloading the graph. the controls for this are bound to events in the constructor + if (resized == true) { + this.svg.style.width = util.option.asSize(3*this.width); + this.svg.style.left = util.option.asSize(-this.width); + } + if (zoomed == true) { + this._updateGraph(); + } + + this.legendLeft.redraw(); + this.legendRight.redraw(); + + return resized; + }; + + /** + * Update and redraw the graph. + * + */ + LineGraph.prototype._updateGraph = function () { + // reset the svg elements + DOMutil.prepareElements(this.svgElements); + // // very slow... + // groupData = group.itemsData.get({filter: + // function (item) { + // return (item.x > minDate && item.x < maxDate); + // }} + // ); + + + if (this.width != 0 && this.itemsData != null) { + var group, groupData, preprocessedGroup, i; + var preprocessedGroupData = []; + var processedGroupData = []; + var groupRanges = []; + var changeCalled = false; + + // getting group Ids + var groupIds = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + groupIds.push(groupId); + } + } + + // this is the range of the SVG canvas + var minDate = this.body.util.toGlobalTime(- this.body.domProps.root.width); + var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width); + + // first select and preprocess the data from the datasets. + // the groups have their preselection of data, we now loop over this data to see + // what data we need to draw. Sorted data is much faster. + // more optimization is possible by doing the sampling before and using the binary search + // to find the end date to determine the increment. + if (groupIds.length > 0) { + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + groupData = []; + // optimization for sorted data + if (group.options.sort == true) { + var guess = Math.max(0,util.binarySearchGeneric(group.itemsData, minDate, 'x', 'before')); + + for (var j = guess; j < group.itemsData.length; j++) { + var item = group.itemsData[j]; + if (item !== undefined) { + if (item.x > maxDate) { + groupData.push(item); + break; + } + else { + groupData.push(item); + } + } + } + } + else { + for (var j = 0; j < group.itemsData.length; j++) { + var item = group.itemsData[j]; + if (item !== undefined) { + if (item.x > minDate && item.x < maxDate) { + groupData.push(item); + } + } + } + } + // preprocess, split into ranges and data + preprocessedGroup = this._preprocessData(groupData, group); + groupRanges.push({min: preprocessedGroup.min, max: preprocessedGroup.max}); + preprocessedGroupData.push(preprocessedGroup.data); + } + + // update the Y axis first, we use this data to draw at the correct Y points + // changeCalled is required to clean the SVG on a change emit. + changeCalled = this._updateYAxis(groupIds, groupRanges); + if (changeCalled == true) { + DOMutil.cleanupElements(this.svgElements); + this.body.emitter.emit("change"); + return; + } + + // with the yAxis scaled correctly, use this to get the Y values of the points. + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + processedGroupData.push(this._convertYvalues(preprocessedGroupData[i],group)) + } + + // draw the groups + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (group.options.style == 'line') { + this._drawLineGraph(processedGroupData[i], group); + } + else { + this._drawBarGraph (processedGroupData[i], group); + } + } + } + } + + // cleanup unused svg elements + DOMutil.cleanupElements(this.svgElements); + }; + + /** + * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden. + * @param {array} groupIds + * @private + */ + LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { + var changeCalled = false; + var yAxisLeftUsed = false; + var yAxisRightUsed = false; + var minLeft = 1e9, minRight = 1e9, maxLeft = -1e9, maxRight = -1e9, minVal, maxVal; + var orientation = 'left'; + + // if groups are present + if (groupIds.length > 0) { + for (var i = 0; i < groupIds.length; i++) { + orientation = 'left'; + var group = this.groups[groupIds[i]]; + if (group.options.yAxisOrientation == 'right') { + orientation = 'right'; + } + + minVal = groupRanges[i].min; + maxVal = groupRanges[i].max; + + if (orientation == 'left') { + yAxisLeftUsed = true; + minLeft = minLeft > minVal ? minVal : minLeft; + maxLeft = maxLeft < maxVal ? maxVal : maxLeft; + } + else { + yAxisRightUsed = true; + minRight = minRight > minVal ? minVal : minRight; + maxRight = maxRight < maxVal ? maxVal : maxRight; + } + } + if (yAxisLeftUsed == true) { + this.yAxisLeft.setRange(minLeft, maxLeft); + } + if (yAxisRightUsed == true) { + this.yAxisRight.setRange(minRight, maxRight); + } + } + + changeCalled = this._toggleAxisVisiblity(yAxisLeftUsed , this.yAxisLeft) || changeCalled; + changeCalled = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || changeCalled; + + if (yAxisRightUsed == true && yAxisLeftUsed == true) { + this.yAxisLeft.drawIcons = true; + this.yAxisRight.drawIcons = true; + } + else { + this.yAxisLeft.drawIcons = false; + this.yAxisRight.drawIcons = false; + } + + this.yAxisRight.master = !yAxisLeftUsed; + + if (this.yAxisRight.master == false) { + if (yAxisRightUsed == true) { + this.yAxisLeft.lineOffset = this.yAxisRight.width; + } + changeCalled = this.yAxisLeft.redraw() || changeCalled; + this.yAxisRight.stepPixelsForced = this.yAxisLeft.stepPixels; + changeCalled = this.yAxisRight.redraw() || changeCalled; + } + else { + changeCalled = this.yAxisRight.redraw() || changeCalled; + } + return changeCalled; + }; + + /** + * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function + * + * @param {boolean} axisUsed + * @returns {boolean} + * @private + * @param axis + */ + LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) { + var changed = false; + if (axisUsed == false) { + if (axis.dom.frame.parentNode) { + axis.hide(); + changed = true; + } + } + else { + if (!axis.dom.frame.parentNode) { + axis.show(); + changed = true; + } + } + return changed; + }; + + + /** + * draw a bar graph + * @param datapoints + * @param group + */ + LineGraph.prototype._drawBarGraph = function (dataset, group) { + if (dataset != null) { + if (dataset.length > 0) { + var coreDistance; + var minWidth = 0.1 * group.options.barChart.width; + var offset = 0; + var width = group.options.barChart.width; + + if (group.options.barChart.align == 'left') {offset -= 0.5*width;} + else if (group.options.barChart.align == 'right') {offset += 0.5*width;} + + for (var i = 0; i < dataset.length; i++) { + // dynammically downscale the width so there is no overlap up to 1/10th the original width + if (i+1 < dataset.length) {coreDistance = Math.abs(dataset[i+1].x - dataset[i].x);} + if (i > 0) {coreDistance = Math.min(coreDistance,Math.abs(dataset[i-1].x - dataset[i].x));} + if (coreDistance < width) {width = coreDistance < minWidth ? minWidth : coreDistance;} + + DOMutil.drawBar(dataset[i].x + offset, dataset[i].y, width, group.zeroPosition - dataset[i].y, group.className + ' bar', this.svgElements, this.svg); + } + + // draw points + if (group.options.drawPoints.enabled == true) { + this._drawPoints(dataset, group, this.svgElements, this.svg, offset); + } + } + } + }; + + + /** + * draw a line graph + * + * @param datapoints + * @param group + */ + LineGraph.prototype._drawLineGraph = function (dataset, group) { + if (dataset != null) { + if (dataset.length > 0) { + var path, d; + var svgHeight = Number(this.svg.style.height.replace("px","")); + path = DOMutil.getSVGElement('path', this.svgElements, this.svg); + path.setAttributeNS(null, "class", group.className); + + // construct path from dataset + if (group.options.catmullRom.enabled == true) { + d = this._catmullRom(dataset, group); + } + else { + d = this._linear(dataset); + } + + // append with points for fill and finalize the path + if (group.options.shaded.enabled == true) { + var fillPath = DOMutil.getSVGElement('path',this.svgElements, this.svg); + var dFill; + if (group.options.shaded.orientation == 'top') { + dFill = "M" + dataset[0].x + "," + 0 + " " + d + "L" + dataset[dataset.length - 1].x + "," + 0; + } + else { + dFill = "M" + dataset[0].x + "," + svgHeight + " " + d + "L" + dataset[dataset.length - 1].x + "," + svgHeight; + } + fillPath.setAttributeNS(null, "class", group.className + " fill"); + fillPath.setAttributeNS(null, "d", dFill); + } + // copy properties to path for drawing. + path.setAttributeNS(null, "d", "M" + d); + + // draw points + if (group.options.drawPoints.enabled == true) { + this._drawPoints(dataset, group, this.svgElements, this.svg); + } + } + } + }; + + /** + * draw the data points + * + * @param dataset + * @param JSONcontainer + * @param svg + * @param group + */ + LineGraph.prototype._drawPoints = function (dataset, group, JSONcontainer, svg, offset) { + if (offset === undefined) {offset = 0;} + for (var i = 0; i < dataset.length; i++) { + DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, group, JSONcontainer, svg); + } + }; + + + + /** + * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for + * the yAxis. + * + * @param datapoints + * @returns {Array} + * @private + */ + LineGraph.prototype._preprocessData = function (datapoints, group) { + var extractedData = []; + var xValue, yValue; + var toScreen = this.body.util.toScreen; + + var increment = 1; + var amountOfPoints = datapoints.length; + + var yMin = datapoints[0].y; + var yMax = datapoints[0].y; + + // the global screen is used because changing the width of the yAxis may affect the increment, resulting in an endless loop + // of width changing of the yAxis. + if (group.options.sampling == true) { + var xDistance = this.body.util.toGlobalScreen(datapoints[datapoints.length-1].x) - this.body.util.toGlobalScreen(datapoints[0].x); + var pointsPerPixel = amountOfPoints/xDistance; + increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1,Math.round(pointsPerPixel))); + } + + for (var i = 0; i < amountOfPoints; i += increment) { + xValue = toScreen(datapoints[i].x) + this.width - 1; + yValue = datapoints[i].y; + extractedData.push({x: xValue, y: yValue}); + yMin = yMin > yValue ? yValue : yMin; + yMax = yMax < yValue ? yValue : yMax; + } + + // extractedData.sort(function (a,b) {return a.x - b.x;}); + return {min: yMin, max: yMax, data: extractedData}; + }; + + /** + * This uses the DataAxis object to generate the correct Y coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. + * + * @param datapoints + * @param options + * @returns {Array} + * @private + */ + LineGraph.prototype._convertYvalues = function (datapoints, group) { + var extractedData = []; + var xValue, yValue; + var axis = this.yAxisLeft; + var svgHeight = Number(this.svg.style.height.replace("px","")); + + if (group.options.yAxisOrientation == 'right') { + axis = this.yAxisRight; + } + + for (var i = 0; i < datapoints.length; i++) { + xValue = datapoints[i].x; + yValue = Math.round(axis.convertValue(datapoints[i].y)); + extractedData.push({x: xValue, y: yValue}); + } + + group.setZeroPosition(Math.min(svgHeight, axis.convertValue(0))); + + // extractedData.sort(function (a,b) {return a.x - b.x;}); + return extractedData; + }; + + + /** + * This uses an uniform parametrization of the CatmullRom algorithm: + * "On the Parameterization of Catmull-Rom Curves" by Cem Yuksel et al. + * @param data + * @returns {string} + * @private + */ + LineGraph.prototype._catmullRomUniform = function(data) { + // catmull rom + var p0, p1, p2, p3, bp1, bp2; + var d = Math.round(data[0].x) + "," + Math.round(data[0].y) + " "; + var normalization = 1/6; + var length = data.length; + for (var i = 0; i < length - 1; i++) { + + p0 = (i == 0) ? data[0] : data[i-1]; + p1 = data[i]; + p2 = data[i+1]; + p3 = (i + 2 < length) ? data[i+2] : p2; + + + // Catmull-Rom to Cubic Bezier conversion matrix + // 0 1 0 0 + // -1/6 1 1/6 0 + // 0 1/6 1 -1/6 + // 0 0 1 0 + + // bp0 = { x: p1.x, y: p1.y }; + bp1 = { x: ((-p0.x + 6*p1.x + p2.x) *normalization), y: ((-p0.y + 6*p1.y + p2.y) *normalization)}; + bp2 = { x: (( p1.x + 6*p2.x - p3.x) *normalization), y: (( p1.y + 6*p2.y - p3.y) *normalization)}; + // bp0 = { x: p2.x, y: p2.y }; + + d += "C" + + bp1.x + "," + + bp1.y + " " + + bp2.x + "," + + bp2.y + " " + + p2.x + "," + + p2.y + " "; + } + + return d; + }; + + /** + * This uses either the chordal or centripetal parameterization of the catmull-rom algorithm. + * By default, the centripetal parameterization is used because this gives the nicest results. + * These parameterizations are relatively heavy because the distance between 4 points have to be calculated. + * + * One optimization can be used to reuse distances since this is a sliding window approach. + * @param data + * @returns {string} + * @private + */ + LineGraph.prototype._catmullRom = function(data, group) { + var alpha = group.options.catmullRom.alpha; + if (alpha == 0 || alpha === undefined) { + return this._catmullRomUniform(data); + } + else { + var p0, p1, p2, p3, bp1, bp2, d1,d2,d3, A, B, N, M; + var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA; + var d = Math.round(data[0].x) + "," + Math.round(data[0].y) + " "; + var length = data.length; + for (var i = 0; i < length - 1; i++) { + + p0 = (i == 0) ? data[0] : data[i-1]; + p1 = data[i]; + p2 = data[i+1]; + p3 = (i + 2 < length) ? data[i+2] : p2; + + d1 = Math.sqrt(Math.pow(p0.x - p1.x,2) + Math.pow(p0.y - p1.y,2)); + d2 = Math.sqrt(Math.pow(p1.x - p2.x,2) + Math.pow(p1.y - p2.y,2)); + d3 = Math.sqrt(Math.pow(p2.x - p3.x,2) + Math.pow(p2.y - p3.y,2)); + + // Catmull-Rom to Cubic Bezier conversion matrix + // + // A = 2d1^2a + 3d1^a * d2^a + d3^2a + // B = 2d3^2a + 3d3^a * d2^a + d2^2a + // + // [ 0 1 0 0 ] + // [ -d2^2a/N A/N d1^2a/N 0 ] + // [ 0 d3^2a/M B/M -d2^2a/M ] + // [ 0 0 1 0 ] + + // [ 0 1 0 0 ] + // [ -d2pow2a/N A/N d1pow2a/N 0 ] + // [ 0 d3pow2a/M B/M -d2pow2a/M ] + // [ 0 0 1 0 ] + + d3powA = Math.pow(d3, alpha); + d3pow2A = Math.pow(d3,2*alpha); + d2powA = Math.pow(d2, alpha); + d2pow2A = Math.pow(d2,2*alpha); + d1powA = Math.pow(d1, alpha); + d1pow2A = Math.pow(d1,2*alpha); + + A = 2*d1pow2A + 3*d1powA * d2powA + d2pow2A; + B = 2*d3pow2A + 3*d3powA * d2powA + d2pow2A; + N = 3*d1powA * (d1powA + d2powA); + if (N > 0) {N = 1 / N;} + M = 3*d3powA * (d3powA + d2powA); + if (M > 0) {M = 1 / M;} + + bp1 = { x: ((-d2pow2A * p0.x + A*p1.x + d1pow2A * p2.x) * N), + y: ((-d2pow2A * p0.y + A*p1.y + d1pow2A * p2.y) * N)}; + + bp2 = { x: (( d3pow2A * p1.x + B*p2.x - d2pow2A * p3.x) * M), + y: (( d3pow2A * p1.y + B*p2.y - d2pow2A * p3.y) * M)}; + + if (bp1.x == 0 && bp1.y == 0) {bp1 = p1;} + if (bp2.x == 0 && bp2.y == 0) {bp2 = p2;} + d += "C" + + bp1.x + "," + + bp1.y + " " + + bp2.x + "," + + bp2.y + " " + + p2.x + "," + + p2.y + " "; + } + + return d; + } + }; + + /** + * this generates the SVG path for a linear drawing between datapoints. + * @param data + * @returns {string} + * @private + */ + LineGraph.prototype._linear = function(data) { + // linear + var d = ""; + for (var i = 0; i < data.length; i++) { + if (i == 0) { + d += data[i].x + "," + data[i].y; + } + else { + d += " " + data[i].x + "," + data[i].y; + } + } + return d; + }; + + module.exports = LineGraph; + + +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(4); + var Component = __webpack_require__(20); + var DataStep = __webpack_require__(35); + + /** + * A horizontal time axis + * @param {Object} [options] See DataAxis.setOptions for the available + * options. + * @constructor DataAxis + * @extends Component + * @param body + */ + function DataAxis (body, options, svg) { + this.id = util.randomUUID(); + this.body = body; + + this.defaultOptions = { + orientation: 'left', // supported: 'left', 'right' + showMinorLabels: true, + showMajorLabels: true, + icons: true, + majorLinesOffset: 7, + minorLinesOffset: 4, + labelOffsetX: 10, + labelOffsetY: 2, + iconWidth: 20, + width: '40px', + visible: true + }; + + this.linegraphSVG = svg; + this.props = {}; + this.DOMelements = { // dynamic elements + lines: {}, + labels: {} + }; + + this.dom = {}; + + this.range = {start:0, end:0}; + + this.options = util.extend({}, this.defaultOptions); + this.conversionFactor = 1; + + this.setOptions(options); + this.width = Number(('' + this.options.width).replace("px","")); + this.minWidth = this.width; + this.height = this.linegraphSVG.offsetHeight; + + this.stepPixels = 25; + this.stepPixelsForced = 25; + this.lineOffset = 0; + this.master = true; + this.svgElements = {}; + + + this.groups = {}; + this.amountOfGroups = 0; + + // create the HTML DOM + this._create(); + } + + DataAxis.prototype = new Component(); + + + + DataAxis.prototype.addGroup = function(label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; + }; + + DataAxis.prototype.updateGroup = function(label, graphOptions) { + this.groups[label] = graphOptions; + }; + + DataAxis.prototype.removeGroup = function(label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } + }; + + + DataAxis.prototype.setOptions = function (options) { + if (options) { + var redraw = false; + if (this.options.orientation != options.orientation && options.orientation !== undefined) { + redraw = true; + } + var fields = [ + 'orientation', + 'showMinorLabels', + 'showMajorLabels', + 'icons', + 'majorLinesOffset', + 'minorLinesOffset', + 'labelOffsetX', + 'labelOffsetY', + 'iconWidth', + 'width', + 'visible']; + util.selectiveExtend(fields, this.options, options); + + this.minWidth = Number(('' + this.options.width).replace("px","")); + + if (redraw == true && this.dom.frame) { + this.hide(); + this.show(); + } + } + }; + + + /** + * Create the HTML DOM for the DataAxis + */ + DataAxis.prototype._create = function() { + this.dom.frame = document.createElement('div'); + this.dom.frame.style.width = this.options.width; + this.dom.frame.style.height = this.height; + + this.dom.lineContainer = document.createElement('div'); + this.dom.lineContainer.style.width = '100%'; + this.dom.lineContainer.style.height = this.height; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); + this.svg.style.position = "absolute"; + this.svg.style.top = '0px'; + this.svg.style.height = '100%'; + this.svg.style.width = '100%'; + this.svg.style.display = "block"; + this.dom.frame.appendChild(this.svg); + }; + + DataAxis.prototype._redrawGroupIcons = function () { + DOMutil.prepareElements(this.svgElements); + + var x; + var iconWidth = this.options.iconWidth; + var iconHeight = 15; + var iconOffset = 4; + var y = iconOffset + 0.5 * iconHeight; + + if (this.options.orientation == 'left') { + x = iconOffset; + } + else { + x = this.width - iconWidth - iconOffset; + } + + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight); + y += iconHeight + iconOffset; + } + } + + DOMutil.cleanupElements(this.svgElements); + }; + + /** + * Create the HTML DOM for the DataAxis + */ + DataAxis.prototype.show = function() { + if (!this.dom.frame.parentNode) { + if (this.options.orientation == 'left') { + this.body.dom.left.appendChild(this.dom.frame); + } + else { + this.body.dom.right.appendChild(this.dom.frame); + } + } + + if (!this.dom.lineContainer.parentNode) { + this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer); + } + }; + + /** + * Create the HTML DOM for the DataAxis + */ + DataAxis.prototype.hide = function() { + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + + if (this.dom.lineContainer.parentNode) { + this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer); + } + }; + + /** + * Set a range (start and end) + * @param end + * @param start + * @param end + */ + DataAxis.prototype.setRange = function (start, end) { + this.range.start = start; + this.range.end = end; + }; + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + DataAxis.prototype.redraw = function () { + var changeCalled = false; + if (this.amountOfGroups == 0) { + this.hide(); + } + else { + this.show(); + this.height = Number(this.linegraphSVG.style.height.replace("px","")); + // svg offsetheight did not work in firefox and explorer... + + this.dom.lineContainer.style.height = this.height + 'px'; + this.width = this.options.visible == true ? Number(('' + this.options.width).replace("px","")) : 0; + + var props = this.props; + var frame = this.dom.frame; + + // update classname + frame.className = 'dataaxis'; + + // calculate character width and height + this._calculateCharSize(); + + var orientation = this.options.orientation; + var showMinorLabels = this.options.showMinorLabels; + var showMajorLabels = this.options.showMajorLabels; + + // determine the width and height of the elemens for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; + + props.minorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.minorLinesOffset; + props.minorLineHeight = 1; + props.majorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.majorLinesOffset; + props.majorLineHeight = 1; + + // take frame offline while updating (is almost twice as fast) + if (orientation == 'left') { + frame.style.top = '0'; + frame.style.left = '0'; + frame.style.bottom = ''; + frame.style.width = this.width + 'px'; + frame.style.height = this.height + "px"; + } + else { // right + frame.style.top = ''; + frame.style.bottom = '0'; + frame.style.left = '0'; + frame.style.width = this.width + 'px'; + frame.style.height = this.height + "px"; + } + changeCalled = this._redrawLabels(); + if (this.options.icons == true) { + this._redrawGroupIcons(); + } + } + return changeCalled; + }; + + /** + * Repaint major and minor text labels and vertical grid lines + * @private + */ + DataAxis.prototype._redrawLabels = function () { + DOMutil.prepareElements(this.DOMelements); + + var orientation = this.options['orientation']; + + // calculate range and step (step such that we have space for 7 characters per label) + var minimumStep = this.master ? this.props.majorCharHeight || 10 : this.stepPixelsForced; + var step = new DataStep(this.range.start, this.range.end, minimumStep, this.dom.frame.offsetHeight); + this.step = step; + step.first(); + + // get the distance in pixels for a step + var stepPixels = this.dom.frame.offsetHeight / ((step.marginRange / step.step) + 1); + this.stepPixels = stepPixels; + + var amountOfSteps = this.height / stepPixels; + var stepDifference = 0; + + if (this.master == false) { + stepPixels = this.stepPixelsForced; + stepDifference = Math.round((this.height / stepPixels) - amountOfSteps); + for (var i = 0; i < 0.5 * stepDifference; i++) { + step.previous(); + } + amountOfSteps = this.height / stepPixels; + } + + + this.valueAtZero = step.marginEnd; + var marginStartPos = 0; + + // do not draw the first label + var max = 1; + step.next(); + + this.maxLabelSize = 0; + var y = 0; + while (max < Math.round(amountOfSteps)) { + + y = Math.round(max * stepPixels); + marginStartPos = max * stepPixels; + var isMajor = step.isMajor(); + + if (this.options['showMinorLabels'] && isMajor == false || this.master == false && this.options['showMinorLabels'] == true) { + this._redrawLabel(y - 2, step.getCurrent(), orientation, 'yAxis minor', this.props.minorCharHeight); + } + + if (isMajor && this.options['showMajorLabels'] && this.master == true || + this.options['showMinorLabels'] == false && this.master == false && isMajor == true) { + + if (y >= 0) { + this._redrawLabel(y - 2, step.getCurrent(), orientation, 'yAxis major', this.props.majorCharHeight); + } + this._redrawLine(y, orientation, 'grid horizontal major', this.options.majorLinesOffset, this.props.majorLineWidth); + } + else { + this._redrawLine(y, orientation, 'grid horizontal minor', this.options.minorLinesOffset, this.props.minorLineWidth); + } + + step.next(); + max++; + } + + this.conversionFactor = marginStartPos/((amountOfSteps-1) * step.step); + + var offset = this.options.icons == true ? this.options.iconWidth + this.options.labelOffsetX + 15 : this.options.labelOffsetX + 15; + // this will resize the yAxis to accomodate the labels. + if (this.maxLabelSize > (this.width - offset) && this.options.visible == true) { + this.width = this.maxLabelSize + offset; + this.options.width = this.width + "px"; + DOMutil.cleanupElements(this.DOMelements); + this.redraw(); + return true; + } + // this will resize the yAxis if it is too big for the labels. + else if (this.maxLabelSize < (this.width - offset) && this.options.visible == true && this.width > this.minWidth) { + this.width = Math.max(this.minWidth,this.maxLabelSize + offset); + this.options.width = this.width + "px"; + DOMutil.cleanupElements(this.DOMelements); + this.redraw(); + return true; + } + else { + DOMutil.cleanupElements(this.DOMelements); + return false; + } + }; + + /** + * Create a label for the axis at position x + * @private + * @param y + * @param text + * @param orientation + * @param className + * @param characterHeight + */ + DataAxis.prototype._redrawLabel = function (y, text, orientation, className, characterHeight) { + // reuse redundant label + var label = DOMutil.getDOMElement('div',this.DOMelements, this.dom.frame); //this.dom.redundant.labels.shift(); + label.className = className; + label.innerHTML = text; + + if (orientation == 'left') { + label.style.left = '-' + this.options.labelOffsetX + 'px'; + label.style.textAlign = "right"; + } + else { + label.style.right = '-' + this.options.labelOffsetX + 'px'; + label.style.textAlign = "left"; + } + + label.style.top = y - 0.5 * characterHeight + this.options.labelOffsetY + 'px'; + + text += ''; + + var largestWidth = Math.max(this.props.majorCharWidth,this.props.minorCharWidth); + if (this.maxLabelSize < text.length * largestWidth) { + this.maxLabelSize = text.length * largestWidth; + } + }; + + /** + * Create a minor line for the axis at position y + * @param y + * @param orientation + * @param className + * @param offset + * @param width + */ + DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) { + if (this.master == true) { + var line = DOMutil.getDOMElement('div',this.DOMelements, this.dom.lineContainer);//this.dom.redundant.lines.shift(); + line.className = className; + line.innerHTML = ''; + + if (orientation == 'left') { + line.style.left = (this.width - offset) + 'px'; + } + else { + line.style.right = (this.width - offset) + 'px'; + } + + line.style.width = width + 'px'; + line.style.top = y + 'px'; + } + }; + + + DataAxis.prototype.convertValue = function (value) { + var invertedValue = this.valueAtZero - value; + var convertedValue = invertedValue * this.conversionFactor; + return convertedValue; // the -2 is to compensate for the borders + }; + + + /** + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private + */ + DataAxis.prototype._calculateCharSize = function () { + // determine the char width and height on the minor axis + if (!('minorCharHeight' in this.props)) { + + var textMinor = document.createTextNode('0'); + var measureCharMinor = document.createElement('DIV'); + measureCharMinor.className = 'yAxis minor measure'; + measureCharMinor.appendChild(textMinor); + this.dom.frame.appendChild(measureCharMinor); + + this.props.minorCharHeight = measureCharMinor.clientHeight; + this.props.minorCharWidth = measureCharMinor.clientWidth; + + this.dom.frame.removeChild(measureCharMinor); + } + + if (!('majorCharHeight' in this.props)) { + var textMajor = document.createTextNode('0'); + var measureCharMajor = document.createElement('DIV'); + measureCharMajor.className = 'yAxis major measure'; + measureCharMajor.appendChild(textMajor); + this.dom.frame.appendChild(measureCharMajor); + + this.props.majorCharHeight = measureCharMajor.clientHeight; + this.props.majorCharWidth = measureCharMajor.clientWidth; + + this.dom.frame.removeChild(measureCharMajor); + } + }; + + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate + */ + DataAxis.prototype.snap = function(date) { + return this.step.snap(date); + }; + + module.exports = DataAxis; + + +/***/ }, +/* 35 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * @constructor DataStep + * The class DataStep is an iterator for data for the lineGraph. You provide a start data point and an + * end data point. The class itself determines the best scale (step size) based on the + * provided start Date, end Date, and minimumStep. + * + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * + * Alternatively, you can set a scale by hand. + * After creation, you can initialize the class by executing first(). Then you + * can iterate from the start date to the end date via next(). You can check if + * the end date is reached with the function hasNext(). After each step, you can + * retrieve the current date via getCurrent(). + * The DataStep has scales ranging from milliseconds, seconds, minutes, hours, + * days, to years. + * + * Version: 1.2 + * + * @param {Date} [start] The start date, for example new Date(2010, 9, 21) + * or new Date(2010, 9, 21, 23, 45, 00) + * @param {Date} [end] The end date + * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds + */ + function DataStep(start, end, minimumStep, containerHeight, forcedStepSize) { + // variables + this.current = 0; + + this.autoScale = true; + this.stepIndex = 0; + this.step = 1; + this.scale = 1; + + this.marginStart; + this.marginEnd; + + this.majorSteps = [1, 2, 5, 10]; + this.minorSteps = [0.25, 0.5, 1, 2]; + + this.setRange(start, end, minimumStep, containerHeight, forcedStepSize); + } + + + + /** + * Set a new range + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * @param {Number} [start] The start date and time. + * @param {Number} [end] The end date and time. + * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds + */ + DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight, forcedStepSize) { + this._start = start; + this._end = end; + + if (start == end) { + this._start = start - 0.75; + this._end = end + 1; + } + + if (this.autoScale) { + this.setMinimumStep(minimumStep, containerHeight, forcedStepSize); + } + this.setFirst(); + }; + + /** + * Automatically determine the scale that bests fits the provided minimum step + * @param {Number} [minimumStep] The minimum step size in milliseconds + */ + DataStep.prototype.setMinimumStep = function(minimumStep, containerHeight) { + // round to floor + var size = this._end - this._start; + var safeSize = size * 1.1; + var minimumStepValue = minimumStep * (safeSize / containerHeight); + var orderOfMagnitude = Math.round(Math.log(safeSize)/Math.LN10); + + var minorStepIdx = -1; + var magnitudefactor = Math.pow(10,orderOfMagnitude); + + var start = 0; + if (orderOfMagnitude < 0) { + start = orderOfMagnitude; + } + + var solutionFound = false; + for (var i = start; Math.abs(i) <= Math.abs(orderOfMagnitude); i++) { + magnitudefactor = Math.pow(10,i); + for (var j = 0; j < this.minorSteps.length; j++) { + var stepSize = magnitudefactor * this.minorSteps[j]; + if (stepSize >= minimumStepValue) { + solutionFound = true; + minorStepIdx = j; + break; + } + } + if (solutionFound == true) { + break; + } + } + this.stepIndex = minorStepIdx; + this.scale = magnitudefactor; + this.step = magnitudefactor * this.minorSteps[minorStepIdx]; + }; + + + /** + * Set the range iterator to the start date. + */ + DataStep.prototype.first = function() { + this.setFirst(); + }; + + /** + * Round the current date to the first minor date value + * This must be executed once when the current date is set to start Date + */ + DataStep.prototype.setFirst = function() { + var niceStart = this._start - (this.scale * this.minorSteps[this.stepIndex]); + var niceEnd = this._end + (this.scale * this.minorSteps[this.stepIndex]); + + this.marginEnd = this.roundToMinor(niceEnd); + this.marginStart = this.roundToMinor(niceStart); + this.marginRange = this.marginEnd - this.marginStart; + + this.current = this.marginEnd; + + }; + + DataStep.prototype.roundToMinor = function(value) { + var rounded = value - (value % (this.scale * this.minorSteps[this.stepIndex])); + if (value % (this.scale * this.minorSteps[this.stepIndex]) > 0.5 * (this.scale * this.minorSteps[this.stepIndex])) { + return rounded + (this.scale * this.minorSteps[this.stepIndex]); + } + else { + return rounded; + } + } + + + /** + * Check if the there is a next step + * @return {boolean} true if the current date has not passed the end date + */ + DataStep.prototype.hasNext = function () { + return (this.current >= this.marginStart); + }; + + /** + * Do the next step + */ + DataStep.prototype.next = function() { + var prev = this.current; + this.current -= this.step; + + // safety mechanism: if current time is still unchanged, move to the end + if (this.current == prev) { + this.current = this._end; + } + }; + + /** + * Do the next step + */ + DataStep.prototype.previous = function() { + this.current += this.step; + this.marginEnd += this.step; + this.marginRange = this.marginEnd - this.marginStart; + }; + + + + /** + * Get the current datetime + * @return {String} current The current date + */ + DataStep.prototype.getCurrent = function() { + var toPrecision = '' + Number(this.current).toPrecision(5); + for (var i = toPrecision.length-1; i > 0; i--) { + if (toPrecision[i] == "0") { + toPrecision = toPrecision.slice(0,i); + } + else if (toPrecision[i] == "." || toPrecision[i] == ",") { + toPrecision = toPrecision.slice(0,i); + break; + } + else{ + break; + } + } + + return toPrecision; + }; + + + + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate + */ + DataStep.prototype.snap = function(date) { + + }; + + /** + * Check if the current value is a major value (for example when the step + * is DAY, a major value is each first day of the MONTH) + * @return {boolean} true if current date is major, else false. + */ + DataStep.prototype.isMajor = function() { + return (this.current % (this.scale * this.majorSteps[this.stepIndex]) == 0); + }; + + module.exports = DataStep; + + +/***/ }, +/* 36 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(4); + + /** + * @constructor Group + * @param {Number | String} groupId + * @param {Object} data + * @param {ItemSet} itemSet + */ + function GraphGroup (group, groupId, options, groupsUsingDefaultStyles) { + this.id = groupId; + var fields = ['sampling','style','sort','yAxisOrientation','barChart','drawPoints','shaded','catmullRom'] + this.options = util.selectiveBridgeObject(fields,options); + this.usingDefaultStyle = group.className === undefined; + this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; + this.zeroPosition = 0; + this.update(group); + if (this.usingDefaultStyle == true) { + this.groupsUsingDefaultStyles[0] += 1; + } + this.itemsData = []; + } + + GraphGroup.prototype.setItems = function(items) { + if (items != null) { + this.itemsData = items; + if (this.options.sort == true) { + this.itemsData.sort(function (a,b) {return a.x - b.x;}) + } + } + else { + this.itemsData = []; + } + }; + + GraphGroup.prototype.setZeroPosition = function(pos) { + this.zeroPosition = pos; + }; + + GraphGroup.prototype.setOptions = function(options) { + if (options !== undefined) { + var fields = ['sampling','style','sort','yAxisOrientation','barChart']; + util.selectiveDeepExtend(fields, this.options, options); + + util.mergeOptions(this.options, options,'catmullRom'); + util.mergeOptions(this.options, options,'drawPoints'); + util.mergeOptions(this.options, options,'shaded'); + + if (options.catmullRom) { + if (typeof options.catmullRom == 'object') { + if (options.catmullRom.parametrization) { + if (options.catmullRom.parametrization == 'uniform') { + this.options.catmullRom.alpha = 0; + } + else if (options.catmullRom.parametrization == 'chordal') { + this.options.catmullRom.alpha = 1.0; + } + else { + this.options.catmullRom.parametrization = 'centripetal'; + this.options.catmullRom.alpha = 0.5; + } + } + } + } + } + }; + + GraphGroup.prototype.update = function(group) { + this.group = group; + this.content = group.content || 'graph'; + this.className = group.className || this.className || "graphGroup" + this.groupsUsingDefaultStyles[0] % 10; + this.setOptions(group.options); + }; + + GraphGroup.prototype.drawIcon = function(x, y, JSONcontainer, SVGcontainer, iconWidth, iconHeight) { + var fillHeight = iconHeight * 0.5; + var path, fillPath; + + var outline = DOMutil.getSVGElement("rect", JSONcontainer, SVGcontainer); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2*fillHeight); + outline.setAttributeNS(null, "class", "outline"); + + if (this.options.style == 'line') { + path = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); + path.setAttributeNS(null, "class", this.className); + path.setAttributeNS(null, "d", "M" + x + ","+y+" L" + (x + iconWidth) + ","+y+""); + if (this.options.shaded.enabled == true) { + fillPath = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); + if (this.options.shaded.orientation == 'top') { + fillPath.setAttributeNS(null, "d", "M"+x+", " + (y - fillHeight) + + "L"+x+","+y+" L"+ (x + iconWidth) + ","+y+" L"+ (x + iconWidth) + "," + (y - fillHeight)); + } + else { + fillPath.setAttributeNS(null, "d", "M"+x+","+y+" " + + "L"+x+"," + (y + fillHeight) + " " + + "L"+ (x + iconWidth) + "," + (y + fillHeight) + + "L"+ (x + iconWidth) + ","+y); + } + fillPath.setAttributeNS(null, "class", this.className + " iconFill"); + } + + if (this.options.drawPoints.enabled == true) { + DOMutil.drawPoint(x + 0.5 * iconWidth,y, this, JSONcontainer, SVGcontainer); + } + } + else { + var barWidth = Math.round(0.3 * iconWidth); + var bar1Height = Math.round(0.4 * iconHeight); + var bar2Height = Math.round(0.75 * iconHeight); + + var offset = Math.round((iconWidth - (2 * barWidth))/3); + + DOMutil.drawBar(x + 0.5*barWidth + offset , y + fillHeight - bar1Height - 1, barWidth, bar1Height, this.className + ' bar', JSONcontainer, SVGcontainer); + DOMutil.drawBar(x + 1.5*barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, this.className + ' bar', JSONcontainer, SVGcontainer); + } + }; + + module.exports = GraphGroup; + + +/***/ }, +/* 37 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(4); + var Component = __webpack_require__(20); + + /** + * Legend for Graph2d + */ + function Legend(body, options, side) { + this.body = body; + this.defaultOptions = { + enabled: true, + icons: true, + iconSize: 20, + iconSpacing: 6, + left: { + visible: true, + position: 'top-left' // top/bottom - left,center,right + }, + right: { + visible: true, + position: 'top-left' // top/bottom - left,center,right + } + } + this.side = side; + this.options = util.extend({},this.defaultOptions); + + this.svgElements = {}; + this.dom = {}; + this.groups = {}; + this.amountOfGroups = 0; + this._create(); + + this.setOptions(options); + } + + Legend.prototype = new Component(); + + + Legend.prototype.addGroup = function(label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; + }; + + Legend.prototype.updateGroup = function(label, graphOptions) { + this.groups[label] = graphOptions; + }; + + Legend.prototype.removeGroup = function(label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } + }; + + Legend.prototype._create = function() { + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'legend'; + this.dom.frame.style.position = "absolute"; + this.dom.frame.style.top = "10px"; + this.dom.frame.style.display = "block"; + + this.dom.textArea = document.createElement('div'); + this.dom.textArea.className = 'legendText'; + this.dom.textArea.style.position = "relative"; + this.dom.textArea.style.top = "0px"; + + this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); + this.svg.style.position = 'absolute'; + this.svg.style.top = 0 +'px'; + this.svg.style.width = this.options.iconSize + 5 + 'px'; + + this.dom.frame.appendChild(this.svg); + this.dom.frame.appendChild(this.dom.textArea); + }; + + /** + * Hide the component from the DOM + */ + Legend.prototype.hide = function() { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + }; + + /** + * Show the component in the DOM (when not already visible). + * @return {Boolean} changed + */ + Legend.prototype.show = function() { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + }; + + Legend.prototype.setOptions = function(options) { + var fields = ['enabled','orientation','icons','left','right']; + util.selectiveDeepExtend(fields, this.options, options); + }; + + Legend.prototype.redraw = function() { + if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false) { + this.hide(); + } + else { + this.show(); + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') { + this.dom.frame.style.left = '4px'; + this.dom.frame.style.textAlign = "left"; + this.dom.textArea.style.textAlign = "left"; + this.dom.textArea.style.left = (this.options.iconSize + 15) + 'px'; + this.dom.textArea.style.right = ''; + this.svg.style.left = 0 +'px'; + this.svg.style.right = ''; + } + else { + this.dom.frame.style.right = '4px'; + this.dom.frame.style.textAlign = "right"; + this.dom.textArea.style.textAlign = "right"; + this.dom.textArea.style.right = (this.options.iconSize + 15) + 'px'; + this.dom.textArea.style.left = ''; + this.svg.style.right = 0 +'px'; + this.svg.style.left = ''; + } + + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') { + this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px","")) + 'px'; + this.dom.frame.style.bottom = ''; + } + else { + this.dom.frame.style.bottom = 4 - Number(this.body.dom.center.style.top.replace("px","")) + 'px'; + this.dom.frame.style.top = ''; + } + + if (this.options.icons == false) { + this.dom.frame.style.width = this.dom.textArea.offsetWidth + 10 + 'px'; + this.dom.textArea.style.right = ''; + this.dom.textArea.style.left = ''; + this.svg.style.width = '0px'; + } + else { + this.dom.frame.style.width = this.options.iconSize + 15 + this.dom.textArea.offsetWidth + 10 + 'px' + this.drawLegendIcons(); + } + + var content = ''; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + content += this.groups[groupId].content + '
'; + } + } + this.dom.textArea.innerHTML = content; + this.dom.textArea.style.lineHeight = ((0.75 * this.options.iconSize) + this.options.iconSpacing) + 'px'; + } + }; + + Legend.prototype.drawLegendIcons = function() { + if (this.dom.frame.parentNode) { + DOMutil.prepareElements(this.svgElements); + var padding = window.getComputedStyle(this.dom.frame).paddingTop; + var iconOffset = Number(padding.replace('px','')); + var x = iconOffset; + var iconWidth = this.options.iconSize; + var iconHeight = 0.75 * this.options.iconSize; + var y = iconOffset + 0.5 * iconHeight + 3; + + this.svg.style.width = iconWidth + 5 + iconOffset + 'px'; + + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight); + y += iconHeight + this.options.iconSpacing; + } + } + + DOMutil.cleanupElements(this.svgElements); + } + }; + + module.exports = Legend; + + +/***/ }, +/* 38 */ +/***/ function(module, exports, __webpack_require__) { + + var Emitter = __webpack_require__(8); + var Hammer = __webpack_require__(16); + var mousetrap = __webpack_require__(39); + var util = __webpack_require__(1); + var hammerUtil = __webpack_require__(19); + var DataSet = __webpack_require__(5); + var DataView = __webpack_require__(6); + var dotparser = __webpack_require__(40); + var gephiParser = __webpack_require__(41); + var Groups = __webpack_require__(42); + var Images = __webpack_require__(43); + var Node = __webpack_require__(44); + var Edge = __webpack_require__(45); + var Popup = __webpack_require__(46); + var MixinLoader = __webpack_require__(47); + + // Load custom shapes into CanvasRenderingContext2D + __webpack_require__(58); + + /** + * @constructor Network + * Create a network visualization, displaying nodes and edges. + * + * @param {Element} container The DOM element in which the Network will + * be created. Normally a div element. + * @param {Object} data An object containing parameters + * {Array} nodes + * {Array} edges + * @param {Object} options Options + */ + function Network (container, data, options) { + if (!(this instanceof Network)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + + this._initializeMixinLoaders(); + + // create variables and set default values + this.containerElement = container; + this.width = '100%'; + this.height = '100%'; + + // render and calculation settings + this.renderRefreshRate = 60; // hz (fps) + this.renderTimestep = 1000 / this.renderRefreshRate; // ms -- saves calculation later on + this.renderTime = 0.5 * this.renderTimestep; // measured time it takes to render a frame + this.maxPhysicsTicksPerRender = 3; // max amount of physics ticks per render step. + this.physicsDiscreteStepsize = 0.50; // discrete stepsize of the simulation + + this.stabilize = true; // stabilize before displaying the network + this.selectable = true; + this.initializing = true; + + // these functions are triggered when the dataset is edited + this.triggerFunctions = {add:null,edit:null,editEdge:null,connect:null,del:null}; + + + // set constant values + this.constants = { + nodes: { + radiusMin: 10, + radiusMax: 30, + radius: 10, + shape: 'ellipse', + image: undefined, + widthMin: 16, // px + widthMax: 64, // px + fixed: false, + fontColor: 'black', + fontSize: 14, // px + fontFace: 'verdana', + level: -1, + color: { + border: '#2B7CE9', + background: '#97C2FC', + highlight: { + border: '#2B7CE9', + background: '#D2E5FF' + }, + hover: { + border: '#2B7CE9', + background: '#D2E5FF' + } + }, + borderColor: '#2B7CE9', + backgroundColor: '#97C2FC', + highlightColor: '#D2E5FF', + group: undefined, + borderWidth: 1 + }, + edges: { + widthMin: 1, + widthMax: 15, + width: 1, + widthSelectionMultiplier: 2, + hoverWidth: 1.5, + style: 'line', + color: { + color:'#848484', + highlight:'#848484', + hover: '#848484' + }, + fontColor: '#343434', + fontSize: 14, // px + fontFace: 'arial', + fontFill: 'white', + arrowScaleFactor: 1, + dash: { + length: 10, + gap: 5, + altLength: undefined + }, + inheritColor: "from" // to, from, false, true (== from) + }, + configurePhysics:false, + physics: { + barnesHut: { + enabled: true, + theta: 1 / 0.6, // inverted to save time during calculation + gravitationalConstant: -2000, + centralGravity: 0.3, + springLength: 95, + springConstant: 0.04, + damping: 0.09 + }, + repulsion: { + centralGravity: 0.0, + springLength: 200, + springConstant: 0.05, + nodeDistance: 100, + damping: 0.09 + }, + hierarchicalRepulsion: { + enabled: false, + centralGravity: 0.0, + springLength: 100, + springConstant: 0.01, + nodeDistance: 150, + damping: 0.09 + }, + damping: null, + centralGravity: null, + springLength: null, + springConstant: null + }, + clustering: { // Per Node in Cluster = PNiC + enabled: false, // (Boolean) | global on/off switch for clustering. + initialMaxNodes: 100, // (# nodes) | if the initial amount of nodes is larger than this, we cluster until the total number is less than this threshold. + clusterThreshold:500, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than this. If it is, cluster until reduced to reduceToNodes + reduceToNodes:300, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than clusterThreshold. If it is, cluster until reduced to this + chainThreshold: 0.4, // (% of all drawn nodes)| maximum percentage of allowed chainnodes (long strings of connected nodes) within all nodes. (lower means less chains). + clusterEdgeThreshold: 20, // (px) | edge length threshold. if smaller, this node is clustered. + sectorThreshold: 100, // (# nodes in cluster) | cluster size threshold. If larger, expanding in own sector. + screenSizeThreshold: 0.2, // (% of canvas) | relative size threshold. If the width or height of a clusternode takes up this much of the screen, decluster node. + fontSizeMultiplier: 4.0, // (px PNiC) | how much the cluster font size grows per node in cluster (in px). + maxFontSize: 1000, + forceAmplification: 0.1, // (multiplier PNiC) | factor of increase fo the repulsion force of a cluster (per node in cluster). + distanceAmplification: 0.1, // (multiplier PNiC) | factor how much the repulsion distance of a cluster increases (per node in cluster). + edgeGrowth: 20, // (px PNiC) | amount of clusterSize connected to the edge is multiplied with this and added to edgeLength. + nodeScaling: {width: 1, // (px PNiC) | growth of the width per node in cluster. + height: 1, // (px PNiC) | growth of the height per node in cluster. + radius: 1}, // (px PNiC) | growth of the radius per node in cluster. + maxNodeSizeIncrements: 600, // (# increments) | max growth of the width per node in cluster. + activeAreaBoxSize: 80, // (px) | box area around the curser where clusters are popped open. + clusterLevelDifference: 2 + }, + navigation: { + enabled: false + }, + keyboard: { + enabled: false, + speed: {x: 10, y: 10, zoom: 0.02} + }, + dataManipulation: { + enabled: false, + initiallyVisible: false + }, + hierarchicalLayout: { + enabled:false, + levelSeparation: 150, + nodeSpacing: 100, + direction: "UD" // UD, DU, LR, RL + }, + freezeForStabilization: false, + smoothCurves: { + enabled: true, + dynamic: true, + type: "continuous", + roundness: 0.5 + }, + dynamicSmoothCurves: true, + maxVelocity: 30, + minVelocity: 0.1, // px/s + stabilizationIterations: 1000, // maximum number of iteration to stabilize + labels:{ + add:"Add Node", + edit:"Edit", + link:"Add Link", + del:"Delete selected", + editNode:"Edit Node", + editEdge:"Edit Edge", + back:"Back", + addDescription:"Click in an empty space to place a new node.", + linkDescription:"Click on a node and drag the edge to another node to connect them.", + editEdgeDescription:"Click on the control points and drag them to a node to connect to it.", + addError:"The function for add does not support two arguments (data,callback).", + linkError:"The function for connect does not support two arguments (data,callback).", + editError:"The function for edit does not support two arguments (data, callback).", + editBoundError:"No edit function has been bound to this button.", + deleteError:"The function for delete does not support two arguments (data, callback).", + deleteClusterError:"Clusters cannot be deleted." + }, + tooltip: { + delay: 300, + fontColor: 'black', + fontSize: 14, // px + fontFace: 'verdana', + color: { + border: '#666', + background: '#FFFFC6' + } + }, + dragNetwork: true, + dragNodes: true, + zoomable: true, + hover: false, + hideEdgesOnDrag: false, + hideNodesOnDrag: false + }; + this.hoverObj = {nodes:{},edges:{}}; + this.controlNodesActive = false; + + // Node variables + var network = this; + this.groups = new Groups(); // object with groups + this.images = new Images(); // object with images + this.images.setOnloadCallback(function () { + network._redraw(); + }); + + // keyboard navigation variables + this.xIncrement = 0; + this.yIncrement = 0; + this.zoomIncrement = 0; + + // loading all the mixins: + // load the force calculation functions, grouped under the physics system. + this._loadPhysicsSystem(); + // create a frame and canvas + this._create(); + // load the sector system. (mandatory, fully integrated with Network) + this._loadSectorSystem(); + // load the cluster system. (mandatory, even when not using the cluster system, there are function calls to it) + this._loadClusterSystem(); + // load the selection system. (mandatory, required by Network) + this._loadSelectionSystem(); + // load the selection system. (mandatory, required by Network) + this._loadHierarchySystem(); + + // apply options + this._setTranslation(this.frame.clientWidth / 2, this.frame.clientHeight / 2); + this._setScale(1); + this.setOptions(options); + + // other vars + this.freezeSimulation = false;// freeze the simulation + this.cachedFunctions = {}; + + // containers for nodes and edges + this.calculationNodes = {}; + this.calculationNodeIndices = []; + this.nodeIndices = []; // array with all the indices of the nodes. Used to speed up forces calculation + this.nodes = {}; // object with Node objects + this.edges = {}; // object with Edge objects + + // position and scale variables and objects + this.canvasTopLeft = {"x": 0,"y": 0}; // coordinates of the top left of the canvas. they will be set during _redraw. + this.canvasBottomRight = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw + this.pointerPosition = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw + this.areaCenter = {}; // object with x and y elements used for determining the center of the zoom action + this.scale = 1; // defining the global scale variable in the constructor + this.previousScale = this.scale; // this is used to check if the zoom operation is zooming in or out + + // datasets or dataviews + this.nodesData = null; // A DataSet or DataView + this.edgesData = null; // A DataSet or DataView + + // create event listeners used to subscribe on the DataSets of the nodes and edges + this.nodesListeners = { + 'add': function (event, params) { + network._addNodes(params.items); + network.start(); + }, + 'update': function (event, params) { + network._updateNodes(params.items); + network.start(); + }, + 'remove': function (event, params) { + network._removeNodes(params.items); + network.start(); + } + }; + this.edgesListeners = { + 'add': function (event, params) { + network._addEdges(params.items); + network.start(); + }, + 'update': function (event, params) { + network._updateEdges(params.items); + network.start(); + }, + 'remove': function (event, params) { + network._removeEdges(params.items); + network.start(); + } + }; + + // properties for the animation + this.moving = true; + this.timer = undefined; // Scheduling function. Is definded in this.start(); + + // load data (the disable start variable will be the same as the enabled clustering) + this.setData(data,this.constants.clustering.enabled || this.constants.hierarchicalLayout.enabled); + + // hierarchical layout + this.initializing = false; + if (this.constants.hierarchicalLayout.enabled == true) { + this._setupHierarchicalLayout(); + } + else { + // zoom so all data will fit on the screen, if clustering is enabled, we do not want start to be called here. + if (this.stabilize == false) { + this.zoomExtent(true,this.constants.clustering.enabled); + } + } + + // if clustering is disabled, the simulation will have started in the setData function + if (this.constants.clustering.enabled) { + this.startWithClustering(); + } + } + + // Extend Network with an Emitter mixin + Emitter(Network.prototype); + + /** + * Get the script path where the vis.js library is located + * + * @returns {string | null} path Path or null when not found. Path does not + * end with a slash. + * @private + */ + Network.prototype._getScriptPath = function() { + var scripts = document.getElementsByTagName( 'script' ); + + // find script named vis.js or vis.min.js + for (var i = 0; i < scripts.length; i++) { + var src = scripts[i].src; + var match = src && /\/?vis(.min)?\.js$/.exec(src); + if (match) { + // return path without the script name + return src.substring(0, src.length - match[0].length); + } + } + + return null; + }; + + + /** + * Find the center position of the network + * @private + */ + Network.prototype._getRange = function() { + var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (minX > (node.x)) {minX = node.x;} + if (maxX < (node.x)) {maxX = node.x;} + if (minY > (node.y)) {minY = node.y;} + if (maxY < (node.y)) {maxY = node.y;} + } + } + if (minX == 1e9 && maxX == -1e9 && minY == 1e9 && maxY == -1e9) { + minY = 0, maxY = 0, minX = 0, maxX = 0; + } + return {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; + }; + + + /** + * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; + * @returns {{x: number, y: number}} + * @private + */ + Network.prototype._findCenter = function(range) { + return {x: (0.5 * (range.maxX + range.minX)), + y: (0.5 * (range.maxY + range.minY))}; + }; + + + /** + * center the network + * + * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; + */ + Network.prototype._centerNetwork = function(range) { + var center = this._findCenter(range); + + center.x *= this.scale; + center.y *= this.scale; + center.x -= 0.5 * this.frame.canvas.clientWidth; + center.y -= 0.5 * this.frame.canvas.clientHeight; + + this._setTranslation(-center.x,-center.y); // set at 0,0 + }; + + + /** + * This function zooms out to fit all data on screen based on amount of nodes + * + * @param {Boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false; + * @param {Boolean} [disableStart] | If true, start is not called. + */ + Network.prototype.zoomExtent = function(initialZoom, disableStart) { + if (initialZoom === undefined) { + initialZoom = false; + } + if (disableStart === undefined) { + disableStart = false; + } + + var range = this._getRange(); + var zoomLevel; + + if (initialZoom == true) { + var numberOfNodes = this.nodeIndices.length; + if (this.constants.smoothCurves == true) { + if (this.constants.clustering.enabled == true && + numberOfNodes >= this.constants.clustering.initialMaxNodes) { + zoomLevel = 49.07548 / (numberOfNodes + 142.05338) + 9.1444e-04; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. + } + else { + zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. + } + } + else { + if (this.constants.clustering.enabled == true && + numberOfNodes >= this.constants.clustering.initialMaxNodes) { + zoomLevel = 77.5271985 / (numberOfNodes + 187.266146) + 4.76710517e-05; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. + } + else { + zoomLevel = 30.5062972 / (numberOfNodes + 19.93597763) + 0.08413486; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. + } + } + + // correct for larger canvasses. + var factor = Math.min(this.frame.canvas.clientWidth / 600, this.frame.canvas.clientHeight / 600); + zoomLevel *= factor; + } + else { + var xDistance = (Math.abs(range.minX) + Math.abs(range.maxX)) * 1.1; + var yDistance = (Math.abs(range.minY) + Math.abs(range.maxY)) * 1.1; + + var xZoomLevel = this.frame.canvas.clientWidth / xDistance; + var yZoomLevel = this.frame.canvas.clientHeight / yDistance; + + zoomLevel = (xZoomLevel <= yZoomLevel) ? xZoomLevel : yZoomLevel; + } + + if (zoomLevel > 1.0) { + zoomLevel = 1.0; + } + + + this._setScale(zoomLevel); + this._centerNetwork(range); + if (disableStart == false) { + this.moving = true; + this.start(); + } + }; + + + /** + * Update the this.nodeIndices with the most recent node index list + * @private + */ + Network.prototype._updateNodeIndexList = function() { + this._clearNodeIndexList(); + for (var idx in this.nodes) { + if (this.nodes.hasOwnProperty(idx)) { + this.nodeIndices.push(idx); + } + } + }; + + + /** + * Set nodes and edges, and optionally options as well. + * + * @param {Object} data Object containing parameters: + * {Array | DataSet | DataView} [nodes] Array with nodes + * {Array | DataSet | DataView} [edges] Array with edges + * {String} [dot] String containing data in DOT format + * {String} [gephi] String containing data in gephi JSON format + * {Options} [options] Object with options + * @param {Boolean} [disableStart] | optional: disable the calling of the start function. + */ + Network.prototype.setData = function(data, disableStart) { + if (disableStart === undefined) { + disableStart = false; + } + + if (data && data.dot && (data.nodes || data.edges)) { + throw new SyntaxError('Data must contain either parameter "dot" or ' + + ' parameter pair "nodes" and "edges", but not both.'); + } + + // set options + this.setOptions(data && data.options); + + // set all data + if (data && data.dot) { + // parse DOT file + if(data && data.dot) { + var dotData = dotparser.DOTToGraph(data.dot); + this.setData(dotData); + return; + } + } + else if (data && data.gephi) { + // parse DOT file + if(data && data.gephi) { + var gephiData = gephiParser.parseGephi(data.gephi); + this.setData(gephiData); + return; + } + } + else { + this._setNodes(data && data.nodes); + this._setEdges(data && data.edges); + } + + this._putDataInSector(); + if (!disableStart) { + // find a stable position or start animating to a stable position + if (this.stabilize) { + var me = this; + setTimeout(function() {me._stabilize(); me.start();},0) + } + else { + this.start(); + } + } + }; + + /** + * Set options + * @param {Object} options + * @param {Boolean} [initializeView] | set zoom and translation to default. + */ + Network.prototype.setOptions = function (options) { + if (options) { + var prop; + // retrieve parameter values + if (options.width !== undefined) {this.width = options.width;} + if (options.height !== undefined) {this.height = options.height;} + if (options.stabilize !== undefined) {this.stabilize = options.stabilize;} + if (options.selectable !== undefined) {this.selectable = options.selectable;} + if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;} + if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;} + if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;} + if (options.dragNetwork !== undefined) {this.constants.dragNetwork = options.dragNetwork;} + if (options.dragNodes !== undefined) {this.constants.dragNodes = options.dragNodes;} + if (options.zoomable !== undefined) {this.constants.zoomable = options.zoomable;} + if (options.hover !== undefined) {this.constants.hover = options.hover;} + if (options.hideEdgesOnDrag !== undefined) {this.constants.hideEdgesOnDrag = options.hideEdgesOnDrag;} + if (options.hideNodesOnDrag !== undefined) {this.constants.hideNodesOnDrag = options.hideNodesOnDrag;} + + // TODO: deprecated since version 3.0.0. Cleanup some day + if (options.dragGraph !== undefined) { + throw new Error('Option dragGraph is renamed to dragNetwork'); + } + + if (options.labels !== undefined) { + for (prop in options.labels) { + if (options.labels.hasOwnProperty(prop)) { + this.constants.labels[prop] = options.labels[prop]; + } + } + } + + if (options.onAdd) { + this.triggerFunctions.add = options.onAdd; + } + + if (options.onEdit) { + this.triggerFunctions.edit = options.onEdit; + } + + if (options.onEditEdge) { + this.triggerFunctions.editEdge = options.onEditEdge; + } + + if (options.onConnect) { + this.triggerFunctions.connect = options.onConnect; + } + + if (options.onDelete) { + this.triggerFunctions.del = options.onDelete; + } + + if (options.physics) { + if (options.physics.barnesHut) { + this.constants.physics.barnesHut.enabled = true; + for (prop in options.physics.barnesHut) { + if (options.physics.barnesHut.hasOwnProperty(prop)) { + this.constants.physics.barnesHut[prop] = options.physics.barnesHut[prop]; + } + } + } + + if (options.physics.repulsion) { + this.constants.physics.barnesHut.enabled = false; + for (prop in options.physics.repulsion) { + if (options.physics.repulsion.hasOwnProperty(prop)) { + this.constants.physics.repulsion[prop] = options.physics.repulsion[prop]; + } + } + } + + if (options.physics.hierarchicalRepulsion) { + this.constants.hierarchicalLayout.enabled = true; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this.constants.physics.barnesHut.enabled = false; + for (prop in options.physics.hierarchicalRepulsion) { + if (options.physics.hierarchicalRepulsion.hasOwnProperty(prop)) { + this.constants.physics.hierarchicalRepulsion[prop] = options.physics.hierarchicalRepulsion[prop]; + } + } + } + } + + if (options.smoothCurves !== undefined) { + if (typeof options.smoothCurves == 'boolean') { + this.constants.smoothCurves.enabled = options.smoothCurves; + } + else { + this.constants.smoothCurves.enabled = true; + for (prop in options.smoothCurves) { + if (options.smoothCurves.hasOwnProperty(prop)) { + this.constants.smoothCurves[prop] = options.smoothCurves[prop]; + } + } + } + } + + if (options.hierarchicalLayout) { + this.constants.hierarchicalLayout.enabled = true; + for (prop in options.hierarchicalLayout) { + if (options.hierarchicalLayout.hasOwnProperty(prop)) { + this.constants.hierarchicalLayout[prop] = options.hierarchicalLayout[prop]; + } + } + } + else if (options.hierarchicalLayout !== undefined) { + this.constants.hierarchicalLayout.enabled = false; + } + + if (options.clustering) { + this.constants.clustering.enabled = true; + for (prop in options.clustering) { + if (options.clustering.hasOwnProperty(prop)) { + this.constants.clustering[prop] = options.clustering[prop]; + } + } + } + else if (options.clustering !== undefined) { + this.constants.clustering.enabled = false; + } + + if (options.navigation) { + this.constants.navigation.enabled = true; + for (prop in options.navigation) { + if (options.navigation.hasOwnProperty(prop)) { + this.constants.navigation[prop] = options.navigation[prop]; + } + } + } + else if (options.navigation !== undefined) { + this.constants.navigation.enabled = false; + } + + if (options.keyboard) { + this.constants.keyboard.enabled = true; + for (prop in options.keyboard) { + if (options.keyboard.hasOwnProperty(prop)) { + this.constants.keyboard[prop] = options.keyboard[prop]; + } + } + } + else if (options.keyboard !== undefined) { + this.constants.keyboard.enabled = false; + } + + if (options.dataManipulation) { + this.constants.dataManipulation.enabled = true; + for (prop in options.dataManipulation) { + if (options.dataManipulation.hasOwnProperty(prop)) { + this.constants.dataManipulation[prop] = options.dataManipulation[prop]; + } + } + this.editMode = this.constants.dataManipulation.initiallyVisible; + } + else if (options.dataManipulation !== undefined) { + this.constants.dataManipulation.enabled = false; + } + + // TODO: work out these options and document them + if (options.edges) { + for (prop in options.edges) { + if (options.edges.hasOwnProperty(prop)) { + if (typeof options.edges[prop] != "object") { + this.constants.edges[prop] = options.edges[prop]; + } + } + } + + if (options.edges.color !== undefined) { + if (util.isString(options.edges.color)) { + this.constants.edges.color = {}; + this.constants.edges.color.color = options.edges.color; + this.constants.edges.color.highlight = options.edges.color; + this.constants.edges.color.hover = options.edges.color; + } + else { + if (options.edges.color.color !== undefined) {this.constants.edges.color.color = options.edges.color.color;} + if (options.edges.color.highlight !== undefined) {this.constants.edges.color.highlight = options.edges.color.highlight;} + if (options.edges.color.hover !== undefined) {this.constants.edges.color.hover = options.edges.color.hover;} + } + } + + if (!options.edges.fontColor) { + if (options.edges.color !== undefined) { + if (util.isString(options.edges.color)) {this.constants.edges.fontColor = options.edges.color;} + else if (options.edges.color.color !== undefined) {this.constants.edges.fontColor = options.edges.color.color;} + } + } + + // Added to support dashed lines + // David Jordan + // 2012-08-08 + if (options.edges.dash) { + if (options.edges.dash.length !== undefined) { + this.constants.edges.dash.length = options.edges.dash.length; + } + if (options.edges.dash.gap !== undefined) { + this.constants.edges.dash.gap = options.edges.dash.gap; + } + if (options.edges.dash.altLength !== undefined) { + this.constants.edges.dash.altLength = options.edges.dash.altLength; + } + } + } + + if (options.nodes) { + for (prop in options.nodes) { + if (options.nodes.hasOwnProperty(prop)) { + this.constants.nodes[prop] = options.nodes[prop]; + } + } + + if (options.nodes.color) { + this.constants.nodes.color = util.parseColor(options.nodes.color); + } + + /* + if (options.nodes.widthMin) this.constants.nodes.radiusMin = options.nodes.widthMin; + if (options.nodes.widthMax) this.constants.nodes.radiusMax = options.nodes.widthMax; + */ + } + if (options.groups) { + for (var groupname in options.groups) { + if (options.groups.hasOwnProperty(groupname)) { + var group = options.groups[groupname]; + this.groups.add(groupname, group); + } + } + } + + if (options.tooltip) { + for (prop in options.tooltip) { + if (options.tooltip.hasOwnProperty(prop)) { + this.constants.tooltip[prop] = options.tooltip[prop]; + } + } + if (options.tooltip.color) { + this.constants.tooltip.color = util.parseColor(options.tooltip.color); + } + } + } + + + // (Re)loading the mixins that can be enabled or disabled in the options. + // load the force calculation functions, grouped under the physics system. + this._loadPhysicsSystem(); + // load the navigation system. + this._loadNavigationControls(); + // load the data manipulation system + this._loadManipulationSystem(); + // configure the smooth curves + this._configureSmoothCurves(); + + + // bind keys. If disabled, this will not do anything; + this._createKeyBinds(); + this.setSize(this.width, this.height); + this.moving = true; + this.start(); + + }; + + /** + * Create the main frame for the Network. + * This function is executed once when a Network object is created. The frame + * contains a canvas, and this canvas contains all objects like the axis and + * nodes. + * @private + */ + Network.prototype._create = function () { + // remove all elements from the container element. + while (this.containerElement.hasChildNodes()) { + this.containerElement.removeChild(this.containerElement.firstChild); + } + + this.frame = document.createElement('div'); + this.frame.className = 'network-frame'; + this.frame.style.position = 'relative'; + this.frame.style.overflow = 'hidden'; + + // create the network canvas (HTML canvas element) + this.frame.canvas = document.createElement( 'canvas' ); + this.frame.canvas.style.position = 'relative'; + this.frame.appendChild(this.frame.canvas); + if (!this.frame.canvas.getContext) { + var noCanvas = document.createElement( 'DIV' ); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold' ; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.frame.canvas.appendChild(noCanvas); + } + + var me = this; + this.drag = {}; + this.pinch = {}; + this.hammer = Hammer(this.frame.canvas, { + prevent_default: true + }); + this.hammer.on('tap', me._onTap.bind(me) ); + this.hammer.on('doubletap', me._onDoubleTap.bind(me) ); + this.hammer.on('hold', me._onHold.bind(me) ); + this.hammer.on('pinch', me._onPinch.bind(me) ); + this.hammer.on('touch', me._onTouch.bind(me) ); + this.hammer.on('dragstart', me._onDragStart.bind(me) ); + this.hammer.on('drag', me._onDrag.bind(me) ); + this.hammer.on('dragend', me._onDragEnd.bind(me) ); + this.hammer.on('release', me._onRelease.bind(me) ); + this.hammer.on('mousewheel',me._onMouseWheel.bind(me) ); + this.hammer.on('DOMMouseScroll',me._onMouseWheel.bind(me) ); // for FF + this.hammer.on('mousemove', me._onMouseMoveTitle.bind(me) ); + + // add the frame to the container element + this.containerElement.appendChild(this.frame); + + }; + + + /** + * Binding the keys for keyboard navigation. These functions are defined in the NavigationMixin + * @private + */ + Network.prototype._createKeyBinds = function() { + var me = this; + this.mousetrap = mousetrap; + + this.mousetrap.reset(); + + if (this.constants.keyboard.enabled == true) { + this.mousetrap.bind("up", this._moveUp.bind(me) , "keydown"); + this.mousetrap.bind("up", this._yStopMoving.bind(me), "keyup"); + this.mousetrap.bind("down", this._moveDown.bind(me) , "keydown"); + this.mousetrap.bind("down", this._yStopMoving.bind(me), "keyup"); + this.mousetrap.bind("left", this._moveLeft.bind(me) , "keydown"); + this.mousetrap.bind("left", this._xStopMoving.bind(me), "keyup"); + this.mousetrap.bind("right",this._moveRight.bind(me), "keydown"); + this.mousetrap.bind("right",this._xStopMoving.bind(me), "keyup"); + this.mousetrap.bind("=", this._zoomIn.bind(me), "keydown"); + this.mousetrap.bind("=", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("-", this._zoomOut.bind(me), "keydown"); + this.mousetrap.bind("-", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("[", this._zoomIn.bind(me), "keydown"); + this.mousetrap.bind("[", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("]", this._zoomOut.bind(me), "keydown"); + this.mousetrap.bind("]", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("pageup",this._zoomIn.bind(me), "keydown"); + this.mousetrap.bind("pageup",this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("pagedown",this._zoomOut.bind(me),"keydown"); + this.mousetrap.bind("pagedown",this._stopZoom.bind(me), "keyup"); + } + + if (this.constants.dataManipulation.enabled == true) { + this.mousetrap.bind("escape",this._createManipulatorBar.bind(me)); + this.mousetrap.bind("del",this._deleteSelected.bind(me)); + } + }; + + /** + * Get the pointer location from a touch location + * @param {{pageX: Number, pageY: Number}} touch + * @return {{x: Number, y: Number}} pointer + * @private + */ + Network.prototype._getPointer = function (touch) { + return { + x: touch.pageX - util.getAbsoluteLeft(this.frame.canvas), + y: touch.pageY - util.getAbsoluteTop(this.frame.canvas) + }; + }; + + /** + * On start of a touch gesture, store the pointer + * @param event + * @private + */ + Network.prototype._onTouch = function (event) { + this.drag.pointer = this._getPointer(event.gesture.center); + this.drag.pinched = false; + this.pinch.scale = this._getScale(); + + this._handleTouch(this.drag.pointer); + }; + + /** + * handle drag start event + * @private + */ + Network.prototype._onDragStart = function () { + this._handleDragStart(); + }; + + + /** + * This function is called by _onDragStart. + * It is separated out because we can then overload it for the datamanipulation system. + * + * @private + */ + Network.prototype._handleDragStart = function() { + var drag = this.drag; + var node = this._getNodeAt(drag.pointer); + // note: drag.pointer is set in _onTouch to get the initial touch location + + drag.dragging = true; + drag.selection = []; + drag.translation = this._getTranslation(); + drag.nodeId = null; + + if (node != null) { + drag.nodeId = node.id; + // select the clicked node if not yet selected + if (!node.isSelected()) { + this._selectObject(node,false); + } + + // create an array with the selected nodes and their original location and status + for (var objectId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(objectId)) { + var object = this.selectionObj.nodes[objectId]; + var s = { + id: object.id, + node: object, + + // store original x, y, xFixed and yFixed, make the node temporarily Fixed + x: object.x, + y: object.y, + xFixed: object.xFixed, + yFixed: object.yFixed + }; + + object.xFixed = true; + object.yFixed = true; + + drag.selection.push(s); + } + } + } + }; + + + /** + * handle drag event + * @private + */ + Network.prototype._onDrag = function (event) { + this._handleOnDrag(event) + }; + + + /** + * This function is called by _onDrag. + * It is separated out because we can then overload it for the datamanipulation system. + * + * @private + */ + Network.prototype._handleOnDrag = function(event) { + if (this.drag.pinched) { + return; + } + + var pointer = this._getPointer(event.gesture.center); + + var me = this; + var drag = this.drag; + var selection = drag.selection; + if (selection && selection.length && this.constants.dragNodes == true) { + // calculate delta's and new location + var deltaX = pointer.x - drag.pointer.x; + var deltaY = pointer.y - drag.pointer.y; + + // update position of all selected nodes + selection.forEach(function (s) { + var node = s.node; + + if (!s.xFixed) { + node.x = me._XconvertDOMtoCanvas(me._XconvertCanvasToDOM(s.x) + deltaX); + } + + if (!s.yFixed) { + node.y = me._YconvertDOMtoCanvas(me._YconvertCanvasToDOM(s.y) + deltaY); + } + }); + + + // start _animationStep if not yet running + if (!this.moving) { + this.moving = true; + this.start(); + } + } + else { + if (this.constants.dragNetwork == true) { + // move the network + var diffX = pointer.x - this.drag.pointer.x; + var diffY = pointer.y - this.drag.pointer.y; + + this._setTranslation( + this.drag.translation.x + diffX, + this.drag.translation.y + diffY + ); + this._redraw(); + // this.moving = true; + // this.start(); + } + } + }; + + /** + * handle drag start event + * @private + */ + Network.prototype._onDragEnd = function () { + this.drag.dragging = false; + var selection = this.drag.selection; + if (selection && selection.length) { + selection.forEach(function (s) { + // restore original xFixed and yFixed + s.node.xFixed = s.xFixed; + s.node.yFixed = s.yFixed; + }); + this.moving = true; + this.start(); + } + else { + this._redraw(); + } + + }; + + /** + * handle tap/click event: select/unselect a node + * @private + */ + Network.prototype._onTap = function (event) { + var pointer = this._getPointer(event.gesture.center); + this.pointerPosition = pointer; + this._handleTap(pointer); + + }; + + + /** + * handle doubletap event + * @private + */ + Network.prototype._onDoubleTap = function (event) { + var pointer = this._getPointer(event.gesture.center); + this._handleDoubleTap(pointer); + }; + + + /** + * handle long tap event: multi select nodes + * @private + */ + Network.prototype._onHold = function (event) { + var pointer = this._getPointer(event.gesture.center); + this.pointerPosition = pointer; + this._handleOnHold(pointer); + }; + + /** + * handle the release of the screen + * + * @private + */ + Network.prototype._onRelease = function (event) { + var pointer = this._getPointer(event.gesture.center); + this._handleOnRelease(pointer); + }; + + /** + * Handle pinch event + * @param event + * @private + */ + Network.prototype._onPinch = function (event) { + var pointer = this._getPointer(event.gesture.center); + + this.drag.pinched = true; + if (!('scale' in this.pinch)) { + this.pinch.scale = 1; + } + + // TODO: enabled moving while pinching? + var scale = this.pinch.scale * event.gesture.scale; + this._zoom(scale, pointer) + }; + + /** + * Zoom the network in or out + * @param {Number} scale a number around 1, and between 0.01 and 10 + * @param {{x: Number, y: Number}} pointer Position on screen + * @return {Number} appliedScale scale is limited within the boundaries + * @private + */ + Network.prototype._zoom = function(scale, pointer) { + if (this.constants.zoomable == true) { + var scaleOld = this._getScale(); + if (scale < 0.00001) { + scale = 0.00001; + } + if (scale > 10) { + scale = 10; + } + + var preScaleDragPointer = null; + if (this.drag !== undefined) { + if (this.drag.dragging == true) { + preScaleDragPointer = this.DOMtoCanvas(this.drag.pointer); + } + } + // + this.frame.canvas.clientHeight / 2 + var translation = this._getTranslation(); + + var scaleFrac = scale / scaleOld; + var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac; + var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac; + + this.areaCenter = {"x" : this._XconvertDOMtoCanvas(pointer.x), + "y" : this._YconvertDOMtoCanvas(pointer.y)}; + + this._setScale(scale); + this._setTranslation(tx, ty); + this.updateClustersDefault(); + + if (preScaleDragPointer != null) { + var postScaleDragPointer = this.canvasToDOM(preScaleDragPointer); + this.drag.pointer.x = postScaleDragPointer.x; + this.drag.pointer.y = postScaleDragPointer.y; + } + + this._redraw(); + + if (scaleOld < scale) { + this.emit("zoom", {direction:"+"}); + } + else { + this.emit("zoom", {direction:"-"}); + } + + return scale; + } + }; + + + /** + * Event handler for mouse wheel event, used to zoom the timeline + * See http://adomas.org/javascript-mouse-wheel/ + * https://github.com/EightMedia/hammer.js/issues/256 + * @param {MouseEvent} event + * @private + */ + Network.prototype._onMouseWheel = function(event) { + // retrieve delta + var delta = 0; + if (event.wheelDelta) { /* IE/Opera. */ + delta = event.wheelDelta/120; + } else if (event.detail) { /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail/3; + } + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + + // calculate the new scale + var scale = this._getScale(); + var zoom = delta / 10; + if (delta < 0) { + zoom = zoom / (1 - zoom); + } + scale *= (1 + zoom); + + // calculate the pointer location + var gesture = hammerUtil.fakeGesture(this, event); + var pointer = this._getPointer(gesture.center); + + // apply the new scale + this._zoom(scale, pointer); + } + + // Prevent default actions caused by mouse wheel. + event.preventDefault(); + }; + + + /** + * Mouse move handler for checking whether the title moves over a node with a title. + * @param {Event} event + * @private + */ + Network.prototype._onMouseMoveTitle = function (event) { + var gesture = hammerUtil.fakeGesture(this, event); + var pointer = this._getPointer(gesture.center); + + // check if the previously selected node is still selected + if (this.popupObj) { + this._checkHidePopup(pointer); + } + + // start a timeout that will check if the mouse is positioned above + // an element + var me = this; + var checkShow = function() { + me._checkShowPopup(pointer); + }; + if (this.popupTimer) { + clearInterval(this.popupTimer); // stop any running calculationTimer + } + if (!this.drag.dragging) { + this.popupTimer = setTimeout(checkShow, this.constants.tooltip.delay); + } + + + /** + * Adding hover highlights + */ + if (this.constants.hover == true) { + // removing all hover highlights + for (var edgeId in this.hoverObj.edges) { + if (this.hoverObj.edges.hasOwnProperty(edgeId)) { + this.hoverObj.edges[edgeId].hover = false; + delete this.hoverObj.edges[edgeId]; + } + } + + // adding hover highlights + var obj = this._getNodeAt(pointer); + if (obj == null) { + obj = this._getEdgeAt(pointer); + } + if (obj != null) { + this._hoverObject(obj); + } + + // removing all node hover highlights except for the selected one. + for (var nodeId in this.hoverObj.nodes) { + if (this.hoverObj.nodes.hasOwnProperty(nodeId)) { + if (obj instanceof Node && obj.id != nodeId || obj instanceof Edge || obj == null) { + this._blurObject(this.hoverObj.nodes[nodeId]); + delete this.hoverObj.nodes[nodeId]; + } + } + } + this.redraw(); + } + }; + + /** + * Check if there is an element on the given position in the network + * (a node or edge). If so, and if this element has a title, + * show a popup window with its title. + * + * @param {{x:Number, y:Number}} pointer + * @private + */ + Network.prototype._checkShowPopup = function (pointer) { + var obj = { + left: this._XconvertDOMtoCanvas(pointer.x), + top: this._YconvertDOMtoCanvas(pointer.y), + right: this._XconvertDOMtoCanvas(pointer.x), + bottom: this._YconvertDOMtoCanvas(pointer.y) + }; + + var id; + var lastPopupNode = this.popupObj; + + if (this.popupObj == undefined) { + // search the nodes for overlap, select the top one in case of multiple nodes + var nodes = this.nodes; + for (id in nodes) { + if (nodes.hasOwnProperty(id)) { + var node = nodes[id]; + if (node.getTitle() !== undefined && node.isOverlappingWith(obj)) { + this.popupObj = node; + break; + } + } + } + } + + if (this.popupObj === undefined) { + // search the edges for overlap + var edges = this.edges; + for (id in edges) { + if (edges.hasOwnProperty(id)) { + var edge = edges[id]; + if (edge.connected && (edge.getTitle() !== undefined) && + edge.isOverlappingWith(obj)) { + this.popupObj = edge; + break; + } + } + } + } + + if (this.popupObj) { + // show popup message window + if (this.popupObj != lastPopupNode) { + var me = this; + if (!me.popup) { + me.popup = new Popup(me.frame, me.constants.tooltip); + } + + // adjust a small offset such that the mouse cursor is located in the + // bottom left location of the popup, and you can easily move over the + // popup area + me.popup.setPosition(pointer.x - 3, pointer.y - 3); + me.popup.setText(me.popupObj.getTitle()); + me.popup.show(); + } + } + else { + if (this.popup) { + this.popup.hide(); + } + } + }; + + + /** + * Check if the popup must be hided, which is the case when the mouse is no + * longer hovering on the object + * @param {{x:Number, y:Number}} pointer + * @private + */ + Network.prototype._checkHidePopup = function (pointer) { + if (!this.popupObj || !this._getNodeAt(pointer) ) { + this.popupObj = undefined; + if (this.popup) { + this.popup.hide(); + } + } + }; + + + /** + * Set a new size for the network + * @param {string} width Width in pixels or percentage (for example '800px' + * or '50%') + * @param {string} height Height in pixels or percentage (for example '400px' + * or '30%') + */ + Network.prototype.setSize = function(width, height) { + this.frame.style.width = width; + this.frame.style.height = height; + + this.frame.canvas.style.width = '100%'; + this.frame.canvas.style.height = '100%'; + + this.frame.canvas.width = this.frame.canvas.clientWidth; + this.frame.canvas.height = this.frame.canvas.clientHeight; + + if (this.manipulationDiv !== undefined) { + this.manipulationDiv.style.width = this.frame.canvas.clientWidth + "px"; + } + if (this.navigationDivs !== undefined) { + if (this.navigationDivs['wrapper'] !== undefined) { + this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; + this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; + } + } + + this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height}); + }; + + /** + * Set a data set with nodes for the network + * @param {Array | DataSet | DataView} nodes The data containing the nodes. + * @private + */ + Network.prototype._setNodes = function(nodes) { + var oldNodesData = this.nodesData; + + if (nodes instanceof DataSet || nodes instanceof DataView) { + this.nodesData = nodes; + } + else if (nodes instanceof Array) { + this.nodesData = new DataSet(); + this.nodesData.add(nodes); + } + else if (!nodes) { + this.nodesData = new DataSet(); + } + else { + throw new TypeError('Array or DataSet expected'); + } + + if (oldNodesData) { + // unsubscribe from old dataset + util.forEach(this.nodesListeners, function (callback, event) { + oldNodesData.off(event, callback); + }); + } + + // remove drawn nodes + this.nodes = {}; + + if (this.nodesData) { + // subscribe to new dataset + var me = this; + util.forEach(this.nodesListeners, function (callback, event) { + me.nodesData.on(event, callback); + }); + + // draw all new nodes + var ids = this.nodesData.getIds(); + this._addNodes(ids); + } + this._updateSelection(); + }; + + /** + * Add nodes + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._addNodes = function(ids) { + var id; + for (var i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + var data = this.nodesData.get(id); + var node = new Node(data, this.images, this.groups, this.constants); + this.nodes[id] = node; // note: this may replace an existing node + + if ((node.xFixed == false || node.yFixed == false) && (node.x === null || node.y === null)) { + var radius = 10 * 0.1*ids.length; + var angle = 2 * Math.PI * Math.random(); + if (node.xFixed == false) {node.x = radius * Math.cos(angle);} + if (node.yFixed == false) {node.y = radius * Math.sin(angle);} + } + this.moving = true; + } + this._updateNodeIndexList(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateCalculationNodes(); + this._reconnectEdges(); + this._updateValueRange(this.nodes); + this.updateLabels(); + }; + + /** + * Update existing nodes, or create them when not yet existing + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._updateNodes = function(ids) { + var nodes = this.nodes, + nodesData = this.nodesData; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + var node = nodes[id]; + var data = nodesData.get(id); + if (node) { + // update node + node.setProperties(data, this.constants); + } + else { + // create node + node = new Node(properties, this.images, this.groups, this.constants); + nodes[id] = node; + } + } + this.moving = true; + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateNodeIndexList(); + this._reconnectEdges(); + this._updateValueRange(nodes); + }; + + /** + * Remove existing nodes. If nodes do not exist, the method will just ignore it. + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._removeNodes = function(ids) { + var nodes = this.nodes; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + delete nodes[id]; + } + this._updateNodeIndexList(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateCalculationNodes(); + this._reconnectEdges(); + this._updateSelection(); + this._updateValueRange(nodes); + }; + + /** + * Load edges by reading the data table + * @param {Array | DataSet | DataView} edges The data containing the edges. + * @private + * @private + */ + Network.prototype._setEdges = function(edges) { + var oldEdgesData = this.edgesData; + + if (edges instanceof DataSet || edges instanceof DataView) { + this.edgesData = edges; + } + else if (edges instanceof Array) { + this.edgesData = new DataSet(); + this.edgesData.add(edges); + } + else if (!edges) { + this.edgesData = new DataSet(); + } + else { + throw new TypeError('Array or DataSet expected'); + } + + if (oldEdgesData) { + // unsubscribe from old dataset + util.forEach(this.edgesListeners, function (callback, event) { + oldEdgesData.off(event, callback); + }); + } + + // remove drawn edges + this.edges = {}; + + if (this.edgesData) { + // subscribe to new dataset + var me = this; + util.forEach(this.edgesListeners, function (callback, event) { + me.edgesData.on(event, callback); + }); + + // draw all new nodes + var ids = this.edgesData.getIds(); + this._addEdges(ids); + } + + this._reconnectEdges(); + }; + + /** + * Add edges + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._addEdges = function (ids) { + var edges = this.edges, + edgesData = this.edgesData; + + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + + var oldEdge = edges[id]; + if (oldEdge) { + oldEdge.disconnect(); + } + + var data = edgesData.get(id, {"showInternalIds" : true}); + edges[id] = new Edge(data, this, this.constants); + } + + this.moving = true; + this._updateValueRange(edges); + this._createBezierNodes(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateCalculationNodes(); + }; + + /** + * Update existing edges, or create them when not yet existing + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._updateEdges = function (ids) { + var edges = this.edges, + edgesData = this.edgesData; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + + var data = edgesData.get(id); + var edge = edges[id]; + if (edge) { + // update edge + edge.disconnect(); + edge.setProperties(data, this.constants); + edge.connect(); + } + else { + // create edge + edge = new Edge(data, this, this.constants); + this.edges[id] = edge; + } + } + + this._createBezierNodes(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this.moving = true; + this._updateValueRange(edges); + }; + + /** + * Remove existing edges. Non existing ids will be ignored + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._removeEdges = function (ids) { + var edges = this.edges; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + var edge = edges[id]; + if (edge) { + if (edge.via != null) { + delete this.sectors['support']['nodes'][edge.via.id]; + } + edge.disconnect(); + delete edges[id]; + } + } + + this.moving = true; + this._updateValueRange(edges); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateCalculationNodes(); + }; + + /** + * Reconnect all edges + * @private + */ + Network.prototype._reconnectEdges = function() { + var id, + nodes = this.nodes, + edges = this.edges; + for (id in nodes) { + if (nodes.hasOwnProperty(id)) { + nodes[id].edges = []; + } + } + + for (id in edges) { + if (edges.hasOwnProperty(id)) { + var edge = edges[id]; + edge.from = null; + edge.to = null; + edge.connect(); + } + } + }; + + /** + * Update the values of all object in the given array according to the current + * value range of the objects in the array. + * @param {Object} obj An object containing a set of Edges or Nodes + * The objects must have a method getValue() and + * setValueRange(min, max). + * @private + */ + Network.prototype._updateValueRange = function(obj) { + var id; + + // determine the range of the objects + var valueMin = undefined; + var valueMax = undefined; + for (id in obj) { + if (obj.hasOwnProperty(id)) { + var value = obj[id].getValue(); + if (value !== undefined) { + valueMin = (valueMin === undefined) ? value : Math.min(value, valueMin); + valueMax = (valueMax === undefined) ? value : Math.max(value, valueMax); + } + } + } + + // adjust the range of all objects + if (valueMin !== undefined && valueMax !== undefined) { + for (id in obj) { + if (obj.hasOwnProperty(id)) { + obj[id].setValueRange(valueMin, valueMax); + } + } + } + }; + + /** + * Redraw the network with the current data + * chart will be resized too. + */ + Network.prototype.redraw = function() { + this.setSize(this.width, this.height); + this._redraw(); + }; + + /** + * Redraw the network with the current data + * @private + */ + Network.prototype._redraw = function() { + var ctx = this.frame.canvas.getContext('2d'); + // clear the canvas + var w = this.frame.canvas.width; + var h = this.frame.canvas.height; + ctx.clearRect(0, 0, w, h); + + // set scaling and translation + ctx.save(); + ctx.translate(this.translation.x, this.translation.y); + ctx.scale(this.scale, this.scale); + + this.canvasTopLeft = { + "x": this._XconvertDOMtoCanvas(0), + "y": this._YconvertDOMtoCanvas(0) + }; + this.canvasBottomRight = { + "x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth), + "y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight) + }; + + + this._doInAllSectors("_drawAllSectorNodes",ctx); + if (this.drag.dragging == false || this.drag.dragging === undefined || this.constants.hideEdgesOnDrag == false) { + this._doInAllSectors("_drawEdges",ctx); + } + + if (this.drag.dragging == false || this.drag.dragging === undefined || this.constants.hideNodesOnDrag == false) { + this._doInAllSectors("_drawNodes",ctx,false); + } + + if (this.controlNodesActive == true) { + this._doInAllSectors("_drawControlNodes",ctx); + } + + // this._doInSupportSector("_drawNodes",ctx,true); + // this._drawTree(ctx,"#F00F0F"); + + // restore original scaling and translation + ctx.restore(); + }; + + /** + * Set the translation of the network + * @param {Number} offsetX Horizontal offset + * @param {Number} offsetY Vertical offset + * @private + */ + Network.prototype._setTranslation = function(offsetX, offsetY) { + if (this.translation === undefined) { + this.translation = { + x: 0, + y: 0 + }; + } + + if (offsetX !== undefined) { + this.translation.x = offsetX; + } + if (offsetY !== undefined) { + this.translation.y = offsetY; + } + + this.emit('viewChanged'); + }; + + /** + * Get the translation of the network + * @return {Object} translation An object with parameters x and y, both a number + * @private + */ + Network.prototype._getTranslation = function() { + return { + x: this.translation.x, + y: this.translation.y + }; + }; + + /** + * Scale the network + * @param {Number} scale Scaling factor 1.0 is unscaled + * @private + */ + Network.prototype._setScale = function(scale) { + this.scale = scale; + }; + + /** + * Get the current scale of the network + * @return {Number} scale Scaling factor 1.0 is unscaled + * @private + */ + Network.prototype._getScale = function() { + return this.scale; + }; + + /** + * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to + * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) + * @param {number} x + * @returns {number} + * @private + */ + Network.prototype._XconvertDOMtoCanvas = function(x) { + return (x - this.translation.x) / this.scale; + }; + + /** + * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to + * the X coordinate in DOM-space (coordinate point in browser relative to the container div) + * @param {number} x + * @returns {number} + * @private + */ + Network.prototype._XconvertCanvasToDOM = function(x) { + return x * this.scale + this.translation.x; + }; + + /** + * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to + * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) + * @param {number} y + * @returns {number} + * @private + */ + Network.prototype._YconvertDOMtoCanvas = function(y) { + return (y - this.translation.y) / this.scale; + }; + + /** + * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to + * the Y coordinate in DOM-space (coordinate point in browser relative to the container div) + * @param {number} y + * @returns {number} + * @private + */ + Network.prototype._YconvertCanvasToDOM = function(y) { + return y * this.scale + this.translation.y ; + }; + + + /** + * + * @param {object} pos = {x: number, y: number} + * @returns {{x: number, y: number}} + * @constructor + */ + Network.prototype.canvasToDOM = function(pos) { + return {x:this._XconvertCanvasToDOM(pos.x),y:this._YconvertCanvasToDOM(pos.y)}; + } + + /** + * + * @param {object} pos = {x: number, y: number} + * @returns {{x: number, y: number}} + * @constructor + */ + Network.prototype.DOMtoCanvas = function(pos) { + return {x:this._XconvertDOMtoCanvas(pos.x),y:this._YconvertDOMtoCanvas(pos.y)}; + } + + /** + * Redraw all nodes + * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); + * @param {CanvasRenderingContext2D} ctx + * @param {Boolean} [alwaysShow] + * @private + */ + Network.prototype._drawNodes = function(ctx,alwaysShow) { + if (alwaysShow === undefined) { + alwaysShow = false; + } + + // first draw the unselected nodes + var nodes = this.nodes; + var selected = []; + + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + nodes[id].setScaleAndPos(this.scale,this.canvasTopLeft,this.canvasBottomRight); + if (nodes[id].isSelected()) { + selected.push(id); + } + else { + if (nodes[id].inArea() || alwaysShow) { + nodes[id].draw(ctx); + } + } + } + } + + // draw the selected nodes on top + for (var s = 0, sMax = selected.length; s < sMax; s++) { + if (nodes[selected[s]].inArea() || alwaysShow) { + nodes[selected[s]].draw(ctx); + } + } + }; + + /** + * Redraw all edges + * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Network.prototype._drawEdges = function(ctx) { + var edges = this.edges; + for (var id in edges) { + if (edges.hasOwnProperty(id)) { + var edge = edges[id]; + edge.setScale(this.scale); + if (edge.connected) { + edges[id].draw(ctx); + } + } + } + }; + + /** + * Redraw all edges + * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Network.prototype._drawControlNodes = function(ctx) { + var edges = this.edges; + for (var id in edges) { + if (edges.hasOwnProperty(id)) { + edges[id]._drawControlNodes(ctx); + } + } + }; + + /** + * Find a stable position for all nodes + * @private + */ + Network.prototype._stabilize = function() { + if (this.constants.freezeForStabilization == true) { + this._freezeDefinedNodes(); + } + + // find stable position + var count = 0; + while (this.moving && count < this.constants.stabilizationIterations) { + this._physicsTick(); + count++; + } + this.zoomExtent(false,true); + if (this.constants.freezeForStabilization == true) { + this._restoreFrozenNodes(); + } + this.emit("stabilized",{iterations:count}); + }; + + /** + * When initializing and stabilizing, we can freeze nodes with a predefined position. This greatly speeds up stabilization + * because only the supportnodes for the smoothCurves have to settle. + * + * @private + */ + Network.prototype._freezeDefinedNodes = function() { + var nodes = this.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + if (nodes[id].x != null && nodes[id].y != null) { + nodes[id].fixedData.x = nodes[id].xFixed; + nodes[id].fixedData.y = nodes[id].yFixed; + nodes[id].xFixed = true; + nodes[id].yFixed = true; + } + } + } + }; + + /** + * Unfreezes the nodes that have been frozen by _freezeDefinedNodes. + * + * @private + */ + Network.prototype._restoreFrozenNodes = function() { + var nodes = this.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + if (nodes[id].fixedData.x != null) { + nodes[id].xFixed = nodes[id].fixedData.x; + nodes[id].yFixed = nodes[id].fixedData.y; + } + } + } + }; + + + /** + * Check if any of the nodes is still moving + * @param {number} vmin the minimum velocity considered as 'moving' + * @return {boolean} true if moving, false if non of the nodes is moving + * @private + */ + Network.prototype._isMoving = function(vmin) { + var nodes = this.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id) && nodes[id].isMoving(vmin)) { + return true; + } + } + return false; + }; + + + /** + * /** + * Perform one discrete step for all nodes + * + * @private + */ + Network.prototype._discreteStepNodes = function() { + var interval = this.physicsDiscreteStepsize; + var nodes = this.nodes; + var nodeId; + var nodesPresent = false; + + if (this.constants.maxVelocity > 0) { + for (nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity); + nodesPresent = true; + } + } + } + else { + for (nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + nodes[nodeId].discreteStep(interval); + nodesPresent = true; + } + } + } + + if (nodesPresent == true) { + var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05); + if (vminCorrected > 0.5*this.constants.maxVelocity) { + this.moving = true; + } + else { + this.moving = this._isMoving(vminCorrected); + if (this.moving == false) { + this.emit("stabilized",{iterations:null}); + } + this.moving = this.moving || this.configurePhysics; + + } + } + }; + + /** + * A single simulation step (or "tick") in the physics simulation + * + * @private + */ + Network.prototype._physicsTick = function() { + if (!this.freezeSimulation) { + if (this.moving == true) { + this._doInAllActiveSectors("_initializeForceCalculation"); + this._doInAllActiveSectors("_discreteStepNodes"); + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this._doInSupportSector("_discreteStepNodes"); + } + this._findCenter(this._getRange()) + } + } + }; + + + /** + * This function runs one step of the animation. It calls an x amount of physics ticks and one render tick. + * It reschedules itself at the beginning of the function + * + * @private + */ + Network.prototype._animationStep = function() { + // reset the timer so a new scheduled animation step can be set + this.timer = undefined; + // handle the keyboad movement + this._handleNavigation(); + + // this schedules a new animation step + this.start(); + + // start the physics simulation + var calculationTime = Date.now(); + var maxSteps = 1; + this._physicsTick(); + var timeRequired = Date.now() - calculationTime; + while (timeRequired < 0.9*(this.renderTimestep - this.renderTime) && maxSteps < this.maxPhysicsTicksPerRender) { + this._physicsTick(); + timeRequired = Date.now() - calculationTime; + maxSteps++; + } + // start the rendering process + var renderTime = Date.now(); + this._redraw(); + this.renderTime = Date.now() - renderTime; + + }; + + if (typeof window !== 'undefined') { + window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + } + + /** + * Schedule a animation step with the refreshrate interval. + */ + Network.prototype.start = function() { + if (this.moving == true || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { + if (!this.timer) { + var ua = navigator.userAgent.toLowerCase(); + + var requiresTimeout = false; + if (ua.indexOf('msie 9.0') != -1) { // IE 9 + requiresTimeout = true; + } + else if (ua.indexOf('safari') != -1) { // safari + if (ua.indexOf('chrome') <= -1) { + requiresTimeout = true; + } + } + + if (requiresTimeout == true) { + this.timer = window.setTimeout(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + } + else{ + this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + } + } + } + else { + this._redraw(); + } + }; + + + /** + * Move the network according to the keyboard presses. + * + * @private + */ + Network.prototype._handleNavigation = function() { + if (this.xIncrement != 0 || this.yIncrement != 0) { + var translation = this._getTranslation(); + this._setTranslation(translation.x+this.xIncrement, translation.y+this.yIncrement); + } + if (this.zoomIncrement != 0) { + var center = { + x: this.frame.canvas.clientWidth / 2, + y: this.frame.canvas.clientHeight / 2 + }; + this._zoom(this.scale*(1 + this.zoomIncrement), center); + } + }; + + + /** + * Freeze the _animationStep + */ + Network.prototype.toggleFreeze = function() { + if (this.freezeSimulation == false) { + this.freezeSimulation = true; + } + else { + this.freezeSimulation = false; + this.start(); + } + }; + + + /** + * This function cleans the support nodes if they are not needed and adds them when they are. + * + * @param {boolean} [disableStart] + * @private + */ + Network.prototype._configureSmoothCurves = function(disableStart) { + if (disableStart === undefined) { + disableStart = true; + } + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this._createBezierNodes(); + // cleanup unused support nodes + for (var nodeId in this.sectors['support']['nodes']) { + if (this.sectors['support']['nodes'].hasOwnProperty(nodeId)) { + if (this.edges[this.sectors['support']['nodes'][nodeId]] === undefined) { + delete this.sectors['support']['nodes'][nodeId]; + } + } + } + } + else { + // delete the support nodes + this.sectors['support']['nodes'] = {}; + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + this.edges[edgeId].smooth = false; + this.edges[edgeId].via = null; + } + } + } + + + this._updateCalculationNodes(); + if (!disableStart) { + this.moving = true; + this.start(); + } + }; + + + /** + * Bezier curves require an anchor point to calculate the smooth flow. These points are nodes. These nodes are invisible but + * are used for the force calculation. + * + * @private + */ + Network.prototype._createBezierNodes = function() { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + var edge = this.edges[edgeId]; + if (edge.via == null) { + edge.smooth = true; + var nodeId = "edgeId:".concat(edge.id); + this.sectors['support']['nodes'][nodeId] = new Node( + {id:nodeId, + mass:1, + shape:'circle', + image:"", + internalMultiplier:1 + },{},{},this.constants); + edge.via = this.sectors['support']['nodes'][nodeId]; + edge.via.parentEdgeId = edge.id; + edge.positionBezierNode(); + } + } + } + } + }; + + /** + * load the functions that load the mixins into the prototype. + * + * @private + */ + Network.prototype._initializeMixinLoaders = function () { + for (var mixin in MixinLoader) { + if (MixinLoader.hasOwnProperty(mixin)) { + Network.prototype[mixin] = MixinLoader[mixin]; + } + } + }; + + /** + * Load the XY positions of the nodes into the dataset. + */ + Network.prototype.storePosition = function() { + var dataArray = []; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + var allowedToMoveX = !this.nodes.xFixed; + var allowedToMoveY = !this.nodes.yFixed; + if (this.nodesData._data[nodeId].x != Math.round(node.x) || this.nodesData._data[nodeId].y != Math.round(node.y)) { + dataArray.push({id:nodeId,x:Math.round(node.x),y:Math.round(node.y),allowedToMoveX:allowedToMoveX,allowedToMoveY:allowedToMoveY}); + } + } + } + this.nodesData.update(dataArray); + }; + + + /** + * Center a node in view. + * + * @param {Number} nodeId + * @param {Number} [zoomLevel] + */ + Network.prototype.focusOnNode = function (nodeId, zoomLevel) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (zoomLevel === undefined) { + zoomLevel = this._getScale(); + } + var nodePosition= {x: this.nodes[nodeId].x, y: this.nodes[nodeId].y}; + + var requiredScale = zoomLevel; + this._setScale(requiredScale); + + var canvasCenter = this.DOMtoCanvas({x:0.5 * this.frame.canvas.width,y:0.5 * this.frame.canvas.height}); + var translation = this._getTranslation(); + + var distanceFromCenter = {x:canvasCenter.x - nodePosition.x, + y:canvasCenter.y - nodePosition.y}; + + this._setTranslation(translation.x + requiredScale * distanceFromCenter.x, + translation.y + requiredScale * distanceFromCenter.y); + this.redraw(); + } + else { + console.log("This nodeId cannot be found.") + } + }; + + module.exports = Network; + + +/***/ }, +/* 39 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Copyright 2012 Craig Campbell + * + * 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. + * + * Mousetrap is a simple keyboard shortcut library for Javascript with + * no external dependencies + * + * @version 1.1.2 + * @url craig.is/killing/mice + */ + + /** + * mapping of special keycodes to their corresponding keys + * + * everything in this dictionary cannot use keypress events + * so it has to be here to map to the correct keycodes for + * keyup/keydown events + * + * @type {Object} + */ + var _MAP = { + 8: 'backspace', + 9: 'tab', + 13: 'enter', + 16: 'shift', + 17: 'ctrl', + 18: 'alt', + 20: 'capslock', + 27: 'esc', + 32: 'space', + 33: 'pageup', + 34: 'pagedown', + 35: 'end', + 36: 'home', + 37: 'left', + 38: 'up', + 39: 'right', + 40: 'down', + 45: 'ins', + 46: 'del', + 91: 'meta', + 93: 'meta', + 224: 'meta' + }, + + /** + * mapping for special characters so they can support + * + * this dictionary is only used incase you want to bind a + * keyup or keydown event to one of these keys + * + * @type {Object} + */ + _KEYCODE_MAP = { + 106: '*', + 107: '+', + 109: '-', + 110: '.', + 111 : '/', + 186: ';', + 187: '=', + 188: ',', + 189: '-', + 190: '.', + 191: '/', + 192: '`', + 219: '[', + 220: '\\', + 221: ']', + 222: '\'' + }, + + /** + * this is a mapping of keys that require shift on a US keypad + * back to the non shift equivelents + * + * this is so you can use keyup events with these keys + * + * note that this will only work reliably on US keyboards + * + * @type {Object} + */ + _SHIFT_MAP = { + '~': '`', + '!': '1', + '@': '2', + '#': '3', + '$': '4', + '%': '5', + '^': '6', + '&': '7', + '*': '8', + '(': '9', + ')': '0', + '_': '-', + '+': '=', + ':': ';', + '\"': '\'', + '<': ',', + '>': '.', + '?': '/', + '|': '\\' + }, + + /** + * this is a list of special strings you can use to map + * to modifier keys when you specify your keyboard shortcuts + * + * @type {Object} + */ + _SPECIAL_ALIASES = { + 'option': 'alt', + 'command': 'meta', + 'return': 'enter', + 'escape': 'esc' + }, + + /** + * variable to store the flipped version of _MAP from above + * needed to check if we should use keypress or not when no action + * is specified + * + * @type {Object|undefined} + */ + _REVERSE_MAP, + + /** + * a list of all the callbacks setup via Mousetrap.bind() + * + * @type {Object} + */ + _callbacks = {}, + + /** + * direct map of string combinations to callbacks used for trigger() + * + * @type {Object} + */ + _direct_map = {}, + + /** + * keeps track of what level each sequence is at since multiple + * sequences can start out with the same sequence + * + * @type {Object} + */ + _sequence_levels = {}, + + /** + * variable to store the setTimeout call + * + * @type {null|number} + */ + _reset_timer, + + /** + * temporary state where we will ignore the next keyup + * + * @type {boolean|string} + */ + _ignore_next_keyup = false, + + /** + * are we currently inside of a sequence? + * type of action ("keyup" or "keydown" or "keypress") or false + * + * @type {boolean|string} + */ + _inside_sequence = false; + + /** + * loop through the f keys, f1 to f19 and add them to the map + * programatically + */ + for (var i = 1; i < 20; ++i) { + _MAP[111 + i] = 'f' + i; + } + + /** + * loop through to map numbers on the numeric keypad + */ + for (i = 0; i <= 9; ++i) { + _MAP[i + 96] = i; + } + + /** + * cross browser add event method + * + * @param {Element|HTMLDocument} object + * @param {string} type + * @param {Function} callback + * @returns void + */ + function _addEvent(object, type, callback) { + if (object.addEventListener) { + return object.addEventListener(type, callback, false); + } + + object.attachEvent('on' + type, callback); + } + + /** + * takes the event and returns the key character + * + * @param {Event} e + * @return {string} + */ + function _characterFromEvent(e) { + + // for keypress events we should return the character as is + if (e.type == 'keypress') { + return String.fromCharCode(e.which); + } + + // for non keypress events the special maps are needed + if (_MAP[e.which]) { + return _MAP[e.which]; + } + + if (_KEYCODE_MAP[e.which]) { + return _KEYCODE_MAP[e.which]; + } + + // if it is not in the special map + return String.fromCharCode(e.which).toLowerCase(); + } + + /** + * should we stop this event before firing off callbacks + * + * @param {Event} e + * @return {boolean} + */ + function _stop(e) { + var element = e.target || e.srcElement, + tag_name = element.tagName; + + // if the element has the class "mousetrap" then no need to stop + if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) { + return false; + } + + // stop for input, select, and textarea + return tag_name == 'INPUT' || tag_name == 'SELECT' || tag_name == 'TEXTAREA' || (element.contentEditable && element.contentEditable == 'true'); + } + + /** + * checks if two arrays are equal + * + * @param {Array} modifiers1 + * @param {Array} modifiers2 + * @returns {boolean} + */ + function _modifiersMatch(modifiers1, modifiers2) { + return modifiers1.sort().join(',') === modifiers2.sort().join(','); + } + + /** + * resets all sequence counters except for the ones passed in + * + * @param {Object} do_not_reset + * @returns void + */ + function _resetSequences(do_not_reset) { + do_not_reset = do_not_reset || {}; + + var active_sequences = false, + key; + + for (key in _sequence_levels) { + if (do_not_reset[key]) { + active_sequences = true; + continue; + } + _sequence_levels[key] = 0; + } + + if (!active_sequences) { + _inside_sequence = false; + } + } + + /** + * finds all callbacks that match based on the keycode, modifiers, + * and action + * + * @param {string} character + * @param {Array} modifiers + * @param {string} action + * @param {boolean=} remove - should we remove any matches + * @param {string=} combination + * @returns {Array} + */ + function _getMatches(character, modifiers, action, remove, combination) { + var i, + callback, + matches = []; + + // if there are no events related to this keycode + if (!_callbacks[character]) { + return []; + } + + // if a modifier key is coming up on its own we should allow it + if (action == 'keyup' && _isModifier(character)) { + modifiers = [character]; + } + + // loop through all callbacks for the key that was pressed + // and see if any of them match + for (i = 0; i < _callbacks[character].length; ++i) { + callback = _callbacks[character][i]; + + // if this is a sequence but it is not at the right level + // then move onto the next match + if (callback.seq && _sequence_levels[callback.seq] != callback.level) { + continue; + } + + // if the action we are looking for doesn't match the action we got + // then we should keep going + if (action != callback.action) { + continue; + } + + // if this is a keypress event that means that we need to only + // look at the character, otherwise check the modifiers as + // well + if (action == 'keypress' || _modifiersMatch(modifiers, callback.modifiers)) { + + // remove is used so if you change your mind and call bind a + // second time with a new function the first one is overwritten + if (remove && callback.combo == combination) { + _callbacks[character].splice(i, 1); + } + + matches.push(callback); + } + } + + return matches; + } + + /** + * takes a key event and figures out what the modifiers are + * + * @param {Event} e + * @returns {Array} + */ + function _eventModifiers(e) { + var modifiers = []; + + if (e.shiftKey) { + modifiers.push('shift'); + } + + if (e.altKey) { + modifiers.push('alt'); + } + + if (e.ctrlKey) { + modifiers.push('ctrl'); + } + + if (e.metaKey) { + modifiers.push('meta'); + } + + return modifiers; + } + + /** + * actually calls the callback function + * + * if your callback function returns false this will use the jquery + * convention - prevent default and stop propogation on the event + * + * @param {Function} callback + * @param {Event} e + * @returns void + */ + function _fireCallback(callback, e) { + if (callback(e) === false) { + if (e.preventDefault) { + e.preventDefault(); + } + + if (e.stopPropagation) { + e.stopPropagation(); + } + + e.returnValue = false; + e.cancelBubble = true; + } + } + + /** + * handles a character key event + * + * @param {string} character + * @param {Event} e + * @returns void + */ + function _handleCharacter(character, e) { + + // if this event should not happen stop here + if (_stop(e)) { + return; + } + + var callbacks = _getMatches(character, _eventModifiers(e), e.type), + i, + do_not_reset = {}, + processed_sequence_callback = false; + + // loop through matching callbacks for this key event + for (i = 0; i < callbacks.length; ++i) { + + // fire for all sequence callbacks + // this is because if for example you have multiple sequences + // bound such as "g i" and "g t" they both need to fire the + // callback for matching g cause otherwise you can only ever + // match the first one + if (callbacks[i].seq) { + processed_sequence_callback = true; + + // keep a list of which sequences were matches for later + do_not_reset[callbacks[i].seq] = 1; + _fireCallback(callbacks[i].callback, e); + continue; + } + + // if there were no sequence matches but we are still here + // that means this is a regular match so we should fire that + if (!processed_sequence_callback && !_inside_sequence) { + _fireCallback(callbacks[i].callback, e); + } + } + + // if you are inside of a sequence and the key you are pressing + // is not a modifier key then we should reset all sequences + // that were not matched by this key event + if (e.type == _inside_sequence && !_isModifier(character)) { + _resetSequences(do_not_reset); + } + } + + /** + * handles a keydown event + * + * @param {Event} e + * @returns void + */ + function _handleKey(e) { + + // normalize e.which for key events + // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion + e.which = typeof e.which == "number" ? e.which : e.keyCode; + + var character = _characterFromEvent(e); + + // no character found then stop + if (!character) { + return; + } + + if (e.type == 'keyup' && _ignore_next_keyup == character) { + _ignore_next_keyup = false; + return; + } + + _handleCharacter(character, e); + } + + /** + * determines if the keycode specified is a modifier key or not + * + * @param {string} key + * @returns {boolean} + */ + function _isModifier(key) { + return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta'; + } + + /** + * called to set a 1 second timeout on the specified sequence + * + * this is so after each key press in the sequence you have 1 second + * to press the next key before you have to start over + * + * @returns void + */ + function _resetSequenceTimer() { + clearTimeout(_reset_timer); + _reset_timer = setTimeout(_resetSequences, 1000); + } + + /** + * reverses the map lookup so that we can look for specific keys + * to see what can and can't use keypress + * + * @return {Object} + */ + function _getReverseMap() { + if (!_REVERSE_MAP) { + _REVERSE_MAP = {}; + for (var key in _MAP) { + + // pull out the numeric keypad from here cause keypress should + // be able to detect the keys from the character + if (key > 95 && key < 112) { + continue; + } + + if (_MAP.hasOwnProperty(key)) { + _REVERSE_MAP[_MAP[key]] = key; + } + } + } + return _REVERSE_MAP; + } + + /** + * picks the best action based on the key combination + * + * @param {string} key - character for key + * @param {Array} modifiers + * @param {string=} action passed in + */ + function _pickBestAction(key, modifiers, action) { + + // if no action was picked in we should try to pick the one + // that we think would work best for this key + if (!action) { + action = _getReverseMap()[key] ? 'keydown' : 'keypress'; + } + + // modifier keys don't work as expected with keypress, + // switch to keydown + if (action == 'keypress' && modifiers.length) { + action = 'keydown'; + } + + return action; + } + + /** + * binds a key sequence to an event + * + * @param {string} combo - combo specified in bind call + * @param {Array} keys + * @param {Function} callback + * @param {string=} action + * @returns void + */ + function _bindSequence(combo, keys, callback, action) { + + // start off by adding a sequence level record for this combination + // and setting the level to 0 + _sequence_levels[combo] = 0; + + // if there is no action pick the best one for the first key + // in the sequence + if (!action) { + action = _pickBestAction(keys[0], []); + } + + /** + * callback to increase the sequence level for this sequence and reset + * all other sequences that were active + * + * @param {Event} e + * @returns void + */ + var _increaseSequence = function(e) { + _inside_sequence = action; + ++_sequence_levels[combo]; + _resetSequenceTimer(); + }, + + /** + * wraps the specified callback inside of another function in order + * to reset all sequence counters as soon as this sequence is done + * + * @param {Event} e + * @returns void + */ + _callbackAndReset = function(e) { + _fireCallback(callback, e); + + // we should ignore the next key up if the action is key down + // or keypress. this is so if you finish a sequence and + // release the key the final key will not trigger a keyup + if (action !== 'keyup') { + _ignore_next_keyup = _characterFromEvent(e); + } + + // weird race condition if a sequence ends with the key + // another sequence begins with + setTimeout(_resetSequences, 10); + }, + i; + + // loop through keys one at a time and bind the appropriate callback + // function. for any key leading up to the final one it should + // increase the sequence. after the final, it should reset all sequences + for (i = 0; i < keys.length; ++i) { + _bindSingle(keys[i], i < keys.length - 1 ? _increaseSequence : _callbackAndReset, action, combo, i); + } + } + + /** + * binds a single keyboard combination + * + * @param {string} combination + * @param {Function} callback + * @param {string=} action + * @param {string=} sequence_name - name of sequence if part of sequence + * @param {number=} level - what part of the sequence the command is + * @returns void + */ + function _bindSingle(combination, callback, action, sequence_name, level) { + + // make sure multiple spaces in a row become a single space + combination = combination.replace(/\s+/g, ' '); + + var sequence = combination.split(' '), + i, + key, + keys, + modifiers = []; + + // if this pattern is a sequence of keys then run through this method + // to reprocess each pattern one key at a time + if (sequence.length > 1) { + return _bindSequence(combination, sequence, callback, action); + } + + // take the keys from this pattern and figure out what the actual + // pattern is all about + keys = combination === '+' ? ['+'] : combination.split('+'); + + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + + // normalize key names + if (_SPECIAL_ALIASES[key]) { + key = _SPECIAL_ALIASES[key]; + } + + // if this is not a keypress event then we should + // be smart about using shift keys + // this will only work for US keyboards however + if (action && action != 'keypress' && _SHIFT_MAP[key]) { + key = _SHIFT_MAP[key]; + modifiers.push('shift'); + } + + // if this key is a modifier then add it to the list of modifiers + if (_isModifier(key)) { + modifiers.push(key); + } + } + + // depending on what the key combination is + // we will try to pick the best event for it + action = _pickBestAction(key, modifiers, action); + + // make sure to initialize array if this is the first time + // a callback is added for this key + if (!_callbacks[key]) { + _callbacks[key] = []; + } + + // remove an existing match if there is one + _getMatches(key, modifiers, action, !sequence_name, combination); + + // add this call back to the array + // if it is a sequence put it at the beginning + // if not put it at the end + // + // this is important because the way these are processed expects + // the sequence ones to come first + _callbacks[key][sequence_name ? 'unshift' : 'push']({ + callback: callback, + modifiers: modifiers, + action: action, + seq: sequence_name, + level: level, + combo: combination + }); + } + + /** + * binds multiple combinations to the same callback + * + * @param {Array} combinations + * @param {Function} callback + * @param {string|undefined} action + * @returns void + */ + function _bindMultiple(combinations, callback, action) { + for (var i = 0; i < combinations.length; ++i) { + _bindSingle(combinations[i], callback, action); + } + } + + // start! + _addEvent(document, 'keypress', _handleKey); + _addEvent(document, 'keydown', _handleKey); + _addEvent(document, 'keyup', _handleKey); + + var mousetrap = { + + /** + * binds an event to mousetrap + * + * can be a single key, a combination of keys separated with +, + * a comma separated list of keys, an array of keys, or + * a sequence of keys separated by spaces + * + * be sure to list the modifier keys first to make sure that the + * correct key ends up getting bound (the last key in the pattern) + * + * @param {string|Array} keys + * @param {Function} callback + * @param {string=} action - 'keypress', 'keydown', or 'keyup' + * @returns void + */ + bind: function(keys, callback, action) { + _bindMultiple(keys instanceof Array ? keys : [keys], callback, action); + _direct_map[keys + ':' + action] = callback; + return this; + }, + + /** + * unbinds an event to mousetrap + * + * the unbinding sets the callback function of the specified key combo + * to an empty function and deletes the corresponding key in the + * _direct_map dict. + * + * the keycombo+action has to be exactly the same as + * it was defined in the bind method + * + * TODO: actually remove this from the _callbacks dictionary instead + * of binding an empty function + * + * @param {string|Array} keys + * @param {string} action + * @returns void + */ + unbind: function(keys, action) { + if (_direct_map[keys + ':' + action]) { + delete _direct_map[keys + ':' + action]; + this.bind(keys, function() {}, action); + } + return this; + }, + + /** + * triggers an event that has already been bound + * + * @param {string} keys + * @param {string=} action + * @returns void + */ + trigger: function(keys, action) { + _direct_map[keys + ':' + action](); + return this; + }, + + /** + * resets the library back to its initial state. this is useful + * if you want to clear out the current keyboard shortcuts and bind + * new ones - for example if you switch to another page + * + * @returns void + */ + reset: function() { + _callbacks = {}; + _direct_map = {}; + return this; + } + }; + + module.exports = mousetrap; + + + +/***/ }, +/* 40 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Parse a text source containing data in DOT language into a JSON object. + * The object contains two lists: one with nodes and one with edges. + * + * DOT language reference: http://www.graphviz.org/doc/info/lang.html + * + * @param {String} data Text containing a graph in DOT-notation + * @return {Object} graph An object containing two parameters: + * {Object[]} nodes + * {Object[]} edges + */ + function parseDOT (data) { + dot = data; + return parseGraph(); + } + + // token types enumeration + var TOKENTYPE = { + NULL : 0, + DELIMITER : 1, + IDENTIFIER: 2, + UNKNOWN : 3 + }; + + // map with all delimiters + var DELIMITERS = { + '{': true, + '}': true, + '[': true, + ']': true, + ';': true, + '=': true, + ',': true, + + '->': true, + '--': true + }; + + var dot = ''; // current dot file + var index = 0; // current index in dot file + var c = ''; // current token character in expr + var token = ''; // current token + var tokenType = TOKENTYPE.NULL; // type of the token + + /** + * Get the first character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. + */ + function first() { + index = 0; + c = dot.charAt(0); + } + + /** + * Get the next character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. + */ + function next() { + index++; + c = dot.charAt(index); + } + + /** + * Preview the next character from the dot file. + * @return {String} cNext + */ + function nextPreview() { + return dot.charAt(index + 1); + } + + /** + * Test whether given character is alphabetic or numeric + * @param {String} c + * @return {Boolean} isAlphaNumeric + */ + var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; + function isAlphaNumeric(c) { + return regexAlphaNumeric.test(c); + } + + /** + * Merge all properties of object b into object b + * @param {Object} a + * @param {Object} b + * @return {Object} a + */ + function merge (a, b) { + if (!a) { + a = {}; + } + + if (b) { + for (var name in b) { + if (b.hasOwnProperty(name)) { + a[name] = b[name]; + } + } + } + return a; + } + + /** + * Set a value in an object, where the provided parameter name can be a + * path with nested parameters. For example: + * + * var obj = {a: 2}; + * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} + * + * @param {Object} obj + * @param {String} path A parameter name or dot-separated parameter path, + * like "color.highlight.border". + * @param {*} value + */ + function setValue(obj, path, value) { + var keys = path.split('.'); + var o = obj; + while (keys.length) { + var key = keys.shift(); + if (keys.length) { + // this isn't the end point + if (!o[key]) { + o[key] = {}; + } + o = o[key]; + } + else { + // this is the end point + o[key] = value; + } + } + } + + /** + * Add a node to a graph object. If there is already a node with + * the same id, their attributes will be merged. + * @param {Object} graph + * @param {Object} node + */ + function addNode(graph, node) { + var i, len; + var current = null; + + // find root graph (in case of subgraph) + var graphs = [graph]; // list with all graphs from current graph to root graph + var root = graph; + while (root.parent) { + graphs.push(root.parent); + root = root.parent; + } + + // find existing node (at root level) by its id + if (root.nodes) { + for (i = 0, len = root.nodes.length; i < len; i++) { + if (node.id === root.nodes[i].id) { + current = root.nodes[i]; + break; + } + } + } + + if (!current) { + // this is a new node + current = { + id: node.id + }; + if (graph.node) { + // clone default attributes + current.attr = merge(current.attr, graph.node); + } + } + + // add node to this (sub)graph and all its parent graphs + for (i = graphs.length - 1; i >= 0; i--) { + var g = graphs[i]; + + if (!g.nodes) { + g.nodes = []; + } + if (g.nodes.indexOf(current) == -1) { + g.nodes.push(current); + } + } + + // merge attributes + if (node.attr) { + current.attr = merge(current.attr, node.attr); + } + } + + /** + * Add an edge to a graph object + * @param {Object} graph + * @param {Object} edge + */ + function addEdge(graph, edge) { + if (!graph.edges) { + graph.edges = []; + } + graph.edges.push(edge); + if (graph.edge) { + var attr = merge({}, graph.edge); // clone default attributes + edge.attr = merge(attr, edge.attr); // merge attributes + } + } + + /** + * Create an edge to a graph object + * @param {Object} graph + * @param {String | Number | Object} from + * @param {String | Number | Object} to + * @param {String} type + * @param {Object | null} attr + * @return {Object} edge + */ + function createEdge(graph, from, to, type, attr) { + var edge = { + from: from, + to: to, + type: type + }; + + if (graph.edge) { + edge.attr = merge({}, graph.edge); // clone default attributes + } + edge.attr = merge(edge.attr || {}, attr); // merge attributes + + return edge; + } + + /** + * Get next token in the current dot file. + * The token and token type are available as token and tokenType + */ + function getToken() { + tokenType = TOKENTYPE.NULL; + token = ''; + + // skip over whitespaces + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter + next(); + } + + do { + var isComment = false; + + // skip comment + if (c == '#') { + // find the previous non-space character + var i = index - 1; + while (dot.charAt(i) == ' ' || dot.charAt(i) == '\t') { + i--; + } + if (dot.charAt(i) == '\n' || dot.charAt(i) == '') { + // the # is at the start of a line, this is indeed a line comment + while (c != '' && c != '\n') { + next(); + } + isComment = true; + } + } + if (c == '/' && nextPreview() == '/') { + // skip line comment + while (c != '' && c != '\n') { + next(); + } + isComment = true; + } + if (c == '/' && nextPreview() == '*') { + // skip block comment + while (c != '') { + if (c == '*' && nextPreview() == '/') { + // end of block comment found. skip these last two characters + next(); + next(); + break; + } + else { + next(); + } + } + isComment = true; + } + + // skip over whitespaces + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter + next(); + } + } + while (isComment); + + // check for end of dot file + if (c == '') { + // token is still empty + tokenType = TOKENTYPE.DELIMITER; + return; + } + + // check for delimiters consisting of 2 characters + var c2 = c + nextPreview(); + if (DELIMITERS[c2]) { + tokenType = TOKENTYPE.DELIMITER; + token = c2; + next(); + next(); + return; + } + + // check for delimiters consisting of 1 character + if (DELIMITERS[c]) { + tokenType = TOKENTYPE.DELIMITER; + token = c; + next(); + return; + } + + // check for an identifier (number or string) + // TODO: more precise parsing of numbers/strings (and the port separator ':') + if (isAlphaNumeric(c) || c == '-') { + token += c; + next(); + + while (isAlphaNumeric(c)) { + token += c; + next(); + } + if (token == 'false') { + token = false; // convert to boolean + } + else if (token == 'true') { + token = true; // convert to boolean + } + else if (!isNaN(Number(token))) { + token = Number(token); // convert to number + } + tokenType = TOKENTYPE.IDENTIFIER; + return; + } + + // check for a string enclosed by double quotes + if (c == '"') { + next(); + while (c != '' && (c != '"' || (c == '"' && nextPreview() == '"'))) { + token += c; + if (c == '"') { // skip the escape character + next(); + } + next(); + } + if (c != '"') { + throw newSyntaxError('End of string " expected'); + } + next(); + tokenType = TOKENTYPE.IDENTIFIER; + return; + } + + // something unknown is found, wrong characters, a syntax error + tokenType = TOKENTYPE.UNKNOWN; + while (c != '') { + token += c; + next(); + } + throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"'); + } + + /** + * Parse a graph. + * @returns {Object} graph + */ + function parseGraph() { + var graph = {}; + + first(); + getToken(); + + // optional strict keyword + if (token == 'strict') { + graph.strict = true; + getToken(); + } + + // graph or digraph keyword + if (token == 'graph' || token == 'digraph') { + graph.type = token; + getToken(); + } + + // optional graph id + if (tokenType == TOKENTYPE.IDENTIFIER) { + graph.id = token; + getToken(); + } + + // open angle bracket + if (token != '{') { + throw newSyntaxError('Angle bracket { expected'); + } + getToken(); + + // statements + parseStatements(graph); + + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); + } + getToken(); + + // end of file + if (token !== '') { + throw newSyntaxError('End of file expected'); + } + getToken(); + + // remove temporary default properties + delete graph.node; + delete graph.edge; + delete graph.graph; + + return graph; + } + + /** + * Parse a list with statements. + * @param {Object} graph + */ + function parseStatements (graph) { + while (token !== '' && token != '}') { + parseStatement(graph); + if (token == ';') { + getToken(); + } + } + } + + /** + * Parse a single statement. Can be a an attribute statement, node + * statement, a series of node statements and edge statements, or a + * parameter. + * @param {Object} graph + */ + function parseStatement(graph) { + // parse subgraph + var subgraph = parseSubgraph(graph); + if (subgraph) { + // edge statements + parseEdge(graph, subgraph); + + return; + } + + // parse an attribute statement + var attr = parseAttributeStatement(graph); + if (attr) { + return; + } + + // parse node + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); + } + var id = token; // id can be a string or a number + getToken(); + + if (token == '=') { + // id statement + getToken(); + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); + } + graph[id] = token; + getToken(); + // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " + } + else { + parseNodeStatement(graph, id); + } + } + + /** + * Parse a subgraph + * @param {Object} graph parent graph object + * @return {Object | null} subgraph + */ + function parseSubgraph (graph) { + var subgraph = null; + + // optional subgraph keyword + if (token == 'subgraph') { + subgraph = {}; + subgraph.type = 'subgraph'; + getToken(); + + // optional graph id + if (tokenType == TOKENTYPE.IDENTIFIER) { + subgraph.id = token; + getToken(); + } + } + + // open angle bracket + if (token == '{') { + getToken(); + + if (!subgraph) { + subgraph = {}; + } + subgraph.parent = graph; + subgraph.node = graph.node; + subgraph.edge = graph.edge; + subgraph.graph = graph.graph; + + // statements + parseStatements(subgraph); + + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); + } + getToken(); + + // remove temporary default properties + delete subgraph.node; + delete subgraph.edge; + delete subgraph.graph; + delete subgraph.parent; + + // register at the parent graph + if (!graph.subgraphs) { + graph.subgraphs = []; + } + graph.subgraphs.push(subgraph); + } + + return subgraph; + } + + /** + * parse an attribute statement like "node [shape=circle fontSize=16]". + * Available keywords are 'node', 'edge', 'graph'. + * The previous list with default attributes will be replaced + * @param {Object} graph + * @returns {String | null} keyword Returns the name of the parsed attribute + * (node, edge, graph), or null if nothing + * is parsed. + */ + function parseAttributeStatement (graph) { + // attribute statements + if (token == 'node') { + getToken(); + + // node attributes + graph.node = parseAttributeList(); + return 'node'; + } + else if (token == 'edge') { + getToken(); + + // edge attributes + graph.edge = parseAttributeList(); + return 'edge'; + } + else if (token == 'graph') { + getToken(); + + // graph attributes + graph.graph = parseAttributeList(); + return 'graph'; + } + + return null; + } + + /** + * parse a node statement + * @param {Object} graph + * @param {String | Number} id + */ + function parseNodeStatement(graph, id) { + // node statement + var node = { + id: id + }; + var attr = parseAttributeList(); + if (attr) { + node.attr = attr; + } + addNode(graph, node); + + // edge statements + parseEdge(graph, id); + } + + /** + * Parse an edge or a series of edges + * @param {Object} graph + * @param {String | Number} from Id of the from node + */ + function parseEdge(graph, from) { + while (token == '->' || token == '--') { + var to; + var type = token; + getToken(); + + var subgraph = parseSubgraph(graph); + if (subgraph) { + to = subgraph; + } + else { + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier or subgraph expected'); + } + to = token; + addNode(graph, { + id: to + }); + getToken(); + } + + // parse edge attributes + var attr = parseAttributeList(); + + // create edge + var edge = createEdge(graph, from, to, type, attr); + addEdge(graph, edge); + + from = to; + } + } + + /** + * Parse a set with attributes, + * for example [label="1.000", shape=solid] + * @return {Object | null} attr + */ + function parseAttributeList() { + var attr = null; + + while (token == '[') { + getToken(); + attr = {}; + while (token !== '' && token != ']') { + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute name expected'); + } + var name = token; + + getToken(); + if (token != '=') { + throw newSyntaxError('Equal sign = expected'); + } + getToken(); + + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute value expected'); + } + var value = token; + setValue(attr, name, value); // name can be a path + + getToken(); + if (token ==',') { + getToken(); + } + } + + if (token != ']') { + throw newSyntaxError('Bracket ] expected'); + } + getToken(); + } + + return attr; + } + + /** + * Create a syntax error with extra information on current token and index. + * @param {String} message + * @returns {SyntaxError} err + */ + function newSyntaxError(message) { + return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')'); + } + + /** + * Chop off text after a maximum length + * @param {String} text + * @param {Number} maxLength + * @returns {String} + */ + function chop (text, maxLength) { + return (text.length <= maxLength) ? text : (text.substr(0, 27) + '...'); + } + + /** + * Execute a function fn for each pair of elements in two arrays + * @param {Array | *} array1 + * @param {Array | *} array2 + * @param {function} fn + */ + function forEach2(array1, array2, fn) { + if (array1 instanceof Array) { + array1.forEach(function (elem1) { + if (array2 instanceof Array) { + array2.forEach(function (elem2) { + fn(elem1, elem2); + }); + } + else { + fn(elem1, array2); + } + }); + } + else { + if (array2 instanceof Array) { + array2.forEach(function (elem2) { + fn(array1, elem2); + }); + } + else { + fn(array1, array2); + } + } + } + + /** + * Convert a string containing a graph in DOT language into a map containing + * with nodes and edges in the format of graph. + * @param {String} data Text containing a graph in DOT-notation + * @return {Object} graphData + */ + function DOTToGraph (data) { + // parse the DOT file + var dotData = parseDOT(data); + var graphData = { + nodes: [], + edges: [], + options: {} + }; + + // copy the nodes + if (dotData.nodes) { + dotData.nodes.forEach(function (dotNode) { + var graphNode = { + id: dotNode.id, + label: String(dotNode.label || dotNode.id) + }; + merge(graphNode, dotNode.attr); + if (graphNode.image) { + graphNode.shape = 'image'; + } + graphData.nodes.push(graphNode); + }); + } + + // copy the edges + if (dotData.edges) { + /** + * Convert an edge in DOT format to an edge with VisGraph format + * @param {Object} dotEdge + * @returns {Object} graphEdge + */ + function convertEdge(dotEdge) { + var graphEdge = { + from: dotEdge.from, + to: dotEdge.to + }; + merge(graphEdge, dotEdge.attr); + graphEdge.style = (dotEdge.type == '->') ? 'arrow' : 'line'; + return graphEdge; + } + + dotData.edges.forEach(function (dotEdge) { + var from, to; + if (dotEdge.from instanceof Object) { + from = dotEdge.from.nodes; + } + else { + from = { + id: dotEdge.from + } + } + + if (dotEdge.to instanceof Object) { + to = dotEdge.to.nodes; + } + else { + to = { + id: dotEdge.to + } + } + + if (dotEdge.from instanceof Object && dotEdge.from.edges) { + dotEdge.from.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + } + + forEach2(from, to, function (from, to) { + var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr); + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + + if (dotEdge.to instanceof Object && dotEdge.to.edges) { + dotEdge.to.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + } + }); + } + + // copy the options + if (dotData.attr) { + graphData.options = dotData.attr; + } + + return graphData; + } + + // exports + exports.parseDOT = parseDOT; + exports.DOTToGraph = DOTToGraph; + + +/***/ }, +/* 41 */ +/***/ function(module, exports, __webpack_require__) { + + + function parseGephi(gephiJSON, options) { + var edges = []; + var nodes = []; + this.options = { + edges: { + inheritColor: true + }, + nodes: { + allowedToMove: false, + parseColor: false + } + }; + + if (options !== undefined) { + this.options.nodes['allowedToMove'] = options.allowedToMove | false; + this.options.nodes['parseColor'] = options.parseColor | false; + this.options.edges['inheritColor'] = options.inheritColor | true; + } + + var gEdges = gephiJSON.edges; + var gNodes = gephiJSON.nodes; + for (var i = 0; i < gEdges.length; i++) { + var edge = {}; + var gEdge = gEdges[i]; + edge['id'] = gEdge.id; + edge['from'] = gEdge.source; + edge['to'] = gEdge.target; + edge['attributes'] = gEdge.attributes; + // edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined; + // edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size; + edge['color'] = gEdge.color; + edge['inheritColor'] = edge['color'] !== undefined ? false : this.options.inheritColor; + edges.push(edge); + } + + for (var i = 0; i < gNodes.length; i++) { + var node = {}; + var gNode = gNodes[i]; + node['id'] = gNode.id; + node['attributes'] = gNode.attributes; + node['x'] = gNode.x; + node['y'] = gNode.y; + node['label'] = gNode.label; + if (this.options.nodes.parseColor == true) { + node['color'] = gNode.color; + } + else { + node['color'] = gNode.color !== undefined ? {background:gNode.color, border:gNode.color} : undefined; + } + node['radius'] = gNode.size; + node['allowedToMoveX'] = this.options.nodes.allowedToMove; + node['allowedToMoveY'] = this.options.nodes.allowedToMove; + nodes.push(node); + } + + return {nodes:nodes, edges:edges}; + } + + exports.parseGephi = parseGephi; + +/***/ }, +/* 42 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + + /** + * @class Groups + * This class can store groups and properties specific for groups. + */ + function Groups() { + this.clear(); + this.defaultIndex = 0; + } + + + /** + * default constants for group colors + */ + Groups.DEFAULT = [ + {border: "#2B7CE9", background: "#97C2FC", highlight: {border: "#2B7CE9", background: "#D2E5FF"}, hover: {border: "#2B7CE9", background: "#D2E5FF"}}, // blue + {border: "#FFA500", background: "#FFFF00", highlight: {border: "#FFA500", background: "#FFFFA3"}, hover: {border: "#FFA500", background: "#FFFFA3"}}, // yellow + {border: "#FA0A10", background: "#FB7E81", highlight: {border: "#FA0A10", background: "#FFAFB1"}, hover: {border: "#FA0A10", background: "#FFAFB1"}}, // red + {border: "#41A906", background: "#7BE141", highlight: {border: "#41A906", background: "#A1EC76"}, hover: {border: "#41A906", background: "#A1EC76"}}, // green + {border: "#E129F0", background: "#EB7DF4", highlight: {border: "#E129F0", background: "#F0B3F5"}, hover: {border: "#E129F0", background: "#F0B3F5"}}, // magenta + {border: "#7C29F0", background: "#AD85E4", highlight: {border: "#7C29F0", background: "#D3BDF0"}, hover: {border: "#7C29F0", background: "#D3BDF0"}}, // purple + {border: "#C37F00", background: "#FFA807", highlight: {border: "#C37F00", background: "#FFCA66"}, hover: {border: "#C37F00", background: "#FFCA66"}}, // orange + {border: "#4220FB", background: "#6E6EFD", highlight: {border: "#4220FB", background: "#9B9BFD"}, hover: {border: "#4220FB", background: "#9B9BFD"}}, // darkblue + {border: "#FD5A77", background: "#FFC0CB", highlight: {border: "#FD5A77", background: "#FFD1D9"}, hover: {border: "#FD5A77", background: "#FFD1D9"}}, // pink + {border: "#4AD63A", background: "#C2FABC", highlight: {border: "#4AD63A", background: "#E6FFE3"}, hover: {border: "#4AD63A", background: "#E6FFE3"}} // mint + ]; + + + /** + * Clear all groups + */ + Groups.prototype.clear = function () { + this.groups = {}; + this.groups.length = function() + { + var i = 0; + for ( var p in this ) { + if (this.hasOwnProperty(p)) { + i++; + } + } + return i; + } + }; + + + /** + * get group properties of a groupname. If groupname is not found, a new group + * is added. + * @param {*} groupname Can be a number, string, Date, etc. + * @return {Object} group The created group, containing all group properties + */ + Groups.prototype.get = function (groupname) { + var group = this.groups[groupname]; + if (group == undefined) { + // create new group + var index = this.defaultIndex % Groups.DEFAULT.length; + this.defaultIndex++; + group = {}; + group.color = Groups.DEFAULT[index]; + this.groups[groupname] = group; + } + + return group; + }; + + /** + * Add a custom group style + * @param {String} groupname + * @param {Object} style An object containing borderColor, + * backgroundColor, etc. + * @return {Object} group The created group object + */ + Groups.prototype.add = function (groupname, style) { + this.groups[groupname] = style; + if (style.color) { + style.color = util.parseColor(style.color); + } + return style; + }; + + module.exports = Groups; + + +/***/ }, +/* 43 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * @class Images + * This class loads images and keeps them stored. + */ + function Images() { + this.images = {}; + + this.callback = undefined; + } + + /** + * Set an onload callback function. This will be called each time an image + * is loaded + * @param {function} callback + */ + Images.prototype.setOnloadCallback = function(callback) { + this.callback = callback; + }; + + /** + * + * @param {string} url Url of the image + * @return {Image} img The image object + */ + Images.prototype.load = function(url) { + var img = this.images[url]; + if (img == undefined) { + // create the image + var images = this; + img = new Image(); + this.images[url] = img; + img.onload = function() { + if (images.callback) { + images.callback(this); + } + }; + img.src = url; + } + + return img; + }; + + module.exports = Images; + + +/***/ }, +/* 44 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + + /** + * @class Node + * A node. A node can be connected to other nodes via one or multiple edges. + * @param {object} properties An object containing properties for the node. All + * properties are optional, except for the id. + * {number} id Id of the node. Required + * {string} label Text label for the node + * {number} x Horizontal position of the node + * {number} y Vertical position of the node + * {string} shape Node shape, available: + * "database", "circle", "ellipse", + * "box", "image", "text", "dot", + * "star", "triangle", "triangleDown", + * "square" + * {string} image An image url + * {string} title An title text, can be HTML + * {anytype} group A group name or number + * @param {Network.Images} imagelist A list with images. Only needed + * when the node has an image + * @param {Network.Groups} grouplist A list with groups. Needed for + * retrieving group properties + * @param {Object} constants An object with default values for + * example for the color + * + */ + function Node(properties, imagelist, grouplist, constants) { + this.selected = false; + this.hover = false; + + this.edges = []; // all edges connected to this node + this.dynamicEdges = []; + this.reroutedEdges = {}; + + this.group = constants.nodes.group; + this.fontSize = Number(constants.nodes.fontSize); + this.fontFace = constants.nodes.fontFace; + this.fontColor = constants.nodes.fontColor; + this.fontDrawThreshold = 3; + + this.color = constants.nodes.color; + + // set defaults for the properties + this.id = undefined; + this.shape = constants.nodes.shape; + this.image = constants.nodes.image; + this.x = null; + this.y = null; + this.xFixed = false; + this.yFixed = false; + this.horizontalAlignLeft = true; // these are for the navigation controls + this.verticalAlignTop = true; // these are for the navigation controls + this.radius = constants.nodes.radius; + this.baseRadiusValue = constants.nodes.radius; + this.radiusFixed = false; + this.radiusMin = constants.nodes.radiusMin; + this.radiusMax = constants.nodes.radiusMax; + this.level = -1; + this.preassignedLevel = false; + this.borderWidth = constants.nodes.borderWidth; + this.borderWidthSelected = constants.nodes.borderWidthSelected; + + + this.imagelist = imagelist; + this.grouplist = grouplist; + + // physics properties + this.fx = 0.0; // external force x + this.fy = 0.0; // external force y + this.vx = 0.0; // velocity x + this.vy = 0.0; // velocity y + this.minForce = constants.minForce; + this.damping = constants.physics.damping; + this.mass = 1; // kg + this.fixedData = {x:null,y:null}; + + + this.setProperties(properties, constants); + + // creating the variables for clustering + this.resetCluster(); + this.dynamicEdgesLength = 0; + this.clusterSession = 0; + this.clusterSizeWidthFactor = constants.clustering.nodeScaling.width; + this.clusterSizeHeightFactor = constants.clustering.nodeScaling.height; + this.clusterSizeRadiusFactor = constants.clustering.nodeScaling.radius; + this.maxNodeSizeIncrements = constants.clustering.maxNodeSizeIncrements; + this.growthIndicator = 0; + + // variables to tell the node about the network. + this.networkScaleInv = 1; + this.networkScale = 1; + this.canvasTopLeft = {"x": -300, "y": -300}; + this.canvasBottomRight = {"x": 300, "y": 300}; + this.parentEdgeId = null; + } + + /** + * (re)setting the clustering variables and objects + */ + Node.prototype.resetCluster = function() { + // clustering variables + this.formationScale = undefined; // this is used to determine when to open the cluster + this.clusterSize = 1; // this signifies the total amount of nodes in this cluster + this.containedNodes = {}; + this.containedEdges = {}; + this.clusterSessions = []; + }; + + /** + * Attach a edge to the node + * @param {Edge} edge + */ + Node.prototype.attachEdge = function(edge) { + if (this.edges.indexOf(edge) == -1) { + this.edges.push(edge); + } + if (this.dynamicEdges.indexOf(edge) == -1) { + this.dynamicEdges.push(edge); + } + this.dynamicEdgesLength = this.dynamicEdges.length; + }; + + /** + * Detach a edge from the node + * @param {Edge} edge + */ + Node.prototype.detachEdge = function(edge) { + var index = this.edges.indexOf(edge); + if (index != -1) { + this.edges.splice(index, 1); + this.dynamicEdges.splice(index, 1); + } + this.dynamicEdgesLength = this.dynamicEdges.length; + }; + + + /** + * Set or overwrite properties for the node + * @param {Object} properties an object with properties + * @param {Object} constants and object with default, global properties + */ + Node.prototype.setProperties = function(properties, constants) { + if (!properties) { + return; + } + this.originalLabel = undefined; + // basic properties + if (properties.id !== undefined) {this.id = properties.id;} + if (properties.label !== undefined) {this.label = properties.label; this.originalLabel = properties.label;} + if (properties.title !== undefined) {this.title = properties.title;} + if (properties.group !== undefined) {this.group = properties.group;} + if (properties.x !== undefined) {this.x = properties.x;} + if (properties.y !== undefined) {this.y = properties.y;} + if (properties.value !== undefined) {this.value = properties.value;} + if (properties.level !== undefined) {this.level = properties.level; this.preassignedLevel = true;} + if (properties.borderWidth !== undefined) {this.borderWidth = properties.borderWidth;} + if (properties.borderWidthSelected !== undefined) {this.borderWidthSelected = properties.borderWidthSelected;} + + // physics + if (properties.mass !== undefined) {this.mass = properties.mass;} + + // navigation controls properties + if (properties.horizontalAlignLeft !== undefined) {this.horizontalAlignLeft = properties.horizontalAlignLeft;} + if (properties.verticalAlignTop !== undefined) {this.verticalAlignTop = properties.verticalAlignTop;} + if (properties.triggerFunction !== undefined) {this.triggerFunction = properties.triggerFunction;} + + if (this.id === undefined) { + throw "Node must have an id"; + } + + // copy group properties + if (this.group !== undefined && this.group != "") { + var groupObj = this.grouplist.get(this.group); + for (var prop in groupObj) { + if (groupObj.hasOwnProperty(prop)) { + this[prop] = groupObj[prop]; + } + } + } + + + // individual shape properties + if (properties.shape !== undefined) {this.shape = properties.shape;} + if (properties.image !== undefined) {this.image = properties.image;} + if (properties.radius !== undefined) {this.radius = properties.radius; this.baseRadiusValue = this.radius;} + if (properties.color !== undefined) {this.color = util.parseColor(properties.color);} + + if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} + if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} + if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} + + if (this.image !== undefined && this.image != "") { + if (this.imagelist) { + this.imageObj = this.imagelist.load(this.image); + } + else { + throw "No imagelist provided"; + } + } + + this.xFixed = this.xFixed || (properties.x !== undefined && !properties.allowedToMoveX); + this.yFixed = this.yFixed || (properties.y !== undefined && !properties.allowedToMoveY); + this.radiusFixed = this.radiusFixed || (properties.radius !== undefined); + + if (this.shape == 'image') { + this.radiusMin = constants.nodes.widthMin; + this.radiusMax = constants.nodes.widthMax; + } + + // choose draw method depending on the shape + switch (this.shape) { + case 'database': this.draw = this._drawDatabase; this.resize = this._resizeDatabase; break; + case 'box': this.draw = this._drawBox; this.resize = this._resizeBox; break; + case 'circle': this.draw = this._drawCircle; this.resize = this._resizeCircle; break; + case 'ellipse': this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break; + // TODO: add diamond shape + case 'image': this.draw = this._drawImage; this.resize = this._resizeImage; break; + case 'text': this.draw = this._drawText; this.resize = this._resizeText; break; + case 'dot': this.draw = this._drawDot; this.resize = this._resizeShape; break; + case 'square': this.draw = this._drawSquare; this.resize = this._resizeShape; break; + case 'triangle': this.draw = this._drawTriangle; this.resize = this._resizeShape; break; + case 'triangleDown': this.draw = this._drawTriangleDown; this.resize = this._resizeShape; break; + case 'star': this.draw = this._drawStar; this.resize = this._resizeShape; break; + default: this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break; + } + // reset the size of the node, this can be changed + this._reset(); + }; + + /** + * select this node + */ + Node.prototype.select = function() { + this.selected = true; + this._reset(); + }; + + /** + * unselect this node + */ + Node.prototype.unselect = function() { + this.selected = false; + this._reset(); + }; + + + /** + * Reset the calculated size of the node, forces it to recalculate its size + */ + Node.prototype.clearSizeCache = function() { + this._reset(); + }; + + /** + * Reset the calculated size of the node, forces it to recalculate its size + * @private + */ + Node.prototype._reset = function() { + this.width = undefined; + this.height = undefined; + }; + + /** + * get the title of this node. + * @return {string} title The title of the node, or undefined when no title + * has been set. + */ + Node.prototype.getTitle = function() { + return typeof this.title === "function" ? this.title() : this.title; + }; + + /** + * Calculate the distance to the border of the Node + * @param {CanvasRenderingContext2D} ctx + * @param {Number} angle Angle in radians + * @returns {number} distance Distance to the border in pixels + */ + Node.prototype.distanceToBorder = function (ctx, angle) { + var borderWidth = 1; + + if (!this.width) { + this.resize(ctx); + } + + switch (this.shape) { + case 'circle': + case 'dot': + return this.radius + borderWidth; + + case 'ellipse': + var a = this.width / 2; + var b = this.height / 2; + var w = (Math.sin(angle) * a); + var h = (Math.cos(angle) * b); + return a * b / Math.sqrt(w * w + h * h); + + // TODO: implement distanceToBorder for database + // TODO: implement distanceToBorder for triangle + // TODO: implement distanceToBorder for triangleDown + + case 'box': + case 'image': + case 'text': + default: + if (this.width) { + return Math.min( + Math.abs(this.width / 2 / Math.cos(angle)), + Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; + // TODO: reckon with border radius too in case of box + } + else { + return 0; + } + + } + // TODO: implement calculation of distance to border for all shapes + }; + + /** + * Set forces acting on the node + * @param {number} fx Force in horizontal direction + * @param {number} fy Force in vertical direction + */ + Node.prototype._setForce = function(fx, fy) { + this.fx = fx; + this.fy = fy; + }; + + /** + * Add forces acting on the node + * @param {number} fx Force in horizontal direction + * @param {number} fy Force in vertical direction + * @private + */ + Node.prototype._addForce = function(fx, fy) { + this.fx += fx; + this.fy += fy; + }; + + /** + * Perform one discrete step for the node + * @param {number} interval Time interval in seconds + */ + Node.prototype.discreteStep = function(interval) { + if (!this.xFixed) { + var dx = this.damping * this.vx; // damping force + var ax = (this.fx - dx) / this.mass; // acceleration + this.vx += ax * interval; // velocity + this.x += this.vx * interval; // position + } + + if (!this.yFixed) { + var dy = this.damping * this.vy; // damping force + var ay = (this.fy - dy) / this.mass; // acceleration + this.vy += ay * interval; // velocity + this.y += this.vy * interval; // position + } + }; + + + + /** + * Perform one discrete step for the node + * @param {number} interval Time interval in seconds + * @param {number} maxVelocity The speed limit imposed on the velocity + */ + Node.prototype.discreteStepLimited = function(interval, maxVelocity) { + if (!this.xFixed) { + var dx = this.damping * this.vx; // damping force + var ax = (this.fx - dx) / this.mass; // acceleration + this.vx += ax * interval; // velocity + this.vx = (Math.abs(this.vx) > maxVelocity) ? ((this.vx > 0) ? maxVelocity : -maxVelocity) : this.vx; + this.x += this.vx * interval; // position + } + else { + this.fx = 0; + } + + if (!this.yFixed) { + var dy = this.damping * this.vy; // damping force + var ay = (this.fy - dy) / this.mass; // acceleration + this.vy += ay * interval; // velocity + this.vy = (Math.abs(this.vy) > maxVelocity) ? ((this.vy > 0) ? maxVelocity : -maxVelocity) : this.vy; + this.y += this.vy * interval; // position + } + else { + this.fy = 0; + } + }; + + /** + * Check if this node has a fixed x and y position + * @return {boolean} true if fixed, false if not + */ + Node.prototype.isFixed = function() { + return (this.xFixed && this.yFixed); + }; + + /** + * Check if this node is moving + * @param {number} vmin the minimum velocity considered as "moving" + * @return {boolean} true if moving, false if it has no velocity + */ + // TODO: replace this method with calculating the kinetic energy + Node.prototype.isMoving = function(vmin) { + return (Math.abs(this.vx) > vmin || Math.abs(this.vy) > vmin); + }; + + /** + * check if this node is selecte + * @return {boolean} selected True if node is selected, else false + */ + Node.prototype.isSelected = function() { + return this.selected; + }; + + /** + * Retrieve the value of the node. Can be undefined + * @return {Number} value + */ + Node.prototype.getValue = function() { + return this.value; + }; + + /** + * Calculate the distance from the nodes location to the given location (x,y) + * @param {Number} x + * @param {Number} y + * @return {Number} value + */ + Node.prototype.getDistance = function(x, y) { + var dx = this.x - x, + dy = this.y - y; + return Math.sqrt(dx * dx + dy * dy); + }; + + + /** + * Adjust the value range of the node. The node will adjust it's radius + * based on its value. + * @param {Number} min + * @param {Number} max + */ + Node.prototype.setValueRange = function(min, max) { + if (!this.radiusFixed && this.value !== undefined) { + if (max == min) { + this.radius = (this.radiusMin + this.radiusMax) / 2; + } + else { + var scale = (this.radiusMax - this.radiusMin) / (max - min); + this.radius = (this.value - min) * scale + this.radiusMin; + } + } + this.baseRadiusValue = this.radius; + }; + + /** + * Draw this node in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ + Node.prototype.draw = function(ctx) { + throw "Draw method not initialized for node"; + }; + + /** + * Recalculate the size of this node in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ + Node.prototype.resize = function(ctx) { + throw "Resize method not initialized for node"; + }; + + /** + * Check if this object is overlapping with the provided object + * @param {Object} obj an object with parameters left, top, right, bottom + * @return {boolean} True if location is located on node + */ + Node.prototype.isOverlappingWith = function(obj) { + return (this.left < obj.right && + this.left + this.width > obj.left && + this.top < obj.bottom && + this.top + this.height > obj.top); + }; + + Node.prototype._resizeImage = function (ctx) { + // TODO: pre calculate the image size + + if (!this.width || !this.height) { // undefined or 0 + var width, height; + if (this.value) { + this.radius = this.baseRadiusValue; + var scale = this.imageObj.height / this.imageObj.width; + if (scale !== undefined) { + width = this.radius || this.imageObj.width; + height = this.radius * scale || this.imageObj.height; + } + else { + width = 0; + height = 0; + } + } + else { + width = this.imageObj.width; + height = this.imageObj.height; + } + this.width = width; + this.height = height; + + this.growthIndicator = 0; + if (this.width > 0 && this.height > 0) { + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - width; + } + } + + }; + + Node.prototype._drawImage = function (ctx) { + this._resizeImage(ctx); + + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var yLabel; + if (this.imageObj.width != 0 ) { + // draw the shade + if (this.clusterSize > 1) { + var lineWidth = ((this.clusterSize > 1) ? 10 : 0.0); + lineWidth *= this.networkScaleInv; + lineWidth = Math.min(0.2 * this.width,lineWidth); + + ctx.globalAlpha = 0.5; + ctx.drawImage(this.imageObj, this.left - lineWidth, this.top - lineWidth, this.width + 2*lineWidth, this.height + 2*lineWidth); + } + + // draw the image + ctx.globalAlpha = 1.0; + ctx.drawImage(this.imageObj, this.left, this.top, this.width, this.height); + yLabel = this.y + this.height / 2; + } + else { + // image still loading... just draw the label for now + yLabel = this.y; + } + + this._label(ctx, this.label, this.x, yLabel, undefined, "top"); + }; + + + Node.prototype._resizeBox = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + this.width = textSize.width + 2 * margin; + this.height = textSize.height + 2 * margin; + + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor; + this.growthIndicator = this.width - (textSize.width + 2 * margin); + // this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; + + } + }; + + Node.prototype._drawBox = function (ctx) { + this._resizeBox(ctx); + + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.roundRect(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth, this.radius); + ctx.stroke(); + } + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background; + + ctx.roundRect(this.left, this.top, this.width, this.height, this.radius); + ctx.fill(); + ctx.stroke(); + + this._label(ctx, this.label, this.x, this.y); + }; + + + Node.prototype._resizeDatabase = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + var size = textSize.width + 2 * margin; + this.width = size; + this.height = size; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - size; + } + }; + + Node.prototype._drawDatabase = function (ctx) { + this._resizeDatabase(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.database(this.x - this.width/2 - 2*ctx.lineWidth, this.y - this.height*0.5 - 2*ctx.lineWidth, this.width + 4*ctx.lineWidth, this.height + 4*ctx.lineWidth); + ctx.stroke(); + } + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + ctx.database(this.x - this.width/2, this.y - this.height*0.5, this.width, this.height); + ctx.fill(); + ctx.stroke(); + + this._label(ctx, this.label, this.x, this.y); + }; + + + Node.prototype._resizeCircle = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + var diameter = Math.max(textSize.width, textSize.height) + 2 * margin; + this.radius = diameter / 2; + + this.width = diameter; + this.height = diameter; + + // scaling used for clustering + // this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor; + // this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; + this.growthIndicator = this.radius - 0.5*diameter; + } + }; + + Node.prototype._drawCircle = function (ctx) { + this._resizeCircle(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.circle(this.x, this.y, this.radius+2*ctx.lineWidth); + ctx.stroke(); + } + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + ctx.circle(this.x, this.y, this.radius); + ctx.fill(); + ctx.stroke(); + + this._label(ctx, this.label, this.x, this.y); + }; + + Node.prototype._resizeEllipse = function (ctx) { + if (!this.width) { + var textSize = this.getTextSize(ctx); + + this.width = textSize.width * 1.5; + this.height = textSize.height * 2; + if (this.width < this.height) { + this.width = this.height; + } + var defaultSize = this.width; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - defaultSize; + } + }; + + Node.prototype._drawEllipse = function (ctx) { + this._resizeEllipse(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.ellipse(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth); + ctx.stroke(); + } + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + + ctx.ellipse(this.left, this.top, this.width, this.height); + ctx.fill(); + ctx.stroke(); + this._label(ctx, this.label, this.x, this.y); + }; + + Node.prototype._drawDot = function (ctx) { + this._drawShape(ctx, 'circle'); + }; + + Node.prototype._drawTriangle = function (ctx) { + this._drawShape(ctx, 'triangle'); + }; + + Node.prototype._drawTriangleDown = function (ctx) { + this._drawShape(ctx, 'triangleDown'); + }; + + Node.prototype._drawSquare = function (ctx) { + this._drawShape(ctx, 'square'); + }; + + Node.prototype._drawStar = function (ctx) { + this._drawShape(ctx, 'star'); + }; + + Node.prototype._resizeShape = function (ctx) { + if (!this.width) { + this.radius = this.baseRadiusValue; + var size = 2 * this.radius; + this.width = size; + this.height = size; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - size; + } + }; + + Node.prototype._drawShape = function (ctx, shape) { + this._resizeShape(ctx); + + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + var radiusMultiplier = 2; + + // choose draw method depending on the shape + switch (shape) { + case 'dot': radiusMultiplier = 2; break; + case 'square': radiusMultiplier = 2; break; + case 'triangle': radiusMultiplier = 3; break; + case 'triangleDown': radiusMultiplier = 3; break; + case 'star': radiusMultiplier = 4; break; + } + + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx[shape](this.x, this.y, this.radius + radiusMultiplier * ctx.lineWidth); + ctx.stroke(); + } + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + ctx[shape](this.x, this.y, this.radius); + ctx.fill(); + ctx.stroke(); + + if (this.label) { + this._label(ctx, this.label, this.x, this.y + this.height / 2, undefined, 'top',true); + } + }; + + Node.prototype._resizeText = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + this.width = textSize.width + 2 * margin; + this.height = textSize.height + 2 * margin; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - (textSize.width + 2 * margin); + } + }; + + Node.prototype._drawText = function (ctx) { + this._resizeText(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + this._label(ctx, this.label, this.x, this.y); + }; + + + Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNode) { + if (text && this.fontSize * this.networkScale > this.fontDrawThreshold) { + ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace; + ctx.fillStyle = this.fontColor || "black"; + ctx.textAlign = align || "center"; + ctx.textBaseline = baseline || "middle"; + + var lines = text.split('\n'); + var lineCount = lines.length; + var fontSize = (this.fontSize + 4); + var yLine = y + (1 - lineCount) / 2 * fontSize; + if (labelUnderNode == true) { + yLine = y + (1 - lineCount) / (2 * fontSize); + } + + for (var i = 0; i < lineCount; i++) { + ctx.fillText(lines[i], x, yLine); + yLine += fontSize; + } + } + }; + + + Node.prototype.getTextSize = function(ctx) { + if (this.label !== undefined) { + ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace; + + var lines = this.label.split('\n'), + height = (this.fontSize + 4) * lines.length, + width = 0; + + for (var i = 0, iMax = lines.length; i < iMax; i++) { + width = Math.max(width, ctx.measureText(lines[i]).width); + } + + return {"width": width, "height": height}; + } + else { + return {"width": 0, "height": 0}; + } + }; + + /** + * this is used to determine if a node is visible at all. this is used to determine when it needs to be drawn. + * there is a safety margin of 0.3 * width; + * + * @returns {boolean} + */ + Node.prototype.inArea = function() { + if (this.width !== undefined) { + return (this.x + this.width *this.networkScaleInv >= this.canvasTopLeft.x && + this.x - this.width *this.networkScaleInv < this.canvasBottomRight.x && + this.y + this.height*this.networkScaleInv >= this.canvasTopLeft.y && + this.y - this.height*this.networkScaleInv < this.canvasBottomRight.y); + } + else { + return true; + } + }; + + /** + * checks if the core of the node is in the display area, this is used for opening clusters around zoom + * @returns {boolean} + */ + Node.prototype.inView = function() { + return (this.x >= this.canvasTopLeft.x && + this.x < this.canvasBottomRight.x && + this.y >= this.canvasTopLeft.y && + this.y < this.canvasBottomRight.y); + }; + + /** + * This allows the zoom level of the network to influence the rendering + * We store the inverted scale and the coordinates of the top left, and bottom right points of the canvas + * + * @param scale + * @param canvasTopLeft + * @param canvasBottomRight + */ + Node.prototype.setScaleAndPos = function(scale,canvasTopLeft,canvasBottomRight) { + this.networkScaleInv = 1.0/scale; + this.networkScale = scale; + this.canvasTopLeft = canvasTopLeft; + this.canvasBottomRight = canvasBottomRight; + }; + + + /** + * This allows the zoom level of the network to influence the rendering + * + * @param scale + */ + Node.prototype.setScale = function(scale) { + this.networkScaleInv = 1.0/scale; + this.networkScale = scale; + }; + + + + /** + * set the velocity at 0. Is called when this node is contained in another during clustering + */ + Node.prototype.clearVelocity = function() { + this.vx = 0; + this.vy = 0; + }; + + + /** + * Basic preservation of (kinectic) energy + * + * @param massBeforeClustering + */ + Node.prototype.updateVelocity = function(massBeforeClustering) { + var energyBefore = this.vx * this.vx * massBeforeClustering; + //this.vx = (this.vx < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass); + this.vx = Math.sqrt(energyBefore/this.mass); + energyBefore = this.vy * this.vy * massBeforeClustering; + //this.vy = (this.vy < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass); + this.vy = Math.sqrt(energyBefore/this.mass); + }; + + module.exports = Node; + + +/***/ }, +/* 45 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var Node = __webpack_require__(44); + + /** + * @class Edge + * + * A edge connects two nodes + * @param {Object} properties Object with properties. Must contain + * At least properties from and to. + * Available properties: from (number), + * to (number), label (string, color (string), + * width (number), style (string), + * length (number), title (string) + * @param {Network} network A Network object, used to find and edge to + * nodes. + * @param {Object} constants An object with default values for + * example for the color + */ + function Edge (properties, network, constants) { + if (!network) { + throw "No network provided"; + } + this.network = network; + + // initialize constants + this.widthMin = constants.edges.widthMin; + this.widthMax = constants.edges.widthMax; + + // initialize variables + this.id = undefined; + this.fromId = undefined; + this.toId = undefined; + this.style = constants.edges.style; + this.title = undefined; + this.width = constants.edges.width; + this.widthSelectionMultiplier = constants.edges.widthSelectionMultiplier; + this.widthSelected = this.width * this.widthSelectionMultiplier; + this.hoverWidth = constants.edges.hoverWidth; + this.value = undefined; + this.length = constants.physics.springLength; + this.customLength = false; + this.selected = false; + this.hover = false; + this.smoothCurves = constants.smoothCurves; + this.dynamicSmoothCurves = constants.dynamicSmoothCurves; + this.arrowScaleFactor = constants.edges.arrowScaleFactor; + this.inheritColor = constants.edges.inheritColor; + + this.from = null; // a node + this.to = null; // a node + this.via = null; // a temp node + + // we use this to be able to reconnect the edge to a cluster if its node is put into a cluster + // by storing the original information we can revert to the original connection when the cluser is opened. + this.originalFromId = []; + this.originalToId = []; + + this.connected = false; + + // Added to support dashed lines + // David Jordan + // 2012-08-08 + this.dash = util.extend({}, constants.edges.dash); // contains properties length, gap, altLength + + this.color = {color:constants.edges.color.color, + highlight:constants.edges.color.highlight, + hover:constants.edges.color.hover}; + this.widthFixed = false; + this.lengthFixed = false; + + this.setProperties(properties, constants); + + this.controlNodesEnabled = false; + this.controlNodes = {from:null, to:null, positions:{}}; + this.connectedNode = null; + } + + /** + * Set or overwrite properties for the edge + * @param {Object} properties an object with properties + * @param {Object} constants and object with default, global properties + */ + Edge.prototype.setProperties = function(properties, constants) { + if (!properties) { + return; + } + + if (properties.from !== undefined) {this.fromId = properties.from;} + if (properties.to !== undefined) {this.toId = properties.to;} + + if (properties.id !== undefined) {this.id = properties.id;} + if (properties.style !== undefined) {this.style = properties.style;} + if (properties.label !== undefined) {this.label = properties.label;} + + if (this.label) { + this.fontSize = constants.edges.fontSize; + this.fontFace = constants.edges.fontFace; + this.fontColor = constants.edges.fontColor; + this.fontFill = constants.edges.fontFill; + + if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} + if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} + if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} + if (properties.fontFill !== undefined) {this.fontFill = properties.fontFill;} + } + + if (properties.title !== undefined) {this.title = properties.title;} + if (properties.width !== undefined) {this.width = properties.width;} + if (properties.widthSelectionMultiplier !== undefined) + {this.widthSelectionMultiplier = properties.widthSelectionMultiplier;} + if (properties.hoverWidth !== undefined) {this.hoverWidth = properties.hoverWidth;} + if (properties.value !== undefined) {this.value = properties.value;} + if (properties.length !== undefined) {this.length = properties.length; + this.customLength = true;} + + // scale the arrow + if (properties.arrowScaleFactor !== undefined) {this.arrowScaleFactor = properties.arrowScaleFactor;} + + if (properties.inheritColor !== undefined) {this.inheritColor = properties.inheritColor;} + + // Added to support dashed lines + // David Jordan + // 2012-08-08 + if (properties.dash) { + if (properties.dash.length !== undefined) {this.dash.length = properties.dash.length;} + if (properties.dash.gap !== undefined) {this.dash.gap = properties.dash.gap;} + if (properties.dash.altLength !== undefined) {this.dash.altLength = properties.dash.altLength;} + } + + if (properties.color !== undefined) { + if (util.isString(properties.color)) { + this.color.color = properties.color; + this.color.highlight = properties.color; + } + else { + if (properties.color.color !== undefined) {this.color.color = properties.color.color;} + if (properties.color.highlight !== undefined) {this.color.highlight = properties.color.highlight;} + if (properties.color.hover !== undefined) {this.color.hover = properties.color.hover;} + } + } + + // A node is connected when it has a from and to node. + this.connect(); + + this.widthFixed = this.widthFixed || (properties.width !== undefined); + this.lengthFixed = this.lengthFixed || (properties.length !== undefined); + + this.widthSelected = this.width * this.widthSelectionMultiplier; + + // set draw method based on style + switch (this.style) { + case 'line': this.draw = this._drawLine; break; + case 'arrow': this.draw = this._drawArrow; break; + case 'arrow-center': this.draw = this._drawArrowCenter; break; + case 'dash-line': this.draw = this._drawDashLine; break; + default: this.draw = this._drawLine; break; + } + }; + + /** + * Connect an edge to its nodes + */ + Edge.prototype.connect = function () { + this.disconnect(); + + this.from = this.network.nodes[this.fromId] || null; + this.to = this.network.nodes[this.toId] || null; + this.connected = (this.from && this.to); + + if (this.connected) { + this.from.attachEdge(this); + this.to.attachEdge(this); + } + else { + if (this.from) { + this.from.detachEdge(this); + } + if (this.to) { + this.to.detachEdge(this); + } + } + }; + + /** + * Disconnect an edge from its nodes + */ + Edge.prototype.disconnect = function () { + if (this.from) { + this.from.detachEdge(this); + this.from = null; + } + if (this.to) { + this.to.detachEdge(this); + this.to = null; + } + + this.connected = false; + }; + + /** + * get the title of this edge. + * @return {string} title The title of the edge, or undefined when no title + * has been set. + */ + Edge.prototype.getTitle = function() { + return typeof this.title === "function" ? this.title() : this.title; + }; + + + /** + * Retrieve the value of the edge. Can be undefined + * @return {Number} value + */ + Edge.prototype.getValue = function() { + return this.value; + }; + + /** + * Adjust the value range of the edge. The edge will adjust it's width + * based on its value. + * @param {Number} min + * @param {Number} max + */ + Edge.prototype.setValueRange = function(min, max) { + if (!this.widthFixed && this.value !== undefined) { + var scale = (this.widthMax - this.widthMin) / (max - min); + this.width = (this.value - min) * scale + this.widthMin; + this.widthSelected = this.width * this.widthSelectionMultiplier; + } + }; + + /** + * Redraw a edge + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ + Edge.prototype.draw = function(ctx) { + throw "Method draw not initialized in edge"; + }; + + /** + * Check if this object is overlapping with the provided object + * @param {Object} obj an object with parameters left, top + * @return {boolean} True if location is located on the edge + */ + Edge.prototype.isOverlappingWith = function(obj) { + if (this.connected) { + var distMax = 10; + var xFrom = this.from.x; + var yFrom = this.from.y; + var xTo = this.to.x; + var yTo = this.to.y; + var xObj = obj.left; + var yObj = obj.top; + + var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj); + + return (dist < distMax); + } + else { + return false + } + }; + + Edge.prototype._getColor = function() { + var colorObj = this.color; + if (this.inheritColor == "to") { + colorObj = { + highlight: this.to.color.highlight.border, + hover: this.to.color.hover.border, + color: this.to.color.border + }; + } + else if (this.inheritColor == "from" || this.inheritColor == true) { + colorObj = { + highlight: this.from.color.highlight.border, + hover: this.from.color.hover.border, + color: this.from.color.border + }; + } + + if (this.selected == true) {return colorObj.highlight;} + else if (this.hover == true) {return colorObj.hover;} + else {return colorObj.color;} + } + + + /** + * Redraw a edge as a line + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Edge.prototype._drawLine = function(ctx) { + // set style + ctx.strokeStyle = this._getColor(); + ctx.lineWidth = this._getLineWidth(); + + if (this.from != this.to) { + // draw line + var via = this._line(ctx); + + // draw label + var point; + if (this.label) { + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; + } + else { + point = this._pointOnLine(0.5); + } + this._label(ctx, this.label, point.x, point.y); + } + } + else { + var x, y; + var radius = this.length / 4; + var node = this.from; + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width / 2; + y = node.y - radius; + } + else { + x = node.x + radius; + y = node.y - node.height / 2; + } + this._circle(ctx, x, y, radius); + point = this._pointOnCircle(x, y, radius, 0.5); + this._label(ctx, this.label, point.x, point.y); + } + }; + + /** + * Get the line width of the edge. Depends on width and whether one of the + * connected nodes is selected. + * @return {Number} width + * @private + */ + Edge.prototype._getLineWidth = function() { + if (this.selected == true) { + return Math.min(this.widthSelected, this.widthMax)*this.networkScaleInv; + } + else { + if (this.hover == true) { + return Math.min(this.hoverWidth, this.widthMax)*this.networkScaleInv; + } + else { + return this.width*this.networkScaleInv; + } + } + }; + + Edge.prototype._getViaCoordinates = function () { + var xVia = null; + var yVia = null; + var factor = this.smoothCurves.roundness; + var type = this.smoothCurves.type; + + var dx = Math.abs(this.from.x - this.to.x); + var dy = Math.abs(this.from.y - this.to.y); + if (type == 'discrete' || type == 'diagonalCross') { + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dy; + yVia = this.from.y - factor * dy; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dy; + yVia = this.from.y - factor * dy; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dy; + yVia = this.from.y + factor * dy; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dy; + yVia = this.from.y + factor * dy; + } + } + if (type == "discrete") { + xVia = dx < factor * dy ? this.from.x : xVia; + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dx; + yVia = this.from.y - factor * dx; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dx; + yVia = this.from.y - factor * dx; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dx; + yVia = this.from.y + factor * dx; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dx; + yVia = this.from.y + factor * dx; + } + } + if (type == "discrete") { + yVia = dy < factor * dx ? this.from.y : yVia; + } + } + } + else if (type == "straightCross") { + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { // up - down + xVia = this.from.x; + if (this.from.y < this.to.y) { + yVia = this.to.y - (1-factor) * dy; + } + else { + yVia = this.to.y + (1-factor) * dy; + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { // left - right + if (this.from.x < this.to.x) { + xVia = this.to.x - (1-factor) * dx; + } + else { + xVia = this.to.x + (1-factor) * dx; + } + yVia = this.from.y; + } + } + else if (type == 'horizontal') { + if (this.from.x < this.to.x) { + xVia = this.to.x - (1-factor) * dx; + } + else { + xVia = this.to.x + (1-factor) * dx; + } + yVia = this.from.y; + } + else if (type == 'vertical') { + xVia = this.from.x; + if (this.from.y < this.to.y) { + yVia = this.to.y - (1-factor) * dy; + } + else { + yVia = this.to.y + (1-factor) * dy; + } + } + else { // continuous + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + // console.log(1) + xVia = this.from.x + factor * dy; + yVia = this.from.y - factor * dy; + xVia = this.to.x < xVia ? this.to.x : xVia; + } + else if (this.from.x > this.to.x) { + // console.log(2) + xVia = this.from.x - factor * dy; + yVia = this.from.y - factor * dy; + xVia = this.to.x > xVia ? this.to.x :xVia; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + // console.log(3) + xVia = this.from.x + factor * dy; + yVia = this.from.y + factor * dy; + xVia = this.to.x < xVia ? this.to.x : xVia; + } + else if (this.from.x > this.to.x) { + // console.log(4, this.from.x, this.to.x) + xVia = this.from.x - factor * dy; + yVia = this.from.y + factor * dy; + xVia = this.to.x > xVia ? this.to.x : xVia; + } + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + // console.log(5) + xVia = this.from.x + factor * dx; + yVia = this.from.y - factor * dx; + yVia = this.to.y > yVia ? this.to.y : yVia; + } + else if (this.from.x > this.to.x) { + // console.log(6) + xVia = this.from.x - factor * dx; + yVia = this.from.y - factor * dx; + yVia = this.to.y > yVia ? this.to.y : yVia; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + // console.log(7) + xVia = this.from.x + factor * dx; + yVia = this.from.y + factor * dx; + yVia = this.to.y < yVia ? this.to.y : yVia; + } + else if (this.from.x > this.to.x) { + // console.log(8) + xVia = this.from.x - factor * dx; + yVia = this.from.y + factor * dx; + yVia = this.to.y < yVia ? this.to.y : yVia; + } + } + } + } + + + return {x:xVia, y:yVia}; + } + + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Edge.prototype._line = function (ctx) { + // draw a straight line + ctx.beginPath(); + ctx.moveTo(this.from.x, this.from.y); + if (this.smoothCurves.enabled == true) { + if (this.smoothCurves.dynamic == false) { + var via = this._getViaCoordinates(); + if (via.x == null) { + ctx.lineTo(this.to.x, this.to.y); + ctx.stroke(); + return null; + } + else { + // this.via.x = via.x; + // this.via.y = via.y; + ctx.quadraticCurveTo(via.x,via.y,this.to.x, this.to.y); + ctx.stroke(); + return via; + } + } + else { + ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y); + ctx.stroke(); + return this.via; + } + } + else { + ctx.lineTo(this.to.x, this.to.y); + ctx.stroke(); + return null; + } + }; + + /** + * Draw a line from a node to itself, a circle + * @param {CanvasRenderingContext2D} ctx + * @param {Number} x + * @param {Number} y + * @param {Number} radius + * @private + */ + Edge.prototype._circle = function (ctx, x, y, radius) { + // draw a circle + ctx.beginPath(); + ctx.arc(x, y, radius, 0, 2 * Math.PI, false); + ctx.stroke(); + }; + + /** + * Draw label with white background and with the middle at (x, y) + * @param {CanvasRenderingContext2D} ctx + * @param {String} text + * @param {Number} x + * @param {Number} y + * @private + */ + Edge.prototype._label = function (ctx, text, x, y) { + if (text) { + // TODO: cache the calculated size + ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") + + this.fontSize + "px " + this.fontFace; + ctx.fillStyle = this.fontFill; + var width = ctx.measureText(text).width; + var height = this.fontSize; + var left = x - width / 2; + var top = y - height / 2; + + ctx.fillRect(left, top, width, height); + + // draw text + ctx.fillStyle = this.fontColor || "black"; + ctx.textAlign = "left"; + ctx.textBaseline = "top"; + ctx.fillText(text, left, top); + } + }; + + /** + * Redraw a edge as a dashed line + * Draw this edge in the given canvas + * @author David Jordan + * @date 2012-08-08 + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Edge.prototype._drawDashLine = function(ctx) { + // set style + if (this.selected == true) {ctx.strokeStyle = this.color.highlight;} + else if (this.hover == true) {ctx.strokeStyle = this.color.hover;} + else {ctx.strokeStyle = this.color.color;} + + ctx.lineWidth = this._getLineWidth(); + + var via = null; + // only firefox and chrome support this method, else we use the legacy one. + if (ctx.mozDash !== undefined || ctx.setLineDash !== undefined) { + // configure the dash pattern + var pattern = [0]; + if (this.dash.length !== undefined && this.dash.gap !== undefined) { + pattern = [this.dash.length,this.dash.gap]; + } + else { + pattern = [5,5]; + } + + // set dash settings for chrome or firefox + if (typeof ctx.setLineDash !== 'undefined') { //Chrome + ctx.setLineDash(pattern); + ctx.lineDashOffset = 0; + + } else { //Firefox + ctx.mozDash = pattern; + ctx.mozDashOffset = 0; + } + + // draw the line + via = this._line(ctx); + + // restore the dash settings. + if (typeof ctx.setLineDash !== 'undefined') { //Chrome + ctx.setLineDash([0]); + ctx.lineDashOffset = 0; + + } else { //Firefox + ctx.mozDash = [0]; + ctx.mozDashOffset = 0; + } + } + else { // unsupporting smooth lines + // draw dashed line + ctx.beginPath(); + ctx.lineCap = 'round'; + if (this.dash.altLength !== undefined) //If an alt dash value has been set add to the array this value + { + ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y, + [this.dash.length,this.dash.gap,this.dash.altLength,this.dash.gap]); + } + else if (this.dash.length !== undefined && this.dash.gap !== undefined) //If a dash and gap value has been set add to the array this value + { + ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y, + [this.dash.length,this.dash.gap]); + } + else //If all else fails draw a line + { + ctx.moveTo(this.from.x, this.from.y); + ctx.lineTo(this.to.x, this.to.y); + } + ctx.stroke(); + } + + // draw label + if (this.label) { + var point; + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; + } + else { + point = this._pointOnLine(0.5); + } + this._label(ctx, this.label, point.x, point.y); + } + }; + + /** + * Get a point on a line + * @param {Number} percentage. Value between 0 (line start) and 1 (line end) + * @return {Object} point + * @private + */ + Edge.prototype._pointOnLine = function (percentage) { + return { + x: (1 - percentage) * this.from.x + percentage * this.to.x, + y: (1 - percentage) * this.from.y + percentage * this.to.y + } + }; + + /** + * Get a point on a circle + * @param {Number} x + * @param {Number} y + * @param {Number} radius + * @param {Number} percentage. Value between 0 (line start) and 1 (line end) + * @return {Object} point + * @private + */ + Edge.prototype._pointOnCircle = function (x, y, radius, percentage) { + var angle = (percentage - 3/8) * 2 * Math.PI; + return { + x: x + radius * Math.cos(angle), + y: y - radius * Math.sin(angle) + } + }; + + /** + * Redraw a edge as a line with an arrow halfway the line + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Edge.prototype._drawArrowCenter = function(ctx) { + var point; + // set style + if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;} + else if (this.hover == true) {ctx.strokeStyle = this.color.hover; ctx.fillStyle = this.color.hover;} + else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;} + ctx.lineWidth = this._getLineWidth(); + + if (this.from != this.to) { + // draw line + var via = this._line(ctx); + + var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); + var length = (10 + 5 * this.width) * this.arrowScaleFactor; + // draw an arrow halfway the line + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; + } + else { + point = this._pointOnLine(0.5); + } + + ctx.arrow(point.x, point.y, angle, length); + ctx.fill(); + ctx.stroke(); + + // draw label + if (this.label) { + this._label(ctx, this.label, point.x, point.y); + } + } + else { + // draw circle + var x, y; + var radius = 0.25 * Math.max(100,this.length); + var node = this.from; + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width * 0.5; + y = node.y - radius; + } + else { + x = node.x + radius; + y = node.y - node.height * 0.5; + } + this._circle(ctx, x, y, radius); + + // draw all arrows + var angle = 0.2 * Math.PI; + var length = (10 + 5 * this.width) * this.arrowScaleFactor; + point = this._pointOnCircle(x, y, radius, 0.5); + ctx.arrow(point.x, point.y, angle, length); + ctx.fill(); + ctx.stroke(); + + // draw label + if (this.label) { + point = this._pointOnCircle(x, y, radius, 0.5); + this._label(ctx, this.label, point.x, point.y); + } + } + }; + + + + /** + * Redraw a edge as a line with an arrow + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Edge.prototype._drawArrow = function(ctx) { + // set style + if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;} + else if (this.hover == true) {ctx.strokeStyle = this.color.hover; ctx.fillStyle = this.color.hover;} + else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;} + + ctx.lineWidth = this._getLineWidth(); + + var angle, length; + //draw a line + if (this.from != this.to) { + angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); + var dx = (this.to.x - this.from.x); + var dy = (this.to.y - this.from.y); + var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + + var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI); + var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength; + var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; + var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; + + var via; + if (this.smoothCurves.dynamic == true && this.smoothCurves.enabled == true ) { + via = this.via; + } + else if (this.smoothCurves.enabled == true) { + via = this._getViaCoordinates(); + } + + if (this.smoothCurves.enabled == true && via.x != null) { + angle = Math.atan2((this.to.y - via.y), (this.to.x - via.x)); + dx = (this.to.x - via.x); + dy = (this.to.y - via.y); + edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + } + var toBorderDist = this.to.distanceToBorder(ctx, angle); + var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; + + var xTo,yTo; + if (this.smoothCurves.enabled == true && via.x != null) { + xTo = (1 - toBorderPoint) * via.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * via.y + toBorderPoint * this.to.y; + } + else { + xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y; + } + + ctx.beginPath(); + ctx.moveTo(xFrom,yFrom); + if (this.smoothCurves.enabled == true && via.x != null) { + ctx.quadraticCurveTo(via.x,via.y,xTo, yTo); + } + else { + ctx.lineTo(xTo, yTo); + } + ctx.stroke(); + + // draw arrow at the end of the line + length = (10 + 5 * this.width) * this.arrowScaleFactor; + ctx.arrow(xTo, yTo, angle, length); + ctx.fill(); + ctx.stroke(); + + // draw label + if (this.label) { + var point; + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; + } + else { + point = this._pointOnLine(0.5); + } + this._label(ctx, this.label, point.x, point.y); + } + } + else { + // draw circle + var node = this.from; + var x, y, arrow; + var radius = 0.25 * Math.max(100,this.length); + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width * 0.5; + y = node.y - radius; + arrow = { + x: x, + y: node.y, + angle: 0.9 * Math.PI + }; + } + else { + x = node.x + radius; + y = node.y - node.height * 0.5; + arrow = { + x: node.x, + y: y, + angle: 0.6 * Math.PI + }; + } + ctx.beginPath(); + // TODO: similarly, for a line without arrows, draw to the border of the nodes instead of the center + ctx.arc(x, y, radius, 0, 2 * Math.PI, false); + ctx.stroke(); + + // draw all arrows + var length = (10 + 5 * this.width) * this.arrowScaleFactor; + ctx.arrow(arrow.x, arrow.y, arrow.angle, length); + ctx.fill(); + ctx.stroke(); + + // draw label + if (this.label) { + point = this._pointOnCircle(x, y, radius, 0.5); + this._label(ctx, this.label, point.x, point.y); + } + } + }; + + + + /** + * Calculate the distance between a point (x3,y3) and a line segment from + * (x1,y1) to (x2,y2). + * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 + * @private + */ + Edge.prototype._getDistanceToEdge = function (x1,y1, x2,y2, x3,y3) { // x3,y3 is the point + if (this.from != this.to) { + if (this.smoothCurves.enabled == true) { + var xVia, yVia; + if (this.smoothCurves.enabled == true && this.smoothCurves.dynamic == true) { + xVia = this.via.x; + yVia = this.via.y; + } + else { + var via = this._getViaCoordinates(); + xVia = via.x; + yVia = via.y; + } + var minDistance = 1e9; + var distance; + var i,t,x,y, lastX, lastY; + for (i = 0; i < 10; i++) { + t = 0.1*i; + x = Math.pow(1-t,2)*x1 + (2*t*(1 - t))*xVia + Math.pow(t,2)*x2; + y = Math.pow(1-t,2)*y1 + (2*t*(1 - t))*yVia + Math.pow(t,2)*y2; + if (i > 0) { + distance = this._getDistanceToLine(lastX,lastY,x,y, x3,y3); + minDistance = distance < minDistance ? distance : minDistance; + } + lastX = x; lastY = y; + } + return minDistance + } + else { + return this._getDistanceToLine(x1,y1,x2,y2,x3,y3); + } + } + else { + var x, y, dx, dy; + var radius = this.length / 4; + var node = this.from; + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width / 2; + y = node.y - radius; + } + else { + x = node.x + radius; + y = node.y - node.height / 2; + } + dx = x - x3; + dy = y - y3; + return Math.abs(Math.sqrt(dx*dx + dy*dy) - radius); + } + }; + + Edge.prototype._getDistanceToLine = function(x1,y1,x2,y2,x3,y3) { + var px = x2-x1, + py = y2-y1, + something = px*px + py*py, + u = ((x3 - x1) * px + (y3 - y1) * py) / something; + + if (u > 1) { + u = 1; + } + else if (u < 0) { + u = 0; + } + + var x = x1 + u * px, + y = y1 + u * py, + dx = x - x3, + dy = y - y3; + + //# Note: If the actual distance does not matter, + //# if you only want to compare what this function + //# returns to other results of this function, you + //# can just return the squared distance instead + //# (i.e. remove the sqrt) to gain a little performance + + return Math.sqrt(dx*dx + dy*dy); + } + + /** + * This allows the zoom level of the network to influence the rendering + * + * @param scale + */ + Edge.prototype.setScale = function(scale) { + this.networkScaleInv = 1.0/scale; + }; + + + Edge.prototype.select = function() { + this.selected = true; + }; + + Edge.prototype.unselect = function() { + this.selected = false; + }; + + Edge.prototype.positionBezierNode = function() { + if (this.via !== null) { + this.via.x = 0.5 * (this.from.x + this.to.x); + this.via.y = 0.5 * (this.from.y + this.to.y); + } + }; + + /** + * This function draws the control nodes for the manipulator. In order to enable this, only set the this.controlNodesEnabled to true. + * @param ctx + */ + Edge.prototype._drawControlNodes = function(ctx) { + if (this.controlNodesEnabled == true) { + if (this.controlNodes.from === null && this.controlNodes.to === null) { + var nodeIdFrom = "edgeIdFrom:".concat(this.id); + var nodeIdTo = "edgeIdTo:".concat(this.id); + var constants = { + nodes:{group:'', radius:8}, + physics:{damping:0}, + clustering: {maxNodeSizeIncrements: 0 ,nodeScaling: {width:0, height: 0, radius:0}} + }; + this.controlNodes.from = new Node( + {id:nodeIdFrom, + shape:'dot', + color:{background:'#ff4e00', border:'#3c3c3c', highlight: {background:'#07f968'}} + },{},{},constants); + this.controlNodes.to = new Node( + {id:nodeIdTo, + shape:'dot', + color:{background:'#ff4e00', border:'#3c3c3c', highlight: {background:'#07f968'}} + },{},{},constants); + } + + if (this.controlNodes.from.selected == false && this.controlNodes.to.selected == false) { + this.controlNodes.positions = this.getControlNodePositions(ctx); + this.controlNodes.from.x = this.controlNodes.positions.from.x; + this.controlNodes.from.y = this.controlNodes.positions.from.y; + this.controlNodes.to.x = this.controlNodes.positions.to.x; + this.controlNodes.to.y = this.controlNodes.positions.to.y; + } + + this.controlNodes.from.draw(ctx); + this.controlNodes.to.draw(ctx); + } + else { + this.controlNodes = {from:null, to:null, positions:{}}; + } + }; + + /** + * Enable control nodes. + * @private + */ + Edge.prototype._enableControlNodes = function() { + this.controlNodesEnabled = true; + }; + + /** + * disable control nodes + * @private + */ + Edge.prototype._disableControlNodes = function() { + this.controlNodesEnabled = false; + }; + + /** + * This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null. + * @param x + * @param y + * @returns {null} + * @private + */ + Edge.prototype._getSelectedControlNode = function(x,y) { + var positions = this.controlNodes.positions; + var fromDistance = Math.sqrt(Math.pow(x - positions.from.x,2) + Math.pow(y - positions.from.y,2)); + var toDistance = Math.sqrt(Math.pow(x - positions.to.x ,2) + Math.pow(y - positions.to.y ,2)); + + if (fromDistance < 15) { + this.connectedNode = this.from; + this.from = this.controlNodes.from; + return this.controlNodes.from; + } + else if (toDistance < 15) { + this.connectedNode = this.to; + this.to = this.controlNodes.to; + return this.controlNodes.to; + } + else { + return null; + } + }; + + + /** + * this resets the control nodes to their original position. + * @private + */ + Edge.prototype._restoreControlNodes = function() { + if (this.controlNodes.from.selected == true) { + this.from = this.connectedNode; + this.connectedNode = null; + this.controlNodes.from.unselect(); + } + if (this.controlNodes.to.selected == true) { + this.to = this.connectedNode; + this.connectedNode = null; + this.controlNodes.to.unselect(); + } + }; + + /** + * this calculates the position of the control nodes on the edges of the parent nodes. + * + * @param ctx + * @returns {{from: {x: number, y: number}, to: {x: *, y: *}}} + */ + Edge.prototype.getControlNodePositions = function(ctx) { + var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); + var dx = (this.to.x - this.from.x); + var dy = (this.to.y - this.from.y); + var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI); + var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength; + var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; + var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; + + var via; + if (this.smoothCurves.dynamic == true && this.smoothCurves.enabled == true) { + via = this.via; + } + else if (this.smoothCurves.enabled == true) { + via = this._getViaCoordinates(); + } + + if (this.smoothCurves.enabled == true && via.x != null) { + angle = Math.atan2((this.to.y - via.y), (this.to.x - via.x)); + dx = (this.to.x - via.x); + dy = (this.to.y - via.y); + edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + } + var toBorderDist = this.to.distanceToBorder(ctx, angle); + var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; + + var xTo,yTo; + if (this.smoothCurves.enabled == true && via.x != null) { + xTo = (1 - toBorderPoint) * via.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * via.y + toBorderPoint * this.to.y; + } + else { + xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y; + } + + return {from:{x:xFrom,y:yFrom},to:{x:xTo,y:yTo}}; + }; + + module.exports = Edge; + +/***/ }, +/* 46 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Popup is a class to create a popup window with some text + * @param {Element} container The container object. + * @param {Number} [x] + * @param {Number} [y] + * @param {String} [text] + * @param {Object} [style] An object containing borderColor, + * backgroundColor, etc. + */ + function Popup(container, x, y, text, style) { + if (container) { + this.container = container; + } + else { + this.container = document.body; + } + + // x, y and text are optional, see if a style object was passed in their place + if (style === undefined) { + if (typeof x === "object") { + style = x; + x = undefined; + } else if (typeof text === "object") { + style = text; + text = undefined; + } else { + // for backwards compatibility, in case clients other than Network are creating Popup directly + style = { + fontColor: 'black', + fontSize: 14, // px + fontFace: 'verdana', + color: { + border: '#666', + background: '#FFFFC6' + } + } + } + } + + this.x = 0; + this.y = 0; + this.padding = 5; + + if (x !== undefined && y !== undefined ) { + this.setPosition(x, y); + } + if (text !== undefined) { + this.setText(text); + } + + // create the frame + this.frame = document.createElement("div"); + var styleAttr = this.frame.style; + styleAttr.position = "absolute"; + styleAttr.visibility = "hidden"; + styleAttr.border = "1px solid " + style.color.border; + styleAttr.color = style.fontColor; + styleAttr.fontSize = style.fontSize + "px"; + styleAttr.fontFamily = style.fontFace; + styleAttr.padding = this.padding + "px"; + styleAttr.backgroundColor = style.color.background; + styleAttr.borderRadius = "3px"; + styleAttr.MozBorderRadius = "3px"; + styleAttr.WebkitBorderRadius = "3px"; + styleAttr.boxShadow = "3px 3px 10px rgba(128, 128, 128, 0.5)"; + styleAttr.whiteSpace = "nowrap"; + this.container.appendChild(this.frame); + } + + /** + * @param {number} x Horizontal position of the popup window + * @param {number} y Vertical position of the popup window + */ + Popup.prototype.setPosition = function(x, y) { + this.x = parseInt(x); + this.y = parseInt(y); + }; + + /** + * Set the text for the popup window. This can be HTML code + * @param {string} text + */ + Popup.prototype.setText = function(text) { + this.frame.innerHTML = text; + }; + + /** + * Show the popup window + * @param {boolean} show Optional. Show or hide the window + */ + Popup.prototype.show = function (show) { + if (show === undefined) { + show = true; + } + + if (show) { + var height = this.frame.clientHeight; + var width = this.frame.clientWidth; + var maxHeight = this.frame.parentNode.clientHeight; + var maxWidth = this.frame.parentNode.clientWidth; + + var top = (this.y - height); + if (top + height + this.padding > maxHeight) { + top = maxHeight - height - this.padding; + } + if (top < this.padding) { + top = this.padding; + } + + var left = this.x; + if (left + width + this.padding > maxWidth) { + left = maxWidth - width - this.padding; + } + if (left < this.padding) { + left = this.padding; + } + + this.frame.style.left = left + "px"; + this.frame.style.top = top + "px"; + this.frame.style.visibility = "visible"; + } + else { + this.hide(); + } + }; + + /** + * Hide the popup window + */ + Popup.prototype.hide = function () { + this.frame.style.visibility = "hidden"; + }; + + module.exports = Popup; + + +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { + + var PhysicsMixin = __webpack_require__(48); + var ClusterMixin = __webpack_require__(52); + var SectorsMixin = __webpack_require__(53); + var SelectionMixin = __webpack_require__(54); + var ManipulationMixin = __webpack_require__(55); + var NavigationMixin = __webpack_require__(56); + var HierarchicalLayoutMixin = __webpack_require__(57); + + /** + * Load a mixin into the network object + * + * @param {Object} sourceVariable | this object has to contain functions. + * @private + */ + exports._loadMixin = function (sourceVariable) { + for (var mixinFunction in sourceVariable) { + if (sourceVariable.hasOwnProperty(mixinFunction)) { + this[mixinFunction] = sourceVariable[mixinFunction]; + } + } + }; + + + /** + * removes a mixin from the network object. + * + * @param {Object} sourceVariable | this object has to contain functions. + * @private + */ + exports._clearMixin = function (sourceVariable) { + for (var mixinFunction in sourceVariable) { + if (sourceVariable.hasOwnProperty(mixinFunction)) { + this[mixinFunction] = undefined; + } + } + }; + + + /** + * Mixin the physics system and initialize the parameters required. + * + * @private + */ + exports._loadPhysicsSystem = function () { + this._loadMixin(PhysicsMixin); + this._loadSelectedForceSolver(); + if (this.constants.configurePhysics == true) { + this._loadPhysicsConfiguration(); + } + }; + + + /** + * Mixin the cluster system and initialize the parameters required. + * + * @private + */ + exports._loadClusterSystem = function () { + this.clusterSession = 0; + this.hubThreshold = 5; + this._loadMixin(ClusterMixin); + }; + + + /** + * Mixin the sector system and initialize the parameters required + * + * @private + */ + exports._loadSectorSystem = function () { + this.sectors = {}; + this.activeSector = ["default"]; + this.sectors["active"] = {}; + this.sectors["active"]["default"] = {"nodes": {}, + "edges": {}, + "nodeIndices": [], + "formationScale": 1.0, + "drawingNode": undefined }; + this.sectors["frozen"] = {}; + this.sectors["support"] = {"nodes": {}, + "edges": {}, + "nodeIndices": [], + "formationScale": 1.0, + "drawingNode": undefined }; + + this.nodeIndices = this.sectors["active"]["default"]["nodeIndices"]; // the node indices list is used to speed up the computation of the repulsion fields + + this._loadMixin(SectorsMixin); + }; + + + /** + * Mixin the selection system and initialize the parameters required + * + * @private + */ + exports._loadSelectionSystem = function () { + this.selectionObj = {nodes: {}, edges: {}}; + + this._loadMixin(SelectionMixin); + }; + + + /** + * Mixin the navigationUI (User Interface) system and initialize the parameters required + * + * @private + */ + exports._loadManipulationSystem = function () { + // reset global variables -- these are used by the selection of nodes and edges. + this.blockConnectingEdgeSelection = false; + this.forceAppendSelection = false; + + if (this.constants.dataManipulation.enabled == true) { + // load the manipulator HTML elements. All styling done in css. + if (this.manipulationDiv === undefined) { + this.manipulationDiv = document.createElement('div'); + this.manipulationDiv.className = 'network-manipulationDiv'; + this.manipulationDiv.id = 'network-manipulationDiv'; + if (this.editMode == true) { + this.manipulationDiv.style.display = "block"; + } + else { + this.manipulationDiv.style.display = "none"; + } + this.containerElement.insertBefore(this.manipulationDiv, this.frame); + } + + if (this.editModeDiv === undefined) { + this.editModeDiv = document.createElement('div'); + this.editModeDiv.className = 'network-manipulation-editMode'; + this.editModeDiv.id = 'network-manipulation-editMode'; + if (this.editMode == true) { + this.editModeDiv.style.display = "none"; + } + else { + this.editModeDiv.style.display = "block"; + } + this.containerElement.insertBefore(this.editModeDiv, this.frame); + } + + if (this.closeDiv === undefined) { + this.closeDiv = document.createElement('div'); + this.closeDiv.className = 'network-manipulation-closeDiv'; + this.closeDiv.id = 'network-manipulation-closeDiv'; + this.closeDiv.style.display = this.manipulationDiv.style.display; + this.containerElement.insertBefore(this.closeDiv, this.frame); + } + + // load the manipulation functions + this._loadMixin(ManipulationMixin); + + // create the manipulator toolbar + this._createManipulatorBar(); + } + else { + if (this.manipulationDiv !== undefined) { + // removes all the bindings and overloads + this._createManipulatorBar(); + // remove the manipulation divs + this.containerElement.removeChild(this.manipulationDiv); + this.containerElement.removeChild(this.editModeDiv); + this.containerElement.removeChild(this.closeDiv); + + this.manipulationDiv = undefined; + this.editModeDiv = undefined; + this.closeDiv = undefined; + // remove the mixin functions + this._clearMixin(ManipulationMixin); + } + } + }; + + + /** + * Mixin the navigation (User Interface) system and initialize the parameters required + * + * @private + */ + exports._loadNavigationControls = function () { + this._loadMixin(NavigationMixin); + + // the clean function removes the button divs, this is done to remove the bindings. + this._cleanNavigation(); + if (this.constants.navigation.enabled == true) { + this._loadNavigationElements(); + } + }; + + + /** + * Mixin the hierarchical layout system. + * + * @private + */ + exports._loadHierarchySystem = function () { + this._loadMixin(HierarchicalLayoutMixin); + }; + + +/***/ }, +/* 48 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var RepulsionMixin = __webpack_require__(49); + var HierarchialRepulsionMixin = __webpack_require__(50); + var BarnesHutMixin = __webpack_require__(51); + + /** + * Toggling barnes Hut calculation on and off. + * + * @private + */ + exports._toggleBarnesHut = function () { + this.constants.physics.barnesHut.enabled = !this.constants.physics.barnesHut.enabled; + this._loadSelectedForceSolver(); + this.moving = true; + this.start(); + }; + + + /** + * This loads the node force solver based on the barnes hut or repulsion algorithm + * + * @private + */ + exports._loadSelectedForceSolver = function () { + // this overloads the this._calculateNodeForces + if (this.constants.physics.barnesHut.enabled == true) { + this._clearMixin(RepulsionMixin); + this._clearMixin(HierarchialRepulsionMixin); + + this.constants.physics.centralGravity = this.constants.physics.barnesHut.centralGravity; + this.constants.physics.springLength = this.constants.physics.barnesHut.springLength; + this.constants.physics.springConstant = this.constants.physics.barnesHut.springConstant; + this.constants.physics.damping = this.constants.physics.barnesHut.damping; + + this._loadMixin(BarnesHutMixin); + } + else if (this.constants.physics.hierarchicalRepulsion.enabled == true) { + this._clearMixin(BarnesHutMixin); + this._clearMixin(RepulsionMixin); + + this.constants.physics.centralGravity = this.constants.physics.hierarchicalRepulsion.centralGravity; + this.constants.physics.springLength = this.constants.physics.hierarchicalRepulsion.springLength; + this.constants.physics.springConstant = this.constants.physics.hierarchicalRepulsion.springConstant; + this.constants.physics.damping = this.constants.physics.hierarchicalRepulsion.damping; + + this._loadMixin(HierarchialRepulsionMixin); + } + else { + this._clearMixin(BarnesHutMixin); + this._clearMixin(HierarchialRepulsionMixin); + this.barnesHutTree = undefined; + + this.constants.physics.centralGravity = this.constants.physics.repulsion.centralGravity; + this.constants.physics.springLength = this.constants.physics.repulsion.springLength; + this.constants.physics.springConstant = this.constants.physics.repulsion.springConstant; + this.constants.physics.damping = this.constants.physics.repulsion.damping; + + this._loadMixin(RepulsionMixin); + } + }; + + /** + * Before calculating the forces, we check if we need to cluster to keep up performance and we check + * if there is more than one node. If it is just one node, we dont calculate anything. + * + * @private + */ + exports._initializeForceCalculation = function () { + // stop calculation if there is only one node + if (this.nodeIndices.length == 1) { + this.nodes[this.nodeIndices[0]]._setForce(0, 0); + } + else { + // if there are too many nodes on screen, we cluster without repositioning + if (this.nodeIndices.length > this.constants.clustering.clusterThreshold && this.constants.clustering.enabled == true) { + this.clusterToFit(this.constants.clustering.reduceToNodes, false); + } + + // we now start the force calculation + this._calculateForces(); + } + }; + + + /** + * Calculate the external forces acting on the nodes + * Forces are caused by: edges, repulsing forces between nodes, gravity + * @private + */ + exports._calculateForces = function () { + // Gravity is required to keep separated groups from floating off + // the forces are reset to zero in this loop by using _setForce instead + // of _addForce + + this._calculateGravitationalForces(); + this._calculateNodeForces(); + + if (this.constants.physics.springConstant > 0) { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this._calculateSpringForcesWithSupport(); + } + else { + if (this.constants.physics.hierarchicalRepulsion.enabled == true) { + this._calculateHierarchicalSpringForces(); + } + else { + this._calculateSpringForces(); + } + } + } + }; + + + /** + * Smooth curves are created by adding invisible nodes in the center of the edges. These nodes are also + * handled in the calculateForces function. We then use a quadratic curve with the center node as control. + * This function joins the datanodes and invisible (called support) nodes into one object. + * We do this so we do not contaminate this.nodes with the support nodes. + * + * @private + */ + exports._updateCalculationNodes = function () { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this.calculationNodes = {}; + this.calculationNodeIndices = []; + + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.calculationNodes[nodeId] = this.nodes[nodeId]; + } + } + var supportNodes = this.sectors['support']['nodes']; + for (var supportNodeId in supportNodes) { + if (supportNodes.hasOwnProperty(supportNodeId)) { + if (this.edges.hasOwnProperty(supportNodes[supportNodeId].parentEdgeId)) { + this.calculationNodes[supportNodeId] = supportNodes[supportNodeId]; + } + else { + supportNodes[supportNodeId]._setForce(0, 0); + } + } + } + + for (var idx in this.calculationNodes) { + if (this.calculationNodes.hasOwnProperty(idx)) { + this.calculationNodeIndices.push(idx); + } + } + } + else { + this.calculationNodes = this.nodes; + this.calculationNodeIndices = this.nodeIndices; + } + }; + + + /** + * this function applies the central gravity effect to keep groups from floating off + * + * @private + */ + exports._calculateGravitationalForces = function () { + var dx, dy, distance, node, i; + var nodes = this.calculationNodes; + var gravity = this.constants.physics.centralGravity; + var gravityForce = 0; + + for (i = 0; i < this.calculationNodeIndices.length; i++) { + node = nodes[this.calculationNodeIndices[i]]; + node.damping = this.constants.physics.damping; // possibly add function to alter damping properties of clusters. + // gravity does not apply when we are in a pocket sector + if (this._sector() == "default" && gravity != 0) { + dx = -node.x; + dy = -node.y; + distance = Math.sqrt(dx * dx + dy * dy); + + gravityForce = (distance == 0) ? 0 : (gravity / distance); + node.fx = dx * gravityForce; + node.fy = dy * gravityForce; + } + else { + node.fx = 0; + node.fy = 0; + } + } + }; + + + + + /** + * this function calculates the effects of the springs in the case of unsmooth curves. + * + * @private + */ + exports._calculateSpringForces = function () { + var edgeLength, edge, edgeId; + var dx, dy, fx, fy, springForce, distance; + var edges = this.edges; + + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + // this implies that the edges between big clusters are longer + edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; + + dx = (edge.from.x - edge.to.x); + dy = (edge.from.y - edge.to.y); + distance = Math.sqrt(dx * dx + dy * dy); + + if (distance == 0) { + distance = 0.01; + } + + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + + fx = dx * springForce; + fy = dy * springForce; + + edge.from.fx += fx; + edge.from.fy += fy; + edge.to.fx -= fx; + edge.to.fy -= fy; + } + } + } + } + }; + + + + + /** + * This function calculates the springforces on the nodes, accounting for the support nodes. + * + * @private + */ + exports._calculateSpringForcesWithSupport = function () { + var edgeLength, edge, edgeId, combinedClusterSize; + var edges = this.edges; + + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + if (edge.via != null) { + var node1 = edge.to; + var node2 = edge.via; + var node3 = edge.from; + + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + + combinedClusterSize = node1.clusterSize + node3.clusterSize - 2; + + // this implies that the edges between big clusters are longer + edgeLength += combinedClusterSize * this.constants.clustering.edgeGrowth; + this._calculateSpringForce(node1, node2, 0.5 * edgeLength); + this._calculateSpringForce(node2, node3, 0.5 * edgeLength); + } + } + } + } + } + }; + + + /** + * This is the code actually performing the calculation for the function above. It is split out to avoid repetition. + * + * @param node1 + * @param node2 + * @param edgeLength + * @private + */ + exports._calculateSpringForce = function (node1, node2, edgeLength) { + var dx, dy, fx, fy, springForce, distance; + + dx = (node1.x - node2.x); + dy = (node1.y - node2.y); + distance = Math.sqrt(dx * dx + dy * dy); + + if (distance == 0) { + distance = 0.01; + } + + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + + fx = dx * springForce; + fy = dy * springForce; + + node1.fx += fx; + node1.fy += fy; + node2.fx -= fx; + node2.fy -= fy; + }; + + + /** + * Load the HTML for the physics config and bind it + * @private + */ + exports._loadPhysicsConfiguration = function () { + if (this.physicsConfiguration === undefined) { + this.backupConstants = {}; + util.deepExtend(this.backupConstants,this.constants); + + var hierarchicalLayoutDirections = ["LR", "RL", "UD", "DU"]; + this.physicsConfiguration = document.createElement('div'); + this.physicsConfiguration.className = "PhysicsConfiguration"; + this.physicsConfiguration.innerHTML = '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
Simulation Mode:
Barnes HutRepulsionHierarchical
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
Options:
' + this.containerElement.parentElement.insertBefore(this.physicsConfiguration, this.containerElement); + this.optionsDiv = document.createElement("div"); + this.optionsDiv.style.fontSize = "14px"; + this.optionsDiv.style.fontFamily = "verdana"; + this.containerElement.parentElement.insertBefore(this.optionsDiv, this.containerElement); + + var rangeElement; + rangeElement = document.getElementById('graph_BH_gc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_gc', -1, "physics_barnesHut_gravitationalConstant"); + rangeElement = document.getElementById('graph_BH_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_BH_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_BH_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_BH_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_damp', 1, "physics_damping"); + + rangeElement = document.getElementById('graph_R_nd'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_nd', 1, "physics_repulsion_nodeDistance"); + rangeElement = document.getElementById('graph_R_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_R_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_R_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_R_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_damp', 1, "physics_damping"); + + rangeElement = document.getElementById('graph_H_nd'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); + rangeElement = document.getElementById('graph_H_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_H_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_H_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_H_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_damp', 1, "physics_damping"); + rangeElement = document.getElementById('graph_H_direction'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_direction', hierarchicalLayoutDirections, "hierarchicalLayout_direction"); + rangeElement = document.getElementById('graph_H_levsep'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_levsep', 1, "hierarchicalLayout_levelSeparation"); + rangeElement = document.getElementById('graph_H_nspac'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nspac', 1, "hierarchicalLayout_nodeSpacing"); + + var radioButton1 = document.getElementById("graph_physicsMethod1"); + var radioButton2 = document.getElementById("graph_physicsMethod2"); + var radioButton3 = document.getElementById("graph_physicsMethod3"); + radioButton2.checked = true; + if (this.constants.physics.barnesHut.enabled) { + radioButton1.checked = true; + } + if (this.constants.hierarchicalLayout.enabled) { + radioButton3.checked = true; + } + + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + var graph_repositionNodes = document.getElementById("graph_repositionNodes"); + var graph_generateOptions = document.getElementById("graph_generateOptions"); + + graph_toggleSmooth.onclick = graphToggleSmoothCurves.bind(this); + graph_repositionNodes.onclick = graphRepositionNodes.bind(this); + graph_generateOptions.onclick = graphGenerateOptions.bind(this); + if (this.constants.smoothCurves == true && this.constants.dynamicSmoothCurves == false) { + graph_toggleSmooth.style.background = "#A4FF56"; + } + else { + graph_toggleSmooth.style.background = "#FF8532"; + } + + + switchConfigurations.apply(this); + + radioButton1.onchange = switchConfigurations.bind(this); + radioButton2.onchange = switchConfigurations.bind(this); + radioButton3.onchange = switchConfigurations.bind(this); + } + }; + + /** + * This overwrites the this.constants. + * + * @param constantsVariableName + * @param value + * @private + */ + exports._overWriteGraphConstants = function (constantsVariableName, value) { + var nameArray = constantsVariableName.split("_"); + if (nameArray.length == 1) { + this.constants[nameArray[0]] = value; + } + else if (nameArray.length == 2) { + this.constants[nameArray[0]][nameArray[1]] = value; + } + else if (nameArray.length == 3) { + this.constants[nameArray[0]][nameArray[1]][nameArray[2]] = value; + } + }; + + + /** + * this function is bound to the toggle smooth curves button. That is also why it is not in the prototype. + */ + function graphToggleSmoothCurves () { + this.constants.smoothCurves.enabled = !this.constants.smoothCurves.enabled; + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + if (this.constants.smoothCurves.enabled == true) {graph_toggleSmooth.style.background = "#A4FF56";} + else {graph_toggleSmooth.style.background = "#FF8532";} + + this._configureSmoothCurves(false); + } + + /** + * this function is used to scramble the nodes + * + */ + function graphRepositionNodes () { + for (var nodeId in this.calculationNodes) { + if (this.calculationNodes.hasOwnProperty(nodeId)) { + this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0; + this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0; + } + } + if (this.constants.hierarchicalLayout.enabled == true) { + this._setupHierarchicalLayout(); + showValueOfRange.call(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); + showValueOfRange.call(this, 'graph_H_cg', 1, "physics_centralGravity"); + showValueOfRange.call(this, 'graph_H_sc', 1, "physics_springConstant"); + showValueOfRange.call(this, 'graph_H_sl', 1, "physics_springLength"); + showValueOfRange.call(this, 'graph_H_damp', 1, "physics_damping"); + } + else { + this.repositionNodes(); + } + this.moving = true; + this.start(); + } + + /** + * this is used to generate an options file from the playing with physics system. + */ + function graphGenerateOptions () { + var options = "No options are required, default values used."; + var optionsSpecific = []; + var radioButton1 = document.getElementById("graph_physicsMethod1"); + var radioButton2 = document.getElementById("graph_physicsMethod2"); + if (radioButton1.checked == true) { + if (this.constants.physics.barnesHut.gravitationalConstant != this.backupConstants.physics.barnesHut.gravitationalConstant) {optionsSpecific.push("gravitationalConstant: " + this.constants.physics.barnesHut.gravitationalConstant);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.barnesHut.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.barnesHut.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.barnesHut.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.barnesHut.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options = "var options = {"; + options += "physics: {barnesHut: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}}' + } + if (this.constants.smoothCurves.enabled != this.backupConstants.smoothCurves.enabled) { + if (optionsSpecific.length == 0) {options = "var options = {";} + else {options += ", "} + options += "smoothCurves: " + this.constants.smoothCurves.enabled; + } + if (options != "No options are required, default values used.") { + options += '};' + } + } + else if (radioButton2.checked == true) { + options = "var options = {"; + options += "physics: {barnesHut: {enabled: false}"; + if (this.constants.physics.repulsion.nodeDistance != this.backupConstants.physics.repulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.repulsion.nodeDistance);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.repulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.repulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.repulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.repulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options += ", repulsion: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}}' + } + if (optionsSpecific.length == 0) {options += "}"} + if (this.constants.smoothCurves != this.backupConstants.smoothCurves) { + options += ", smoothCurves: " + this.constants.smoothCurves; + } + options += '};' + } + else { + options = "var options = {"; + if (this.constants.physics.hierarchicalRepulsion.nodeDistance != this.backupConstants.physics.hierarchicalRepulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.hierarchicalRepulsion.nodeDistance);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.hierarchicalRepulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.hierarchicalRepulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.hierarchicalRepulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.hierarchicalRepulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options += "physics: {hierarchicalRepulsion: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", "; + } + } + options += '}},'; + } + options += 'hierarchicalLayout: {'; + optionsSpecific = []; + if (this.constants.hierarchicalLayout.direction != this.backupConstants.hierarchicalLayout.direction) {optionsSpecific.push("direction: " + this.constants.hierarchicalLayout.direction);} + if (Math.abs(this.constants.hierarchicalLayout.levelSeparation) != this.backupConstants.hierarchicalLayout.levelSeparation) {optionsSpecific.push("levelSeparation: " + this.constants.hierarchicalLayout.levelSeparation);} + if (this.constants.hierarchicalLayout.nodeSpacing != this.backupConstants.hierarchicalLayout.nodeSpacing) {optionsSpecific.push("nodeSpacing: " + this.constants.hierarchicalLayout.nodeSpacing);} + if (optionsSpecific.length != 0) { + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}' + } + else { + options += "enabled:true}"; + } + options += '};' + } + + + this.optionsDiv.innerHTML = options; + } + + /** + * this is used to switch between barnesHut, repulsion and hierarchical. + * + */ + function switchConfigurations () { + var ids = ["graph_BH_table", "graph_R_table", "graph_H_table"]; + var radioButton = document.querySelector('input[name="graph_physicsMethod"]:checked').value; + var tableId = "graph_" + radioButton + "_table"; + var table = document.getElementById(tableId); + table.style.display = "block"; + for (var i = 0; i < ids.length; i++) { + if (ids[i] != tableId) { + table = document.getElementById(ids[i]); + table.style.display = "none"; + } + } + this._restoreNodes(); + if (radioButton == "R") { + this.constants.hierarchicalLayout.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = false; + this.constants.physics.barnesHut.enabled = false; + } + else if (radioButton == "H") { + if (this.constants.hierarchicalLayout.enabled == false) { + this.constants.hierarchicalLayout.enabled = true; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this.constants.physics.barnesHut.enabled = false; + this.constants.smoothCurves.enabled = false; + this._setupHierarchicalLayout(); + } + } + else { + this.constants.hierarchicalLayout.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = false; + this.constants.physics.barnesHut.enabled = true; + } + this._loadSelectedForceSolver(); + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + if (this.constants.smoothCurves.enabled == true) {graph_toggleSmooth.style.background = "#A4FF56";} + else {graph_toggleSmooth.style.background = "#FF8532";} + this.moving = true; + this.start(); + } + + + /** + * this generates the ranges depending on the iniital values. + * + * @param id + * @param map + * @param constantsVariableName + */ + function showValueOfRange (id,map,constantsVariableName) { + var valueId = id + "_value"; + var rangeValue = document.getElementById(id).value; + + if (map instanceof Array) { + document.getElementById(valueId).value = map[parseInt(rangeValue)]; + this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]); + } + else { + document.getElementById(valueId).value = parseInt(map) * parseFloat(rangeValue); + this._overWriteGraphConstants(constantsVariableName, parseInt(map) * parseFloat(rangeValue)); + } + + if (constantsVariableName == "hierarchicalLayout_direction" || + constantsVariableName == "hierarchicalLayout_levelSeparation" || + constantsVariableName == "hierarchicalLayout_nodeSpacing") { + this._setupHierarchicalLayout(); + } + this.moving = true; + this.start(); + } + + +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Calculate the forces the nodes apply on each other based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ + exports._calculateNodeForces = function () { + var dx, dy, angle, distance, fx, fy, combinedClusterSize, + repulsingForce, node1, node2, i, j; + + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + + // approximation constants + var a_base = -2 / 3; + var b = 4 / 3; + + // repulsing forces between nodes + var nodeDistance = this.constants.physics.repulsion.nodeDistance; + var minimumDistance = nodeDistance; + + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j + for (i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; + combinedClusterSize = node1.clusterSize + node2.clusterSize - 2; + + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); + + minimumDistance = (combinedClusterSize == 0) ? nodeDistance : (nodeDistance * (1 + combinedClusterSize * this.constants.clustering.distanceAmplification)); + var a = a_base / minimumDistance; + if (distance < 2 * minimumDistance) { + if (distance < 0.5 * minimumDistance) { + repulsingForce = 1.0; + } + else { + repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / minimumDistance - 1) * steepness)) + } + + // amplify the repulsion for clusters. + repulsingForce *= (combinedClusterSize == 0) ? 1 : 1 + combinedClusterSize * this.constants.clustering.forceAmplification; + repulsingForce = repulsingForce / distance; + + fx = dx * repulsingForce; + fy = dy * repulsingForce; + + node1.fx -= fx; + node1.fy -= fy; + node2.fx += fx; + node2.fy += fy; + } + } + } + }; + + +/***/ }, +/* 50 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Calculate the forces the nodes apply on eachother based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ + exports._calculateNodeForces = function () { + var dx, dy, distance, fx, fy, + repulsingForce, node1, node2, i, j; + + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + + // repulsing forces between nodes + var nodeDistance = this.constants.physics.hierarchicalRepulsion.nodeDistance; + + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j + for (i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; + + // nodes only affect nodes on their level + if (node1.level == node2.level) { + + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); + + + var steepness = 0.05; + if (distance < nodeDistance) { + repulsingForce = -Math.pow(steepness*distance,2) + Math.pow(steepness*nodeDistance,2); + } + else { + repulsingForce = 0; + } + // normalize force with + if (distance == 0) { + distance = 0.01; + } + else { + repulsingForce = repulsingForce / distance; + } + fx = dx * repulsingForce; + fy = dy * repulsingForce; + + node1.fx -= fx; + node1.fy -= fy; + node2.fx += fx; + node2.fy += fy; + } + } + } + }; + + + /** + * this function calculates the effects of the springs in the case of unsmooth curves. + * + * @private + */ + exports._calculateHierarchicalSpringForces = function () { + var edgeLength, edge, edgeId; + var dx, dy, fx, fy, springForce, distance; + var edges = this.edges; + + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + + + for (var i = 0; i < nodeIndices.length; i++) { + var node1 = nodes[nodeIndices[i]]; + node1.springFx = 0; + node1.springFy = 0; + } + + + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + // this implies that the edges between big clusters are longer + edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; + + dx = (edge.from.x - edge.to.x); + dy = (edge.from.y - edge.to.y); + distance = Math.sqrt(dx * dx + dy * dy); + + if (distance == 0) { + distance = 0.01; + } + + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + + fx = dx * springForce; + fy = dy * springForce; + + + + if (edge.to.level != edge.from.level) { + edge.to.springFx -= fx; + edge.to.springFy -= fy; + edge.from.springFx += fx; + edge.from.springFy += fy; + } + else { + var factor = 0.5; + edge.to.fx -= factor*fx; + edge.to.fy -= factor*fy; + edge.from.fx += factor*fx; + edge.from.fy += factor*fy; + } + } + } + } + } + + // normalize spring forces + var springForce = 1; + var springFx, springFy; + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + springFx = Math.min(springForce,Math.max(-springForce,node.springFx)); + springFy = Math.min(springForce,Math.max(-springForce,node.springFy)); + + node.fx += springFx; + node.fy += springFy; + } + + // retain energy balance + var totalFx = 0; + var totalFy = 0; + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + totalFx += node.fx; + totalFy += node.fy; + } + var correctionFx = totalFx / nodeIndices.length; + var correctionFy = totalFy / nodeIndices.length; + + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + node.fx -= correctionFx; + node.fy -= correctionFy; + } + + }; + +/***/ }, +/* 51 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * This function calculates the forces the nodes apply on eachother based on a gravitational model. + * The Barnes Hut method is used to speed up this N-body simulation. + * + * @private + */ + exports._calculateNodeForces = function() { + if (this.constants.physics.barnesHut.gravitationalConstant != 0) { + var node; + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + var nodeCount = nodeIndices.length; + + this._formBarnesHutTree(nodes,nodeIndices); + + var barnesHutTree = this.barnesHutTree; + + // place the nodes one by one recursively + for (var i = 0; i < nodeCount; i++) { + node = nodes[nodeIndices[i]]; + // starting with root is irrelevant, it never passes the BarnesHut condition + this._getForceContribution(barnesHutTree.root.children.NW,node); + this._getForceContribution(barnesHutTree.root.children.NE,node); + this._getForceContribution(barnesHutTree.root.children.SW,node); + this._getForceContribution(barnesHutTree.root.children.SE,node); + } + } + }; + + + /** + * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. + * If a region contains a single node, we check if it is not itself, then we apply the force. + * + * @param parentBranch + * @param node + * @private + */ + exports._getForceContribution = function(parentBranch,node) { + // we get no force contribution from an empty region + if (parentBranch.childrenCount > 0) { + var dx,dy,distance; + + // get the distance from the center of mass to the node. + dx = parentBranch.centerOfMass.x - node.x; + dy = parentBranch.centerOfMass.y - node.y; + distance = Math.sqrt(dx * dx + dy * dy); + + // BarnesHut condition + // original condition : s/d < theta = passed === d/s > 1/theta = passed + // calcSize = 1/s --> d * 1/s > 1/theta = passed + if (distance * parentBranch.calcSize > this.constants.physics.barnesHut.theta) { + // duplicate code to reduce function calls to speed up program + if (distance == 0) { + distance = 0.1*Math.random(); + dx = distance; + } + var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); + var fx = dx * gravityForce; + var fy = dy * gravityForce; + node.fx += fx; + node.fy += fy; + } + else { + // Did not pass the condition, go into children if available + if (parentBranch.childrenCount == 4) { + this._getForceContribution(parentBranch.children.NW,node); + this._getForceContribution(parentBranch.children.NE,node); + this._getForceContribution(parentBranch.children.SW,node); + this._getForceContribution(parentBranch.children.SE,node); + } + else { // parentBranch must have only one node, if it was empty we wouldnt be here + if (parentBranch.children.data.id != node.id) { // if it is not self + // duplicate code to reduce function calls to speed up program + if (distance == 0) { + distance = 0.5*Math.random(); + dx = distance; + } + var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); + var fx = dx * gravityForce; + var fy = dy * gravityForce; + node.fx += fx; + node.fy += fy; + } + } + } + } + }; + + /** + * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. + * + * @param nodes + * @param nodeIndices + * @private + */ + exports._formBarnesHutTree = function(nodes,nodeIndices) { + var node; + var nodeCount = nodeIndices.length; + + var minX = Number.MAX_VALUE, + minY = Number.MAX_VALUE, + maxX =-Number.MAX_VALUE, + maxY =-Number.MAX_VALUE; + + // get the range of the nodes + for (var i = 0; i < nodeCount; i++) { + var x = nodes[nodeIndices[i]].x; + var y = nodes[nodeIndices[i]].y; + if (x < minX) { minX = x; } + if (x > maxX) { maxX = x; } + if (y < minY) { minY = y; } + if (y > maxY) { maxY = y; } + } + // make the range a square + var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y + if (sizeDiff > 0) {minY -= 0.5 * sizeDiff; maxY += 0.5 * sizeDiff;} // xSize > ySize + else {minX += 0.5 * sizeDiff; maxX -= 0.5 * sizeDiff;} // xSize < ySize + + + var minimumTreeSize = 1e-5; + var rootSize = Math.max(minimumTreeSize,Math.abs(maxX - minX)); + var halfRootSize = 0.5 * rootSize; + var centerX = 0.5 * (minX + maxX), centerY = 0.5 * (minY + maxY); + + // construct the barnesHutTree + var barnesHutTree = { + root:{ + centerOfMass: {x:0, y:0}, + mass:0, + range: { + minX: centerX-halfRootSize,maxX:centerX+halfRootSize, + minY: centerY-halfRootSize,maxY:centerY+halfRootSize + }, + size: rootSize, + calcSize: 1 / rootSize, + children: { data:null}, + maxWidth: 0, + level: 0, + childrenCount: 4 + } + }; + this._splitBranch(barnesHutTree.root); + + // place the nodes one by one recursively + for (i = 0; i < nodeCount; i++) { + node = nodes[nodeIndices[i]]; + this._placeInTree(barnesHutTree.root,node); + } + + // make global + this.barnesHutTree = barnesHutTree + }; + + + /** + * this updates the mass of a branch. this is increased by adding a node. + * + * @param parentBranch + * @param node + * @private + */ + exports._updateBranchMass = function(parentBranch, node) { + var totalMass = parentBranch.mass + node.mass; + var totalMassInv = 1/totalMass; + + parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.mass; + parentBranch.centerOfMass.x *= totalMassInv; + + parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.mass; + parentBranch.centerOfMass.y *= totalMassInv; + + parentBranch.mass = totalMass; + var biggestSize = Math.max(Math.max(node.height,node.radius),node.width); + parentBranch.maxWidth = (parentBranch.maxWidth < biggestSize) ? biggestSize : parentBranch.maxWidth; + + }; + + + /** + * determine in which branch the node will be placed. + * + * @param parentBranch + * @param node + * @param skipMassUpdate + * @private + */ + exports._placeInTree = function(parentBranch,node,skipMassUpdate) { + if (skipMassUpdate != true || skipMassUpdate === undefined) { + // update the mass of the branch. + this._updateBranchMass(parentBranch,node); + } + + if (parentBranch.children.NW.range.maxX > node.x) { // in NW or SW + if (parentBranch.children.NW.range.maxY > node.y) { // in NW + this._placeInRegion(parentBranch,node,"NW"); + } + else { // in SW + this._placeInRegion(parentBranch,node,"SW"); + } + } + else { // in NE or SE + if (parentBranch.children.NW.range.maxY > node.y) { // in NE + this._placeInRegion(parentBranch,node,"NE"); + } + else { // in SE + this._placeInRegion(parentBranch,node,"SE"); + } + } + }; + + + /** + * actually place the node in a region (or branch) + * + * @param parentBranch + * @param node + * @param region + * @private + */ + exports._placeInRegion = function(parentBranch,node,region) { + switch (parentBranch.children[region].childrenCount) { + case 0: // place node here + parentBranch.children[region].children.data = node; + parentBranch.children[region].childrenCount = 1; + this._updateBranchMass(parentBranch.children[region],node); + break; + case 1: // convert into children + // if there are two nodes exactly overlapping (on init, on opening of cluster etc.) + // we move one node a pixel and we do not put it in the tree. + if (parentBranch.children[region].children.data.x == node.x && + parentBranch.children[region].children.data.y == node.y) { + node.x += Math.random(); + node.y += Math.random(); + } + else { + this._splitBranch(parentBranch.children[region]); + this._placeInTree(parentBranch.children[region],node); + } + break; + case 4: // place in branch + this._placeInTree(parentBranch.children[region],node); + break; + } + }; + + + /** + * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch + * after the split is complete. + * + * @param parentBranch + * @private + */ + exports._splitBranch = function(parentBranch) { + // if the branch is shaded with a node, replace the node in the new subset. + var containedNode = null; + if (parentBranch.childrenCount == 1) { + containedNode = parentBranch.children.data; + parentBranch.mass = 0; parentBranch.centerOfMass.x = 0; parentBranch.centerOfMass.y = 0; + } + parentBranch.childrenCount = 4; + parentBranch.children.data = null; + this._insertRegion(parentBranch,"NW"); + this._insertRegion(parentBranch,"NE"); + this._insertRegion(parentBranch,"SW"); + this._insertRegion(parentBranch,"SE"); + + if (containedNode != null) { + this._placeInTree(parentBranch,containedNode); + } + }; + + + /** + * This function subdivides the region into four new segments. + * Specifically, this inserts a single new segment. + * It fills the children section of the parentBranch + * + * @param parentBranch + * @param region + * @param parentRange + * @private + */ + exports._insertRegion = function(parentBranch, region) { + var minX,maxX,minY,maxY; + var childSize = 0.5 * parentBranch.size; + switch (region) { + case "NW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "NE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "SW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; + case "SE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; + } + + + parentBranch.children[region] = { + centerOfMass:{x:0,y:0}, + mass:0, + range:{minX:minX,maxX:maxX,minY:minY,maxY:maxY}, + size: 0.5 * parentBranch.size, + calcSize: 2 * parentBranch.calcSize, + children: {data:null}, + maxWidth: 0, + level: parentBranch.level+1, + childrenCount: 0 + }; + }; + + + /** + * This function is for debugging purposed, it draws the tree. + * + * @param ctx + * @param color + * @private + */ + exports._drawTree = function(ctx,color) { + if (this.barnesHutTree !== undefined) { + + ctx.lineWidth = 1; + + this._drawBranch(this.barnesHutTree.root,ctx,color); + } + }; + + + /** + * This function is for debugging purposes. It draws the branches recursively. + * + * @param branch + * @param ctx + * @param color + * @private + */ + exports._drawBranch = function(branch,ctx,color) { + if (color === undefined) { + color = "#FF0000"; + } + + if (branch.childrenCount == 4) { + this._drawBranch(branch.children.NW,ctx); + this._drawBranch(branch.children.NE,ctx); + this._drawBranch(branch.children.SE,ctx); + this._drawBranch(branch.children.SW,ctx); + } + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(branch.range.minX,branch.range.minY); + ctx.lineTo(branch.range.maxX,branch.range.minY); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(branch.range.maxX,branch.range.minY); + ctx.lineTo(branch.range.maxX,branch.range.maxY); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(branch.range.maxX,branch.range.maxY); + ctx.lineTo(branch.range.minX,branch.range.maxY); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(branch.range.minX,branch.range.maxY); + ctx.lineTo(branch.range.minX,branch.range.minY); + ctx.stroke(); + + /* + if (branch.mass > 0) { + ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass); + ctx.stroke(); + } + */ + }; + + +/***/ }, +/* 52 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Creation of the ClusterMixin var. + * + * This contains all the functions the Network object can use to employ clustering + */ + + /** + * This is only called in the constructor of the network object + * + */ + exports.startWithClustering = function() { + // cluster if the data set is big + this.clusterToFit(this.constants.clustering.initialMaxNodes, true); + + // updates the lables after clustering + this.updateLabels(); + + // this is called here because if clusterin is disabled, the start and stabilize are called in + // the setData function. + if (this.stabilize) { + this._stabilize(); + } + this.start(); + }; + + /** + * This function clusters until the initialMaxNodes has been reached + * + * @param {Number} maxNumberOfNodes + * @param {Boolean} reposition + */ + exports.clusterToFit = function(maxNumberOfNodes, reposition) { + var numberOfNodes = this.nodeIndices.length; + + var maxLevels = 50; + var level = 0; + + // we first cluster the hubs, then we pull in the outliers, repeat + while (numberOfNodes > maxNumberOfNodes && level < maxLevels) { + if (level % 3 == 0) { + this.forceAggregateHubs(true); + this.normalizeClusterLevels(); + } + else { + this.increaseClusterLevel(); // this also includes a cluster normalization + } + + numberOfNodes = this.nodeIndices.length; + level += 1; + } + + // after the clustering we reposition the nodes to reduce the initial chaos + if (level > 0 && reposition == true) { + this.repositionNodes(); + } + this._updateCalculationNodes(); + }; + + /** + * This function can be called to open up a specific cluster. It is only called by + * It will unpack the cluster back one level. + * + * @param node | Node object: cluster to open. + */ + exports.openCluster = function(node) { + var isMovingBeforeClustering = this.moving; + if (node.clusterSize > this.constants.clustering.sectorThreshold && this._nodeInActiveArea(node) && + !(this._sector() == "default" && this.nodeIndices.length == 1)) { + // this loads a new sector, loads the nodes and edges and nodeIndices of it. + this._addSector(node); + var level = 0; + + // we decluster until we reach a decent number of nodes + while ((this.nodeIndices.length < this.constants.clustering.initialMaxNodes) && (level < 10)) { + this.decreaseClusterLevel(); + level += 1; + } + + } + else { + this._expandClusterNode(node,false,true); + + // update the index list, dynamic edges and labels + this._updateNodeIndexList(); + this._updateDynamicEdges(); + this._updateCalculationNodes(); + this.updateLabels(); + } + + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + }; + + + /** + * This calls the updateClustes with default arguments + */ + exports.updateClustersDefault = function() { + if (this.constants.clustering.enabled == true) { + this.updateClusters(0,false,false); + } + }; + + + /** + * This function can be called to increase the cluster level. This means that the nodes with only one edge connection will + * be clustered with their connected node. This can be repeated as many times as needed. + * This can be called externally (by a keybind for instance) to reduce the complexity of big datasets. + */ + exports.increaseClusterLevel = function() { + this.updateClusters(-1,false,true); + }; + + + /** + * This function can be called to decrease the cluster level. This means that the nodes with only one edge connection will + * be unpacked if they are a cluster. This can be repeated as many times as needed. + * This can be called externally (by a key-bind for instance) to look into clusters without zooming. + */ + exports.decreaseClusterLevel = function() { + this.updateClusters(1,false,true); + }; + + + /** + * This is the main clustering function. It clusters and declusters on zoom or forced + * This function clusters on zoom, it can be called with a predefined zoom direction + * If out, check if we can form clusters, if in, check if we can open clusters. + * This function is only called from _zoom() + * + * @param {Number} zoomDirection | -1 / 0 / +1 for zoomOut / determineByZoom / zoomIn + * @param {Boolean} recursive | enabled or disable recursive calling of the opening of clusters + * @param {Boolean} force | enabled or disable forcing + * @param {Boolean} doNotStart | if true do not call start + * + */ + exports.updateClusters = function(zoomDirection,recursive,force,doNotStart) { + var isMovingBeforeClustering = this.moving; + var amountOfNodes = this.nodeIndices.length; + + // on zoom out collapse the sector if the scale is at the level the sector was made + if (this.previousScale > this.scale && zoomDirection == 0) { + this._collapseSector(); + } + + // check if we zoom in or out + if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out + // forming clusters when forced pulls outliers in. When not forced, the edge length of the + // outer nodes determines if it is being clustered + this._formClusters(force); + } + else if (this.previousScale < this.scale || zoomDirection == 1) { // zoom in + if (force == true) { + // _openClusters checks for each node if the formationScale of the cluster is smaller than + // the current scale and if so, declusters. When forced, all clusters are reduced by one step + this._openClusters(recursive,force); + } + else { + // if a cluster takes up a set percentage of the active window + this._openClustersBySize(); + } + } + this._updateNodeIndexList(); + + // if a cluster was NOT formed and the user zoomed out, we try clustering by hubs + if (this.nodeIndices.length == amountOfNodes && (this.previousScale > this.scale || zoomDirection == -1)) { + this._aggregateHubs(force); + this._updateNodeIndexList(); + } + + // we now reduce chains. + if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out + this.handleChains(); + this._updateNodeIndexList(); + } + + this.previousScale = this.scale; + + // rest of the update the index list, dynamic edges and labels + this._updateDynamicEdges(); + this.updateLabels(); + + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length < amountOfNodes) { // this means a clustering operation has taken place + this.clusterSession += 1; + // if clusters have been made, we normalize the cluster level + this.normalizeClusterLevels(); + } + + if (doNotStart == false || doNotStart === undefined) { + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + } + + this._updateCalculationNodes(); + }; + + /** + * This function handles the chains. It is called on every updateClusters(). + */ + exports.handleChains = function() { + // after clustering we check how many chains there are + var chainPercentage = this._getChainFraction(); + if (chainPercentage > this.constants.clustering.chainThreshold) { + this._reduceAmountOfChains(1 - this.constants.clustering.chainThreshold / chainPercentage) + + } + }; + + /** + * this functions starts clustering by hubs + * The minimum hub threshold is set globally + * + * @private + */ + exports._aggregateHubs = function(force) { + this._getHubSize(); + this._formClustersByHub(force,false); + }; + + + /** + * This function is fired by keypress. It forces hubs to form. + * + */ + exports.forceAggregateHubs = function(doNotStart) { + var isMovingBeforeClustering = this.moving; + var amountOfNodes = this.nodeIndices.length; + + this._aggregateHubs(true); + + // update the index list, dynamic edges and labels + this._updateNodeIndexList(); + this._updateDynamicEdges(); + this.updateLabels(); + + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length != amountOfNodes) { + this.clusterSession += 1; + } + + if (doNotStart == false || doNotStart === undefined) { + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + } + }; + + /** + * If a cluster takes up more than a set percentage of the screen, open the cluster + * + * @private + */ + exports._openClustersBySize = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.inView() == true) { + if ((node.width*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || + (node.height*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { + this.openCluster(node); + } + } + } + } + }; + + + /** + * This function loops over all nodes in the nodeIndices list. For each node it checks if it is a cluster and if it + * has to be opened based on the current zoom level. + * + * @private + */ + exports._openClusters = function(recursive,force) { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + this._expandClusterNode(node,recursive,force); + this._updateCalculationNodes(); + } + }; + + /** + * This function checks if a node has to be opened. This is done by checking the zoom level. + * If the node contains child nodes, this function is recursively called on the child nodes as well. + * This recursive behaviour is optional and can be set by the recursive argument. + * + * @param {Node} parentNode | to check for cluster and expand + * @param {Boolean} recursive | enabled or disable recursive calling + * @param {Boolean} force | enabled or disable forcing + * @param {Boolean} [openAll] | This will recursively force all nodes in the parent to be released + * @private + */ + exports._expandClusterNode = function(parentNode, recursive, force, openAll) { + // first check if node is a cluster + if (parentNode.clusterSize > 1) { + // this means that on a double tap event or a zoom event, the cluster fully unpacks if it is smaller than 20 + if (parentNode.clusterSize < this.constants.clustering.sectorThreshold) { + openAll = true; + } + recursive = openAll ? true : recursive; + + // if the last child has been added on a smaller scale than current scale decluster + if (parentNode.formationScale < this.scale || force == true) { + // we will check if any of the contained child nodes should be removed from the cluster + for (var containedNodeId in parentNode.containedNodes) { + if (parentNode.containedNodes.hasOwnProperty(containedNodeId)) { + var childNode = parentNode.containedNodes[containedNodeId]; + + // force expand will expand the largest cluster size clusters. Since we cluster from outside in, we assume that + // the largest cluster is the one that comes from outside + if (force == true) { + if (childNode.clusterSession == parentNode.clusterSessions[parentNode.clusterSessions.length-1] + || openAll) { + this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); + } + } + else { + if (this._nodeInActiveArea(parentNode)) { + this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); + } + } + } + } + } + } + }; + + /** + * ONLY CALLED FROM _expandClusterNode + * + * This function will expel a child_node from a parent_node. This is to de-cluster the node. This function will remove + * the child node from the parent contained_node object and put it back into the global nodes object. + * The same holds for the edge that was connected to the child node. It is moved back into the global edges object. + * + * @param {Node} parentNode | the parent node + * @param {String} containedNodeId | child_node id as it is contained in the containedNodes object of the parent node + * @param {Boolean} recursive | This will also check if the child needs to be expanded. + * With force and recursive both true, the entire cluster is unpacked + * @param {Boolean} force | This will disregard the zoom level and will expel this child from the parent + * @param {Boolean} openAll | This will recursively force all nodes in the parent to be released + * @private + */ + exports._expelChildFromParent = function(parentNode, containedNodeId, recursive, force, openAll) { + var childNode = parentNode.containedNodes[containedNodeId]; + + // if child node has been added on smaller scale than current, kick out + if (childNode.formationScale < this.scale || force == true) { + // unselect all selected items + this._unselectAll(); + + // put the child node back in the global nodes object + this.nodes[containedNodeId] = childNode; + + // release the contained edges from this childNode back into the global edges + this._releaseContainedEdges(parentNode,childNode); + + // reconnect rerouted edges to the childNode + this._connectEdgeBackToChild(parentNode,childNode); + + // validate all edges in dynamicEdges + this._validateEdges(parentNode); + + // undo the changes from the clustering operation on the parent node + parentNode.mass -= childNode.mass; + parentNode.clusterSize -= childNode.clusterSize; + parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); + parentNode.dynamicEdgesLength = parentNode.dynamicEdges.length; + + // place the child node near the parent, not at the exact same location to avoid chaos in the system + childNode.x = parentNode.x + parentNode.growthIndicator * (0.5 - Math.random()); + childNode.y = parentNode.y + parentNode.growthIndicator * (0.5 - Math.random()); + + // remove node from the list + delete parentNode.containedNodes[containedNodeId]; + + // check if there are other childs with this clusterSession in the parent. + var othersPresent = false; + for (var childNodeId in parentNode.containedNodes) { + if (parentNode.containedNodes.hasOwnProperty(childNodeId)) { + if (parentNode.containedNodes[childNodeId].clusterSession == childNode.clusterSession) { + othersPresent = true; + break; + } + } + } + // if there are no others, remove the cluster session from the list + if (othersPresent == false) { + parentNode.clusterSessions.pop(); + } + + this._repositionBezierNodes(childNode); + // this._repositionBezierNodes(parentNode); + + // remove the clusterSession from the child node + childNode.clusterSession = 0; + + // recalculate the size of the node on the next time the node is rendered + parentNode.clearSizeCache(); + + // restart the simulation to reorganise all nodes + this.moving = true; + } + + // check if a further expansion step is possible if recursivity is enabled + if (recursive == true) { + this._expandClusterNode(childNode,recursive,force,openAll); + } + }; + + + /** + * position the bezier nodes at the center of the edges + * + * @param node + * @private + */ + exports._repositionBezierNodes = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + node.dynamicEdges[i].positionBezierNode(); + } + }; + + + /** + * This function checks if any nodes at the end of their trees have edges below a threshold length + * This function is called only from updateClusters() + * forceLevelCollapse ignores the length of the edge and collapses one level + * This means that a node with only one edge will be clustered with its connected node + * + * @private + * @param {Boolean} force + */ + exports._formClusters = function(force) { + if (force == false) { + this._formClustersByZoom(); + } + else { + this._forceClustersByZoom(); + } + }; + + + /** + * This function handles the clustering by zooming out, this is based on a minimum edge distance + * + * @private + */ + exports._formClustersByZoom = function() { + var dx,dy,length, + minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; + + // check if any edges are shorter than minLength and start the clustering + // the clustering favours the node with the larger mass + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + var edge = this.edges[edgeId]; + if (edge.connected) { + if (edge.toId != edge.fromId) { + dx = (edge.to.x - edge.from.x); + dy = (edge.to.y - edge.from.y); + length = Math.sqrt(dx * dx + dy * dy); + + + if (length < minLength) { + // first check which node is larger + var parentNode = edge.from; + var childNode = edge.to; + if (edge.to.mass > edge.from.mass) { + parentNode = edge.to; + childNode = edge.from; + } + + if (childNode.dynamicEdgesLength == 1) { + this._addToCluster(parentNode,childNode,false); + } + else if (parentNode.dynamicEdgesLength == 1) { + this._addToCluster(childNode,parentNode,false); + } + } + } + } + } + } + }; + + /** + * This function forces the network to cluster all nodes with only one connecting edge to their + * connected node. + * + * @private + */ + exports._forceClustersByZoom = function() { + for (var nodeId in this.nodes) { + // another node could have absorbed this child. + if (this.nodes.hasOwnProperty(nodeId)) { + var childNode = this.nodes[nodeId]; + + // the edges can be swallowed by another decrease + if (childNode.dynamicEdgesLength == 1 && childNode.dynamicEdges.length != 0) { + var edge = childNode.dynamicEdges[0]; + var parentNode = (edge.toId == childNode.id) ? this.nodes[edge.fromId] : this.nodes[edge.toId]; + + // group to the largest node + if (childNode.id != parentNode.id) { + if (parentNode.mass > childNode.mass) { + this._addToCluster(parentNode,childNode,true); + } + else { + this._addToCluster(childNode,parentNode,true); + } + } + } + } + } + }; + + + /** + * To keep the nodes of roughly equal size we normalize the cluster levels. + * This function clusters a node to its smallest connected neighbour. + * + * @param node + * @private + */ + exports._clusterToSmallestNeighbour = function(node) { + var smallestNeighbour = -1; + var smallestNeighbourNode = null; + for (var i = 0; i < node.dynamicEdges.length; i++) { + if (node.dynamicEdges[i] !== undefined) { + var neighbour = null; + if (node.dynamicEdges[i].fromId != node.id) { + neighbour = node.dynamicEdges[i].from; + } + else if (node.dynamicEdges[i].toId != node.id) { + neighbour = node.dynamicEdges[i].to; + } + + + if (neighbour != null && smallestNeighbour > neighbour.clusterSessions.length) { + smallestNeighbour = neighbour.clusterSessions.length; + smallestNeighbourNode = neighbour; + } + } + } + + if (neighbour != null && this.nodes[neighbour.id] !== undefined) { + this._addToCluster(neighbour, node, true); + } + }; + + + /** + * This function forms clusters from hubs, it loops over all nodes + * + * @param {Boolean} force | Disregard zoom level + * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges + * @private + */ + exports._formClustersByHub = function(force, onlyEqual) { + // we loop over all nodes in the list + for (var nodeId in this.nodes) { + // we check if it is still available since it can be used by the clustering in this loop + if (this.nodes.hasOwnProperty(nodeId)) { + this._formClusterFromHub(this.nodes[nodeId],force,onlyEqual); + } + } + }; + + /** + * This function forms a cluster from a specific preselected hub node + * + * @param {Node} hubNode | the node we will cluster as a hub + * @param {Boolean} force | Disregard zoom level + * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges + * @param {Number} [absorptionSizeOffset] | + * @private + */ + exports._formClusterFromHub = function(hubNode, force, onlyEqual, absorptionSizeOffset) { + if (absorptionSizeOffset === undefined) { + absorptionSizeOffset = 0; + } + // we decide if the node is a hub + if ((hubNode.dynamicEdgesLength >= this.hubThreshold && onlyEqual == false) || + (hubNode.dynamicEdgesLength == this.hubThreshold && onlyEqual == true)) { + // initialize variables + var dx,dy,length; + var minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; + var allowCluster = false; + + // we create a list of edges because the dynamicEdges change over the course of this loop + var edgesIdarray = []; + var amountOfInitialEdges = hubNode.dynamicEdges.length; + for (var j = 0; j < amountOfInitialEdges; j++) { + edgesIdarray.push(hubNode.dynamicEdges[j].id); + } + + // if the hub clustering is not forces, we check if one of the edges connected + // to a cluster is small enough based on the constants.clustering.clusterEdgeThreshold + if (force == false) { + allowCluster = false; + for (j = 0; j < amountOfInitialEdges; j++) { + var edge = this.edges[edgesIdarray[j]]; + if (edge !== undefined) { + if (edge.connected) { + if (edge.toId != edge.fromId) { + dx = (edge.to.x - edge.from.x); + dy = (edge.to.y - edge.from.y); + length = Math.sqrt(dx * dx + dy * dy); + + if (length < minLength) { + allowCluster = true; + break; + } + } + } + } + } + } + + // start the clustering if allowed + if ((!force && allowCluster) || force) { + // we loop over all edges INITIALLY connected to this hub + for (j = 0; j < amountOfInitialEdges; j++) { + edge = this.edges[edgesIdarray[j]]; + // the edge can be clustered by this function in a previous loop + if (edge !== undefined) { + var childNode = this.nodes[(edge.fromId == hubNode.id) ? edge.toId : edge.fromId]; + // we do not want hubs to merge with other hubs nor do we want to cluster itself. + if ((childNode.dynamicEdges.length <= (this.hubThreshold + absorptionSizeOffset)) && + (childNode.id != hubNode.id)) { + this._addToCluster(hubNode,childNode,force); + } + } + } + } + } + }; + + + + /** + * This function adds the child node to the parent node, creating a cluster if it is not already. + * + * @param {Node} parentNode | this is the node that will house the child node + * @param {Node} childNode | this node will be deleted from the global this.nodes and stored in the parent node + * @param {Boolean} force | true will only update the remainingEdges at the very end of the clustering, ensuring single level collapse + * @private + */ + exports._addToCluster = function(parentNode, childNode, force) { + // join child node in the parent node + parentNode.containedNodes[childNode.id] = childNode; + + // manage all the edges connected to the child and parent nodes + for (var i = 0; i < childNode.dynamicEdges.length; i++) { + var edge = childNode.dynamicEdges[i]; + if (edge.toId == parentNode.id || edge.fromId == parentNode.id) { // edge connected to parentNode + this._addToContainedEdges(parentNode,childNode,edge); + } + else { + this._connectEdgeToCluster(parentNode,childNode,edge); + } + } + // a contained node has no dynamic edges. + childNode.dynamicEdges = []; + + // remove circular edges from clusters + this._containCircularEdgesFromNode(parentNode,childNode); + + + // remove the childNode from the global nodes object + delete this.nodes[childNode.id]; + + // update the properties of the child and parent + var massBefore = parentNode.mass; + childNode.clusterSession = this.clusterSession; + parentNode.mass += childNode.mass; + parentNode.clusterSize += childNode.clusterSize; + parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); + + // keep track of the clustersessions so we can open the cluster up as it has been formed. + if (parentNode.clusterSessions[parentNode.clusterSessions.length - 1] != this.clusterSession) { + parentNode.clusterSessions.push(this.clusterSession); + } + + // forced clusters only open from screen size and double tap + if (force == true) { + // parentNode.formationScale = Math.pow(1 - (1.0/11.0),this.clusterSession+3); + parentNode.formationScale = 0; + } + else { + parentNode.formationScale = this.scale; // The latest child has been added on this scale + } + + // recalculate the size of the node on the next time the node is rendered + parentNode.clearSizeCache(); + + // set the pop-out scale for the childnode + parentNode.containedNodes[childNode.id].formationScale = parentNode.formationScale; + + // nullify the movement velocity of the child, this is to avoid hectic behaviour + childNode.clearVelocity(); + + // the mass has altered, preservation of energy dictates the velocity to be updated + parentNode.updateVelocity(massBefore); + + // restart the simulation to reorganise all nodes + this.moving = true; + }; + + + /** + * This function will apply the changes made to the remainingEdges during the formation of the clusters. + * This is a seperate function to allow for level-wise collapsing of the node barnesHutTree. + * It has to be called if a level is collapsed. It is called by _formClusters(). + * @private + */ + exports._updateDynamicEdges = function() { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + node.dynamicEdgesLength = node.dynamicEdges.length; + + // this corrects for multiple edges pointing at the same other node + var correction = 0; + if (node.dynamicEdgesLength > 1) { + for (var j = 0; j < node.dynamicEdgesLength - 1; j++) { + var edgeToId = node.dynamicEdges[j].toId; + var edgeFromId = node.dynamicEdges[j].fromId; + for (var k = j+1; k < node.dynamicEdgesLength; k++) { + if ((node.dynamicEdges[k].toId == edgeToId && node.dynamicEdges[k].fromId == edgeFromId) || + (node.dynamicEdges[k].fromId == edgeToId && node.dynamicEdges[k].toId == edgeFromId)) { + correction += 1; + } + } + } + } + node.dynamicEdgesLength -= correction; + } + }; + + + /** + * This adds an edge from the childNode to the contained edges of the parent node + * + * @param parentNode | Node object + * @param childNode | Node object + * @param edge | Edge object + * @private + */ + exports._addToContainedEdges = function(parentNode, childNode, edge) { + // create an array object if it does not yet exist for this childNode + if (!(parentNode.containedEdges.hasOwnProperty(childNode.id))) { + parentNode.containedEdges[childNode.id] = [] + } + // add this edge to the list + parentNode.containedEdges[childNode.id].push(edge); + + // remove the edge from the global edges object + delete this.edges[edge.id]; + + // remove the edge from the parent object + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + if (parentNode.dynamicEdges[i].id == edge.id) { + parentNode.dynamicEdges.splice(i,1); + break; + } + } + }; + + /** + * This function connects an edge that was connected to a child node to the parent node. + * It keeps track of which nodes it has been connected to with the originalId array. + * + * @param {Node} parentNode | Node object + * @param {Node} childNode | Node object + * @param {Edge} edge | Edge object + * @private + */ + exports._connectEdgeToCluster = function(parentNode, childNode, edge) { + // handle circular edges + if (edge.toId == edge.fromId) { + this._addToContainedEdges(parentNode, childNode, edge); + } + else { + if (edge.toId == childNode.id) { // edge connected to other node on the "to" side + edge.originalToId.push(childNode.id); + edge.to = parentNode; + edge.toId = parentNode.id; + } + else { // edge connected to other node with the "from" side + + edge.originalFromId.push(childNode.id); + edge.from = parentNode; + edge.fromId = parentNode.id; + } + + this._addToReroutedEdges(parentNode,childNode,edge); + } + }; + + + /** + * If a node is connected to itself, a circular edge is drawn. When clustering we want to contain + * these edges inside of the cluster. + * + * @param parentNode + * @param childNode + * @private + */ + exports._containCircularEdgesFromNode = function(parentNode, childNode) { + // manage all the edges connected to the child and parent nodes + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + var edge = parentNode.dynamicEdges[i]; + // handle circular edges + if (edge.toId == edge.fromId) { + this._addToContainedEdges(parentNode, childNode, edge); + } + } + }; + + + /** + * This adds an edge from the childNode to the rerouted edges of the parent node + * + * @param parentNode | Node object + * @param childNode | Node object + * @param edge | Edge object + * @private + */ + exports._addToReroutedEdges = function(parentNode, childNode, edge) { + // create an array object if it does not yet exist for this childNode + // we store the edge in the rerouted edges so we can restore it when the cluster pops open + if (!(parentNode.reroutedEdges.hasOwnProperty(childNode.id))) { + parentNode.reroutedEdges[childNode.id] = []; + } + parentNode.reroutedEdges[childNode.id].push(edge); + + // this edge becomes part of the dynamicEdges of the cluster node + parentNode.dynamicEdges.push(edge); + }; + + + + /** + * This function connects an edge that was connected to a cluster node back to the child node. + * + * @param parentNode | Node object + * @param childNode | Node object + * @private + */ + exports._connectEdgeBackToChild = function(parentNode, childNode) { + if (parentNode.reroutedEdges.hasOwnProperty(childNode.id)) { + for (var i = 0; i < parentNode.reroutedEdges[childNode.id].length; i++) { + var edge = parentNode.reroutedEdges[childNode.id][i]; + if (edge.originalFromId[edge.originalFromId.length-1] == childNode.id) { + edge.originalFromId.pop(); + edge.fromId = childNode.id; + edge.from = childNode; + } + else { + edge.originalToId.pop(); + edge.toId = childNode.id; + edge.to = childNode; + } + + // append this edge to the list of edges connecting to the childnode + childNode.dynamicEdges.push(edge); + + // remove the edge from the parent object + for (var j = 0; j < parentNode.dynamicEdges.length; j++) { + if (parentNode.dynamicEdges[j].id == edge.id) { + parentNode.dynamicEdges.splice(j,1); + break; + } + } + } + // remove the entry from the rerouted edges + delete parentNode.reroutedEdges[childNode.id]; + } + }; + + + /** + * When loops are clustered, an edge can be both in the rerouted array and the contained array. + * This function is called last to verify that all edges in dynamicEdges are in fact connected to the + * parentNode + * + * @param parentNode | Node object + * @private + */ + exports._validateEdges = function(parentNode) { + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + var edge = parentNode.dynamicEdges[i]; + if (parentNode.id != edge.toId && parentNode.id != edge.fromId) { + parentNode.dynamicEdges.splice(i,1); + } + } + }; + + + /** + * This function released the contained edges back into the global domain and puts them back into the + * dynamic edges of both parent and child. + * + * @param {Node} parentNode | + * @param {Node} childNode | + * @private + */ + exports._releaseContainedEdges = function(parentNode, childNode) { + for (var i = 0; i < parentNode.containedEdges[childNode.id].length; i++) { + var edge = parentNode.containedEdges[childNode.id][i]; + + // put the edge back in the global edges object + this.edges[edge.id] = edge; + + // put the edge back in the dynamic edges of the child and parent + childNode.dynamicEdges.push(edge); + parentNode.dynamicEdges.push(edge); + } + // remove the entry from the contained edges + delete parentNode.containedEdges[childNode.id]; + + }; + + + + + // ------------------- UTILITY FUNCTIONS ---------------------------- // + + + /** + * This updates the node labels for all nodes (for debugging purposes) + */ + exports.updateLabels = function() { + var nodeId; + // update node labels + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.clusterSize > 1) { + node.label = "[".concat(String(node.clusterSize),"]"); + } + } + } + + // update node labels + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.clusterSize == 1) { + if (node.originalLabel !== undefined) { + node.label = node.originalLabel; + } + else { + node.label = String(node.id); + } + } + } + } + + // /* Debug Override */ + // for (nodeId in this.nodes) { + // if (this.nodes.hasOwnProperty(nodeId)) { + // node = this.nodes[nodeId]; + // node.label = String(node.level); + // } + // } + + }; + + + /** + * We want to keep the cluster level distribution rather small. This means we do not want unclustered nodes + * if the rest of the nodes are already a few cluster levels in. + * To fix this we use this function. It determines the min and max cluster level and sends nodes that have not + * clustered enough to the clusterToSmallestNeighbours function. + */ + exports.normalizeClusterLevels = function() { + var maxLevel = 0; + var minLevel = 1e9; + var clusterLevel = 0; + var nodeId; + + // we loop over all nodes in the list + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + clusterLevel = this.nodes[nodeId].clusterSessions.length; + if (maxLevel < clusterLevel) {maxLevel = clusterLevel;} + if (minLevel > clusterLevel) {minLevel = clusterLevel;} + } + } + + if (maxLevel - minLevel > this.constants.clustering.clusterLevelDifference) { + var amountOfNodes = this.nodeIndices.length; + var targetLevel = maxLevel - this.constants.clustering.clusterLevelDifference; + // we loop over all nodes in the list + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].clusterSessions.length < targetLevel) { + this._clusterToSmallestNeighbour(this.nodes[nodeId]); + } + } + } + this._updateNodeIndexList(); + this._updateDynamicEdges(); + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length != amountOfNodes) { + this.clusterSession += 1; + } + } + }; + + + + /** + * This function determines if the cluster we want to decluster is in the active area + * this means around the zoom center + * + * @param {Node} node + * @returns {boolean} + * @private + */ + exports._nodeInActiveArea = function(node) { + return ( + Math.abs(node.x - this.areaCenter.x) <= this.constants.clustering.activeAreaBoxSize/this.scale + && + Math.abs(node.y - this.areaCenter.y) <= this.constants.clustering.activeAreaBoxSize/this.scale + ) + }; + + + /** + * This is an adaptation of the original repositioning function. This is called if the system is clustered initially + * It puts large clusters away from the center and randomizes the order. + * + */ + exports.repositionNodes = function() { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + if ((node.xFixed == false || node.yFixed == false)) { + var radius = 10 * 0.1*this.nodeIndices.length * Math.min(100,node.mass); + var angle = 2 * Math.PI * Math.random(); + if (node.xFixed == false) {node.x = radius * Math.cos(angle);} + if (node.yFixed == false) {node.y = radius * Math.sin(angle);} + this._repositionBezierNodes(node); + } + } + }; + + + /** + * We determine how many connections denote an important hub. + * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) + * + * @private + */ + exports._getHubSize = function() { + var average = 0; + var averageSquared = 0; + var hubCounter = 0; + var largestHub = 0; + + for (var i = 0; i < this.nodeIndices.length; i++) { + + var node = this.nodes[this.nodeIndices[i]]; + if (node.dynamicEdgesLength > largestHub) { + largestHub = node.dynamicEdgesLength; + } + average += node.dynamicEdgesLength; + averageSquared += Math.pow(node.dynamicEdgesLength,2); + hubCounter += 1; + } + average = average / hubCounter; + averageSquared = averageSquared / hubCounter; + + var variance = averageSquared - Math.pow(average,2); + + var standardDeviation = Math.sqrt(variance); + + this.hubThreshold = Math.floor(average + 2*standardDeviation); + + // always have at least one to cluster + if (this.hubThreshold > largestHub) { + this.hubThreshold = largestHub; + } + + // console.log("average",average,"averageSQ",averageSquared,"var",variance,"std",standardDeviation); + // console.log("hubThreshold:",this.hubThreshold); + }; + + + /** + * We reduce the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods + * with this amount we can cluster specifically on these chains. + * + * @param {Number} fraction | between 0 and 1, the percentage of chains to reduce + * @private + */ + exports._reduceAmountOfChains = function(fraction) { + this.hubThreshold = 2; + var reduceAmount = Math.floor(this.nodeIndices.length * fraction); + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { + if (reduceAmount > 0) { + this._formClusterFromHub(this.nodes[nodeId],true,true,1); + reduceAmount -= 1; + } + } + } + } + }; + + /** + * We get the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods + * with this amount we can cluster specifically on these chains. + * + * @private + */ + exports._getChainFraction = function() { + var chains = 0; + var total = 0; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { + chains += 1; + } + total += 1; + } + } + return chains/total; + }; + + +/***/ }, +/* 53 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + + /** + * Creation of the SectorMixin var. + * + * This contains all the functions the Network object can use to employ the sector system. + * The sector system is always used by Network, though the benefits only apply to the use of clustering. + * If clustering is not used, there is no overhead except for a duplicate object with references to nodes and edges. + */ + + /** + * This function is only called by the setData function of the Network object. + * This loads the global references into the active sector. This initializes the sector. + * + * @private + */ + exports._putDataInSector = function() { + this.sectors["active"][this._sector()].nodes = this.nodes; + this.sectors["active"][this._sector()].edges = this.edges; + this.sectors["active"][this._sector()].nodeIndices = this.nodeIndices; + }; + + + /** + * /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied (active) sector. If a type is defined, do the specific type + * + * @param {String} sectorId + * @param {String} [sectorType] | "active" or "frozen" + * @private + */ + exports._switchToSector = function(sectorId, sectorType) { + if (sectorType === undefined || sectorType == "active") { + this._switchToActiveSector(sectorId); + } + else { + this._switchToFrozenSector(sectorId); + } + }; + + + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied active sector. + * + * @param sectorId + * @private + */ + exports._switchToActiveSector = function(sectorId) { + this.nodeIndices = this.sectors["active"][sectorId]["nodeIndices"]; + this.nodes = this.sectors["active"][sectorId]["nodes"]; + this.edges = this.sectors["active"][sectorId]["edges"]; + }; + + + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied active sector. + * + * @private + */ + exports._switchToSupportSector = function() { + this.nodeIndices = this.sectors["support"]["nodeIndices"]; + this.nodes = this.sectors["support"]["nodes"]; + this.edges = this.sectors["support"]["edges"]; + }; + + + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied frozen sector. + * + * @param sectorId + * @private + */ + exports._switchToFrozenSector = function(sectorId) { + this.nodeIndices = this.sectors["frozen"][sectorId]["nodeIndices"]; + this.nodes = this.sectors["frozen"][sectorId]["nodes"]; + this.edges = this.sectors["frozen"][sectorId]["edges"]; + }; + + + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the currently active sector. + * + * @private + */ + exports._loadLatestSector = function() { + this._switchToSector(this._sector()); + }; + + + /** + * This function returns the currently active sector Id + * + * @returns {String} + * @private + */ + exports._sector = function() { + return this.activeSector[this.activeSector.length-1]; + }; + + + /** + * This function returns the previously active sector Id + * + * @returns {String} + * @private + */ + exports._previousSector = function() { + if (this.activeSector.length > 1) { + return this.activeSector[this.activeSector.length-2]; + } + else { + throw new TypeError('there are not enough sectors in the this.activeSector array.'); + } + }; + + + /** + * We add the active sector at the end of the this.activeSector array + * This ensures it is the currently active sector returned by _sector() and it reaches the top + * of the activeSector stack. When we reverse our steps we move from the end to the beginning of this stack. + * + * @param newId + * @private + */ + exports._setActiveSector = function(newId) { + this.activeSector.push(newId); + }; + + + /** + * We remove the currently active sector id from the active sector stack. This happens when + * we reactivate the previously active sector + * + * @private + */ + exports._forgetLastSector = function() { + this.activeSector.pop(); + }; + + + /** + * This function creates a new active sector with the supplied newId. This newId + * is the expanding node id. + * + * @param {String} newId | Id of the new active sector + * @private + */ + exports._createNewSector = function(newId) { + // create the new sector + this.sectors["active"][newId] = {"nodes":{}, + "edges":{}, + "nodeIndices":[], + "formationScale": this.scale, + "drawingNode": undefined}; + + // create the new sector render node. This gives visual feedback that you are in a new sector. + this.sectors["active"][newId]['drawingNode'] = new Node( + {id:newId, + color: { + background: "#eaefef", + border: "495c5e" + } + },{},{},this.constants); + this.sectors["active"][newId]['drawingNode'].clusterSize = 2; + }; + + + /** + * This function removes the currently active sector. This is called when we create a new + * active sector. + * + * @param {String} sectorId | Id of the active sector that will be removed + * @private + */ + exports._deleteActiveSector = function(sectorId) { + delete this.sectors["active"][sectorId]; + }; + + + /** + * This function removes the currently active sector. This is called when we reactivate + * the previously active sector. + * + * @param {String} sectorId | Id of the active sector that will be removed + * @private + */ + exports._deleteFrozenSector = function(sectorId) { + delete this.sectors["frozen"][sectorId]; + }; + + + /** + * Freezing an active sector means moving it from the "active" object to the "frozen" object. + * We copy the references, then delete the active entree. + * + * @param sectorId + * @private + */ + exports._freezeSector = function(sectorId) { + // we move the set references from the active to the frozen stack. + this.sectors["frozen"][sectorId] = this.sectors["active"][sectorId]; + + // we have moved the sector data into the frozen set, we now remove it from the active set + this._deleteActiveSector(sectorId); + }; + + + /** + * This is the reverse operation of _freezeSector. Activating means moving the sector from the "frozen" + * object to the "active" object. + * + * @param sectorId + * @private + */ + exports._activateSector = function(sectorId) { + // we move the set references from the frozen to the active stack. + this.sectors["active"][sectorId] = this.sectors["frozen"][sectorId]; + + // we have moved the sector data into the active set, we now remove it from the frozen stack + this._deleteFrozenSector(sectorId); + }; + + + /** + * This function merges the data from the currently active sector with a frozen sector. This is used + * in the process of reverting back to the previously active sector. + * The data that is placed in the frozen (the previously active) sector is the node that has been removed from it + * upon the creation of a new active sector. + * + * @param sectorId + * @private + */ + exports._mergeThisWithFrozen = function(sectorId) { + // copy all nodes + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.sectors["frozen"][sectorId]["nodes"][nodeId] = this.nodes[nodeId]; + } + } + + // copy all edges (if not fully clustered, else there are no edges) + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + this.sectors["frozen"][sectorId]["edges"][edgeId] = this.edges[edgeId]; + } + } + + // merge the nodeIndices + for (var i = 0; i < this.nodeIndices.length; i++) { + this.sectors["frozen"][sectorId]["nodeIndices"].push(this.nodeIndices[i]); + } + }; + + + /** + * This clusters the sector to one cluster. It was a single cluster before this process started so + * we revert to that state. The clusterToFit function with a maximum size of 1 node does this. + * + * @private + */ + exports._collapseThisToSingleCluster = function() { + this.clusterToFit(1,false); + }; + + + /** + * We create a new active sector from the node that we want to open. + * + * @param node + * @private + */ + exports._addSector = function(node) { + // this is the currently active sector + var sector = this._sector(); + + // // this should allow me to select nodes from a frozen set. + // if (this.sectors['active'][sector]["nodes"].hasOwnProperty(node.id)) { + // console.log("the node is part of the active sector"); + // } + // else { + // console.log("I dont know what the fuck happened!!"); + // } + + // when we switch to a new sector, we remove the node that will be expanded from the current nodes list. + delete this.nodes[node.id]; + + var unqiueIdentifier = util.randomUUID(); + + // we fully freeze the currently active sector + this._freezeSector(sector); + + // we create a new active sector. This sector has the Id of the node to ensure uniqueness + this._createNewSector(unqiueIdentifier); + + // we add the active sector to the sectors array to be able to revert these steps later on + this._setActiveSector(unqiueIdentifier); + + // we redirect the global references to the new sector's references. this._sector() now returns unqiueIdentifier + this._switchToSector(this._sector()); + + // finally we add the node we removed from our previous active sector to the new active sector + this.nodes[node.id] = node; + }; + + + /** + * We close the sector that is currently open and revert back to the one before. + * If the active sector is the "default" sector, nothing happens. + * + * @private + */ + exports._collapseSector = function() { + // the currently active sector + var sector = this._sector(); + + // we cannot collapse the default sector + if (sector != "default") { + if ((this.nodeIndices.length == 1) || + (this.sectors["active"][sector]["drawingNode"].width*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || + (this.sectors["active"][sector]["drawingNode"].height*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { + var previousSector = this._previousSector(); + + // we collapse the sector back to a single cluster + this._collapseThisToSingleCluster(); + + // we move the remaining nodes, edges and nodeIndices to the previous sector. + // This previous sector is the one we will reactivate + this._mergeThisWithFrozen(previousSector); + + // the previously active (frozen) sector now has all the data from the currently active sector. + // we can now delete the active sector. + this._deleteActiveSector(sector); + + // we activate the previously active (and currently frozen) sector. + this._activateSector(previousSector); + + // we load the references from the newly active sector into the global references + this._switchToSector(previousSector); + + // we forget the previously active sector because we reverted to the one before + this._forgetLastSector(); + + // finally, we update the node index list. + this._updateNodeIndexList(); + + // we refresh the list with calulation nodes and calculation node indices. + this._updateCalculationNodes(); + } + } + }; + + + /** + * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we dont pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInAllActiveSectors = function(runFunction,argument) { + if (argument === undefined) { + for (var sector in this.sectors["active"]) { + if (this.sectors["active"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToActiveSector(sector); + this[runFunction](); + } + } + } + else { + for (var sector in this.sectors["active"]) { + if (this.sectors["active"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToActiveSector(sector); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } + } + } + } + // we revert the global references back to our active sector + this._loadLatestSector(); + }; + + + /** + * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we dont pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInSupportSector = function(runFunction,argument) { + if (argument === undefined) { + this._switchToSupportSector(); + this[runFunction](); + } + else { + this._switchToSupportSector(); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } + } + // we revert the global references back to our active sector + this._loadLatestSector(); + }; + + + /** + * This runs a function in all frozen sectors. This is used in the _redraw(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we don't pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInAllFrozenSectors = function(runFunction,argument) { + if (argument === undefined) { + for (var sector in this.sectors["frozen"]) { + if (this.sectors["frozen"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToFrozenSector(sector); + this[runFunction](); + } + } + } + else { + for (var sector in this.sectors["frozen"]) { + if (this.sectors["frozen"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToFrozenSector(sector); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } + } + } + } + this._loadLatestSector(); + }; + + + /** + * This runs a function in all sectors. This is used in the _redraw(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we don't pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInAllSectors = function(runFunction,argument) { + var args = Array.prototype.splice.call(arguments, 1); + if (argument === undefined) { + this._doInAllActiveSectors(runFunction); + this._doInAllFrozenSectors(runFunction); + } + else { + if (args.length > 1) { + this._doInAllActiveSectors(runFunction,args[0],args[1]); + this._doInAllFrozenSectors(runFunction,args[0],args[1]); + } + else { + this._doInAllActiveSectors(runFunction,argument); + this._doInAllFrozenSectors(runFunction,argument); + } + } + }; + + + /** + * This clears the nodeIndices list. We cannot use this.nodeIndices = [] because we would break the link with the + * active sector. Thus we clear the nodeIndices in the active sector, then reconnect the this.nodeIndices to it. + * + * @private + */ + exports._clearNodeIndexList = function() { + var sector = this._sector(); + this.sectors["active"][sector]["nodeIndices"] = []; + this.nodeIndices = this.sectors["active"][sector]["nodeIndices"]; + }; + + + /** + * Draw the encompassing sector node + * + * @param ctx + * @param sectorType + * @private + */ + exports._drawSectorNodes = function(ctx,sectorType) { + var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; + for (var sector in this.sectors[sectorType]) { + if (this.sectors[sectorType].hasOwnProperty(sector)) { + if (this.sectors[sectorType][sector]["drawingNode"] !== undefined) { + + this._switchToSector(sector,sectorType); + + minY = 1e9; maxY = -1e9; minX = 1e9; maxX = -1e9; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + node.resize(ctx); + if (minX > node.x - 0.5 * node.width) {minX = node.x - 0.5 * node.width;} + if (maxX < node.x + 0.5 * node.width) {maxX = node.x + 0.5 * node.width;} + if (minY > node.y - 0.5 * node.height) {minY = node.y - 0.5 * node.height;} + if (maxY < node.y + 0.5 * node.height) {maxY = node.y + 0.5 * node.height;} + } + } + node = this.sectors[sectorType][sector]["drawingNode"]; + node.x = 0.5 * (maxX + minX); + node.y = 0.5 * (maxY + minY); + node.width = 2 * (node.x - minX); + node.height = 2 * (node.y - minY); + node.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2)); + node.setScale(this.scale); + node._drawCircle(ctx); + } + } + } + }; + + exports._drawAllSectorNodes = function(ctx) { + this._drawSectorNodes(ctx,"frozen"); + this._drawSectorNodes(ctx,"active"); + this._loadLatestSector(); + }; + + +/***/ }, +/* 54 */ +/***/ function(module, exports, __webpack_require__) { + + var Node = __webpack_require__(44); + + /** + * This function can be called from the _doInAllSectors function + * + * @param object + * @param overlappingNodes + * @private + */ + exports._getNodesOverlappingWith = function(object, overlappingNodes) { + var nodes = this.nodes; + for (var nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + if (nodes[nodeId].isOverlappingWith(object)) { + overlappingNodes.push(nodeId); + } + } + } + }; + + /** + * retrieve all nodes overlapping with given object + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ + exports._getAllNodesOverlappingWith = function (object) { + var overlappingNodes = []; + this._doInAllActiveSectors("_getNodesOverlappingWith",object,overlappingNodes); + return overlappingNodes; + }; + + + /** + * Return a position object in canvasspace from a single point in screenspace + * + * @param pointer + * @returns {{left: number, top: number, right: number, bottom: number}} + * @private + */ + exports._pointerToPositionObject = function(pointer) { + var x = this._XconvertDOMtoCanvas(pointer.x); + var y = this._YconvertDOMtoCanvas(pointer.y); + + return { + left: x, + top: y, + right: x, + bottom: y + }; + }; + + + /** + * Get the top node at the a specific point (like a click) + * + * @param {{x: Number, y: Number}} pointer + * @return {Node | null} node + * @private + */ + exports._getNodeAt = function (pointer) { + // we first check if this is an navigation controls element + var positionObject = this._pointerToPositionObject(pointer); + var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); + + // if there are overlapping nodes, select the last one, this is the + // one which is drawn on top of the others + if (overlappingNodes.length > 0) { + return this.nodes[overlappingNodes[overlappingNodes.length - 1]]; + } + else { + return null; + } + }; + + + /** + * retrieve all edges overlapping with given object, selector is around center + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ + exports._getEdgesOverlappingWith = function (object, overlappingEdges) { + var edges = this.edges; + for (var edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + if (edges[edgeId].isOverlappingWith(object)) { + overlappingEdges.push(edgeId); + } + } + } + }; + + + /** + * retrieve all nodes overlapping with given object + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ + exports._getAllEdgesOverlappingWith = function (object) { + var overlappingEdges = []; + this._doInAllActiveSectors("_getEdgesOverlappingWith",object,overlappingEdges); + return overlappingEdges; + }; + + /** + * Place holder. To implement change the _getNodeAt to a _getObjectAt. Have the _getObjectAt call + * _getNodeAt and _getEdgesAt, then priortize the selection to user preferences. + * + * @param pointer + * @returns {null} + * @private + */ + exports._getEdgeAt = function(pointer) { + var positionObject = this._pointerToPositionObject(pointer); + var overlappingEdges = this._getAllEdgesOverlappingWith(positionObject); + + if (overlappingEdges.length > 0) { + return this.edges[overlappingEdges[overlappingEdges.length - 1]]; + } + else { + return null; + } + }; + + + /** + * Add object to the selection array. + * + * @param obj + * @private + */ + exports._addToSelection = function(obj) { + if (obj instanceof Node) { + this.selectionObj.nodes[obj.id] = obj; + } + else { + this.selectionObj.edges[obj.id] = obj; + } + }; + + /** + * Add object to the selection array. + * + * @param obj + * @private + */ + exports._addToHover = function(obj) { + if (obj instanceof Node) { + this.hoverObj.nodes[obj.id] = obj; + } + else { + this.hoverObj.edges[obj.id] = obj; + } + }; + + + /** + * Remove a single option from selection. + * + * @param {Object} obj + * @private + */ + exports._removeFromSelection = function(obj) { + if (obj instanceof Node) { + delete this.selectionObj.nodes[obj.id]; + } + else { + delete this.selectionObj.edges[obj.id]; + } + }; + + /** + * Unselect all. The selectionObj is useful for this. + * + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ + exports._unselectAll = function(doNotTrigger) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + this.selectionObj.nodes[nodeId].unselect(); + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + this.selectionObj.edges[edgeId].unselect(); + } + } + + this.selectionObj = {nodes:{},edges:{}}; + + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } + }; + + /** + * Unselect all clusters. The selectionObj is useful for this. + * + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ + exports._unselectClusters = function(doNotTrigger) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (this.selectionObj.nodes[nodeId].clusterSize > 1) { + this.selectionObj.nodes[nodeId].unselect(); + this._removeFromSelection(this.selectionObj.nodes[nodeId]); + } + } + } + + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } + }; + + + /** + * return the number of selected nodes + * + * @returns {number} + * @private + */ + exports._getSelectedNodeCount = function() { + var count = 0; + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + return count; + }; + + /** + * return the selected node + * + * @returns {number} + * @private + */ + exports._getSelectedNode = function() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return this.selectionObj.nodes[nodeId]; + } + } + return null; + }; + + /** + * return the selected edge + * + * @returns {number} + * @private + */ + exports._getSelectedEdge = function() { + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + return this.selectionObj.edges[edgeId]; + } + } + return null; + }; + + + /** + * return the number of selected edges + * + * @returns {number} + * @private + */ + exports._getSelectedEdgeCount = function() { + var count = 0; + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; + }; + + + /** + * return the number of selected objects. + * + * @returns {number} + * @private + */ + exports._getSelectedObjectCount = function() { + var count = 0; + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; + }; + + /** + * Check if anything is selected + * + * @returns {boolean} + * @private + */ + exports._selectionIsEmpty = function() { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return false; + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + return false; + } + } + return true; + }; + + + /** + * check if one of the selected nodes is a cluster. + * + * @returns {boolean} + * @private + */ + exports._clusterInSelection = function() { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (this.selectionObj.nodes[nodeId].clusterSize > 1) { + return true; + } + } + } + return false; + }; + + /** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + exports._selectConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.select(); + this._addToSelection(edge); + } + }; + + /** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + exports._hoverConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.hover = true; + this._addToHover(edge); + } + }; + + + /** + * unselect the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + exports._unselectConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.unselect(); + this._removeFromSelection(edge); + } + }; + + + + + /** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @param {Boolean} append + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ + exports._selectObject = function(object, append, doNotTrigger, highlightEdges) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + if (highlightEdges === undefined) { + highlightEdges = true; + } + + if (this._selectionIsEmpty() == false && append == false && this.forceAppendSelection == false) { + this._unselectAll(true); + } + + if (object.selected == false) { + object.select(); + this._addToSelection(object); + if (object instanceof Node && this.blockConnectingEdgeSelection == false && highlightEdges == true) { + this._selectConnectedEdges(object); + } + } + else { + object.unselect(); + this._removeFromSelection(object); + } + + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } + }; + + + /** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @private + */ + exports._blurObject = function(object) { + if (object.hover == true) { + object.hover = false; + this.emit("blurNode",{node:object.id}); + } + }; + + /** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @private + */ + exports._hoverObject = function(object) { + if (object.hover == false) { + object.hover = true; + this._addToHover(object); + if (object instanceof Node) { + this.emit("hoverNode",{node:object.id}); + } + } + if (object instanceof Node) { + this._hoverConnectedEdges(object); + } + }; + + + /** + * handles the selection part of the touch, only for navigation controls elements; + * Touch is triggered before tap, also before hold. Hold triggers after a while. + * This is the most responsive solution + * + * @param {Object} pointer + * @private + */ + exports._handleTouch = function(pointer) { + }; + + + /** + * handles the selection part of the tap; + * + * @param {Object} pointer + * @private + */ + exports._handleTap = function(pointer) { + var node = this._getNodeAt(pointer); + if (node != null) { + this._selectObject(node,false); + } + else { + var edge = this._getEdgeAt(pointer); + if (edge != null) { + this._selectObject(edge,false); + } + else { + this._unselectAll(); + } + } + this.emit("click", this.getSelection()); + this._redraw(); + }; + + + /** + * handles the selection part of the double tap and opens a cluster if needed + * + * @param {Object} pointer + * @private + */ + exports._handleDoubleTap = function(pointer) { + var node = this._getNodeAt(pointer); + if (node != null && node !== undefined) { + // we reset the areaCenter here so the opening of the node will occur + this.areaCenter = {"x" : this._XconvertDOMtoCanvas(pointer.x), + "y" : this._YconvertDOMtoCanvas(pointer.y)}; + this.openCluster(node); + } + this.emit("doubleClick", this.getSelection()); + }; + + + /** + * Handle the onHold selection part + * + * @param pointer + * @private + */ + exports._handleOnHold = function(pointer) { + var node = this._getNodeAt(pointer); + if (node != null) { + this._selectObject(node,true); + } + else { + var edge = this._getEdgeAt(pointer); + if (edge != null) { + this._selectObject(edge,true); + } + } + this._redraw(); + }; + + + /** + * handle the onRelease event. These functions are here for the navigation controls module. + * + * @private + */ + exports._handleOnRelease = function(pointer) { + + }; + + + + /** + * + * retrieve the currently selected objects + * @return {{nodes: Array., edges: Array.}} selection + */ + exports.getSelection = function() { + var nodeIds = this.getSelectedNodes(); + var edgeIds = this.getSelectedEdges(); + return {nodes:nodeIds, edges:edgeIds}; + }; + + /** + * + * retrieve the currently selected nodes + * @return {String[]} selection An array with the ids of the + * selected nodes. + */ + exports.getSelectedNodes = function() { + var idArray = []; + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + idArray.push(nodeId); + } + } + return idArray + }; + + /** + * + * retrieve the currently selected edges + * @return {Array} selection An array with the ids of the + * selected nodes. + */ + exports.getSelectedEdges = function() { + var idArray = []; + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + idArray.push(edgeId); + } + } + return idArray; + }; + + + /** + * select zero or more nodes + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + */ + exports.setSelection = function(selection) { + var i, iMax, id; + + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; + + // first unselect any selected node + this._unselectAll(true); + + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; + + var node = this.nodes[id]; + if (!node) { + throw new RangeError('Node with id "' + id + '" not found'); + } + this._selectObject(node,true,true); + } + + console.log("setSelection is deprecated. Please use selectNodes instead.") + + this.redraw(); + }; + + + /** + * select zero or more nodes with the option to highlight edges + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + * @param {boolean} [highlightEdges] + */ + exports.selectNodes = function(selection, highlightEdges) { + var i, iMax, id; + + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; + + // first unselect any selected node + this._unselectAll(true); + + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; + + var node = this.nodes[id]; + if (!node) { + throw new RangeError('Node with id "' + id + '" not found'); + } + this._selectObject(node,true,true,highlightEdges); + } + this.redraw(); + }; + + + /** + * select zero or more edges + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + */ + exports.selectEdges = function(selection) { + var i, iMax, id; + + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; + + // first unselect any selected node + this._unselectAll(true); + + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; + + var edge = this.edges[id]; + if (!edge) { + throw new RangeError('Edge with id "' + id + '" not found'); + } + this._selectObject(edge,true,true,highlightEdges); + } + this.redraw(); + }; + + /** + * Validate the selection: remove ids of nodes which no longer exist + * @private + */ + exports._updateSelection = function () { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (!this.nodes.hasOwnProperty(nodeId)) { + delete this.selectionObj.nodes[nodeId]; + } + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + if (!this.edges.hasOwnProperty(edgeId)) { + delete this.selectionObj.edges[edgeId]; + } + } + } + }; + + +/***/ }, +/* 55 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var Node = __webpack_require__(44); + var Edge = __webpack_require__(45); + + /** + * clears the toolbar div element of children + * + * @private + */ + exports._clearManipulatorBar = function() { + while (this.manipulationDiv.hasChildNodes()) { + this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); + } + }; + + /** + * Manipulation UI temporarily overloads certain functions to extend or replace them. To be able to restore + * these functions to their original functionality, we saved them in this.cachedFunctions. + * This function restores these functions to their original function. + * + * @private + */ + exports._restoreOverloadedFunctions = function() { + for (var functionName in this.cachedFunctions) { + if (this.cachedFunctions.hasOwnProperty(functionName)) { + this[functionName] = this.cachedFunctions[functionName]; + } + } + }; + + /** + * Enable or disable edit-mode. + * + * @private + */ + exports._toggleEditMode = function() { + this.editMode = !this.editMode; + var toolbar = document.getElementById("network-manipulationDiv"); + var closeDiv = document.getElementById("network-manipulation-closeDiv"); + var editModeDiv = document.getElementById("network-manipulation-editMode"); + if (this.editMode == true) { + toolbar.style.display="block"; + closeDiv.style.display="block"; + editModeDiv.style.display="none"; + closeDiv.onclick = this._toggleEditMode.bind(this); + } + else { + toolbar.style.display="none"; + closeDiv.style.display="none"; + editModeDiv.style.display="block"; + closeDiv.onclick = null; + } + this._createManipulatorBar() + }; + + /** + * main function, creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. + * + * @private + */ + exports._createManipulatorBar = function() { + // remove bound functions + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + if (this.edgeBeingEdited !== undefined) { + this.edgeBeingEdited._disableControlNodes(); + this.edgeBeingEdited = undefined; + this.selectedControlNode = null; + this.controlNodesActive = false; + } + + // restore overloaded functions + this._restoreOverloadedFunctions(); + + // resume calculation + this.freezeSimulation = false; + + // reset global variables + this.blockConnectingEdgeSelection = false; + this.forceAppendSelection = false; + + if (this.editMode == true) { + while (this.manipulationDiv.hasChildNodes()) { + this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); + } + // add the icons to the manipulator div + this.manipulationDiv.innerHTML = "" + + "" + + ""+this.constants.labels['add'] +"" + + "
" + + "" + + ""+this.constants.labels['link'] +""; + if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { + this.manipulationDiv.innerHTML += "" + + "
" + + "" + + ""+this.constants.labels['editNode'] +""; + } + else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { + this.manipulationDiv.innerHTML += "" + + "
" + + "" + + ""+this.constants.labels['editEdge'] +""; + } + if (this._selectionIsEmpty() == false) { + this.manipulationDiv.innerHTML += "" + + "
" + + "" + + ""+this.constants.labels['del'] +""; + } + + + // bind the icons + var addNodeButton = document.getElementById("network-manipulate-addNode"); + addNodeButton.onclick = this._createAddNodeToolbar.bind(this); + var addEdgeButton = document.getElementById("network-manipulate-connectNode"); + addEdgeButton.onclick = this._createAddEdgeToolbar.bind(this); + if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { + var editButton = document.getElementById("network-manipulate-editNode"); + editButton.onclick = this._editNode.bind(this); + } + else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { + var editButton = document.getElementById("network-manipulate-editEdge"); + editButton.onclick = this._createEditEdgeToolbar.bind(this); + } + if (this._selectionIsEmpty() == false) { + var deleteButton = document.getElementById("network-manipulate-delete"); + deleteButton.onclick = this._deleteSelected.bind(this); + } + var closeDiv = document.getElementById("network-manipulation-closeDiv"); + closeDiv.onclick = this._toggleEditMode.bind(this); + + this.boundFunction = this._createManipulatorBar.bind(this); + this.on('select', this.boundFunction); + } + else { + this.editModeDiv.innerHTML = "" + + "" + + "" + this.constants.labels['edit'] + ""; + var editModeButton = document.getElementById("network-manipulate-editModeButton"); + editModeButton.onclick = this._toggleEditMode.bind(this); + } + }; + + + + /** + * Create the toolbar for adding Nodes + * + * @private + */ + exports._createAddNodeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + // create the toolbar contents + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
" + + "" + + "" + this.constants.labels['addDescription'] + ""; + + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); + + // we use the boundFunction so we can reference it when we unbind it from the "select" event. + this.boundFunction = this._addNode.bind(this); + this.on('select', this.boundFunction); + }; + + + /** + * create the toolbar to connect nodes + * + * @private + */ + exports._createAddEdgeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + this._unselectAll(true); + this.freezeSimulation = true; + + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + this._unselectAll(); + this.forceAppendSelection = false; + this.blockConnectingEdgeSelection = true; + + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
" + + "" + + "" + this.constants.labels['linkDescription'] + ""; + + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); + + // we use the boundFunction so we can reference it when we unbind it from the "select" event. + this.boundFunction = this._handleConnect.bind(this); + this.on('select', this.boundFunction); + + // temporarily overload functions + this.cachedFunctions["_handleTouch"] = this._handleTouch; + this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; + this._handleTouch = this._handleConnect; + this._handleOnRelease = this._finishConnect; + + // redraw to show the unselect + this._redraw(); + }; + + /** + * create the toolbar to edit edges + * + * @private + */ + exports._createEditEdgeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + this.controlNodesActive = true; + + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + this.edgeBeingEdited = this._getSelectedEdge(); + this.edgeBeingEdited._enableControlNodes(); + + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
" + + "" + + "" + this.constants.labels['editEdgeDescription'] + ""; + + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); + + // temporarily overload functions + this.cachedFunctions["_handleTouch"] = this._handleTouch; + this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; + this.cachedFunctions["_handleTap"] = this._handleTap; + this.cachedFunctions["_handleDragStart"] = this._handleDragStart; + this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + this._handleTouch = this._selectControlNode; + this._handleTap = function () {}; + this._handleOnDrag = this._controlNodeDrag; + this._handleDragStart = function () {} + this._handleOnRelease = this._releaseControlNode; + + // redraw to show the unselect + this._redraw(); + }; + + + + + + /** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ + exports._selectControlNode = function(pointer) { + this.edgeBeingEdited.controlNodes.from.unselect(); + this.edgeBeingEdited.controlNodes.to.unselect(); + this.selectedControlNode = this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(pointer.x),this._YconvertDOMtoCanvas(pointer.y)); + if (this.selectedControlNode !== null) { + this.selectedControlNode.select(); + this.freezeSimulation = true; + } + this._redraw(); + }; + + /** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ + exports._controlNodeDrag = function(event) { + var pointer = this._getPointer(event.gesture.center); + if (this.selectedControlNode !== null && this.selectedControlNode !== undefined) { + this.selectedControlNode.x = this._XconvertDOMtoCanvas(pointer.x); + this.selectedControlNode.y = this._YconvertDOMtoCanvas(pointer.y); + } + this._redraw(); + }; + + exports._releaseControlNode = function(pointer) { + var newNode = this._getNodeAt(pointer); + if (newNode != null) { + if (this.edgeBeingEdited.controlNodes.from.selected == true) { + this._editEdge(newNode.id, this.edgeBeingEdited.to.id); + this.edgeBeingEdited.controlNodes.from.unselect(); + } + if (this.edgeBeingEdited.controlNodes.to.selected == true) { + this._editEdge(this.edgeBeingEdited.from.id, newNode.id); + this.edgeBeingEdited.controlNodes.to.unselect(); + } + } + else { + this.edgeBeingEdited._restoreControlNodes(); + } + this.freezeSimulation = false; + this._redraw(); + }; + + /** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ + exports._handleConnect = function(pointer) { + if (this._getSelectedNodeCount() == 0) { + var node = this._getNodeAt(pointer); + if (node != null) { + if (node.clusterSize > 1) { + alert("Cannot create edges to a cluster.") + } + else { + this._selectObject(node,false); + // create a node the temporary line can look at + this.sectors['support']['nodes']['targetNode'] = new Node({id:'targetNode'},{},{},this.constants); + this.sectors['support']['nodes']['targetNode'].x = node.x; + this.sectors['support']['nodes']['targetNode'].y = node.y; + this.sectors['support']['nodes']['targetViaNode'] = new Node({id:'targetViaNode'},{},{},this.constants); + this.sectors['support']['nodes']['targetViaNode'].x = node.x; + this.sectors['support']['nodes']['targetViaNode'].y = node.y; + this.sectors['support']['nodes']['targetViaNode'].parentEdgeId = "connectionEdge"; + + // create a temporary edge + this.edges['connectionEdge'] = new Edge({id:"connectionEdge",from:node.id,to:this.sectors['support']['nodes']['targetNode'].id}, this, this.constants); + this.edges['connectionEdge'].from = node; + this.edges['connectionEdge'].connected = true; + this.edges['connectionEdge'].smooth = true; + this.edges['connectionEdge'].selected = true; + this.edges['connectionEdge'].to = this.sectors['support']['nodes']['targetNode']; + this.edges['connectionEdge'].via = this.sectors['support']['nodes']['targetViaNode']; + + this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + this._handleOnDrag = function(event) { + var pointer = this._getPointer(event.gesture.center); + this.sectors['support']['nodes']['targetNode'].x = this._XconvertDOMtoCanvas(pointer.x); + this.sectors['support']['nodes']['targetNode'].y = this._YconvertDOMtoCanvas(pointer.y); + this.sectors['support']['nodes']['targetViaNode'].x = 0.5 * (this._XconvertDOMtoCanvas(pointer.x) + this.edges['connectionEdge'].from.x); + this.sectors['support']['nodes']['targetViaNode'].y = this._YconvertDOMtoCanvas(pointer.y); + }; + + this.moving = true; + this.start(); + } + } + } + }; + + exports._finishConnect = function(pointer) { + if (this._getSelectedNodeCount() == 1) { + + // restore the drag function + this._handleOnDrag = this.cachedFunctions["_handleOnDrag"]; + delete this.cachedFunctions["_handleOnDrag"]; + + // remember the edge id + var connectFromId = this.edges['connectionEdge'].fromId; + + // remove the temporary nodes and edge + delete this.edges['connectionEdge']; + delete this.sectors['support']['nodes']['targetNode']; + delete this.sectors['support']['nodes']['targetViaNode']; + + var node = this._getNodeAt(pointer); + if (node != null) { + if (node.clusterSize > 1) { + alert("Cannot create edges to a cluster.") + } + else { + this._createEdge(connectFromId,node.id); + this._createManipulatorBar(); + } + } + this._unselectAll(); + } + }; + + + /** + * Adds a node on the specified location + */ + exports._addNode = function() { + if (this._selectionIsEmpty() && this.editMode == true) { + var positionObject = this._pointerToPositionObject(this.pointerPosition); + var defaultData = {id:util.randomUUID(),x:positionObject.left,y:positionObject.top,label:"new",allowedToMoveX:true,allowedToMoveY:true}; + if (this.triggerFunctions.add) { + if (this.triggerFunctions.add.length == 2) { + var me = this; + this.triggerFunctions.add(defaultData, function(finalizedData) { + me.nodesData.add(finalizedData); + me._createManipulatorBar(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels['addError']); + this._createManipulatorBar(); + this.moving = true; + this.start(); + } + } + else { + this.nodesData.add(defaultData); + this._createManipulatorBar(); + this.moving = true; + this.start(); + } + } + }; + + + /** + * connect two nodes with a new edge. + * + * @private + */ + exports._createEdge = function(sourceNodeId,targetNodeId) { + if (this.editMode == true) { + var defaultData = {from:sourceNodeId, to:targetNodeId}; + if (this.triggerFunctions.connect) { + if (this.triggerFunctions.connect.length == 2) { + var me = this; + this.triggerFunctions.connect(defaultData, function(finalizedData) { + me.edgesData.add(finalizedData); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["linkError"]); + this.moving = true; + this.start(); + } + } + else { + this.edgesData.add(defaultData); + this.moving = true; + this.start(); + } + } + }; + + /** + * connect two nodes with a new edge. + * + * @private + */ + exports._editEdge = function(sourceNodeId,targetNodeId) { + if (this.editMode == true) { + var defaultData = {id: this.edgeBeingEdited.id, from:sourceNodeId, to:targetNodeId}; + if (this.triggerFunctions.editEdge) { + if (this.triggerFunctions.editEdge.length == 2) { + var me = this; + this.triggerFunctions.editEdge(defaultData, function(finalizedData) { + me.edgesData.update(finalizedData); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["linkError"]); + this.moving = true; + this.start(); + } + } + else { + this.edgesData.update(defaultData); + this.moving = true; + this.start(); + } + } + }; + + /** + * Create the toolbar to edit the selected node. The label and the color can be changed. Other colors are derived from the chosen color. + * + * @private + */ + exports._editNode = function() { + if (this.triggerFunctions.edit && this.editMode == true) { + var node = this._getSelectedNode(); + var data = {id:node.id, + label: node.label, + group: node.group, + shape: node.shape, + color: { + background:node.color.background, + border:node.color.border, + highlight: { + background:node.color.highlight.background, + border:node.color.highlight.border + } + }}; + if (this.triggerFunctions.edit.length == 2) { + var me = this; + this.triggerFunctions.edit(data, function (finalizedData) { + me.nodesData.update(finalizedData); + me._createManipulatorBar(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["editError"]); + } + } + else { + alert(this.constants.labels["editBoundError"]); + } + }; + + + + + /** + * delete everything in the selection + * + * @private + */ + exports._deleteSelected = function() { + if (!this._selectionIsEmpty() && this.editMode == true) { + if (!this._clusterInSelection()) { + var selectedNodes = this.getSelectedNodes(); + var selectedEdges = this.getSelectedEdges(); + if (this.triggerFunctions.del) { + var me = this; + var data = {nodes: selectedNodes, edges: selectedEdges}; + if (this.triggerFunctions.del.length = 2) { + this.triggerFunctions.del(data, function (finalizedData) { + me.edgesData.remove(finalizedData.edges); + me.nodesData.remove(finalizedData.nodes); + me._unselectAll(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["deleteError"]) + } + } + else { + this.edgesData.remove(selectedEdges); + this.nodesData.remove(selectedNodes); + this._unselectAll(); + this.moving = true; + this.start(); + } + } + else { + alert(this.constants.labels["deleteClusterError"]); + } + } + }; + + +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + + exports._cleanNavigation = function() { + // clean up previous navigation items + var wrapper = document.getElementById('network-navigation_wrapper'); + if (wrapper != null) { + this.containerElement.removeChild(wrapper); + } + document.onmouseup = null; + }; + + /** + * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation + * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent + * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. + * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. + * + * @private + */ + exports._loadNavigationElements = function() { + this._cleanNavigation(); + + this.navigationDivs = {}; + var navigationDivs = ['up','down','left','right','zoomIn','zoomOut','zoomExtends']; + var navigationDivActions = ['_moveUp','_moveDown','_moveLeft','_moveRight','_zoomIn','_zoomOut','zoomExtent']; + + this.navigationDivs['wrapper'] = document.createElement('div'); + this.navigationDivs['wrapper'].id = "network-navigation_wrapper"; + this.navigationDivs['wrapper'].style.position = "absolute"; + this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; + this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; + this.containerElement.insertBefore(this.navigationDivs['wrapper'],this.frame); + + for (var i = 0; i < navigationDivs.length; i++) { + this.navigationDivs[navigationDivs[i]] = document.createElement('div'); + this.navigationDivs[navigationDivs[i]].id = "network-navigation_" + navigationDivs[i]; + this.navigationDivs[navigationDivs[i]].className = "network-navigation " + navigationDivs[i]; + this.navigationDivs['wrapper'].appendChild(this.navigationDivs[navigationDivs[i]]); + this.navigationDivs[navigationDivs[i]].onmousedown = this[navigationDivActions[i]].bind(this); + } + + document.onmouseup = this._stopMovement.bind(this); + }; + + /** + * this stops all movement induced by the navigation buttons + * + * @private + */ + exports._stopMovement = function() { + this._xStopMoving(); + this._yStopMoving(); + this._stopZoom(); + }; + + + /** + * move the screen up + * By using the increments, instead of adding a fixed number to the translation, we keep fluent and + * instant movement. The onKeypress event triggers immediately, then pauses, then triggers frequently + * To avoid this behaviour, we do the translation in the start loop. + * + * @private + */ + exports._moveUp = function(event) { + this.yIncrement = this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['up'].className += " active"; + } + }; + + + /** + * move the screen down + * @private + */ + exports._moveDown = function(event) { + this.yIncrement = -this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['down'].className += " active"; + } + }; + + + /** + * move the screen left + * @private + */ + exports._moveLeft = function(event) { + this.xIncrement = this.constants.keyboard.speed.x; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['left'].className += " active"; + } + }; + + + /** + * move the screen right + * @private + */ + exports._moveRight = function(event) { + this.xIncrement = -this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['right'].className += " active"; + } + }; + + + /** + * Zoom in, using the same method as the movement. + * @private + */ + exports._zoomIn = function(event) { + this.zoomIncrement = this.constants.keyboard.speed.zoom; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['zoomIn'].className += " active"; + } + }; + + + /** + * Zoom out + * @private + */ + exports._zoomOut = function() { + this.zoomIncrement = -this.constants.keyboard.speed.zoom; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['zoomOut'].className += " active"; + } + }; + + + /** + * Stop zooming and unhighlight the zoom controls + * @private + */ + exports._stopZoom = function() { + this.zoomIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['zoomIn'].className = this.navigationDivs['zoomIn'].className.replace(" active",""); + this.navigationDivs['zoomOut'].className = this.navigationDivs['zoomOut'].className.replace(" active",""); + } + }; + + + /** + * Stop moving in the Y direction and unHighlight the up and down + * @private + */ + exports._yStopMoving = function() { + this.yIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['up'].className = this.navigationDivs['up'].className.replace(" active",""); + this.navigationDivs['down'].className = this.navigationDivs['down'].className.replace(" active",""); + } + }; + + + /** + * Stop moving in the X direction and unHighlight left and right. + * @private + */ + exports._xStopMoving = function() { + this.xIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['left'].className = this.navigationDivs['left'].className.replace(" active",""); + this.navigationDivs['right'].className = this.navigationDivs['right'].className.replace(" active",""); + } + }; + + +/***/ }, +/* 57 */ +/***/ function(module, exports, __webpack_require__) { + + exports._resetLevels = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.preassignedLevel == false) { + node.level = -1; + } + } + } + }; + + /** + * This is the main function to layout the nodes in a hierarchical way. + * It checks if the node details are supplied correctly + * + * @private + */ + exports._setupHierarchicalLayout = function() { + if (this.constants.hierarchicalLayout.enabled == true && this.nodeIndices.length > 0) { + if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "DU") { + this.constants.hierarchicalLayout.levelSeparation *= -1; + } + else { + this.constants.hierarchicalLayout.levelSeparation = Math.abs(this.constants.hierarchicalLayout.levelSeparation); + } + + if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "LR") { + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.type = "vertical"; + } + } + else { + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.type = "horizontal"; + } + } + // get the size of the largest hubs and check if the user has defined a level for a node. + var hubsize = 0; + var node, nodeId; + var definedLevel = false; + var undefinedLevel = false; + + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.level != -1) { + definedLevel = true; + } + else { + undefinedLevel = true; + } + if (hubsize < node.edges.length) { + hubsize = node.edges.length; + } + } + } + + // if the user defined some levels but not all, alert and run without hierarchical layout + if (undefinedLevel == true && definedLevel == true) { + alert("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes."); + this.zoomExtent(true,this.constants.clustering.enabled); + if (!this.constants.clustering.enabled) { + this.start(); + } + } + else { + // setup the system to use hierarchical method. + this._changeConstants(); + + // define levels if undefined by the users. Based on hubsize + if (undefinedLevel == true) { + this._determineLevels(hubsize); + } + // check the distribution of the nodes per level. + var distribution = this._getDistribution(); + + // place the nodes on the canvas. This also stablilizes the system. + this._placeNodesByHierarchy(distribution); + + // start the simulation. + this.start(); + } + } + }; + + + /** + * This function places the nodes on the canvas based on the hierarchial distribution. + * + * @param {Object} distribution | obtained by the function this._getDistribution() + * @private + */ + exports._placeNodesByHierarchy = function(distribution) { + var nodeId, node; + + // start placing all the level 0 nodes first. Then recursively position their branches. + for (var level in distribution) { + if (distribution.hasOwnProperty(level)) { + + for (nodeId in distribution[level].nodes) { + if (distribution[level].nodes.hasOwnProperty(nodeId)) { + node = distribution[level].nodes[nodeId]; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + if (node.xFixed) { + node.x = distribution[level].minPos; + node.xFixed = false; + + distribution[level].minPos += distribution[level].nodeSpacing; + } + } + else { + if (node.yFixed) { + node.y = distribution[level].minPos; + node.yFixed = false; + + distribution[level].minPos += distribution[level].nodeSpacing; + } + } + this._placeBranchNodes(node.edges,node.id,distribution,node.level); + } + } + } + } + + // stabilize the system after positioning. This function calls zoomExtent. + this._stabilize(); + }; + + + /** + * This function get the distribution of levels based on hubsize + * + * @returns {Object} + * @private + */ + exports._getDistribution = function() { + var distribution = {}; + var nodeId, node, level; + + // we fix Y because the hierarchy is vertical, we fix X so we do not give a node an x position for a second time. + // the fix of X is removed after the x value has been set. + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + node.xFixed = true; + node.yFixed = true; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + node.y = this.constants.hierarchicalLayout.levelSeparation*node.level; + } + else { + node.x = this.constants.hierarchicalLayout.levelSeparation*node.level; + } + if (distribution[node.level] === undefined) { + distribution[node.level] = {amount: 0, nodes: {}, minPos:0, nodeSpacing:0}; + } + distribution[node.level].amount += 1; + distribution[node.level].nodes[nodeId] = node; + } + } + + // determine the largest amount of nodes of all levels + var maxCount = 0; + for (level in distribution) { + if (distribution.hasOwnProperty(level)) { + if (maxCount < distribution[level].amount) { + maxCount = distribution[level].amount; + } + } + } + + // set the initial position and spacing of each nodes accordingly + for (level in distribution) { + if (distribution.hasOwnProperty(level)) { + distribution[level].nodeSpacing = (maxCount + 1) * this.constants.hierarchicalLayout.nodeSpacing; + distribution[level].nodeSpacing /= (distribution[level].amount + 1); + distribution[level].minPos = distribution[level].nodeSpacing - (0.5 * (distribution[level].amount + 1) * distribution[level].nodeSpacing); + } + } + + return distribution; + }; + + + /** + * this function allocates nodes in levels based on the recursive branching from the largest hubs. + * + * @param hubsize + * @private + */ + exports._determineLevels = function(hubsize) { + var nodeId, node; + + // determine hubs + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.edges.length == hubsize) { + node.level = 0; + } + } + } + + // branch from hubs + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.level == 0) { + this._setLevel(1,node.edges,node.id); + } + } + } + }; + + + /** + * Since hierarchical layout does not support: + * - smooth curves (based on the physics), + * - clustering (based on dynamic node counts) + * + * We disable both features so there will be no problems. + * + * @private + */ + exports._changeConstants = function() { + this.constants.clustering.enabled = false; + this.constants.physics.barnesHut.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this._loadSelectedForceSolver(); + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.dynamic = false; + } + this._configureSmoothCurves(); + }; + + + /** + * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes + * on a X position that ensures there will be no overlap. + * + * @param edges + * @param parentId + * @param distribution + * @param parentLevel + * @private + */ + exports._placeBranchNodes = function(edges, parentId, distribution, parentLevel) { + for (var i = 0; i < edges.length; i++) { + var childNode = null; + if (edges[i].toId == parentId) { + childNode = edges[i].from; + } + else { + childNode = edges[i].to; + } + + // if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here. + var nodeMoved = false; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + if (childNode.xFixed && childNode.level > parentLevel) { + childNode.xFixed = false; + childNode.x = distribution[childNode.level].minPos; + nodeMoved = true; + } + } + else { + if (childNode.yFixed && childNode.level > parentLevel) { + childNode.yFixed = false; + childNode.y = distribution[childNode.level].minPos; + nodeMoved = true; + } + } + + if (nodeMoved == true) { + distribution[childNode.level].minPos += distribution[childNode.level].nodeSpacing; + if (childNode.edges.length > 1) { + this._placeBranchNodes(childNode.edges,childNode.id,distribution,childNode.level); + } + } + } + }; + + + /** + * this function is called recursively to enumerate the barnches of the largest hubs and give each node a level. + * + * @param level + * @param edges + * @param parentId + * @private + */ + exports._setLevel = function(level, edges, parentId) { + for (var i = 0; i < edges.length; i++) { + var childNode = null; + if (edges[i].toId == parentId) { + childNode = edges[i].from; + } + else { + childNode = edges[i].to; + } + if (childNode.level == -1 || childNode.level > level) { + childNode.level = level; + if (edges.length > 1) { + this._setLevel(level+1, childNode.edges, childNode.id); + } + } + } + }; + + + /** + * Unfix nodes + * + * @private + */ + exports._restoreNodes = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.nodes[nodeId].xFixed = false; + this.nodes[nodeId].yFixed = false; + } + } + }; + + +/***/ }, +/* 58 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Canvas shapes used by Network + */ + if (typeof CanvasRenderingContext2D !== 'undefined') { + + /** + * Draw a circle shape + */ + CanvasRenderingContext2D.prototype.circle = function(x, y, r) { + this.beginPath(); + this.arc(x, y, r, 0, 2*Math.PI, false); + }; + + /** + * Draw a square shape + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r size, width and height of the square + */ + CanvasRenderingContext2D.prototype.square = function(x, y, r) { + this.beginPath(); + this.rect(x - r, y - r, r * 2, r * 2); + }; + + /** + * Draw a triangle shape + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r radius, half the length of the sides of the triangle + */ + CanvasRenderingContext2D.prototype.triangle = function(x, y, r) { + // http://en.wikipedia.org/wiki/Equilateral_triangle + this.beginPath(); + + var s = r * 2; + var s2 = s / 2; + var ir = Math.sqrt(3) / 6 * s; // radius of inner circle + var h = Math.sqrt(s * s - s2 * s2); // height + + this.moveTo(x, y - (h - ir)); + this.lineTo(x + s2, y + ir); + this.lineTo(x - s2, y + ir); + this.lineTo(x, y - (h - ir)); + this.closePath(); + }; + + /** + * Draw a triangle shape in downward orientation + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r radius + */ + CanvasRenderingContext2D.prototype.triangleDown = function(x, y, r) { + // http://en.wikipedia.org/wiki/Equilateral_triangle + this.beginPath(); + + var s = r * 2; + var s2 = s / 2; + var ir = Math.sqrt(3) / 6 * s; // radius of inner circle + var h = Math.sqrt(s * s - s2 * s2); // height + + this.moveTo(x, y + (h - ir)); + this.lineTo(x + s2, y - ir); + this.lineTo(x - s2, y - ir); + this.lineTo(x, y + (h - ir)); + this.closePath(); + }; + + /** + * Draw a star shape, a star with 5 points + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r radius, half the length of the sides of the triangle + */ + CanvasRenderingContext2D.prototype.star = function(x, y, r) { + // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ + this.beginPath(); + + for (var n = 0; n < 10; n++) { + var radius = (n % 2 === 0) ? r * 1.3 : r * 0.5; + this.lineTo( + x + radius * Math.sin(n * 2 * Math.PI / 10), + y - radius * Math.cos(n * 2 * Math.PI / 10) + ); + } + + this.closePath(); + }; + + /** + * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas + */ + CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) { + var r2d = Math.PI/180; + if( w - ( 2 * r ) < 0 ) { r = ( w / 2 ); } //ensure that the radius isn't too large for x + if( h - ( 2 * r ) < 0 ) { r = ( h / 2 ); } //ensure that the radius isn't too large for y + this.beginPath(); + this.moveTo(x+r,y); + this.lineTo(x+w-r,y); + this.arc(x+w-r,y+r,r,r2d*270,r2d*360,false); + this.lineTo(x+w,y+h-r); + this.arc(x+w-r,y+h-r,r,0,r2d*90,false); + this.lineTo(x+r,y+h); + this.arc(x+r,y+h-r,r,r2d*90,r2d*180,false); + this.lineTo(x,y+r); + this.arc(x+r,y+r,r,r2d*180,r2d*270,false); + }; + + /** + * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + */ + CanvasRenderingContext2D.prototype.ellipse = function(x, y, w, h) { + var kappa = .5522848, + ox = (w / 2) * kappa, // control point offset horizontal + oy = (h / 2) * kappa, // control point offset vertical + xe = x + w, // x-end + ye = y + h, // y-end + xm = x + w / 2, // x-middle + ym = y + h / 2; // y-middle + + this.beginPath(); + this.moveTo(x, ym); + this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + }; + + + + /** + * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + */ + CanvasRenderingContext2D.prototype.database = function(x, y, w, h) { + var f = 1/3; + var wEllipse = w; + var hEllipse = h * f; + + var kappa = .5522848, + ox = (wEllipse / 2) * kappa, // control point offset horizontal + oy = (hEllipse / 2) * kappa, // control point offset vertical + xe = x + wEllipse, // x-end + ye = y + hEllipse, // y-end + xm = x + wEllipse / 2, // x-middle + ym = y + hEllipse / 2, // y-middle + ymb = y + (h - hEllipse/2), // y-midlle, bottom ellipse + yeb = y + h; // y-end, bottom ellipse + + this.beginPath(); + this.moveTo(xe, ym); + + this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + + this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + + this.lineTo(xe, ymb); + + this.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb); + this.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb); + + this.lineTo(x, ym); + }; + + + /** + * Draw an arrow point (no line) + */ + CanvasRenderingContext2D.prototype.arrow = function(x, y, angle, length) { + // tail + var xt = x - length * Math.cos(angle); + var yt = y - length * Math.sin(angle); + + // inner tail + // TODO: allow to customize different shapes + var xi = x - length * 0.9 * Math.cos(angle); + var yi = y - length * 0.9 * Math.sin(angle); + + // left + var xl = xt + length / 3 * Math.cos(angle + 0.5 * Math.PI); + var yl = yt + length / 3 * Math.sin(angle + 0.5 * Math.PI); + + // right + var xr = xt + length / 3 * Math.cos(angle - 0.5 * Math.PI); + var yr = yt + length / 3 * Math.sin(angle - 0.5 * Math.PI); + + this.beginPath(); + this.moveTo(x, y); + this.lineTo(xl, yl); + this.lineTo(xi, yi); + this.lineTo(xr, yr); + this.closePath(); + }; + + /** + * Sets up the dashedLine functionality for drawing + * Original code came from http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas + * @author David Jordan + * @date 2012-08-08 + */ + CanvasRenderingContext2D.prototype.dashedLine = function(x,y,x2,y2,dashArray){ + if (!dashArray) dashArray=[10,5]; + if (dashLength==0) dashLength = 0.001; // Hack for Safari + var dashCount = dashArray.length; + this.moveTo(x, y); + var dx = (x2-x), dy = (y2-y); + var slope = dy/dx; + var distRemaining = Math.sqrt( dx*dx + dy*dy ); + var dashIndex=0, draw=true; + while (distRemaining>=0.1){ + var dashLength = dashArray[dashIndex++%dashCount]; + if (dashLength > distRemaining) dashLength = distRemaining; + var xStep = Math.sqrt( dashLength*dashLength / (1 + slope*slope) ); + if (dx<0) xStep = -xStep; + x += xStep; + y += slope*xStep; + this[draw ? 'lineTo' : 'moveTo'](x,y); + distRemaining -= dashLength; + draw = !draw; + } + }; + + // TODO: add diamond shape + } + + +/***/ } +/******/ ]) +}) diff --git a/dist/vis.css b/dist/vis.css old mode 100644 new mode 100755 index 2a5d8a24..260d73e2 --- a/dist/vis.css +++ b/dist/vis.css @@ -703,4 +703,4 @@ div.network-navigation.zoomExtends { background-image: url("img/network/zoomExtends.png"); bottom:50px; right:15px; -} +} \ No newline at end of file diff --git a/dist/vis.js b/dist/vis.js index 525a40b8..8a6ce8c9 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -4,8 +4,8 @@ * * A dynamic, browser-based visualization library. * - * @version 3.0.0 - * @date 2014-07-07 + * @version 3.1.0 + * @date 2014-07-22 * * @license * Copyright (C) 2011-2014 Almende B.V, http://almende.com @@ -22,441 +22,324 @@ * License for the specific language governing permissions and limitations under * the License. */ -!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.vis=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o>> 0; + // Timeline + exports.Timeline = __webpack_require__(12); + exports.Graph2d = __webpack_require__(13); + exports.timeline = { + DataStep: __webpack_require__(14), + Range: __webpack_require__(15), + stack: __webpack_require__(16), + TimeStep: __webpack_require__(17), - // 4. If IsCallable(callback) is false, throw a TypeError exception. - // See: http://es5.github.com/#x9.11 - if (typeof callback !== "function") { - throw new TypeError(callback + " is not a function"); - } + components: { + items: { + Item: __webpack_require__(28), + ItemBox: __webpack_require__(29), + ItemPoint: __webpack_require__(30), + ItemRange: __webpack_require__(31) + }, - // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. - if (thisArg) { - T = thisArg; + Component: __webpack_require__(18), + CurrentTime: __webpack_require__(19), + CustomTime: __webpack_require__(20), + DataAxis: __webpack_require__(21), + GraphGroup: __webpack_require__(22), + Group: __webpack_require__(23), + ItemSet: __webpack_require__(24), + Legend: __webpack_require__(25), + LineGraph: __webpack_require__(26), + TimeAxis: __webpack_require__(27) } + }; - // 6. Let A be a new array created as if by the expression new Array(len) where Array is - // the standard built-in constructor with that name and len is the value of len. - A = new Array(len); - - // 7. Let k be 0 - k = 0; - - // 8. Repeat, while k < len - while(k < len) { - - var kValue, mappedValue; + // Network + exports.Network = __webpack_require__(32); + exports.network = { + Edge: __webpack_require__(33), + Groups: __webpack_require__(34), + Images: __webpack_require__(35), + Node: __webpack_require__(36), + Popup: __webpack_require__(37), + dotparser: __webpack_require__(38), + gephiParser: __webpack_require__(39) + }; - // a. Let Pk be ToString(k). - // This is implicit for LHS operands of the in operator - // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. - // This step can be combined with c - // c. If kPresent is true, then - if (k in O) { + // Deprecated since v3.0.0 + exports.Graph = function () { + throw new Error('Graph is renamed to Network. Please create a graph as new vis.Network(...)'); + }; - // i. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[ k ]; + // bundled external libraries + exports.moment = __webpack_require__(40); + exports.hammer = __webpack_require__(41); - // ii. Let mappedValue be the result of calling the Call internal method of callback - // with T as the this value and argument list containing kValue, k, and O. - mappedValue = callback.call(T, kValue, k, O); - // iii. Call the DefineOwnProperty internal method of A with arguments - // Pk, Property Descriptor {Value: mappedValue, : true, Enumerable: true, Configurable: true}, - // and false. +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { - // In browsers that support Object.defineProperty, use the following: - // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true }); + // utility functions - // For best browser support, use the following: - A[ k ] = mappedValue; - } - // d. Increase k by 1. - k++; - } + // first check if moment.js is already loaded in the browser window, if so, + // use this instance. Else, load via commonjs. + var moment = __webpack_require__(40); - // 9. return A - return A; + /** + * Test whether given object is a number + * @param {*} object + * @return {Boolean} isNumber + */ + exports.isNumber = function(object) { + return (object instanceof Number || typeof object == 'number'); }; -} -// Internet Explorer 8 and older does not support Array.filter, so we define it -// here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter -if (!Array.prototype.filter) { - Array.prototype.filter = function(fun /*, thisp */) { - "use strict"; - - if (this == null) { - throw new TypeError(); - } + /** + * Test whether given object is a string + * @param {*} object + * @return {Boolean} isString + */ + exports.isString = function(object) { + return (object instanceof String || typeof object == 'string'); + }; - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun != "function") { - throw new TypeError(); + /** + * Test whether given object is a Date, or a String containing a Date + * @param {Date | String} object + * @return {Boolean} isDate + */ + exports.isDate = function(object) { + if (object instanceof Date) { + return true; } - - var res = []; - var thisp = arguments[1]; - for (var i = 0; i < len; i++) { - if (i in t) { - var val = t[i]; // in case fun mutates this - if (fun.call(thisp, val, i, t)) - res.push(val); + else if (exports.isString(object)) { + // test whether this string contains a date + var match = ASPDateRegex.exec(object); + if (match) { + return true; + } + else if (!isNaN(Date.parse(object))) { + return true; } } - return res; + return false; }; -} - - -// Internet Explorer 8 and older does not support Object.keys, so we define it -// here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys -if (!Object.keys) { - Object.keys = (function () { - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), - dontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ], - dontEnumsLength = dontEnums.length; - return function (obj) { - if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) { - throw new TypeError('Object.keys called on non-object'); - } + /** + * Test whether given object is an instance of google.visualization.DataTable + * @param {*} object + * @return {Boolean} isDataTable + */ + exports.isDataTable = function(object) { + return (typeof (google) !== 'undefined') && + (google.visualization) && + (google.visualization.DataTable) && + (object instanceof google.visualization.DataTable); + }; - var result = []; + /** + * Create a semi UUID + * source: http://stackoverflow.com/a/105074/1262753 + * @return {String} uuid + */ + exports.randomUUID = function() { + var S4 = function () { + return Math.floor( + Math.random() * 0x10000 /* 65536 */ + ).toString(16); + }; - for (var prop in obj) { - if (hasOwnProperty.call(obj, prop)) result.push(prop); - } + return ( + S4() + S4() + '-' + + S4() + '-' + + S4() + '-' + + S4() + '-' + + S4() + S4() + S4() + ); + }; - if (hasDontEnumBug) { - for (var i=0; i < dontEnumsLength; i++) { - if (hasOwnProperty.call(obj, dontEnums[i])) result.push(dontEnums[i]); + /** + * Extend object a with the properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Object} a + * @param {... Object} b + * @return {Object} a + */ + exports.extend = function (a, b) { + for (var i = 1, len = arguments.length; i < len; i++) { + var other = arguments[i]; + for (var prop in other) { + if (other.hasOwnProperty(prop)) { + a[prop] = other[prop]; } } - return result; } - })() -} - -// Internet Explorer 8 and older does not support Array.isArray, -// so we define it here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray -if(!Array.isArray) { - Array.isArray = function (vArg) { - return Object.prototype.toString.call(vArg) === "[object Array]"; - }; -} - -// Internet Explorer 8 and older does not support Function.bind, -// so we define it here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} - -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create -if (!Object.create) { - Object.create = function (o) { - if (arguments.length > 1) { - throw new Error('Object.create implementation only accepts the first parameter.'); - } - function F() {} - F.prototype = o; - return new F(); + return a; }; -} -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); + /** + * Extend object a with selected properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Array.} props + * @param {Object} a + * @param {... Object} b + * @return {Object} a + */ + exports.selectiveExtend = function (props, a, b) { + if (!Array.isArray(props)) { + throw new Error('Array with property names expected as first argument'); } - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} - -/** - * utility functions - */ -var util = {}; - -/** - * Test whether given object is a number - * @param {*} object - * @return {Boolean} isNumber - */ -util.isNumber = function(object) { - return (object instanceof Number || typeof object == 'number'); -}; - -/** - * Test whether given object is a string - * @param {*} object - * @return {Boolean} isString - */ -util.isString = function(object) { - return (object instanceof String || typeof object == 'string'); -}; + for (var i = 2; i < arguments.length; i++) { + var other = arguments[i]; -/** - * Test whether given object is a Date, or a String containing a Date - * @param {Date | String} object - * @return {Boolean} isDate - */ -util.isDate = function(object) { - if (object instanceof Date) { - return true; - } - else if (util.isString(object)) { - // test whether this string contains a date - var match = ASPDateRegex.exec(object); - if (match) { - return true; - } - else if (!isNaN(Date.parse(object))) { - return true; + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (other.hasOwnProperty(prop)) { + a[prop] = other[prop]; + } + } } - } - - return false; -}; - -/** - * Test whether given object is an instance of google.visualization.DataTable - * @param {*} object - * @return {Boolean} isDataTable - */ -util.isDataTable = function(object) { - return (typeof (google) !== 'undefined') && - (google.visualization) && - (google.visualization.DataTable) && - (object instanceof google.visualization.DataTable); -}; + return a; + }; -/** - * Create a semi UUID - * source: http://stackoverflow.com/a/105074/1262753 - * @return {String} uuid - */ -util.randomUUID = function() { - var S4 = function () { - return Math.floor( - Math.random() * 0x10000 /* 65536 */ - ).toString(16); - }; - - return ( - S4() + S4() + '-' + - S4() + '-' + - S4() + '-' + - S4() + '-' + - S4() + S4() + S4() - ); -}; + /** + * Extend object a with selected properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Array.} props + * @param {Object} a + * @param {... Object} b + * @return {Object} a + */ + exports.selectiveDeepExtend = function (props, a, b) { + // TODO: add support for Arrays to deepExtend + if (Array.isArray(b)) { + throw new TypeError('Arrays are not supported by deepExtend'); + } + for (var i = 2; i < arguments.length; i++) { + var other = arguments[i]; + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (other.hasOwnProperty(prop)) { + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + exports.deepExtend(a[prop], b[prop]); + } + else { + a[prop] = b[prop]; + } + } else if (Array.isArray(b[prop])) { + throw new TypeError('Arrays are not supported by deepExtend'); + } else { + a[prop] = b[prop]; + } -/** - * Extend object a with the properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Object} a - * @param {... Object} b - * @return {Object} a - */ -util.extend = function (a, b) { - for (var i = 1, len = arguments.length; i < len; i++) { - var other = arguments[i]; - for (var prop in other) { - if (other.hasOwnProperty(prop)) { - a[prop] = other[prop]; + } } } - } - - return a; -}; - -/** - * Extend object a with selected properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Array.} props - * @param {Object} a - * @param {... Object} b - * @return {Object} a - */ -util.selectiveExtend = function (props, a, b) { - if (!Array.isArray(props)) { - throw new Error('Array with property names expected as first argument'); - } - - for (var i = 2; i < arguments.length; i++) { - var other = arguments[i]; + return a; + }; - for (var p = 0; p < props.length; p++) { - var prop = props[p]; - if (other.hasOwnProperty(prop)) { - a[prop] = other[prop]; - } + /** + * Deep extend an object a with the properties of object b + * @param {Object} a + * @param {Object} b + * @returns {Object} + */ + exports.deepExtend = function(a, b) { + // TODO: add support for Arrays to deepExtend + if (Array.isArray(b)) { + throw new TypeError('Arrays are not supported by deepExtend'); } - } - return a; -}; -/** - * Extend object a with selected properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Array.} props - * @param {Object} a - * @param {... Object} b - * @return {Object} a - */ -util.selectiveDeepExtend = function (props, a, b) { - // TODO: add support for Arrays to deepExtend - if (Array.isArray(b)) { - throw new TypeError('Arrays are not supported by deepExtend'); - } - for (var i = 2; i < arguments.length; i++) { - var other = arguments[i]; - for (var p = 0; p < props.length; p++) { - var prop = props[p]; - if (other.hasOwnProperty(prop)) { + for (var prop in b) { + if (b.hasOwnProperty(prop)) { if (b[prop] && b[prop].constructor === Object) { if (a[prop] === undefined) { a[prop] = {}; } if (a[prop].constructor === Object) { - util.deepExtend(a[prop], b[prop]); + exports.deepExtend(a[prop], b[prop]); } else { a[prop] = b[prop]; @@ -466,18830 +349,20294 @@ util.selectiveDeepExtend = function (props, a, b) { } else { a[prop] = b[prop]; } - } } - } - return a; -}; + return a; + }; -/** - * Deep extend an object a with the properties of object b - * @param {Object} a - * @param {Object} b - * @returns {Object} - */ -util.deepExtend = function(a, b) { - // TODO: add support for Arrays to deepExtend - if (Array.isArray(b)) { - throw new TypeError('Arrays are not supported by deepExtend'); - } + /** + * Test whether all elements in two arrays are equal. + * @param {Array} a + * @param {Array} b + * @return {boolean} Returns true if both arrays have the same length and same + * elements. + */ + exports.equalArray = function (a, b) { + if (a.length != b.length) return false; - for (var prop in b) { - if (b.hasOwnProperty(prop)) { - if (b[prop] && b[prop].constructor === Object) { - if (a[prop] === undefined) { - a[prop] = {}; - } - if (a[prop].constructor === Object) { - util.deepExtend(a[prop], b[prop]); - } - else { - a[prop] = b[prop]; - } - } else if (Array.isArray(b[prop])) { - throw new TypeError('Arrays are not supported by deepExtend'); - } else { - a[prop] = b[prop]; - } + for (var i = 0, len = a.length; i < len; i++) { + if (a[i] != b[i]) return false; } - } - return a; -}; - -/** - * Test whether all elements in two arrays are equal. - * @param {Array} a - * @param {Array} b - * @return {boolean} Returns true if both arrays have the same length and same - * elements. - */ -util.equalArray = function (a, b) { - if (a.length != b.length) return false; - for (var i = 0, len = a.length; i < len; i++) { - if (a[i] != b[i]) return false; - } - - return true; -}; - -/** - * Convert an object to another type - * @param {Boolean | Number | String | Date | Moment | Null | undefined} object - * @param {String | undefined} type Name of the type. Available types: - * 'Boolean', 'Number', 'String', - * 'Date', 'Moment', ISODate', 'ASPDate'. - * @return {*} object - * @throws Error - */ -util.convert = function(object, type) { - var match; - - if (object === undefined) { - return undefined; - } - if (object === null) { - return null; - } - - if (!type) { - return object; - } - if (!(typeof type === 'string') && !(type instanceof String)) { - throw new Error('Type must be a string'); - } + return true; + }; - //noinspection FallthroughInSwitchStatementJS - switch (type) { - case 'boolean': - case 'Boolean': - return Boolean(object); + /** + * Convert an object to another type + * @param {Boolean | Number | String | Date | Moment | Null | undefined} object + * @param {String | undefined} type Name of the type. Available types: + * 'Boolean', 'Number', 'String', + * 'Date', 'Moment', ISODate', 'ASPDate'. + * @return {*} object + * @throws Error + */ + exports.convert = function(object, type) { + var match; - case 'number': - case 'Number': - return Number(object.valueOf()); + if (object === undefined) { + return undefined; + } + if (object === null) { + return null; + } - case 'string': - case 'String': - return String(object); + if (!type) { + return object; + } + if (!(typeof type === 'string') && !(type instanceof String)) { + throw new Error('Type must be a string'); + } - case 'Date': - if (util.isNumber(object)) { - return new Date(object); - } - if (object instanceof Date) { - return new Date(object.valueOf()); - } - else if (moment.isMoment(object)) { - return new Date(object.valueOf()); - } - if (util.isString(object)) { - match = ASPDateRegex.exec(object); - if (match) { - // object is an ASP date - return new Date(Number(match[1])); // parse number + //noinspection FallthroughInSwitchStatementJS + switch (type) { + case 'boolean': + case 'Boolean': + return Boolean(object); + + case 'number': + case 'Number': + return Number(object.valueOf()); + + case 'string': + case 'String': + return String(object); + + case 'Date': + if (exports.isNumber(object)) { + return new Date(object); + } + if (object instanceof Date) { + return new Date(object.valueOf()); + } + else if (moment.isMoment(object)) { + return new Date(object.valueOf()); + } + if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return new Date(Number(match[1])); // parse number + } + else { + return moment(object).toDate(); // parse string + } } else { - return moment(object).toDate(); // parse string + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type Date'); } - } - else { - throw new Error( - 'Cannot convert object of type ' + util.getType(object) + - ' to type Date'); - } - case 'Moment': - if (util.isNumber(object)) { - return moment(object); - } - if (object instanceof Date) { - return moment(object.valueOf()); - } - else if (moment.isMoment(object)) { - return moment(object); - } - if (util.isString(object)) { - match = ASPDateRegex.exec(object); - if (match) { - // object is an ASP date - return moment(Number(match[1])); // parse number + case 'Moment': + if (exports.isNumber(object)) { + return moment(object); + } + if (object instanceof Date) { + return moment(object.valueOf()); + } + else if (moment.isMoment(object)) { + return moment(object); + } + if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return moment(Number(match[1])); // parse number + } + else { + return moment(object); // parse string + } } else { - return moment(object); // parse string + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type Date'); } - } - else { - throw new Error( - 'Cannot convert object of type ' + util.getType(object) + - ' to type Date'); - } - case 'ISODate': - if (util.isNumber(object)) { - return new Date(object); - } - else if (object instanceof Date) { - return object.toISOString(); - } - else if (moment.isMoment(object)) { - return object.toDate().toISOString(); - } - else if (util.isString(object)) { - match = ASPDateRegex.exec(object); - if (match) { - // object is an ASP date - return new Date(Number(match[1])).toISOString(); // parse number + case 'ISODate': + if (exports.isNumber(object)) { + return new Date(object); + } + else if (object instanceof Date) { + return object.toISOString(); + } + else if (moment.isMoment(object)) { + return object.toDate().toISOString(); + } + else if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return new Date(Number(match[1])).toISOString(); // parse number + } + else { + return new Date(object).toISOString(); // parse string + } } else { - return new Date(object).toISOString(); // parse string + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type ISODate'); } - } - else { - throw new Error( - 'Cannot convert object of type ' + util.getType(object) + - ' to type ISODate'); - } - case 'ASPDate': - if (util.isNumber(object)) { - return '/Date(' + object + ')/'; - } - else if (object instanceof Date) { - return '/Date(' + object.valueOf() + ')/'; - } - else if (util.isString(object)) { - match = ASPDateRegex.exec(object); - var value; - if (match) { - // object is an ASP date - value = new Date(Number(match[1])).valueOf(); // parse number + case 'ASPDate': + if (exports.isNumber(object)) { + return '/Date(' + object + ')/'; + } + else if (object instanceof Date) { + return '/Date(' + object.valueOf() + ')/'; + } + else if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + var value; + if (match) { + // object is an ASP date + value = new Date(Number(match[1])).valueOf(); // parse number + } + else { + value = new Date(object).valueOf(); // parse string + } + return '/Date(' + value + ')/'; } else { - value = new Date(object).valueOf(); // parse string + throw new Error( + 'Cannot convert object of type ' + exports.getType(object) + + ' to type ASPDate'); } - return '/Date(' + value + ')/'; - } - else { - throw new Error( - 'Cannot convert object of type ' + util.getType(object) + - ' to type ASPDate'); - } - default: - throw new Error('Unknown type "' + type + '"'); - } -}; + default: + throw new Error('Unknown type "' + type + '"'); + } + }; -// parse ASP.Net Date pattern, -// for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/' -// code from http://momentjs.com/ -var ASPDateRegex = /^\/?Date\((\-?\d+)/i; + // parse ASP.Net Date pattern, + // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/' + // code from http://momentjs.com/ + var ASPDateRegex = /^\/?Date\((\-?\d+)/i; -/** - * Get the type of an object, for example util.getType([]) returns 'Array' - * @param {*} object - * @return {String} type - */ -util.getType = function(object) { - var type = typeof object; + /** + * Get the type of an object, for example exports.getType([]) returns 'Array' + * @param {*} object + * @return {String} type + */ + exports.getType = function(object) { + var type = typeof object; - if (type == 'object') { - if (object == null) { - return 'null'; - } - if (object instanceof Boolean) { - return 'Boolean'; + if (type == 'object') { + if (object == null) { + return 'null'; + } + if (object instanceof Boolean) { + return 'Boolean'; + } + if (object instanceof Number) { + return 'Number'; + } + if (object instanceof String) { + return 'String'; + } + if (object instanceof Array) { + return 'Array'; + } + if (object instanceof Date) { + return 'Date'; + } + return 'Object'; } - if (object instanceof Number) { + else if (type == 'number') { return 'Number'; } - if (object instanceof String) { - return 'String'; - } - if (object instanceof Array) { - return 'Array'; + else if (type == 'boolean') { + return 'Boolean'; } - if (object instanceof Date) { - return 'Date'; + else if (type == 'string') { + return 'String'; } - return 'Object'; - } - else if (type == 'number') { - return 'Number'; - } - else if (type == 'boolean') { - return 'Boolean'; - } - else if (type == 'string') { - return 'String'; - } - return type; -}; + return type; + }; -/** - * Retrieve the absolute left value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {number} left The absolute left position of this element - * in the browser page. - */ -util.getAbsoluteLeft = function(elem) { - var doc = document.documentElement; - var body = document.body; - - var left = elem.offsetLeft; - var e = elem.offsetParent; - while (e != null && e != body && e != doc) { - left += e.offsetLeft; - left -= e.scrollLeft; - e = e.offsetParent; - } - return left; -}; + /** + * Retrieve the absolute left value of a DOM element + * @param {Element} elem A dom element, for example a div + * @return {number} left The absolute left position of this element + * in the browser page. + */ + exports.getAbsoluteLeft = function(elem) { + return elem.getBoundingClientRect().left + window.pageXOffset; + }; -/** - * Retrieve the absolute top value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {number} top The absolute top position of this element - * in the browser page. - */ -util.getAbsoluteTop = function(elem) { - var doc = document.documentElement; - var body = document.body; - - var top = elem.offsetTop; - var e = elem.offsetParent; - while (e != null && e != body && e != doc) { - top += e.offsetTop; - top -= e.scrollTop; - e = e.offsetParent; - } - return top; -}; + /** + * Retrieve the absolute top value of a DOM element + * @param {Element} elem A dom element, for example a div + * @return {number} top The absolute top position of this element + * in the browser page. + */ + exports.getAbsoluteTop = function(elem) { + return elem.getBoundingClientRect().top + window.pageYOffset; + }; -/** - * Get the absolute, vertical mouse position from an event. - * @param {Event} event - * @return {Number} pageY - */ -util.getPageY = function(event) { - if ('pageY' in event) { - return event.pageY; - } - else { - var clientY; - if (('targetTouches' in event) && event.targetTouches.length) { - clientY = event.targetTouches[0].clientY; - } - else { - clientY = event.clientY; + /** + * add a className to the given elements style + * @param {Element} elem + * @param {String} className + */ + exports.addClassName = function(elem, className) { + var classes = elem.className.split(' '); + if (classes.indexOf(className) == -1) { + classes.push(className); // add the class to the array + elem.className = classes.join(' '); } + }; - var doc = document.documentElement; - var body = document.body; - return clientY + - ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } -}; + /** + * add a className to the given elements style + * @param {Element} elem + * @param {String} className + */ + exports.removeClassName = function(elem, className) { + var classes = elem.className.split(' '); + var index = classes.indexOf(className); + if (index != -1) { + classes.splice(index, 1); // remove the class from the array + elem.className = classes.join(' '); + } + }; -/** - * Get the absolute, horizontal mouse position from an event. - * @param {Event} event - * @return {Number} pageX - */ -util.getPageX = function(event) { - if ('pageY' in event) { - return event.pageX; - } - else { - var clientX; - if (('targetTouches' in event) && event.targetTouches.length) { - clientX = event.targetTouches[0].clientX; + /** + * For each method for both arrays and objects. + * In case of an array, the built-in Array.forEach() is applied. + * In case of an Object, the method loops over all properties of the object. + * @param {Object | Array} object An Object or Array + * @param {function} callback Callback method, called for each item in + * the object or array with three parameters: + * callback(value, index, object) + */ + exports.forEach = function(object, callback) { + var i, + len; + if (object instanceof Array) { + // array + for (i = 0, len = object.length; i < len; i++) { + callback(object[i], i, object); + } } else { - clientX = event.clientX; + // object + for (i in object) { + if (object.hasOwnProperty(i)) { + callback(object[i], i, object); + } + } } + }; - var doc = document.documentElement; - var body = document.body; - return clientX + - ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - } -}; + /** + * Convert an object into an array: all objects properties are put into the + * array. The resulting array is unordered. + * @param {Object} object + * @param {Array} array + */ + exports.toArray = function(object) { + var array = []; -/** - * add a className to the given elements style - * @param {Element} elem - * @param {String} className - */ -util.addClassName = function(elem, className) { - var classes = elem.className.split(' '); - if (classes.indexOf(className) == -1) { - classes.push(className); // add the class to the array - elem.className = classes.join(' '); - } -}; + for (var prop in object) { + if (object.hasOwnProperty(prop)) array.push(object[prop]); + } -/** - * add a className to the given elements style - * @param {Element} elem - * @param {String} className - */ -util.removeClassName = function(elem, className) { - var classes = elem.className.split(' '); - var index = classes.indexOf(className); - if (index != -1) { - classes.splice(index, 1); // remove the class from the array - elem.className = classes.join(' '); + return array; } -}; -/** - * For each method for both arrays and objects. - * In case of an array, the built-in Array.forEach() is applied. - * In case of an Object, the method loops over all properties of the object. - * @param {Object | Array} object An Object or Array - * @param {function} callback Callback method, called for each item in - * the object or array with three parameters: - * callback(value, index, object) - */ -util.forEach = function(object, callback) { - var i, - len; - if (object instanceof Array) { - // array - for (i = 0, len = object.length; i < len; i++) { - callback(object[i], i, object); + /** + * Update a property in an object + * @param {Object} object + * @param {String} key + * @param {*} value + * @return {Boolean} changed + */ + exports.updateProperty = function(object, key, value) { + if (object[key] !== value) { + object[key] = value; + return true; } - } - else { - // object - for (i in object) { - if (object.hasOwnProperty(i)) { - callback(object[i], i, object); - } + else { + return false; } - } -}; + }; -/** - * Convert an object into an array: all objects properties are put into the - * array. The resulting array is unordered. - * @param {Object} object - * @param {Array} array - */ -util.toArray = function(object) { - var array = []; + /** + * Add and event listener. Works for all browsers + * @param {Element} element An html element + * @param {string} action The action, for example "click", + * without the prefix "on" + * @param {function} listener The callback function to be executed + * @param {boolean} [useCapture] + */ + exports.addEventListener = function(element, action, listener, useCapture) { + if (element.addEventListener) { + if (useCapture === undefined) + useCapture = false; - for (var prop in object) { - if (object.hasOwnProperty(prop)) array.push(object[prop]); - } + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox + } - return array; -} + element.addEventListener(action, listener, useCapture); + } else { + element.attachEvent("on" + action, listener); // IE browsers + } + }; -/** - * Update a property in an object - * @param {Object} object - * @param {String} key - * @param {*} value - * @return {Boolean} changed - */ -util.updateProperty = function(object, key, value) { - if (object[key] !== value) { - object[key] = value; - return true; - } - else { - return false; - } -}; + /** + * Remove an event listener from an element + * @param {Element} element An html dom element + * @param {string} action The name of the event, for example "mousedown" + * @param {function} listener The listener function + * @param {boolean} [useCapture] + */ + exports.removeEventListener = function(element, action, listener, useCapture) { + if (element.removeEventListener) { + // non-IE browsers + if (useCapture === undefined) + useCapture = false; -/** - * Add and event listener. Works for all browsers - * @param {Element} element An html element - * @param {string} action The action, for example "click", - * without the prefix "on" - * @param {function} listener The callback function to be executed - * @param {boolean} [useCapture] - */ -util.addEventListener = function(element, action, listener, useCapture) { - if (element.addEventListener) { - if (useCapture === undefined) - useCapture = false; + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox + } - if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { - action = "DOMMouseScroll"; // For Firefox + element.removeEventListener(action, listener, useCapture); + } else { + // IE browsers + element.detachEvent("on" + action, listener); } + }; - element.addEventListener(action, listener, useCapture); - } else { - element.attachEvent("on" + action, listener); // IE browsers - } -}; - -/** - * Remove an event listener from an element - * @param {Element} element An html dom element - * @param {string} action The name of the event, for example "mousedown" - * @param {function} listener The listener function - * @param {boolean} [useCapture] - */ -util.removeEventListener = function(element, action, listener, useCapture) { - if (element.removeEventListener) { - // non-IE browsers - if (useCapture === undefined) - useCapture = false; + /** + * Cancels the event if it is cancelable, without stopping further propagation of the event. + */ + exports.preventDefault = function (event) { + if (!event) + event = window.event; - if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { - action = "DOMMouseScroll"; // For Firefox + if (event.preventDefault) { + event.preventDefault(); // non-IE browsers } + else { + event.returnValue = false; // IE browsers + } + }; - element.removeEventListener(action, listener, useCapture); - } else { - // IE browsers - element.detachEvent("on" + action, listener); - } -}; - + /** + * Get HTML element which is the target of the event + * @param {Event} event + * @return {Element} target element + */ + exports.getTarget = function(event) { + // code from http://www.quirksmode.org/js/events_properties.html + if (!event) { + event = window.event; + } -/** - * Get HTML element which is the target of the event - * @param {Event} event - * @return {Element} target element - */ -util.getTarget = function(event) { - // code from http://www.quirksmode.org/js/events_properties.html - if (!event) { - event = window.event; - } + var target; - var target; + if (event.target) { + target = event.target; + } + else if (event.srcElement) { + target = event.srcElement; + } - if (event.target) { - target = event.target; - } - else if (event.srcElement) { - target = event.srcElement; - } + if (target.nodeType != undefined && target.nodeType == 3) { + // defeat Safari bug + target = target.parentNode; + } - if (target.nodeType != undefined && target.nodeType == 3) { - // defeat Safari bug - target = target.parentNode; - } + return target; + }; - return target; -}; + exports.option = {}; -/** - * Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent - * @param {Element} element - * @param {Event} event - */ -util.fakeGesture = function(element, event) { - var eventType = null; + /** + * Convert a value into a boolean + * @param {Boolean | function | undefined} value + * @param {Boolean} [defaultValue] + * @returns {Boolean} bool + */ + exports.option.asBoolean = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - // for hammer.js 1.0.5 - var gesture = Hammer.event.collectEventData(this, eventType, event); + if (value != null) { + return (value != false); + } - // for hammer.js 1.0.6 - //var touches = Hammer.event.getTouchList(event, eventType); - // var gesture = Hammer.event.collectEventData(this, eventType, touches, event); + return defaultValue || null; + }; - // on IE in standards mode, no touches are recognized by hammer.js, - // resulting in NaN values for center.pageX and center.pageY - if (isNaN(gesture.center.pageX)) { - gesture.center.pageX = event.pageX; - } - if (isNaN(gesture.center.pageY)) { - gesture.center.pageY = event.pageY; - } + /** + * Convert a value into a number + * @param {Boolean | function | undefined} value + * @param {Number} [defaultValue] + * @returns {Number} number + */ + exports.option.asNumber = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - return gesture; -}; + if (value != null) { + return Number(value) || defaultValue || null; + } -util.option = {}; + return defaultValue || null; + }; -/** - * Convert a value into a boolean - * @param {Boolean | function | undefined} value - * @param {Boolean} [defaultValue] - * @returns {Boolean} bool - */ -util.option.asBoolean = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + /** + * Convert a value into a string + * @param {String | function | undefined} value + * @param {String} [defaultValue] + * @returns {String} str + */ + exports.option.asString = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - if (value != null) { - return (value != false); - } + if (value != null) { + return String(value); + } - return defaultValue || null; -}; + return defaultValue || null; + }; -/** - * Convert a value into a number - * @param {Boolean | function | undefined} value - * @param {Number} [defaultValue] - * @returns {Number} number - */ -util.option.asNumber = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + /** + * Convert a size or location into a string with pixels or a percentage + * @param {String | Number | function | undefined} value + * @param {String} [defaultValue] + * @returns {String} size + */ + exports.option.asSize = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - if (value != null) { - return Number(value) || defaultValue || null; - } + if (exports.isString(value)) { + return value; + } + else if (exports.isNumber(value)) { + return value + 'px'; + } + else { + return defaultValue || null; + } + }; - return defaultValue || null; -}; + /** + * Convert a value into a DOM element + * @param {HTMLElement | function | undefined} value + * @param {HTMLElement} [defaultValue] + * @returns {HTMLElement | null} dom + */ + exports.option.asElement = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } -/** - * Convert a value into a string - * @param {String | function | undefined} value - * @param {String} [defaultValue] - * @returns {String} str - */ -util.option.asString = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + return value || defaultValue || null; + }; - if (value != null) { - return String(value); - } - return defaultValue || null; -}; -/** - * Convert a size or location into a string with pixels or a percentage - * @param {String | Number | function | undefined} value - * @param {String} [defaultValue] - * @returns {String} size - */ -util.option.asSize = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + exports.GiveDec = function(Hex) { + var Value; - if (util.isString(value)) { - return value; - } - else if (util.isNumber(value)) { - return value + 'px'; - } - else { - return defaultValue || null; - } -}; + if (Hex == "A") + Value = 10; + else if (Hex == "B") + Value = 11; + else if (Hex == "C") + Value = 12; + else if (Hex == "D") + Value = 13; + else if (Hex == "E") + Value = 14; + else if (Hex == "F") + Value = 15; + else + Value = eval(Hex); -/** - * Convert a value into a DOM element - * @param {HTMLElement | function | undefined} value - * @param {HTMLElement} [defaultValue] - * @returns {HTMLElement | null} dom - */ -util.option.asElement = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + return Value; + }; - return value || defaultValue || null; -}; - - - -util.GiveDec = function(Hex) { - var Value; - - if (Hex == "A") - Value = 10; - else if (Hex == "B") - Value = 11; - else if (Hex == "C") - Value = 12; - else if (Hex == "D") - Value = 13; - else if (Hex == "E") - Value = 14; - else if (Hex == "F") - Value = 15; - else - Value = eval(Hex); - - return Value; -}; - -util.GiveHex = function(Dec) { - var Value; - - if(Dec == 10) - Value = "A"; - else if (Dec == 11) - Value = "B"; - else if (Dec == 12) - Value = "C"; - else if (Dec == 13) - Value = "D"; - else if (Dec == 14) - Value = "E"; - else if (Dec == 15) - Value = "F"; - else - Value = "" + Dec; - - return Value; -}; + exports.GiveHex = function(Dec) { + var Value; + + if(Dec == 10) + Value = "A"; + else if (Dec == 11) + Value = "B"; + else if (Dec == 12) + Value = "C"; + else if (Dec == 13) + Value = "D"; + else if (Dec == 14) + Value = "E"; + else if (Dec == 15) + Value = "F"; + else + Value = "" + Dec; + + return Value; + }; -/** - * Parse a color property into an object with border, background, and - * highlight colors - * @param {Object | String} color - * @return {Object} colorObject - */ -util.parseColor = function(color) { - var c; - if (util.isString(color)) { - if (util.isValidHex(color)) { - var hsv = util.hexToHSV(color); - var lighterColorHSV = {h:hsv.h,s:hsv.s * 0.45,v:Math.min(1,hsv.v * 1.05)}; - var darkerColorHSV = {h:hsv.h,s:Math.min(1,hsv.v * 1.25),v:hsv.v*0.6}; - var darkerColorHex = util.HSVToHex(darkerColorHSV.h ,darkerColorHSV.h ,darkerColorHSV.v); - var lighterColorHex = util.HSVToHex(lighterColorHSV.h,lighterColorHSV.s,lighterColorHSV.v); - - c = { - background: color, - border:darkerColorHex, - highlight: { - background:lighterColorHex, - border:darkerColorHex - }, - hover: { - background:lighterColorHex, - border:darkerColorHex - } - }; - } - else { - c = { - background:color, - border:color, - highlight: { - background:color, - border:color - }, - hover: { + /** + * Parse a color property into an object with border, background, and + * highlight colors + * @param {Object | String} color + * @return {Object} colorObject + */ + exports.parseColor = function(color) { + var c; + if (exports.isString(color)) { + if (exports.isValidRGB(color)) { + var rgb = color.substr(4).substr(0,color.length-5).split(','); + color = exports.RGBToHex(rgb[0],rgb[1],rgb[2]); + } + if (exports.isValidHex(color)) { + var hsv = exports.hexToHSV(color); + var lighterColorHSV = {h:hsv.h,s:hsv.s * 0.45,v:Math.min(1,hsv.v * 1.05)}; + var darkerColorHSV = {h:hsv.h,s:Math.min(1,hsv.v * 1.25),v:hsv.v*0.6}; + var darkerColorHex = exports.HSVToHex(darkerColorHSV.h ,darkerColorHSV.h ,darkerColorHSV.v); + var lighterColorHex = exports.HSVToHex(lighterColorHSV.h,lighterColorHSV.s,lighterColorHSV.v); + + c = { + background: color, + border:darkerColorHex, + highlight: { + background:lighterColorHex, + border:darkerColorHex + }, + hover: { + background:lighterColorHex, + border:darkerColorHex + } + }; + } + else { + c = { background:color, - border:color - } - }; - } - } - else { - c = {}; - c.background = color.background || 'white'; - c.border = color.border || c.background; - - if (util.isString(color.highlight)) { - c.highlight = { - border: color.highlight, - background: color.highlight + border:color, + highlight: { + background:color, + border:color + }, + hover: { + background:color, + border:color + } + }; } } else { - c.highlight = {}; - c.highlight.background = color.highlight && color.highlight.background || c.background; - c.highlight.border = color.highlight && color.highlight.border || c.border; - } + c = {}; + c.background = color.background || 'white'; + c.border = color.border || c.background; - if (util.isString(color.hover)) { - c.hover = { - border: color.hover, - background: color.hover + if (exports.isString(color.highlight)) { + c.highlight = { + border: color.highlight, + background: color.highlight + } + } + else { + c.highlight = {}; + c.highlight.background = color.highlight && color.highlight.background || c.background; + c.highlight.border = color.highlight && color.highlight.border || c.border; + } + + if (exports.isString(color.hover)) { + c.hover = { + border: color.hover, + background: color.hover + } + } + else { + c.hover = {}; + c.hover.background = color.hover && color.hover.background || c.background; + c.hover.border = color.hover && color.hover.border || c.border; } } - else { - c.hover = {}; - c.hover.background = color.hover && color.hover.background || c.background; - c.hover.border = color.hover && color.hover.border || c.border; - } - } - return c; -}; + return c; + }; -/** - * http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php - * - * @param {String} hex - * @returns {{r: *, g: *, b: *}} - */ -util.hexToRGB = function(hex) { - hex = hex.replace("#","").toUpperCase(); + /** + * http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php + * + * @param {String} hex + * @returns {{r: *, g: *, b: *}} + */ + exports.hexToRGB = function(hex) { + hex = hex.replace("#","").toUpperCase(); - var a = util.GiveDec(hex.substring(0, 1)); - var b = util.GiveDec(hex.substring(1, 2)); - var c = util.GiveDec(hex.substring(2, 3)); - var d = util.GiveDec(hex.substring(3, 4)); - var e = util.GiveDec(hex.substring(4, 5)); - var f = util.GiveDec(hex.substring(5, 6)); + var a = exports.GiveDec(hex.substring(0, 1)); + var b = exports.GiveDec(hex.substring(1, 2)); + var c = exports.GiveDec(hex.substring(2, 3)); + var d = exports.GiveDec(hex.substring(3, 4)); + var e = exports.GiveDec(hex.substring(4, 5)); + var f = exports.GiveDec(hex.substring(5, 6)); - var r = (a * 16) + b; - var g = (c * 16) + d; - var b = (e * 16) + f; + var r = (a * 16) + b; + var g = (c * 16) + d; + var b = (e * 16) + f; - return {r:r,g:g,b:b}; -}; + return {r:r,g:g,b:b}; + }; -util.RGBToHex = function(red,green,blue) { - var a = util.GiveHex(Math.floor(red / 16)); - var b = util.GiveHex(red % 16); - var c = util.GiveHex(Math.floor(green / 16)); - var d = util.GiveHex(green % 16); - var e = util.GiveHex(Math.floor(blue / 16)); - var f = util.GiveHex(blue % 16); + exports.RGBToHex = function(red,green,blue) { + var a = exports.GiveHex(Math.floor(red / 16)); + var b = exports.GiveHex(red % 16); + var c = exports.GiveHex(Math.floor(green / 16)); + var d = exports.GiveHex(green % 16); + var e = exports.GiveHex(Math.floor(blue / 16)); + var f = exports.GiveHex(blue % 16); - var hex = a + b + c + d + e + f; - return "#" + hex; -}; + var hex = a + b + c + d + e + f; + return "#" + hex; + }; -/** - * http://www.javascripter.net/faq/rgb2hsv.htm - * - * @param red - * @param green - * @param blue - * @returns {*} - * @constructor - */ -util.RGBToHSV = function(red,green,blue) { - red=red/255; green=green/255; blue=blue/255; - var minRGB = Math.min(red,Math.min(green,blue)); - var maxRGB = Math.max(red,Math.max(green,blue)); - - // Black-gray-white - if (minRGB == maxRGB) { - return {h:0,s:0,v:minRGB}; - } + /** + * http://www.javascripter.net/faq/rgb2hsv.htm + * + * @param red + * @param green + * @param blue + * @returns {*} + * @constructor + */ + exports.RGBToHSV = function(red,green,blue) { + red=red/255; green=green/255; blue=blue/255; + var minRGB = Math.min(red,Math.min(green,blue)); + var maxRGB = Math.max(red,Math.max(green,blue)); + + // Black-gray-white + if (minRGB == maxRGB) { + return {h:0,s:0,v:minRGB}; + } + + // Colors other than black-gray-white: + var d = (red==minRGB) ? green-blue : ((blue==minRGB) ? red-green : blue-red); + var h = (red==minRGB) ? 3 : ((blue==minRGB) ? 1 : 5); + var hue = 60*(h - d/(maxRGB - minRGB))/360; + var saturation = (maxRGB - minRGB)/maxRGB; + var value = maxRGB; + return {h:hue,s:saturation,v:value}; + }; - // Colors other than black-gray-white: - var d = (red==minRGB) ? green-blue : ((blue==minRGB) ? red-green : blue-red); - var h = (red==minRGB) ? 3 : ((blue==minRGB) ? 1 : 5); - var hue = 60*(h - d/(maxRGB - minRGB))/360; - var saturation = (maxRGB - minRGB)/maxRGB; - var value = maxRGB; - return {h:hue,s:saturation,v:value}; -}; + /** + * https://gist.github.com/mjijackson/5311256 + * @param h + * @param s + * @param v + * @returns {{r: number, g: number, b: number}} + * @constructor + */ + exports.HSVToRGB = function(h, s, v) { + var r, g, b; -/** - * https://gist.github.com/mjijackson/5311256 - * @param hue - * @param saturation - * @param value - * @returns {{r: number, g: number, b: number}} - * @constructor - */ -util.HSVToRGB = function(h, s, v) { - var r, g, b; - - var i = Math.floor(h * 6); - var f = h * 6 - i; - var p = v * (1 - s); - var q = v * (1 - f * s); - var t = v * (1 - (1 - f) * s); - - switch (i % 6) { - case 0: r = v, g = t, b = p; break; - case 1: r = q, g = v, b = p; break; - case 2: r = p, g = v, b = t; break; - case 3: r = p, g = q, b = v; break; - case 4: r = t, g = p, b = v; break; - case 5: r = v, g = p, b = q; break; - } + var i = Math.floor(h * 6); + var f = h * 6 - i; + var p = v * (1 - s); + var q = v * (1 - f * s); + var t = v * (1 - (1 - f) * s); - return {r:Math.floor(r * 255), g:Math.floor(g * 255), b:Math.floor(b * 255) }; -}; + switch (i % 6) { + case 0: r = v, g = t, b = p; break; + case 1: r = q, g = v, b = p; break; + case 2: r = p, g = v, b = t; break; + case 3: r = p, g = q, b = v; break; + case 4: r = t, g = p, b = v; break; + case 5: r = v, g = p, b = q; break; + } -util.HSVToHex = function(h, s, v) { - var rgb = util.HSVToRGB(h, s, v); - return util.RGBToHex(rgb.r, rgb.g, rgb.b); -}; + return {r:Math.floor(r * 255), g:Math.floor(g * 255), b:Math.floor(b * 255) }; + }; -util.hexToHSV = function(hex) { - var rgb = util.hexToRGB(hex); - return util.RGBToHSV(rgb.r, rgb.g, rgb.b); -}; + exports.HSVToHex = function(h, s, v) { + var rgb = exports.HSVToRGB(h, s, v); + return exports.RGBToHex(rgb.r, rgb.g, rgb.b); + }; -util.isValidHex = function(hex) { - var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); - return isOk; -}; + exports.hexToHSV = function(hex) { + var rgb = exports.hexToRGB(hex); + return exports.RGBToHSV(rgb.r, rgb.g, rgb.b); + }; + exports.isValidHex = function(hex) { + var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); + return isOk; + }; -/** - * This recursively redirects the prototype of JSON objects to the referenceObject - * This is used for default options. - * - * @param referenceObject - * @returns {*} - */ -util.selectiveBridgeObject = function(fields, referenceObject) { - if (typeof referenceObject == "object") { - var objectTo = Object.create(referenceObject); - for (var i = 0; i < fields.length; i++) { - if (referenceObject.hasOwnProperty(fields[i])) { - if (typeof referenceObject[fields[i]] == "object") { - objectTo[fields[i]] = util.bridgeObject(referenceObject[fields[i]]); - } - } - } - return objectTo; + exports.isValidRGB = function(rgb) { + rgb = rgb.replace(" ",""); + var isOk = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(rgb); + return isOk; } - else { - return null; - } -}; -/** - * This recursively redirects the prototype of JSON objects to the referenceObject - * This is used for default options. - * - * @param referenceObject - * @returns {*} - */ -util.bridgeObject = function(referenceObject) { - if (typeof referenceObject == "object") { - var objectTo = Object.create(referenceObject); - for (var i in referenceObject) { - if (referenceObject.hasOwnProperty(i)) { - if (typeof referenceObject[i] == "object") { - objectTo[i] = util.bridgeObject(referenceObject[i]); + /** + * This recursively redirects the prototype of JSON objects to the referenceObject + * This is used for default options. + * + * @param referenceObject + * @returns {*} + */ + exports.selectiveBridgeObject = function(fields, referenceObject) { + if (typeof referenceObject == "object") { + var objectTo = Object.create(referenceObject); + for (var i = 0; i < fields.length; i++) { + if (referenceObject.hasOwnProperty(fields[i])) { + if (typeof referenceObject[fields[i]] == "object") { + objectTo[fields[i]] = exports.bridgeObject(referenceObject[fields[i]]); + } } } + return objectTo; } - return objectTo; - } - else { - return null; - } -}; - - -/** - * this is used to set the options of subobjects in the options object. A requirement of these subobjects - * is that they have an 'enabled' element which is optional for the user but mandatory for the program. - * - * @param [object] mergeTarget | this is either this.options or the options used for the groups. - * @param [object] options | options - * @param [String] option | this is the option key in the options argument - * @private - */ -util.mergeOptions = function (mergeTarget, options, option) { - if (options[option] !== undefined) { - if (typeof options[option] == 'boolean') { - mergeTarget[option].enabled = options[option]; + else { + return null; + } + }; + + /** + * This recursively redirects the prototype of JSON objects to the referenceObject + * This is used for default options. + * + * @param referenceObject + * @returns {*} + */ + exports.bridgeObject = function(referenceObject) { + if (typeof referenceObject == "object") { + var objectTo = Object.create(referenceObject); + for (var i in referenceObject) { + if (referenceObject.hasOwnProperty(i)) { + if (typeof referenceObject[i] == "object") { + objectTo[i] = exports.bridgeObject(referenceObject[i]); + } + } + } + return objectTo; } else { - mergeTarget[option].enabled = true; - for (prop in options[option]) { - if (options[option].hasOwnProperty(prop)) { - mergeTarget[option][prop] = options[option][prop]; + return null; + } + }; + + + /** + * this is used to set the options of subobjects in the options object. A requirement of these subobjects + * is that they have an 'enabled' element which is optional for the user but mandatory for the program. + * + * @param [object] mergeTarget | this is either this.options or the options used for the groups. + * @param [object] options | options + * @param [String] option | this is the option key in the options argument + * @private + */ + exports.mergeOptions = function (mergeTarget, options, option) { + if (options[option] !== undefined) { + if (typeof options[option] == 'boolean') { + mergeTarget[option].enabled = options[option]; + } + else { + mergeTarget[option].enabled = true; + for (prop in options[option]) { + if (options[option].hasOwnProperty(prop)) { + mergeTarget[option][prop] = options[option][prop]; + } } } } } -} -/** - * this is used to set the options of subobjects in the options object. A requirement of these subobjects - * is that they have an 'enabled' element which is optional for the user but mandatory for the program. - * - * @param [object] mergeTarget | this is either this.options or the options used for the groups. - * @param [object] options | options - * @param [String] option | this is the option key in the options argument - * @private - */ -util.mergeOptions = function (mergeTarget, options, option) { - if (options[option] !== undefined) { - if (typeof options[option] == 'boolean') { - mergeTarget[option].enabled = options[option]; - } - else { - mergeTarget[option].enabled = true; - for (prop in options[option]) { - if (options[option].hasOwnProperty(prop)) { - mergeTarget[option][prop] = options[option][prop]; + /** + * this is used to set the options of subobjects in the options object. A requirement of these subobjects + * is that they have an 'enabled' element which is optional for the user but mandatory for the program. + * + * @param [object] mergeTarget | this is either this.options or the options used for the groups. + * @param [object] options | options + * @param [String] option | this is the option key in the options argument + * @private + */ + exports.mergeOptions = function (mergeTarget, options, option) { + if (options[option] !== undefined) { + if (typeof options[option] == 'boolean') { + mergeTarget[option].enabled = options[option]; + } + else { + mergeTarget[option].enabled = true; + for (prop in options[option]) { + if (options[option].hasOwnProperty(prop)) { + mergeTarget[option][prop] = options[option][prop]; + } } } } } -} -/** - * This function does a binary search for a visible item. The user can select either the this.orderedItems.byStart or .byEnd - * arrays. This is done by giving a boolean value true if you want to use the byEnd. - * This is done to be able to select the correct if statement (we do not want to check if an item is visible, we want to check - * if the time we selected (start or end) is within the current range). - * - * The trick is that every interval has to either enter the screen at the initial load or by dragging. The case of the ItemRange that is - * before and after the current range is handled by simply checking if it was in view before and if it is again. For all the rest, - * either the start OR end time has to be in the range. - * - * @param {{byStart: Item[], byEnd: Item[]}} orderedItems - * @param {{start: number, end: number}} range - * @param {Boolean} byEnd - * @returns {number} - * @private - */ -util.binarySearch = function(orderedItems, range, field, field2) { - var array = orderedItems; - var interval = range.end - range.start; - - var found = false; - var low = 0; - var high = array.length; - var guess = Math.floor(0.5*(high+low)); - var newGuess; - var value; - - if (high == 0) {guess = -1;} - else if (high == 1) { - value = field2 === undefined ? array[guess][field] : array[guess][field][field2]; - if ((value > range.start - interval) && (value < range.end)) { - guess = 0; - } - else { + /** + * This function does a binary search for a visible item. The user can select either the this.orderedItems.byStart or .byEnd + * arrays. This is done by giving a boolean value true if you want to use the byEnd. + * This is done to be able to select the correct if statement (we do not want to check if an item is visible, we want to check + * if the time we selected (start or end) is within the current range). + * + * The trick is that every interval has to either enter the screen at the initial load or by dragging. The case of the ItemRange that is + * before and after the current range is handled by simply checking if it was in view before and if it is again. For all the rest, + * either the start OR end time has to be in the range. + * + * @param {Item[]} orderedItems Items ordered by start + * @param {{start: number, end: number}} range + * @param {String} field + * @param {String} field2 + * @returns {number} + * @private + */ + exports.binarySearch = function(orderedItems, range, field, field2) { + var array = orderedItems; + + var maxIterations = 10000; + var iteration = 0; + var found = false; + var low = 0; + var high = array.length; + var newLow = low; + var newHigh = high; + var guess = Math.floor(0.5*(high+low)); + var value; + + if (high == 0) { guess = -1; } - } - else { - high -= 1; - while (found == false) { - value = field2 === undefined ? array[guess][field] : array[guess][field][field2]; - if ((value > range.start - interval) && (value < range.end)) { - found = true; + else if (high == 1) { + if (array[guess].isVisible(range)) { + guess = 0; } else { - if (value < range.start - interval) { // it is too small --> increase low - low = Math.floor(0.5*(high+low)); - } - else { // it is too big --> decrease high - high = Math.floor(0.5*(high+low)); - } - newGuess = Math.floor(0.5*(high+low)); - // not in list; - if (guess == newGuess) { - guess = -1; + guess = -1; + } + } + else { + high -= 1; + + while (found == false && iteration < maxIterations) { + value = field2 === undefined ? array[guess][field] : array[guess][field][field2]; + + if (array[guess].isVisible(range)) { found = true; } else { - guess = newGuess; + if (value < range.start) { // it is too small --> increase low + newLow = Math.floor(0.5*(high+low)); + } + else { // it is too big --> decrease high + newHigh = Math.floor(0.5*(high+low)); + } + // not in list; + if (low == newLow && high == newHigh) { + guess = -1; + found = true; + } + else { + high = newHigh; low = newLow; + guess = Math.floor(0.5*(high+low)); + } } + iteration++; + } + if (iteration >= maxIterations) { + console.log("BinarySearch too many iterations. Aborting."); } } - } - return guess; -}; + return guess; + }; -/** - * This function does a binary search for a visible item. The user can select either the this.orderedItems.byStart or .byEnd - * arrays. This is done by giving a boolean value true if you want to use the byEnd. - * This is done to be able to select the correct if statement (we do not want to check if an item is visible, we want to check - * if the time we selected (start or end) is within the current range). - * - * The trick is that every interval has to either enter the screen at the initial load or by dragging. The case of the ItemRange that is - * before and after the current range is handled by simply checking if it was in view before and if it is again. For all the rest, - * either the start OR end time has to be in the range. - * - * @param {Array} orderedItems - * @param {{start: number, end: number}} target - * @param {Boolean} byEnd - * @returns {number} - * @private - */ -util.binarySearchGeneric = function(orderedItems, target, field, sidePreference) { - var array = orderedItems; - var found = false; - var low = 0; - var high = array.length; - var guess = Math.floor(0.5*(high+low)); - var newGuess; - var prevValue, value, nextValue; - - if (high == 0) {guess = -1;} - else if (high == 1) { - value = array[guess][field]; - if (value == target) { - guess = 0; + /** + * This function does a binary search for a visible item. The user can select either the this.orderedItems.byStart or .byEnd + * arrays. This is done by giving a boolean value true if you want to use the byEnd. + * This is done to be able to select the correct if statement (we do not want to check if an item is visible, we want to check + * if the time we selected (start or end) is within the current range). + * + * The trick is that every interval has to either enter the screen at the initial load or by dragging. The case of the ItemRange that is + * before and after the current range is handled by simply checking if it was in view before and if it is again. For all the rest, + * either the start OR end time has to be in the range. + * + * @param {Array} orderedItems + * @param {{start: number, end: number}} target + * @param {String} field + * @param {String} sidePreference 'before' or 'after' + * @returns {number} + * @private + */ + exports.binarySearchGeneric = function(orderedItems, target, field, sidePreference) { + var maxIterations = 10000; + var iteration = 0; + var array = orderedItems; + var found = false; + var low = 0; + var high = array.length; + var newLow = low; + var newHigh = high; + var guess = Math.floor(0.5*(high+low)); + var newGuess; + var prevValue, value, nextValue; + + if (high == 0) {guess = -1;} + else if (high == 1) { + value = array[guess][field]; + if (value == target) { + guess = 0; + } + else { + guess = -1; + } } else { - guess = -1; - } - } - else { - high -= 1; - while (found == false) { - prevValue = array[Math.max(0,guess - 1)][field]; - value = array[guess][field]; - nextValue = array[Math.min(array.length-1,guess + 1)][field]; - - if (value == target || prevValue < target && value > target || value < target && nextValue > target) { - found = true; - if (value != target) { - if (sidePreference == 'before') { - if (prevValue < target && value > target) { - guess = Math.max(0,guess - 1); + high -= 1; + while (found == false && iteration < maxIterations) { + prevValue = array[Math.max(0,guess - 1)][field]; + value = array[guess][field]; + nextValue = array[Math.min(array.length-1,guess + 1)][field]; + + if (value == target || prevValue < target && value > target || value < target && nextValue > target) { + found = true; + if (value != target) { + if (sidePreference == 'before') { + if (prevValue < target && value > target) { + guess = Math.max(0,guess - 1); + } } - } - else { - if (value < target && nextValue > target) { - guess = Math.min(array.length-1,guess + 1); + else { + if (value < target && nextValue > target) { + guess = Math.min(array.length-1,guess + 1); + } } } } - } - else { - if (value < target) { // it is too small --> increase low - low = Math.floor(0.5*(high+low)); - } - else { // it is too big --> decrease high - high = Math.floor(0.5*(high+low)); - } - newGuess = Math.floor(0.5*(high+low)); - // not in list; - if (guess == newGuess) { - guess = -2; - found = true; - } else { - guess = newGuess; + if (value < target) { // it is too small --> increase low + newLow = Math.floor(0.5*(high+low)); + } + else { // it is too big --> decrease high + newHigh = Math.floor(0.5*(high+low)); + } + newGuess = Math.floor(0.5*(high+low)); + // not in list; + if (low == newLow && high == newHigh) { + guess = -1; + found = true; + } + else { + high = newHigh; low = newLow; + guess = Math.floor(0.5*(high+low)); + } } + iteration++; + } + if (iteration >= maxIterations) { + console.log("BinarySearch too many iterations. Aborting."); } } - } - return guess; -}; -/** - * Created by Alex on 6/20/14. - */ + return guess; + }; -var DOMutil = {}; +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { -/** - * this prepares the JSON container for allocating SVG elements - * @param JSONcontainer - * @private - */ -DOMutil.prepareElements = function(JSONcontainer) { - // cleanup the redundant svgElements; - for (var elementType in JSONcontainer) { - if (JSONcontainer.hasOwnProperty(elementType)) { - JSONcontainer[elementType].redundant = JSONcontainer[elementType].used; - JSONcontainer[elementType].used = []; + // DOM utility methods + + /** + * this prepares the JSON container for allocating SVG elements + * @param JSONcontainer + * @private + */ + exports.prepareElements = function(JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + JSONcontainer[elementType].redundant = JSONcontainer[elementType].used; + JSONcontainer[elementType].used = []; + } } - } -}; + }; -/** - * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from - * which to remove the redundant elements. - * - * @param JSONcontainer - * @private - */ -DOMutil.cleanupElements = function(JSONcontainer) { - // cleanup the redundant svgElements; - for (var elementType in JSONcontainer) { - if (JSONcontainer.hasOwnProperty(elementType)) { - if (JSONcontainer[elementType].redundant) { - for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) { - JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]); + /** + * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from + * which to remove the redundant elements. + * + * @param JSONcontainer + * @private + */ + exports.cleanupElements = function(JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + if (JSONcontainer[elementType].redundant) { + for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) { + JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]); + } + JSONcontainer[elementType].redundant = []; } - JSONcontainer[elementType].redundant = []; } } - } -}; + }; -/** - * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer - * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. - * - * @param elementType - * @param JSONcontainer - * @param svgContainer - * @returns {*} - * @private - */ -DOMutil.getSVGElement = function (elementType, JSONcontainer, svgContainer) { - var element; - // allocate SVG element, if it doesnt yet exist, create one. - if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before - // check if there is an redundant element - if (JSONcontainer[elementType].redundant.length > 0) { - element = JSONcontainer[elementType].redundant[0]; - JSONcontainer[elementType].redundant.shift(); + /** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param elementType + * @param JSONcontainer + * @param svgContainer + * @returns {*} + * @private + */ + exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) { + var element; + // allocate SVG element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } + else { + // create a new element and add it to the SVG + element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + svgContainer.appendChild(element); + } } else { - // create a new element and add it to the SVG + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + JSONcontainer[elementType] = {used: [], redundant: []}; svgContainer.appendChild(element); } - } - else { - // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. - element = document.createElementNS('http://www.w3.org/2000/svg', elementType); - JSONcontainer[elementType] = {used: [], redundant: []}; - svgContainer.appendChild(element); - } - JSONcontainer[elementType].used.push(element); - return element; -}; + JSONcontainer[elementType].used.push(element); + return element; + }; -/** - * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer - * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. - * - * @param elementType - * @param JSONcontainer - * @param DOMContainer - * @returns {*} - * @private - */ -DOMutil.getDOMElement = function (elementType, JSONcontainer, DOMContainer) { - var element; - // allocate SVG element, if it doesnt yet exist, create one. - if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before - // check if there is an redundant element - if (JSONcontainer[elementType].redundant.length > 0) { - element = JSONcontainer[elementType].redundant[0]; - JSONcontainer[elementType].redundant.shift(); + /** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param elementType + * @param JSONcontainer + * @param DOMContainer + * @returns {*} + * @private + */ + exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer) { + var element; + // allocate SVG element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } + else { + // create a new element and add it to the SVG + element = document.createElement(elementType); + DOMContainer.appendChild(element); + } } else { - // create a new element and add it to the SVG + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. element = document.createElement(elementType); + JSONcontainer[elementType] = {used: [], redundant: []}; DOMContainer.appendChild(element); } - } - else { - // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. - element = document.createElement(elementType); - JSONcontainer[elementType] = {used: [], redundant: []}; - DOMContainer.appendChild(element); - } - JSONcontainer[elementType].used.push(element); - return element; -}; + JSONcontainer[elementType].used.push(element); + return element; + }; -/** - * draw a point object. this is a seperate function because it can also be called by the legend. - * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions - * as well. - * - * @param x - * @param y - * @param group - * @param JSONcontainer - * @param svgContainer - * @returns {*} - */ -DOMutil.drawPoint = function(x, y, group, JSONcontainer, svgContainer) { - var point; - if (group.options.drawPoints.style == 'circle') { - point = DOMutil.getSVGElement('circle',JSONcontainer,svgContainer); - point.setAttributeNS(null, "cx", x); - point.setAttributeNS(null, "cy", y); - point.setAttributeNS(null, "r", 0.5 * group.options.drawPoints.size); - point.setAttributeNS(null, "class", group.className + " point"); - } - else { - point = DOMutil.getSVGElement('rect',JSONcontainer,svgContainer); - point.setAttributeNS(null, "x", x - 0.5*group.options.drawPoints.size); - point.setAttributeNS(null, "y", y - 0.5*group.options.drawPoints.size); - point.setAttributeNS(null, "width", group.options.drawPoints.size); - point.setAttributeNS(null, "height", group.options.drawPoints.size); - point.setAttributeNS(null, "class", group.className + " point"); - } - return point; -}; + /** + * draw a point object. this is a seperate function because it can also be called by the legend. + * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions + * as well. + * + * @param x + * @param y + * @param group + * @param JSONcontainer + * @param svgContainer + * @returns {*} + */ + exports.drawPoint = function(x, y, group, JSONcontainer, svgContainer) { + var point; + if (group.options.drawPoints.style == 'circle') { + point = exports.getSVGElement('circle',JSONcontainer,svgContainer); + point.setAttributeNS(null, "cx", x); + point.setAttributeNS(null, "cy", y); + point.setAttributeNS(null, "r", 0.5 * group.options.drawPoints.size); + point.setAttributeNS(null, "class", group.className + " point"); + } + else { + point = exports.getSVGElement('rect',JSONcontainer,svgContainer); + point.setAttributeNS(null, "x", x - 0.5*group.options.drawPoints.size); + point.setAttributeNS(null, "y", y - 0.5*group.options.drawPoints.size); + point.setAttributeNS(null, "width", group.options.drawPoints.size); + point.setAttributeNS(null, "height", group.options.drawPoints.size); + point.setAttributeNS(null, "class", group.className + " point"); + } + return point; + }; -/** - * draw a bar SVG element centered on the X coordinate - * - * @param x - * @param y - * @param className - */ -DOMutil.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer) { - var rect = DOMutil.getSVGElement('rect',JSONcontainer, svgContainer); - rect.setAttributeNS(null, "x", x - 0.5 * width); - rect.setAttributeNS(null, "y", y); - rect.setAttributeNS(null, "width", width); - rect.setAttributeNS(null, "height", height); - rect.setAttributeNS(null, "class", className); -}; -/** - * DataSet - * - * Usage: - * var dataSet = new DataSet({ - * fieldId: '_id', - * type: { - * // ... - * } - * }); - * - * dataSet.add(item); - * dataSet.add(data); - * dataSet.update(item); - * dataSet.update(data); - * dataSet.remove(id); - * dataSet.remove(ids); - * var data = dataSet.get(); - * var data = dataSet.get(id); - * var data = dataSet.get(ids); - * var data = dataSet.get(ids, options, data); - * dataSet.clear(); - * - * A data set can: - * - add/remove/update data - * - gives triggers upon changes in the data - * - can import/export data in various data formats - * - * @param {Array | DataTable} [data] Optional array with initial data - * @param {Object} [options] Available options: - * {String} fieldId Field name of the id in the - * items, 'id' by default. - * {Object.} [type] - * {String[]} [fields] field names to be returned - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * {Array | DataTable} [data] If provided, items will be appended to this - * array or table. Required in case of Google - * DataTable. - * - * @throws Error - */ -DataSet.prototype.get = function (args) { - var me = this; - - // parse the arguments - var id, ids, options, data; - var firstType = util.getType(arguments[0]); - if (firstType == 'String' || firstType == 'Number') { - // get(id [, options] [, data]) - id = arguments[0]; - options = arguments[1]; - data = arguments[2]; - } - else if (firstType == 'Array') { - // get(ids [, options] [, data]) - ids = arguments[0]; - options = arguments[1]; - data = arguments[2]; - } - else { - // get([, options] [, data]) - options = arguments[0]; - data = arguments[1]; - } + var addOrUpdate = function (item) { + var id = item[fieldId]; + if (me._data[id]) { + // update item + id = me._updateItem(item); + updatedIds.push(id); + } + else { + // add new item + id = me._addItem(item); + addedIds.push(id); + } + }; - // determine the return type - var returnType; - if (options && options.returnType) { - returnType = (options.returnType == 'DataTable') ? 'DataTable' : 'Array'; + if (Array.isArray(data)) { + // Array + for (var i = 0, len = data.length; i < len; i++) { + addOrUpdate(data[i]); + } + } + else if (util.isDataTable(data)) { + // Google DataTable + var columns = this._getColumnNames(data); + for (var row = 0, rows = data.getNumberOfRows(); row < rows; row++) { + var item = {}; + for (var col = 0, cols = columns.length; col < cols; col++) { + var field = columns[col]; + item[field] = data.getValue(row, col); + } - if (data && (returnType != util.getType(data))) { - throw new Error('Type of parameter "data" (' + util.getType(data) + ') ' + - 'does not correspond with specified options.type (' + options.type + ')'); + addOrUpdate(item); + } } - if (returnType == 'DataTable' && !util.isDataTable(data)) { - throw new Error('Parameter "data" must be a DataTable ' + - 'when options.type is "DataTable"'); + else if (data instanceof Object) { + // Single item + addOrUpdate(data); } - } - else if (data) { - returnType = (util.getType(data) == 'DataTable') ? 'DataTable' : 'Array'; - } - else { - returnType = 'Array'; - } + else { + throw new Error('Unknown dataType'); + } + + if (addedIds.length) { + this._trigger('add', {items: addedIds}, senderId); + } + if (updatedIds.length) { + this._trigger('update', {items: updatedIds}, senderId); + } + + return addedIds.concat(updatedIds); + }; - // build options - var type = options && options.type || this._options.type; - var filter = options && options.filter; - var items = [], item, itemId, i, len; + /** + * Get a data item or multiple items. + * + * Usage: + * + * get() + * get(options: Object) + * get(options: Object, data: Array | DataTable) + * + * get(id: Number | String) + * get(id: Number | String, options: Object) + * get(id: Number | String, options: Object, data: Array | DataTable) + * + * get(ids: Number[] | String[]) + * get(ids: Number[] | String[], options: Object) + * get(ids: Number[] | String[], options: Object, data: Array | DataTable) + * + * Where: + * + * {Number | String} id The id of an item + * {Number[] | String{}} ids An array with ids of items + * {Object} options An Object with options. Available options: + * {String} [returnType] Type of data to be + * returned. Can be 'DataTable' or 'Array' (default) + * {Object.} [type] + * {String[]} [fields] field names to be returned + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * {Array | DataTable} [data] If provided, items will be appended to this + * array or table. Required in case of Google + * DataTable. + * + * @throws Error + */ + DataSet.prototype.get = function (args) { + var me = this; - // convert items - if (id != undefined) { - // return a single item - item = me._getItem(id, type); - if (filter && !filter(item)) { - item = null; + // parse the arguments + var id, ids, options, data; + var firstType = util.getType(arguments[0]); + if (firstType == 'String' || firstType == 'Number') { + // get(id [, options] [, data]) + id = arguments[0]; + options = arguments[1]; + data = arguments[2]; + } + else if (firstType == 'Array') { + // get(ids [, options] [, data]) + ids = arguments[0]; + options = arguments[1]; + data = arguments[2]; } - } - else if (ids != undefined) { - // return a subset of items - for (i = 0, len = ids.length; i < len; i++) { - item = me._getItem(ids[i], type); - if (!filter || filter(item)) { - items.push(item); - } + else { + // get([, options] [, data]) + options = arguments[0]; + data = arguments[1]; } - } - else { - // return all items - for (itemId in this._data) { - if (this._data.hasOwnProperty(itemId)) { - item = me._getItem(itemId, type); - if (!filter || filter(item)) { - items.push(item); - } + + // determine the return type + var returnType; + if (options && options.returnType) { + var allowedValues = ["DataTable", "Array", "Object"]; + returnType = allowedValues.indexOf(options.returnType) == -1 ? "Array" : options.returnType; + + if (data && (returnType != util.getType(data))) { + throw new Error('Type of parameter "data" (' + util.getType(data) + ') ' + + 'does not correspond with specified options.type (' + options.type + ')'); + } + if (returnType == 'DataTable' && !util.isDataTable(data)) { + throw new Error('Parameter "data" must be a DataTable ' + + 'when options.type is "DataTable"'); } } - } + else if (data) { + returnType = (util.getType(data) == 'DataTable') ? 'DataTable' : 'Array'; + } + else { + returnType = 'Array'; + } - // order the results - if (options && options.order && id == undefined) { - this._sort(items, options.order); - } + // build options + var type = options && options.type || this._options.type; + var filter = options && options.filter; + var items = [], item, itemId, i, len; - // filter fields of the items - if (options && options.fields) { - var fields = options.fields; + // convert items if (id != undefined) { - item = this._filterFields(item, fields); + // return a single item + item = me._getItem(id, type); + if (filter && !filter(item)) { + item = null; + } + } + else if (ids != undefined) { + // return a subset of items + for (i = 0, len = ids.length; i < len; i++) { + item = me._getItem(ids[i], type); + if (!filter || filter(item)) { + items.push(item); + } + } } else { - for (i = 0, len = items.length; i < len; i++) { - items[i] = this._filterFields(items[i], fields); + // return all items + for (itemId in this._data) { + if (this._data.hasOwnProperty(itemId)) { + item = me._getItem(itemId, type); + if (!filter || filter(item)) { + items.push(item); + } + } } } - } - // return the results - if (returnType == 'DataTable') { - var columns = this._getColumnNames(data); - if (id != undefined) { - // append a single item to the data table - me._appendRow(data, columns, item); + // order the results + if (options && options.order && id == undefined) { + this._sort(items, options.order); } - else { - // copy the items to the provided data table - for (i = 0, len = items.length; i < len; i++) { - me._appendRow(data, columns, items[i]); + + // filter fields of the items + if (options && options.fields) { + var fields = options.fields; + if (id != undefined) { + item = this._filterFields(item, fields); + } + else { + for (i = 0, len = items.length; i < len; i++) { + items[i] = this._filterFields(items[i], fields); + } } } - return data; - } - else { - // return an array - if (id != undefined) { - // a single item - return item; + + // return the results + if (returnType == 'DataTable') { + var columns = this._getColumnNames(data); + if (id != undefined) { + // append a single item to the data table + me._appendRow(data, columns, item); + } + else { + // copy the items to the provided data table + for (i = 0; i < items.length; i++) { + me._appendRow(data, columns, items[i]); + } + } + return data; + } + else if (returnType == "Object") { + var result = {}; + for (i = 0; i < items.length; i++) { + result[items[i].id] = items[i]; + } + return result; } else { - // multiple items - if (data) { - // copy the items to the provided array - for (i = 0, len = items.length; i < len; i++) { - data.push(items[i]); - } - return data; + // return an array + if (id != undefined) { + // a single item + return item; } else { - // just return our array - return items; + // multiple items + if (data) { + // copy the items to the provided array + for (i = 0, len = items.length; i < len; i++) { + data.push(items[i]); + } + return data; + } + else { + // just return our array + return items; + } } } - } -}; - -/** - * Get ids of all items or from a filtered set of items. - * @param {Object} [options] An Object with options. Available options: - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * @return {Array} ids - */ -DataSet.prototype.getIds = function (options) { - var data = this._data, - filter = options && options.filter, - order = options && options.order, - type = options && options.type || this._options.type, - i, - len, - id, - item, - items, - ids = []; + }; - if (filter) { - // get filtered items - if (order) { - // create ordered list - items = []; - for (id in data) { - if (data.hasOwnProperty(id)) { - item = this._getItem(id, type); - if (filter(item)) { - items.push(item); + /** + * Get ids of all items or from a filtered set of items. + * @param {Object} [options] An Object with options. Available options: + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * @return {Array} ids + */ + DataSet.prototype.getIds = function (options) { + var data = this._data, + filter = options && options.filter, + order = options && options.order, + type = options && options.type || this._options.type, + i, + len, + id, + item, + items, + ids = []; + + if (filter) { + // get filtered items + if (order) { + // create ordered list + items = []; + for (id in data) { + if (data.hasOwnProperty(id)) { + item = this._getItem(id, type); + if (filter(item)) { + items.push(item); + } } } - } - this._sort(items, order); + this._sort(items, order); - for (i = 0, len = items.length; i < len; i++) { - ids[i] = items[i][this._fieldId]; + for (i = 0, len = items.length; i < len; i++) { + ids[i] = items[i][this._fieldId]; + } + } + else { + // create unordered list + for (id in data) { + if (data.hasOwnProperty(id)) { + item = this._getItem(id, type); + if (filter(item)) { + ids.push(item[this._fieldId]); + } + } + } } } else { - // create unordered list - for (id in data) { - if (data.hasOwnProperty(id)) { - item = this._getItem(id, type); - if (filter(item)) { - ids.push(item[this._fieldId]); + // get all items + if (order) { + // create an ordered list + items = []; + for (id in data) { + if (data.hasOwnProperty(id)) { + items.push(data[id]); } } + + this._sort(items, order); + + for (i = 0, len = items.length; i < len; i++) { + ids[i] = items[i][this._fieldId]; + } } - } - } - else { - // get all items - if (order) { - // create an ordered list - items = []; - for (id in data) { - if (data.hasOwnProperty(id)) { - items.push(data[id]); + else { + // create unordered list + for (id in data) { + if (data.hasOwnProperty(id)) { + item = data[id]; + ids.push(item[this._fieldId]); + } } } + } + + return ids; + }; + + /** + * Returns the DataSet itself. Is overwritten for example by the DataView, + * which returns the DataSet it is connected to instead. + */ + DataSet.prototype.getDataSet = function () { + return this; + }; - this._sort(items, order); + /** + * Execute a callback function for every item in the dataset. + * @param {function} callback + * @param {Object} [options] Available options: + * {Object.} [type] + * {String[]} [fields] filter fields + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + */ + DataSet.prototype.forEach = function (callback, options) { + var filter = options && options.filter, + type = options && options.type || this._options.type, + data = this._data, + item, + id; - for (i = 0, len = items.length; i < len; i++) { - ids[i] = items[i][this._fieldId]; + if (options && options.order) { + // execute forEach on ordered list + var items = this.get(options); + + for (var i = 0, len = items.length; i < len; i++) { + item = items[i]; + id = item[this._fieldId]; + callback(item, id); } } else { - // create unordered list + // unordered for (id in data) { if (data.hasOwnProperty(id)) { - item = data[id]; - ids.push(item[this._fieldId]); + item = this._getItem(id, type); + if (!filter || filter(item)) { + callback(item, id); + } } } } - } - - return ids; -}; - -/** - * Returns the DataSet itself. Is overwritten for example by the DataView, - * which returns the DataSet it is connected to instead. - */ -DataSet.prototype.getDataSet = function () { - return this; -}; + }; -/** - * Execute a callback function for every item in the dataset. - * @param {function} callback - * @param {Object} [options] Available options: - * {Object.} [type] - * {String[]} [fields] filter fields - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - */ -DataSet.prototype.forEach = function (callback, options) { - var filter = options && options.filter, - type = options && options.type || this._options.type, - data = this._data, - item, - id; - - if (options && options.order) { - // execute forEach on ordered list - var items = this.get(options); - - for (var i = 0, len = items.length; i < len; i++) { - item = items[i]; - id = item[this._fieldId]; - callback(item, id); - } - } - else { - // unordered - for (id in data) { + /** + * Map every item in the dataset. + * @param {function} callback + * @param {Object} [options] Available options: + * {Object.} [type] + * {String[]} [fields] filter fields + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * @return {Object[]} mappedItems + */ + DataSet.prototype.map = function (callback, options) { + var filter = options && options.filter, + type = options && options.type || this._options.type, + mappedItems = [], + data = this._data, + item; + + // convert and filter items + for (var id in data) { if (data.hasOwnProperty(id)) { item = this._getItem(id, type); if (!filter || filter(item)) { - callback(item, id); + mappedItems.push(callback(item, id)); } } } - } -}; - -/** - * Map every item in the dataset. - * @param {function} callback - * @param {Object} [options] Available options: - * {Object.} [type] - * {String[]} [fields] filter fields - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * @return {Object[]} mappedItems - */ -DataSet.prototype.map = function (callback, options) { - var filter = options && options.filter, - type = options && options.type || this._options.type, - mappedItems = [], - data = this._data, - item; - // convert and filter items - for (var id in data) { - if (data.hasOwnProperty(id)) { - item = this._getItem(id, type); - if (!filter || filter(item)) { - mappedItems.push(callback(item, id)); - } + // order items + if (options && options.order) { + this._sort(mappedItems, options.order); } - } - // order items - if (options && options.order) { - this._sort(mappedItems, options.order); - } - - return mappedItems; -}; + return mappedItems; + }; -/** - * Filter the fields of an item - * @param {Object} item - * @param {String[]} fields Field names - * @return {Object} filteredItem - * @private - */ -DataSet.prototype._filterFields = function (item, fields) { - var filteredItem = {}; + /** + * Filter the fields of an item + * @param {Object} item + * @param {String[]} fields Field names + * @return {Object} filteredItem + * @private + */ + DataSet.prototype._filterFields = function (item, fields) { + var filteredItem = {}; - for (var field in item) { - if (item.hasOwnProperty(field) && (fields.indexOf(field) != -1)) { - filteredItem[field] = item[field]; + for (var field in item) { + if (item.hasOwnProperty(field) && (fields.indexOf(field) != -1)) { + filteredItem[field] = item[field]; + } } - } - return filteredItem; -}; + return filteredItem; + }; -/** - * Sort the provided array with items - * @param {Object[]} items - * @param {String | function} order A field name or custom sort function. - * @private - */ -DataSet.prototype._sort = function (items, order) { - if (util.isString(order)) { - // order by provided field name - var name = order; // field name - items.sort(function (a, b) { - var av = a[name]; - var bv = b[name]; - return (av > bv) ? 1 : ((av < bv) ? -1 : 0); - }); - } - else if (typeof order === 'function') { - // order by sort function - items.sort(order); - } - // TODO: extend order by an Object {field:String, direction:String} - // where direction can be 'asc' or 'desc' - else { - throw new TypeError('Order must be a function or a string'); - } -}; + /** + * Sort the provided array with items + * @param {Object[]} items + * @param {String | function} order A field name or custom sort function. + * @private + */ + DataSet.prototype._sort = function (items, order) { + if (util.isString(order)) { + // order by provided field name + var name = order; // field name + items.sort(function (a, b) { + var av = a[name]; + var bv = b[name]; + return (av > bv) ? 1 : ((av < bv) ? -1 : 0); + }); + } + else if (typeof order === 'function') { + // order by sort function + items.sort(order); + } + // TODO: extend order by an Object {field:String, direction:String} + // where direction can be 'asc' or 'desc' + else { + throw new TypeError('Order must be a function or a string'); + } + }; -/** - * Remove an object by pointer or by id - * @param {String | Number | Object | Array} id Object or id, or an array with - * objects or ids to be removed - * @param {String} [senderId] Optional sender id - * @return {Array} removedIds - */ -DataSet.prototype.remove = function (id, senderId) { - var removedIds = [], - i, len, removedId; + /** + * Remove an object by pointer or by id + * @param {String | Number | Object | Array} id Object or id, or an array with + * objects or ids to be removed + * @param {String} [senderId] Optional sender id + * @return {Array} removedIds + */ + DataSet.prototype.remove = function (id, senderId) { + var removedIds = [], + i, len, removedId; - if (Array.isArray(id)) { - for (i = 0, len = id.length; i < len; i++) { - removedId = this._remove(id[i]); + if (Array.isArray(id)) { + for (i = 0, len = id.length; i < len; i++) { + removedId = this._remove(id[i]); + if (removedId != null) { + removedIds.push(removedId); + } + } + } + else { + removedId = this._remove(id); if (removedId != null) { removedIds.push(removedId); } } - } - else { - removedId = this._remove(id); - if (removedId != null) { - removedIds.push(removedId); - } - } - if (removedIds.length) { - this._trigger('remove', {items: removedIds}, senderId); - } + if (removedIds.length) { + this._trigger('remove', {items: removedIds}, senderId); + } - return removedIds; -}; + return removedIds; + }; -/** - * Remove an item by its id - * @param {Number | String | Object} id id or item - * @returns {Number | String | null} id - * @private - */ -DataSet.prototype._remove = function (id) { - if (util.isNumber(id) || util.isString(id)) { - if (this._data[id]) { - delete this._data[id]; - return id; + /** + * Remove an item by its id + * @param {Number | String | Object} id id or item + * @returns {Number | String | null} id + * @private + */ + DataSet.prototype._remove = function (id) { + if (util.isNumber(id) || util.isString(id)) { + if (this._data[id]) { + delete this._data[id]; + return id; + } } - } - else if (id instanceof Object) { - var itemId = id[this._fieldId]; - if (itemId && this._data[itemId]) { - delete this._data[itemId]; - return itemId; + else if (id instanceof Object) { + var itemId = id[this._fieldId]; + if (itemId && this._data[itemId]) { + delete this._data[itemId]; + return itemId; + } } - } - return null; -}; + return null; + }; -/** - * Clear the data - * @param {String} [senderId] Optional sender id - * @return {Array} removedIds The ids of all removed items - */ -DataSet.prototype.clear = function (senderId) { - var ids = Object.keys(this._data); + /** + * Clear the data + * @param {String} [senderId] Optional sender id + * @return {Array} removedIds The ids of all removed items + */ + DataSet.prototype.clear = function (senderId) { + var ids = Object.keys(this._data); - this._data = {}; + this._data = {}; - this._trigger('remove', {items: ids}, senderId); + this._trigger('remove', {items: ids}, senderId); - return ids; -}; + return ids; + }; -/** - * Find the item with maximum value of a specified field - * @param {String} field - * @return {Object | null} item Item containing max value, or null if no items - */ -DataSet.prototype.max = function (field) { - var data = this._data, - max = null, - maxField = null; + /** + * Find the item with maximum value of a specified field + * @param {String} field + * @return {Object | null} item Item containing max value, or null if no items + */ + DataSet.prototype.max = function (field) { + var data = this._data, + max = null, + maxField = null; - for (var id in data) { - if (data.hasOwnProperty(id)) { - var item = data[id]; - var itemField = item[field]; - if (itemField != null && (!max || itemField > maxField)) { - max = item; - maxField = itemField; + for (var id in data) { + if (data.hasOwnProperty(id)) { + var item = data[id]; + var itemField = item[field]; + if (itemField != null && (!max || itemField > maxField)) { + max = item; + maxField = itemField; + } } } - } - return max; -}; + return max; + }; -/** - * Find the item with minimum value of a specified field - * @param {String} field - * @return {Object | null} item Item containing max value, or null if no items - */ -DataSet.prototype.min = function (field) { - var data = this._data, - min = null, - minField = null; + /** + * Find the item with minimum value of a specified field + * @param {String} field + * @return {Object | null} item Item containing max value, or null if no items + */ + DataSet.prototype.min = function (field) { + var data = this._data, + min = null, + minField = null; - for (var id in data) { - if (data.hasOwnProperty(id)) { - var item = data[id]; - var itemField = item[field]; - if (itemField != null && (!min || itemField < minField)) { - min = item; - minField = itemField; + for (var id in data) { + if (data.hasOwnProperty(id)) { + var item = data[id]; + var itemField = item[field]; + if (itemField != null && (!min || itemField < minField)) { + min = item; + minField = itemField; + } } } - } - return min; -}; + return min; + }; -/** - * Find all distinct values of a specified field - * @param {String} field - * @return {Array} values Array containing all distinct values. If data items - * do not contain the specified field are ignored. - * The returned array is unordered. - */ -DataSet.prototype.distinct = function (field) { - var data = this._data; - var values = []; - var fieldType = this._options.type && this._options.type[field] || null; - var count = 0; - var i; - - for (var prop in data) { - if (data.hasOwnProperty(prop)) { - var item = data[prop]; - var value = item[field]; - var exists = false; - for (i = 0; i < count; i++) { - if (values[i] == value) { - exists = true; - break; + /** + * Find all distinct values of a specified field + * @param {String} field + * @return {Array} values Array containing all distinct values. If data items + * do not contain the specified field are ignored. + * The returned array is unordered. + */ + DataSet.prototype.distinct = function (field) { + var data = this._data; + var values = []; + var fieldType = this._options.type && this._options.type[field] || null; + var count = 0; + var i; + + for (var prop in data) { + if (data.hasOwnProperty(prop)) { + var item = data[prop]; + var value = item[field]; + var exists = false; + for (i = 0; i < count; i++) { + if (values[i] == value) { + exists = true; + break; + } + } + if (!exists && (value !== undefined)) { + values[count] = value; + count++; } - } - if (!exists && (value !== undefined)) { - values[count] = value; - count++; } } - } - if (fieldType) { - for (i = 0; i < values.length; i++) { - values[i] = util.convert(values[i], fieldType); + if (fieldType) { + for (i = 0; i < values.length; i++) { + values[i] = util.convert(values[i], fieldType); + } } - } - return values; -}; + return values; + }; -/** - * Add a single item. Will fail when an item with the same id already exists. - * @param {Object} item - * @return {String} id - * @private - */ -DataSet.prototype._addItem = function (item) { - var id = item[this._fieldId]; + /** + * Add a single item. Will fail when an item with the same id already exists. + * @param {Object} item + * @return {String} id + * @private + */ + DataSet.prototype._addItem = function (item) { + var id = item[this._fieldId]; - if (id != undefined) { - // check whether this id is already taken - if (this._data[id]) { - // item already exists - throw new Error('Cannot add item: item with id ' + id + ' already exists'); + if (id != undefined) { + // check whether this id is already taken + if (this._data[id]) { + // item already exists + throw new Error('Cannot add item: item with id ' + id + ' already exists'); + } + } + else { + // generate an id + id = util.randomUUID(); + item[this._fieldId] = id; } - } - else { - // generate an id - id = util.randomUUID(); - item[this._fieldId] = id; - } - var d = {}; - for (var field in item) { - if (item.hasOwnProperty(field)) { - var fieldType = this._type[field]; // type may be undefined - d[field] = util.convert(item[field], fieldType); + var d = {}; + for (var field in item) { + if (item.hasOwnProperty(field)) { + var fieldType = this._type[field]; // type may be undefined + d[field] = util.convert(item[field], fieldType); + } } - } - this._data[id] = d; + this._data[id] = d; - return id; -}; + return id; + }; -/** - * Get an item. Fields can be converted to a specific type - * @param {String} id - * @param {Object.} [types] field types to convert - * @return {Object | null} item - * @private - */ -DataSet.prototype._getItem = function (id, types) { - var field, value; + /** + * Get an item. Fields can be converted to a specific type + * @param {String} id + * @param {Object.} [types] field types to convert + * @return {Object | null} item + * @private + */ + DataSet.prototype._getItem = function (id, types) { + var field, value; - // get the item from the dataset - var raw = this._data[id]; - if (!raw) { - return null; - } + // get the item from the dataset + var raw = this._data[id]; + if (!raw) { + return null; + } - // convert the items field types - var converted = {}; - if (types) { - for (field in raw) { - if (raw.hasOwnProperty(field)) { - value = raw[field]; - converted[field] = util.convert(value, types[field]); + // convert the items field types + var converted = {}; + if (types) { + for (field in raw) { + if (raw.hasOwnProperty(field)) { + value = raw[field]; + converted[field] = util.convert(value, types[field]); + } } } - } - else { - // no field types specified, no converting needed - for (field in raw) { - if (raw.hasOwnProperty(field)) { - value = raw[field]; - converted[field] = value; + else { + // no field types specified, no converting needed + for (field in raw) { + if (raw.hasOwnProperty(field)) { + value = raw[field]; + converted[field] = value; + } } } - } - return converted; -}; + return converted; + }; -/** - * Update a single item: merge with existing item. - * Will fail when the item has no id, or when there does not exist an item - * with the same id. - * @param {Object} item - * @return {String} id - * @private - */ -DataSet.prototype._updateItem = function (item) { - var id = item[this._fieldId]; - if (id == undefined) { - throw new Error('Cannot update item: item has no id (item: ' + JSON.stringify(item) + ')'); - } - var d = this._data[id]; - if (!d) { - // item doesn't exist - throw new Error('Cannot update item: no item with id ' + id + ' found'); - } + /** + * Update a single item: merge with existing item. + * Will fail when the item has no id, or when there does not exist an item + * with the same id. + * @param {Object} item + * @return {String} id + * @private + */ + DataSet.prototype._updateItem = function (item) { + var id = item[this._fieldId]; + if (id == undefined) { + throw new Error('Cannot update item: item has no id (item: ' + JSON.stringify(item) + ')'); + } + var d = this._data[id]; + if (!d) { + // item doesn't exist + throw new Error('Cannot update item: no item with id ' + id + ' found'); + } - // merge with current item - for (var field in item) { - if (item.hasOwnProperty(field)) { - var fieldType = this._type[field]; // type may be undefined - d[field] = util.convert(item[field], fieldType); + // merge with current item + for (var field in item) { + if (item.hasOwnProperty(field)) { + var fieldType = this._type[field]; // type may be undefined + d[field] = util.convert(item[field], fieldType); + } } - } - return id; -}; + return id; + }; -/** - * Get an array with the column names of a Google DataTable - * @param {DataTable} dataTable - * @return {String[]} columnNames - * @private - */ -DataSet.prototype._getColumnNames = function (dataTable) { - var columns = []; - for (var col = 0, cols = dataTable.getNumberOfColumns(); col < cols; col++) { - columns[col] = dataTable.getColumnId(col) || dataTable.getColumnLabel(col); - } - return columns; -}; + /** + * Get an array with the column names of a Google DataTable + * @param {DataTable} dataTable + * @return {String[]} columnNames + * @private + */ + DataSet.prototype._getColumnNames = function (dataTable) { + var columns = []; + for (var col = 0, cols = dataTable.getNumberOfColumns(); col < cols; col++) { + columns[col] = dataTable.getColumnId(col) || dataTable.getColumnLabel(col); + } + return columns; + }; -/** - * Append an item as a row to the dataTable - * @param dataTable - * @param columns - * @param item - * @private - */ -DataSet.prototype._appendRow = function (dataTable, columns, item) { - var row = dataTable.addRow(); + /** + * Append an item as a row to the dataTable + * @param dataTable + * @param columns + * @param item + * @private + */ + DataSet.prototype._appendRow = function (dataTable, columns, item) { + var row = dataTable.addRow(); - for (var col = 0, cols = columns.length; col < cols; col++) { - var field = columns[col]; - dataTable.setValue(row, col, item[field]); - } -}; + for (var col = 0, cols = columns.length; col < cols; col++) { + var field = columns[col]; + dataTable.setValue(row, col, item[field]); + } + }; -/** - * DataView - * - * a dataview offers a filtered view on a dataset or an other dataview. - * - * @param {DataSet | DataView} data - * @param {Object} [options] Available options: see method get - * - * @constructor DataView - */ -function DataView (data, options) { - this._data = null; - this._ids = {}; // ids of the items currently in memory (just contains a boolean true) - this._options = options || {}; - this._fieldId = 'id'; // name of the field containing id - this._subscribers = {}; // event subscribers + module.exports = DataSet; - var me = this; - this.listener = function () { - me._onEvent.apply(me, arguments); - }; - this.setData(data); -} +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { -// TODO: implement a function .config() to dynamically update things like configured filter -// and trigger changes accordingly + var util = __webpack_require__(1); + var DataSet = __webpack_require__(3); -/** - * Set a data source for the view - * @param {DataSet | DataView} data - */ -DataView.prototype.setData = function (data) { - var ids, i, len; + /** + * DataView + * + * a dataview offers a filtered view on a dataset or an other dataview. + * + * @param {DataSet | DataView} data + * @param {Object} [options] Available options: see method get + * + * @constructor DataView + */ + function DataView (data, options) { + this._data = null; + this._ids = {}; // ids of the items currently in memory (just contains a boolean true) + this._options = options || {}; + this._fieldId = 'id'; // name of the field containing id + this._subscribers = {}; // event subscribers - if (this._data) { - // unsubscribe from current dataset - if (this._data.unsubscribe) { - this._data.unsubscribe('*', this.listener); - } + var me = this; + this.listener = function () { + me._onEvent.apply(me, arguments); + }; - // trigger a remove of all items in memory - ids = []; - for (var id in this._ids) { - if (this._ids.hasOwnProperty(id)) { - ids.push(id); - } - } - this._ids = {}; - this._trigger('remove', {items: ids}); + this.setData(data); } - this._data = data; + // TODO: implement a function .config() to dynamically update things like configured filter + // and trigger changes accordingly + + /** + * Set a data source for the view + * @param {DataSet | DataView} data + */ + DataView.prototype.setData = function (data) { + var ids, i, len; - if (this._data) { - // update fieldId - this._fieldId = this._options.fieldId || - (this._data && this._data.options && this._data.options.fieldId) || - 'id'; + if (this._data) { + // unsubscribe from current dataset + if (this._data.unsubscribe) { + this._data.unsubscribe('*', this.listener); + } - // trigger an add of all added items - ids = this._data.getIds({filter: this._options && this._options.filter}); - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - this._ids[id] = true; + // trigger a remove of all items in memory + ids = []; + for (var id in this._ids) { + if (this._ids.hasOwnProperty(id)) { + ids.push(id); + } + } + this._ids = {}; + this._trigger('remove', {items: ids}); } - this._trigger('add', {items: ids}); - // subscribe to new dataset - if (this._data.on) { - this._data.on('*', this.listener); + this._data = data; + + if (this._data) { + // update fieldId + this._fieldId = this._options.fieldId || + (this._data && this._data.options && this._data.options.fieldId) || + 'id'; + + // trigger an add of all added items + ids = this._data.getIds({filter: this._options && this._options.filter}); + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + this._ids[id] = true; + } + this._trigger('add', {items: ids}); + + // subscribe to new dataset + if (this._data.on) { + this._data.on('*', this.listener); + } } - } -}; + }; -/** - * Get data from the data view - * - * Usage: - * - * get() - * get(options: Object) - * get(options: Object, data: Array | DataTable) - * - * get(id: Number) - * get(id: Number, options: Object) - * get(id: Number, options: Object, data: Array | DataTable) - * - * get(ids: Number[]) - * get(ids: Number[], options: Object) - * get(ids: Number[], options: Object, data: Array | DataTable) - * - * Where: - * - * {Number | String} id The id of an item - * {Number[] | String{}} ids An array with ids of items - * {Object} options An Object with options. Available options: - * {String} [type] Type of data to be returned. Can - * be 'DataTable' or 'Array' (default) - * {Object.} [convert] - * {String[]} [fields] field names to be returned - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * {Array | DataTable} [data] If provided, items will be appended to this - * array or table. Required in case of Google - * DataTable. - * @param args - */ -DataView.prototype.get = function (args) { - var me = this; - - // parse the arguments - var ids, options, data; - var firstType = util.getType(arguments[0]); - if (firstType == 'String' || firstType == 'Number' || firstType == 'Array') { - // get(id(s) [, options] [, data]) - ids = arguments[0]; // can be a single id or an array with ids - options = arguments[1]; - data = arguments[2]; - } - else { - // get([, options] [, data]) - options = arguments[0]; - data = arguments[1]; - } + /** + * Get data from the data view + * + * Usage: + * + * get() + * get(options: Object) + * get(options: Object, data: Array | DataTable) + * + * get(id: Number) + * get(id: Number, options: Object) + * get(id: Number, options: Object, data: Array | DataTable) + * + * get(ids: Number[]) + * get(ids: Number[], options: Object) + * get(ids: Number[], options: Object, data: Array | DataTable) + * + * Where: + * + * {Number | String} id The id of an item + * {Number[] | String{}} ids An array with ids of items + * {Object} options An Object with options. Available options: + * {String} [type] Type of data to be returned. Can + * be 'DataTable' or 'Array' (default) + * {Object.} [convert] + * {String[]} [fields] field names to be returned + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * {Array | DataTable} [data] If provided, items will be appended to this + * array or table. Required in case of Google + * DataTable. + * @param args + */ + DataView.prototype.get = function (args) { + var me = this; + + // parse the arguments + var ids, options, data; + var firstType = util.getType(arguments[0]); + if (firstType == 'String' || firstType == 'Number' || firstType == 'Array') { + // get(id(s) [, options] [, data]) + ids = arguments[0]; // can be a single id or an array with ids + options = arguments[1]; + data = arguments[2]; + } + else { + // get([, options] [, data]) + options = arguments[0]; + data = arguments[1]; + } - // extend the options with the default options and provided options - var viewOptions = util.extend({}, this._options, options); + // extend the options with the default options and provided options + var viewOptions = util.extend({}, this._options, options); - // create a combined filter method when needed - if (this._options.filter && options && options.filter) { - viewOptions.filter = function (item) { - return me._options.filter(item) && options.filter(item); + // create a combined filter method when needed + if (this._options.filter && options && options.filter) { + viewOptions.filter = function (item) { + return me._options.filter(item) && options.filter(item); + } } - } - // build up the call to the linked data set - var getArguments = []; - if (ids != undefined) { - getArguments.push(ids); - } - getArguments.push(viewOptions); - getArguments.push(data); + // build up the call to the linked data set + var getArguments = []; + if (ids != undefined) { + getArguments.push(ids); + } + getArguments.push(viewOptions); + getArguments.push(data); - return this._data && this._data.get.apply(this._data, getArguments); -}; + return this._data && this._data.get.apply(this._data, getArguments); + }; -/** - * Get ids of all items or from a filtered set of items. - * @param {Object} [options] An Object with options. Available options: - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * @return {Array} ids - */ -DataView.prototype.getIds = function (options) { - var ids; + /** + * Get ids of all items or from a filtered set of items. + * @param {Object} [options] An Object with options. Available options: + * {function} [filter] filter items + * {String | function} [order] Order the items by + * a field name or custom sort function. + * @return {Array} ids + */ + DataView.prototype.getIds = function (options) { + var ids; - if (this._data) { - var defaultFilter = this._options.filter; - var filter; + if (this._data) { + var defaultFilter = this._options.filter; + var filter; - if (options && options.filter) { - if (defaultFilter) { - filter = function (item) { - return defaultFilter(item) && options.filter(item); + if (options && options.filter) { + if (defaultFilter) { + filter = function (item) { + return defaultFilter(item) && options.filter(item); + } + } + else { + filter = options.filter; } } else { - filter = options.filter; + filter = defaultFilter; } + + ids = this._data.getIds({ + filter: filter, + order: options && options.order + }); } else { - filter = defaultFilter; + ids = []; } - ids = this._data.getIds({ - filter: filter, - order: options && options.order - }); - } - else { - ids = []; - } - - return ids; -}; + return ids; + }; -/** - * Get the DataSet to which this DataView is connected. In case there is a chain - * of multiple DataViews, the root DataSet of this chain is returned. - * @return {DataSet} dataSet - */ -DataView.prototype.getDataSet = function () { - var dataSet = this; - while (dataSet instanceof DataView) { - dataSet = dataSet._data; - } - return dataSet || null; -}; + /** + * Get the DataSet to which this DataView is connected. In case there is a chain + * of multiple DataViews, the root DataSet of this chain is returned. + * @return {DataSet} dataSet + */ + DataView.prototype.getDataSet = function () { + var dataSet = this; + while (dataSet instanceof DataView) { + dataSet = dataSet._data; + } + return dataSet || null; + }; -/** - * Event listener. Will propagate all events from the connected data set to - * the subscribers of the DataView, but will filter the items and only trigger - * when there are changes in the filtered data set. - * @param {String} event - * @param {Object | null} params - * @param {String} senderId - * @private - */ -DataView.prototype._onEvent = function (event, params, senderId) { - var i, len, id, item, - ids = params && params.items, - data = this._data, - added = [], - updated = [], - removed = []; - - if (ids && data) { - switch (event) { - case 'add': - // filter the ids of the added items - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - item = this.get(id); - if (item) { - this._ids[id] = true; - added.push(id); + /** + * Event listener. Will propagate all events from the connected data set to + * the subscribers of the DataView, but will filter the items and only trigger + * when there are changes in the filtered data set. + * @param {String} event + * @param {Object | null} params + * @param {String} senderId + * @private + */ + DataView.prototype._onEvent = function (event, params, senderId) { + var i, len, id, item, + ids = params && params.items, + data = this._data, + added = [], + updated = [], + removed = []; + + if (ids && data) { + switch (event) { + case 'add': + // filter the ids of the added items + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + item = this.get(id); + if (item) { + this._ids[id] = true; + added.push(id); + } } - } - break; + break; - case 'update': - // determine the event from the views viewpoint: an updated - // item can be added, updated, or removed from this view. - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - item = this.get(id); + case 'update': + // determine the event from the views viewpoint: an updated + // item can be added, updated, or removed from this view. + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + item = this.get(id); - if (item) { - if (this._ids[id]) { - updated.push(id); + if (item) { + if (this._ids[id]) { + updated.push(id); + } + else { + this._ids[id] = true; + added.push(id); + } } else { - this._ids[id] = true; - added.push(id); + if (this._ids[id]) { + delete this._ids[id]; + removed.push(id); + } + else { + // nothing interesting for me :-( + } } } - else { + + break; + + case 'remove': + // filter the ids of the removed items + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; if (this._ids[id]) { delete this._ids[id]; removed.push(id); } - else { - // nothing interesting for me :-( - } } - } - break; - - case 'remove': - // filter the ids of the removed items - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - if (this._ids[id]) { - delete this._ids[id]; - removed.push(id); - } - } + break; + } - break; + if (added.length) { + this._trigger('add', {items: added}, senderId); + } + if (updated.length) { + this._trigger('update', {items: updated}, senderId); + } + if (removed.length) { + this._trigger('remove', {items: removed}, senderId); + } } + }; - if (added.length) { - this._trigger('add', {items: added}, senderId); - } - if (updated.length) { - this._trigger('update', {items: updated}, senderId); - } - if (removed.length) { - this._trigger('remove', {items: removed}, senderId); - } - } -}; + // copy subscription functionality from DataSet + DataView.prototype.on = DataSet.prototype.on; + DataView.prototype.off = DataSet.prototype.off; + DataView.prototype._trigger = DataSet.prototype._trigger; -// copy subscription functionality from DataSet -DataView.prototype.on = DataSet.prototype.on; -DataView.prototype.off = DataSet.prototype.off; -DataView.prototype._trigger = DataSet.prototype._trigger; + // TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5) + DataView.prototype.subscribe = DataView.prototype.on; + DataView.prototype.unsubscribe = DataView.prototype.off; -// TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5) -DataView.prototype.subscribe = DataView.prototype.on; -DataView.prototype.unsubscribe = DataView.prototype.off; + module.exports = DataView; -/** - * @constructor Group - * @param {Number | String} groupId - * @param {Object} data - * @param {ItemSet} itemSet - */ -function GraphGroup (group, groupId, options, groupsUsingDefaultStyles) { - this.id = groupId; - var fields = ['sampling','style','sort','yAxisOrientation','barChart','drawPoints','shaded','catmullRom'] - this.options = util.selectiveBridgeObject(fields,options); - this.usingDefaultStyle = group.className === undefined; - this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; - this.zeroPosition = 0; - this.update(group); - if (this.usingDefaultStyle == true) { - this.groupsUsingDefaultStyles[0] += 1; - } - this.itemsData = []; -} +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + var Emitter = __webpack_require__(45); + var DataSet = __webpack_require__(3); + var DataView = __webpack_require__(4); + var util = __webpack_require__(1); + var Point3d = __webpack_require__(9); + var Point2d = __webpack_require__(8); + var Camera = __webpack_require__(6); + var Filter = __webpack_require__(7); + var Slider = __webpack_require__(10); + var StepNumber = __webpack_require__(11); + + /** + * @constructor Graph3d + * Graph3d displays data in 3d. + * + * Graph3d is developed in javascript as a Google Visualization Chart. + * + * @param {Element} container The DOM element in which the Graph3d will + * be created. Normally a div element. + * @param {DataSet | DataView | Array} [data] + * @param {Object} [options] + */ + function Graph3d(container, data, options) { + if (!(this instanceof Graph3d)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + + // create variables and set default values + this.containerElement = container; + this.width = '400px'; + this.height = '400px'; + this.margin = 10; // px + this.defaultXCenter = '55%'; + this.defaultYCenter = '50%'; + + this.xLabel = 'x'; + this.yLabel = 'y'; + this.zLabel = 'z'; + this.filterLabel = 'time'; + this.legendLabel = 'value'; + + this.style = Graph3d.STYLE.DOT; + this.showPerspective = true; + this.showGrid = true; + this.keepAspectRatio = true; + this.showShadow = false; + this.showGrayBottom = false; // TODO: this does not work correctly + this.showTooltip = false; + this.verticalRatio = 0.5; // 0.1 to 1.0, where 1.0 results in a 'cube' + + this.animationInterval = 1000; // milliseconds + this.animationPreload = false; + + this.camera = new Camera(); + this.eye = new Point3d(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window? + + this.dataTable = null; // The original data table + this.dataPoints = null; // The table with point objects + + // the column indexes + this.colX = undefined; + this.colY = undefined; + this.colZ = undefined; + this.colValue = undefined; + this.colFilter = undefined; + + this.xMin = 0; + this.xStep = undefined; // auto by default + this.xMax = 1; + this.yMin = 0; + this.yStep = undefined; // auto by default + this.yMax = 1; + this.zMin = 0; + this.zStep = undefined; // auto by default + this.zMax = 1; + this.valueMin = 0; + this.valueMax = 1; + this.xBarWidth = 1; + this.yBarWidth = 1; + // TODO: customize axis range + + // constants + this.colorAxis = '#4D4D4D'; + this.colorGrid = '#D3D3D3'; + this.colorDot = '#7DC1FF'; + this.colorDotBorder = '#3267D2'; + + // create a frame and canvas + this.create(); + + // apply options (also when undefined) + this.setOptions(options); -GraphGroup.prototype.setItems = function(items) { - if (items != null) { - this.itemsData = items; - if (this.options.sort == true) { - this.itemsData.sort(function (a,b) {return a.x - b.x;}) + // apply data + if (data) { + this.setData(data); } } - else { - this.itemsData = []; - } -} - -GraphGroup.prototype.setZeroPosition = function(pos) { - this.zeroPosition = pos; -} -GraphGroup.prototype.setOptions = function(options) { - if (options !== undefined) { - var fields = ['sampling','style','sort','yAxisOrientation','barChart']; - util.selectiveDeepExtend(fields, this.options, options); + // Extend Graph3d with an Emitter mixin + Emitter(Graph3d.prototype); - util.mergeOptions(this.options, options,'catmullRom'); - util.mergeOptions(this.options, options,'drawPoints'); - util.mergeOptions(this.options, options,'shaded'); + /** + * Calculate the scaling values, dependent on the range in x, y, and z direction + */ + Graph3d.prototype._setScale = function() { + this.scale = new Point3d(1 / (this.xMax - this.xMin), + 1 / (this.yMax - this.yMin), + 1 / (this.zMax - this.zMin)); - if (options.catmullRom) { - if (typeof options.catmullRom == 'object') { - if (options.catmullRom.parametrization) { - if (options.catmullRom.parametrization == 'uniform') { - this.options.catmullRom.alpha = 0; - } - else if (options.catmullRom.parametrization == 'chordal') { - this.options.catmullRom.alpha = 1.0; - } - else { - this.options.catmullRom.parametrization = 'centripetal'; - this.options.catmullRom.alpha = 0.5; - } - } - } - } - } -}; - -GraphGroup.prototype.update = function(group) { - this.group = group; - this.content = group.content || 'graph'; - this.className = group.className || this.className || "graphGroup" + this.groupsUsingDefaultStyles[0] % 10; - this.setOptions(group.options); -}; - -GraphGroup.prototype.drawIcon = function(x, y, JSONcontainer, SVGcontainer, iconWidth, iconHeight) { - var fillHeight = iconHeight * 0.5; - var path, fillPath; - - var outline = DOMutil.getSVGElement("rect", JSONcontainer, SVGcontainer); - outline.setAttributeNS(null, "x", x); - outline.setAttributeNS(null, "y", y - fillHeight); - outline.setAttributeNS(null, "width", iconWidth); - outline.setAttributeNS(null, "height", 2*fillHeight); - outline.setAttributeNS(null, "class", "outline"); - - if (this.options.style == 'line') { - path = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); - path.setAttributeNS(null, "class", this.className); - path.setAttributeNS(null, "d", "M" + x + ","+y+" L" + (x + iconWidth) + ","+y+""); - if (this.options.shaded.enabled == true) { - fillPath = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); - if (this.options.shaded.orientation == 'top') { - fillPath.setAttributeNS(null, "d", "M"+x+", " + (y - fillHeight) + - "L"+x+","+y+" L"+ (x + iconWidth) + ","+y+" L"+ (x + iconWidth) + "," + (y - fillHeight)); + // keep aspect ration between x and y scale if desired + if (this.keepAspectRatio) { + if (this.scale.x < this.scale.y) { + //noinspection JSSuspiciousNameCombination + this.scale.y = this.scale.x; } else { - fillPath.setAttributeNS(null, "d", "M"+x+","+y+" " + - "L"+x+"," + (y + fillHeight) + " " + - "L"+ (x + iconWidth) + "," + (y + fillHeight) + - "L"+ (x + iconWidth) + ","+y); + //noinspection JSSuspiciousNameCombination + this.scale.x = this.scale.y; } - fillPath.setAttributeNS(null, "class", this.className + " iconFill"); - } - - if (this.options.drawPoints.enabled == true) { - DOMutil.drawPoint(x + 0.5 * iconWidth,y, this, JSONcontainer, SVGcontainer); } - } - else { - var barWidth = Math.round(0.3 * iconWidth); - var bar1Height = Math.round(0.4 * iconHeight); - var bar2Height = Math.round(0.75 * iconHeight); - var offset = Math.round((iconWidth - (2 * barWidth))/3); + // scale the vertical axis + this.scale.z *= this.verticalRatio; + // TODO: can this be automated? verticalRatio? - DOMutil.drawBar(x + 0.5*barWidth + offset , y + fillHeight - bar1Height - 1, barWidth, bar1Height, this.className + ' bar', JSONcontainer, SVGcontainer); - DOMutil.drawBar(x + 1.5*barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, this.className + ' bar', JSONcontainer, SVGcontainer); - } -} + // determine scale for (optional) value + this.scale.value = 1 / (this.valueMax - this.valueMin); -/** - * Created by Alex on 6/17/14. - */ -function Legend(body, options, side) { - this.body = body; - this.defaultOptions = { - enabled: true, - icons: true, - iconSize: 20, - iconSpacing: 6, - left: { - visible: true, - position: 'top-left' // top/bottom - left,center,right - }, - right: { - visible: true, - position: 'top-left' // top/bottom - left,center,right - } - } - this.side = side; - this.options = util.extend({},this.defaultOptions); + // position the camera arm + var xCenter = (this.xMax + this.xMin) / 2 * this.scale.x; + var yCenter = (this.yMax + this.yMin) / 2 * this.scale.y; + var zCenter = (this.zMax + this.zMin) / 2 * this.scale.z; + this.camera.setArmLocation(xCenter, yCenter, zCenter); + }; - this.svgElements = {}; - this.dom = {}; - this.groups = {}; - this.amountOfGroups = 0; - this._create(); - this.setOptions(options); -}; + /** + * Convert a 3D location to a 2D location on screen + * http://en.wikipedia.org/wiki/3D_projection + * @param {Point3d} point3d A 3D point with parameters x, y, z + * @return {Point2d} point2d A 2D point with parameters x, y + */ + Graph3d.prototype._convert3Dto2D = function(point3d) { + var translation = this._convertPointToTranslation(point3d); + return this._convertTranslationToScreen(translation); + }; -Legend.prototype = new Component(); + /** + * Convert a 3D location its translation seen from the camera + * http://en.wikipedia.org/wiki/3D_projection + * @param {Point3d} point3d A 3D point with parameters x, y, z + * @return {Point3d} translation A 3D point with parameters x, y, z This is + * the translation of the point, seen from the + * camera + */ + Graph3d.prototype._convertPointToTranslation = function(point3d) { + var ax = point3d.x * this.scale.x, + ay = point3d.y * this.scale.y, + az = point3d.z * this.scale.z, + + cx = this.camera.getCameraLocation().x, + cy = this.camera.getCameraLocation().y, + cz = this.camera.getCameraLocation().z, + + // calculate angles + sinTx = Math.sin(this.camera.getCameraRotation().x), + cosTx = Math.cos(this.camera.getCameraRotation().x), + sinTy = Math.sin(this.camera.getCameraRotation().y), + cosTy = Math.cos(this.camera.getCameraRotation().y), + sinTz = Math.sin(this.camera.getCameraRotation().z), + cosTz = Math.cos(this.camera.getCameraRotation().z), + + // calculate translation + dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz), + dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax-cx)), + dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax-cx)); + + return new Point3d(dx, dy, dz); + }; + /** + * Convert a translation point to a point on the screen + * @param {Point3d} translation A 3D point with parameters x, y, z This is + * the translation of the point, seen from the + * camera + * @return {Point2d} point2d A 2D point with parameters x, y + */ + Graph3d.prototype._convertTranslationToScreen = function(translation) { + var ex = this.eye.x, + ey = this.eye.y, + ez = this.eye.z, + dx = translation.x, + dy = translation.y, + dz = translation.z; + + // calculate position on screen from translation + var bx; + var by; + if (this.showPerspective) { + bx = (dx - ex) * (ez / dz); + by = (dy - ey) * (ez / dz); + } + else { + bx = dx * -(ez / this.camera.getArmLength()); + by = dy * -(ez / this.camera.getArmLength()); + } -Legend.prototype.addGroup = function(label, graphOptions) { - if (!this.groups.hasOwnProperty(label)) { - this.groups[label] = graphOptions; - } - this.amountOfGroups += 1; -}; + // shift and scale the point to the center of the screen + // use the width of the graph to scale both horizontally and vertically. + return new Point2d( + this.xcenter + bx * this.frame.canvas.clientWidth, + this.ycenter - by * this.frame.canvas.clientWidth); + }; -Legend.prototype.updateGroup = function(label, graphOptions) { - this.groups[label] = graphOptions; -}; + /** + * Set the background styling for the graph + * @param {string | {fill: string, stroke: string, strokeWidth: string}} backgroundColor + */ + Graph3d.prototype._setBackgroundColor = function(backgroundColor) { + var fill = 'white'; + var stroke = 'gray'; + var strokeWidth = 1; -Legend.prototype.removeGroup = function(label) { - if (this.groups.hasOwnProperty(label)) { - delete this.groups[label]; - this.amountOfGroups -= 1; - } -}; + if (typeof(backgroundColor) === 'string') { + fill = backgroundColor; + stroke = 'none'; + strokeWidth = 0; + } + else if (typeof(backgroundColor) === 'object') { + if (backgroundColor.fill !== undefined) fill = backgroundColor.fill; + if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke; + if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth; + } + else if (backgroundColor === undefined) { + // use use defaults + } + else { + throw 'Unsupported type of backgroundColor'; + } -Legend.prototype._create = function() { - this.dom.frame = document.createElement('div'); - this.dom.frame.className = 'legend'; - this.dom.frame.style.position = "absolute"; - this.dom.frame.style.top = "10px"; - this.dom.frame.style.display = "block"; + this.frame.style.backgroundColor = fill; + this.frame.style.borderColor = stroke; + this.frame.style.borderWidth = strokeWidth + 'px'; + this.frame.style.borderStyle = 'solid'; + }; - this.dom.textArea = document.createElement('div'); - this.dom.textArea.className = 'legendText'; - this.dom.textArea.style.position = "relative"; - this.dom.textArea.style.top = "0px"; - this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); - this.svg.style.position = 'absolute'; - this.svg.style.top = 0 +'px'; - this.svg.style.width = this.options.iconSize + 5 + 'px'; + /// enumerate the available styles + Graph3d.STYLE = { + BAR: 0, + BARCOLOR: 1, + BARSIZE: 2, + DOT : 3, + DOTLINE : 4, + DOTCOLOR: 5, + DOTSIZE: 6, + GRID : 7, + LINE: 8, + SURFACE : 9 + }; - this.dom.frame.appendChild(this.svg); - this.dom.frame.appendChild(this.dom.textArea); -} - -/** - * Hide the component from the DOM - */ -Legend.prototype.hide = function() { - // remove the frame containing the items - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); - } -}; - -/** - * Show the component in the DOM (when not already visible). - * @return {Boolean} changed - */ -Legend.prototype.show = function() { - // show frame containing the items - if (!this.dom.frame.parentNode) { - this.body.dom.center.appendChild(this.dom.frame); - } -}; + /** + * Retrieve the style index from given styleName + * @param {string} styleName Style name such as 'dot', 'grid', 'dot-line' + * @return {Number} styleNumber Enumeration value representing the style, or -1 + * when not found + */ + Graph3d.prototype._getStyleNumber = function(styleName) { + switch (styleName) { + case 'dot': return Graph3d.STYLE.DOT; + case 'dot-line': return Graph3d.STYLE.DOTLINE; + case 'dot-color': return Graph3d.STYLE.DOTCOLOR; + case 'dot-size': return Graph3d.STYLE.DOTSIZE; + case 'line': return Graph3d.STYLE.LINE; + case 'grid': return Graph3d.STYLE.GRID; + case 'surface': return Graph3d.STYLE.SURFACE; + case 'bar': return Graph3d.STYLE.BAR; + case 'bar-color': return Graph3d.STYLE.BARCOLOR; + case 'bar-size': return Graph3d.STYLE.BARSIZE; + } -Legend.prototype.setOptions = function(options) { - var fields = ['enabled','orientation','icons','left','right']; - util.selectiveDeepExtend(fields, this.options, options); -} + return -1; + }; -Legend.prototype.redraw = function() { - if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false) { - this.hide(); - } - else { - this.show(); - if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') { - this.dom.frame.style.left = '4px'; - this.dom.frame.style.textAlign = "left"; - this.dom.textArea.style.textAlign = "left"; - this.dom.textArea.style.left = (this.options.iconSize + 15) + 'px'; - this.dom.textArea.style.right = ''; - this.svg.style.left = 0 +'px'; - this.svg.style.right = ''; + /** + * Determine the indexes of the data columns, based on the given style and data + * @param {DataSet} data + * @param {Number} style + */ + Graph3d.prototype._determineColumnIndexes = function(data, style) { + if (this.style === Graph3d.STYLE.DOT || + this.style === Graph3d.STYLE.DOTLINE || + this.style === Graph3d.STYLE.LINE || + this.style === Graph3d.STYLE.GRID || + this.style === Graph3d.STYLE.SURFACE || + this.style === Graph3d.STYLE.BAR) { + // 3 columns expected, and optionally a 4th with filter values + this.colX = 0; + this.colY = 1; + this.colZ = 2; + this.colValue = undefined; + + if (data.getNumberOfColumns() > 3) { + this.colFilter = 3; + } + } + else if (this.style === Graph3d.STYLE.DOTCOLOR || + this.style === Graph3d.STYLE.DOTSIZE || + this.style === Graph3d.STYLE.BARCOLOR || + this.style === Graph3d.STYLE.BARSIZE) { + // 4 columns expected, and optionally a 5th with filter values + this.colX = 0; + this.colY = 1; + this.colZ = 2; + this.colValue = 3; + + if (data.getNumberOfColumns() > 4) { + this.colFilter = 4; + } } else { - this.dom.frame.style.right = '4px'; - this.dom.frame.style.textAlign = "right"; - this.dom.textArea.style.textAlign = "right"; - this.dom.textArea.style.right = (this.options.iconSize + 15) + 'px'; - this.dom.textArea.style.left = ''; - this.svg.style.right = 0 +'px'; - this.svg.style.left = ''; + throw 'Unknown style "' + this.style + '"'; } + }; - if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') { - this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px","")) + 'px'; - this.dom.frame.style.bottom = ''; - } - else { - this.dom.frame.style.bottom = 4 - Number(this.body.dom.center.style.top.replace("px","")) + 'px'; - this.dom.frame.style.top = ''; - } + Graph3d.prototype.getNumberOfRows = function(data) { + return data.length; + } - if (this.options.icons == false) { - this.dom.frame.style.width = this.dom.textArea.offsetWidth + 10 + 'px'; - this.dom.textArea.style.right = ''; - this.dom.textArea.style.left = ''; - this.svg.style.width = '0px'; - } - else { - this.dom.frame.style.width = this.options.iconSize + 15 + this.dom.textArea.offsetWidth + 10 + 'px' - this.drawLegendIcons(); - } - var content = ""; - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - content += this.groups[groupId].content + '
'; + Graph3d.prototype.getNumberOfColumns = function(data) { + var counter = 0; + for (var column in data[0]) { + if (data[0].hasOwnProperty(column)) { + counter++; } } - this.dom.textArea.innerHTML = content; - this.dom.textArea.style.lineHeight = ((0.75 * this.options.iconSize) + this.options.iconSpacing) + 'px'; + return counter; } -} - -Legend.prototype.drawLegendIcons = function() { - if (this.dom.frame.parentNode) { - DOMutil.prepareElements(this.svgElements); - var padding = window.getComputedStyle(this.dom.frame).paddingTop; - var iconOffset = Number(padding.replace("px",'')); - var x = iconOffset; - var iconWidth = this.options.iconSize; - var iconHeight = 0.75 * this.options.iconSize; - var y = iconOffset + 0.5 * iconHeight + 3; - this.svg.style.width = iconWidth + 5 + iconOffset + 'px'; - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight); - y += iconHeight + this.options.iconSpacing; + Graph3d.prototype.getDistinctValues = function(data, column) { + var distinctValues = []; + for (var i = 0; i < data.length; i++) { + if (distinctValues.indexOf(data[i][column]) == -1) { + distinctValues.push(data[i][column]); } } - - DOMutil.cleanupElements(this.svgElements); + return distinctValues; } -} -/** - * A horizontal time axis - * @param {Object} [options] See DataAxis.setOptions for the available - * options. - * @constructor DataAxis - * @extends Component - * @param body - */ -function DataAxis (body, options, svg) { - this.id = util.randomUUID(); - this.body = body; - this.defaultOptions = { - orientation: 'left', // supported: 'left', 'right' - showMinorLabels: true, - showMajorLabels: true, - icons: true, - majorLinesOffset: 7, - minorLinesOffset: 4, - labelOffsetX: 10, - labelOffsetY: 2, - iconWidth: 20, - width: '40px', - visible: true - }; - this.linegraphSVG = svg; - this.props = {}; - this.DOMelements = { // dynamic elements - lines: {}, - labels: {} + Graph3d.prototype.getColumnRange = function(data,column) { + var minMax = {min:data[0][column],max:data[0][column]}; + for (var i = 0; i < data.length; i++) { + if (minMax.min > data[i][column]) { minMax.min = data[i][column]; } + if (minMax.max < data[i][column]) { minMax.max = data[i][column]; } + } + return minMax; }; - this.dom = {}; - - this.range = {start:0, end:0}; + /** + * Initialize the data from the data table. Calculate minimum and maximum values + * and column index values + * @param {Array | DataSet | DataView} rawData The data containing the items for the Graph. + * @param {Number} style Style Number + */ + Graph3d.prototype._dataInitialize = function (rawData, style) { + var me = this; - this.options = util.extend({}, this.defaultOptions); - this.conversionFactor = 1; + // unsubscribe from the dataTable + if (this.dataSet) { + this.dataSet.off('*', this._onChange); + } - this.setOptions(options); - this.width = Number(('' + this.options.width).replace("px","")); - this.minWidth = this.width; - this.height = this.linegraphSVG.offsetHeight; + if (rawData === undefined) + return; - this.stepPixels = 25; - this.stepPixelsForced = 25; - this.lineOffset = 0; - this.master = true; - this.svgElements = {}; + if (Array.isArray(rawData)) { + rawData = new DataSet(rawData); + } + var data; + if (rawData instanceof DataSet || rawData instanceof DataView) { + data = rawData.get(); + } + else { + throw new Error('Array, DataSet, or DataView expected'); + } - this.groups = {}; - this.amountOfGroups = 0; + if (data.length == 0) + return; - // create the HTML DOM - this._create(); -} + this.dataSet = rawData; + this.dataTable = data; -DataAxis.prototype = new Component(); + // subscribe to changes in the dataset + this._onChange = function () { + me.setData(me.dataSet); + }; + this.dataSet.on('*', this._onChange); + // _determineColumnIndexes + // getNumberOfRows (points) + // getNumberOfColumns (x,y,z,v,t,t1,t2...) + // getDistinctValues (unique values?) + // getColumnRange + // determine the location of x,y,z,value,filter columns + this.colX = 'x'; + this.colY = 'y'; + this.colZ = 'z'; + this.colValue = 'style'; + this.colFilter = 'filter'; -DataAxis.prototype.addGroup = function(label, graphOptions) { - if (!this.groups.hasOwnProperty(label)) { - this.groups[label] = graphOptions; - } - this.amountOfGroups += 1; -}; -DataAxis.prototype.updateGroup = function(label, graphOptions) { - this.groups[label] = graphOptions; -}; -DataAxis.prototype.removeGroup = function(label) { - if (this.groups.hasOwnProperty(label)) { - delete this.groups[label]; - this.amountOfGroups -= 1; - } -}; - - -DataAxis.prototype.setOptions = function (options) { - if (options) { - var redraw = false; - if (this.options.orientation != options.orientation && options.orientation !== undefined) { - redraw = true; - } - var fields = [ - 'orientation', - 'showMinorLabels', - 'showMajorLabels', - 'icons', - 'majorLinesOffset', - 'minorLinesOffset', - 'labelOffsetX', - 'labelOffsetY', - 'iconWidth', - 'width', - 'visible']; - util.selectiveExtend(fields, this.options, options); - - this.minWidth = Number(('' + this.options.width).replace("px","")); - - if (redraw == true && this.dom.frame) { - this.hide(); - this.show(); + // check if a filter column is provided + if (data[0].hasOwnProperty('filter')) { + if (this.dataFilter === undefined) { + this.dataFilter = new Filter(rawData, this.colFilter, this); + this.dataFilter.setOnLoadCallback(function() {me.redraw();}); + } } - } -}; -/** - * Create the HTML DOM for the DataAxis - */ -DataAxis.prototype._create = function() { - this.dom.frame = document.createElement('div'); - this.dom.frame.style.width = this.options.width; - this.dom.frame.style.height = this.height; - - this.dom.lineContainer = document.createElement('div'); - this.dom.lineContainer.style.width = '100%'; - this.dom.lineContainer.style.height = this.height; - - // create svg element for graph drawing. - this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); - this.svg.style.position = "absolute"; - this.svg.style.top = '0px'; - this.svg.style.height = '100%'; - this.svg.style.width = '100%'; - this.svg.style.display = "block"; - this.dom.frame.appendChild(this.svg); -}; - -DataAxis.prototype._redrawGroupIcons = function () { - DOMutil.prepareElements(this.svgElements); - - var x; - var iconWidth = this.options.iconWidth; - var iconHeight = 15; - var iconOffset = 4; - var y = iconOffset + 0.5 * iconHeight; - - if (this.options.orientation == 'left') { - x = iconOffset; - } - else { - x = this.width - iconWidth - iconOffset; - } + var withBars = this.style == Graph3d.STYLE.BAR || + this.style == Graph3d.STYLE.BARCOLOR || + this.style == Graph3d.STYLE.BARSIZE; + + // determine barWidth from data + if (withBars) { + if (this.defaultXBarWidth !== undefined) { + this.xBarWidth = this.defaultXBarWidth; + } + else { + var dataX = this.getDistinctValues(data,this.colX); + this.xBarWidth = (dataX[1] - dataX[0]) || 1; + } - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight); - y += iconHeight + iconOffset; + if (this.defaultYBarWidth !== undefined) { + this.yBarWidth = this.defaultYBarWidth; + } + else { + var dataY = this.getDistinctValues(data,this.colY); + this.yBarWidth = (dataY[1] - dataY[0]) || 1; + } } - } - DOMutil.cleanupElements(this.svgElements); -}; + // calculate minimums and maximums + var xRange = this.getColumnRange(data,this.colX); + if (withBars) { + xRange.min -= this.xBarWidth / 2; + xRange.max += this.xBarWidth / 2; + } + this.xMin = (this.defaultXMin !== undefined) ? this.defaultXMin : xRange.min; + this.xMax = (this.defaultXMax !== undefined) ? this.defaultXMax : xRange.max; + if (this.xMax <= this.xMin) this.xMax = this.xMin + 1; + this.xStep = (this.defaultXStep !== undefined) ? this.defaultXStep : (this.xMax-this.xMin)/5; -/** - * Create the HTML DOM for the DataAxis - */ -DataAxis.prototype.show = function() { - if (!this.dom.frame.parentNode) { - if (this.options.orientation == 'left') { - this.body.dom.left.appendChild(this.dom.frame); + var yRange = this.getColumnRange(data,this.colY); + if (withBars) { + yRange.min -= this.yBarWidth / 2; + yRange.max += this.yBarWidth / 2; } - else { - this.body.dom.right.appendChild(this.dom.frame); + this.yMin = (this.defaultYMin !== undefined) ? this.defaultYMin : yRange.min; + this.yMax = (this.defaultYMax !== undefined) ? this.defaultYMax : yRange.max; + if (this.yMax <= this.yMin) this.yMax = this.yMin + 1; + this.yStep = (this.defaultYStep !== undefined) ? this.defaultYStep : (this.yMax-this.yMin)/5; + + var zRange = this.getColumnRange(data,this.colZ); + this.zMin = (this.defaultZMin !== undefined) ? this.defaultZMin : zRange.min; + this.zMax = (this.defaultZMax !== undefined) ? this.defaultZMax : zRange.max; + if (this.zMax <= this.zMin) this.zMax = this.zMin + 1; + this.zStep = (this.defaultZStep !== undefined) ? this.defaultZStep : (this.zMax-this.zMin)/5; + + if (this.colValue !== undefined) { + var valueRange = this.getColumnRange(data,this.colValue); + this.valueMin = (this.defaultValueMin !== undefined) ? this.defaultValueMin : valueRange.min; + this.valueMax = (this.defaultValueMax !== undefined) ? this.defaultValueMax : valueRange.max; + if (this.valueMax <= this.valueMin) this.valueMax = this.valueMin + 1; } - } - if (!this.dom.lineContainer.parentNode) { - this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer); - } -}; + // set the scale dependent on the ranges. + this._setScale(); + }; -/** - * Create the HTML DOM for the DataAxis - */ -DataAxis.prototype.hide = function() { - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); - } - if (this.dom.lineContainer.parentNode) { - this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer); - } -}; -/** - * Set a range (start and end) - * @param end - * @param start - * @param end - */ -DataAxis.prototype.setRange = function (start, end) { - this.range.start = start; - this.range.end = end; -}; + /** + * Filter the data based on the current filter + * @param {Array} data + * @return {Array} dataPoints Array with point objects which can be drawn on screen + */ + Graph3d.prototype._getDataPoints = function (data) { + // TODO: store the created matrix dataPoints in the filters instead of reloading each time + var x, y, i, z, obj, point; -/** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ -DataAxis.prototype.redraw = function () { - var changeCalled = false; - if (this.amountOfGroups == 0) { - this.hide(); - } - else { - this.show(); - this.height = Number(this.linegraphSVG.style.height.replace("px","")); - // svg offsetheight did not work in firefox and explorer... + var dataPoints = []; - this.dom.lineContainer.style.height = this.height + 'px'; - this.width = this.options.visible == true ? Number(('' + this.options.width).replace("px","")) : 0; + if (this.style === Graph3d.STYLE.GRID || + this.style === Graph3d.STYLE.SURFACE) { + // copy all values from the google data table to a matrix + // the provided values are supposed to form a grid of (x,y) positions - var props = this.props; - var frame = this.dom.frame; + // create two lists with all present x and y values + var dataX = []; + var dataY = []; + for (i = 0; i < this.getNumberOfRows(data); i++) { + x = data[i][this.colX] || 0; + y = data[i][this.colY] || 0; - // update classname - frame.className = 'dataaxis'; + if (dataX.indexOf(x) === -1) { + dataX.push(x); + } + if (dataY.indexOf(y) === -1) { + dataY.push(y); + } + } - // calculate character width and height - this._calculateCharSize(); + function sortNumber(a, b) { + return a - b; + } + dataX.sort(sortNumber); + dataY.sort(sortNumber); - var orientation = this.options.orientation; - var showMinorLabels = this.options.showMinorLabels; - var showMajorLabels = this.options.showMajorLabels; + // create a grid, a 2d matrix, with all values. + var dataMatrix = []; // temporary data matrix + for (i = 0; i < data.length; i++) { + x = data[i][this.colX] || 0; + y = data[i][this.colY] || 0; + z = data[i][this.colZ] || 0; - // determine the width and height of the elemens for the axis - props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; - props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; + var xIndex = dataX.indexOf(x); // TODO: implement Array().indexOf() for Internet Explorer + var yIndex = dataY.indexOf(y); - props.minorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.minorLinesOffset; - props.minorLineHeight = 1; - props.majorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.majorLinesOffset; - props.majorLineHeight = 1; + if (dataMatrix[xIndex] === undefined) { + dataMatrix[xIndex] = []; + } - // take frame offline while updating (is almost twice as fast) - if (orientation == 'left') { - frame.style.top = '0'; - frame.style.left = '0'; - frame.style.bottom = ''; - frame.style.width = this.width + 'px'; - frame.style.height = this.height + "px"; - } - else { // right - frame.style.top = ''; - frame.style.bottom = '0'; - frame.style.left = '0'; - frame.style.width = this.width + 'px'; - frame.style.height = this.height + "px"; - } - changeCalled = this._redrawLabels(); - if (this.options.icons == true) { - this._redrawGroupIcons(); - } - } - return changeCalled; -}; + var point3d = new Point3d(); + point3d.x = x; + point3d.y = y; + point3d.z = z; -/** - * Repaint major and minor text labels and vertical grid lines - * @private - */ -DataAxis.prototype._redrawLabels = function () { - DOMutil.prepareElements(this.DOMelements); + obj = {}; + obj.point = point3d; + obj.trans = undefined; + obj.screen = undefined; + obj.bottom = new Point3d(x, y, this.zMin); - var orientation = this.options['orientation']; + dataMatrix[xIndex][yIndex] = obj; + + dataPoints.push(obj); + } - // calculate range and step (step such that we have space for 7 characters per label) - var minimumStep = this.master ? this.props.majorCharHeight || 10 : this.stepPixelsForced; - var step = new DataStep(this.range.start, this.range.end, minimumStep, this.dom.frame.offsetHeight); - this.step = step; - step.first(); + // fill in the pointers to the neighbors. + for (x = 0; x < dataMatrix.length; x++) { + for (y = 0; y < dataMatrix[x].length; y++) { + if (dataMatrix[x][y]) { + dataMatrix[x][y].pointRight = (x < dataMatrix.length-1) ? dataMatrix[x+1][y] : undefined; + dataMatrix[x][y].pointTop = (y < dataMatrix[x].length-1) ? dataMatrix[x][y+1] : undefined; + dataMatrix[x][y].pointCross = + (x < dataMatrix.length-1 && y < dataMatrix[x].length-1) ? + dataMatrix[x+1][y+1] : + undefined; + } + } + } + } + else { // 'dot', 'dot-line', etc. + // copy all values from the google data table to a list with Point3d objects + for (i = 0; i < data.length; i++) { + point = new Point3d(); + point.x = data[i][this.colX] || 0; + point.y = data[i][this.colY] || 0; + point.z = data[i][this.colZ] || 0; - // get the distance in pixels for a step - var stepPixels = this.dom.frame.offsetHeight / ((step.marginRange / step.step) + 1); - this.stepPixels = stepPixels; + if (this.colValue !== undefined) { + point.value = data[i][this.colValue] || 0; + } - var amountOfSteps = this.height / stepPixels; - var stepDifference = 0; + obj = {}; + obj.point = point; + obj.bottom = new Point3d(point.x, point.y, this.zMin); + obj.trans = undefined; + obj.screen = undefined; - if (this.master == false) { - stepPixels = this.stepPixelsForced; - stepDifference = Math.round((this.height / stepPixels) - amountOfSteps); - for (var i = 0; i < 0.5 * stepDifference; i++) { - step.previous(); + dataPoints.push(obj); + } } - amountOfSteps = this.height / stepPixels; - } + return dataPoints; + }; - this.valueAtZero = step.marginEnd; - var marginStartPos = 0; + /** + * Create the main frame for the Graph3d. + * This function is executed once when a Graph3d object is created. The frame + * contains a canvas, and this canvas contains all objects like the axis and + * nodes. + */ + Graph3d.prototype.create = function () { + // remove all elements from the container element. + while (this.containerElement.hasChildNodes()) { + this.containerElement.removeChild(this.containerElement.firstChild); + } - // do not draw the first label - var max = 1; - step.next(); + this.frame = document.createElement('div'); + this.frame.style.position = 'relative'; + this.frame.style.overflow = 'hidden'; - this.maxLabelSize = 0; - var y = 0; - while (max < Math.round(amountOfSteps)) { + // create the graph canvas (HTML canvas element) + this.frame.canvas = document.createElement( 'canvas' ); + this.frame.canvas.style.position = 'relative'; + this.frame.appendChild(this.frame.canvas); + //if (!this.frame.canvas.getContext) { + { + var noCanvas = document.createElement( 'DIV' ); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold' ; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.frame.canvas.appendChild(noCanvas); + } + + this.frame.filter = document.createElement( 'div' ); + this.frame.filter.style.position = 'absolute'; + this.frame.filter.style.bottom = '0px'; + this.frame.filter.style.left = '0px'; + this.frame.filter.style.width = '100%'; + this.frame.appendChild(this.frame.filter); + + // add event listeners to handle moving and zooming the contents + var me = this; + var onmousedown = function (event) {me._onMouseDown(event);}; + var ontouchstart = function (event) {me._onTouchStart(event);}; + var onmousewheel = function (event) {me._onWheel(event);}; + var ontooltip = function (event) {me._onTooltip(event);}; + // TODO: these events are never cleaned up... can give a 'memory leakage' + + util.addEventListener(this.frame.canvas, 'keydown', onkeydown); + util.addEventListener(this.frame.canvas, 'mousedown', onmousedown); + util.addEventListener(this.frame.canvas, 'touchstart', ontouchstart); + util.addEventListener(this.frame.canvas, 'mousewheel', onmousewheel); + util.addEventListener(this.frame.canvas, 'mousemove', ontooltip); + + // add the new graph to the container element + this.containerElement.appendChild(this.frame); + }; - y = Math.round(max * stepPixels); - marginStartPos = max * stepPixels; - var isMajor = step.isMajor(); - if (this.options['showMinorLabels'] && isMajor == false || this.master == false && this.options['showMinorLabels'] == true) { - this._redrawLabel(y - 2, step.getCurrent(), orientation, 'yAxis minor', this.props.minorCharHeight); - } + /** + * Set a new size for the graph + * @param {string} width Width in pixels or percentage (for example '800px' + * or '50%') + * @param {string} height Height in pixels or percentage (for example '400px' + * or '30%') + */ + Graph3d.prototype.setSize = function(width, height) { + this.frame.style.width = width; + this.frame.style.height = height; - if (isMajor && this.options['showMajorLabels'] && this.master == true || - this.options['showMinorLabels'] == false && this.master == false && isMajor == true) { + this._resizeCanvas(); + }; - if (y >= 0) { - this._redrawLabel(y - 2, step.getCurrent(), orientation, 'yAxis major', this.props.majorCharHeight); - } - this._redrawLine(y, orientation, 'grid horizontal major', this.options.majorLinesOffset, this.props.majorLineWidth); - } - else { - this._redrawLine(y, orientation, 'grid horizontal minor', this.options.minorLinesOffset, this.props.minorLineWidth); - } + /** + * Resize the canvas to the current size of the frame + */ + Graph3d.prototype._resizeCanvas = function() { + this.frame.canvas.style.width = '100%'; + this.frame.canvas.style.height = '100%'; - step.next(); - max++; - } + this.frame.canvas.width = this.frame.canvas.clientWidth; + this.frame.canvas.height = this.frame.canvas.clientHeight; - this.conversionFactor = marginStartPos/((amountOfSteps-1) * step.step); + // adjust with for margin + this.frame.filter.style.width = (this.frame.canvas.clientWidth - 2 * 10) + 'px'; + }; - var offset = this.options.icons == true ? this.options.iconWidth + this.options.labelOffsetX + 15 : this.options.labelOffsetX + 15; - // this will resize the yAxis to accomodate the labels. - if (this.maxLabelSize > (this.width - offset) && this.options.visible == true) { - this.width = this.maxLabelSize + offset; - this.options.width = this.width + "px"; - DOMutil.cleanupElements(this.DOMelements); - this.redraw(); - return true; - } - // this will resize the yAxis if it is too big for the labels. - else if (this.maxLabelSize < (this.width - offset) && this.options.visible == true && this.width > this.minWidth) { - this.width = Math.max(this.minWidth,this.maxLabelSize + offset); - this.options.width = this.width + "px"; - DOMutil.cleanupElements(this.DOMelements); - this.redraw(); - return true; - } - else { - DOMutil.cleanupElements(this.DOMelements); - return false; - } -}; + /** + * Start animation + */ + Graph3d.prototype.animationStart = function() { + if (!this.frame.filter || !this.frame.filter.slider) + throw 'No animation available'; -/** - * Create a label for the axis at position x - * @private - * @param y - * @param text - * @param orientation - * @param className - * @param characterHeight - */ -DataAxis.prototype._redrawLabel = function (y, text, orientation, className, characterHeight) { - // reuse redundant label - var label = DOMutil.getDOMElement('div',this.DOMelements, this.dom.frame); //this.dom.redundant.labels.shift(); - label.className = className; - label.innerHTML = text; - - if (orientation == 'left') { - label.style.left = '-' + this.options.labelOffsetX + 'px'; - label.style.textAlign = "right"; - } - else { - label.style.right = '-' + this.options.labelOffsetX + 'px'; - label.style.textAlign = "left"; - } + this.frame.filter.slider.play(); + }; - label.style.top = y - 0.5 * characterHeight + this.options.labelOffsetY + 'px'; - text += ''; + /** + * Stop animation + */ + Graph3d.prototype.animationStop = function() { + if (!this.frame.filter || !this.frame.filter.slider) return; - var largestWidth = Math.max(this.props.majorCharWidth,this.props.minorCharWidth); - if (this.maxLabelSize < text.length * largestWidth) { - this.maxLabelSize = text.length * largestWidth; - } -}; + this.frame.filter.slider.stop(); + }; -/** - * Create a minor line for the axis at position y - * @param y - * @param orientation - * @param className - * @param offset - * @param width - */ -DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) { - if (this.master == true) { - var line = DOMutil.getDOMElement('div',this.DOMelements, this.dom.lineContainer);//this.dom.redundant.lines.shift(); - line.className = className; - line.innerHTML = ''; - if (orientation == 'left') { - line.style.left = (this.width - offset) + 'px'; + /** + * Resize the center position based on the current values in this.defaultXCenter + * and this.defaultYCenter (which are strings with a percentage or a value + * in pixels). The center positions are the variables this.xCenter + * and this.yCenter + */ + Graph3d.prototype._resizeCenter = function() { + // calculate the horizontal center position + if (this.defaultXCenter.charAt(this.defaultXCenter.length-1) === '%') { + this.xcenter = + parseFloat(this.defaultXCenter) / 100 * + this.frame.canvas.clientWidth; } else { - line.style.right = (this.width - offset) + 'px'; + this.xcenter = parseFloat(this.defaultXCenter); // supposed to be in px } - line.style.width = width + 'px'; - line.style.top = y + 'px'; - } -}; + // calculate the vertical center position + if (this.defaultYCenter.charAt(this.defaultYCenter.length-1) === '%') { + this.ycenter = + parseFloat(this.defaultYCenter) / 100 * + (this.frame.canvas.clientHeight - this.frame.filter.clientHeight); + } + else { + this.ycenter = parseFloat(this.defaultYCenter); // supposed to be in px + } + }; + /** + * Set the rotation and distance of the camera + * @param {Object} pos An object with the camera position. The object + * contains three parameters: + * - horizontal {Number} + * The horizontal rotation, between 0 and 2*PI. + * Optional, can be left undefined. + * - vertical {Number} + * The vertical rotation, between 0 and 0.5*PI + * if vertical=0.5*PI, the graph is shown from the + * top. Optional, can be left undefined. + * - distance {Number} + * The (normalized) distance of the camera to the + * center of the graph, a value between 0.71 and 5.0. + * Optional, can be left undefined. + */ + Graph3d.prototype.setCameraPosition = function(pos) { + if (pos === undefined) { + return; + } -DataAxis.prototype.convertValue = function (value) { - var invertedValue = this.valueAtZero - value; - var convertedValue = invertedValue * this.conversionFactor; - return convertedValue; // the -2 is to compensate for the borders -}; + if (pos.horizontal !== undefined && pos.vertical !== undefined) { + this.camera.setArmRotation(pos.horizontal, pos.vertical); + } + if (pos.distance !== undefined) { + this.camera.setArmLength(pos.distance); + } -/** - * Determine the size of text on the axis (both major and minor axis). - * The size is calculated only once and then cached in this.props. - * @private - */ -DataAxis.prototype._calculateCharSize = function () { - // determine the char width and height on the minor axis - if (!('minorCharHeight' in this.props)) { + this.redraw(); + }; - var textMinor = document.createTextNode('0'); - var measureCharMinor = document.createElement('DIV'); - measureCharMinor.className = 'yAxis minor measure'; - measureCharMinor.appendChild(textMinor); - this.dom.frame.appendChild(measureCharMinor); - this.props.minorCharHeight = measureCharMinor.clientHeight; - this.props.minorCharWidth = measureCharMinor.clientWidth; + /** + * Retrieve the current camera rotation + * @return {object} An object with parameters horizontal, vertical, and + * distance + */ + Graph3d.prototype.getCameraPosition = function() { + var pos = this.camera.getArmRotation(); + pos.distance = this.camera.getArmLength(); + return pos; + }; - this.dom.frame.removeChild(measureCharMinor); - } + /** + * Load data into the 3D Graph + */ + Graph3d.prototype._readData = function(data) { + // read the data + this._dataInitialize(data, this.style); - if (!('majorCharHeight' in this.props)) { - var textMajor = document.createTextNode('0'); - var measureCharMajor = document.createElement('DIV'); - measureCharMajor.className = 'yAxis major measure'; - measureCharMajor.appendChild(textMajor); - this.dom.frame.appendChild(measureCharMajor); - this.props.majorCharHeight = measureCharMajor.clientHeight; - this.props.majorCharWidth = measureCharMajor.clientWidth; + if (this.dataFilter) { + // apply filtering + this.dataPoints = this.dataFilter._getDataPoints(); + } + else { + // no filtering. load all data + this.dataPoints = this._getDataPoints(this.dataTable); + } - this.dom.frame.removeChild(measureCharMajor); - } -}; + // draw the filter + this._redrawFilter(); + }; -/** - * Snap a date to a rounded value. - * The snap intervals are dependent on the current scale and step. - * @param {Date} date the date to be snapped. - * @return {Date} snappedDate - */ -DataAxis.prototype.snap = function(date) { - return this.step.snap(date); -}; + /** + * Replace the dataset of the Graph3d + * @param {Array | DataSet | DataView} data + */ + Graph3d.prototype.setData = function (data) { + this._readData(data); + this.redraw(); -var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items + // start animation when option is true + if (this.animationAutoStart && this.dataFilter) { + this.animationStart(); + } + }; -/** - * This is the constructor of the LineGraph. It requires a Timeline body and options. - * - * @param body - * @param options - * @constructor - */ -function LineGraph(body, options) { - this.id = util.randomUUID(); - this.body = body; - - this.defaultOptions = { - yAxisOrientation: 'left', - defaultGroup: 'default', - sort: true, - sampling: true, - graphHeight: '400px', - shaded: { - enabled: false, - orientation: 'bottom' // top, bottom - }, - style: 'line', // line, bar - barChart: { - width: 50, - align: 'center' // left, center, right - }, - catmullRom: { - enabled: true, - parametrization: 'centripetal', // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) - alpha: 0.5 - }, - drawPoints: { - enabled: true, - size: 6, - style: 'square' // square, circle - }, - dataAxis: { - showMinorLabels: true, - showMajorLabels: true, - icons: false, - width: '40px', - visible: true - }, - legend: { - enabled: false, - icons: true, - left: { - visible: true, - position: 'top-left' // top/bottom - left,right - }, - right: { - visible: true, - position: 'top-right' // top/bottom - left,right + /** + * Update the options. Options will be merged with current options + * @param {Object} options + */ + Graph3d.prototype.setOptions = function (options) { + var cameraPosition = undefined; + + this.animationStop(); + + if (options !== undefined) { + // retrieve parameter values + if (options.width !== undefined) this.width = options.width; + if (options.height !== undefined) this.height = options.height; + + if (options.xCenter !== undefined) this.defaultXCenter = options.xCenter; + if (options.yCenter !== undefined) this.defaultYCenter = options.yCenter; + + if (options.filterLabel !== undefined) this.filterLabel = options.filterLabel; + if (options.legendLabel !== undefined) this.legendLabel = options.legendLabel; + if (options.xLabel !== undefined) this.xLabel = options.xLabel; + if (options.yLabel !== undefined) this.yLabel = options.yLabel; + if (options.zLabel !== undefined) this.zLabel = options.zLabel; + + if (options.style !== undefined) { + var styleNumber = this._getStyleNumber(options.style); + if (styleNumber !== -1) { + this.style = styleNumber; + } + } + if (options.showGrid !== undefined) this.showGrid = options.showGrid; + if (options.showPerspective !== undefined) this.showPerspective = options.showPerspective; + if (options.showShadow !== undefined) this.showShadow = options.showShadow; + if (options.tooltip !== undefined) this.showTooltip = options.tooltip; + if (options.showAnimationControls !== undefined) this.showAnimationControls = options.showAnimationControls; + if (options.keepAspectRatio !== undefined) this.keepAspectRatio = options.keepAspectRatio; + if (options.verticalRatio !== undefined) this.verticalRatio = options.verticalRatio; + + if (options.animationInterval !== undefined) this.animationInterval = options.animationInterval; + if (options.animationPreload !== undefined) this.animationPreload = options.animationPreload; + if (options.animationAutoStart !== undefined)this.animationAutoStart = options.animationAutoStart; + + if (options.xBarWidth !== undefined) this.defaultXBarWidth = options.xBarWidth; + if (options.yBarWidth !== undefined) this.defaultYBarWidth = options.yBarWidth; + + if (options.xMin !== undefined) this.defaultXMin = options.xMin; + if (options.xStep !== undefined) this.defaultXStep = options.xStep; + if (options.xMax !== undefined) this.defaultXMax = options.xMax; + if (options.yMin !== undefined) this.defaultYMin = options.yMin; + if (options.yStep !== undefined) this.defaultYStep = options.yStep; + if (options.yMax !== undefined) this.defaultYMax = options.yMax; + if (options.zMin !== undefined) this.defaultZMin = options.zMin; + if (options.zStep !== undefined) this.defaultZStep = options.zStep; + if (options.zMax !== undefined) this.defaultZMax = options.zMax; + if (options.valueMin !== undefined) this.defaultValueMin = options.valueMin; + if (options.valueMax !== undefined) this.defaultValueMax = options.valueMax; + + if (options.cameraPosition !== undefined) cameraPosition = options.cameraPosition; + + if (cameraPosition !== undefined) { + this.camera.setArmRotation(cameraPosition.horizontal, cameraPosition.vertical); + this.camera.setArmLength(cameraPosition.distance); + } + else { + this.camera.setArmRotation(1.0, 0.5); + this.camera.setArmLength(1.7); } } - }; - // options is shared by this ItemSet and all its items - this.options = util.extend({}, this.defaultOptions); - this.dom = {}; - this.props = {}; - this.hammer = null; - this.groups = {}; + this._setBackgroundColor(options && options.backgroundColor); - var me = this; - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet + this.setSize(this.width, this.height); - // listeners for the DataSet of the items - this.itemListeners = { - 'add': function (event, params, senderId) { - me._onAdd(params.items); - }, - 'update': function (event, params, senderId) { - me._onUpdate(params.items); - }, - 'remove': function (event, params, senderId) { - me._onRemove(params.items); + // re-load the data + if (this.dataTable) { + this.setData(this.dataTable); } - }; - // listeners for the DataSet of the groups - this.groupListeners = { - 'add': function (event, params, senderId) { - me._onAddGroups(params.items); - }, - 'update': function (event, params, senderId) { - me._onUpdateGroups(params.items); - }, - 'remove': function (event, params, senderId) { - me._onRemoveGroups(params.items); + // start animation when option is true + if (this.animationAutoStart && this.dataFilter) { + this.animationStart(); } }; - this.items = {}; // object with an Item for every data item - this.selection = []; // list with the ids of all selected nodes - this.lastStart = this.body.range.start; - this.touchParams = {}; // stores properties while dragging + /** + * Redraw the Graph. + */ + Graph3d.prototype.redraw = function() { + if (this.dataPoints === undefined) { + throw 'Error: graph data not initialized'; + } - this.svgElements = {}; - this.setOptions(options); - this.groupsUsingDefaultStyles = [0]; + this._resizeCanvas(); + this._resizeCenter(); + this._redrawSlider(); + this._redrawClear(); + this._redrawAxis(); - this.body.emitter.on("rangechange",function() { - if (me.lastStart != 0) { - var offset = me.body.range.start - me.lastStart; - var range = me.body.range.end - me.body.range.start; - if (me.width != 0) { - var rangePerPixelInv = me.width/range; - var xOffset = offset * rangePerPixelInv; - me.svg.style.left = (-me.width - xOffset) + "px"; - } - } - }); - this.body.emitter.on("rangechanged", function() { - me.lastStart = me.body.range.start; - me.svg.style.left = util.option.asSize(-me.width); - me._updateGraph.apply(me); - }); + if (this.style === Graph3d.STYLE.GRID || + this.style === Graph3d.STYLE.SURFACE) { + this._redrawDataGrid(); + } + else if (this.style === Graph3d.STYLE.LINE) { + this._redrawDataLine(); + } + else if (this.style === Graph3d.STYLE.BAR || + this.style === Graph3d.STYLE.BARCOLOR || + this.style === Graph3d.STYLE.BARSIZE) { + this._redrawDataBar(); + } + else { + // style is DOT, DOTLINE, DOTCOLOR, DOTSIZE + this._redrawDataDot(); + } - // create the HTML DOM - this._create(); - this.body.emitter.emit("change"); -} + this._redrawInfo(); + this._redrawLegend(); + }; -LineGraph.prototype = new Component(); + /** + * Clear the canvas before redrawing + */ + Graph3d.prototype._redrawClear = function() { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); -/** - * Create the HTML DOM for the ItemSet - */ -LineGraph.prototype._create = function(){ - var frame = document.createElement('div'); - frame.className = 'LineGraph'; - this.dom.frame = frame; + ctx.clearRect(0, 0, canvas.width, canvas.height); + }; - // create svg element for graph drawing. - this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); - this.svg.style.position = "relative"; - this.svg.style.height = ('' + this.options.graphHeight).replace("px",'') + 'px'; - this.svg.style.display = "block"; - frame.appendChild(this.svg); - // data axis - this.options.dataAxis.orientation = 'left'; - this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg); + /** + * Redraw the legend showing the colors + */ + Graph3d.prototype._redrawLegend = function() { + var y; - this.options.dataAxis.orientation = 'right'; - this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg); - delete this.options.dataAxis.orientation; + if (this.style === Graph3d.STYLE.DOTCOLOR || + this.style === Graph3d.STYLE.DOTSIZE) { - // legends - this.legendLeft = new Legend(this.body, this.options.legend, 'left'); - this.legendRight = new Legend(this.body, this.options.legend, 'right'); + var dotSize = this.frame.clientWidth * 0.02; - this.show(); -}; + var widthMin, widthMax; + if (this.style === Graph3d.STYLE.DOTSIZE) { + widthMin = dotSize / 2; // px + widthMax = dotSize / 2 + dotSize * 2; // Todo: put this in one function + } + else { + widthMin = 20; // px + widthMax = 20; // px + } -/** - * set the options of the LineGraph. the mergeOptions is used for subObjects that have an enabled element. - * @param options - */ -LineGraph.prototype.setOptions = function(options) { - if (options) { - var fields = ['sampling','defaultGroup','graphHeight','yAxisOrientation','style','barChart','dataAxis','sort']; - util.selectiveDeepExtend(fields, this.options, options); - util.mergeOptions(this.options, options,'catmullRom'); - util.mergeOptions(this.options, options,'drawPoints'); - util.mergeOptions(this.options, options,'shaded'); - util.mergeOptions(this.options, options,'legend'); + var height = Math.max(this.frame.clientHeight * 0.25, 100); + var top = this.margin; + var right = this.frame.clientWidth - this.margin; + var left = right - widthMax; + var bottom = top + height; + } - if (options.catmullRom) { - if (typeof options.catmullRom == 'object') { - if (options.catmullRom.parametrization) { - if (options.catmullRom.parametrization == 'uniform') { - this.options.catmullRom.alpha = 0; - } - else if (options.catmullRom.parametrization == 'chordal') { - this.options.catmullRom.alpha = 1.0; - } - else { - this.options.catmullRom.parametrization = 'centripetal'; - this.options.catmullRom.alpha = 0.5; - } - } + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + ctx.lineWidth = 1; + ctx.font = '14px arial'; // TODO: put in options + + if (this.style === Graph3d.STYLE.DOTCOLOR) { + // draw the color bar + var ymin = 0; + var ymax = height; // Todo: make height customizable + for (y = ymin; y < ymax; y++) { + var f = (y - ymin) / (ymax - ymin); + + //var width = (dotSize / 2 + (1-f) * dotSize * 2); // Todo: put this in one function + var hue = f * 240; + var color = this._hsv2rgb(hue, 1, 1); + + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(left, top + y); + ctx.lineTo(right, top + y); + ctx.stroke(); } + + ctx.strokeStyle = this.colorAxis; + ctx.strokeRect(left, top, widthMax, height); } - if (this.yAxisLeft) { - if (options.dataAxis !== undefined) { - this.yAxisLeft.setOptions(this.options.dataAxis); - this.yAxisRight.setOptions(this.options.dataAxis); - } + if (this.style === Graph3d.STYLE.DOTSIZE) { + // draw border around color bar + ctx.strokeStyle = this.colorAxis; + ctx.fillStyle = this.colorDot; + ctx.beginPath(); + ctx.moveTo(left, top); + ctx.lineTo(right, top); + ctx.lineTo(right - widthMax + widthMin, bottom); + ctx.lineTo(left, bottom); + ctx.closePath(); + ctx.fill(); + ctx.stroke(); } - if (this.legendLeft) { - if (options.legend !== undefined) { - this.legendLeft.setOptions(this.options.legend); - this.legendRight.setOptions(this.options.legend); + if (this.style === Graph3d.STYLE.DOTCOLOR || + this.style === Graph3d.STYLE.DOTSIZE) { + // print values along the color bar + var gridLineLen = 5; // px + var step = new StepNumber(this.valueMin, this.valueMax, (this.valueMax-this.valueMin)/5, true); + step.start(); + if (step.getCurrent() < this.valueMin) { + step.next(); } - } + while (!step.end()) { + y = bottom - (step.getCurrent() - this.valueMin) / (this.valueMax - this.valueMin) * height; + + ctx.beginPath(); + ctx.moveTo(left - gridLineLen, y); + ctx.lineTo(left, y); + ctx.stroke(); - if (this.groups.hasOwnProperty(UNGROUPED)) { - this.groups[UNGROUPED].setOptions(options); + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.colorAxis; + ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y); + + step.next(); + } + + ctx.textAlign = 'right'; + ctx.textBaseline = 'top'; + var label = this.legendLabel; + ctx.fillText(label, right, bottom + this.margin); } - } - if (this.dom.frame) { - this._updateGraph(); - } -}; + }; -/** - * Hide the component from the DOM - */ -LineGraph.prototype.hide = function() { - // remove the frame containing the items - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); - } -}; + /** + * Redraw the filter + */ + Graph3d.prototype._redrawFilter = function() { + this.frame.filter.innerHTML = ''; -/** - * Show the component in the DOM (when not already visible). - * @return {Boolean} changed - */ -LineGraph.prototype.show = function() { - // show frame containing the items - if (!this.dom.frame.parentNode) { - this.body.dom.center.appendChild(this.dom.frame); - } -}; + if (this.dataFilter) { + var options = { + 'visible': this.showAnimationControls + }; + var slider = new Slider(this.frame.filter, options); + this.frame.filter.slider = slider; + // TODO: css here is not nice here... + this.frame.filter.style.padding = '10px'; + //this.frame.filter.style.backgroundColor = '#EFEFEF'; -/** - * Set items - * @param {vis.DataSet | null} items - */ -LineGraph.prototype.setItems = function(items) { - var me = this, - ids, - oldItemsData = this.itemsData; - - // replace the dataset - if (!items) { - this.itemsData = null; - } - else if (items instanceof DataSet || items instanceof DataView) { - this.itemsData = items; - } - else { - throw new TypeError('Data must be an instance of DataSet or DataView'); - } + slider.setValues(this.dataFilter.values); + slider.setPlayInterval(this.animationInterval); - if (oldItemsData) { - // unsubscribe from old dataset - util.forEach(this.itemListeners, function (callback, event) { - oldItemsData.off(event, callback); - }); + // create an event handler + var me = this; + var onchange = function () { + var index = slider.getIndex(); - // remove all drawn items - ids = oldItemsData.getIds(); - this._onRemove(ids); - } + me.dataFilter.selectValue(index); + me.dataPoints = me.dataFilter._getDataPoints(); - if (this.itemsData) { - // subscribe to new dataset - var id = this.id; - util.forEach(this.itemListeners, function (callback, event) { - me.itemsData.on(event, callback, id); - }); + me.redraw(); + }; + slider.setOnChangeCallback(onchange); + } + else { + this.frame.filter.slider = undefined; + } + }; - // add all new items - ids = this.itemsData.getIds(); - this._onAdd(ids); - } - this._updateUngrouped(); - this._updateGraph(); - this.redraw(); -}; + /** + * Redraw the slider + */ + Graph3d.prototype._redrawSlider = function() { + if ( this.frame.filter.slider !== undefined) { + this.frame.filter.slider.redraw(); + } + }; -/** - * Set groups - * @param {vis.DataSet} groups - */ -LineGraph.prototype.setGroups = function(groups) { - var me = this, - ids; - - // unsubscribe from current dataset - if (this.groupsData) { - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.unsubscribe(event, callback); - }); - // remove all drawn groups - ids = this.groupsData.getIds(); - this.groupsData = null; - this._onRemoveGroups(ids); // note: this will cause a redraw - } + /** + * Redraw common information + */ + Graph3d.prototype._redrawInfo = function() { + if (this.dataFilter) { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + + ctx.font = '14px arial'; // TODO: put in options + ctx.lineStyle = 'gray'; + ctx.fillStyle = 'gray'; + ctx.textAlign = 'left'; + ctx.textBaseline = 'top'; - // replace the dataset - if (!groups) { - this.groupsData = null; - } - else if (groups instanceof DataSet || groups instanceof DataView) { - this.groupsData = groups; - } - else { - throw new TypeError('Data must be an instance of DataSet or DataView'); - } + var x = this.margin; + var y = this.margin; + ctx.fillText(this.dataFilter.getLabel() + ': ' + this.dataFilter.getSelectedValue(), x, y); + } + }; - if (this.groupsData) { - // subscribe to new dataset - var id = this.id; - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.on(event, callback, id); - }); - // draw all ms - ids = this.groupsData.getIds(); - this._onAddGroups(ids); - } - this._onUpdate(); -}; - - - -LineGraph.prototype._onUpdate = function(ids) { - this._updateUngrouped(); - this._updateAllGroupData(); - this._updateGraph(); - this.redraw(); -}; -LineGraph.prototype._onAdd = function (ids) {this._onUpdate(ids);}; -LineGraph.prototype._onRemove = function (ids) {this._onUpdate(ids);}; -LineGraph.prototype._onUpdateGroups = function (groupIds) { - for (var i = 0; i < groupIds.length; i++) { - var group = this.groupsData.get(groupIds[i]); - this._updateGroup(group, groupIds[i]); - } + /** + * Redraw the axis + */ + Graph3d.prototype._redrawAxis = function() { + var canvas = this.frame.canvas, + ctx = canvas.getContext('2d'), + from, to, step, prettyStep, + text, xText, yText, zText, + offset, xOffset, yOffset, + xMin2d, xMax2d; + + // TODO: get the actual rendered style of the containerElement + //ctx.font = this.containerElement.style.font; + ctx.font = 24 / this.camera.getArmLength() + 'px arial'; + + // calculate the length for the short grid lines + var gridLenX = 0.025 / this.scale.x; + var gridLenY = 0.025 / this.scale.y; + var textMargin = 5 / this.camera.getArmLength(); // px + var armAngle = this.camera.getArmRotation().horizontal; + + // draw x-grid lines + ctx.lineWidth = 1; + prettyStep = (this.defaultXStep === undefined); + step = new StepNumber(this.xMin, this.xMax, this.xStep, prettyStep); + step.start(); + if (step.getCurrent() < this.xMin) { + step.next(); + } + while (!step.end()) { + var x = step.getCurrent(); + + if (this.showGrid) { + from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorGrid; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } + else { + from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(x, this.yMin+gridLenX, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); - this._updateGraph(); - this.redraw(); -}; -LineGraph.prototype._onAddGroups = function (groupIds) {this._onUpdateGroups(groupIds);}; + from = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); + to = this._convert3Dto2D(new Point3d(x, this.yMax-gridLenX, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } -LineGraph.prototype._onRemoveGroups = function (groupIds) { - for (var i = 0; i < groupIds.length; i++) { - if (!this.groups.hasOwnProperty(groupIds[i])) { - if (this.groups[groupIds[i]].options.yAxisOrientation == 'right') { - this.yAxisRight.removeGroup(groupIds[i]); - this.legendRight.removeGroup(groupIds[i]); - this.legendRight.redraw(); + yText = (Math.cos(armAngle) > 0) ? this.yMin : this.yMax; + text = this._convert3Dto2D(new Point3d(x, yText, this.zMin)); + if (Math.cos(armAngle * 2) > 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + text.y += textMargin; + } + else if (Math.sin(armAngle * 2) < 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; } else { - this.yAxisLeft.removeGroup(groupIds[i]); - this.legendLeft.removeGroup(groupIds[i]); - this.legendLeft.redraw(); + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; } - delete this.groups[groupIds[i]]; + ctx.fillStyle = this.colorAxis; + ctx.fillText(' ' + step.getCurrent() + ' ', text.x, text.y); + + step.next(); } - } - this._updateUngrouped(); - this._updateGraph(); - this.redraw(); -}; -/** - * update a group object - * - * @param group - * @param groupId - * @private - */ -LineGraph.prototype._updateGroup = function (group, groupId) { - if (!this.groups.hasOwnProperty(groupId)) { - this.groups[groupId] = new GraphGroup(group, groupId, this.options, this.groupsUsingDefaultStyles); - if (this.groups[groupId].options.yAxisOrientation == 'right') { - this.yAxisRight.addGroup(groupId, this.groups[groupId]); - this.legendRight.addGroup(groupId, this.groups[groupId]); + // draw y-grid lines + ctx.lineWidth = 1; + prettyStep = (this.defaultYStep === undefined); + step = new StepNumber(this.yMin, this.yMax, this.yStep, prettyStep); + step.start(); + if (step.getCurrent() < this.yMin) { + step.next(); } - else { - this.yAxisLeft.addGroup(groupId, this.groups[groupId]); - this.legendLeft.addGroup(groupId, this.groups[groupId]); + while (!step.end()) { + if (this.showGrid) { + from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); + ctx.strokeStyle = this.colorGrid; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } + else { + from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMin+gridLenY, step.getCurrent(), this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + + from = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMax-gridLenY, step.getCurrent(), this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + } + + xText = (Math.sin(armAngle ) > 0) ? this.xMin : this.xMax; + text = this._convert3Dto2D(new Point3d(xText, step.getCurrent(), this.zMin)); + if (Math.cos(armAngle * 2) < 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + text.y += textMargin; + } + else if (Math.sin(armAngle * 2) > 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } + else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + } + ctx.fillStyle = this.colorAxis; + ctx.fillText(' ' + step.getCurrent() + ' ', text.x, text.y); + + step.next(); } - } - else { - this.groups[groupId].update(group); - if (this.groups[groupId].options.yAxisOrientation == 'right') { - this.yAxisRight.updateGroup(groupId, this.groups[groupId]); - this.legendRight.updateGroup(groupId, this.groups[groupId]); + + // draw z-grid lines and axis + ctx.lineWidth = 1; + prettyStep = (this.defaultZStep === undefined); + step = new StepNumber(this.zMin, this.zMax, this.zStep, prettyStep); + step.start(); + if (step.getCurrent() < this.zMin) { + step.next(); } - else { - this.yAxisLeft.updateGroup(groupId, this.groups[groupId]); - this.legendLeft.updateGroup(groupId, this.groups[groupId]); + xText = (Math.cos(armAngle ) > 0) ? this.xMin : this.xMax; + yText = (Math.sin(armAngle ) < 0) ? this.yMin : this.yMax; + while (!step.end()) { + // TODO: make z-grid lines really 3d? + from = this._convert3Dto2D(new Point3d(xText, yText, step.getCurrent())); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(from.x - textMargin, from.y); + ctx.stroke(); + + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.colorAxis; + ctx.fillText(step.getCurrent() + ' ', from.x - 5, from.y); + + step.next(); } - } - this.legendLeft.redraw(); - this.legendRight.redraw(); -}; + ctx.lineWidth = 1; + from = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); + to = this._convert3Dto2D(new Point3d(xText, yText, this.zMax)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); -LineGraph.prototype._updateAllGroupData = function () { - if (this.itemsData != null) { - // ~450 ms @ 500k + // draw x-axis + ctx.lineWidth = 1; + // line at yMin + xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); + xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(xMin2d.x, xMin2d.y); + ctx.lineTo(xMax2d.x, xMax2d.y); + ctx.stroke(); + // line at ymax + xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); + xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(xMin2d.x, xMin2d.y); + ctx.lineTo(xMax2d.x, xMax2d.y); + ctx.stroke(); - var groupsContent = {}; - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - groupsContent[groupId] = []; + // draw y-axis + ctx.lineWidth = 1; + // line at xMin + from = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + // line at xMax + from = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); + to = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); + ctx.strokeStyle = this.colorAxis; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); + + // draw x-label + var xLabel = this.xLabel; + if (xLabel.length > 0) { + yOffset = 0.1 / this.scale.y; + xText = (this.xMin + this.xMax) / 2; + yText = (Math.cos(armAngle) > 0) ? this.yMin - yOffset: this.yMax + yOffset; + text = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); + if (Math.cos(armAngle * 2) > 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + } + else if (Math.sin(armAngle * 2) < 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; } - } - for (var itemId in this.itemsData._data) { - if (this.itemsData._data.hasOwnProperty(itemId)) { - var item = this.itemsData._data[itemId]; - item.x = util.convert(item.x,"Date"); - groupsContent[item.group].push(item); + else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; } + ctx.fillStyle = this.colorAxis; + ctx.fillText(xLabel, text.x, text.y); } - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - this.groups[groupId].setItems(groupsContent[groupId]); - } - } -// // ~4500ms @ 500k -// for (var groupId in this.groups) { -// if (this.groups.hasOwnProperty(groupId)) { -// this.groups[groupId].setItems(this.itemsData.get({filter: -// function (item) { -// return (item.group == groupId); -// }, type:{x:"Date"}} -// )); -// } -// } - } -}; -/** - * Create or delete the group holding all ungrouped items. This group is used when - * there are no groups specified. This anonymous group is called 'graph'. - * @protected - */ -LineGraph.prototype._updateUngrouped = function() { - if (this.itemsData != null) { -// var t0 = new Date(); - var group = {id: UNGROUPED, content: this.options.defaultGroup}; - this._updateGroup(group, UNGROUPED); - var ungroupedCounter = 0; - if (this.itemsData) { - for (var itemId in this.itemsData._data) { - if (this.itemsData._data.hasOwnProperty(itemId)) { - var item = this.itemsData._data[itemId]; - if (item != undefined) { - if (item.hasOwnProperty('group')) { - if (item.group === undefined) { - item.group = UNGROUPED; - } - } - else { - item.group = UNGROUPED; - } - ungroupedCounter = item.group == UNGROUPED ? ungroupedCounter + 1 : ungroupedCounter; - } - } + // draw y-label + var yLabel = this.yLabel; + if (yLabel.length > 0) { + xOffset = 0.1 / this.scale.x; + xText = (Math.sin(armAngle ) > 0) ? this.xMin - xOffset : this.xMax + xOffset; + yText = (this.yMin + this.yMax) / 2; + text = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); + if (Math.cos(armAngle * 2) < 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; } + else if (Math.sin(armAngle * 2) > 0){ + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } + else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + } + ctx.fillStyle = this.colorAxis; + ctx.fillText(yLabel, text.x, text.y); } - // much much slower -// var datapoints = this.itemsData.get({ -// filter: function (item) {return item.group === undefined;}, -// showInternalIds:true -// }); -// if (datapoints.length > 0) { -// var updateQuery = []; -// for (var i = 0; i < datapoints.length; i++) { -// updateQuery.push({id:datapoints[i].id, group: UNGROUPED}); -// } -// this.itemsData.update(updateQuery, true); -// } -// var t1 = new Date(); -// var pointInUNGROUPED = this.itemsData.get({filter: function (item) {return item.group == UNGROUPED;}}); - if (ungroupedCounter == 0) { - delete this.groups[UNGROUPED]; - this.legendLeft.removeGroup(UNGROUPED); - this.legendRight.removeGroup(UNGROUPED); - this.yAxisLeft.removeGroup(UNGROUPED); - this.yAxisRight.removeGroup(UNGROUPED); + // draw z-label + var zLabel = this.zLabel; + if (zLabel.length > 0) { + offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis? + xText = (Math.cos(armAngle ) > 0) ? this.xMin : this.xMax; + yText = (Math.sin(armAngle ) < 0) ? this.yMin : this.yMax; + zText = (this.zMin + this.zMax) / 2; + text = this._convert3Dto2D(new Point3d(xText, yText, zText)); + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.colorAxis; + ctx.fillText(zLabel, text.x - offset, text.y); } -// console.log("getting amount ungrouped",new Date() - t1); -// console.log("putting in ungrouped",new Date() - t0); - } - else { - delete this.groups[UNGROUPED]; - this.legendLeft.removeGroup(UNGROUPED); - this.legendRight.removeGroup(UNGROUPED); - this.yAxisLeft.removeGroup(UNGROUPED); - this.yAxisRight.removeGroup(UNGROUPED); - } + }; - this.legendLeft.redraw(); - this.legendRight.redraw(); -}; + /** + * Calculate the color based on the given value. + * @param {Number} H Hue, a value be between 0 and 360 + * @param {Number} S Saturation, a value between 0 and 1 + * @param {Number} V Value, a value between 0 and 1 + */ + Graph3d.prototype._hsv2rgb = function(H, S, V) { + var R, G, B, C, Hi, X; + C = V * S; + Hi = Math.floor(H/60); // hi = 0,1,2,3,4,5 + X = C * (1 - Math.abs(((H/60) % 2) - 1)); -/** - * Redraw the component, mandatory function - * @return {boolean} Returns true if the component is resized - */ -LineGraph.prototype.redraw = function() { - var resized = false; + switch (Hi) { + case 0: R = C; G = X; B = 0; break; + case 1: R = X; G = C; B = 0; break; + case 2: R = 0; G = C; B = X; break; + case 3: R = 0; G = X; B = C; break; + case 4: R = X; G = 0; B = C; break; + case 5: R = C; G = 0; B = X; break; - this.svg.style.height = ('' + this.options.graphHeight).replace('px','') + 'px'; - if (this.lastWidth === undefined && this.width || this.lastWidth != this.width) { - resized = true; - } - // check if this component is resized - resized = this._isResized() || resized; - // check whether zoomed (in that case we need to re-stack everything) - var visibleInterval = this.body.range.end - this.body.range.start; - var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.width != this.lastWidth); - this.lastVisibleInterval = visibleInterval; - this.lastWidth = this.width; - - // calculate actual size and position - this.width = this.dom.frame.offsetWidth; - - // the svg element is three times as big as the width, this allows for fully dragging left and right - // without reloading the graph. the controls for this are bound to events in the constructor - if (resized == true) { - this.svg.style.width = util.option.asSize(3*this.width); - this.svg.style.left = util.option.asSize(-this.width); - } - if (zoomed == true) { - this._updateGraph(); - } + default: R = 0; G = 0; B = 0; break; + } - this.legendLeft.redraw(); - this.legendRight.redraw(); + return 'RGB(' + parseInt(R*255) + ',' + parseInt(G*255) + ',' + parseInt(B*255) + ')'; + }; - return resized; -}; -/** - * Update and redraw the graph. - * - */ -LineGraph.prototype._updateGraph = function () { - // reset the svg elements - DOMutil.prepareElements(this.svgElements); -// // very slow... -// groupData = group.itemsData.get({filter: -// function (item) { -// return (item.x > minDate && item.x < maxDate); -// }} -// ); - - - if (this.width != 0 && this.itemsData != null) { - var group, groupData, preprocessedGroup, i; - var preprocessedGroupData = []; - var processedGroupData = []; - var groupRanges = []; - var changeCalled = false; + /** + * Draw all datapoints as a grid + * This function can be used when the style is 'grid' + */ + Graph3d.prototype._redrawDataGrid = function() { + var canvas = this.frame.canvas, + ctx = canvas.getContext('2d'), + point, right, top, cross, + i, + topSideVisible, fillStyle, strokeStyle, lineWidth, + h, s, v, zAvg; - // getting group Ids - var groupIds = []; - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - groupIds.push(groupId); - } + + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? + + // calculate the translations and screen position of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); + + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; + + // calculate the translation of the point at the bottom (needed for sorting) + var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); + this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; } - // this is the range of the SVG canvas - var minDate = this.body.util.toGlobalTime(- this.body.domProps.root.width); - var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width); + // sort the points on depth of their (x,y) position (not on z) + var sortDepth = function (a, b) { + return b.dist - a.dist; + }; + this.dataPoints.sort(sortDepth); + + if (this.style === Graph3d.STYLE.SURFACE) { + for (i = 0; i < this.dataPoints.length; i++) { + point = this.dataPoints[i]; + right = this.dataPoints[i].pointRight; + top = this.dataPoints[i].pointTop; + cross = this.dataPoints[i].pointCross; + + if (point !== undefined && right !== undefined && top !== undefined && cross !== undefined) { + + if (this.showGrayBottom || this.showShadow) { + // calculate the cross product of the two vectors from center + // to left and right, in order to know whether we are looking at the + // bottom or at the top side. We can also use the cross product + // for calculating light intensity + var aDiff = Point3d.subtract(cross.trans, point.trans); + var bDiff = Point3d.subtract(top.trans, right.trans); + var crossproduct = Point3d.crossProduct(aDiff, bDiff); + var len = crossproduct.length(); + // FIXME: there is a bug with determining the surface side (shadow or colored) + + topSideVisible = (crossproduct.z > 0); + } + else { + topSideVisible = true; + } + + if (topSideVisible) { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + zAvg = (point.point.z + right.point.z + top.point.z + cross.point.z) / 4; + h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; + s = 1; // saturation - // first select and preprocess the data from the datasets. - // the groups have their preselection of data, we now loop over this data to see - // what data we need to draw. Sorted data is much faster. - // more optimization is possible by doing the sampling before and using the binary search - // to find the end date to determine the increment. - if (groupIds.length > 0) { - for (i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - groupData = []; - // optimization for sorted data - if (group.options.sort == true) { - var guess = Math.max(0,util.binarySearchGeneric(group.itemsData, minDate, 'x', 'before')); - - for (var j = guess; j < group.itemsData.length; j++) { - var item = group.itemsData[j]; - if (item !== undefined) { - if (item.x > maxDate) { - groupData.push(item); - break; - } - else { - groupData.push(item); - } + if (this.showShadow) { + v = Math.min(1 + (crossproduct.x / len) / 2, 1); // value. TODO: scale + fillStyle = this._hsv2rgb(h, s, v); + strokeStyle = fillStyle; } - } - } - else { - for (var j = 0; j < group.itemsData.length; j++) { - var item = group.itemsData[j]; - if (item !== undefined) { - if (item.x > minDate && item.x < maxDate) { - groupData.push(item); - } + else { + v = 1; + fillStyle = this._hsv2rgb(h, s, v); + strokeStyle = this.colorAxis; } } + else { + fillStyle = 'gray'; + strokeStyle = this.colorAxis; + } + lineWidth = 0.5; + + ctx.lineWidth = lineWidth; + ctx.fillStyle = fillStyle; + ctx.strokeStyle = strokeStyle; + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); + ctx.lineTo(right.screen.x, right.screen.y); + ctx.lineTo(cross.screen.x, cross.screen.y); + ctx.lineTo(top.screen.x, top.screen.y); + ctx.closePath(); + ctx.fill(); + ctx.stroke(); + } + } + } + else { // grid style + for (i = 0; i < this.dataPoints.length; i++) { + point = this.dataPoints[i]; + right = this.dataPoints[i].pointRight; + top = this.dataPoints[i].pointTop; + + if (point !== undefined) { + if (this.showPerspective) { + lineWidth = 2 / -point.trans.z; + } + else { + lineWidth = 2 * -(this.eye.z / this.camera.getArmLength()); + } } - // preprocess, split into ranges and data - preprocessedGroup = this._preprocessData(groupData, group); - groupRanges.push({min: preprocessedGroup.min, max: preprocessedGroup.max}); - preprocessedGroupData.push(preprocessedGroup.data); - } - - // update the Y axis first, we use this data to draw at the correct Y points - // changeCalled is required to clean the SVG on a change emit. - changeCalled = this._updateYAxis(groupIds, groupRanges); - if (changeCalled == true) { - DOMutil.cleanupElements(this.svgElements); - this.body.emitter.emit("change"); - return; - } - // with the yAxis scaled correctly, use this to get the Y values of the points. - for (i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - processedGroupData.push(this._convertYvalues(preprocessedGroupData[i],group)) - } + if (point !== undefined && right !== undefined) { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + zAvg = (point.point.z + right.point.z) / 2; + h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; - // draw the groups - for (i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - if (group.options.style == 'line') { - this._drawLineGraph(processedGroupData[i], group); + ctx.lineWidth = lineWidth; + ctx.strokeStyle = this._hsv2rgb(h, 1, 1); + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); + ctx.lineTo(right.screen.x, right.screen.y); + ctx.stroke(); } - else { - this._drawBarGraph (processedGroupData[i], group); - } - } - } - } - - // cleanup unused svg elements - DOMutil.cleanupElements(this.svgElements); -}; - -/** - * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden. - * @param {array} groupIds - * @private - */ -LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { - var changeCalled = false; - var yAxisLeftUsed = false; - var yAxisRightUsed = false; - var minLeft = 1e9, minRight = 1e9, maxLeft = -1e9, maxRight = -1e9, minVal, maxVal; - var orientation = 'left'; - - // if groups are present - if (groupIds.length > 0) { - for (var i = 0; i < groupIds.length; i++) { - orientation = 'left'; - var group = this.groups[groupIds[i]]; - if (group.options.yAxisOrientation == 'right') { - orientation = 'right'; - } - minVal = groupRanges[i].min; - maxVal = groupRanges[i].max; + if (point !== undefined && top !== undefined) { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + zAvg = (point.point.z + top.point.z) / 2; + h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; - if (orientation == 'left') { - yAxisLeftUsed = true; - minLeft = minLeft > minVal ? minVal : minLeft; - maxLeft = maxLeft < maxVal ? maxVal : maxLeft; - } - else { - yAxisRightUsed = true; - minRight = minRight > minVal ? minVal : minRight; - maxRight = maxRight < maxVal ? maxVal : maxRight; + ctx.lineWidth = lineWidth; + ctx.strokeStyle = this._hsv2rgb(h, 1, 1); + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); + ctx.lineTo(top.screen.x, top.screen.y); + ctx.stroke(); + } } } - if (yAxisLeftUsed == true) { - this.yAxisLeft.setRange(minLeft, maxLeft); - } - if (yAxisRightUsed == true) { - this.yAxisRight.setRange(minRight, maxRight); - } - } + }; - changeCalled = this._toggleAxisVisiblity(yAxisLeftUsed , this.yAxisLeft) || changeCalled; - changeCalled = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || changeCalled; - if (yAxisRightUsed == true && yAxisLeftUsed == true) { - this.yAxisLeft.drawIcons = true; - this.yAxisRight.drawIcons = true; - } - else { - this.yAxisLeft.drawIcons = false; - this.yAxisRight.drawIcons = false; - } + /** + * Draw all datapoints as dots. + * This function can be used when the style is 'dot' or 'dot-line' + */ + Graph3d.prototype._redrawDataDot = function() { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + var i; - this.yAxisRight.master = !yAxisLeftUsed; + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? - if (this.yAxisRight.master == false) { - if (yAxisRightUsed == true) { - this.yAxisLeft.lineOffset = this.yAxisRight.width; - } - changeCalled = this.yAxisLeft.redraw() || changeCalled; - this.yAxisRight.stepPixelsForced = this.yAxisLeft.stepPixels; - changeCalled = this.yAxisRight.redraw() || changeCalled; - } - else { - changeCalled = this.yAxisRight.redraw() || changeCalled; - } - return changeCalled; -}; + // calculate the translations of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; -/** - * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function - * - * @param {boolean} axisUsed - * @returns {boolean} - * @private - * @param axis - */ -LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) { - var changed = false; - if (axisUsed == false) { - if (axis.dom.frame.parentNode) { - axis.hide(); - changed = true; - } - } - else { - if (!axis.dom.frame.parentNode) { - axis.show(); - changed = true; + // calculate the distance from the point at the bottom to the camera + var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); + this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; } - } - return changed; -}; - -/** - * draw a bar graph - * @param datapoints - * @param group - */ -LineGraph.prototype._drawBarGraph = function (dataset, group) { - if (dataset != null) { - if (dataset.length > 0) { - var coreDistance; - var minWidth = 0.1 * group.options.barChart.width; - var offset = 0; - var width = group.options.barChart.width; - - if (group.options.barChart.align == 'left') {offset -= 0.5*width;} - else if (group.options.barChart.align == 'right') {offset += 0.5*width;} - - for (var i = 0; i < dataset.length; i++) { - // dynammically downscale the width so there is no overlap up to 1/10th the original width - if (i+1 < dataset.length) {coreDistance = Math.abs(dataset[i+1].x - dataset[i].x);} - if (i > 0) {coreDistance = Math.min(coreDistance,Math.abs(dataset[i-1].x - dataset[i].x));} - if (coreDistance < width) {width = coreDistance < minWidth ? minWidth : coreDistance;} + // order the translated points by depth + var sortDepth = function (a, b) { + return b.dist - a.dist; + }; + this.dataPoints.sort(sortDepth); - DOMutil.drawBar(dataset[i].x + offset, dataset[i].y, width, group.zeroPosition - dataset[i].y, group.className + ' bar', this.svgElements, this.svg); + // draw the datapoints as colored circles + var dotSize = this.frame.clientWidth * 0.02; // px + for (i = 0; i < this.dataPoints.length; i++) { + var point = this.dataPoints[i]; + + if (this.style === Graph3d.STYLE.DOTLINE) { + // draw a vertical line from the bottom to the graph value + //var from = this._convert3Dto2D(new Point3d(point.point.x, point.point.y, this.zMin)); + var from = this._convert3Dto2D(point.bottom); + ctx.lineWidth = 1; + ctx.strokeStyle = this.colorGrid; + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(point.screen.x, point.screen.y); + ctx.stroke(); } - // draw points - if (group.options.drawPoints.enabled == true) { - this._drawPoints(dataset, group, this.svgElements, this.svg, offset); + // calculate radius for the circle + var size; + if (this.style === Graph3d.STYLE.DOTSIZE) { + size = dotSize/2 + 2*dotSize * (point.point.value - this.valueMin) / (this.valueMax - this.valueMin); + } + else { + size = dotSize; } - } - } -}; - -/** - * draw a line graph - * - * @param datapoints - * @param group - */ -LineGraph.prototype._drawLineGraph = function (dataset, group) { - if (dataset != null) { - if (dataset.length > 0) { - var path, d; - var svgHeight = Number(this.svg.style.height.replace("px","")); - path = DOMutil.getSVGElement('path', this.svgElements, this.svg); - path.setAttributeNS(null, "class", group.className); - - // construct path from dataset - if (group.options.catmullRom.enabled == true) { - d = this._catmullRom(dataset, group); + var radius; + if (this.showPerspective) { + radius = size / -point.trans.z; } else { - d = this._linear(dataset); + radius = size * -(this.eye.z / this.camera.getArmLength()); } - - // append with points for fill and finalize the path - if (group.options.shaded.enabled == true) { - var fillPath = DOMutil.getSVGElement('path',this.svgElements, this.svg); - var dFill; - if (group.options.shaded.orientation == 'top') { - dFill = "M" + dataset[0].x + "," + 0 + " " + d + "L" + dataset[dataset.length - 1].x + "," + 0; - } - else { - dFill = "M" + dataset[0].x + "," + svgHeight + " " + d + "L" + dataset[dataset.length - 1].x + "," + svgHeight; - } - fillPath.setAttributeNS(null, "class", group.className + " fill"); - fillPath.setAttributeNS(null, "d", dFill); + if (radius < 0) { + radius = 0; } - // copy properties to path for drawing. - path.setAttributeNS(null, "d", "M" + d); - // draw points - if (group.options.drawPoints.enabled == true) { - this._drawPoints(dataset, group, this.svgElements, this.svg); + var hue, color, borderColor; + if (this.style === Graph3d.STYLE.DOTCOLOR ) { + // calculate the color based on the value + hue = (1 - (point.point.value - this.valueMin) * this.scale.value) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } + else if (this.style === Graph3d.STYLE.DOTSIZE) { + color = this.colorDot; + borderColor = this.colorDotBorder; + } + else { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + hue = (1 - (point.point.z - this.zMin) * this.scale.z / this.verticalRatio) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); } - } - } -}; -/** - * draw the data points - * - * @param dataset - * @param JSONcontainer - * @param svg - * @param group - */ -LineGraph.prototype._drawPoints = function (dataset, group, JSONcontainer, svg, offset) { - if (offset === undefined) {offset = 0;} - for (var i = 0; i < dataset.length; i++) { - DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, group, JSONcontainer, svg); - } -}; + // draw the circle + ctx.lineWidth = 1.0; + ctx.strokeStyle = borderColor; + ctx.fillStyle = color; + ctx.beginPath(); + ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI*2, true); + ctx.fill(); + ctx.stroke(); + } + }; + /** + * Draw all datapoints as bars. + * This function can be used when the style is 'bar', 'bar-color', or 'bar-size' + */ + Graph3d.prototype._redrawDataBar = function() { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); + var i, j, surface, corners; + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? -/** - * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the - * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for - * the yAxis. - * - * @param datapoints - * @returns {Array} - * @private - */ -LineGraph.prototype._preprocessData = function (datapoints, group) { - var extractedData = []; - var xValue, yValue; - var toScreen = this.body.util.toScreen; - - var increment = 1; - var amountOfPoints = datapoints.length; - - var yMin = datapoints[0].y; - var yMax = datapoints[0].y; - - // the global screen is used because changing the width of the yAxis may affect the increment, resulting in an endless loop - // of width changing of the yAxis. - if (group.options.sampling == true) { - var xDistance = this.body.util.toGlobalScreen(datapoints[datapoints.length-1].x) - this.body.util.toGlobalScreen(datapoints[0].x); - var pointsPerPixel = amountOfPoints/xDistance; - increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1,Math.round(pointsPerPixel))); - } + // calculate the translations of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; - for (var i = 0; i < amountOfPoints; i += increment) { - xValue = toScreen(datapoints[i].x) + this.width - 1; - yValue = datapoints[i].y; - extractedData.push({x: xValue, y: yValue}); - yMin = yMin > yValue ? yValue : yMin; - yMax = yMax < yValue ? yValue : yMax; - } + // calculate the distance from the point at the bottom to the camera + var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); + this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; + } - // extractedData.sort(function (a,b) {return a.x - b.x;}); - return {min: yMin, max: yMax, data: extractedData}; -}; + // order the translated points by depth + var sortDepth = function (a, b) { + return b.dist - a.dist; + }; + this.dataPoints.sort(sortDepth); -/** - * This uses the DataAxis object to generate the correct Y coordinate on the SVG window. It uses the - * util function toScreen to get the x coordinate from the timestamp. - * - * @param datapoints - * @param options - * @returns {Array} - * @private - */ -LineGraph.prototype._convertYvalues = function (datapoints, group) { - var extractedData = []; - var xValue, yValue; - var axis = this.yAxisLeft; - var svgHeight = Number(this.svg.style.height.replace("px","")); - - if (group.options.yAxisOrientation == 'right') { - axis = this.yAxisRight; - } + // draw the datapoints as bars + var xWidth = this.xBarWidth / 2; + var yWidth = this.yBarWidth / 2; + for (i = 0; i < this.dataPoints.length; i++) { + var point = this.dataPoints[i]; - for (var i = 0; i < datapoints.length; i++) { - xValue = datapoints[i].x; - yValue = Math.round(axis.convertValue(datapoints[i].y)); - extractedData.push({x: xValue, y: yValue}); - } + // determine color + var hue, color, borderColor; + if (this.style === Graph3d.STYLE.BARCOLOR ) { + // calculate the color based on the value + hue = (1 - (point.point.value - this.valueMin) * this.scale.value) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } + else if (this.style === Graph3d.STYLE.BARSIZE) { + color = this.colorDot; + borderColor = this.colorDotBorder; + } + else { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + hue = (1 - (point.point.z - this.zMin) * this.scale.z / this.verticalRatio) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } - group.setZeroPosition(Math.min(svgHeight, axis.convertValue(0))); + // calculate size for the bar + if (this.style === Graph3d.STYLE.BARSIZE) { + xWidth = (this.xBarWidth / 2) * ((point.point.value - this.valueMin) / (this.valueMax - this.valueMin) * 0.8 + 0.2); + yWidth = (this.yBarWidth / 2) * ((point.point.value - this.valueMin) / (this.valueMax - this.valueMin) * 0.8 + 0.2); + } - // extractedData.sort(function (a,b) {return a.x - b.x;}); - return extractedData; -}; + // calculate all corner points + var me = this; + var point3d = point.point; + var top = [ + {point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, point3d.z)}, + {point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, point3d.z)}, + {point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, point3d.z)}, + {point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, point3d.z)} + ]; + var bottom = [ + {point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, this.zMin)}, + {point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, this.zMin)}, + {point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, this.zMin)}, + {point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, this.zMin)} + ]; + + // calculate screen location of the points + top.forEach(function (obj) { + obj.screen = me._convert3Dto2D(obj.point); + }); + bottom.forEach(function (obj) { + obj.screen = me._convert3Dto2D(obj.point); + }); + // create five sides, calculate both corner points and center points + var surfaces = [ + {corners: top, center: Point3d.avg(bottom[0].point, bottom[2].point)}, + {corners: [top[0], top[1], bottom[1], bottom[0]], center: Point3d.avg(bottom[1].point, bottom[0].point)}, + {corners: [top[1], top[2], bottom[2], bottom[1]], center: Point3d.avg(bottom[2].point, bottom[1].point)}, + {corners: [top[2], top[3], bottom[3], bottom[2]], center: Point3d.avg(bottom[3].point, bottom[2].point)}, + {corners: [top[3], top[0], bottom[0], bottom[3]], center: Point3d.avg(bottom[0].point, bottom[3].point)} + ]; + point.surfaces = surfaces; + + // calculate the distance of each of the surface centers to the camera + for (j = 0; j < surfaces.length; j++) { + surface = surfaces[j]; + var transCenter = this._convertPointToTranslation(surface.center); + surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z; + // TODO: this dept calculation doesn't work 100% of the cases due to perspective, + // but the current solution is fast/simple and works in 99.9% of all cases + // the issue is visible in example 14, with graph.setCameraPosition({horizontal: 2.97, vertical: 0.5, distance: 0.9}) + } + + // order the surfaces by their (translated) depth + surfaces.sort(function (a, b) { + var diff = b.dist - a.dist; + if (diff) return diff; + + // if equal depth, sort the top surface last + if (a.corners === top) return 1; + if (b.corners === top) return -1; + + // both are equal + return 0; + }); -/** - * This uses an uniform parametrization of the CatmullRom algorithm: - * "On the Parameterization of Catmull-Rom Curves" by Cem Yuksel et al. - * @param data - * @returns {string} - * @private - */ -LineGraph.prototype._catmullRomUniform = function(data) { - // catmull rom - var p0, p1, p2, p3, bp1, bp2; - var d = Math.round(data[0].x) + "," + Math.round(data[0].y) + " "; - var normalization = 1/6; - var length = data.length; - for (var i = 0; i < length - 1; i++) { - - p0 = (i == 0) ? data[0] : data[i-1]; - p1 = data[i]; - p2 = data[i+1]; - p3 = (i + 2 < length) ? data[i+2] : p2; - - - // Catmull-Rom to Cubic Bezier conversion matrix - // 0 1 0 0 - // -1/6 1 1/6 0 - // 0 1/6 1 -1/6 - // 0 0 1 0 - - // bp0 = { x: p1.x, y: p1.y }; - bp1 = { x: ((-p0.x + 6*p1.x + p2.x) *normalization), y: ((-p0.y + 6*p1.y + p2.y) *normalization)}; - bp2 = { x: (( p1.x + 6*p2.x - p3.x) *normalization), y: (( p1.y + 6*p2.y - p3.y) *normalization)}; - // bp0 = { x: p2.x, y: p2.y }; - - d += "C" + - bp1.x + "," + - bp1.y + " " + - bp2.x + "," + - bp2.y + " " + - p2.x + "," + - p2.y + " "; - } + // draw the ordered surfaces + ctx.lineWidth = 1; + ctx.strokeStyle = borderColor; + ctx.fillStyle = color; + // NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside + for (j = 2; j < surfaces.length; j++) { + surface = surfaces[j]; + corners = surface.corners; + ctx.beginPath(); + ctx.moveTo(corners[3].screen.x, corners[3].screen.y); + ctx.lineTo(corners[0].screen.x, corners[0].screen.y); + ctx.lineTo(corners[1].screen.x, corners[1].screen.y); + ctx.lineTo(corners[2].screen.x, corners[2].screen.y); + ctx.lineTo(corners[3].screen.x, corners[3].screen.y); + ctx.fill(); + ctx.stroke(); + } + } + }; - return d; -}; -/** - * This uses either the chordal or centripetal parameterization of the catmull-rom algorithm. - * By default, the centripetal parameterization is used because this gives the nicest results. - * These parameterizations are relatively heavy because the distance between 4 points have to be calculated. - * - * One optimization can be used to reuse distances since this is a sliding window approach. - * @param data - * @returns {string} - * @private - */ -LineGraph.prototype._catmullRom = function(data, group) { - var alpha = group.options.catmullRom.alpha; - if (alpha == 0 || alpha === undefined) { - return this._catmullRomUniform(data); - } - else { - var p0, p1, p2, p3, bp1, bp2, d1,d2,d3, A, B, N, M; - var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA; - var d = Math.round(data[0].x) + "," + Math.round(data[0].y) + " "; - var length = data.length; - for (var i = 0; i < length - 1; i++) { + /** + * Draw a line through all datapoints. + * This function can be used when the style is 'line' + */ + Graph3d.prototype._redrawDataLine = function() { + var canvas = this.frame.canvas, + ctx = canvas.getContext('2d'), + point, i; - p0 = (i == 0) ? data[0] : data[i-1]; - p1 = data[i]; - p2 = data[i+1]; - p3 = (i + 2 < length) ? data[i+2] : p2; + if (this.dataPoints === undefined || this.dataPoints.length <= 0) + return; // TODO: throw exception? - d1 = Math.sqrt(Math.pow(p0.x - p1.x,2) + Math.pow(p0.y - p1.y,2)); - d2 = Math.sqrt(Math.pow(p1.x - p2.x,2) + Math.pow(p1.y - p2.y,2)); - d3 = Math.sqrt(Math.pow(p2.x - p3.x,2) + Math.pow(p2.y - p3.y,2)); + // calculate the translations of all points + for (i = 0; i < this.dataPoints.length; i++) { + var trans = this._convertPointToTranslation(this.dataPoints[i].point); + var screen = this._convertTranslationToScreen(trans); - // Catmull-Rom to Cubic Bezier conversion matrix - // - // A = 2d1^2a + 3d1^a * d2^a + d3^2a - // B = 2d3^2a + 3d3^a * d2^a + d2^2a - // - // [ 0 1 0 0 ] - // [ -d2^2a/N A/N d1^2a/N 0 ] - // [ 0 d3^2a/M B/M -d2^2a/M ] - // [ 0 0 1 0 ] - - // [ 0 1 0 0 ] - // [ -d2pow2a/N A/N d1pow2a/N 0 ] - // [ 0 d3pow2a/M B/M -d2pow2a/M ] - // [ 0 0 1 0 ] - - d3powA = Math.pow(d3, alpha); - d3pow2A = Math.pow(d3,2*alpha); - d2powA = Math.pow(d2, alpha); - d2pow2A = Math.pow(d2,2*alpha); - d1powA = Math.pow(d1, alpha); - d1pow2A = Math.pow(d1,2*alpha); - - A = 2*d1pow2A + 3*d1powA * d2powA + d2pow2A; - B = 2*d3pow2A + 3*d3powA * d2powA + d2pow2A; - N = 3*d1powA * (d1powA + d2powA); - if (N > 0) {N = 1 / N;} - M = 3*d3powA * (d3powA + d2powA); - if (M > 0) {M = 1 / M;} - - bp1 = { x: ((-d2pow2A * p0.x + A*p1.x + d1pow2A * p2.x) * N), - y: ((-d2pow2A * p0.y + A*p1.y + d1pow2A * p2.y) * N)}; - - bp2 = { x: (( d3pow2A * p1.x + B*p2.x - d2pow2A * p3.x) * M), - y: (( d3pow2A * p1.y + B*p2.y - d2pow2A * p3.y) * M)}; - - if (bp1.x == 0 && bp1.y == 0) {bp1 = p1;} - if (bp2.x == 0 && bp2.y == 0) {bp2 = p2;} - d += "C" + - bp1.x + "," + - bp1.y + " " + - bp2.x + "," + - bp2.y + " " + - p2.x + "," + - p2.y + " "; + this.dataPoints[i].trans = trans; + this.dataPoints[i].screen = screen; } - return d; - } -}; + // start the line + if (this.dataPoints.length > 0) { + point = this.dataPoints[0]; -/** - * this generates the SVG path for a linear drawing between datapoints. - * @param data - * @returns {string} - * @private - */ -LineGraph.prototype._linear = function(data) { - // linear - var d = ""; - for (var i = 0; i < data.length; i++) { - if (i == 0) { - d += data[i].x + "," + data[i].y; - } - else { - d += " " + data[i].x + "," + data[i].y; + ctx.lineWidth = 1; // TODO: make customizable + ctx.strokeStyle = 'blue'; // TODO: make customizable + ctx.beginPath(); + ctx.moveTo(point.screen.x, point.screen.y); } - } - return d; -}; + // draw the datapoints as colored circles + for (i = 1; i < this.dataPoints.length; i++) { + point = this.dataPoints[i]; + ctx.lineTo(point.screen.x, point.screen.y); + } + // finish the line + if (this.dataPoints.length > 0) { + ctx.stroke(); + } + }; + /** + * Start a moving operation inside the provided parent element + * @param {Event} event The event that occurred (required for + * retrieving the mouse position) + */ + Graph3d.prototype._onMouseDown = function(event) { + event = event || window.event; + // check if mouse is still down (may be up when focus is lost for example + // in an iframe) + if (this.leftButtonDown) { + this._onMouseUp(event); + } + // only react on left mouse button down + this.leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); + if (!this.leftButtonDown && !this.touchDown) return; -/** - * @constructor DataStep - * The class DataStep is an iterator for data for the lineGraph. You provide a start data point and an - * end data point. The class itself determines the best scale (step size) based on the - * provided start Date, end Date, and minimumStep. - * - * If minimumStep is provided, the step size is chosen as close as possible - * to the minimumStep but larger than minimumStep. If minimumStep is not - * provided, the scale is set to 1 DAY. - * The minimumStep should correspond with the onscreen size of about 6 characters - * - * Alternatively, you can set a scale by hand. - * After creation, you can initialize the class by executing first(). Then you - * can iterate from the start date to the end date via next(). You can check if - * the end date is reached with the function hasNext(). After each step, you can - * retrieve the current date via getCurrent(). - * The DataStep has scales ranging from milliseconds, seconds, minutes, hours, - * days, to years. - * - * Version: 1.2 - * - * @param {Date} [start] The start date, for example new Date(2010, 9, 21) - * or new Date(2010, 9, 21, 23, 45, 00) - * @param {Date} [end] The end date - * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds - */ -function DataStep(start, end, minimumStep, containerHeight, forcedStepSize) { - // variables - this.current = 0; + // get mouse position (different code for IE and all other browsers) + this.startMouseX = getMouseX(event); + this.startMouseY = getMouseY(event); - this.autoScale = true; - this.stepIndex = 0; - this.step = 1; - this.scale = 1; + this.startStart = new Date(this.start); + this.startEnd = new Date(this.end); + this.startArmRotation = this.camera.getArmRotation(); - this.marginStart; - this.marginEnd; + this.frame.style.cursor = 'move'; - this.majorSteps = [1, 2, 5, 10]; - this.minorSteps = [0.25, 0.5, 1, 2]; + // add event listeners to handle moving the contents + // we store the function onmousemove and onmouseup in the graph, so we can + // remove the eventlisteners lateron in the function mouseUp() + var me = this; + this.onmousemove = function (event) {me._onMouseMove(event);}; + this.onmouseup = function (event) {me._onMouseUp(event);}; + util.addEventListener(document, 'mousemove', me.onmousemove); + util.addEventListener(document, 'mouseup', me.onmouseup); + util.preventDefault(event); + }; - this.setRange(start, end, minimumStep, containerHeight, forcedStepSize); -} + /** + * Perform moving operating. + * This function activated from within the funcion Graph.mouseDown(). + * @param {Event} event Well, eehh, the event + */ + Graph3d.prototype._onMouseMove = function (event) { + event = event || window.event; + // calculate change in mouse position + var diffX = parseFloat(getMouseX(event)) - this.startMouseX; + var diffY = parseFloat(getMouseY(event)) - this.startMouseY; -/** - * Set a new range - * If minimumStep is provided, the step size is chosen as close as possible - * to the minimumStep but larger than minimumStep. If minimumStep is not - * provided, the scale is set to 1 DAY. - * The minimumStep should correspond with the onscreen size of about 6 characters - * @param {Number} [start] The start date and time. - * @param {Number} [end] The end date and time. - * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds - */ -DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight, forcedStepSize) { - this._start = start; - this._end = end; + var horizontalNew = this.startArmRotation.horizontal + diffX / 200; + var verticalNew = this.startArmRotation.vertical + diffY / 200; - if (this.autoScale) { - this.setMinimumStep(minimumStep, containerHeight, forcedStepSize); - } - this.setFirst(); -}; + var snapAngle = 4; // degrees + var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); -/** - * Automatically determine the scale that bests fits the provided minimum step - * @param {Number} [minimumStep] The minimum step size in milliseconds - */ -DataStep.prototype.setMinimumStep = function(minimumStep, containerHeight) { - // round to floor - var size = this._end - this._start; - var safeSize = size * 1.1; - var minimumStepValue = minimumStep * (safeSize / containerHeight); - var orderOfMagnitude = Math.round(Math.log(safeSize)/Math.LN10); - - var minorStepIdx = -1; - var magnitudefactor = Math.pow(10,orderOfMagnitude); - - var start = 0; - if (orderOfMagnitude < 0) { - start = orderOfMagnitude; - } + // snap horizontally to nice angles at 0pi, 0.5pi, 1pi, 1.5pi, etc... + // the -0.001 is to take care that the vertical axis is always drawn at the left front corner + if (Math.abs(Math.sin(horizontalNew)) < snapValue) { + horizontalNew = Math.round((horizontalNew / Math.PI)) * Math.PI - 0.001; + } + if (Math.abs(Math.cos(horizontalNew)) < snapValue) { + horizontalNew = (Math.round((horizontalNew/ Math.PI - 0.5)) + 0.5) * Math.PI - 0.001; + } - var solutionFound = false; - for (var i = start; Math.abs(i) <= Math.abs(orderOfMagnitude); i++) { - magnitudefactor = Math.pow(10,i); - for (var j = 0; j < this.minorSteps.length; j++) { - var stepSize = magnitudefactor * this.minorSteps[j]; - if (stepSize >= minimumStepValue) { - solutionFound = true; - minorStepIdx = j; - break; - } + // snap vertically to nice angles + if (Math.abs(Math.sin(verticalNew)) < snapValue) { + verticalNew = Math.round((verticalNew / Math.PI)) * Math.PI; } - if (solutionFound == true) { - break; + if (Math.abs(Math.cos(verticalNew)) < snapValue) { + verticalNew = (Math.round((verticalNew/ Math.PI - 0.5)) + 0.5) * Math.PI; } - } - this.stepIndex = minorStepIdx; - this.scale = magnitudefactor; - this.step = magnitudefactor * this.minorSteps[minorStepIdx]; -}; + this.camera.setArmRotation(horizontalNew, verticalNew); + this.redraw(); -/** - * Set the range iterator to the start date. - */ -DataStep.prototype.first = function() { - this.setFirst(); -}; + // fire a cameraPositionChange event + var parameters = this.getCameraPosition(); + this.emit('cameraPositionChange', parameters); -/** - * Round the current date to the first minor date value - * This must be executed once when the current date is set to start Date - */ -DataStep.prototype.setFirst = function() { - var niceStart = this._start - (this.scale * this.minorSteps[this.stepIndex]); - var niceEnd = this._end + (this.scale * this.minorSteps[this.stepIndex]); + util.preventDefault(event); + }; - this.marginEnd = this.roundToMinor(niceEnd); - this.marginStart = this.roundToMinor(niceStart); - this.marginRange = this.marginEnd - this.marginStart; - this.current = this.marginEnd; + /** + * Stop moving operating. + * This function activated from within the funcion Graph.mouseDown(). + * @param {event} event The event + */ + Graph3d.prototype._onMouseUp = function (event) { + this.frame.style.cursor = 'auto'; + this.leftButtonDown = false; + + // remove event listeners here + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); + }; -}; + /** + * After having moved the mouse, a tooltip should pop up when the mouse is resting on a data point + * @param {Event} event A mouse move event + */ + Graph3d.prototype._onTooltip = function (event) { + var delay = 300; // ms + var mouseX = getMouseX(event) - util.getAbsoluteLeft(this.frame); + var mouseY = getMouseY(event) - util.getAbsoluteTop(this.frame); -DataStep.prototype.roundToMinor = function(value) { - var rounded = value - (value % (this.scale * this.minorSteps[this.stepIndex])); - if (value % (this.scale * this.minorSteps[this.stepIndex]) > 0.5 * (this.scale * this.minorSteps[this.stepIndex])) { - return rounded + (this.scale * this.minorSteps[this.stepIndex]); - } - else { - return rounded; - } -} + if (!this.showTooltip) { + return; + } + if (this.tooltipTimeout) { + clearTimeout(this.tooltipTimeout); + } -/** - * Check if the there is a next step - * @return {boolean} true if the current date has not passed the end date - */ -DataStep.prototype.hasNext = function () { - return (this.current >= this.marginStart); -}; + // (delayed) display of a tooltip only if no mouse button is down + if (this.leftButtonDown) { + this._hideTooltip(); + return; + } -/** - * Do the next step - */ -DataStep.prototype.next = function() { - var prev = this.current; - this.current -= this.step; + if (this.tooltip && this.tooltip.dataPoint) { + // tooltip is currently visible + var dataPoint = this._dataPointFromXY(mouseX, mouseY); + if (dataPoint !== this.tooltip.dataPoint) { + // datapoint changed + if (dataPoint) { + this._showTooltip(dataPoint); + } + else { + this._hideTooltip(); + } + } + } + else { + // tooltip is currently not visible + var me = this; + this.tooltipTimeout = setTimeout(function () { + me.tooltipTimeout = null; - // safety mechanism: if current time is still unchanged, move to the end - if (this.current == prev) { - this.current = this._end; - } -}; + // show a tooltip if we have a data point + var dataPoint = me._dataPointFromXY(mouseX, mouseY); + if (dataPoint) { + me._showTooltip(dataPoint); + } + }, delay); + } + }; -/** - * Do the next step - */ -DataStep.prototype.previous = function() { - this.current += this.step; - this.marginEnd += this.step; - this.marginRange = this.marginEnd - this.marginStart; -}; + /** + * Event handler for touchstart event on mobile devices + */ + Graph3d.prototype._onTouchStart = function(event) { + this.touchDown = true; + var me = this; + this.ontouchmove = function (event) {me._onTouchMove(event);}; + this.ontouchend = function (event) {me._onTouchEnd(event);}; + util.addEventListener(document, 'touchmove', me.ontouchmove); + util.addEventListener(document, 'touchend', me.ontouchend); + this._onMouseDown(event); + }; -/** - * Get the current datetime - * @return {Number} current The current date - */ -DataStep.prototype.getCurrent = function() { - var toPrecision = '' + Number(this.current).toPrecision(5); - for (var i = toPrecision.length-1; i > 0; i--) { - if (toPrecision[i] == "0") { - toPrecision = toPrecision.slice(0,i); - } - else if (toPrecision[i] == "." || toPrecision[i] == ",") { - toPrecision = toPrecision.slice(0,i); - break; - } - else{ - break; - } - } + /** + * Event handler for touchmove event on mobile devices + */ + Graph3d.prototype._onTouchMove = function(event) { + this._onMouseMove(event); + }; + /** + * Event handler for touchend event on mobile devices + */ + Graph3d.prototype._onTouchEnd = function(event) { + this.touchDown = false; - return toPrecision; -}; + util.removeEventListener(document, 'touchmove', this.ontouchmove); + util.removeEventListener(document, 'touchend', this.ontouchend); + this._onMouseUp(event); + }; -/** - * Snap a date to a rounded value. - * The snap intervals are dependent on the current scale and step. - * @param {Date} date the date to be snapped. - * @return {Date} snappedDate - */ -DataStep.prototype.snap = function(date) { + /** + * Event handler for mouse wheel event, used to zoom the graph + * Code from http://adomas.org/javascript-mouse-wheel/ + * @param {event} event The event + */ + Graph3d.prototype._onWheel = function(event) { + if (!event) /* For IE. */ + event = window.event; -}; + // retrieve delta + var delta = 0; + if (event.wheelDelta) { /* IE/Opera. */ + delta = event.wheelDelta/120; + } else if (event.detail) { /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail/3; + } -/** - * Check if the current value is a major value (for example when the step - * is DAY, a major value is each first day of the MONTH) - * @return {boolean} true if current date is major, else false. - */ -DataStep.prototype.isMajor = function() { - return (this.current % (this.scale * this.majorSteps[this.stepIndex]) == 0); -}; + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + var oldLength = this.camera.getArmLength(); + var newLength = oldLength * (1 - delta / 10); -/** - * Utility functions for ordering and stacking of items - */ -var stack = {}; + this.camera.setArmLength(newLength); + this.redraw(); -/** - * Order items by their start data - * @param {Item[]} items - */ -stack.orderByStart = function(items) { - items.sort(function (a, b) { - return a.data.start - b.data.start; - }); -}; + this._hideTooltip(); + } -/** - * Order items by their end date. If they have no end date, their start date - * is used. - * @param {Item[]} items - */ -stack.orderByEnd = function(items) { - items.sort(function (a, b) { - var aTime = ('end' in a.data) ? a.data.end : a.data.start, - bTime = ('end' in b.data) ? b.data.end : b.data.start; + // fire a cameraPositionChange event + var parameters = this.getCameraPosition(); + this.emit('cameraPositionChange', parameters); - return aTime - bTime; - }); -}; + // Prevent default actions caused by mouse wheel. + // That might be ugly, but we handle scrolls somehow + // anyway, so don't bother here.. + util.preventDefault(event); + }; -/** - * Adjust vertical positions of the items such that they don't overlap each - * other. - * @param {Item[]} items - * All visible items - * @param {{item: number, axis: number}} margin - * Margins between items and between items and the axis. - * @param {boolean} [force=false] - * If true, all items will be repositioned. If false (default), only - * items having a top===null will be re-stacked - */ -stack.stack = function(items, margin, force) { - var i, iMax; + /** + * Test whether a point lies inside given 2D triangle + * @param {Point2d} point + * @param {Point2d[]} triangle + * @return {boolean} Returns true if given point lies inside or on the edge of the triangle + * @private + */ + Graph3d.prototype._insideTriangle = function (point, triangle) { + var a = triangle[0], + b = triangle[1], + c = triangle[2]; - if (force) { - // reset top position of all items - for (i = 0, iMax = items.length; i < iMax; i++) { - items[i].top = null; + function sign (x) { + return x > 0 ? 1 : x < 0 ? -1 : 0; } - } - // calculate new, non-overlapping positions - for (i = 0, iMax = items.length; i < iMax; i++) { - var item = items[i]; - if (item.top === null) { - // initialize top position - item.top = margin.axis; - - do { - // TODO: optimize checking for overlap. when there is a gap without items, - // you only need to check for items from the next item on, not from zero - var collidingItem = null; - for (var j = 0, jj = items.length; j < jj; j++) { - var other = items[j]; - if (other.top !== null && other !== item && stack.collision(item, other, margin.item)) { - collidingItem = other; - break; - } - } + var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x)); + var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x)); + var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x)); - if (collidingItem != null) { - // There is a collision. Reposition the items above the colliding element - item.top = collidingItem.top + collidingItem.height + margin.item; + // each of the three signs must be either equal to each other or zero + return (as == 0 || bs == 0 || as == bs) && + (bs == 0 || cs == 0 || bs == cs) && + (as == 0 || cs == 0 || as == cs); + }; + + /** + * Find a data point close to given screen position (x, y) + * @param {Number} x + * @param {Number} y + * @return {Object | null} The closest data point or null if not close to any data point + * @private + */ + Graph3d.prototype._dataPointFromXY = function (x, y) { + var i, + distMax = 100, // px + dataPoint = null, + closestDataPoint = null, + closestDist = null, + center = new Point2d(x, y); + + if (this.style === Graph3d.STYLE.BAR || + this.style === Graph3d.STYLE.BARCOLOR || + this.style === Graph3d.STYLE.BARSIZE) { + // the data points are ordered from far away to closest + for (i = this.dataPoints.length - 1; i >= 0; i--) { + dataPoint = this.dataPoints[i]; + var surfaces = dataPoint.surfaces; + if (surfaces) { + for (var s = surfaces.length - 1; s >= 0; s--) { + // split each surface in two triangles, and see if the center point is inside one of these + var surface = surfaces[s]; + var corners = surface.corners; + var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen]; + var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen]; + if (this._insideTriangle(center, triangle1) || + this._insideTriangle(center, triangle2)) { + // return immediately at the first hit + return dataPoint; + } + } + } + } + } + else { + // find the closest data point, using distance to the center of the point on 2d screen + for (i = 0; i < this.dataPoints.length; i++) { + dataPoint = this.dataPoints[i]; + var point = dataPoint.screen; + if (point) { + var distX = Math.abs(x - point.x); + var distY = Math.abs(y - point.y); + var dist = Math.sqrt(distX * distX + distY * distY); + + if ((closestDist === null || dist < closestDist) && dist < distMax) { + closestDist = dist; + closestDataPoint = dataPoint; + } } - } while (collidingItem); + } } - } -}; -/** - * Adjust vertical positions of the items without stacking them - * @param {Item[]} items - * All visible items - * @param {{item: number, axis: number}} margin - * Margins between items and between items and the axis. - */ -stack.nostack = function(items, margin) { - var i, iMax; - // reset top position of all items - for (i = 0, iMax = items.length; i < iMax; i++) { - items[i].top = margin.axis; - } -}; + return closestDataPoint; + }; -/** - * Test if the two provided items collide - * The items must have parameters left, width, top, and height. - * @param {Item} a The first item - * @param {Item} b The second item - * @param {Number} margin A minimum required margin. - * If margin is provided, the two items will be - * marked colliding when they overlap or - * when the margin between the two is smaller than - * the requested margin. - * @return {boolean} true if a and b collide, else false - */ -stack.collision = function(a, b, margin) { - return ((a.left - margin) < (b.left + b.width) && - (a.left + a.width + margin) > b.left && - (a.top - margin) < (b.top + b.height) && - (a.top + a.height + margin) > b.top); -}; + /** + * Display a tooltip for given data point + * @param {Object} dataPoint + * @private + */ + Graph3d.prototype._showTooltip = function (dataPoint) { + var content, line, dot; + + if (!this.tooltip) { + content = document.createElement('div'); + content.style.position = 'absolute'; + content.style.padding = '10px'; + content.style.border = '1px solid #4d4d4d'; + content.style.color = '#1a1a1a'; + content.style.background = 'rgba(255,255,255,0.7)'; + content.style.borderRadius = '2px'; + content.style.boxShadow = '5px 5px 10px rgba(128,128,128,0.5)'; + + line = document.createElement('div'); + line.style.position = 'absolute'; + line.style.height = '40px'; + line.style.width = '0'; + line.style.borderLeft = '1px solid #4d4d4d'; + + dot = document.createElement('div'); + dot.style.position = 'absolute'; + dot.style.height = '0'; + dot.style.width = '0'; + dot.style.border = '5px solid #4d4d4d'; + dot.style.borderRadius = '5px'; + + this.tooltip = { + dataPoint: null, + dom: { + content: content, + line: line, + dot: dot + } + }; + } + else { + content = this.tooltip.dom.content; + line = this.tooltip.dom.line; + dot = this.tooltip.dom.dot; + } -/** - * @constructor TimeStep - * The class TimeStep is an iterator for dates. You provide a start date and an - * end date. The class itself determines the best scale (step size) based on the - * provided start Date, end Date, and minimumStep. - * - * If minimumStep is provided, the step size is chosen as close as possible - * to the minimumStep but larger than minimumStep. If minimumStep is not - * provided, the scale is set to 1 DAY. - * The minimumStep should correspond with the onscreen size of about 6 characters - * - * Alternatively, you can set a scale by hand. - * After creation, you can initialize the class by executing first(). Then you - * can iterate from the start date to the end date via next(). You can check if - * the end date is reached with the function hasNext(). After each step, you can - * retrieve the current date via getCurrent(). - * The TimeStep has scales ranging from milliseconds, seconds, minutes, hours, - * days, to years. - * - * Version: 1.2 - * - * @param {Date} [start] The start date, for example new Date(2010, 9, 21) - * or new Date(2010, 9, 21, 23, 45, 00) - * @param {Date} [end] The end date - * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds - */ -function TimeStep(start, end, minimumStep) { - // variables - this.current = new Date(); - this._start = new Date(); - this._end = new Date(); - - this.autoScale = true; - this.scale = TimeStep.SCALE.DAY; - this.step = 1; - - // initialize the range - this.setRange(start, end, minimumStep); -} - -/// enum scale -TimeStep.SCALE = { - MILLISECOND: 1, - SECOND: 2, - MINUTE: 3, - HOUR: 4, - DAY: 5, - WEEKDAY: 6, - MONTH: 7, - YEAR: 8 -}; + this._hideTooltip(); + this.tooltip.dataPoint = dataPoint; + if (typeof this.showTooltip === 'function') { + content.innerHTML = this.showTooltip(dataPoint.point); + } + else { + content.innerHTML = '' + + '' + + '' + + '' + + '
x:' + dataPoint.point.x + '
y:' + dataPoint.point.y + '
z:' + dataPoint.point.z + '
'; + } + + content.style.left = '0'; + content.style.top = '0'; + this.frame.appendChild(content); + this.frame.appendChild(line); + this.frame.appendChild(dot); + + // calculate sizes + var contentWidth = content.offsetWidth; + var contentHeight = content.offsetHeight; + var lineHeight = line.offsetHeight; + var dotWidth = dot.offsetWidth; + var dotHeight = dot.offsetHeight; + + var left = dataPoint.screen.x - contentWidth / 2; + left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth); + + line.style.left = dataPoint.screen.x + 'px'; + line.style.top = (dataPoint.screen.y - lineHeight) + 'px'; + content.style.left = left + 'px'; + content.style.top = (dataPoint.screen.y - lineHeight - contentHeight) + 'px'; + dot.style.left = (dataPoint.screen.x - dotWidth / 2) + 'px'; + dot.style.top = (dataPoint.screen.y - dotHeight / 2) + 'px'; + }; -/** - * Set a new range - * If minimumStep is provided, the step size is chosen as close as possible - * to the minimumStep but larger than minimumStep. If minimumStep is not - * provided, the scale is set to 1 DAY. - * The minimumStep should correspond with the onscreen size of about 6 characters - * @param {Date} [start] The start date and time. - * @param {Date} [end] The end date and time. - * @param {int} [minimumStep] Optional. Minimum step size in milliseconds - */ -TimeStep.prototype.setRange = function(start, end, minimumStep) { - if (!(start instanceof Date) || !(end instanceof Date)) { - throw "No legal start or end date in method setRange"; - } + /** + * Hide the tooltip when displayed + * @private + */ + Graph3d.prototype._hideTooltip = function () { + if (this.tooltip) { + this.tooltip.dataPoint = null; + + for (var prop in this.tooltip.dom) { + if (this.tooltip.dom.hasOwnProperty(prop)) { + var elem = this.tooltip.dom[prop]; + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + } + } + } + }; - this._start = (start != undefined) ? new Date(start.valueOf()) : new Date(); - this._end = (end != undefined) ? new Date(end.valueOf()) : new Date(); + /**--------------------------------------------------------------------------**/ - if (this.autoScale) { - this.setMinimumStep(minimumStep); - } -}; -/** - * Set the range iterator to the start date. - */ -TimeStep.prototype.first = function() { - this.current = new Date(this._start.valueOf()); - this.roundToMinor(); -}; + /** + * Get the horizontal mouse position from a mouse event + * @param {Event} event + * @return {Number} mouse x + */ + getMouseX = function(event) { + if ('clientX' in event) return event.clientX; + return event.targetTouches[0] && event.targetTouches[0].clientX || 0; + }; -/** - * Round the current date to the first minor date value - * This must be executed once when the current date is set to start Date - */ -TimeStep.prototype.roundToMinor = function() { - // round to floor - // IMPORTANT: we have no breaks in this switch! (this is no bug) - //noinspection FallthroughInSwitchStatementJS - switch (this.scale) { - case TimeStep.SCALE.YEAR: - this.current.setFullYear(this.step * Math.floor(this.current.getFullYear() / this.step)); - this.current.setMonth(0); - case TimeStep.SCALE.MONTH: this.current.setDate(1); - case TimeStep.SCALE.DAY: // intentional fall through - case TimeStep.SCALE.WEEKDAY: this.current.setHours(0); - case TimeStep.SCALE.HOUR: this.current.setMinutes(0); - case TimeStep.SCALE.MINUTE: this.current.setSeconds(0); - case TimeStep.SCALE.SECOND: this.current.setMilliseconds(0); - //case TimeStep.SCALE.MILLISECOND: // nothing to do for milliseconds - } + /** + * Get the vertical mouse position from a mouse event + * @param {Event} event + * @return {Number} mouse y + */ + getMouseY = function(event) { + if ('clientY' in event) return event.clientY; + return event.targetTouches[0] && event.targetTouches[0].clientY || 0; + }; - if (this.step != 1) { - // round down to the first minor value that is a multiple of the current step size - switch (this.scale) { - case TimeStep.SCALE.MILLISECOND: this.current.setMilliseconds(this.current.getMilliseconds() - this.current.getMilliseconds() % this.step); break; - case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() - this.current.getSeconds() % this.step); break; - case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() - this.current.getMinutes() % this.step); break; - case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() - this.current.getHours() % this.step); break; - case TimeStep.SCALE.WEEKDAY: // intentional fall through - case TimeStep.SCALE.DAY: this.current.setDate((this.current.getDate()-1) - (this.current.getDate()-1) % this.step + 1); break; - case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() - this.current.getMonth() % this.step); break; - case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() - this.current.getFullYear() % this.step); break; - default: break; - } - } -}; + module.exports = Graph3d; -/** - * Check if the there is a next step - * @return {boolean} true if the current date has not passed the end date - */ -TimeStep.prototype.hasNext = function () { - return (this.current.valueOf() <= this._end.valueOf()); -}; -/** - * Do the next step - */ -TimeStep.prototype.next = function() { - var prev = this.current.valueOf(); +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { - // Two cases, needed to prevent issues with switching daylight savings - // (end of March and end of October) - if (this.current.getMonth() < 6) { - switch (this.scale) { - case TimeStep.SCALE.MILLISECOND: + var Point3d = __webpack_require__(9); - this.current = new Date(this.current.valueOf() + this.step); break; - case TimeStep.SCALE.SECOND: this.current = new Date(this.current.valueOf() + this.step * 1000); break; - case TimeStep.SCALE.MINUTE: this.current = new Date(this.current.valueOf() + this.step * 1000 * 60); break; - case TimeStep.SCALE.HOUR: - this.current = new Date(this.current.valueOf() + this.step * 1000 * 60 * 60); - // in case of skipping an hour for daylight savings, adjust the hour again (else you get: 0h 5h 9h ... instead of 0h 4h 8h ...) - var h = this.current.getHours(); - this.current.setHours(h - (h % this.step)); - break; - case TimeStep.SCALE.WEEKDAY: // intentional fall through - case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break; - case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break; - case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break; - default: break; - } - } - else { - switch (this.scale) { - case TimeStep.SCALE.MILLISECOND: this.current = new Date(this.current.valueOf() + this.step); break; - case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() + this.step); break; - case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() + this.step); break; - case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() + this.step); break; - case TimeStep.SCALE.WEEKDAY: // intentional fall through - case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break; - case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break; - case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break; - default: break; + /** + * @class Camera + * The camera is mounted on a (virtual) camera arm. The camera arm can rotate + * The camera is always looking in the direction of the origin of the arm. + * This way, the camera always rotates around one fixed point, the location + * of the camera arm. + * + * Documentation: + * http://en.wikipedia.org/wiki/3D_projection + */ + Camera = function () { + this.armLocation = new Point3d(); + this.armRotation = {}; + this.armRotation.horizontal = 0; + this.armRotation.vertical = 0; + this.armLength = 1.7; + + this.cameraLocation = new Point3d(); + this.cameraRotation = new Point3d(0.5*Math.PI, 0, 0); + + this.calculateCameraOrientation(); + }; + + /** + * Set the location (origin) of the arm + * @param {Number} x Normalized value of x + * @param {Number} y Normalized value of y + * @param {Number} z Normalized value of z + */ + Camera.prototype.setArmLocation = function(x, y, z) { + this.armLocation.x = x; + this.armLocation.y = y; + this.armLocation.z = z; + + this.calculateCameraOrientation(); + }; + + /** + * Set the rotation of the camera arm + * @param {Number} horizontal The horizontal rotation, between 0 and 2*PI. + * Optional, can be left undefined. + * @param {Number} vertical The vertical rotation, between 0 and 0.5*PI + * if vertical=0.5*PI, the graph is shown from the + * top. Optional, can be left undefined. + */ + Camera.prototype.setArmRotation = function(horizontal, vertical) { + if (horizontal !== undefined) { + this.armRotation.horizontal = horizontal; } - } - if (this.step != 1) { - // round down to the correct major value - switch (this.scale) { - case TimeStep.SCALE.MILLISECOND: if(this.current.getMilliseconds() < this.step) this.current.setMilliseconds(0); break; - case TimeStep.SCALE.SECOND: if(this.current.getSeconds() < this.step) this.current.setSeconds(0); break; - case TimeStep.SCALE.MINUTE: if(this.current.getMinutes() < this.step) this.current.setMinutes(0); break; - case TimeStep.SCALE.HOUR: if(this.current.getHours() < this.step) this.current.setHours(0); break; - case TimeStep.SCALE.WEEKDAY: // intentional fall through - case TimeStep.SCALE.DAY: if(this.current.getDate() < this.step+1) this.current.setDate(1); break; - case TimeStep.SCALE.MONTH: if(this.current.getMonth() < this.step) this.current.setMonth(0); break; - case TimeStep.SCALE.YEAR: break; // nothing to do for year - default: break; + if (vertical !== undefined) { + this.armRotation.vertical = vertical; + if (this.armRotation.vertical < 0) this.armRotation.vertical = 0; + if (this.armRotation.vertical > 0.5*Math.PI) this.armRotation.vertical = 0.5*Math.PI; } - } - // safety mechanism: if current time is still unchanged, move to the end - if (this.current.valueOf() == prev) { - this.current = new Date(this._end.valueOf()); - } -}; + if (horizontal !== undefined || vertical !== undefined) { + this.calculateCameraOrientation(); + } + }; + /** + * Retrieve the current arm rotation + * @return {object} An object with parameters horizontal and vertical + */ + Camera.prototype.getArmRotation = function() { + var rot = {}; + rot.horizontal = this.armRotation.horizontal; + rot.vertical = this.armRotation.vertical; -/** - * Get the current datetime - * @return {Date} current The current date - */ -TimeStep.prototype.getCurrent = function() { - return this.current; -}; + return rot; + }; -/** - * Set a custom scale. Autoscaling will be disabled. - * For example setScale(SCALE.MINUTES, 5) will result - * in minor steps of 5 minutes, and major steps of an hour. - * - * @param {TimeStep.SCALE} newScale - * A scale. Choose from SCALE.MILLISECOND, - * SCALE.SECOND, SCALE.MINUTE, SCALE.HOUR, - * SCALE.WEEKDAY, SCALE.DAY, SCALE.MONTH, - * SCALE.YEAR. - * @param {Number} newStep A step size, by default 1. Choose for - * example 1, 2, 5, or 10. - */ -TimeStep.prototype.setScale = function(newScale, newStep) { - this.scale = newScale; + /** + * Set the (normalized) length of the camera arm. + * @param {Number} length A length between 0.71 and 5.0 + */ + Camera.prototype.setArmLength = function(length) { + if (length === undefined) + return; - if (newStep > 0) { - this.step = newStep; - } + this.armLength = length; - this.autoScale = false; -}; + // Radius must be larger than the corner of the graph, + // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the + // graph + if (this.armLength < 0.71) this.armLength = 0.71; + if (this.armLength > 5.0) this.armLength = 5.0; -/** - * Enable or disable autoscaling - * @param {boolean} enable If true, autoascaling is set true - */ -TimeStep.prototype.setAutoScale = function (enable) { - this.autoScale = enable; -}; + this.calculateCameraOrientation(); + }; + /** + * Retrieve the arm length + * @return {Number} length + */ + Camera.prototype.getArmLength = function() { + return this.armLength; + }; -/** - * Automatically determine the scale that bests fits the provided minimum step - * @param {Number} [minimumStep] The minimum step size in milliseconds - */ -TimeStep.prototype.setMinimumStep = function(minimumStep) { - if (minimumStep == undefined) { - return; - } + /** + * Retrieve the camera location + * @return {Point3d} cameraLocation + */ + Camera.prototype.getCameraLocation = function() { + return this.cameraLocation; + }; - var stepYear = (1000 * 60 * 60 * 24 * 30 * 12); - var stepMonth = (1000 * 60 * 60 * 24 * 30); - var stepDay = (1000 * 60 * 60 * 24); - var stepHour = (1000 * 60 * 60); - var stepMinute = (1000 * 60); - var stepSecond = (1000); - var stepMillisecond= (1); - - // find the smallest step that is larger than the provided minimumStep - if (stepYear*1000 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1000;} - if (stepYear*500 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 500;} - if (stepYear*100 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 100;} - if (stepYear*50 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 50;} - if (stepYear*10 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 10;} - if (stepYear*5 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 5;} - if (stepYear > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1;} - if (stepMonth*3 > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 3;} - if (stepMonth > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 1;} - if (stepDay*5 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 5;} - if (stepDay*2 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 2;} - if (stepDay > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 1;} - if (stepDay/2 > minimumStep) {this.scale = TimeStep.SCALE.WEEKDAY; this.step = 1;} - if (stepHour*4 > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 4;} - if (stepHour > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 1;} - if (stepMinute*15 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 15;} - if (stepMinute*10 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 10;} - if (stepMinute*5 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 5;} - if (stepMinute > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 1;} - if (stepSecond*15 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 15;} - if (stepSecond*10 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 10;} - if (stepSecond*5 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 5;} - if (stepSecond > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 1;} - if (stepMillisecond*200 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 200;} - if (stepMillisecond*100 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 100;} - if (stepMillisecond*50 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 50;} - if (stepMillisecond*10 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 10;} - if (stepMillisecond*5 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 5;} - if (stepMillisecond > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 1;} -}; + /** + * Retrieve the camera rotation + * @return {Point3d} cameraRotation + */ + Camera.prototype.getCameraRotation = function() { + return this.cameraRotation; + }; -/** - * Snap a date to a rounded value. - * The snap intervals are dependent on the current scale and step. - * @param {Date} date the date to be snapped. - * @return {Date} snappedDate - */ -TimeStep.prototype.snap = function(date) { - var clone = new Date(date.valueOf()); - - if (this.scale == TimeStep.SCALE.YEAR) { - var year = clone.getFullYear() + Math.round(clone.getMonth() / 12); - clone.setFullYear(Math.round(year / this.step) * this.step); - clone.setMonth(0); - clone.setDate(0); - clone.setHours(0); - clone.setMinutes(0); - clone.setSeconds(0); - clone.setMilliseconds(0); - } - else if (this.scale == TimeStep.SCALE.MONTH) { - if (clone.getDate() > 15) { - clone.setDate(1); - clone.setMonth(clone.getMonth() + 1); - // important: first set Date to 1, after that change the month. - } - else { - clone.setDate(1); - } + /** + * Calculate the location and rotation of the camera based on the + * position and orientation of the camera arm + */ + Camera.prototype.calculateCameraOrientation = function() { + // calculate location of the camera + this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); + + // calculate rotation of the camera + this.cameraRotation.x = Math.PI/2 - this.armRotation.vertical; + this.cameraRotation.y = 0; + this.cameraRotation.z = -this.armRotation.horizontal; + }; - clone.setHours(0); - clone.setMinutes(0); - clone.setSeconds(0); - clone.setMilliseconds(0); - } - else if (this.scale == TimeStep.SCALE.DAY) { - //noinspection FallthroughInSwitchStatementJS - switch (this.step) { - case 5: - case 2: - clone.setHours(Math.round(clone.getHours() / 24) * 24); break; - default: - clone.setHours(Math.round(clone.getHours() / 12) * 12); break; - } - clone.setMinutes(0); - clone.setSeconds(0); - clone.setMilliseconds(0); - } - else if (this.scale == TimeStep.SCALE.WEEKDAY) { - //noinspection FallthroughInSwitchStatementJS - switch (this.step) { - case 5: - case 2: - clone.setHours(Math.round(clone.getHours() / 12) * 12); break; - default: - clone.setHours(Math.round(clone.getHours() / 6) * 6); break; - } - clone.setMinutes(0); - clone.setSeconds(0); - clone.setMilliseconds(0); - } - else if (this.scale == TimeStep.SCALE.HOUR) { - switch (this.step) { - case 4: - clone.setMinutes(Math.round(clone.getMinutes() / 60) * 60); break; - default: - clone.setMinutes(Math.round(clone.getMinutes() / 30) * 30); break; - } - clone.setSeconds(0); - clone.setMilliseconds(0); - } else if (this.scale == TimeStep.SCALE.MINUTE) { - //noinspection FallthroughInSwitchStatementJS - switch (this.step) { - case 15: - case 10: - clone.setMinutes(Math.round(clone.getMinutes() / 5) * 5); - clone.setSeconds(0); - break; - case 5: - clone.setSeconds(Math.round(clone.getSeconds() / 60) * 60); break; - default: - clone.setSeconds(Math.round(clone.getSeconds() / 30) * 30); break; - } - clone.setMilliseconds(0); - } - else if (this.scale == TimeStep.SCALE.SECOND) { - //noinspection FallthroughInSwitchStatementJS - switch (this.step) { - case 15: - case 10: - clone.setSeconds(Math.round(clone.getSeconds() / 5) * 5); - clone.setMilliseconds(0); - break; - case 5: - clone.setMilliseconds(Math.round(clone.getMilliseconds() / 1000) * 1000); break; - default: - clone.setMilliseconds(Math.round(clone.getMilliseconds() / 500) * 500); break; - } - } - else if (this.scale == TimeStep.SCALE.MILLISECOND) { - var step = this.step > 5 ? this.step / 2 : 1; - clone.setMilliseconds(Math.round(clone.getMilliseconds() / step) * step); - } - - return clone; -}; + module.exports = Camera; -/** - * Check if the current value is a major value (for example when the step - * is DAY, a major value is each first day of the MONTH) - * @return {boolean} true if current date is major, else false. - */ -TimeStep.prototype.isMajor = function() { - switch (this.scale) { - case TimeStep.SCALE.MILLISECOND: - return (this.current.getMilliseconds() == 0); - case TimeStep.SCALE.SECOND: - return (this.current.getSeconds() == 0); - case TimeStep.SCALE.MINUTE: - return (this.current.getHours() == 0) && (this.current.getMinutes() == 0); - // Note: this is no bug. Major label is equal for both minute and hour scale - case TimeStep.SCALE.HOUR: - return (this.current.getHours() == 0); - case TimeStep.SCALE.WEEKDAY: // intentional fall through - case TimeStep.SCALE.DAY: - return (this.current.getDate() == 1); - case TimeStep.SCALE.MONTH: - return (this.current.getMonth() == 0); - case TimeStep.SCALE.YEAR: - return false; - default: - return false; - } -}; +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + var DataView = __webpack_require__(4); -/** - * Returns formatted text for the minor axislabel, depending on the current - * date and the scale. For example when scale is MINUTE, the current time is - * formatted as "hh:mm". - * @param {Date} [date] custom date. if not provided, current date is taken - */ -TimeStep.prototype.getLabelMinor = function(date) { - if (date == undefined) { - date = this.current; - } + /** + * @class Filter + * + * @param {DataSet} data The google data table + * @param {Number} column The index of the column to be filtered + * @param {Graph} graph The graph + */ + function Filter (data, column, graph) { + this.data = data; + this.column = column; + this.graph = graph; // the parent graph - switch (this.scale) { - case TimeStep.SCALE.MILLISECOND: return moment(date).format('SSS'); - case TimeStep.SCALE.SECOND: return moment(date).format('s'); - case TimeStep.SCALE.MINUTE: return moment(date).format('HH:mm'); - case TimeStep.SCALE.HOUR: return moment(date).format('HH:mm'); - case TimeStep.SCALE.WEEKDAY: return moment(date).format('ddd D'); - case TimeStep.SCALE.DAY: return moment(date).format('D'); - case TimeStep.SCALE.MONTH: return moment(date).format('MMM'); - case TimeStep.SCALE.YEAR: return moment(date).format('YYYY'); - default: return ''; - } -}; + this.index = undefined; + this.value = undefined; + // read all distinct values and select the first one + this.values = graph.getDistinctValues(data.get(), this.column); -/** - * Returns formatted text for the major axis label, depending on the current - * date and the scale. For example when scale is MINUTE, the major scale is - * hours, and the hour will be formatted as "hh". - * @param {Date} [date] custom date. if not provided, current date is taken - */ -TimeStep.prototype.getLabelMajor = function(date) { - if (date == undefined) { - date = this.current; - } + // sort both numeric and string values correctly + this.values.sort(function (a, b) { + return a > b ? 1 : a < b ? -1 : 0; + }); - //noinspection FallthroughInSwitchStatementJS - switch (this.scale) { - case TimeStep.SCALE.MILLISECOND:return moment(date).format('HH:mm:ss'); - case TimeStep.SCALE.SECOND: return moment(date).format('D MMMM HH:mm'); - case TimeStep.SCALE.MINUTE: - case TimeStep.SCALE.HOUR: return moment(date).format('ddd D MMMM'); - case TimeStep.SCALE.WEEKDAY: - case TimeStep.SCALE.DAY: return moment(date).format('MMMM YYYY'); - case TimeStep.SCALE.MONTH: return moment(date).format('YYYY'); - case TimeStep.SCALE.YEAR: return ''; - default: return ''; - } -}; + if (this.values.length > 0) { + this.selectValue(0); + } -/** - * @constructor Range - * A Range controls a numeric range with a start and end value. - * The Range adjusts the range based on mouse events or programmatic changes, - * and triggers events when the range is changing or has been changed. - * @param {{dom: Object, domProps: Object, emitter: Emitter}} body - * @param {Object} [options] See description at Range.setOptions - */ -function Range(body, options) { - var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0); - this.start = now.clone().add('days', -3).valueOf(); // Number - this.end = now.clone().add('days', 4).valueOf(); // Number + // create an array with the filtered datapoints. this will be loaded afterwards + this.dataPoints = []; - this.body = body; + this.loaded = false; + this.onLoadCallback = undefined; - // default options - this.defaultOptions = { - start: null, - end: null, - direction: 'horizontal', // 'horizontal' or 'vertical' - moveable: true, - zoomable: true, - min: null, - max: null, - zoomMin: 10, // milliseconds - zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000 // milliseconds + if (graph.animationPreload) { + this.loaded = false; + this.loadInBackground(); + } + else { + this.loaded = true; + } }; - this.options = util.extend({}, this.defaultOptions); - this.props = { - touch: {} + + /** + * Return the label + * @return {string} label + */ + Filter.prototype.isLoaded = function() { + return this.loaded; }; - // drag listeners for dragging - this.body.emitter.on('dragstart', this._onDragStart.bind(this)); - this.body.emitter.on('drag', this._onDrag.bind(this)); - this.body.emitter.on('dragend', this._onDragEnd.bind(this)); - // ignore dragging when holding - this.body.emitter.on('hold', this._onHold.bind(this)); + /** + * Return the loaded progress + * @return {Number} percentage between 0 and 100 + */ + Filter.prototype.getLoadedProgress = function() { + var len = this.values.length; + + var i = 0; + while (this.dataPoints[i]) { + i++; + } - // mouse wheel for zooming - this.body.emitter.on('mousewheel', this._onMouseWheel.bind(this)); - this.body.emitter.on('DOMMouseScroll', this._onMouseWheel.bind(this)); // For FF + return Math.round(i / len * 100); + }; - // pinch to zoom - this.body.emitter.on('touch', this._onTouch.bind(this)); - this.body.emitter.on('pinch', this._onPinch.bind(this)); - this.setOptions(options); -} + /** + * Return the label + * @return {string} label + */ + Filter.prototype.getLabel = function() { + return this.graph.filterLabel; + }; -Range.prototype = new Component(); -/** - * Set options for the range controller - * @param {Object} options Available options: - * {Number | Date | String} start Start date for the range - * {Number | Date | String} end End date for the range - * {Number} min Minimum value for start - * {Number} max Maximum value for end - * {Number} zoomMin Set a minimum value for - * (end - start). - * {Number} zoomMax Set a maximum value for - * (end - start). - * {Boolean} moveable Enable moving of the range - * by dragging. True by default - * {Boolean} zoomable Enable zooming of the range - * by pinching/scrolling. True by default - */ -Range.prototype.setOptions = function (options) { - if (options) { - // copy the options that we know - var fields = ['direction', 'min', 'max', 'zoomMin', 'zoomMax', 'moveable', 'zoomable']; - util.selectiveExtend(fields, this.options, options); + /** + * Return the columnIndex of the filter + * @return {Number} columnIndex + */ + Filter.prototype.getColumn = function() { + return this.column; + }; - if ('start' in options || 'end' in options) { - // apply a new range. both start and end are optional - this.setRange(options.start, options.end); - } - } -}; + /** + * Return the currently selected value. Returns undefined if there is no selection + * @return {*} value + */ + Filter.prototype.getSelectedValue = function() { + if (this.index === undefined) + return undefined; -/** - * Test whether direction has a valid value - * @param {String} direction 'horizontal' or 'vertical' - */ -function validateDirection (direction) { - if (direction != 'horizontal' && direction != 'vertical') { - throw new TypeError('Unknown direction "' + direction + '". ' + - 'Choose "horizontal" or "vertical".'); - } -} + return this.values[this.index]; + }; -/** - * Set a new start and end range - * @param {Number} [start] - * @param {Number} [end] - */ -Range.prototype.setRange = function(start, end) { - var changed = this._applyRange(start, end); - if (changed) { - var params = { - start: new Date(this.start), - end: new Date(this.end) - }; - this.body.emitter.emit('rangechange', params); - this.body.emitter.emit('rangechanged', params); - } -}; + /** + * Retrieve all values of the filter + * @return {Array} values + */ + Filter.prototype.getValues = function() { + return this.values; + }; -/** - * Set a new start and end range. This method is the same as setRange, but - * does not trigger a range change and range changed event, and it returns - * true when the range is changed - * @param {Number} [start] - * @param {Number} [end] - * @return {Boolean} changed - * @private - */ -Range.prototype._applyRange = function(start, end) { - var newStart = (start != null) ? util.convert(start, 'Date').valueOf() : this.start, - newEnd = (end != null) ? util.convert(end, 'Date').valueOf() : this.end, - max = (this.options.max != null) ? util.convert(this.options.max, 'Date').valueOf() : null, - min = (this.options.min != null) ? util.convert(this.options.min, 'Date').valueOf() : null, - diff; - - // check for valid number - if (isNaN(newStart) || newStart === null) { - throw new Error('Invalid start "' + start + '"'); - } - if (isNaN(newEnd) || newEnd === null) { - throw new Error('Invalid end "' + end + '"'); - } + /** + * Retrieve one value of the filter + * @param {Number} index + * @return {*} value + */ + Filter.prototype.getValue = function(index) { + if (index >= this.values.length) + throw 'Error: index out of range'; - // prevent start < end - if (newEnd < newStart) { - newEnd = newStart; - } + return this.values[index]; + }; - // prevent start < min - if (min !== null) { - if (newStart < min) { - diff = (min - newStart); - newStart += diff; - newEnd += diff; - // prevent end > max - if (max != null) { - if (newEnd > max) { - newEnd = max; - } - } - } - } + /** + * Retrieve the (filtered) dataPoints for the currently selected filter index + * @param {Number} [index] (optional) + * @return {Array} dataPoints + */ + Filter.prototype._getDataPoints = function(index) { + if (index === undefined) + index = this.index; - // prevent end > max - if (max !== null) { - if (newEnd > max) { - diff = (newEnd - max); - newStart -= diff; - newEnd -= diff; + if (index === undefined) + return []; - // prevent start < min - if (min != null) { - if (newStart < min) { - newStart = min; - } - } + var dataPoints; + if (this.dataPoints[index]) { + dataPoints = this.dataPoints[index]; } - } + else { + var f = {}; + f.column = this.column; + f.value = this.values[index]; - // prevent (end-start) < zoomMin - if (this.options.zoomMin !== null) { - var zoomMin = parseFloat(this.options.zoomMin); - if (zoomMin < 0) { - zoomMin = 0; - } - if ((newEnd - newStart) < zoomMin) { - if ((this.end - this.start) === zoomMin) { - // ignore this action, we are already zoomed to the minimum - newStart = this.start; - newEnd = this.end; - } - else { - // zoom to the minimum - diff = (zoomMin - (newEnd - newStart)); - newStart -= diff / 2; - newEnd += diff / 2; - } - } - } + var dataView = new DataView(this.data,{filter: function (item) {return (item[f.column] == f.value);}}).get(); + dataPoints = this.graph._getDataPoints(dataView); - // prevent (end-start) > zoomMax - if (this.options.zoomMax !== null) { - var zoomMax = parseFloat(this.options.zoomMax); - if (zoomMax < 0) { - zoomMax = 0; + this.dataPoints[index] = dataPoints; } - if ((newEnd - newStart) > zoomMax) { - if ((this.end - this.start) === zoomMax) { - // ignore this action, we are already zoomed to the maximum - newStart = this.start; - newEnd = this.end; - } - else { - // zoom to the maximum - diff = ((newEnd - newStart) - zoomMax); - newStart += diff / 2; - newEnd -= diff / 2; - } - } - } - var changed = (this.start != newStart || this.end != newEnd); + return dataPoints; + }; - this.start = newStart; - this.end = newEnd; - return changed; -}; -/** - * Retrieve the current range. - * @return {Object} An object with start and end properties - */ -Range.prototype.getRange = function() { - return { - start: this.start, - end: this.end + /** + * Set a callback function when the filter is fully loaded. + */ + Filter.prototype.setOnLoadCallback = function(callback) { + this.onLoadCallback = callback; }; -}; -/** - * Calculate the conversion offset and scale for current range, based on - * the provided width - * @param {Number} width - * @returns {{offset: number, scale: number}} conversion - */ -Range.prototype.conversion = function (width) { - return Range.conversion(this.start, this.end, width); -}; -/** - * Static method to calculate the conversion offset and scale for a range, - * based on the provided start, end, and width - * @param {Number} start - * @param {Number} end - * @param {Number} width - * @returns {{offset: number, scale: number}} conversion - */ -Range.conversion = function (start, end, width) { - if (width != 0 && (end - start != 0)) { - return { - offset: start, - scale: width / (end - start) - } - } - else { - return { - offset: 0, - scale: 1 - }; - } -}; - -/** - * Start dragging horizontally or vertically - * @param {Event} event - * @private - */ -Range.prototype._onDragStart = function(event) { - // only allow dragging when configured as movable - if (!this.options.moveable) return; - - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.props.touch.allowDragging) return; - - this.props.touch.start = this.start; - this.props.touch.end = this.end; - - if (this.body.dom.root) { - this.body.dom.root.style.cursor = 'move'; - } -}; - -/** - * Perform dragging operation - * @param {Event} event - * @private - */ -Range.prototype._onDrag = function (event) { - // only allow dragging when configured as movable - if (!this.options.moveable) return; - var direction = this.options.direction; - validateDirection(direction); - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.props.touch.allowDragging) return; - var delta = (direction == 'horizontal') ? event.gesture.deltaX : event.gesture.deltaY, - interval = (this.props.touch.end - this.props.touch.start), - width = (direction == 'horizontal') ? this.body.domProps.center.width : this.body.domProps.center.height, - diffRange = -delta / width * interval; - this._applyRange(this.props.touch.start + diffRange, this.props.touch.end + diffRange); - this.body.emitter.emit('rangechange', { - start: new Date(this.start), - end: new Date(this.end) - }); -}; - -/** - * Stop dragging operation - * @param {event} event - * @private - */ -Range.prototype._onDragEnd = function (event) { - // only allow dragging when configured as movable - if (!this.options.moveable) return; + /** + * Add a value to the list with available values for this filter + * No double entries will be created. + * @param {Number} index + */ + Filter.prototype.selectValue = function(index) { + if (index >= this.values.length) + throw 'Error: index out of range'; - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.props.touch.allowDragging) return; + this.index = index; + this.value = this.values[index]; + }; - if (this.body.dom.root) { - this.body.dom.root.style.cursor = 'auto'; - } + /** + * Load all filtered rows in the background one by one + * Start this method without providing an index! + */ + Filter.prototype.loadInBackground = function(index) { + if (index === undefined) + index = 0; - // fire a rangechanged event - this.body.emitter.emit('rangechanged', { - start: new Date(this.start), - end: new Date(this.end) - }); -}; + var frame = this.graph.frame; -/** - * Event handler for mouse wheel event, used to zoom - * Code from http://adomas.org/javascript-mouse-wheel/ - * @param {Event} event - * @private - */ -Range.prototype._onMouseWheel = function(event) { - // only allow zooming when configured as zoomable and moveable - if (!(this.options.zoomable && this.options.moveable)) return; - - // retrieve delta - var delta = 0; - if (event.wheelDelta) { /* IE/Opera. */ - delta = event.wheelDelta / 120; - } else if (event.detail) { /* Mozilla case. */ - // In Mozilla, sign of delta is different than in IE. - // Also, delta is multiple of 3. - delta = -event.detail / 3; - } + if (index < this.values.length) { + var dataPointsTemp = this._getDataPoints(index); + //this.graph.redrawInfo(); // TODO: not neat - // If delta is nonzero, handle it. - // Basically, delta is now positive if wheel was scrolled up, - // and negative, if wheel was scrolled down. - if (delta) { - // perform the zoom action. Delta is normally 1 or -1 + // create a progress box + if (frame.progress === undefined) { + frame.progress = document.createElement('DIV'); + frame.progress.style.position = 'absolute'; + frame.progress.style.color = 'gray'; + frame.appendChild(frame.progress); + } + var progress = this.getLoadedProgress(); + frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; + // TODO: this is no nice solution... + frame.progress.style.bottom = 60 + 'px'; // TODO: use height of slider + frame.progress.style.left = 10 + 'px'; - // adjust a negative delta such that zooming in with delta 0.1 - // equals zooming out with a delta -0.1 - var scale; - if (delta < 0) { - scale = 1 - (delta / 5); + var me = this; + setTimeout(function() {me.loadInBackground(index+1);}, 10); + this.loaded = false; } else { - scale = 1 / (1 + (delta / 5)) ; + this.loaded = true; + + // remove the progress box + if (frame.progress !== undefined) { + frame.removeChild(frame.progress); + frame.progress = undefined; + } + + if (this.onLoadCallback) + this.onLoadCallback(); } + }; - // calculate center, the date to zoom around - var gesture = util.fakeGesture(this, event), - pointer = getPointer(gesture.center, this.body.dom.center), - pointerDate = this._pointerToDate(pointer); + module.exports = Filter; - this.zoom(scale, pointerDate); - } - // Prevent default actions caused by mouse wheel - // (else the page and timeline both zoom and scroll) - event.preventDefault(); -}; +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Start of a touch gesture - * @private - */ -Range.prototype._onTouch = function (event) { - this.props.touch.start = this.start; - this.props.touch.end = this.end; - this.props.touch.allowDragging = true; - this.props.touch.center = null; -}; + /** + * @prototype Point2d + * @param {Number} [x] + * @param {Number} [y] + */ + Point2d = function (x, y) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; + }; -/** - * On start of a hold gesture - * @private - */ -Range.prototype._onHold = function () { - this.props.touch.allowDragging = false; -}; + module.exports = Point2d; -/** - * Handle pinch event - * @param {Event} event - * @private - */ -Range.prototype._onPinch = function (event) { - // only allow zooming when configured as zoomable and moveable - if (!(this.options.zoomable && this.options.moveable)) return; - this.props.touch.allowDragging = false; +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { - if (event.gesture.touches.length > 1) { - if (!this.props.touch.center) { - this.props.touch.center = getPointer(event.gesture.center, this.body.dom.center); - } + /** + * @prototype Point3d + * @param {Number} [x] + * @param {Number} [y] + * @param {Number} [z] + */ + function Point3d(x, y, z) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; + this.z = z !== undefined ? z : 0; + }; - var scale = 1 / event.gesture.scale, - initDate = this._pointerToDate(this.props.touch.center); + /** + * Subtract the two provided points, returns a-b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a-b + */ + Point3d.subtract = function(a, b) { + var sub = new Point3d(); + sub.x = a.x - b.x; + sub.y = a.y - b.y; + sub.z = a.z - b.z; + return sub; + }; - // calculate new start and end - var newStart = parseInt(initDate + (this.props.touch.start - initDate) * scale); - var newEnd = parseInt(initDate + (this.props.touch.end - initDate) * scale); + /** + * Add the two provided points, returns a+b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a+b + */ + Point3d.add = function(a, b) { + var sum = new Point3d(); + sum.x = a.x + b.x; + sum.y = a.y + b.y; + sum.z = a.z + b.z; + return sum; + }; - // apply new range - this.setRange(newStart, newEnd); - } -}; + /** + * Calculate the average of two 3d points + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} The average, (a+b)/2 + */ + Point3d.avg = function(a, b) { + return new Point3d( + (a.x + b.x) / 2, + (a.y + b.y) / 2, + (a.z + b.z) / 2 + ); + }; -/** - * Helper function to calculate the center date for zooming - * @param {{x: Number, y: Number}} pointer - * @return {number} date - * @private - */ -Range.prototype._pointerToDate = function (pointer) { - var conversion; - var direction = this.options.direction; + /** + * Calculate the cross product of the two provided points, returns axb + * Documentation: http://en.wikipedia.org/wiki/Cross_product + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} cross product axb + */ + Point3d.crossProduct = function(a, b) { + var crossproduct = new Point3d(); - validateDirection(direction); + crossproduct.x = a.y * b.z - a.z * b.y; + crossproduct.y = a.z * b.x - a.x * b.z; + crossproduct.z = a.x * b.y - a.y * b.x; - if (direction == 'horizontal') { - var width = this.body.domProps.center.width; - conversion = this.conversion(width); - return pointer.x / conversion.scale + conversion.offset; - } - else { - var height = this.body.domProps.center.height; - conversion = this.conversion(height); - return pointer.y / conversion.scale + conversion.offset; - } -}; + return crossproduct; + }; -/** - * Get the pointer location relative to the location of the dom element - * @param {{pageX: Number, pageY: Number}} touch - * @param {Element} element HTML DOM element - * @return {{x: Number, y: Number}} pointer - * @private - */ -function getPointer (touch, element) { - return { - x: touch.pageX - vis.util.getAbsoluteLeft(element), - y: touch.pageY - vis.util.getAbsoluteTop(element) + + /** + * Rtrieve the length of the vector (or the distance from this point to the origin + * @return {Number} length + */ + Point3d.prototype.length = function() { + return Math.sqrt( + this.x * this.x + + this.y * this.y + + this.z * this.z + ); }; -} -/** - * Zoom the range the given scale in or out. Start and end date will - * be adjusted, and the timeline will be redrawn. You can optionally give a - * date around which to zoom. - * For example, try scale = 0.9 or 1.1 - * @param {Number} scale Scaling factor. Values above 1 will zoom out, - * values below 1 will zoom in. - * @param {Number} [center] Value representing a date around which will - * be zoomed. - */ -Range.prototype.zoom = function(scale, center) { - // if centerDate is not provided, take it half between start Date and end Date - if (center == null) { - center = (this.start + this.end) / 2; - } + module.exports = Point3d; - // calculate new start and end - var newStart = center + (this.start - center) * scale; - var newEnd = center + (this.end - center) * scale; - this.setRange(newStart, newEnd); -}; +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Move the range with a given delta to the left or right. Start and end - * value will be adjusted. For example, try delta = 0.1 or -0.1 - * @param {Number} delta Moving amount. Positive value will move right, - * negative value will move left - */ -Range.prototype.move = function(delta) { - // zoom start Date and end Date relative to the centerDate - var diff = (this.end - this.start); + var util = __webpack_require__(1); - // apply new values - var newStart = this.start + diff * delta; - var newEnd = this.end + diff * delta; + /** + * @constructor Slider + * + * An html slider control with start/stop/prev/next buttons + * @param {Element} container The element where the slider will be created + * @param {Object} options Available options: + * {boolean} visible If true (default) the + * slider is visible. + */ + function Slider(container, options) { + if (container === undefined) { + throw 'Error: No container element defined'; + } + this.container = container; + this.visible = (options && options.visible != undefined) ? options.visible : true; + + if (this.visible) { + this.frame = document.createElement('DIV'); + //this.frame.style.backgroundColor = '#E5E5E5'; + this.frame.style.width = '100%'; + this.frame.style.position = 'relative'; + this.container.appendChild(this.frame); + + this.frame.prev = document.createElement('INPUT'); + this.frame.prev.type = 'BUTTON'; + this.frame.prev.value = 'Prev'; + this.frame.appendChild(this.frame.prev); + + this.frame.play = document.createElement('INPUT'); + this.frame.play.type = 'BUTTON'; + this.frame.play.value = 'Play'; + this.frame.appendChild(this.frame.play); + + this.frame.next = document.createElement('INPUT'); + this.frame.next.type = 'BUTTON'; + this.frame.next.value = 'Next'; + this.frame.appendChild(this.frame.next); + + this.frame.bar = document.createElement('INPUT'); + this.frame.bar.type = 'BUTTON'; + this.frame.bar.style.position = 'absolute'; + this.frame.bar.style.border = '1px solid red'; + this.frame.bar.style.width = '100px'; + this.frame.bar.style.height = '6px'; + this.frame.bar.style.borderRadius = '2px'; + this.frame.bar.style.MozBorderRadius = '2px'; + this.frame.bar.style.border = '1px solid #7F7F7F'; + this.frame.bar.style.backgroundColor = '#E5E5E5'; + this.frame.appendChild(this.frame.bar); + + this.frame.slide = document.createElement('INPUT'); + this.frame.slide.type = 'BUTTON'; + this.frame.slide.style.margin = '0px'; + this.frame.slide.value = ' '; + this.frame.slide.style.position = 'relative'; + this.frame.slide.style.left = '-100px'; + this.frame.appendChild(this.frame.slide); + + // create events + var me = this; + this.frame.slide.onmousedown = function (event) {me._onMouseDown(event);}; + this.frame.prev.onclick = function (event) {me.prev(event);}; + this.frame.play.onclick = function (event) {me.togglePlay(event);}; + this.frame.next.onclick = function (event) {me.next(event);}; + } - // TODO: reckon with min and max range + this.onChangeCallback = undefined; - this.start = newStart; - this.end = newEnd; -}; + this.values = []; + this.index = undefined; -/** - * Move the range to a new center point - * @param {Number} moveTo New center point of the range - */ -Range.prototype.moveTo = function(moveTo) { - var center = (this.start + this.end) / 2; + this.playTimeout = undefined; + this.playInterval = 1000; // milliseconds + this.playLoop = true; + } - var diff = center - moveTo; + /** + * Select the previous index + */ + Slider.prototype.prev = function() { + var index = this.getIndex(); + if (index > 0) { + index--; + this.setIndex(index); + } + }; - // calculate new start and end - var newStart = this.start - diff; - var newEnd = this.end - diff; + /** + * Select the next index + */ + Slider.prototype.next = function() { + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } + }; - this.setRange(newStart, newEnd); -}; + /** + * Select the next index + */ + Slider.prototype.playNext = function() { + var start = new Date(); -/** - * Prototype for visual components - * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body] - * @param {Object} [options] - */ -function Component (body, options) { - this.options = null; - this.props = null; -} + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } + else if (this.playLoop) { + // jump to the start + index = 0; + this.setIndex(index); + } -/** - * Set options for the component. The new options will be merged into the - * current options. - * @param {Object} options - */ -Component.prototype.setOptions = function(options) { - if (options) { - util.extend(this.options, options); - } -}; + var end = new Date(); + var diff = (end - start); -/** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ -Component.prototype.redraw = function() { - // should be implemented by the component - return false; -}; + // calculate how much time it to to set the index and to execute the callback + // function. + var interval = Math.max(this.playInterval - diff, 0); + // document.title = diff // TODO: cleanup -/** - * Destroy the component. Cleanup DOM and event listeners - */ -Component.prototype.destroy = function() { - // should be implemented by the component -}; + var me = this; + this.playTimeout = setTimeout(function() {me.playNext();}, interval); + }; -/** - * Test whether the component is resized since the last time _isResized() was - * called. - * @return {Boolean} Returns true if the component is resized - * @protected - */ -Component.prototype._isResized = function() { - var resized = (this.props._previousWidth !== this.props.width || - this.props._previousHeight !== this.props.height); + /** + * Toggle start or stop playing + */ + Slider.prototype.togglePlay = function() { + if (this.playTimeout === undefined) { + this.play(); + } else { + this.stop(); + } + }; - this.props._previousWidth = this.props.width; - this.props._previousHeight = this.props.height; + /** + * Start playing + */ + Slider.prototype.play = function() { + // Test whether already playing + if (this.playTimeout) return; - return resized; -}; + this.playNext(); -/** - * A horizontal time axis - * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body - * @param {Object} [options] See TimeAxis.setOptions for the available - * options. - * @constructor TimeAxis - * @extends Component - */ -function TimeAxis (body, options) { - this.dom = { - foreground: null, - majorLines: [], - majorTexts: [], - minorLines: [], - minorTexts: [], - redundant: { - majorLines: [], - majorTexts: [], - minorLines: [], - minorTexts: [] + if (this.frame) { + this.frame.play.value = 'Stop'; } }; - this.props = { - range: { - start: 0, - end: 0, - minimumStep: 0 - }, - lineTop: 0 - }; - this.defaultOptions = { - orientation: 'bottom', // supported: 'top', 'bottom' - // TODO: implement timeaxis orientations 'left' and 'right' - showMinorLabels: true, - showMajorLabels: true + /** + * Stop playing + */ + Slider.prototype.stop = function() { + clearInterval(this.playTimeout); + this.playTimeout = undefined; + + if (this.frame) { + this.frame.play.value = 'Play'; + } }; - this.options = util.extend({}, this.defaultOptions); - this.body = body; + /** + * Set a callback function which will be triggered when the value of the + * slider bar has changed. + */ + Slider.prototype.setOnChangeCallback = function(callback) { + this.onChangeCallback = callback; + }; - // create the HTML DOM - this._create(); + /** + * Set the interval for playing the list + * @param {Number} interval The interval in milliseconds + */ + Slider.prototype.setPlayInterval = function(interval) { + this.playInterval = interval; + }; - this.setOptions(options); -} + /** + * Retrieve the current play interval + * @return {Number} interval The interval in milliseconds + */ + Slider.prototype.getPlayInterval = function(interval) { + return this.playInterval; + }; -TimeAxis.prototype = new Component(); + /** + * Set looping on or off + * @pararm {boolean} doLoop If true, the slider will jump to the start when + * the end is passed, and will jump to the end + * when the start is passed. + */ + Slider.prototype.setPlayLoop = function(doLoop) { + this.playLoop = doLoop; + }; -/** - * Set options for the TimeAxis. - * Parameters will be merged in current options. - * @param {Object} options Available options: - * {string} [orientation] - * {boolean} [showMinorLabels] - * {boolean} [showMajorLabels] - */ -TimeAxis.prototype.setOptions = function(options) { - if (options) { - // copy all options that we know - util.selectiveExtend(['orientation', 'showMinorLabels', 'showMajorLabels'], this.options, options); - } -}; -/** - * Create the HTML DOM for the TimeAxis - */ -TimeAxis.prototype._create = function() { - this.dom.foreground = document.createElement('div'); - this.dom.background = document.createElement('div'); + /** + * Execute the onchange callback function + */ + Slider.prototype.onChange = function() { + if (this.onChangeCallback !== undefined) { + this.onChangeCallback(); + } + }; - this.dom.foreground.className = 'timeaxis foreground'; - this.dom.background.className = 'timeaxis background'; -}; + /** + * redraw the slider on the correct place + */ + Slider.prototype.redraw = function() { + if (this.frame) { + // resize the bar + this.frame.bar.style.top = (this.frame.clientHeight/2 - + this.frame.bar.offsetHeight/2) + 'px'; + this.frame.bar.style.width = (this.frame.clientWidth - + this.frame.prev.clientWidth - + this.frame.play.clientWidth - + this.frame.next.clientWidth - 30) + 'px'; + + // position the slider button + var left = this.indexToLeft(this.index); + this.frame.slide.style.left = (left) + 'px'; + } + }; -/** - * Destroy the TimeAxis - */ -TimeAxis.prototype.destroy = function() { - // remove from DOM - if (this.dom.foreground.parentNode) { - this.dom.foreground.parentNode.removeChild(this.dom.foreground); - } - if (this.dom.background.parentNode) { - this.dom.background.parentNode.removeChild(this.dom.background); - } - this.body = null; -}; + /** + * Set the list with values for the slider + * @param {Array} values A javascript array with values (any type) + */ + Slider.prototype.setValues = function(values) { + this.values = values; -/** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ -TimeAxis.prototype.redraw = function () { - var options = this.options, - props = this.props, - foreground = this.dom.foreground, - background = this.dom.background; - - // determine the correct parent DOM element (depending on option orientation) - var parent = (options.orientation == 'top') ? this.body.dom.top : this.body.dom.bottom; - var parentChanged = (foreground.parentNode !== parent); - - // calculate character width and height - this._calculateCharSize(); - - // TODO: recalculate sizes only needed when parent is resized or options is changed - var orientation = this.options.orientation, - showMinorLabels = this.options.showMinorLabels, - showMajorLabels = this.options.showMajorLabels; - - // determine the width and height of the elemens for the axis - props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; - props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; - props.height = props.minorLabelHeight + props.majorLabelHeight; - props.width = foreground.offsetWidth; - - props.minorLineHeight = this.body.domProps.root.height - props.majorLabelHeight - - (options.orientation == 'top' ? this.body.domProps.bottom.height : this.body.domProps.top.height); - props.minorLineWidth = 1; // TODO: really calculate width - props.majorLineHeight = props.minorLineHeight + props.majorLabelHeight; - props.majorLineWidth = 1; // TODO: really calculate width - - // take foreground and background offline while updating (is almost twice as fast) - var foregroundNextSibling = foreground.nextSibling; - var backgroundNextSibling = background.nextSibling; - foreground.parentNode && foreground.parentNode.removeChild(foreground); - background.parentNode && background.parentNode.removeChild(background); - - foreground.style.height = this.props.height + 'px'; - - this._repaintLabels(); - - // put DOM online again (at the same place) - if (foregroundNextSibling) { - parent.insertBefore(foreground, foregroundNextSibling); - } - else { - parent.appendChild(foreground) - } - if (backgroundNextSibling) { - this.body.dom.backgroundVertical.insertBefore(background, backgroundNextSibling); - } - else { - this.body.dom.backgroundVertical.appendChild(background) - } + if (this.values.length > 0) + this.setIndex(0); + else + this.index = undefined; + }; - return this._isResized() || parentChanged; -}; + /** + * Select a value by its index + * @param {Number} index + */ + Slider.prototype.setIndex = function(index) { + if (index < this.values.length) { + this.index = index; -/** - * Repaint major and minor text labels and vertical grid lines - * @private - */ -TimeAxis.prototype._repaintLabels = function () { - var orientation = this.options.orientation; - - // calculate range and step (step such that we have space for 7 characters per label) - var start = util.convert(this.body.range.start, 'Number'), - end = util.convert(this.body.range.end, 'Number'), - minimumStep = this.body.util.toTime((this.props.minorCharWidth || 10) * 7).valueOf() - -this.body.util.toTime(0).valueOf(); - var step = new TimeStep(new Date(start), new Date(end), minimumStep); - this.step = step; - - // Move all DOM elements to a "redundant" list, where they - // can be picked for re-use, and clear the lists with lines and texts. - // At the end of the function _repaintLabels, left over elements will be cleaned up - var dom = this.dom; - dom.redundant.majorLines = dom.majorLines; - dom.redundant.majorTexts = dom.majorTexts; - dom.redundant.minorLines = dom.minorLines; - dom.redundant.minorTexts = dom.minorTexts; - dom.majorLines = []; - dom.majorTexts = []; - dom.minorLines = []; - dom.minorTexts = []; - - step.first(); - var xFirstMajorLabel = undefined; - var max = 0; - while (step.hasNext() && max < 1000) { - max++; - var cur = step.getCurrent(), - x = this.body.util.toScreen(cur), - isMajor = step.isMajor(); - - // TODO: lines must have a width, such that we can create css backgrounds - - if (this.options.showMinorLabels) { - this._repaintMinorText(x, step.getLabelMinor(), orientation); - } - - if (isMajor && this.options.showMajorLabels) { - if (x > 0) { - if (xFirstMajorLabel == undefined) { - xFirstMajorLabel = x; - } - this._repaintMajorText(x, step.getLabelMajor(), orientation); - } - this._repaintMajorLine(x, orientation); + this.redraw(); + this.onChange(); } else { - this._repaintMinorLine(x, orientation); + throw 'Error: index out of range'; } + }; - step.next(); - } + /** + * retrieve the index of the currently selected vaue + * @return {Number} index + */ + Slider.prototype.getIndex = function() { + return this.index; + }; - // create a major label on the left when needed - if (this.options.showMajorLabels) { - var leftTime = this.body.util.toTime(0), - leftText = step.getLabelMajor(leftTime), - widthText = leftText.length * (this.props.majorCharWidth || 10) + 10; // upper bound estimation - if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) { - this._repaintMajorText(0, leftText, orientation); - } - } + /** + * retrieve the currently selected value + * @return {*} value + */ + Slider.prototype.get = function() { + return this.values[this.index]; + }; - // Cleanup leftover DOM elements from the redundant list - util.forEach(this.dom.redundant, function (arr) { - while (arr.length) { - var elem = arr.pop(); - if (elem && elem.parentNode) { - elem.parentNode.removeChild(elem); - } - } - }); -}; -/** - * Create a minor label for the axis at position x - * @param {Number} x - * @param {String} text - * @param {String} orientation "top" or "bottom" (default) - * @private - */ -TimeAxis.prototype._repaintMinorText = function (x, text, orientation) { - // reuse redundant label - var label = this.dom.redundant.minorTexts.shift(); - - if (!label) { - // create new label - var content = document.createTextNode(''); - label = document.createElement('div'); - label.appendChild(content); - label.className = 'text minor'; - this.dom.foreground.appendChild(label); - } - this.dom.minorTexts.push(label); + Slider.prototype._onMouseDown = function(event) { + // only react on left mouse button down + var leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); + if (!leftButtonDown) return; - label.childNodes[0].nodeValue = text; + this.startClientX = event.clientX; + this.startSlideX = parseFloat(this.frame.slide.style.left); - label.style.top = (orientation == 'top') ? (this.props.majorLabelHeight + 'px') : '0'; - label.style.left = x + 'px'; - //label.title = title; // TODO: this is a heavy operation -}; + this.frame.style.cursor = 'move'; -/** - * Create a Major label for the axis at position x - * @param {Number} x - * @param {String} text - * @param {String} orientation "top" or "bottom" (default) - * @private - */ -TimeAxis.prototype._repaintMajorText = function (x, text, orientation) { - // reuse redundant label - var label = this.dom.redundant.majorTexts.shift(); - - if (!label) { - // create label - var content = document.createTextNode(text); - label = document.createElement('div'); - label.className = 'text major'; - label.appendChild(content); - this.dom.foreground.appendChild(label); - } - this.dom.majorTexts.push(label); + // add event listeners to handle moving the contents + // we store the function onmousemove and onmouseup in the graph, so we can + // remove the eventlisteners lateron in the function mouseUp() + var me = this; + this.onmousemove = function (event) {me._onMouseMove(event);}; + this.onmouseup = function (event) {me._onMouseUp(event);}; + util.addEventListener(document, 'mousemove', this.onmousemove); + util.addEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); + }; - label.childNodes[0].nodeValue = text; - //label.title = title; // TODO: this is a heavy operation - label.style.top = (orientation == 'top') ? '0' : (this.props.minorLabelHeight + 'px'); - label.style.left = x + 'px'; -}; + Slider.prototype.leftToIndex = function (left) { + var width = parseFloat(this.frame.bar.style.width) - + this.frame.slide.clientWidth - 10; + var x = left - 3; -/** - * Create a minor line for the axis at position x - * @param {Number} x - * @param {String} orientation "top" or "bottom" (default) - * @private - */ -TimeAxis.prototype._repaintMinorLine = function (x, orientation) { - // reuse redundant line - var line = this.dom.redundant.minorLines.shift(); - - if (!line) { - // create vertical line - line = document.createElement('div'); - line.className = 'grid vertical minor'; - this.dom.background.appendChild(line); - } - this.dom.minorLines.push(line); + var index = Math.round(x / width * (this.values.length-1)); + if (index < 0) index = 0; + if (index > this.values.length-1) index = this.values.length-1; - var props = this.props; - if (orientation == 'top') { - line.style.top = props.majorLabelHeight + 'px'; - } - else { - line.style.top = this.body.domProps.top.height + 'px'; - } - line.style.height = props.minorLineHeight + 'px'; - line.style.left = (x - props.minorLineWidth / 2) + 'px'; -}; + return index; + }; -/** - * Create a Major line for the axis at position x - * @param {Number} x - * @param {String} orientation "top" or "bottom" (default) - * @private - */ -TimeAxis.prototype._repaintMajorLine = function (x, orientation) { - // reuse redundant line - var line = this.dom.redundant.majorLines.shift(); - - if (!line) { - // create vertical line - line = document.createElement('DIV'); - line.className = 'grid vertical major'; - this.dom.background.appendChild(line); - } - this.dom.majorLines.push(line); + Slider.prototype.indexToLeft = function (index) { + var width = parseFloat(this.frame.bar.style.width) - + this.frame.slide.clientWidth - 10; - var props = this.props; - if (orientation == 'top') { - line.style.top = '0'; - } - else { - line.style.top = this.body.domProps.top.height + 'px'; - } - line.style.left = (x - props.majorLineWidth / 2) + 'px'; - line.style.height = props.majorLineHeight + 'px'; -}; + var x = index / (this.values.length-1) * width; + var left = x + 3; -/** - * Determine the size of text on the axis (both major and minor axis). - * The size is calculated only once and then cached in this.props. - * @private - */ -TimeAxis.prototype._calculateCharSize = function () { - // Note: We calculate char size with every redraw. Size may change, for - // example when any of the timelines parents had display:none for example. - - // determine the char width and height on the minor axis - if (!this.dom.measureCharMinor) { - this.dom.measureCharMinor = document.createElement('DIV'); - this.dom.measureCharMinor.className = 'text minor measure'; - this.dom.measureCharMinor.style.position = 'absolute'; - - this.dom.measureCharMinor.appendChild(document.createTextNode('0')); - this.dom.foreground.appendChild(this.dom.measureCharMinor); - } - this.props.minorCharHeight = this.dom.measureCharMinor.clientHeight; - this.props.minorCharWidth = this.dom.measureCharMinor.clientWidth; + return left; + }; - // determine the char width and height on the major axis - if (!this.dom.measureCharMajor) { - this.dom.measureCharMajor = document.createElement('DIV'); - this.dom.measureCharMajor.className = 'text minor measure'; - this.dom.measureCharMajor.style.position = 'absolute'; - this.dom.measureCharMajor.appendChild(document.createTextNode('0')); - this.dom.foreground.appendChild(this.dom.measureCharMajor); - } - this.props.majorCharHeight = this.dom.measureCharMajor.clientHeight; - this.props.majorCharWidth = this.dom.measureCharMajor.clientWidth; -}; -/** - * Snap a date to a rounded value. - * The snap intervals are dependent on the current scale and step. - * @param {Date} date the date to be snapped. - * @return {Date} snappedDate - */ -TimeAxis.prototype.snap = function(date) { - return this.step.snap(date); -}; + Slider.prototype._onMouseMove = function (event) { + var diff = event.clientX - this.startClientX; + var x = this.startSlideX + diff; -/** - * A current time bar - * @param {{range: Range, dom: Object, domProps: Object}} body - * @param {Object} [options] Available parameters: - * {Boolean} [showCurrentTime] - * @constructor CurrentTime - * @extends Component - */ + var index = this.leftToIndex(x); -function CurrentTime (body, options) { - this.body = body; + this.setIndex(index); - // default options - this.defaultOptions = { - showCurrentTime: true + util.preventDefault(); }; - this.options = util.extend({}, this.defaultOptions); - this._create(); - this.setOptions(options); -} + Slider.prototype._onMouseUp = function (event) { + this.frame.style.cursor = 'auto'; -CurrentTime.prototype = new Component(); + // remove event listeners + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); -/** - * Create the HTML DOM for the current time bar - * @private - */ -CurrentTime.prototype._create = function() { - var bar = document.createElement('div'); - bar.className = 'currenttime'; - bar.style.position = 'absolute'; - bar.style.top = '0px'; - bar.style.height = '100%'; + util.preventDefault(); + }; - this.bar = bar; -}; + module.exports = Slider; -/** - * Destroy the CurrentTime bar - */ -CurrentTime.prototype.destroy = function () { - this.options.showCurrentTime = false; - this.redraw(); // will remove the bar from the DOM and stop refreshing - this.body = null; -}; +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Set options for the component. Options will be merged in current options. - * @param {Object} options Available parameters: - * {boolean} [showCurrentTime] - */ -CurrentTime.prototype.setOptions = function(options) { - if (options) { - // copy all options that we know - util.selectiveExtend(['showCurrentTime'], this.options, options); - } -}; + /** + * @prototype StepNumber + * The class StepNumber is an iterator for Numbers. You provide a start and end + * value, and a best step size. StepNumber itself rounds to fixed values and + * a finds the step that best fits the provided step. + * + * If prettyStep is true, the step size is chosen as close as possible to the + * provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... + * + * Example usage: + * var step = new StepNumber(0, 10, 2.5, true); + * step.start(); + * while (!step.end()) { + * alert(step.getCurrent()); + * step.next(); + * } + * + * Version: 1.0 + * + * @param {Number} start The start value + * @param {Number} end The end value + * @param {Number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ + function StepNumber(start, end, step, prettyStep) { + // set default values + this._start = 0; + this._end = 0; + this._step = 1; + this.prettyStep = true; + this.precision = 5; + + this._current = 0; + this.setRange(start, end, step, prettyStep); + }; -/** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ -CurrentTime.prototype.redraw = function() { - if (this.options.showCurrentTime) { - var parent = this.body.dom.backgroundVertical; - if (this.bar.parentNode != parent) { - // attach to the dom - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); - } - parent.appendChild(this.bar); + /** + * Set a new range: start, end and step. + * + * @param {Number} start The start value + * @param {Number} end The end value + * @param {Number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ + StepNumber.prototype.setRange = function(start, end, step, prettyStep) { + this._start = start ? start : 0; + this._end = end ? end : 0; - this.start(); - } + this.setStep(step, prettyStep); + }; - var now = new Date(); - var x = this.body.util.toScreen(now); + /** + * Set a new step size + * @param {Number} step New step size. Must be a positive value + * @param {boolean} prettyStep Optional. If true, the provided step is rounded + * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ + StepNumber.prototype.setStep = function(step, prettyStep) { + if (step === undefined || step <= 0) + return; - this.bar.style.left = x + 'px'; - this.bar.title = 'Current time: ' + now; - } - else { - // remove the line from the DOM - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); - } - this.stop(); - } + if (prettyStep !== undefined) + this.prettyStep = prettyStep; - return false; -}; + if (this.prettyStep === true) + this._step = StepNumber.calculatePrettyStep(step); + else + this._step = step; + }; -/** - * Start auto refreshing the current time bar - */ -CurrentTime.prototype.start = function() { - var me = this; - - function update () { - me.stop(); + /** + * Calculate a nice step size, closest to the desired step size. + * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an + * integer Number. For example 1, 2, 5, 10, 20, 50, etc... + * @param {Number} step Desired step size + * @return {Number} Nice step size + */ + StepNumber.calculatePrettyStep = function (step) { + var log10 = function (x) {return Math.log(x) / Math.LN10;}; - // determine interval to refresh - var scale = me.body.range.conversion(me.body.domProps.center.width).scale; - var interval = 1 / scale / 10; - if (interval < 30) interval = 30; - if (interval > 1000) interval = 1000; + // try three steps (multiple of 1, 2, or 5 + var step1 = Math.pow(10, Math.round(log10(step))), + step2 = 2 * Math.pow(10, Math.round(log10(step / 2))), + step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); - me.redraw(); + // choose the best step (closest to minimum step) + var prettyStep = step1; + if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2; + if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; - // start a timer to adjust for the new time - me.currentTimeTimer = setTimeout(update, interval); - } + // for safety + if (prettyStep <= 0) { + prettyStep = 1; + } - update(); -}; + return prettyStep; + }; -/** - * Stop auto refreshing the current time bar - */ -CurrentTime.prototype.stop = function() { - if (this.currentTimeTimer !== undefined) { - clearTimeout(this.currentTimeTimer); - delete this.currentTimeTimer; - } -}; + /** + * returns the current value of the step + * @return {Number} current value + */ + StepNumber.prototype.getCurrent = function () { + return parseFloat(this._current.toPrecision(this.precision)); + }; -/** - * A custom time bar - * @param {{range: Range, dom: Object}} body - * @param {Object} [options] Available parameters: - * {Boolean} [showCustomTime] - * @constructor CustomTime - * @extends Component - */ + /** + * returns the current step size + * @return {Number} current step size + */ + StepNumber.prototype.getStep = function () { + return this._step; + }; -function CustomTime (body, options) { - this.body = body; + /** + * Set the current value to the largest value smaller than start, which + * is a multiple of the step size + */ + StepNumber.prototype.start = function() { + this._current = this._start - this._start % this._step; + }; - // default options - this.defaultOptions = { - showCustomTime: false + /** + * Do a step, add the step size to the current value + */ + StepNumber.prototype.next = function () { + this._current += this._step; }; - this.options = util.extend({}, this.defaultOptions); - this.customTime = new Date(); - this.eventParams = {}; // stores state parameters while dragging the bar + /** + * Returns true whether the end is reached + * @return {boolean} True if the current value has passed the end value. + */ + StepNumber.prototype.end = function () { + return (this._current > this._end); + }; - // create the DOM - this._create(); + module.exports = StepNumber; - this.setOptions(options); -} -CustomTime.prototype = new Component(); +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Set options for the component. Options will be merged in current options. - * @param {Object} options Available parameters: - * {boolean} [showCustomTime] - */ -CustomTime.prototype.setOptions = function(options) { - if (options) { - // copy all options that we know - util.selectiveExtend(['showCustomTime'], this.options, options); - } -}; + var Emitter = __webpack_require__(45); + var Hammer = __webpack_require__(41); + var util = __webpack_require__(1); + var DataSet = __webpack_require__(3); + var DataView = __webpack_require__(4); + var Range = __webpack_require__(15); + var TimeAxis = __webpack_require__(27); + var CurrentTime = __webpack_require__(19); + var CustomTime = __webpack_require__(20); + var ItemSet = __webpack_require__(24); -/** - * Create the DOM for the custom time - * @private - */ -CustomTime.prototype._create = function() { - var bar = document.createElement('div'); - bar.className = 'customtime'; - bar.style.position = 'absolute'; - bar.style.top = '0px'; - bar.style.height = '100%'; - this.bar = bar; - - var drag = document.createElement('div'); - drag.style.position = 'relative'; - drag.style.top = '0px'; - drag.style.left = '-10px'; - drag.style.height = '100%'; - drag.style.width = '20px'; - bar.appendChild(drag); - - // attach event listeners - this.hammer = Hammer(bar, { - prevent_default: true - }); - this.hammer.on('dragstart', this._onDragStart.bind(this)); - this.hammer.on('drag', this._onDrag.bind(this)); - this.hammer.on('dragend', this._onDragEnd.bind(this)); -}; + /** + * Create a timeline visualization + * @param {HTMLElement} container + * @param {vis.DataSet | Array | google.visualization.DataTable} [items] + * @param {Object} [options] See Timeline.setOptions for the available options. + * @constructor + */ + function Timeline (container, items, options) { + if (!(this instanceof Timeline)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } -/** - * Destroy the CustomTime bar - */ -CustomTime.prototype.destroy = function () { - this.options.showCustomTime = false; - this.redraw(); // will remove the bar from the DOM + var me = this; + this.defaultOptions = { + start: null, + end: null, - this.hammer.enable(false); - this.hammer = null; + autoResize: true, - this.body = null; -}; + orientation: 'bottom', + width: null, + height: null, + maxHeight: null, + minHeight: null + }; + this.options = util.deepExtend({}, this.defaultOptions); -/** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ -CustomTime.prototype.redraw = function () { - if (this.options.showCustomTime) { - var parent = this.body.dom.backgroundVertical; - if (this.bar.parentNode != parent) { - // attach to the dom - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); - } - parent.appendChild(this.bar); - } + // Create the DOM, props, and emitter + this._create(container); - var x = this.body.util.toScreen(this.customTime); + // all components listed here will be repainted automatically + this.components = []; - this.bar.style.left = x + 'px'; - this.bar.title = 'Time: ' + this.customTime; - } - else { - // remove the line from the DOM - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); - } - } + this.body = { + dom: this.dom, + domProps: this.props, + emitter: { + on: this.on.bind(this), + off: this.off.bind(this), + emit: this.emit.bind(this) + }, + util: { + snap: null, // will be specified after TimeAxis is created + toScreen: me._toScreen.bind(me), + toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width + toTime: me._toTime.bind(me), + toGlobalTime : me._toGlobalTime.bind(me) + } + }; - return false; -}; + // range + this.range = new Range(this.body); + this.components.push(this.range); + this.body.range = this.range; -/** - * Set custom time. - * @param {Date} time - */ -CustomTime.prototype.setCustomTime = function(time) { - this.customTime = new Date(time.valueOf()); - this.redraw(); -}; + // time axis + this.timeAxis = new TimeAxis(this.body); + this.components.push(this.timeAxis); + this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); -/** - * Retrieve the current custom time. - * @return {Date} customTime - */ -CustomTime.prototype.getCustomTime = function() { - return new Date(this.customTime.valueOf()); -}; + // current time bar + this.currentTime = new CurrentTime(this.body); + this.components.push(this.currentTime); -/** - * Start moving horizontally - * @param {Event} event - * @private - */ -CustomTime.prototype._onDragStart = function(event) { - this.eventParams.dragging = true; - this.eventParams.customTime = this.customTime; + // custom time bar + // Note: time bar will be attached in this.setOptions when selected + this.customTime = new CustomTime(this.body); + this.components.push(this.customTime); - event.stopPropagation(); - event.preventDefault(); -}; + // item set + this.itemSet = new ItemSet(this.body); + this.components.push(this.itemSet); -/** - * Perform moving operating. - * @param {Event} event - * @private - */ -CustomTime.prototype._onDrag = function (event) { - if (!this.eventParams.dragging) return; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet - var deltaX = event.gesture.deltaX, - x = this.body.util.toScreen(this.eventParams.customTime) + deltaX, - time = this.body.util.toTime(x); + // apply options + if (options) { + this.setOptions(options); + } - this.setCustomTime(time); + // create itemset + if (items) { + this.setItems(items); + } + else { + this.redraw(); + } + } - // fire a timechange event - this.body.emitter.emit('timechange', { - time: new Date(this.customTime.valueOf()) - }); + // turn Timeline into an event emitter + Emitter(Timeline.prototype); - event.stopPropagation(); - event.preventDefault(); -}; + /** + * Create the main DOM for the Timeline: a root panel containing left, right, + * top, bottom, content, and background panel. + * @param {Element} container The container element where the Timeline will + * be attached. + * @private + */ + Timeline.prototype._create = function (container) { + this.dom = {}; -/** - * Stop moving operating. - * @param {event} event - * @private - */ -CustomTime.prototype._onDragEnd = function (event) { - if (!this.eventParams.dragging) return; + this.dom.root = document.createElement('div'); + this.dom.background = document.createElement('div'); + this.dom.backgroundVertical = document.createElement('div'); + this.dom.backgroundHorizontal = document.createElement('div'); + this.dom.centerContainer = document.createElement('div'); + this.dom.leftContainer = document.createElement('div'); + this.dom.rightContainer = document.createElement('div'); + this.dom.center = document.createElement('div'); + this.dom.left = document.createElement('div'); + this.dom.right = document.createElement('div'); + this.dom.top = document.createElement('div'); + this.dom.bottom = document.createElement('div'); + this.dom.shadowTop = document.createElement('div'); + this.dom.shadowBottom = document.createElement('div'); + this.dom.shadowTopLeft = document.createElement('div'); + this.dom.shadowBottomLeft = document.createElement('div'); + this.dom.shadowTopRight = document.createElement('div'); + this.dom.shadowBottomRight = document.createElement('div'); + + this.dom.background.className = 'vispanel background'; + this.dom.backgroundVertical.className = 'vispanel background vertical'; + this.dom.backgroundHorizontal.className = 'vispanel background horizontal'; + this.dom.centerContainer.className = 'vispanel center'; + this.dom.leftContainer.className = 'vispanel left'; + this.dom.rightContainer.className = 'vispanel right'; + this.dom.top.className = 'vispanel top'; + this.dom.bottom.className = 'vispanel bottom'; + this.dom.left.className = 'content'; + this.dom.center.className = 'content'; + this.dom.right.className = 'content'; + this.dom.shadowTop.className = 'shadow top'; + this.dom.shadowBottom.className = 'shadow bottom'; + this.dom.shadowTopLeft.className = 'shadow top'; + this.dom.shadowBottomLeft.className = 'shadow bottom'; + this.dom.shadowTopRight.className = 'shadow top'; + this.dom.shadowBottomRight.className = 'shadow bottom'; + + this.dom.root.appendChild(this.dom.background); + this.dom.root.appendChild(this.dom.backgroundVertical); + this.dom.root.appendChild(this.dom.backgroundHorizontal); + this.dom.root.appendChild(this.dom.centerContainer); + this.dom.root.appendChild(this.dom.leftContainer); + this.dom.root.appendChild(this.dom.rightContainer); + this.dom.root.appendChild(this.dom.top); + this.dom.root.appendChild(this.dom.bottom); + + this.dom.centerContainer.appendChild(this.dom.center); + this.dom.leftContainer.appendChild(this.dom.left); + this.dom.rightContainer.appendChild(this.dom.right); + + this.dom.centerContainer.appendChild(this.dom.shadowTop); + this.dom.centerContainer.appendChild(this.dom.shadowBottom); + this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); + this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); + this.dom.rightContainer.appendChild(this.dom.shadowTopRight); + this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); + + this.on('rangechange', this.redraw.bind(this)); + this.on('change', this.redraw.bind(this)); + this.on('touch', this._onTouch.bind(this)); + this.on('pinch', this._onPinch.bind(this)); + this.on('dragstart', this._onDragStart.bind(this)); + this.on('drag', this._onDrag.bind(this)); + + // create event listeners for all interesting events, these events will be + // emitted via emitter + this.hammer = Hammer(this.dom.root, { + prevent_default: true + }); + this.listeners = {}; - // fire a timechanged event - this.body.emitter.emit('timechanged', { - time: new Date(this.customTime.valueOf()) - }); + var me = this; + var events = [ + 'touch', 'pinch', + 'tap', 'doubletap', 'hold', + 'dragstart', 'drag', 'dragend', + 'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox + ]; + events.forEach(function (event) { + var listener = function () { + var args = [event].concat(Array.prototype.slice.call(arguments, 0)); + me.emit.apply(me, args); + }; + me.hammer.on(event, listener); + me.listeners[event] = listener; + }); - event.stopPropagation(); - event.preventDefault(); -}; + // size properties of each of the panels + this.props = { + root: {}, + background: {}, + centerContainer: {}, + leftContainer: {}, + rightContainer: {}, + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + border: {}, + scrollTop: 0, + scrollTopMin: 0 + }; + this.touch = {}; // store state information needed for touch events -var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items + // attach the root panel to the provided container + if (!container) throw new Error('No container provided'); + container.appendChild(this.dom.root); + }; -/** - * An ItemSet holds a set of items and ranges which can be displayed in a - * range. The width is determined by the parent of the ItemSet, and the height - * is determined by the size of the items. - * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body - * @param {Object} [options] See ItemSet.setOptions for the available options. - * @constructor ItemSet - * @extends Component - */ -function ItemSet(body, options) { - this.body = body; - - this.defaultOptions = { - type: null, // 'box', 'point', 'range' - orientation: 'bottom', // 'top' or 'bottom' - align: 'center', // alignment of box items - stack: true, - groupOrder: null, - - selectable: true, - editable: { - updateTime: false, - updateGroup: false, - add: false, - remove: false - }, - - onAdd: function (item, callback) { - callback(item); - }, - onUpdate: function (item, callback) { - callback(item); - }, - onMove: function (item, callback) { - callback(item); - }, - onRemove: function (item, callback) { - callback(item); - }, - - margin: { - item: 10, - axis: 20 - }, - padding: 5 - }; - - // options is shared by this ItemSet and all its items - this.options = util.extend({}, this.defaultOptions); - - // options for getting items from the DataSet with the correct type - this.itemOptions = { - type: {start: 'Date', end: 'Date'} - }; - - this.conversion = { - toScreen: body.util.toScreen, - toTime: body.util.toTime - }; - this.dom = {}; - this.props = {}; - this.hammer = null; - - var me = this; - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet - - // listeners for the DataSet of the items - this.itemListeners = { - 'add': function (event, params, senderId) { - me._onAdd(params.items); - }, - 'update': function (event, params, senderId) { - me._onUpdate(params.items); - }, - 'remove': function (event, params, senderId) { - me._onRemove(params.items); - } - }; - - // listeners for the DataSet of the groups - this.groupListeners = { - 'add': function (event, params, senderId) { - me._onAddGroups(params.items); - }, - 'update': function (event, params, senderId) { - me._onUpdateGroups(params.items); - }, - 'remove': function (event, params, senderId) { - me._onRemoveGroups(params.items); - } - }; - - this.items = {}; // object with an Item for every data item - this.groups = {}; // Group object for every group - this.groupIds = []; - - this.selection = []; // list with the ids of all selected nodes - this.stackDirty = true; // if true, all items will be restacked on next redraw - - this.touchParams = {}; // stores properties while dragging - // create the HTML DOM - - this._create(); - - this.setOptions(options); -} - -ItemSet.prototype = new Component(); - -// available item types will be registered here -ItemSet.types = { - box: ItemBox, - range: ItemRange, - point: ItemPoint -}; + /** + * Destroy the Timeline, clean up all DOM elements and event listeners. + */ + Timeline.prototype.destroy = function () { + // unbind datasets + this.clear(); -/** - * Create the HTML DOM for the ItemSet - */ -ItemSet.prototype._create = function(){ - var frame = document.createElement('div'); - frame.className = 'itemset'; - frame['timeline-itemset'] = this; - this.dom.frame = frame; - - // create background panel - var background = document.createElement('div'); - background.className = 'background'; - frame.appendChild(background); - this.dom.background = background; - - // create foreground panel - var foreground = document.createElement('div'); - foreground.className = 'foreground'; - frame.appendChild(foreground); - this.dom.foreground = foreground; - - // create axis panel - var axis = document.createElement('div'); - axis.className = 'axis'; - this.dom.axis = axis; - - // create labelset - var labelSet = document.createElement('div'); - labelSet.className = 'labelset'; - this.dom.labelSet = labelSet; - - // create ungrouped Group - this._updateUngrouped(); - - // attach event listeners - // Note: we bind to the centerContainer for the case where the height - // of the center container is larger than of the ItemSet, so we - // can click in the empty area to create a new item or deselect an item. - this.hammer = Hammer(this.body.dom.centerContainer, { - prevent_default: true - }); - - // drag items when selected - this.hammer.on('touch', this._onTouch.bind(this)); - this.hammer.on('dragstart', this._onDragStart.bind(this)); - this.hammer.on('drag', this._onDrag.bind(this)); - this.hammer.on('dragend', this._onDragEnd.bind(this)); - - // single select (or unselect) when tapping an item - this.hammer.on('tap', this._onSelectItem.bind(this)); - - // multi select when holding mouse/touch, or on ctrl+click - this.hammer.on('hold', this._onMultiSelectItem.bind(this)); - - // add item on doubletap - this.hammer.on('doubletap', this._onAddItem.bind(this)); - - // attach to the DOM - this.show(); -}; + // remove all event listeners + this.off(); -/** - * Set options for the ItemSet. Existing options will be extended/overwritten. - * @param {Object} [options] The following options are available: - * {String} type - * Default type for the items. Choose from 'box' - * (default), 'point', or 'range'. The default - * Style can be overwritten by individual items. - * {String} align - * Alignment for the items, only applicable for - * ItemBox. Choose 'center' (default), 'left', or - * 'right'. - * {String} orientation - * Orientation of the item set. Choose 'top' or - * 'bottom' (default). - * {Function} groupOrder - * A sorting function for ordering groups - * {Boolean} stack - * If true (deafult), items will be stacked on - * top of each other. - * {Number} margin.axis - * Margin between the axis and the items in pixels. - * Default is 20. - * {Number} margin.item - * Margin between items in pixels. Default is 10. - * {Number} margin - * Set margin for both axis and items in pixels. - * {Number} padding - * Padding of the contents of an item in pixels. - * Must correspond with the items css. Default is 5. - * {Boolean} selectable - * If true (default), items can be selected. - * {Boolean} editable - * Set all editable options to true or false - * {Boolean} editable.updateTime - * Allow dragging an item to an other moment in time - * {Boolean} editable.updateGroup - * Allow dragging an item to an other group - * {Boolean} editable.add - * Allow creating new items on double tap - * {Boolean} editable.remove - * Allow removing items by clicking the delete button - * top right of a selected item. - * {Function(item: Item, callback: Function)} onAdd - * Callback function triggered when an item is about to be added: - * when the user double taps an empty space in the Timeline. - * {Function(item: Item, callback: Function)} onUpdate - * Callback function fired when an item is about to be updated. - * This function typically has to show a dialog where the user - * change the item. If not implemented, nothing happens. - * {Function(item: Item, callback: Function)} onMove - * Fired when an item has been moved. If not implemented, - * the move action will be accepted. - * {Function(item: Item, callback: Function)} onRemove - * Fired when an item is about to be deleted. - * If not implemented, the item will be always removed. - */ -ItemSet.prototype.setOptions = function(options) { - if (options) { - // copy all options that we know - var fields = ['type', 'align', 'orientation', 'padding', 'stack', 'selectable', 'groupOrder']; - util.selectiveExtend(fields, this.options, options); + // stop checking for changed size + this._stopAutoResize(); - if ('margin' in options) { - if (typeof options.margin === 'number') { - this.options.margin.axis = options.margin; - this.options.margin.item = options.margin; - } - else if (typeof options.margin === 'object'){ - util.selectiveExtend(['axis', 'item'], this.options.margin, options.margin); - } + // remove from DOM + if (this.dom.root.parentNode) { + this.dom.root.parentNode.removeChild(this.dom.root); } + this.dom = null; - if ('editable' in options) { - if (typeof options.editable === 'boolean') { - this.options.editable.updateTime = options.editable; - this.options.editable.updateGroup = options.editable; - this.options.editable.add = options.editable; - this.options.editable.remove = options.editable; - } - else if (typeof options.editable === 'object') { - util.selectiveExtend(['updateTime', 'updateGroup', 'add', 'remove'], this.options.editable, options.editable); + // cleanup hammer touch events + for (var event in this.listeners) { + if (this.listeners.hasOwnProperty(event)) { + delete this.listeners[event]; } } + this.listeners = null; + this.hammer = null; - // callback functions - var addCallback = (function (name) { - if (name in options) { - var fn = options[name]; - if (!(fn instanceof Function) || fn.length != 2) { - throw new Error('option ' + name + ' must be a function ' + name + '(item, callback)'); - } - this.options[name] = fn; - } - }).bind(this); - ['onAdd', 'onUpdate', 'onRemove', 'onMove'].forEach(addCallback); - - // force the itemSet to refresh: options like orientation and margins may be changed - this.markDirty(); - } -}; + // give all components the opportunity to cleanup + this.components.forEach(function (component) { + component.destroy(); + }); -/** - * Mark the ItemSet dirty so it will refresh everything with next redraw - */ -ItemSet.prototype.markDirty = function() { - this.groupIds = []; - this.stackDirty = true; -}; + this.body = null; + }; -/** - * Destroy the ItemSet - */ -ItemSet.prototype.destroy = function() { - this.hide(); - this.setItems(null); - this.setGroups(null); + /** + * Set options. Options will be passed to all components loaded in the Timeline. + * @param {Object} [options] + * {String} orientation + * Vertical orientation for the Timeline, + * can be 'bottom' (default) or 'top'. + * {String | Number} width + * Width for the timeline, a number in pixels or + * a css string like '1000px' or '75%'. '100%' by default. + * {String | Number} height + * Fixed height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. If undefined, + * The Timeline will automatically size such that + * its contents fit. + * {String | Number} minHeight + * Minimum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {String | Number} maxHeight + * Maximum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {Number | Date | String} start + * Start date for the visible window + * {Number | Date | String} end + * End date for the visible window + */ + Timeline.prototype.setOptions = function (options) { + if (options) { + // copy the known options + var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation']; + util.selectiveExtend(fields, this.options, options); - this.hammer = null; + // enable/disable autoResize + this._initAutoResize(); + } - this.body = null; - this.conversion = null; -}; + // propagate options to all components + this.components.forEach(function (component) { + component.setOptions(options); + }); -/** - * Hide the component from the DOM - */ -ItemSet.prototype.hide = function() { - // remove the frame containing the items - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); - } + // TODO: remove deprecation error one day (deprecated since version 0.8.0) + if (options && options.order) { + throw new Error('Option order is deprecated. There is no replacement for this feature.'); + } - // remove the axis with dots - if (this.dom.axis.parentNode) { - this.dom.axis.parentNode.removeChild(this.dom.axis); - } + // redraw everything + this.redraw(); + }; - // remove the labelset containing all group labels - if (this.dom.labelSet.parentNode) { - this.dom.labelSet.parentNode.removeChild(this.dom.labelSet); - } -}; + /** + * Set a custom time bar + * @param {Date} time + */ + Timeline.prototype.setCustomTime = function (time) { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); + } -/** - * Show the component in the DOM (when not already visible). - * @return {Boolean} changed - */ -ItemSet.prototype.show = function() { - // show frame containing the items - if (!this.dom.frame.parentNode) { - this.body.dom.center.appendChild(this.dom.frame); - } + this.customTime.setCustomTime(time); + }; - // show axis with dots - if (!this.dom.axis.parentNode) { - this.body.dom.backgroundVertical.appendChild(this.dom.axis); - } + /** + * Retrieve the current custom time. + * @return {Date} customTime + */ + Timeline.prototype.getCustomTime = function() { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); + } - // show labelset containing labels - if (!this.dom.labelSet.parentNode) { - this.body.dom.left.appendChild(this.dom.labelSet); - } -}; + return this.customTime.getCustomTime(); + }; -/** - * Set selected items by their id. Replaces the current selection - * Unknown id's are silently ignored. - * @param {Array} [ids] An array with zero or more id's of the items to be - * selected. If ids is an empty array, all items will be - * unselected. - */ -ItemSet.prototype.setSelection = function(ids) { - var i, ii, id, item; + /** + * Set items + * @param {vis.DataSet | Array | google.visualization.DataTable | null} items + */ + Timeline.prototype.setItems = function(items) { + var initialLoad = (this.itemsData == null); - if (ids) { - if (!Array.isArray(ids)) { - throw new TypeError('Array expected'); + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; } - - // unselect currently selected items - for (i = 0, ii = this.selection.length; i < ii; i++) { - id = this.selection[i]; - item = this.items[id]; - if (item) item.unselect(); + else if (items instanceof DataSet || items instanceof DataView) { + newDataSet = items; } - - // select items - this.selection = []; - for (i = 0, ii = ids.length; i < ii; i++) { - id = ids[i]; - item = this.items[id]; - if (item) { - this.selection.push(id); - item.select(); - } + else { + // turn an array into a dataset + newDataSet = new DataSet(items, { + type: { + start: 'Date', + end: 'Date' + } + }); } - } -}; -/** - * Get the selected items by their id - * @return {Array} ids The ids of the selected items - */ -ItemSet.prototype.getSelection = function() { - return this.selection.concat([]); -}; + // set items + this.itemsData = newDataSet; + this.itemSet && this.itemSet.setItems(newDataSet); -/** - * Deselect a selected item - * @param {String | Number} id - * @private - */ -ItemSet.prototype._deselect = function(id) { - var selection = this.selection; - for (var i = 0, ii = selection.length; i < ii; i++) { - if (selection[i] == id) { // non-strict comparison! - selection.splice(i, 1); - break; - } - } -}; + if (initialLoad && ('start' in this.options || 'end' in this.options)) { + this.fit(); -/** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ -ItemSet.prototype.redraw = function() { - var margin = this.options.margin, - range = this.body.range, - asSize = util.option.asSize, - options = this.options, - orientation = options.orientation, - resized = false, - frame = this.dom.frame, - editable = options.editable.updateTime || options.editable.updateGroup; - - // update class name - frame.className = 'itemset' + (editable ? ' editable' : ''); - - // reorder the groups (if needed) - resized = this._orderGroups() || resized; - - // check whether zoomed (in that case we need to re-stack everything) - // TODO: would be nicer to get this as a trigger from Range - var visibleInterval = range.end - range.start; - var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.props.width != this.props.lastWidth); - if (zoomed) this.stackDirty = true; - this.lastVisibleInterval = visibleInterval; - this.props.lastWidth = this.props.width; - - // redraw all groups - var restack = this.stackDirty, - firstGroup = this._firstGroup(), - firstMargin = { - item: margin.item, - axis: margin.axis - }, - nonFirstMargin = { - item: margin.item, - axis: margin.item / 2 - }, - height = 0, - minHeight = margin.axis + margin.item; - util.forEach(this.groups, function (group) { - var groupMargin = (group == firstGroup) ? firstMargin : nonFirstMargin; - var groupResized = group.redraw(range, groupMargin, restack); - resized = groupResized || resized; - height += group.height; - }); - height = Math.max(height, minHeight); - this.stackDirty = false; - - // update frame height - frame.style.height = asSize(height); - - // calculate actual size and position - this.props.top = frame.offsetTop; - this.props.left = frame.offsetLeft; - this.props.width = frame.offsetWidth; - this.props.height = height; - - // reposition axis - this.dom.axis.style.top = asSize((orientation == 'top') ? - (this.body.domProps.top.height + this.body.domProps.border.top) : - (this.body.domProps.top.height + this.body.domProps.centerContainer.height)); - this.dom.axis.style.left = this.body.domProps.border.left + 'px'; - - // check if this component is resized - resized = this._isResized() || resized; - - return resized; -}; + var start = ('start' in this.options) ? util.convert(this.options.start, 'Date') : null; + var end = ('end' in this.options) ? util.convert(this.options.end, 'Date') : null; -/** - * Get the first group, aligned with the axis - * @return {Group | null} firstGroup - * @private - */ -ItemSet.prototype._firstGroup = function() { - var firstGroupIndex = (this.options.orientation == 'top') ? 0 : (this.groupIds.length - 1); - var firstGroupId = this.groupIds[firstGroupIndex]; - var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED]; + this.setWindow(start, end); + } + }; - return firstGroup || null; -}; + /** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ + Timeline.prototype.getVisibleItems = function() { + return this.itemSet && this.itemSet.getVisibleItems() || []; + }; -/** - * Create or delete the group holding all ungrouped items. This group is used when - * there are no groups specified. - * @protected - */ -ItemSet.prototype._updateUngrouped = function() { - var ungrouped = this.groups[UNGROUPED]; - if (this.groupsData) { - // remove the group holding all ungrouped items - if (ungrouped) { - ungrouped.hide(); - delete this.groups[UNGROUPED]; + /** + * Set groups + * @param {vis.DataSet | Array | google.visualization.DataTable} groups + */ + Timeline.prototype.setGroups = function(groups) { + // convert to type DataSet when needed + var newDataSet; + if (!groups) { + newDataSet = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + newDataSet = groups; + } + else { + // turn an array into a dataset + newDataSet = new DataSet(groups); } - } - else { - // create a group holding all (unfiltered) items - if (!ungrouped) { - var id = null; - var data = null; - ungrouped = new Group(id, data, this); - this.groups[UNGROUPED] = ungrouped; - for (var itemId in this.items) { - if (this.items.hasOwnProperty(itemId)) { - ungrouped.add(this.items[itemId]); - } - } + this.groupsData = newDataSet; + this.itemSet.setGroups(newDataSet); + }; - ungrouped.show(); + /** + * Clear the Timeline. By Default, items, groups and options are cleared. + * Example usage: + * + * timeline.clear(); // clear items, groups, and options + * timeline.clear({options: true}); // clear options only + * + * @param {Object} [what] Optionally specify what to clear. By default: + * {items: true, groups: true, options: true} + */ + Timeline.prototype.clear = function(what) { + // clear items + if (!what || what.items) { + this.setItems(null); } - } -}; -/** - * Get the element for the labelset - * @return {HTMLElement} labelSet - */ -ItemSet.prototype.getLabelSet = function() { - return this.dom.labelSet; -}; + // clear groups + if (!what || what.groups) { + this.setGroups(null); + } -/** - * Set items - * @param {vis.DataSet | null} items - */ -ItemSet.prototype.setItems = function(items) { - var me = this, - ids, - oldItemsData = this.itemsData; + // clear options of timeline and of each of the components + if (!what || what.options) { + this.components.forEach(function (component) { + component.setOptions(component.defaultOptions); + }); - // replace the dataset - if (!items) { - this.itemsData = null; - } - else if (items instanceof DataSet || items instanceof DataView) { - this.itemsData = items; - } - else { - throw new TypeError('Data must be an instance of DataSet or DataView'); - } + this.setOptions(this.defaultOptions); // this will also do a redraw + } + }; - if (oldItemsData) { - // unsubscribe from old dataset - util.forEach(this.itemListeners, function (callback, event) { - oldItemsData.off(event, callback); - }); + /** + * Set Timeline window such that it fits all items + */ + Timeline.prototype.fit = function() { + // apply the data range as range + var dataRange = this.getItemRange(); - // remove all drawn items - ids = oldItemsData.getIds(); - this._onRemove(ids); - } + // add 5% space on both sides + var start = dataRange.min; + var end = dataRange.max; + if (start != null && end != null) { + var interval = (end.valueOf() - start.valueOf()); + if (interval <= 0) { + // prevent an empty interval + interval = 24 * 60 * 60 * 1000; // 1 day + } + start = new Date(start.valueOf() - interval * 0.05); + end = new Date(end.valueOf() + interval * 0.05); + } - if (this.itemsData) { - // subscribe to new dataset - var id = this.id; - util.forEach(this.itemListeners, function (callback, event) { - me.itemsData.on(event, callback, id); - }); + // skip range set if there is no start and end date + if (start === null && end === null) { + return; + } - // add all new items - ids = this.itemsData.getIds(); - this._onAdd(ids); + this.range.setRange(start, end); + }; - // update the group holding all ungrouped items - this._updateUngrouped(); - } -}; + /** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ + Timeline.prototype.getItemRange = function() { + // calculate min from start filed + var dataset = this.itemsData.getDataSet(), + min = null, + max = null; + + if (dataset) { + // calculate the minimum value of the field 'start' + var minItem = dataset.min('start'); + min = minItem ? util.convert(minItem.start, 'Date').valueOf() : null; + // Note: we convert first to Date and then to number because else + // a conversion from ISODate to Number will fail + + // calculate maximum value of fields 'start' and 'end' + var maxStartItem = dataset.max('start'); + if (maxStartItem) { + max = util.convert(maxStartItem.start, 'Date').valueOf(); + } + var maxEndItem = dataset.max('end'); + if (maxEndItem) { + if (max == null) { + max = util.convert(maxEndItem.end, 'Date').valueOf(); + } + else { + max = Math.max(max, util.convert(maxEndItem.end, 'Date').valueOf()); + } + } + } -/** - * Get the current items - * @returns {vis.DataSet | null} - */ -ItemSet.prototype.getItems = function() { - return this.itemsData; -}; + return { + min: (min != null) ? new Date(min) : null, + max: (max != null) ? new Date(max) : null + }; + }; -/** - * Set groups - * @param {vis.DataSet} groups - */ -ItemSet.prototype.setGroups = function(groups) { - var me = this, - ids; + /** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {Array} [ids] An array with zero or more id's of the items to be + * selected. If ids is an empty array, all items will be + * unselected. + */ + Timeline.prototype.setSelection = function(ids) { + this.itemSet && this.itemSet.setSelection(ids); + }; - // unsubscribe from current dataset - if (this.groupsData) { - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.unsubscribe(event, callback); - }); + /** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ + Timeline.prototype.getSelection = function() { + return this.itemSet && this.itemSet.getSelection() || []; + }; - // remove all drawn groups - ids = this.groupsData.getIds(); - this.groupsData = null; - this._onRemoveGroups(ids); // note: this will cause a redraw - } + /** + * Set the visible window. Both parameters are optional, you can change only + * start or only end. Syntax: + * + * TimeLine.setWindow(start, end) + * TimeLine.setWindow(range) + * + * Where start and end can be a Date, number, or string, and range is an + * object with properties start and end. + * + * @param {Date | Number | String | Object} [start] Start date of visible window + * @param {Date | Number | String} [end] End date of visible window + */ + Timeline.prototype.setWindow = function(start, end) { + if (arguments.length == 1) { + var range = arguments[0]; + this.range.setRange(range.start, range.end); + } + else { + this.range.setRange(start, end); + } + }; - // replace the dataset - if (!groups) { - this.groupsData = null; - } - else if (groups instanceof DataSet || groups instanceof DataView) { - this.groupsData = groups; - } - else { - throw new TypeError('Data must be an instance of DataSet or DataView'); - } + /** + * Get the visible window + * @return {{start: Date, end: Date}} Visible range + */ + Timeline.prototype.getWindow = function() { + var range = this.range.getRange(); + return { + start: new Date(range.start), + end: new Date(range.end) + }; + }; - if (this.groupsData) { - // subscribe to new dataset - var id = this.id; - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.on(event, callback, id); + /** + * Force a redraw of the Timeline. Can be useful to manually redraw when + * option autoResize=false + */ + Timeline.prototype.redraw = function() { + var resized = false, + options = this.options, + props = this.props, + dom = this.dom; + + if (!dom) return; // when destroyed + + // update class names + dom.root.className = 'vis timeline root ' + options.orientation; + + // update root width and height options + dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); + dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); + dom.root.style.width = util.option.asSize(options.width, ''); + + // calculate border widths + props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; + props.border.right = props.border.left; + props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; + props.border.bottom = props.border.top; + var borderRootHeight= dom.root.offsetHeight - dom.root.clientHeight; + var borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; + + // calculate the heights. If any of the side panels is empty, we set the height to + // minus the border width, such that the border will be invisible + props.center.height = dom.center.offsetHeight; + props.left.height = dom.left.offsetHeight; + props.right.height = dom.right.offsetHeight; + props.top.height = dom.top.clientHeight || -props.border.top; + props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; + + // TODO: compensate borders when any of the panels is empty. + + // apply auto height + // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) + var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); + var autoHeight = props.top.height + contentHeight + props.bottom.height + + borderRootHeight + props.border.top + props.border.bottom; + dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); + + // calculate heights of the content panels + props.root.height = dom.root.offsetHeight; + props.background.height = props.root.height - borderRootHeight; + var containerHeight = props.root.height - props.top.height - props.bottom.height - + borderRootHeight; + props.centerContainer.height = containerHeight; + props.leftContainer.height = containerHeight; + props.rightContainer.height = props.leftContainer.height; + + // calculate the widths of the panels + props.root.width = dom.root.offsetWidth; + props.background.width = props.root.width - borderRootWidth; + props.left.width = dom.leftContainer.clientWidth || -props.border.left; + props.leftContainer.width = props.left.width; + props.right.width = dom.rightContainer.clientWidth || -props.border.right; + props.rightContainer.width = props.right.width; + var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; + props.center.width = centerWidth; + props.centerContainer.width = centerWidth; + props.top.width = centerWidth; + props.bottom.width = centerWidth; + + // resize the panels + dom.background.style.height = props.background.height + 'px'; + dom.backgroundVertical.style.height = props.background.height + 'px'; + dom.backgroundHorizontal.style.height = props.centerContainer.height + 'px'; + dom.centerContainer.style.height = props.centerContainer.height + 'px'; + dom.leftContainer.style.height = props.leftContainer.height + 'px'; + dom.rightContainer.style.height = props.rightContainer.height + 'px'; + + dom.background.style.width = props.background.width + 'px'; + dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; + dom.backgroundHorizontal.style.width = props.background.width + 'px'; + dom.centerContainer.style.width = props.center.width + 'px'; + dom.top.style.width = props.top.width + 'px'; + dom.bottom.style.width = props.bottom.width + 'px'; + + // reposition the panels + dom.background.style.left = '0'; + dom.background.style.top = '0'; + dom.backgroundVertical.style.left = props.left.width + 'px'; + dom.backgroundVertical.style.top = '0'; + dom.backgroundHorizontal.style.left = '0'; + dom.backgroundHorizontal.style.top = props.top.height + 'px'; + dom.centerContainer.style.left = props.left.width + 'px'; + dom.centerContainer.style.top = props.top.height + 'px'; + dom.leftContainer.style.left = '0'; + dom.leftContainer.style.top = props.top.height + 'px'; + dom.rightContainer.style.left = (props.left.width + props.center.width) + 'px'; + dom.rightContainer.style.top = props.top.height + 'px'; + dom.top.style.left = props.left.width + 'px'; + dom.top.style.top = '0'; + dom.bottom.style.left = props.left.width + 'px'; + dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px'; + + // update the scrollTop, feasible range for the offset can be changed + // when the height of the Timeline or of the contents of the center changed + this._updateScrollTop(); + + // reposition the scrollable contents + var offset = this.props.scrollTop; + if (options.orientation == 'bottom') { + offset += Math.max(this.props.centerContainer.height - this.props.center.height - + this.props.border.top - this.props.border.bottom, 0); + } + dom.center.style.left = '0'; + dom.center.style.top = offset + 'px'; + dom.left.style.left = '0'; + dom.left.style.top = offset + 'px'; + dom.right.style.left = '0'; + dom.right.style.top = offset + 'px'; + + // show shadows when vertical scrolling is available + var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; + var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; + dom.shadowTop.style.visibility = visibilityTop; + dom.shadowBottom.style.visibility = visibilityBottom; + dom.shadowTopLeft.style.visibility = visibilityTop; + dom.shadowBottomLeft.style.visibility = visibilityBottom; + dom.shadowTopRight.style.visibility = visibilityTop; + dom.shadowBottomRight.style.visibility = visibilityBottom; + + // redraw all components + this.components.forEach(function (component) { + resized = component.redraw() || resized; }); + if (resized) { + // keep repainting until all sizes are settled + this.redraw(); + } + }; - // draw all ms - ids = this.groupsData.getIds(); - this._onAddGroups(ids); - } + // TODO: deprecated since version 1.1.0, remove some day + Timeline.prototype.repaint = function () { + throw new Error('Function repaint is deprecated. Use redraw instead.'); + }; - // update the group holding all ungrouped items - this._updateUngrouped(); + /** + * Convert a position on screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toTime = function(x) { + var conversion = this.range.conversion(this.props.center.width); + return new Date(x / conversion.scale + conversion.offset); + }; - // update the order of all items in each group - this._order(); - this.body.emitter.emit('change'); -}; - -/** - * Get the current groups - * @returns {vis.DataSet | null} groups - */ -ItemSet.prototype.getGroups = function() { - return this.groupsData; -}; - -/** - * Remove an item by its id - * @param {String | Number} id - */ -ItemSet.prototype.removeItem = function(id) { - var item = this.itemsData.get(id), - dataset = this.itemsData.getDataSet(); - - if (item) { - // confirm deletion - this.options.onRemove(item, function (item) { - if (item) { - // remove by id here, it is possible that an item has no id defined - // itself, so better not delete by the item itself - dataset.remove(id); - } - }); - } -}; + /** + * Convert a position on the global screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toGlobalTime = function(x) { + var conversion = this.range.conversion(this.props.root.width); + return new Date(x / conversion.scale + conversion.offset); + }; -/** - * Handle updated items - * @param {Number[]} ids - * @protected - */ -ItemSet.prototype._onUpdate = function(ids) { - var me = this; + /** + * Convert a datetime (Date object) into a position on the screen + * @param {Date} time A date + * @return {int} x The position on the screen in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toScreen = function(time) { + var conversion = this.range.conversion(this.props.center.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; - ids.forEach(function (id) { - var itemData = me.itemsData.get(id, me.itemOptions), - item = me.items[id], - type = itemData.type || me.options.type || (itemData.end ? 'range' : 'box'); - var constructor = ItemSet.types[type]; + /** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Timeline.prototype._toGlobalScreen = function(time) { + var conversion = this.range.conversion(this.props.root.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; - if (item) { - // update item - if (!constructor || !(item instanceof constructor)) { - // item type has changed, delete the item and recreate it - me._removeItem(item); - item = null; - } - else { - me._updateItem(item, itemData); - } - } - if (!item) { - // create item - if (constructor) { - item = new constructor(itemData, me.conversion, me.options); - item.id = id; // TODO: not so nice setting id afterwards - me._addItem(item); - } - else if (type == 'rangeoverflow') { - // TODO: deprecated since version 2.1.0 (or 3.0.0?). cleanup some day - throw new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: ' + - '.vis.timeline .item.range .content {overflow: visible;}'); - } - else { - throw new TypeError('Unknown item type "' + type + '"'); - } + /** + * Initialize watching when option autoResize is true + * @private + */ + Timeline.prototype._initAutoResize = function () { + if (this.options.autoResize == true) { + this._startAutoResize(); } - }); - - this._order(); - this.stackDirty = true; // force re-stacking of all items next redraw - this.body.emitter.emit('change'); -}; - -/** - * Handle added items - * @param {Number[]} ids - * @protected - */ -ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate; - -/** - * Handle removed items - * @param {Number[]} ids - * @protected - */ -ItemSet.prototype._onRemove = function(ids) { - var count = 0; - var me = this; - ids.forEach(function (id) { - var item = me.items[id]; - if (item) { - count++; - me._removeItem(item); + else { + this._stopAutoResize(); } - }); - - if (count) { - // update order - this._order(); - this.stackDirty = true; // force re-stacking of all items next redraw - this.body.emitter.emit('change'); - } -}; - -/** - * Update the order of item in all groups - * @private - */ -ItemSet.prototype._order = function() { - // reorder the items in all groups - // TODO: optimization: only reorder groups affected by the changed items - util.forEach(this.groups, function (group) { - group.order(); - }); -}; - -/** - * Handle updated groups - * @param {Number[]} ids - * @private - */ -ItemSet.prototype._onUpdateGroups = function(ids) { - this._onAddGroups(ids); -}; + }; -/** - * Handle changed groups - * @param {Number[]} ids - * @private - */ -ItemSet.prototype._onAddGroups = function(ids) { - var me = this; + /** + * Watch for changes in the size of the container. On resize, the Panel will + * automatically redraw itself. + * @private + */ + Timeline.prototype._startAutoResize = function () { + var me = this; - ids.forEach(function (id) { - var groupData = me.groupsData.get(id); - var group = me.groups[id]; + this._stopAutoResize(); - if (!group) { - // check for reserved ids - if (id == UNGROUPED) { - throw new Error('Illegal group id. ' + id + ' is a reserved id.'); + this._onResize = function() { + if (me.options.autoResize != true) { + // stop watching when the option autoResize is changed to false + me._stopAutoResize(); + return; } - var groupOptions = Object.create(me.options); - util.extend(groupOptions, { - height: null - }); - - group = new Group(id, groupData, me); - me.groups[id] = group; + if (me.dom.root) { + // check whether the frame is resized + if ((me.dom.root.clientWidth != me.props.lastWidth) || + (me.dom.root.clientHeight != me.props.lastHeight)) { + me.props.lastWidth = me.dom.root.clientWidth; + me.props.lastHeight = me.dom.root.clientHeight; - // add items with this groupId to the new group - for (var itemId in me.items) { - if (me.items.hasOwnProperty(itemId)) { - var item = me.items[itemId]; - if (item.data.group == id) { - group.add(item); - } + me.emit('change'); } } + }; - group.order(); - group.show(); - } - else { - // update group - group.setData(groupData); + // add event listener to window resize + util.addEventListener(window, 'resize', this._onResize); + + this.watchTimer = setInterval(this._onResize, 1000); + }; + + /** + * Stop watching for a resize of the frame. + * @private + */ + Timeline.prototype._stopAutoResize = function () { + if (this.watchTimer) { + clearInterval(this.watchTimer); + this.watchTimer = undefined; } - }); - this.body.emitter.emit('change'); -}; + // remove event listener on window.resize + util.removeEventListener(window, 'resize', this._onResize); + this._onResize = null; + }; -/** - * Handle removed groups - * @param {Number[]} ids - * @private - */ -ItemSet.prototype._onRemoveGroups = function(ids) { - var groups = this.groups; - ids.forEach(function (id) { - var group = groups[id]; + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onTouch = function (event) { + this.touch.allowDragging = true; + }; - if (group) { - group.hide(); - delete groups[id]; - } - }); + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onPinch = function (event) { + this.touch.allowDragging = false; + }; + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onDragStart = function (event) { + this.touch.initialScrollTop = this.props.scrollTop; + }; - this.markDirty(); + /** + * Move the timeline vertically + * @param {Event} event + * @private + */ + Timeline.prototype._onDrag = function (event) { + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.touch.allowDragging) return; - this.body.emitter.emit('change'); -}; + var delta = event.gesture.deltaY; -/** - * Reorder the groups if needed - * @return {boolean} changed - * @private - */ -ItemSet.prototype._orderGroups = function () { - if (this.groupsData) { - // reorder the groups - var groupIds = this.groupsData.getIds({ - order: this.options.groupOrder - }); + var oldScrollTop = this._getScrollTop(); + var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); - var changed = !util.equalArray(groupIds, this.groupIds); - if (changed) { - // hide all groups, removes them from the DOM - var groups = this.groups; - groupIds.forEach(function (groupId) { - groups[groupId].hide(); - }); + if (newScrollTop != oldScrollTop) { + this.redraw(); // TODO: this causes two redraws when dragging, the other is triggered by rangechange already + } + }; - // show the groups again, attach them to the DOM in correct order - groupIds.forEach(function (groupId) { - groups[groupId].show(); - }); + /** + * Apply a scrollTop + * @param {Number} scrollTop + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Timeline.prototype._setScrollTop = function (scrollTop) { + this.props.scrollTop = scrollTop; + this._updateScrollTop(); + return this.props.scrollTop; + }; - this.groupIds = groupIds; + /** + * Update the current scrollTop when the height of the containers has been changed + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Timeline.prototype._updateScrollTop = function () { + // recalculate the scrollTopMin + var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero + if (scrollTopMin != this.props.scrollTopMin) { + // in case of bottom orientation, change the scrollTop such that the contents + // do not move relative to the time axis at the bottom + if (this.options.orientation == 'bottom') { + this.props.scrollTop += (scrollTopMin - this.props.scrollTopMin); + } + this.props.scrollTopMin = scrollTopMin; } - return changed; - } - else { - return false; - } -}; + // limit the scrollTop to the feasible scroll range + if (this.props.scrollTop > 0) this.props.scrollTop = 0; + if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; -/** - * Add a new item - * @param {Item} item - * @private - */ -ItemSet.prototype._addItem = function(item) { - this.items[item.id] = item; + return this.props.scrollTop; + }; - // add to group - var groupId = this.groupsData ? item.data.group : UNGROUPED; - var group = this.groups[groupId]; - if (group) group.add(item); -}; + /** + * Get the current scrollTop + * @returns {number} scrollTop + * @private + */ + Timeline.prototype._getScrollTop = function () { + return this.props.scrollTop; + }; -/** - * Update an existing item - * @param {Item} item - * @param {Object} itemData - * @private - */ -ItemSet.prototype._updateItem = function(item, itemData) { - var oldGroupId = item.data.group; + module.exports = Timeline; - item.data = itemData; - if (item.displayed) { - item.redraw(); - } - // update group - if (oldGroupId != item.data.group) { - var oldGroup = this.groups[oldGroupId]; - if (oldGroup) oldGroup.remove(item); +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { - var groupId = this.groupsData ? item.data.group : UNGROUPED; - var group = this.groups[groupId]; - if (group) group.add(item); - } -}; + var Emitter = __webpack_require__(45); + var Hammer = __webpack_require__(41); + var util = __webpack_require__(1); + var DataSet = __webpack_require__(3); + var DataView = __webpack_require__(4); + var Range = __webpack_require__(15); + var TimeAxis = __webpack_require__(27); + var CurrentTime = __webpack_require__(19); + var CustomTime = __webpack_require__(20); + var LineGraph = __webpack_require__(26); -/** - * Delete an item from the ItemSet: remove it from the DOM, from the map - * with items, and from the map with visible items, and from the selection - * @param {Item} item - * @private - */ -ItemSet.prototype._removeItem = function(item) { - // remove from DOM - item.hide(); + /** + * Create a timeline visualization + * @param {HTMLElement} container + * @param {vis.DataSet | Array | google.visualization.DataTable} [items] + * @param {Object} [options] See Graph2d.setOptions for the available options. + * @constructor + */ + function Graph2d (container, items, options, groups) { + var me = this; + this.defaultOptions = { + start: null, + end: null, - // remove from items - delete this.items[item.id]; + autoResize: true, - // remove from selection - var index = this.selection.indexOf(item.id); - if (index != -1) this.selection.splice(index, 1); + orientation: 'bottom', + width: null, + height: null, + maxHeight: null, + minHeight: null + }; + this.options = util.deepExtend({}, this.defaultOptions); - // remove from group - var groupId = this.groupsData ? item.data.group : UNGROUPED; - var group = this.groups[groupId]; - if (group) group.remove(item); -}; + // Create the DOM, props, and emitter + this._create(container); -/** - * Create an array containing all items being a range (having an end date) - * @param array - * @returns {Array} - * @private - */ -ItemSet.prototype._constructByEndArray = function(array) { - var endArray = []; + // all components listed here will be repainted automatically + this.components = []; - for (var i = 0; i < array.length; i++) { - if (array[i] instanceof ItemRange) { - endArray.push(array[i]); - } - } - return endArray; -}; + this.body = { + dom: this.dom, + domProps: this.props, + emitter: { + on: this.on.bind(this), + off: this.off.bind(this), + emit: this.emit.bind(this) + }, + util: { + snap: null, // will be specified after TimeAxis is created + toScreen: me._toScreen.bind(me), + toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width + toTime: me._toTime.bind(me), + toGlobalTime : me._toGlobalTime.bind(me) + } + }; -/** - * Register the clicked item on touch, before dragStart is initiated. - * - * dragStart is initiated from a mousemove event, which can have left the item - * already resulting in an item == null - * - * @param {Event} event - * @private - */ -ItemSet.prototype._onTouch = function (event) { - // store the touched item, used in _onDragStart - this.touchParams.item = ItemSet.itemFromTarget(event); -}; + // range + this.range = new Range(this.body); + this.components.push(this.range); + this.body.range = this.range; -/** - * Start dragging the selected events - * @param {Event} event - * @private - */ -ItemSet.prototype._onDragStart = function (event) { - if (!this.options.editable.updateTime && !this.options.editable.updateGroup) { - return; - } + // time axis + this.timeAxis = new TimeAxis(this.body); + this.components.push(this.timeAxis); + this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); - var item = this.touchParams.item || null, - me = this, - props; + // current time bar + this.currentTime = new CurrentTime(this.body); + this.components.push(this.currentTime); - if (item && item.selected) { - var dragLeftItem = event.target.dragLeftItem; - var dragRightItem = event.target.dragRightItem; + // custom time bar + // Note: time bar will be attached in this.setOptions when selected + this.customTime = new CustomTime(this.body); + this.components.push(this.customTime); - if (dragLeftItem) { - props = { - item: dragLeftItem - }; + // item set + this.linegraph = new LineGraph(this.body); + this.components.push(this.linegraph); - if (me.options.editable.updateTime) { - props.start = item.data.start.valueOf(); - } - if (me.options.editable.updateGroup) { - if ('group' in item.data) props.group = item.data.group; - } + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet - this.touchParams.itemProps = [props]; + // apply options + if (options) { + this.setOptions(options); } - else if (dragRightItem) { - props = { - item: dragRightItem - }; - if (me.options.editable.updateTime) { - props.end = item.data.end.valueOf(); - } - if (me.options.editable.updateGroup) { - if ('group' in item.data) props.group = item.data.group; - } + // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! + if (groups) { + this.setGroups(groups); + } - this.touchParams.itemProps = [props]; + // create itemset + if (items) { + this.setItems(items); } else { - this.touchParams.itemProps = this.getSelection().map(function (id) { - var item = me.items[id]; - var props = { - item: item - }; - - if (me.options.editable.updateTime) { - if ('start' in item.data) props.start = item.data.start.valueOf(); - if ('end' in item.data) props.end = item.data.end.valueOf(); - } - if (me.options.editable.updateGroup) { - if ('group' in item.data) props.group = item.data.group; - } - - return props; - }); + this.redraw(); } - - event.stopPropagation(); } -}; -/** - * Drag selected items - * @param {Event} event - * @private - */ -ItemSet.prototype._onDrag = function (event) { - if (this.touchParams.itemProps) { - var range = this.body.range, - snap = this.body.util.snap || null, - deltaX = event.gesture.deltaX, - scale = (this.props.width / (range.end - range.start)), - offset = deltaX / scale; - - // move - this.touchParams.itemProps.forEach(function (props) { - if ('start' in props) { - var start = new Date(props.start + offset); - props.item.data.start = snap ? snap(start) : start; - } - - if ('end' in props) { - var end = new Date(props.end + offset); - props.item.data.end = snap ? snap(end) : end; - } + // turn Graph2d into an event emitter + Emitter(Graph2d.prototype); - if ('group' in props) { - // drag from one group to another - var group = ItemSet.groupFromTarget(event); - if (group && group.groupId != props.item.data.group) { - var oldGroup = props.item.parent; - oldGroup.remove(props.item); - oldGroup.order(); - group.add(props.item); - group.order(); + /** + * Create the main DOM for the Graph2d: a root panel containing left, right, + * top, bottom, content, and background panel. + * @param {Element} container The container element where the Graph2d will + * be attached. + * @private + */ + Graph2d.prototype._create = function (container) { + this.dom = {}; - props.item.data.group = group.groupId; - } - } + this.dom.root = document.createElement('div'); + this.dom.background = document.createElement('div'); + this.dom.backgroundVertical = document.createElement('div'); + this.dom.backgroundHorizontalContainer = document.createElement('div'); + this.dom.centerContainer = document.createElement('div'); + this.dom.leftContainer = document.createElement('div'); + this.dom.rightContainer = document.createElement('div'); + this.dom.backgroundHorizontal = document.createElement('div'); + this.dom.center = document.createElement('div'); + this.dom.left = document.createElement('div'); + this.dom.right = document.createElement('div'); + this.dom.top = document.createElement('div'); + this.dom.bottom = document.createElement('div'); + this.dom.shadowTop = document.createElement('div'); + this.dom.shadowBottom = document.createElement('div'); + this.dom.shadowTopLeft = document.createElement('div'); + this.dom.shadowBottomLeft = document.createElement('div'); + this.dom.shadowTopRight = document.createElement('div'); + this.dom.shadowBottomRight = document.createElement('div'); + + this.dom.background.className = 'vispanel background'; + this.dom.backgroundVertical.className = 'vispanel background vertical'; + this.dom.backgroundHorizontalContainer.className = 'vispanel background horizontal'; + this.dom.backgroundHorizontal.className = 'vispanel background horizontal'; + this.dom.centerContainer.className = 'vispanel center'; + this.dom.leftContainer.className = 'vispanel left'; + this.dom.rightContainer.className = 'vispanel right'; + this.dom.top.className = 'vispanel top'; + this.dom.bottom.className = 'vispanel bottom'; + this.dom.left.className = 'content'; + this.dom.center.className = 'content'; + this.dom.right.className = 'content'; + this.dom.shadowTop.className = 'shadow top'; + this.dom.shadowBottom.className = 'shadow bottom'; + this.dom.shadowTopLeft.className = 'shadow top'; + this.dom.shadowBottomLeft.className = 'shadow bottom'; + this.dom.shadowTopRight.className = 'shadow top'; + this.dom.shadowBottomRight.className = 'shadow bottom'; + + this.dom.root.appendChild(this.dom.background); + this.dom.root.appendChild(this.dom.backgroundVertical); + this.dom.root.appendChild(this.dom.backgroundHorizontalContainer); + this.dom.root.appendChild(this.dom.centerContainer); + this.dom.root.appendChild(this.dom.leftContainer); + this.dom.root.appendChild(this.dom.rightContainer); + this.dom.root.appendChild(this.dom.top); + this.dom.root.appendChild(this.dom.bottom); + + this.dom.backgroundHorizontalContainer.appendChild(this.dom.backgroundHorizontal); + this.dom.centerContainer.appendChild(this.dom.center); + this.dom.leftContainer.appendChild(this.dom.left); + this.dom.rightContainer.appendChild(this.dom.right); + + this.dom.centerContainer.appendChild(this.dom.shadowTop); + this.dom.centerContainer.appendChild(this.dom.shadowBottom); + this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); + this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); + this.dom.rightContainer.appendChild(this.dom.shadowTopRight); + this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); + + this.on('rangechange', this.redraw.bind(this)); + this.on('change', this.redraw.bind(this)); + this.on('touch', this._onTouch.bind(this)); + this.on('pinch', this._onPinch.bind(this)); + this.on('dragstart', this._onDragStart.bind(this)); + this.on('drag', this._onDrag.bind(this)); + + // create event listeners for all interesting events, these events will be + // emitted via emitter + this.hammer = Hammer(this.dom.root, { + prevent_default: true }); + this.listeners = {}; - // TODO: implement onMoving handler + var me = this; + var events = [ + 'touch', 'pinch', + 'tap', 'doubletap', 'hold', + 'dragstart', 'drag', 'dragend', + 'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox + ]; + events.forEach(function (event) { + var listener = function () { + var args = [event].concat(Array.prototype.slice.call(arguments, 0)); + me.emit.apply(me, args); + }; + me.hammer.on(event, listener); + me.listeners[event] = listener; + }); - this.stackDirty = true; // force re-stacking of all items next redraw - this.body.emitter.emit('change'); + // size properties of each of the panels + this.props = { + root: {}, + background: {}, + centerContainer: {}, + leftContainer: {}, + rightContainer: {}, + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + border: {}, + scrollTop: 0, + scrollTopMin: 0 + }; + this.touch = {}; // store state information needed for touch events - event.stopPropagation(); - } -}; + // attach the root panel to the provided container + if (!container) throw new Error('No container provided'); + container.appendChild(this.dom.root); + }; -/** - * End of dragging selected items - * @param {Event} event - * @private - */ -ItemSet.prototype._onDragEnd = function (event) { - if (this.touchParams.itemProps) { - // prepare a change set for the changed items - var changes = [], - me = this, - dataset = this.itemsData.getDataSet(); + /** + * Destroy the Graph2d, clean up all DOM elements and event listeners. + */ + Graph2d.prototype.destroy = function () { + // unbind datasets + this.clear(); - this.touchParams.itemProps.forEach(function (props) { - var id = props.item.id, - itemData = me.itemsData.get(id, me.itemOptions); + // remove all event listeners + this.off(); - var changed = false; - if ('start' in props.item.data) { - changed = (props.start != props.item.data.start.valueOf()); - itemData.start = util.convert(props.item.data.start, - dataset._options.type && dataset._options.type.start || 'Date'); - } - if ('end' in props.item.data) { - changed = changed || (props.end != props.item.data.end.valueOf()); - itemData.end = util.convert(props.item.data.end, - dataset._options.type && dataset._options.type.end || 'Date'); - } - if ('group' in props.item.data) { - changed = changed || (props.group != props.item.data.group); - itemData.group = props.item.data.group; - } + // stop checking for changed size + this._stopAutoResize(); - // only apply changes when start or end is actually changed - if (changed) { - me.options.onMove(itemData, function (itemData) { - if (itemData) { - // apply changes - itemData[dataset._fieldId] = id; // ensure the item contains its id (can be undefined) - changes.push(itemData); - } - else { - // restore original values - if ('start' in props) props.item.data.start = props.start; - if ('end' in props) props.item.data.end = props.end; + // remove from DOM + if (this.dom.root.parentNode) { + this.dom.root.parentNode.removeChild(this.dom.root); + } + this.dom = null; - me.stackDirty = true; // force re-stacking of all items next redraw - me.body.emitter.emit('change'); - } - }); + // cleanup hammer touch events + for (var event in this.listeners) { + if (this.listeners.hasOwnProperty(event)) { + delete this.listeners[event]; } - }); - this.touchParams.itemProps = null; - - // apply the changes to the data (if there are changes) - if (changes.length) { - dataset.update(changes); } + this.listeners = null; + this.hammer = null; - event.stopPropagation(); - } -}; - -/** - * Handle selecting/deselecting an item when tapping it - * @param {Event} event - * @private - */ -ItemSet.prototype._onSelectItem = function (event) { - if (!this.options.selectable) return; - - var ctrlKey = event.gesture.srcEvent && event.gesture.srcEvent.ctrlKey; - var shiftKey = event.gesture.srcEvent && event.gesture.srcEvent.shiftKey; - if (ctrlKey || shiftKey) { - this._onMultiSelectItem(event); - return; - } - - var oldSelection = this.getSelection(); - - var item = ItemSet.itemFromTarget(event); - var selection = item ? [item.id] : []; - this.setSelection(selection); - - var newSelection = this.getSelection(); - - // emit a select event, - // except when old selection is empty and new selection is still empty - if (newSelection.length > 0 || oldSelection.length > 0) { - this.body.emitter.emit('select', { - items: this.getSelection() + // give all components the opportunity to cleanup + this.components.forEach(function (component) { + component.destroy(); }); - } - - event.stopPropagation(); -}; -/** - * Handle creation and updates of an item on double tap - * @param event - * @private - */ -ItemSet.prototype._onAddItem = function (event) { - if (!this.options.selectable) return; - if (!this.options.editable.add) return; + this.body = null; + }; - var me = this, - snap = this.body.util.snap || null, - item = ItemSet.itemFromTarget(event); + /** + * Set options. Options will be passed to all components loaded in the Graph2d. + * @param {Object} [options] + * {String} orientation + * Vertical orientation for the Graph2d, + * can be 'bottom' (default) or 'top'. + * {String | Number} width + * Width for the timeline, a number in pixels or + * a css string like '1000px' or '75%'. '100%' by default. + * {String | Number} height + * Fixed height for the Graph2d, a number in pixels or + * a css string like '400px' or '75%'. If undefined, + * The Graph2d will automatically size such that + * its contents fit. + * {String | Number} minHeight + * Minimum height for the Graph2d, a number in pixels or + * a css string like '400px' or '75%'. + * {String | Number} maxHeight + * Maximum height for the Graph2d, a number in pixels or + * a css string like '400px' or '75%'. + * {Number | Date | String} start + * Start date for the visible window + * {Number | Date | String} end + * End date for the visible window + */ + Graph2d.prototype.setOptions = function (options) { + if (options) { + // copy the known options + var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation']; + util.selectiveExtend(fields, this.options, options); - if (item) { - // update item + // enable/disable autoResize + this._initAutoResize(); + } - // execute async handler to update the item (or cancel it) - var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset - this.options.onUpdate(itemData, function (itemData) { - if (itemData) { - me.itemsData.update(itemData); - } + // propagate options to all components + this.components.forEach(function (component) { + component.setOptions(options); }); - } - else { - // add item - var xAbs = vis.util.getAbsoluteLeft(this.dom.frame); - var x = event.gesture.center.pageX - xAbs; - var start = this.body.util.toTime(x); - var newItem = { - start: snap ? snap(start) : start, - content: 'new item' - }; - // when default type is a range, add a default end date to the new item - if (this.options.type === 'range') { - var end = this.body.util.toTime(x + this.props.width / 5); - newItem.end = snap ? snap(end) : end; + // TODO: remove deprecation error one day (deprecated since version 0.8.0) + if (options && options.order) { + throw new Error('Option order is deprecated. There is no replacement for this feature.'); } - newItem[this.itemsData.fieldId] = util.randomUUID(); + // redraw everything + this.redraw(); + }; - var group = ItemSet.groupFromTarget(event); - if (group) { - newItem.group = group.groupId; + /** + * Set a custom time bar + * @param {Date} time + */ + Graph2d.prototype.setCustomTime = function (time) { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); } - // execute async handler to customize (or cancel) adding an item - this.options.onAdd(newItem, function (item) { - if (item) { - me.itemsData.add(newItem); - // TODO: need to trigger a redraw? - } - }); - } -}; + this.customTime.setCustomTime(time); + }; -/** - * Handle selecting/deselecting multiple items when holding an item - * @param {Event} event - * @private - */ -ItemSet.prototype._onMultiSelectItem = function (event) { - if (!this.options.selectable) return; + /** + * Retrieve the current custom time. + * @return {Date} customTime + */ + Graph2d.prototype.getCustomTime = function() { + if (!this.customTime) { + throw new Error('Cannot get custom time: Custom time bar is not enabled'); + } - var selection, - item = ItemSet.itemFromTarget(event); + return this.customTime.getCustomTime(); + }; - if (item) { - // multi select items - selection = this.getSelection(); // current selection - var index = selection.indexOf(item.id); - if (index == -1) { - // item is not yet selected -> select it - selection.push(item.id); + /** + * Set items + * @param {vis.DataSet | Array | google.visualization.DataTable | null} items + */ + Graph2d.prototype.setItems = function(items) { + var initialLoad = (this.itemsData == null); + + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; + } + else if (items instanceof DataSet || items instanceof DataView) { + newDataSet = items; } else { - // item is already selected -> deselect it - selection.splice(index, 1); + // turn an array into a dataset + newDataSet = new DataSet(items, { + type: { + start: 'Date', + end: 'Date' + } + }); } - this.setSelection(selection); - - this.body.emitter.emit('select', { - items: this.getSelection() - }); - event.stopPropagation(); - } -}; + // set items + this.itemsData = newDataSet; + this.linegraph && this.linegraph.setItems(newDataSet); -/** - * Find an item from an event target: - * searches for the attribute 'timeline-item' in the event target's element tree - * @param {Event} event - * @return {Item | null} item - */ -ItemSet.itemFromTarget = function(event) { - var target = event.target; - while (target) { - if (target.hasOwnProperty('timeline-item')) { - return target['timeline-item']; - } - target = target.parentNode; - } + if (initialLoad && ('start' in this.options || 'end' in this.options)) { + this.fit(); - return null; -}; + var start = ('start' in this.options) ? util.convert(this.options.start, 'Date') : null; + var end = ('end' in this.options) ? util.convert(this.options.end, 'Date') : null; -/** - * Find the Group from an event target: - * searches for the attribute 'timeline-group' in the event target's element tree - * @param {Event} event - * @return {Group | null} group - */ -ItemSet.groupFromTarget = function(event) { - var target = event.target; - while (target) { - if (target.hasOwnProperty('timeline-group')) { - return target['timeline-group']; + this.setWindow(start, end); } - target = target.parentNode; - } - - return null; -}; + }; -/** - * Find the ItemSet from an event target: - * searches for the attribute 'timeline-itemset' in the event target's element tree - * @param {Event} event - * @return {ItemSet | null} item - */ -ItemSet.itemSetFromTarget = function(event) { - var target = event.target; - while (target) { - if (target.hasOwnProperty('timeline-itemset')) { - return target['timeline-itemset']; + /** + * Set groups + * @param {vis.DataSet | Array | google.visualization.DataTable} groups + */ + Graph2d.prototype.setGroups = function(groups) { + // convert to type DataSet when needed + var newDataSet; + if (!groups) { + newDataSet = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + newDataSet = groups; + } + else { + // turn an array into a dataset + newDataSet = new DataSet(groups); } - target = target.parentNode; - } - - return null; -}; - - -/** - * @constructor Item - * @param {Object} data Object containing (optional) parameters type, - * start, end, content, group, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} options Configuration options - * // TODO: describe available options - */ -function Item (data, conversion, options) { - this.id = null; - this.parent = null; - this.data = data; - this.dom = null; - this.conversion = conversion || {}; - this.options = options || {}; - - this.selected = false; - this.displayed = false; - this.dirty = true; - - this.top = null; - this.left = null; - this.width = null; - this.height = null; -} - -/** - * Select current item - */ -Item.prototype.select = function() { - this.selected = true; - if (this.displayed) this.redraw(); -}; -/** - * Unselect current item - */ -Item.prototype.unselect = function() { - this.selected = false; - if (this.displayed) this.redraw(); -}; + this.groupsData = newDataSet; + this.linegraph.setGroups(newDataSet); + }; -/** - * Set a parent for the item - * @param {ItemSet | Group} parent - */ -Item.prototype.setParent = function(parent) { - if (this.displayed) { - this.hide(); - this.parent = parent; - if (this.parent) { - this.show(); + /** + * Clear the Graph2d. By Default, items, groups and options are cleared. + * Example usage: + * + * timeline.clear(); // clear items, groups, and options + * timeline.clear({options: true}); // clear options only + * + * @param {Object} [what] Optionally specify what to clear. By default: + * {items: true, groups: true, options: true} + */ + Graph2d.prototype.clear = function(what) { + // clear items + if (!what || what.items) { + this.setItems(null); } - } - else { - this.parent = parent; - } -}; -/** - * Check whether this item is visible inside given range - * @returns {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ -Item.prototype.isVisible = function(range) { - // Should be implemented by Item implementations - return false; -}; + // clear groups + if (!what || what.groups) { + this.setGroups(null); + } -/** - * Show the Item in the DOM (when not already visible) - * @return {Boolean} changed - */ -Item.prototype.show = function() { - return false; -}; + // clear options of timeline and of each of the components + if (!what || what.options) { + this.components.forEach(function (component) { + component.setOptions(component.defaultOptions); + }); -/** - * Hide the Item from the DOM (when visible) - * @return {Boolean} changed - */ -Item.prototype.hide = function() { - return false; -}; + this.setOptions(this.defaultOptions); // this will also do a redraw + } + }; -/** - * Repaint the item - */ -Item.prototype.redraw = function() { - // should be implemented by the item -}; + /** + * Set Graph2d window such that it fits all items + */ + Graph2d.prototype.fit = function() { + // apply the data range as range + var dataRange = this.getItemRange(); -/** - * Reposition the Item horizontally - */ -Item.prototype.repositionX = function() { - // should be implemented by the item -}; + // add 5% space on both sides + var start = dataRange.min; + var end = dataRange.max; + if (start != null && end != null) { + var interval = (end.valueOf() - start.valueOf()); + if (interval <= 0) { + // prevent an empty interval + interval = 24 * 60 * 60 * 1000; // 1 day + } + start = new Date(start.valueOf() - interval * 0.05); + end = new Date(end.valueOf() + interval * 0.05); + } -/** - * Reposition the Item vertically - */ -Item.prototype.repositionY = function() { - // should be implemented by the item -}; + // skip range set if there is no start and end date + if (start === null && end === null) { + return; + } -/** - * Repaint a delete button on the top right of the item when the item is selected - * @param {HTMLElement} anchor - * @protected - */ -Item.prototype._repaintDeleteButton = function (anchor) { - if (this.selected && this.options.editable.remove && !this.dom.deleteButton) { - // create and show button - var me = this; + this.range.setRange(start, end); + }; - var deleteButton = document.createElement('div'); - deleteButton.className = 'delete'; - deleteButton.title = 'Delete this item'; + /** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ + Graph2d.prototype.getItemRange = function() { + // calculate min from start filed + var itemsData = this.itemsData, + min = null, + max = null; - Hammer(deleteButton, { - preventDefault: true - }).on('tap', function (event) { - me.parent.removeFromDataSet(me); - event.stopPropagation(); - }); + if (itemsData) { + // calculate the minimum value of the field 'start' + var minItem = itemsData.min('start'); + min = minItem ? util.convert(minItem.start, 'Date').valueOf() : null; + // Note: we convert first to Date and then to number because else + // a conversion from ISODate to Number will fail - anchor.appendChild(deleteButton); - this.dom.deleteButton = deleteButton; - } - else if (!this.selected && this.dom.deleteButton) { - // remove button - if (this.dom.deleteButton.parentNode) { - this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton); + // calculate maximum value of fields 'start' and 'end' + var maxStartItem = itemsData.max('start'); + if (maxStartItem) { + max = util.convert(maxStartItem.start, 'Date').valueOf(); + } + var maxEndItem = itemsData.max('end'); + if (maxEndItem) { + if (max == null) { + max = util.convert(maxEndItem.end, 'Date').valueOf(); + } + else { + max = Math.max(max, util.convert(maxEndItem.end, 'Date').valueOf()); + } + } } - this.dom.deleteButton = null; - } -}; -/** - * @constructor ItemBox - * @extends Item - * @param {Object} data Object containing parameters start - * content, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} [options] Configuration options - * // TODO: describe available options - */ -function ItemBox (data, conversion, options) { - this.props = { - dot: { - width: 0, - height: 0 - }, - line: { - width: 0, - height: 0 - } + return { + min: (min != null) ? new Date(min) : null, + max: (max != null) ? new Date(max) : null + }; }; - // validate data - if (data) { - if (data.start == undefined) { - throw new Error('Property "start" missing in item ' + data); + /** + * Set the visible window. Both parameters are optional, you can change only + * start or only end. Syntax: + * + * TimeLine.setWindow(start, end) + * TimeLine.setWindow(range) + * + * Where start and end can be a Date, number, or string, and range is an + * object with properties start and end. + * + * @param {Date | Number | String | Object} [start] Start date of visible window + * @param {Date | Number | String} [end] End date of visible window + */ + Graph2d.prototype.setWindow = function(start, end) { + if (arguments.length == 1) { + var range = arguments[0]; + this.range.setRange(range.start, range.end); } - } - - Item.call(this, data, conversion, options); -} + else { + this.range.setRange(start, end); + } + }; -ItemBox.prototype = new Item (null, null, null); + /** + * Get the visible window + * @return {{start: Date, end: Date}} Visible range + */ + Graph2d.prototype.getWindow = function() { + var range = this.range.getRange(); + return { + start: new Date(range.start), + end: new Date(range.end) + }; + }; -/** - * Check whether this item is visible inside given range - * @returns {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ -ItemBox.prototype.isVisible = function(range) { - // determine visibility - // TODO: account for the real width of the item. Right now we just add 1/4 to the window - var interval = (range.end - range.start) / 4; - return (this.data.start > range.start - interval) && (this.data.start < range.end + interval); -}; + /** + * Force a redraw of the Graph2d. Can be useful to manually redraw when + * option autoResize=false + */ + Graph2d.prototype.redraw = function() { + var resized = false, + options = this.options, + props = this.props, + dom = this.dom; -/** - * Repaint the item - */ -ItemBox.prototype.redraw = function() { - var dom = this.dom; - if (!dom) { - // create DOM - this.dom = {}; - dom = this.dom; + if (!dom) return; // when destroyed + + // update class names + dom.root.className = 'vis timeline root ' + options.orientation; + + // update root width and height options + dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); + dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); + dom.root.style.width = util.option.asSize(options.width, ''); + + // calculate border widths + props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; + props.border.right = props.border.left; + props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; + props.border.bottom = props.border.top; + var borderRootHeight= dom.root.offsetHeight - dom.root.clientHeight; + var borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; + + // calculate the heights. If any of the side panels is empty, we set the height to + // minus the border width, such that the border will be invisible + props.center.height = dom.center.offsetHeight; + props.left.height = dom.left.offsetHeight; + props.right.height = dom.right.offsetHeight; + props.top.height = dom.top.clientHeight || -props.border.top; + props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; + + // TODO: compensate borders when any of the panels is empty. + + // apply auto height + // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) + var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); + var autoHeight = props.top.height + contentHeight + props.bottom.height + + borderRootHeight + props.border.top + props.border.bottom; + dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); - // create main box - dom.box = document.createElement('DIV'); + // calculate heights of the content panels + props.root.height = dom.root.offsetHeight; + props.background.height = props.root.height - borderRootHeight; + var containerHeight = props.root.height - props.top.height - props.bottom.height - + borderRootHeight; + props.centerContainer.height = containerHeight; + props.leftContainer.height = containerHeight; + props.rightContainer.height = props.leftContainer.height; + + // calculate the widths of the panels + props.root.width = dom.root.offsetWidth; + props.background.width = props.root.width - borderRootWidth; + props.left.width = dom.leftContainer.clientWidth || -props.border.left; + props.leftContainer.width = props.left.width; + props.right.width = dom.rightContainer.clientWidth || -props.border.right; + props.rightContainer.width = props.right.width; + var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; + props.center.width = centerWidth; + props.centerContainer.width = centerWidth; + props.top.width = centerWidth; + props.bottom.width = centerWidth; + + // resize the panels + dom.background.style.height = props.background.height + 'px'; + dom.backgroundVertical.style.height = props.background.height + 'px'; + dom.backgroundHorizontalContainer.style.height = props.centerContainer.height + 'px'; + dom.centerContainer.style.height = props.centerContainer.height + 'px'; + dom.leftContainer.style.height = props.leftContainer.height + 'px'; + dom.rightContainer.style.height = props.rightContainer.height + 'px'; + + dom.background.style.width = props.background.width + 'px'; + dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; + dom.backgroundHorizontalContainer.style.width = props.background.width + 'px'; + dom.backgroundHorizontal.style.width = props.background.width + 'px'; + dom.centerContainer.style.width = props.center.width + 'px'; + dom.top.style.width = props.top.width + 'px'; + dom.bottom.style.width = props.bottom.width + 'px'; + + // reposition the panels + dom.background.style.left = '0'; + dom.background.style.top = '0'; + dom.backgroundVertical.style.left = props.left.width + 'px'; + dom.backgroundVertical.style.top = '0'; + dom.backgroundHorizontalContainer.style.left = '0'; + dom.backgroundHorizontalContainer.style.top = props.top.height + 'px'; + dom.centerContainer.style.left = props.left.width + 'px'; + dom.centerContainer.style.top = props.top.height + 'px'; + dom.leftContainer.style.left = '0'; + dom.leftContainer.style.top = props.top.height + 'px'; + dom.rightContainer.style.left = (props.left.width + props.center.width) + 'px'; + dom.rightContainer.style.top = props.top.height + 'px'; + dom.top.style.left = props.left.width + 'px'; + dom.top.style.top = '0'; + dom.bottom.style.left = props.left.width + 'px'; + dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px'; + + // update the scrollTop, feasible range for the offset can be changed + // when the height of the Graph2d or of the contents of the center changed + this._updateScrollTop(); + + // reposition the scrollable contents + var offset = this.props.scrollTop; + if (options.orientation == 'bottom') { + offset += Math.max(this.props.centerContainer.height - this.props.center.height - + this.props.border.top - this.props.border.bottom, 0); + } + dom.center.style.left = '0'; + dom.center.style.top = offset + 'px'; + dom.backgroundHorizontal.style.left = '0'; + dom.backgroundHorizontal.style.top = offset + 'px'; + dom.left.style.left = '0'; + dom.left.style.top = offset + 'px'; + dom.right.style.left = '0'; + dom.right.style.top = offset + 'px'; + + // show shadows when vertical scrolling is available + var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; + var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; + dom.shadowTop.style.visibility = visibilityTop; + dom.shadowBottom.style.visibility = visibilityBottom; + dom.shadowTopLeft.style.visibility = visibilityTop; + dom.shadowBottomLeft.style.visibility = visibilityBottom; + dom.shadowTopRight.style.visibility = visibilityTop; + dom.shadowBottomRight.style.visibility = visibilityBottom; + + // redraw all components + this.components.forEach(function (component) { + resized = component.redraw() || resized; + }); + if (resized) { + // keep redrawing until all sizes are settled + this.redraw(); + } + }; - // contents box (inside the background box). used for making margins - dom.content = document.createElement('DIV'); - dom.content.className = 'content'; - dom.box.appendChild(dom.content); + /** + * Convert a position on screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toTime = function(x) { + var conversion = this.range.conversion(this.props.center.width); + return new Date(x / conversion.scale + conversion.offset); + }; - // line to axis - dom.line = document.createElement('DIV'); - dom.line.className = 'line'; + /** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toGlobalTime = function(x) { + var conversion = this.range.conversion(this.props.root.width); + return new Date(x / conversion.scale + conversion.offset); + }; - // dot on axis - dom.dot = document.createElement('DIV'); - dom.dot.className = 'dot'; + /** + * Convert a datetime (Date object) into a position on the screen + * @param {Date} time A date + * @return {int} x The position on the screen in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toScreen = function(time) { + var conversion = this.range.conversion(this.props.center.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; - // attach this item as attribute - dom.box['timeline-item'] = this; - } - // append DOM to parent DOM - if (!this.parent) { - throw new Error('Cannot redraw item: no parent attached'); - } - if (!dom.box.parentNode) { - var foreground = this.parent.dom.foreground; - if (!foreground) throw new Error('Cannot redraw time axis: parent has no foreground container element'); - foreground.appendChild(dom.box); - } - if (!dom.line.parentNode) { - var background = this.parent.dom.background; - if (!background) throw new Error('Cannot redraw time axis: parent has no background container element'); - background.appendChild(dom.line); - } - if (!dom.dot.parentNode) { - var axis = this.parent.dom.axis; - if (!background) throw new Error('Cannot redraw time axis: parent has no axis container element'); - axis.appendChild(dom.dot); - } - this.displayed = true; + /** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @private + */ + // TODO: move this function to Range + Graph2d.prototype._toGlobalScreen = function(time) { + var conversion = this.range.conversion(this.props.root.width); + return (time.valueOf() - conversion.offset) * conversion.scale; + }; - // update contents - if (this.data.content != this.content) { - this.content = this.data.content; - if (this.content instanceof Element) { - dom.content.innerHTML = ''; - dom.content.appendChild(this.content); - } - else if (this.data.content != undefined) { - dom.content.innerHTML = this.content; + /** + * Initialize watching when option autoResize is true + * @private + */ + Graph2d.prototype._initAutoResize = function () { + if (this.options.autoResize == true) { + this._startAutoResize(); } else { - throw new Error('Property "content" missing in item ' + this.data.id); + this._stopAutoResize(); } + }; - this.dirty = true; - } + /** + * Watch for changes in the size of the container. On resize, the Panel will + * automatically redraw itself. + * @private + */ + Graph2d.prototype._startAutoResize = function () { + var me = this; - // update title - if (this.data.title != this.title) { - dom.box.title = this.data.title; - this.title = this.data.title; - } + this._stopAutoResize(); - // update class - var className = (this.data.className? ' ' + this.data.className : '') + - (this.selected ? ' selected' : ''); - if (this.className != className) { - this.className = className; - dom.box.className = 'item box' + className; - dom.line.className = 'item line' + className; - dom.dot.className = 'item dot' + className; + this._onResize = function() { + if (me.options.autoResize != true) { + // stop watching when the option autoResize is changed to false + me._stopAutoResize(); + return; + } - this.dirty = true; - } + if (me.dom.root) { + // check whether the frame is resized + if ((me.dom.root.clientWidth != me.props.lastWidth) || + (me.dom.root.clientHeight != me.props.lastHeight)) { + me.props.lastWidth = me.dom.root.clientWidth; + me.props.lastHeight = me.dom.root.clientHeight; - // recalculate size - if (this.dirty) { - this.props.dot.height = dom.dot.offsetHeight; - this.props.dot.width = dom.dot.offsetWidth; - this.props.line.width = dom.line.offsetWidth; - this.width = dom.box.offsetWidth; - this.height = dom.box.offsetHeight; + me.emit('change'); + } + } + }; - this.dirty = false; - } + // add event listener to window resize + util.addEventListener(window, 'resize', this._onResize); - this._repaintDeleteButton(dom.box); -}; + this.watchTimer = setInterval(this._onResize, 1000); + }; -/** - * Show the item in the DOM (when not already displayed). The items DOM will - * be created when needed. - */ -ItemBox.prototype.show = function() { - if (!this.displayed) { - this.redraw(); - } -}; + /** + * Stop watching for a resize of the frame. + * @private + */ + Graph2d.prototype._stopAutoResize = function () { + if (this.watchTimer) { + clearInterval(this.watchTimer); + this.watchTimer = undefined; + } -/** - * Hide the item from the DOM (when visible) - */ -ItemBox.prototype.hide = function() { - if (this.displayed) { - var dom = this.dom; + // remove event listener on window.resize + util.removeEventListener(window, 'resize', this._onResize); + this._onResize = null; + }; - if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box); - if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line); - if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot); + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onTouch = function (event) { + this.touch.allowDragging = true; + }; - this.top = null; - this.left = null; + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onPinch = function (event) { + this.touch.allowDragging = false; + }; - this.displayed = false; - } -}; + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onDragStart = function (event) { + this.touch.initialScrollTop = this.props.scrollTop; + }; -/** - * Reposition the item horizontally - * @Override - */ -ItemBox.prototype.repositionX = function() { - var start = this.conversion.toScreen(this.data.start), - align = this.options.align, - left, - box = this.dom.box, - line = this.dom.line, - dot = this.dom.dot; - - // calculate left position of the box - if (align == 'right') { - this.left = start - this.width; - } - else if (align == 'left') { - this.left = start; - } - else { - // default or 'center' - this.left = start - this.width / 2; - } + /** + * Move the timeline vertically + * @param {Event} event + * @private + */ + Graph2d.prototype._onDrag = function (event) { + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.touch.allowDragging) return; - // reposition box - box.style.left = this.left + 'px'; + var delta = event.gesture.deltaY; - // reposition line - line.style.left = (start - this.props.line.width / 2) + 'px'; + var oldScrollTop = this._getScrollTop(); + var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); - // reposition dot - dot.style.left = (start - this.props.dot.width / 2) + 'px'; -}; + if (newScrollTop != oldScrollTop) { + this.redraw(); // TODO: this causes two redraws when dragging, the other is triggered by rangechange already + } + }; -/** - * Reposition the item vertically - * @Override - */ -ItemBox.prototype.repositionY = function() { - var orientation = this.options.orientation, - box = this.dom.box, - line = this.dom.line, - dot = this.dom.dot; - - if (orientation == 'top') { - box.style.top = (this.top || 0) + 'px'; - - line.style.top = '0'; - line.style.height = (this.parent.top + this.top + 1) + 'px'; - line.style.bottom = ''; - } - else { // orientation 'bottom' - var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty - var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top; + /** + * Apply a scrollTop + * @param {Number} scrollTop + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Graph2d.prototype._setScrollTop = function (scrollTop) { + this.props.scrollTop = scrollTop; + this._updateScrollTop(); + return this.props.scrollTop; + }; - box.style.top = (this.parent.height - this.top - this.height || 0) + 'px'; - line.style.top = (itemSetHeight - lineHeight) + 'px'; - line.style.bottom = '0'; - } + /** + * Update the current scrollTop when the height of the containers has been changed + * @returns {Number} scrollTop Returns the applied scrollTop + * @private + */ + Graph2d.prototype._updateScrollTop = function () { + // recalculate the scrollTopMin + var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero + if (scrollTopMin != this.props.scrollTopMin) { + // in case of bottom orientation, change the scrollTop such that the contents + // do not move relative to the time axis at the bottom + if (this.options.orientation == 'bottom') { + this.props.scrollTop += (scrollTopMin - this.props.scrollTopMin); + } + this.props.scrollTopMin = scrollTopMin; + } - dot.style.top = (-this.props.dot.height / 2) + 'px'; -}; + // limit the scrollTop to the feasible scroll range + if (this.props.scrollTop > 0) this.props.scrollTop = 0; + if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; -/** - * @constructor ItemPoint - * @extends Item - * @param {Object} data Object containing parameters start - * content, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} [options] Configuration options - * // TODO: describe available options - */ -function ItemPoint (data, conversion, options) { - this.props = { - dot: { - top: 0, - width: 0, - height: 0 - }, - content: { - height: 0, - marginLeft: 0 - } + return this.props.scrollTop; }; - // validate data - if (data) { - if (data.start == undefined) { - throw new Error('Property "start" missing in item ' + data); - } - } - - Item.call(this, data, conversion, options); -} + /** + * Get the current scrollTop + * @returns {number} scrollTop + * @private + */ + Graph2d.prototype._getScrollTop = function () { + return this.props.scrollTop; + }; -ItemPoint.prototype = new Item (null, null, null); + module.exports = Graph2d; -/** - * Check whether this item is visible inside given range - * @returns {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ -ItemPoint.prototype.isVisible = function(range) { - // determine visibility - // TODO: account for the real width of the item. Right now we just add 1/4 to the window - var interval = (range.end - range.start) / 4; - return (this.data.start > range.start - interval) && (this.data.start < range.end + interval); -}; -/** - * Repaint the item - */ -ItemPoint.prototype.redraw = function() { - var dom = this.dom; - if (!dom) { - // create DOM - this.dom = {}; - dom = this.dom; +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { - // background box - dom.point = document.createElement('div'); - // className is updated in redraw() + /** + * @constructor DataStep + * The class DataStep is an iterator for data for the lineGraph. You provide a start data point and an + * end data point. The class itself determines the best scale (step size) based on the + * provided start Date, end Date, and minimumStep. + * + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * + * Alternatively, you can set a scale by hand. + * After creation, you can initialize the class by executing first(). Then you + * can iterate from the start date to the end date via next(). You can check if + * the end date is reached with the function hasNext(). After each step, you can + * retrieve the current date via getCurrent(). + * The DataStep has scales ranging from milliseconds, seconds, minutes, hours, + * days, to years. + * + * Version: 1.2 + * + * @param {Date} [start] The start date, for example new Date(2010, 9, 21) + * or new Date(2010, 9, 21, 23, 45, 00) + * @param {Date} [end] The end date + * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds + */ + function DataStep(start, end, minimumStep, containerHeight, forcedStepSize) { + // variables + this.current = 0; - // contents box, right from the dot - dom.content = document.createElement('div'); - dom.content.className = 'content'; - dom.point.appendChild(dom.content); + this.autoScale = true; + this.stepIndex = 0; + this.step = 1; + this.scale = 1; - // dot at start - dom.dot = document.createElement('div'); - dom.point.appendChild(dom.dot); + this.marginStart; + this.marginEnd; - // attach this item as attribute - dom.point['timeline-item'] = this; - } + this.majorSteps = [1, 2, 5, 10]; + this.minorSteps = [0.25, 0.5, 1, 2]; - // append DOM to parent DOM - if (!this.parent) { - throw new Error('Cannot redraw item: no parent attached'); + this.setRange(start, end, minimumStep, containerHeight, forcedStepSize); } - if (!dom.point.parentNode) { - var foreground = this.parent.dom.foreground; - if (!foreground) { - throw new Error('Cannot redraw time axis: parent has no foreground container element'); - } - foreground.appendChild(dom.point); - } - this.displayed = true; - // update contents - if (this.data.content != this.content) { - this.content = this.data.content; - if (this.content instanceof Element) { - dom.content.innerHTML = ''; - dom.content.appendChild(this.content); - } - else if (this.data.content != undefined) { - dom.content.innerHTML = this.content; - } - else { - throw new Error('Property "content" missing in item ' + this.data.id); - } - this.dirty = true; - } - // update title - if (this.data.title != this.title) { - dom.point.title = this.data.title; - this.title = this.data.title; - } + /** + * Set a new range + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * @param {Number} [start] The start date and time. + * @param {Number} [end] The end date and time. + * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds + */ + DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight, forcedStepSize) { + this._start = start; + this._end = end; - // update class - var className = (this.data.className? ' ' + this.data.className : '') + - (this.selected ? ' selected' : ''); - if (this.className != className) { - this.className = className; - dom.point.className = 'item point' + className; - dom.dot.className = 'item dot' + className; + if (start == end) { + this._start = start - 0.75; + this._end = end + 1; + } - this.dirty = true; - } + if (this.autoScale) { + this.setMinimumStep(minimumStep, containerHeight, forcedStepSize); + } + this.setFirst(); + }; + + /** + * Automatically determine the scale that bests fits the provided minimum step + * @param {Number} [minimumStep] The minimum step size in milliseconds + */ + DataStep.prototype.setMinimumStep = function(minimumStep, containerHeight) { + // round to floor + var size = this._end - this._start; + var safeSize = size * 1.1; + var minimumStepValue = minimumStep * (safeSize / containerHeight); + var orderOfMagnitude = Math.round(Math.log(safeSize)/Math.LN10); + + var minorStepIdx = -1; + var magnitudefactor = Math.pow(10,orderOfMagnitude); + + var start = 0; + if (orderOfMagnitude < 0) { + start = orderOfMagnitude; + } + + var solutionFound = false; + for (var i = start; Math.abs(i) <= Math.abs(orderOfMagnitude); i++) { + magnitudefactor = Math.pow(10,i); + for (var j = 0; j < this.minorSteps.length; j++) { + var stepSize = magnitudefactor * this.minorSteps[j]; + if (stepSize >= minimumStepValue) { + solutionFound = true; + minorStepIdx = j; + break; + } + } + if (solutionFound == true) { + break; + } + } + this.stepIndex = minorStepIdx; + this.scale = magnitudefactor; + this.step = magnitudefactor * this.minorSteps[minorStepIdx]; + }; - // recalculate size - if (this.dirty) { - this.width = dom.point.offsetWidth; - this.height = dom.point.offsetHeight; - this.props.dot.width = dom.dot.offsetWidth; - this.props.dot.height = dom.dot.offsetHeight; - this.props.content.height = dom.content.offsetHeight; - // resize contents - dom.content.style.marginLeft = 2 * this.props.dot.width + 'px'; - //dom.content.style.marginRight = ... + 'px'; // TODO: margin right + /** + * Set the range iterator to the start date. + */ + DataStep.prototype.first = function() { + this.setFirst(); + }; - dom.dot.style.top = ((this.height - this.props.dot.height) / 2) + 'px'; - dom.dot.style.left = (this.props.dot.width / 2) + 'px'; + /** + * Round the current date to the first minor date value + * This must be executed once when the current date is set to start Date + */ + DataStep.prototype.setFirst = function() { + var niceStart = this._start - (this.scale * this.minorSteps[this.stepIndex]); + var niceEnd = this._end + (this.scale * this.minorSteps[this.stepIndex]); - this.dirty = false; - } + this.marginEnd = this.roundToMinor(niceEnd); + this.marginStart = this.roundToMinor(niceStart); + this.marginRange = this.marginEnd - this.marginStart; - this._repaintDeleteButton(dom.point); -}; + this.current = this.marginEnd; -/** - * Show the item in the DOM (when not already visible). The items DOM will - * be created when needed. - */ -ItemPoint.prototype.show = function() { - if (!this.displayed) { - this.redraw(); - } -}; + }; -/** - * Hide the item from the DOM (when visible) - */ -ItemPoint.prototype.hide = function() { - if (this.displayed) { - if (this.dom.point.parentNode) { - this.dom.point.parentNode.removeChild(this.dom.point); + DataStep.prototype.roundToMinor = function(value) { + var rounded = value - (value % (this.scale * this.minorSteps[this.stepIndex])); + if (value % (this.scale * this.minorSteps[this.stepIndex]) > 0.5 * (this.scale * this.minorSteps[this.stepIndex])) { + return rounded + (this.scale * this.minorSteps[this.stepIndex]); + } + else { + return rounded; } + } - this.top = null; - this.left = null; - this.displayed = false; - } -}; + /** + * Check if the there is a next step + * @return {boolean} true if the current date has not passed the end date + */ + DataStep.prototype.hasNext = function () { + return (this.current >= this.marginStart); + }; -/** - * Reposition the item horizontally - * @Override - */ -ItemPoint.prototype.repositionX = function() { - var start = this.conversion.toScreen(this.data.start); + /** + * Do the next step + */ + DataStep.prototype.next = function() { + var prev = this.current; + this.current -= this.step; - this.left = start - this.props.dot.width; + // safety mechanism: if current time is still unchanged, move to the end + if (this.current == prev) { + this.current = this._end; + } + }; - // reposition point - this.dom.point.style.left = this.left + 'px'; -}; + /** + * Do the next step + */ + DataStep.prototype.previous = function() { + this.current += this.step; + this.marginEnd += this.step; + this.marginRange = this.marginEnd - this.marginStart; + }; -/** - * Reposition the item vertically - * @Override - */ -ItemPoint.prototype.repositionY = function() { - var orientation = this.options.orientation, - point = this.dom.point; - if (orientation == 'top') { - point.style.top = this.top + 'px'; - } - else { - point.style.top = (this.parent.height - this.top - this.height) + 'px'; - } -}; -/** - * @constructor ItemRange - * @extends Item - * @param {Object} data Object containing parameters start, end - * content, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} [options] Configuration options - * // TODO: describe options - */ -function ItemRange (data, conversion, options) { - this.props = { - content: { - width: 0 + /** + * Get the current datetime + * @return {String} current The current date + */ + DataStep.prototype.getCurrent = function() { + var toPrecision = '' + Number(this.current).toPrecision(5); + for (var i = toPrecision.length-1; i > 0; i--) { + if (toPrecision[i] == "0") { + toPrecision = toPrecision.slice(0,i); + } + else if (toPrecision[i] == "." || toPrecision[i] == ",") { + toPrecision = toPrecision.slice(0,i); + break; + } + else{ + break; + } } + + return toPrecision; }; - this.overflow = false; // if contents can overflow (css styling), this flag is set to true - // validate data - if (data) { - if (data.start == undefined) { - throw new Error('Property "start" missing in item ' + data.id); - } - if (data.end == undefined) { - throw new Error('Property "end" missing in item ' + data.id); - } - } - Item.call(this, data, conversion, options); -} -ItemRange.prototype = new Item (null, null, null); + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate + */ + DataStep.prototype.snap = function(date) { -ItemRange.prototype.baseClassName = 'item range'; + }; -/** - * Check whether this item is visible inside given range - * @returns {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ -ItemRange.prototype.isVisible = function(range) { - // determine visibility - return (this.data.start < range.end) && (this.data.end > range.start); -}; + /** + * Check if the current value is a major value (for example when the step + * is DAY, a major value is each first day of the MONTH) + * @return {boolean} true if current date is major, else false. + */ + DataStep.prototype.isMajor = function() { + return (this.current % (this.scale * this.majorSteps[this.stepIndex]) == 0); + }; -/** - * Repaint the item - */ -ItemRange.prototype.redraw = function() { - var dom = this.dom; - if (!dom) { - // create DOM - this.dom = {}; - dom = this.dom; + module.exports = DataStep; - // background box - dom.box = document.createElement('div'); - // className is updated in redraw() - // contents box - dom.content = document.createElement('div'); - dom.content.className = 'content'; - dom.box.appendChild(dom.content); +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { - // attach this item as attribute - dom.box['timeline-item'] = this; - } + var util = __webpack_require__(1); + var hammerUtil = __webpack_require__(42); + var moment = __webpack_require__(40); + var Component = __webpack_require__(18); - // append DOM to parent DOM - if (!this.parent) { - throw new Error('Cannot redraw item: no parent attached'); - } - if (!dom.box.parentNode) { - var foreground = this.parent.dom.foreground; - if (!foreground) { - throw new Error('Cannot redraw time axis: parent has no foreground container element'); - } - foreground.appendChild(dom.box); - } - this.displayed = true; + /** + * @constructor Range + * A Range controls a numeric range with a start and end value. + * The Range adjusts the range based on mouse events or programmatic changes, + * and triggers events when the range is changing or has been changed. + * @param {{dom: Object, domProps: Object, emitter: Emitter}} body + * @param {Object} [options] See description at Range.setOptions + */ + function Range(body, options) { + var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0); + this.start = now.clone().add('days', -3).valueOf(); // Number + this.end = now.clone().add('days', 4).valueOf(); // Number + + this.body = body; + + // default options + this.defaultOptions = { + start: null, + end: null, + direction: 'horizontal', // 'horizontal' or 'vertical' + moveable: true, + zoomable: true, + min: null, + max: null, + zoomMin: 10, // milliseconds + zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000 // milliseconds + }; + this.options = util.extend({}, this.defaultOptions); - // update contents - if (this.data.content != this.content) { - this.content = this.data.content; - if (this.content instanceof Element) { - dom.content.innerHTML = ''; - dom.content.appendChild(this.content); - } - else if (this.data.content != undefined) { - dom.content.innerHTML = this.content; - } - else { - throw new Error('Property "content" missing in item ' + this.data.id); - } + this.props = { + touch: {} + }; - this.dirty = true; - } + // drag listeners for dragging + this.body.emitter.on('dragstart', this._onDragStart.bind(this)); + this.body.emitter.on('drag', this._onDrag.bind(this)); + this.body.emitter.on('dragend', this._onDragEnd.bind(this)); - // update title - if (this.data.title != this.title) { - dom.box.title = this.data.title; - this.title = this.data.title; - } + // ignore dragging when holding + this.body.emitter.on('hold', this._onHold.bind(this)); - // update class - var className = (this.data.className ? (' ' + this.data.className) : '') + - (this.selected ? ' selected' : ''); - if (this.className != className) { - this.className = className; - dom.box.className = this.baseClassName + className; + // mouse wheel for zooming + this.body.emitter.on('mousewheel', this._onMouseWheel.bind(this)); + this.body.emitter.on('DOMMouseScroll', this._onMouseWheel.bind(this)); // For FF - this.dirty = true; + // pinch to zoom + this.body.emitter.on('touch', this._onTouch.bind(this)); + this.body.emitter.on('pinch', this._onPinch.bind(this)); + + this.setOptions(options); } - // recalculate size - if (this.dirty) { - // determine from css whether this box has overflow - this.overflow = window.getComputedStyle(dom.content).overflow !== 'hidden'; + Range.prototype = new Component(); + + /** + * Set options for the range controller + * @param {Object} options Available options: + * {Number | Date | String} start Start date for the range + * {Number | Date | String} end End date for the range + * {Number} min Minimum value for start + * {Number} max Maximum value for end + * {Number} zoomMin Set a minimum value for + * (end - start). + * {Number} zoomMax Set a maximum value for + * (end - start). + * {Boolean} moveable Enable moving of the range + * by dragging. True by default + * {Boolean} zoomable Enable zooming of the range + * by pinching/scrolling. True by default + */ + Range.prototype.setOptions = function (options) { + if (options) { + // copy the options that we know + var fields = ['direction', 'min', 'max', 'zoomMin', 'zoomMax', 'moveable', 'zoomable']; + util.selectiveExtend(fields, this.options, options); - this.props.content.width = this.dom.content.offsetWidth; - this.height = this.dom.box.offsetHeight; + if ('start' in options || 'end' in options) { + // apply a new range. both start and end are optional + this.setRange(options.start, options.end); + } + } + }; - this.dirty = false; + /** + * Test whether direction has a valid value + * @param {String} direction 'horizontal' or 'vertical' + */ + function validateDirection (direction) { + if (direction != 'horizontal' && direction != 'vertical') { + throw new TypeError('Unknown direction "' + direction + '". ' + + 'Choose "horizontal" or "vertical".'); + } } - this._repaintDeleteButton(dom.box); - this._repaintDragLeft(); - this._repaintDragRight(); -}; + /** + * Set a new start and end range + * @param {Number} [start] + * @param {Number} [end] + */ + Range.prototype.setRange = function(start, end) { + var changed = this._applyRange(start, end); + if (changed) { + var params = { + start: new Date(this.start), + end: new Date(this.end) + }; + this.body.emitter.emit('rangechange', params); + this.body.emitter.emit('rangechanged', params); + } + }; -/** - * Show the item in the DOM (when not already visible). The items DOM will - * be created when needed. - */ -ItemRange.prototype.show = function() { - if (!this.displayed) { - this.redraw(); - } -}; + /** + * Set a new start and end range. This method is the same as setRange, but + * does not trigger a range change and range changed event, and it returns + * true when the range is changed + * @param {Number} [start] + * @param {Number} [end] + * @return {Boolean} changed + * @private + */ + Range.prototype._applyRange = function(start, end) { + var newStart = (start != null) ? util.convert(start, 'Date').valueOf() : this.start, + newEnd = (end != null) ? util.convert(end, 'Date').valueOf() : this.end, + max = (this.options.max != null) ? util.convert(this.options.max, 'Date').valueOf() : null, + min = (this.options.min != null) ? util.convert(this.options.min, 'Date').valueOf() : null, + diff; -/** - * Hide the item from the DOM (when visible) - * @return {Boolean} changed - */ -ItemRange.prototype.hide = function() { - if (this.displayed) { - var box = this.dom.box; + // check for valid number + if (isNaN(newStart) || newStart === null) { + throw new Error('Invalid start "' + start + '"'); + } + if (isNaN(newEnd) || newEnd === null) { + throw new Error('Invalid end "' + end + '"'); + } - if (box.parentNode) { - box.parentNode.removeChild(box); + // prevent start < end + if (newEnd < newStart) { + newEnd = newStart; } - this.top = null; - this.left = null; + // prevent start < min + if (min !== null) { + if (newStart < min) { + diff = (min - newStart); + newStart += diff; + newEnd += diff; - this.displayed = false; - } -}; + // prevent end > max + if (max != null) { + if (newEnd > max) { + newEnd = max; + } + } + } + } -/** - * Reposition the item horizontally - * @Override - */ -// TODO: delete the old function -ItemRange.prototype.repositionX = function() { - var props = this.props, - parentWidth = this.parent.width, - start = this.conversion.toScreen(this.data.start), - end = this.conversion.toScreen(this.data.end), - padding = this.options.padding, - contentLeft; - - // limit the width of the this, as browsers cannot draw very wide divs - if (start < -parentWidth) { - start = -parentWidth; - } - if (end > 2 * parentWidth) { - end = 2 * parentWidth; - } - var boxWidth = Math.max(end - start, 1); + // prevent end > max + if (max !== null) { + if (newEnd > max) { + diff = (newEnd - max); + newStart -= diff; + newEnd -= diff; - if (this.overflow) { - // when range exceeds left of the window, position the contents at the left of the visible area - contentLeft = Math.max(-start, 0); + // prevent start < min + if (min != null) { + if (newStart < min) { + newStart = min; + } + } + } + } - this.left = start; - this.width = boxWidth + this.props.content.width; - // Note: The calculation of width is an optimistic calculation, giving - // a width which will not change when moving the Timeline - // So no restacking needed, which is nicer for the eye; - } - else { // no overflow - // when range exceeds left of the window, position the contents at the left of the visible area - if (start < 0) { - contentLeft = Math.min(-start, - (end - start - props.content.width - 2 * padding)); - // TODO: remove the need for options.padding. it's terrible. + // prevent (end-start) < zoomMin + if (this.options.zoomMin !== null) { + var zoomMin = parseFloat(this.options.zoomMin); + if (zoomMin < 0) { + zoomMin = 0; + } + if ((newEnd - newStart) < zoomMin) { + if ((this.end - this.start) === zoomMin) { + // ignore this action, we are already zoomed to the minimum + newStart = this.start; + newEnd = this.end; + } + else { + // zoom to the minimum + diff = (zoomMin - (newEnd - newStart)); + newStart -= diff / 2; + newEnd += diff / 2; + } + } } - else { - contentLeft = 0; + + // prevent (end-start) > zoomMax + if (this.options.zoomMax !== null) { + var zoomMax = parseFloat(this.options.zoomMax); + if (zoomMax < 0) { + zoomMax = 0; + } + if ((newEnd - newStart) > zoomMax) { + if ((this.end - this.start) === zoomMax) { + // ignore this action, we are already zoomed to the maximum + newStart = this.start; + newEnd = this.end; + } + else { + // zoom to the maximum + diff = ((newEnd - newStart) - zoomMax); + newStart += diff / 2; + newEnd -= diff / 2; + } + } } - this.left = start; - this.width = boxWidth; - } + var changed = (this.start != newStart || this.end != newEnd); - this.dom.box.style.left = this.left + 'px'; - this.dom.box.style.width = boxWidth + 'px'; - this.dom.content.style.left = contentLeft + 'px'; -}; + this.start = newStart; + this.end = newEnd; -/** - * Reposition the item vertically - * @Override - */ -ItemRange.prototype.repositionY = function() { - var orientation = this.options.orientation, - box = this.dom.box; + return changed; + }; - if (orientation == 'top') { - box.style.top = this.top + 'px'; - } - else { - box.style.top = (this.parent.height - this.top - this.height) + 'px'; - } -}; + /** + * Retrieve the current range. + * @return {Object} An object with start and end properties + */ + Range.prototype.getRange = function() { + return { + start: this.start, + end: this.end + }; + }; -/** - * Repaint a drag area on the left side of the range when the range is selected - * @protected - */ -ItemRange.prototype._repaintDragLeft = function () { - if (this.selected && this.options.editable.updateTime && !this.dom.dragLeft) { - // create and show drag area - var dragLeft = document.createElement('div'); - dragLeft.className = 'drag-left'; - dragLeft.dragLeftItem = this; - - // TODO: this should be redundant? - Hammer(dragLeft, { - preventDefault: true - }).on('drag', function () { - //console.log('drag left') - }); + /** + * Calculate the conversion offset and scale for current range, based on + * the provided width + * @param {Number} width + * @returns {{offset: number, scale: number}} conversion + */ + Range.prototype.conversion = function (width) { + return Range.conversion(this.start, this.end, width); + }; - this.dom.box.appendChild(dragLeft); - this.dom.dragLeft = dragLeft; - } - else if (!this.selected && this.dom.dragLeft) { - // delete drag area - if (this.dom.dragLeft.parentNode) { - this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft); + /** + * Static method to calculate the conversion offset and scale for a range, + * based on the provided start, end, and width + * @param {Number} start + * @param {Number} end + * @param {Number} width + * @returns {{offset: number, scale: number}} conversion + */ + Range.conversion = function (start, end, width) { + if (width != 0 && (end - start != 0)) { + return { + offset: start, + scale: width / (end - start) + } } - this.dom.dragLeft = null; - } -}; - -/** - * Repaint a drag area on the right side of the range when the range is selected - * @protected - */ -ItemRange.prototype._repaintDragRight = function () { - if (this.selected && this.options.editable.updateTime && !this.dom.dragRight) { - // create and show drag area - var dragRight = document.createElement('div'); - dragRight.className = 'drag-right'; - dragRight.dragRightItem = this; - - // TODO: this should be redundant? - Hammer(dragRight, { - preventDefault: true - }).on('drag', function () { - //console.log('drag right') - }); - - this.dom.box.appendChild(dragRight); - this.dom.dragRight = dragRight; - } - else if (!this.selected && this.dom.dragRight) { - // delete drag area - if (this.dom.dragRight.parentNode) { - this.dom.dragRight.parentNode.removeChild(this.dom.dragRight); + else { + return { + offset: 0, + scale: 1 + }; } - this.dom.dragRight = null; - } -}; + }; -/** - * @constructor Group - * @param {Number | String} groupId - * @param {Object} data - * @param {ItemSet} itemSet - */ -function Group (groupId, data, itemSet) { - this.groupId = groupId; + /** + * Start dragging horizontally or vertically + * @param {Event} event + * @private + */ + Range.prototype._onDragStart = function(event) { + // only allow dragging when configured as movable + if (!this.options.moveable) return; - this.itemSet = itemSet; + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; - this.dom = {}; - this.props = { - label: { - width: 0, - height: 0 + this.props.touch.start = this.start; + this.props.touch.end = this.end; + + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'move'; } }; - this.className = null; - this.items = {}; // items filtered by groupId of this group - this.visibleItems = []; // items currently visible in window - this.orderedItems = { // items sorted by start and by end - byStart: [], - byEnd: [] + /** + * Perform dragging operation + * @param {Event} event + * @private + */ + Range.prototype._onDrag = function (event) { + // only allow dragging when configured as movable + if (!this.options.moveable) return; + var direction = this.options.direction; + validateDirection(direction); + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + var delta = (direction == 'horizontal') ? event.gesture.deltaX : event.gesture.deltaY, + interval = (this.props.touch.end - this.props.touch.start), + width = (direction == 'horizontal') ? this.body.domProps.center.width : this.body.domProps.center.height, + diffRange = -delta / width * interval; + this._applyRange(this.props.touch.start + diffRange, this.props.touch.end + diffRange); + this.body.emitter.emit('rangechange', { + start: new Date(this.start), + end: new Date(this.end) + }); }; - this._create(); + /** + * Stop dragging operation + * @param {event} event + * @private + */ + Range.prototype._onDragEnd = function (event) { + // only allow dragging when configured as movable + if (!this.options.moveable) return; - this.setData(data); -} + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; -/** - * Create DOM elements for the group - * @private - */ -Group.prototype._create = function() { - var label = document.createElement('div'); - label.className = 'vlabel'; - this.dom.label = label; - - var inner = document.createElement('div'); - inner.className = 'inner'; - label.appendChild(inner); - this.dom.inner = inner; - - var foreground = document.createElement('div'); - foreground.className = 'group'; - foreground['timeline-group'] = this; - this.dom.foreground = foreground; - - this.dom.background = document.createElement('div'); - this.dom.background.className = 'group'; - - this.dom.axis = document.createElement('div'); - this.dom.axis.className = 'group'; - - // create a hidden marker to detect when the Timelines container is attached - // to the DOM, or the style of a parent of the Timeline is changed from - // display:none is changed to visible. - this.dom.marker = document.createElement('div'); - this.dom.marker.style.visibility = 'hidden'; - this.dom.marker.innerHTML = '?'; - this.dom.background.appendChild(this.dom.marker); -}; + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'auto'; + } -/** - * Set the group data for this group - * @param {Object} data Group data, can contain properties content and className - */ -Group.prototype.setData = function(data) { - // update contents - var content = data && data.content; - if (content instanceof Element) { - this.dom.inner.appendChild(content); - } - else if (content != undefined) { - this.dom.inner.innerHTML = content; - } - else { - this.dom.inner.innerHTML = this.groupId; - } + // fire a rangechanged event + this.body.emitter.emit('rangechanged', { + start: new Date(this.start), + end: new Date(this.end) + }); + }; - // update title - this.dom.label.title = data && data.title || ''; + /** + * Event handler for mouse wheel event, used to zoom + * Code from http://adomas.org/javascript-mouse-wheel/ + * @param {Event} event + * @private + */ + Range.prototype._onMouseWheel = function(event) { + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; + + // retrieve delta + var delta = 0; + if (event.wheelDelta) { /* IE/Opera. */ + delta = event.wheelDelta / 120; + } else if (event.detail) { /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail / 3; + } + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + // perform the zoom action. Delta is normally 1 or -1 + + // adjust a negative delta such that zooming in with delta 0.1 + // equals zooming out with a delta -0.1 + var scale; + if (delta < 0) { + scale = 1 - (delta / 5); + } + else { + scale = 1 / (1 + (delta / 5)) ; + } - if (!this.dom.inner.firstChild) { - util.addClassName(this.dom.inner, 'hidden'); - } - else { - util.removeClassName(this.dom.inner, 'hidden'); - } + // calculate center, the date to zoom around + var gesture = hammerUtil.fakeGesture(this, event), + pointer = getPointer(gesture.center, this.body.dom.center), + pointerDate = this._pointerToDate(pointer); - // update className - var className = data && data.className || null; - if (className != this.className) { - if (this.className) { - util.removeClassName(this.dom.label, className); - util.removeClassName(this.dom.foreground, className); - util.removeClassName(this.dom.background, className); - util.removeClassName(this.dom.axis, className); - } - util.addClassName(this.dom.label, className); - util.addClassName(this.dom.foreground, className); - util.addClassName(this.dom.background, className); - util.addClassName(this.dom.axis, className); - } -}; + this.zoom(scale, pointerDate); + } -/** - * Get the width of the group label - * @return {number} width - */ -Group.prototype.getLabelWidth = function() { - return this.props.label.width; -}; + // Prevent default actions caused by mouse wheel + // (else the page and timeline both zoom and scroll) + event.preventDefault(); + }; + /** + * Start of a touch gesture + * @private + */ + Range.prototype._onTouch = function (event) { + this.props.touch.start = this.start; + this.props.touch.end = this.end; + this.props.touch.allowDragging = true; + this.props.touch.center = null; + }; -/** - * Repaint this group - * @param {{start: number, end: number}} range - * @param {{item: number, axis: number}} margin - * @param {boolean} [restack=false] Force restacking of all items - * @return {boolean} Returns true if the group is resized - */ -Group.prototype.redraw = function(range, margin, restack) { - var resized = false; + /** + * On start of a hold gesture + * @private + */ + Range.prototype._onHold = function () { + this.props.touch.allowDragging = false; + }; - this.visibleItems = this._updateVisibleItems(this.orderedItems, this.visibleItems, range); + /** + * Handle pinch event + * @param {Event} event + * @private + */ + Range.prototype._onPinch = function (event) { + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; - // force recalculation of the height of the items when the marker height changed - // (due to the Timeline being attached to the DOM or changed from display:none to visible) - var markerHeight = this.dom.marker.clientHeight; - if (markerHeight != this.lastMarkerHeight) { - this.lastMarkerHeight = markerHeight; + this.props.touch.allowDragging = false; - util.forEach(this.items, function (item) { - item.dirty = true; - if (item.displayed) item.redraw(); - }); + if (event.gesture.touches.length > 1) { + if (!this.props.touch.center) { + this.props.touch.center = getPointer(event.gesture.center, this.body.dom.center); + } - restack = true; - } + var scale = 1 / event.gesture.scale, + initDate = this._pointerToDate(this.props.touch.center); - // reposition visible items vertically - if (this.itemSet.options.stack) { // TODO: ugly way to access options... - stack.stack(this.visibleItems, margin, restack); - } - else { // no stacking - stack.nostack(this.visibleItems, margin); - } + // calculate new start and end + var newStart = parseInt(initDate + (this.props.touch.start - initDate) * scale); + var newEnd = parseInt(initDate + (this.props.touch.end - initDate) * scale); - // recalculate the height of the group - var height; - var visibleItems = this.visibleItems; - if (visibleItems.length) { - var min = visibleItems[0].top; - var max = visibleItems[0].top + visibleItems[0].height; - util.forEach(visibleItems, function (item) { - min = Math.min(min, item.top); - max = Math.max(max, (item.top + item.height)); - }); - if (min > margin.axis) { - // there is an empty gap between the lowest item and the axis - var offset = min - margin.axis; - max -= offset; - util.forEach(visibleItems, function (item) { - item.top -= offset; - }); + // apply new range + this.setRange(newStart, newEnd); } - height = max + margin.item / 2; - } - else { - height = margin.axis + margin.item; - } - height = Math.max(height, this.props.label.height); - - // calculate actual size and position - var foreground = this.dom.foreground; - this.top = foreground.offsetTop; - this.left = foreground.offsetLeft; - this.width = foreground.offsetWidth; - resized = util.updateProperty(this, 'height', height) || resized; - - // recalculate size of label - resized = util.updateProperty(this.props.label, 'width', this.dom.inner.clientWidth) || resized; - resized = util.updateProperty(this.props.label, 'height', this.dom.inner.clientHeight) || resized; - - // apply new height - this.dom.background.style.height = height + 'px'; - this.dom.foreground.style.height = height + 'px'; - this.dom.label.style.height = height + 'px'; - - // update vertical position of items after they are re-stacked and the height of the group is calculated - for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { - var item = this.visibleItems[i]; - item.repositionY(); - } + }; - return resized; -}; + /** + * Helper function to calculate the center date for zooming + * @param {{x: Number, y: Number}} pointer + * @return {number} date + * @private + */ + Range.prototype._pointerToDate = function (pointer) { + var conversion; + var direction = this.options.direction; -/** - * Show this group: attach to the DOM - */ -Group.prototype.show = function() { - if (!this.dom.label.parentNode) { - this.itemSet.dom.labelSet.appendChild(this.dom.label); - } + validateDirection(direction); - if (!this.dom.foreground.parentNode) { - this.itemSet.dom.foreground.appendChild(this.dom.foreground); - } - - if (!this.dom.background.parentNode) { - this.itemSet.dom.background.appendChild(this.dom.background); - } + if (direction == 'horizontal') { + var width = this.body.domProps.center.width; + conversion = this.conversion(width); + return pointer.x / conversion.scale + conversion.offset; + } + else { + var height = this.body.domProps.center.height; + conversion = this.conversion(height); + return pointer.y / conversion.scale + conversion.offset; + } + }; - if (!this.dom.axis.parentNode) { - this.itemSet.dom.axis.appendChild(this.dom.axis); + /** + * Get the pointer location relative to the location of the dom element + * @param {{pageX: Number, pageY: Number}} touch + * @param {Element} element HTML DOM element + * @return {{x: Number, y: Number}} pointer + * @private + */ + function getPointer (touch, element) { + return { + x: touch.pageX - util.getAbsoluteLeft(element), + y: touch.pageY - util.getAbsoluteTop(element) + }; } -}; -/** - * Hide this group: remove from the DOM - */ -Group.prototype.hide = function() { - var label = this.dom.label; - if (label.parentNode) { - label.parentNode.removeChild(label); - } + /** + * Zoom the range the given scale in or out. Start and end date will + * be adjusted, and the timeline will be redrawn. You can optionally give a + * date around which to zoom. + * For example, try scale = 0.9 or 1.1 + * @param {Number} scale Scaling factor. Values above 1 will zoom out, + * values below 1 will zoom in. + * @param {Number} [center] Value representing a date around which will + * be zoomed. + */ + Range.prototype.zoom = function(scale, center) { + // if centerDate is not provided, take it half between start Date and end Date + if (center == null) { + center = (this.start + this.end) / 2; + } - var foreground = this.dom.foreground; - if (foreground.parentNode) { - foreground.parentNode.removeChild(foreground); - } + // calculate new start and end + var newStart = center + (this.start - center) * scale; + var newEnd = center + (this.end - center) * scale; - var background = this.dom.background; - if (background.parentNode) { - background.parentNode.removeChild(background); - } + this.setRange(newStart, newEnd); + }; - var axis = this.dom.axis; - if (axis.parentNode) { - axis.parentNode.removeChild(axis); - } -}; + /** + * Move the range with a given delta to the left or right. Start and end + * value will be adjusted. For example, try delta = 0.1 or -0.1 + * @param {Number} delta Moving amount. Positive value will move right, + * negative value will move left + */ + Range.prototype.move = function(delta) { + // zoom start Date and end Date relative to the centerDate + var diff = (this.end - this.start); -/** - * Add an item to the group - * @param {Item} item - */ -Group.prototype.add = function(item) { - this.items[item.id] = item; - item.setParent(this); + // apply new values + var newStart = this.start + diff * delta; + var newEnd = this.end + diff * delta; - if (item instanceof ItemRange && this.visibleItems.indexOf(item) == -1) { - var range = this.itemSet.body.range; // TODO: not nice accessing the range like this - this._checkIfVisible(item, this.visibleItems, range); - } -}; + // TODO: reckon with min and max range -/** - * Remove an item from the group - * @param {Item} item - */ -Group.prototype.remove = function(item) { - delete this.items[item.id]; - item.setParent(this.itemSet); + this.start = newStart; + this.end = newEnd; + }; - // remove from visible items - var index = this.visibleItems.indexOf(item); - if (index != -1) this.visibleItems.splice(index, 1); + /** + * Move the range to a new center point + * @param {Number} moveTo New center point of the range + */ + Range.prototype.moveTo = function(moveTo) { + var center = (this.start + this.end) / 2; - // TODO: also remove from ordered items? -}; + var diff = center - moveTo; -/** - * Remove an item from the corresponding DataSet - * @param {Item} item - */ -Group.prototype.removeFromDataSet = function(item) { - this.itemSet.removeItem(item.id); -}; + // calculate new start and end + var newStart = this.start - diff; + var newEnd = this.end - diff; -/** - * Reorder the items - */ -Group.prototype.order = function() { - var array = util.toArray(this.items); - this.orderedItems.byStart = array; - this.orderedItems.byEnd = this._constructByEndArray(array); + this.setRange(newStart, newEnd); + }; - stack.orderByStart(this.orderedItems.byStart); - stack.orderByEnd(this.orderedItems.byEnd); -}; + module.exports = Range; -/** - * Create an array containing all items being a range (having an end date) - * @param {Item[]} array - * @returns {ItemRange[]} - * @private - */ -Group.prototype._constructByEndArray = function(array) { - var endArray = []; - for (var i = 0; i < array.length; i++) { - if (array[i] instanceof ItemRange) { - endArray.push(array[i]); - } - } - return endArray; -}; +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Update the visible items - * @param {{byStart: Item[], byEnd: Item[]}} orderedItems All items ordered by start date and by end date - * @param {Item[]} visibleItems The previously visible items. - * @param {{start: number, end: number}} range Visible range - * @return {Item[]} visibleItems The new visible items. - * @private - */ -Group.prototype._updateVisibleItems = function(orderedItems, visibleItems, range) { - var initialPosByStart, - newVisibleItems = [], - i; + // Utility functions for ordering and stacking of items + var EPSILON = 0.001; // used when checking collisions, to prevent round-off errors - // first check if the items that were in view previously are still in view. - // this handles the case for the ItemRange that is both before and after the current one. - if (visibleItems.length > 0) { - for (i = 0; i < visibleItems.length; i++) { - this._checkIfVisible(visibleItems[i], newVisibleItems, range); - } - } + /** + * Order items by their start data + * @param {Item[]} items + */ + exports.orderByStart = function(items) { + items.sort(function (a, b) { + return a.data.start - b.data.start; + }); + }; - // If there were no visible items previously, use binarySearch to find a visible ItemPoint or ItemRange (based on startTime) - if (newVisibleItems.length == 0) { - initialPosByStart = util.binarySearch(orderedItems.byStart, range, 'data','start'); - } - else { - initialPosByStart = orderedItems.byStart.indexOf(newVisibleItems[0]); - } + /** + * Order items by their end date. If they have no end date, their start date + * is used. + * @param {Item[]} items + */ + exports.orderByEnd = function(items) { + items.sort(function (a, b) { + var aTime = ('end' in a.data) ? a.data.end : a.data.start, + bTime = ('end' in b.data) ? b.data.end : b.data.start; - // use visible search to find a visible ItemRange (only based on endTime) - var initialPosByEnd = util.binarySearch(orderedItems.byEnd, range, 'data','end'); + return aTime - bTime; + }); + }; - // if we found a initial ID to use, trace it up and down until we meet an invisible item. - if (initialPosByStart != -1) { - for (i = initialPosByStart; i >= 0; i--) { - if (this._checkIfInvisible(orderedItems.byStart[i], newVisibleItems, range)) {break;} - } - for (i = initialPosByStart + 1; i < orderedItems.byStart.length; i++) { - if (this._checkIfInvisible(orderedItems.byStart[i], newVisibleItems, range)) {break;} - } - } + /** + * Adjust vertical positions of the items such that they don't overlap each + * other. + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {boolean} [force=false] + * If true, all items will be repositioned. If false (default), only + * items having a top===null will be re-stacked + */ + exports.stack = function(items, margin, force) { + var i, iMax; - // if we found a initial ID to use, trace it up and down until we meet an invisible item. - if (initialPosByEnd != -1) { - for (i = initialPosByEnd; i >= 0; i--) { - if (this._checkIfInvisible(orderedItems.byEnd[i], newVisibleItems, range)) {break;} - } - for (i = initialPosByEnd + 1; i < orderedItems.byEnd.length; i++) { - if (this._checkIfInvisible(orderedItems.byEnd[i], newVisibleItems, range)) {break;} + if (force) { + // reset top position of all items + for (i = 0, iMax = items.length; i < iMax; i++) { + items[i].top = null; + } } - } - return newVisibleItems; -}; + // calculate new, non-overlapping positions + for (i = 0, iMax = items.length; i < iMax; i++) { + var item = items[i]; + if (item.top === null) { + // initialize top position + item.top = margin.axis; + + do { + // TODO: optimize checking for overlap. when there is a gap without items, + // you only need to check for items from the next item on, not from zero + var collidingItem = null; + for (var j = 0, jj = items.length; j < jj; j++) { + var other = items[j]; + if (other.top !== null && other !== item && exports.collision(item, other, margin.item)) { + collidingItem = other; + break; + } + } + if (collidingItem != null) { + // There is a collision. Reposition the items above the colliding element + item.top = collidingItem.top + collidingItem.height + margin.item.vertical; + } + } while (collidingItem); + } + } + }; + /** + * Adjust vertical positions of the items without stacking them + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + */ + exports.nostack = function(items, margin) { + var i, iMax; -/** - * this function checks if an item is invisible. If it is NOT we make it visible - * and add it to the global visible items. If it is, return true. - * - * @param {Item} item - * @param {Item[]} visibleItems - * @param {{start:number, end:number}} range - * @returns {boolean} - * @private - */ -Group.prototype._checkIfInvisible = function(item, visibleItems, range) { - if (item.isVisible(range)) { - if (!item.displayed) item.show(); - item.repositionX(); - if (visibleItems.indexOf(item) == -1) { - visibleItems.push(item); + // reset top position of all items + for (i = 0, iMax = items.length; i < iMax; i++) { + items[i].top = margin.axis; } - return false; - } - else { - return true; - } -}; + }; -/** - * this function is very similar to the _checkIfInvisible() but it does not - * return booleans, hides the item if it should not be seen and always adds to - * the visibleItems. - * this one is for brute forcing and hiding. - * - * @param {Item} item - * @param {Array} visibleItems - * @param {{start:number, end:number}} range - * @private - */ -Group.prototype._checkIfVisible = function(item, visibleItems, range) { - if (item.isVisible(range)) { - if (!item.displayed) item.show(); - // reposition item horizontally - item.repositionX(); - visibleItems.push(item); - } - else { - if (item.displayed) item.hide(); - } -}; + /** + * Test if the two provided items collide + * The items must have parameters left, width, top, and height. + * @param {Item} a The first item + * @param {Item} b The second item + * @param {{horizontal: number, vertical: number}} margin + * An object containing a horizontal and vertical + * minimum required margin. + * @return {boolean} true if a and b collide, else false + */ + exports.collision = function(a, b, margin) { + return ((a.left - margin.horizontal + EPSILON) < (b.left + b.width) && + (a.left + a.width + margin.horizontal - EPSILON) > b.left && + (a.top - margin.vertical + EPSILON) < (b.top + b.height) && + (a.top + a.height + margin.vertical - EPSILON) > b.top); + }; -/** - * Create a timeline visualization - * @param {HTMLElement} container - * @param {vis.DataSet | Array | google.visualization.DataTable} [items] - * @param {Object} [options] See Timeline.setOptions for the available options. - * @constructor - */ -function Timeline (container, items, options) { - if (!(this instanceof Timeline)) { - throw new SyntaxError('Constructor must be called with the new operator'); - } - var me = this; - this.defaultOptions = { - start: null, - end: null, +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { - autoResize: true, + var moment = __webpack_require__(40); - orientation: 'bottom', - width: null, - height: null, - maxHeight: null, - minHeight: null + /** + * @constructor TimeStep + * The class TimeStep is an iterator for dates. You provide a start date and an + * end date. The class itself determines the best scale (step size) based on the + * provided start Date, end Date, and minimumStep. + * + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * + * Alternatively, you can set a scale by hand. + * After creation, you can initialize the class by executing first(). Then you + * can iterate from the start date to the end date via next(). You can check if + * the end date is reached with the function hasNext(). After each step, you can + * retrieve the current date via getCurrent(). + * The TimeStep has scales ranging from milliseconds, seconds, minutes, hours, + * days, to years. + * + * Version: 1.2 + * + * @param {Date} [start] The start date, for example new Date(2010, 9, 21) + * or new Date(2010, 9, 21, 23, 45, 00) + * @param {Date} [end] The end date + * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds + */ + function TimeStep(start, end, minimumStep) { + // variables + this.current = new Date(); + this._start = new Date(); + this._end = new Date(); + + this.autoScale = true; + this.scale = TimeStep.SCALE.DAY; + this.step = 1; + + // initialize the range + this.setRange(start, end, minimumStep); + } + + /// enum scale + TimeStep.SCALE = { + MILLISECOND: 1, + SECOND: 2, + MINUTE: 3, + HOUR: 4, + DAY: 5, + WEEKDAY: 6, + MONTH: 7, + YEAR: 8 }; - this.options = util.deepExtend({}, this.defaultOptions); - // Create the DOM, props, and emitter - this._create(container); - // all components listed here will be repainted automatically - this.components = []; + /** + * Set a new range + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * @param {Date} [start] The start date and time. + * @param {Date} [end] The end date and time. + * @param {int} [minimumStep] Optional. Minimum step size in milliseconds + */ + TimeStep.prototype.setRange = function(start, end, minimumStep) { + if (!(start instanceof Date) || !(end instanceof Date)) { + throw "No legal start or end date in method setRange"; + } + + this._start = (start != undefined) ? new Date(start.valueOf()) : new Date(); + this._end = (end != undefined) ? new Date(end.valueOf()) : new Date(); - this.body = { - dom: this.dom, - domProps: this.props, - emitter: { - on: this.on.bind(this), - off: this.off.bind(this), - emit: this.emit.bind(this) - }, - util: { - snap: null, // will be specified after TimeAxis is created - toScreen: me._toScreen.bind(me), - toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width - toTime: me._toTime.bind(me), - toGlobalTime : me._toGlobalTime.bind(me) + if (this.autoScale) { + this.setMinimumStep(minimumStep); } }; - // range - this.range = new Range(this.body); - this.components.push(this.range); - this.body.range = this.range; + /** + * Set the range iterator to the start date. + */ + TimeStep.prototype.first = function() { + this.current = new Date(this._start.valueOf()); + this.roundToMinor(); + }; - // time axis - this.timeAxis = new TimeAxis(this.body); - this.components.push(this.timeAxis); - this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); + /** + * Round the current date to the first minor date value + * This must be executed once when the current date is set to start Date + */ + TimeStep.prototype.roundToMinor = function() { + // round to floor + // IMPORTANT: we have no breaks in this switch! (this is no bug) + //noinspection FallthroughInSwitchStatementJS + switch (this.scale) { + case TimeStep.SCALE.YEAR: + this.current.setFullYear(this.step * Math.floor(this.current.getFullYear() / this.step)); + this.current.setMonth(0); + case TimeStep.SCALE.MONTH: this.current.setDate(1); + case TimeStep.SCALE.DAY: // intentional fall through + case TimeStep.SCALE.WEEKDAY: this.current.setHours(0); + case TimeStep.SCALE.HOUR: this.current.setMinutes(0); + case TimeStep.SCALE.MINUTE: this.current.setSeconds(0); + case TimeStep.SCALE.SECOND: this.current.setMilliseconds(0); + //case TimeStep.SCALE.MILLISECOND: // nothing to do for milliseconds + } + + if (this.step != 1) { + // round down to the first minor value that is a multiple of the current step size + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: this.current.setMilliseconds(this.current.getMilliseconds() - this.current.getMilliseconds() % this.step); break; + case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() - this.current.getSeconds() % this.step); break; + case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() - this.current.getMinutes() % this.step); break; + case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() - this.current.getHours() % this.step); break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: this.current.setDate((this.current.getDate()-1) - (this.current.getDate()-1) % this.step + 1); break; + case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() - this.current.getMonth() % this.step); break; + case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() - this.current.getFullYear() % this.step); break; + default: break; + } + } + }; - // current time bar - this.currentTime = new CurrentTime(this.body); - this.components.push(this.currentTime); + /** + * Check if the there is a next step + * @return {boolean} true if the current date has not passed the end date + */ + TimeStep.prototype.hasNext = function () { + return (this.current.valueOf() <= this._end.valueOf()); + }; - // custom time bar - // Note: time bar will be attached in this.setOptions when selected - this.customTime = new CustomTime(this.body); - this.components.push(this.customTime); + /** + * Do the next step + */ + TimeStep.prototype.next = function() { + var prev = this.current.valueOf(); + + // Two cases, needed to prevent issues with switching daylight savings + // (end of March and end of October) + if (this.current.getMonth() < 6) { + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: + + this.current = new Date(this.current.valueOf() + this.step); break; + case TimeStep.SCALE.SECOND: this.current = new Date(this.current.valueOf() + this.step * 1000); break; + case TimeStep.SCALE.MINUTE: this.current = new Date(this.current.valueOf() + this.step * 1000 * 60); break; + case TimeStep.SCALE.HOUR: + this.current = new Date(this.current.valueOf() + this.step * 1000 * 60 * 60); + // in case of skipping an hour for daylight savings, adjust the hour again (else you get: 0h 5h 9h ... instead of 0h 4h 8h ...) + var h = this.current.getHours(); + this.current.setHours(h - (h % this.step)); + break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break; + case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break; + case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break; + default: break; + } + } + else { + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: this.current = new Date(this.current.valueOf() + this.step); break; + case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() + this.step); break; + case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() + this.step); break; + case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() + this.step); break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break; + case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break; + case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break; + default: break; + } + } + + if (this.step != 1) { + // round down to the correct major value + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: if(this.current.getMilliseconds() < this.step) this.current.setMilliseconds(0); break; + case TimeStep.SCALE.SECOND: if(this.current.getSeconds() < this.step) this.current.setSeconds(0); break; + case TimeStep.SCALE.MINUTE: if(this.current.getMinutes() < this.step) this.current.setMinutes(0); break; + case TimeStep.SCALE.HOUR: if(this.current.getHours() < this.step) this.current.setHours(0); break; + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: if(this.current.getDate() < this.step+1) this.current.setDate(1); break; + case TimeStep.SCALE.MONTH: if(this.current.getMonth() < this.step) this.current.setMonth(0); break; + case TimeStep.SCALE.YEAR: break; // nothing to do for year + default: break; + } + } + + // safety mechanism: if current time is still unchanged, move to the end + if (this.current.valueOf() == prev) { + this.current = new Date(this._end.valueOf()); + } + }; - // item set - this.itemSet = new ItemSet(this.body); - this.components.push(this.itemSet); - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet + /** + * Get the current datetime + * @return {Date} current The current date + */ + TimeStep.prototype.getCurrent = function() { + return this.current; + }; - // apply options - if (options) { - this.setOptions(options); - } + /** + * Set a custom scale. Autoscaling will be disabled. + * For example setScale(SCALE.MINUTES, 5) will result + * in minor steps of 5 minutes, and major steps of an hour. + * + * @param {TimeStep.SCALE} newScale + * A scale. Choose from SCALE.MILLISECOND, + * SCALE.SECOND, SCALE.MINUTE, SCALE.HOUR, + * SCALE.WEEKDAY, SCALE.DAY, SCALE.MONTH, + * SCALE.YEAR. + * @param {Number} newStep A step size, by default 1. Choose for + * example 1, 2, 5, or 10. + */ + TimeStep.prototype.setScale = function(newScale, newStep) { + this.scale = newScale; - // create itemset - if (items) { - this.setItems(items); - } - else { - this.redraw(); - } -} + if (newStep > 0) { + this.step = newStep; + } -// turn Timeline into an event emitter -Emitter(Timeline.prototype); + this.autoScale = false; + }; -/** - * Create the main DOM for the Timeline: a root panel containing left, right, - * top, bottom, content, and background panel. - * @param {Element} container The container element where the Timeline will - * be attached. - * @private - */ -Timeline.prototype._create = function (container) { - this.dom = {}; - - this.dom.root = document.createElement('div'); - this.dom.background = document.createElement('div'); - this.dom.backgroundVertical = document.createElement('div'); - this.dom.backgroundHorizontal = document.createElement('div'); - this.dom.centerContainer = document.createElement('div'); - this.dom.leftContainer = document.createElement('div'); - this.dom.rightContainer = document.createElement('div'); - this.dom.center = document.createElement('div'); - this.dom.left = document.createElement('div'); - this.dom.right = document.createElement('div'); - this.dom.top = document.createElement('div'); - this.dom.bottom = document.createElement('div'); - this.dom.shadowTop = document.createElement('div'); - this.dom.shadowBottom = document.createElement('div'); - this.dom.shadowTopLeft = document.createElement('div'); - this.dom.shadowBottomLeft = document.createElement('div'); - this.dom.shadowTopRight = document.createElement('div'); - this.dom.shadowBottomRight = document.createElement('div'); - - this.dom.background.className = 'vispanel background'; - this.dom.backgroundVertical.className = 'vispanel background vertical'; - this.dom.backgroundHorizontal.className = 'vispanel background horizontal'; - this.dom.centerContainer.className = 'vispanel center'; - this.dom.leftContainer.className = 'vispanel left'; - this.dom.rightContainer.className = 'vispanel right'; - this.dom.top.className = 'vispanel top'; - this.dom.bottom.className = 'vispanel bottom'; - this.dom.left.className = 'content'; - this.dom.center.className = 'content'; - this.dom.right.className = 'content'; - this.dom.shadowTop.className = 'shadow top'; - this.dom.shadowBottom.className = 'shadow bottom'; - this.dom.shadowTopLeft.className = 'shadow top'; - this.dom.shadowBottomLeft.className = 'shadow bottom'; - this.dom.shadowTopRight.className = 'shadow top'; - this.dom.shadowBottomRight.className = 'shadow bottom'; - - this.dom.root.appendChild(this.dom.background); - this.dom.root.appendChild(this.dom.backgroundVertical); - this.dom.root.appendChild(this.dom.backgroundHorizontal); - this.dom.root.appendChild(this.dom.centerContainer); - this.dom.root.appendChild(this.dom.leftContainer); - this.dom.root.appendChild(this.dom.rightContainer); - this.dom.root.appendChild(this.dom.top); - this.dom.root.appendChild(this.dom.bottom); - - this.dom.centerContainer.appendChild(this.dom.center); - this.dom.leftContainer.appendChild(this.dom.left); - this.dom.rightContainer.appendChild(this.dom.right); - - this.dom.centerContainer.appendChild(this.dom.shadowTop); - this.dom.centerContainer.appendChild(this.dom.shadowBottom); - this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); - this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); - this.dom.rightContainer.appendChild(this.dom.shadowTopRight); - this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); - - this.on('rangechange', this.redraw.bind(this)); - this.on('change', this.redraw.bind(this)); - this.on('touch', this._onTouch.bind(this)); - this.on('pinch', this._onPinch.bind(this)); - this.on('dragstart', this._onDragStart.bind(this)); - this.on('drag', this._onDrag.bind(this)); - - // create event listeners for all interesting events, these events will be - // emitted via emitter - this.hammer = Hammer(this.dom.root, { - prevent_default: true - }); - this.listeners = {}; - - var me = this; - var events = [ - 'touch', 'pinch', - 'tap', 'doubletap', 'hold', - 'dragstart', 'drag', 'dragend', - 'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox - ]; - events.forEach(function (event) { - var listener = function () { - var args = [event].concat(Array.prototype.slice.call(arguments, 0)); - me.emit.apply(me, args); - }; - me.hammer.on(event, listener); - me.listeners[event] = listener; - }); - - // size properties of each of the panels - this.props = { - root: {}, - background: {}, - centerContainer: {}, - leftContainer: {}, - rightContainer: {}, - center: {}, - left: {}, - right: {}, - top: {}, - bottom: {}, - border: {}, - scrollTop: 0, - scrollTopMin: 0 - }; - this.touch = {}; // store state information needed for touch events - - // attach the root panel to the provided container - if (!container) throw new Error('No container provided'); - container.appendChild(this.dom.root); -}; + /** + * Enable or disable autoscaling + * @param {boolean} enable If true, autoascaling is set true + */ + TimeStep.prototype.setAutoScale = function (enable) { + this.autoScale = enable; + }; -/** - * Destroy the Timeline, clean up all DOM elements and event listeners. - */ -Timeline.prototype.destroy = function () { - // unbind datasets - this.clear(); - // remove all event listeners - this.off(); + /** + * Automatically determine the scale that bests fits the provided minimum step + * @param {Number} [minimumStep] The minimum step size in milliseconds + */ + TimeStep.prototype.setMinimumStep = function(minimumStep) { + if (minimumStep == undefined) { + return; + } - // stop checking for changed size - this._stopAutoResize(); + var stepYear = (1000 * 60 * 60 * 24 * 30 * 12); + var stepMonth = (1000 * 60 * 60 * 24 * 30); + var stepDay = (1000 * 60 * 60 * 24); + var stepHour = (1000 * 60 * 60); + var stepMinute = (1000 * 60); + var stepSecond = (1000); + var stepMillisecond= (1); + + // find the smallest step that is larger than the provided minimumStep + if (stepYear*1000 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1000;} + if (stepYear*500 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 500;} + if (stepYear*100 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 100;} + if (stepYear*50 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 50;} + if (stepYear*10 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 10;} + if (stepYear*5 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 5;} + if (stepYear > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1;} + if (stepMonth*3 > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 3;} + if (stepMonth > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 1;} + if (stepDay*5 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 5;} + if (stepDay*2 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 2;} + if (stepDay > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 1;} + if (stepDay/2 > minimumStep) {this.scale = TimeStep.SCALE.WEEKDAY; this.step = 1;} + if (stepHour*4 > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 4;} + if (stepHour > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 1;} + if (stepMinute*15 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 15;} + if (stepMinute*10 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 10;} + if (stepMinute*5 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 5;} + if (stepMinute > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 1;} + if (stepSecond*15 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 15;} + if (stepSecond*10 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 10;} + if (stepSecond*5 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 5;} + if (stepSecond > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 1;} + if (stepMillisecond*200 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 200;} + if (stepMillisecond*100 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 100;} + if (stepMillisecond*50 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 50;} + if (stepMillisecond*10 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 10;} + if (stepMillisecond*5 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 5;} + if (stepMillisecond > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 1;} + }; - // remove from DOM - if (this.dom.root.parentNode) { - this.dom.root.parentNode.removeChild(this.dom.root); - } - this.dom = null; + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate + */ + TimeStep.prototype.snap = function(date) { + var clone = new Date(date.valueOf()); + + if (this.scale == TimeStep.SCALE.YEAR) { + var year = clone.getFullYear() + Math.round(clone.getMonth() / 12); + clone.setFullYear(Math.round(year / this.step) * this.step); + clone.setMonth(0); + clone.setDate(0); + clone.setHours(0); + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.MONTH) { + if (clone.getDate() > 15) { + clone.setDate(1); + clone.setMonth(clone.getMonth() + 1); + // important: first set Date to 1, after that change the month. + } + else { + clone.setDate(1); + } + + clone.setHours(0); + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.DAY) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 5: + case 2: + clone.setHours(Math.round(clone.getHours() / 24) * 24); break; + default: + clone.setHours(Math.round(clone.getHours() / 12) * 12); break; + } + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.WEEKDAY) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 5: + case 2: + clone.setHours(Math.round(clone.getHours() / 12) * 12); break; + default: + clone.setHours(Math.round(clone.getHours() / 6) * 6); break; + } + clone.setMinutes(0); + clone.setSeconds(0); + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.HOUR) { + switch (this.step) { + case 4: + clone.setMinutes(Math.round(clone.getMinutes() / 60) * 60); break; + default: + clone.setMinutes(Math.round(clone.getMinutes() / 30) * 30); break; + } + clone.setSeconds(0); + clone.setMilliseconds(0); + } else if (this.scale == TimeStep.SCALE.MINUTE) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 15: + case 10: + clone.setMinutes(Math.round(clone.getMinutes() / 5) * 5); + clone.setSeconds(0); + break; + case 5: + clone.setSeconds(Math.round(clone.getSeconds() / 60) * 60); break; + default: + clone.setSeconds(Math.round(clone.getSeconds() / 30) * 30); break; + } + clone.setMilliseconds(0); + } + else if (this.scale == TimeStep.SCALE.SECOND) { + //noinspection FallthroughInSwitchStatementJS + switch (this.step) { + case 15: + case 10: + clone.setSeconds(Math.round(clone.getSeconds() / 5) * 5); + clone.setMilliseconds(0); + break; + case 5: + clone.setMilliseconds(Math.round(clone.getMilliseconds() / 1000) * 1000); break; + default: + clone.setMilliseconds(Math.round(clone.getMilliseconds() / 500) * 500); break; + } + } + else if (this.scale == TimeStep.SCALE.MILLISECOND) { + var step = this.step > 5 ? this.step / 2 : 1; + clone.setMilliseconds(Math.round(clone.getMilliseconds() / step) * step); + } + + return clone; + }; - // cleanup hammer touch events - for (var event in this.listeners) { - if (this.listeners.hasOwnProperty(event)) { - delete this.listeners[event]; + /** + * Check if the current value is a major value (for example when the step + * is DAY, a major value is each first day of the MONTH) + * @return {boolean} true if current date is major, else false. + */ + TimeStep.prototype.isMajor = function() { + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: + return (this.current.getMilliseconds() == 0); + case TimeStep.SCALE.SECOND: + return (this.current.getSeconds() == 0); + case TimeStep.SCALE.MINUTE: + return (this.current.getHours() == 0) && (this.current.getMinutes() == 0); + // Note: this is no bug. Major label is equal for both minute and hour scale + case TimeStep.SCALE.HOUR: + return (this.current.getHours() == 0); + case TimeStep.SCALE.WEEKDAY: // intentional fall through + case TimeStep.SCALE.DAY: + return (this.current.getDate() == 1); + case TimeStep.SCALE.MONTH: + return (this.current.getMonth() == 0); + case TimeStep.SCALE.YEAR: + return false; + default: + return false; } - } - this.listeners = null; - this.hammer = null; + }; - // give all components the opportunity to cleanup - this.components.forEach(function (component) { - component.destroy(); - }); - this.body = null; -}; + /** + * Returns formatted text for the minor axislabel, depending on the current + * date and the scale. For example when scale is MINUTE, the current time is + * formatted as "hh:mm". + * @param {Date} [date] custom date. if not provided, current date is taken + */ + TimeStep.prototype.getLabelMinor = function(date) { + if (date == undefined) { + date = this.current; + } -/** - * Set options. Options will be passed to all components loaded in the Timeline. - * @param {Object} [options] - * {String} orientation - * Vertical orientation for the Timeline, - * can be 'bottom' (default) or 'top'. - * {String | Number} width - * Width for the timeline, a number in pixels or - * a css string like '1000px' or '75%'. '100%' by default. - * {String | Number} height - * Fixed height for the Timeline, a number in pixels or - * a css string like '400px' or '75%'. If undefined, - * The Timeline will automatically size such that - * its contents fit. - * {String | Number} minHeight - * Minimum height for the Timeline, a number in pixels or - * a css string like '400px' or '75%'. - * {String | Number} maxHeight - * Maximum height for the Timeline, a number in pixels or - * a css string like '400px' or '75%'. - * {Number | Date | String} start - * Start date for the visible window - * {Number | Date | String} end - * End date for the visible window - */ -Timeline.prototype.setOptions = function (options) { - if (options) { - // copy the known options - var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation']; - util.selectiveExtend(fields, this.options, options); - - // enable/disable autoResize - this._initAutoResize(); - } + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND: return moment(date).format('SSS'); + case TimeStep.SCALE.SECOND: return moment(date).format('s'); + case TimeStep.SCALE.MINUTE: return moment(date).format('HH:mm'); + case TimeStep.SCALE.HOUR: return moment(date).format('HH:mm'); + case TimeStep.SCALE.WEEKDAY: return moment(date).format('ddd D'); + case TimeStep.SCALE.DAY: return moment(date).format('D'); + case TimeStep.SCALE.MONTH: return moment(date).format('MMM'); + case TimeStep.SCALE.YEAR: return moment(date).format('YYYY'); + default: return ''; + } + }; - // propagate options to all components - this.components.forEach(function (component) { - component.setOptions(options); - }); - // TODO: remove deprecation error one day (deprecated since version 0.8.0) - if (options && options.order) { - throw new Error('Option order is deprecated. There is no replacement for this feature.'); - } + /** + * Returns formatted text for the major axis label, depending on the current + * date and the scale. For example when scale is MINUTE, the major scale is + * hours, and the hour will be formatted as "hh". + * @param {Date} [date] custom date. if not provided, current date is taken + */ + TimeStep.prototype.getLabelMajor = function(date) { + if (date == undefined) { + date = this.current; + } - // redraw everything - this.redraw(); -}; + //noinspection FallthroughInSwitchStatementJS + switch (this.scale) { + case TimeStep.SCALE.MILLISECOND:return moment(date).format('HH:mm:ss'); + case TimeStep.SCALE.SECOND: return moment(date).format('D MMMM HH:mm'); + case TimeStep.SCALE.MINUTE: + case TimeStep.SCALE.HOUR: return moment(date).format('ddd D MMMM'); + case TimeStep.SCALE.WEEKDAY: + case TimeStep.SCALE.DAY: return moment(date).format('MMMM YYYY'); + case TimeStep.SCALE.MONTH: return moment(date).format('YYYY'); + case TimeStep.SCALE.YEAR: return ''; + default: return ''; + } + }; -/** - * Set a custom time bar - * @param {Date} time - */ -Timeline.prototype.setCustomTime = function (time) { - if (!this.customTime) { - throw new Error('Cannot get custom time: Custom time bar is not enabled'); - } + module.exports = TimeStep; - this.customTime.setCustomTime(time); -}; -/** - * Retrieve the current custom time. - * @return {Date} customTime - */ -Timeline.prototype.getCustomTime = function() { - if (!this.customTime) { - throw new Error('Cannot get custom time: Custom time bar is not enabled'); - } +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { - return this.customTime.getCustomTime(); -}; + /** + * Prototype for visual components + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body] + * @param {Object} [options] + */ + function Component (body, options) { + this.options = null; + this.props = null; + } -/** - * Set items - * @param {vis.DataSet | Array | google.visualization.DataTable | null} items - */ -Timeline.prototype.setItems = function(items) { - var initialLoad = (this.itemsData == null); + /** + * Set options for the component. The new options will be merged into the + * current options. + * @param {Object} options + */ + Component.prototype.setOptions = function(options) { + if (options) { + util.extend(this.options, options); + } + }; - // convert to type DataSet when needed - var newDataSet; - if (!items) { - newDataSet = null; - } - else if (items instanceof DataSet || items instanceof DataView) { - newDataSet = items; - } - else { - // turn an array into a dataset - newDataSet = new DataSet(items, { - type: { - start: 'Date', - end: 'Date' - } - }); - } + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + Component.prototype.redraw = function() { + // should be implemented by the component + return false; + }; - // set items - this.itemsData = newDataSet; - this.itemSet && this.itemSet.setItems(newDataSet); + /** + * Destroy the component. Cleanup DOM and event listeners + */ + Component.prototype.destroy = function() { + // should be implemented by the component + }; - if (initialLoad && ('start' in this.options || 'end' in this.options)) { - this.fit(); + /** + * Test whether the component is resized since the last time _isResized() was + * called. + * @return {Boolean} Returns true if the component is resized + * @protected + */ + Component.prototype._isResized = function() { + var resized = (this.props._previousWidth !== this.props.width || + this.props._previousHeight !== this.props.height); - var start = ('start' in this.options) ? util.convert(this.options.start, 'Date') : null; - var end = ('end' in this.options) ? util.convert(this.options.end, 'Date') : null; + this.props._previousWidth = this.props.width; + this.props._previousHeight = this.props.height; - this.setWindow(start, end); - } -}; + return resized; + }; -/** - * Set groups - * @param {vis.DataSet | Array | google.visualization.DataTable} groups - */ -Timeline.prototype.setGroups = function(groups) { - // convert to type DataSet when needed - var newDataSet; - if (!groups) { - newDataSet = null; - } - else if (groups instanceof DataSet || groups instanceof DataView) { - newDataSet = groups; - } - else { - // turn an array into a dataset - newDataSet = new DataSet(groups); - } + module.exports = Component; - this.groupsData = newDataSet; - this.itemSet.setGroups(newDataSet); -}; -/** - * Clear the Timeline. By Default, items, groups and options are cleared. - * Example usage: - * - * timeline.clear(); // clear items, groups, and options - * timeline.clear({options: true}); // clear options only - * - * @param {Object} [what] Optionally specify what to clear. By default: - * {items: true, groups: true, options: true} - */ -Timeline.prototype.clear = function(what) { - // clear items - if (!what || what.items) { - this.setItems(null); - } +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { - // clear groups - if (!what || what.groups) { - this.setGroups(null); - } + var util = __webpack_require__(1); + var Component = __webpack_require__(18); - // clear options of timeline and of each of the components - if (!what || what.options) { - this.components.forEach(function (component) { - component.setOptions(component.defaultOptions); - }); + /** + * A current time bar + * @param {{range: Range, dom: Object, domProps: Object}} body + * @param {Object} [options] Available parameters: + * {Boolean} [showCurrentTime] + * @constructor CurrentTime + * @extends Component + */ + function CurrentTime (body, options) { + this.body = body; - this.setOptions(this.defaultOptions); // this will also do a redraw - } -}; + // default options + this.defaultOptions = { + showCurrentTime: true + }; + this.options = util.extend({}, this.defaultOptions); -/** - * Set Timeline window such that it fits all items - */ -Timeline.prototype.fit = function() { - // apply the data range as range - var dataRange = this.getItemRange(); - - // add 5% space on both sides - var start = dataRange.min; - var end = dataRange.max; - if (start != null && end != null) { - var interval = (end.valueOf() - start.valueOf()); - if (interval <= 0) { - // prevent an empty interval - interval = 24 * 60 * 60 * 1000; // 1 day - } - start = new Date(start.valueOf() - interval * 0.05); - end = new Date(end.valueOf() + interval * 0.05); - } + this._create(); - // skip range set if there is no start and end date - if (start === null && end === null) { - return; + this.setOptions(options); } - this.range.setRange(start, end); -}; + CurrentTime.prototype = new Component(); -/** - * Get the data range of the item set. - * @returns {{min: Date, max: Date}} range A range with a start and end Date. - * When no minimum is found, min==null - * When no maximum is found, max==null - */ -Timeline.prototype.getItemRange = function() { - // calculate min from start filed - var dataset = this.itemsData.getDataSet(), - min = null, - max = null; + /** + * Create the HTML DOM for the current time bar + * @private + */ + CurrentTime.prototype._create = function() { + var bar = document.createElement('div'); + bar.className = 'currenttime'; + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + + this.bar = bar; + }; - if (dataset) { - // calculate the minimum value of the field 'start' - var minItem = dataset.min('start'); - min = minItem ? util.convert(minItem.start, 'Date').valueOf() : null; - // Note: we convert first to Date and then to number because else - // a conversion from ISODate to Number will fail + /** + * Destroy the CurrentTime bar + */ + CurrentTime.prototype.destroy = function () { + this.options.showCurrentTime = false; + this.redraw(); // will remove the bar from the DOM and stop refreshing + + this.body = null; + }; - // calculate maximum value of fields 'start' and 'end' - var maxStartItem = dataset.max('start'); - if (maxStartItem) { - max = util.convert(maxStartItem.start, 'Date').valueOf(); + /** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {boolean} [showCurrentTime] + */ + CurrentTime.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['showCurrentTime'], this.options, options); } - var maxEndItem = dataset.max('end'); - if (maxEndItem) { - if (max == null) { - max = util.convert(maxEndItem.end, 'Date').valueOf(); + }; + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + CurrentTime.prototype.redraw = function() { + if (this.options.showCurrentTime) { + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); + + this.start(); } - else { - max = Math.max(max, util.convert(maxEndItem.end, 'Date').valueOf()); + + var now = new Date(); + var x = this.body.util.toScreen(now); + + this.bar.style.left = x + 'px'; + this.bar.title = 'Current time: ' + now; + } + else { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); } + this.stop(); } - } - return { - min: (min != null) ? new Date(min) : null, - max: (max != null) ? new Date(max) : null + return false; }; -}; - -/** - * Set selected items by their id. Replaces the current selection - * Unknown id's are silently ignored. - * @param {Array} [ids] An array with zero or more id's of the items to be - * selected. If ids is an empty array, all items will be - * unselected. - */ -Timeline.prototype.setSelection = function(ids) { - this.itemSet && this.itemSet.setSelection(ids); -}; - -/** - * Get the selected items by their id - * @return {Array} ids The ids of the selected items - */ -Timeline.prototype.getSelection = function() { - return this.itemSet && this.itemSet.getSelection() || []; -}; -/** - * Set the visible window. Both parameters are optional, you can change only - * start or only end. Syntax: - * - * TimeLine.setWindow(start, end) - * TimeLine.setWindow(range) - * - * Where start and end can be a Date, number, or string, and range is an - * object with properties start and end. - * - * @param {Date | Number | String | Object} [start] Start date of visible window - * @param {Date | Number | String} [end] End date of visible window - */ -Timeline.prototype.setWindow = function(start, end) { - if (arguments.length == 1) { - var range = arguments[0]; - this.range.setRange(range.start, range.end); - } - else { - this.range.setRange(start, end); - } -}; + /** + * Start auto refreshing the current time bar + */ + CurrentTime.prototype.start = function() { + var me = this; -/** - * Get the visible window - * @return {{start: Date, end: Date}} Visible range - */ -Timeline.prototype.getWindow = function() { - var range = this.range.getRange(); - return { - start: new Date(range.start), - end: new Date(range.end) - }; -}; + function update () { + me.stop(); -/** - * Force a redraw of the Timeline. Can be useful to manually redraw when - * option autoResize=false - */ -Timeline.prototype.redraw = function() { - var resized = false, - options = this.options, - props = this.props, - dom = this.dom; + // determine interval to refresh + var scale = me.body.range.conversion(me.body.domProps.center.width).scale; + var interval = 1 / scale / 10; + if (interval < 30) interval = 30; + if (interval > 1000) interval = 1000; - if (!dom) return; // when destroyed - - // update class names - dom.root.className = 'vis timeline root ' + options.orientation; - - // update root width and height options - dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); - dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); - dom.root.style.width = util.option.asSize(options.width, ''); - - // calculate border widths - props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; - props.border.right = props.border.left; - props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; - props.border.bottom = props.border.top; - var borderRootHeight= dom.root.offsetHeight - dom.root.clientHeight; - var borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; - - // calculate the heights. If any of the side panels is empty, we set the height to - // minus the border width, such that the border will be invisible - props.center.height = dom.center.offsetHeight; - props.left.height = dom.left.offsetHeight; - props.right.height = dom.right.offsetHeight; - props.top.height = dom.top.clientHeight || -props.border.top; - props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; - - // TODO: compensate borders when any of the panels is empty. - - // apply auto height - // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) - var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); - var autoHeight = props.top.height + contentHeight + props.bottom.height + - borderRootHeight + props.border.top + props.border.bottom; - dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); + me.redraw(); - // calculate heights of the content panels - props.root.height = dom.root.offsetHeight; - props.background.height = props.root.height - borderRootHeight; - var containerHeight = props.root.height - props.top.height - props.bottom.height - - borderRootHeight; - props.centerContainer.height = containerHeight; - props.leftContainer.height = containerHeight; - props.rightContainer.height = props.leftContainer.height; - - // calculate the widths of the panels - props.root.width = dom.root.offsetWidth; - props.background.width = props.root.width - borderRootWidth; - props.left.width = dom.leftContainer.clientWidth || -props.border.left; - props.leftContainer.width = props.left.width; - props.right.width = dom.rightContainer.clientWidth || -props.border.right; - props.rightContainer.width = props.right.width; - var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; - props.center.width = centerWidth; - props.centerContainer.width = centerWidth; - props.top.width = centerWidth; - props.bottom.width = centerWidth; - - // resize the panels - dom.background.style.height = props.background.height + 'px'; - dom.backgroundVertical.style.height = props.background.height + 'px'; - dom.backgroundHorizontal.style.height = props.centerContainer.height + 'px'; - dom.centerContainer.style.height = props.centerContainer.height + 'px'; - dom.leftContainer.style.height = props.leftContainer.height + 'px'; - dom.rightContainer.style.height = props.rightContainer.height + 'px'; - - dom.background.style.width = props.background.width + 'px'; - dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; - dom.backgroundHorizontal.style.width = props.background.width + 'px'; - dom.centerContainer.style.width = props.center.width + 'px'; - dom.top.style.width = props.top.width + 'px'; - dom.bottom.style.width = props.bottom.width + 'px'; - - // reposition the panels - dom.background.style.left = '0'; - dom.background.style.top = '0'; - dom.backgroundVertical.style.left = props.left.width + 'px'; - dom.backgroundVertical.style.top = '0'; - dom.backgroundHorizontal.style.left = '0'; - dom.backgroundHorizontal.style.top = props.top.height + 'px'; - dom.centerContainer.style.left = props.left.width + 'px'; - dom.centerContainer.style.top = props.top.height + 'px'; - dom.leftContainer.style.left = '0'; - dom.leftContainer.style.top = props.top.height + 'px'; - dom.rightContainer.style.left = (props.left.width + props.center.width) + 'px'; - dom.rightContainer.style.top = props.top.height + 'px'; - dom.top.style.left = props.left.width + 'px'; - dom.top.style.top = '0'; - dom.bottom.style.left = props.left.width + 'px'; - dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px'; - - // update the scrollTop, feasible range for the offset can be changed - // when the height of the Timeline or of the contents of the center changed - this._updateScrollTop(); - - // reposition the scrollable contents - var offset = this.props.scrollTop; - if (options.orientation == 'bottom') { - offset += Math.max(this.props.centerContainer.height - this.props.center.height - - this.props.border.top - this.props.border.bottom, 0); - } - dom.center.style.left = '0'; - dom.center.style.top = offset + 'px'; - dom.left.style.left = '0'; - dom.left.style.top = offset + 'px'; - dom.right.style.left = '0'; - dom.right.style.top = offset + 'px'; - - // show shadows when vertical scrolling is available - var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; - var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; - dom.shadowTop.style.visibility = visibilityTop; - dom.shadowBottom.style.visibility = visibilityBottom; - dom.shadowTopLeft.style.visibility = visibilityTop; - dom.shadowBottomLeft.style.visibility = visibilityBottom; - dom.shadowTopRight.style.visibility = visibilityTop; - dom.shadowBottomRight.style.visibility = visibilityBottom; - - // redraw all components - this.components.forEach(function (component) { - resized = component.redraw() || resized; - }); - if (resized) { - // keep repainting until all sizes are settled - this.redraw(); - } -}; + // start a timer to adjust for the new time + me.currentTimeTimer = setTimeout(update, interval); + } -// TODO: deprecated since version 1.1.0, remove some day -Timeline.prototype.repaint = function () { - throw new Error('Function repaint is deprecated. Use redraw instead.'); -}; + update(); + }; -/** - * Convert a position on screen (pixels) to a datetime - * @param {int} x Position on the screen in pixels - * @return {Date} time The datetime the corresponds with given position x - * @private - */ -// TODO: move this function to Range -Timeline.prototype._toTime = function(x) { - var conversion = this.range.conversion(this.props.center.width); - return new Date(x / conversion.scale + conversion.offset); -}; + /** + * Stop auto refreshing the current time bar + */ + CurrentTime.prototype.stop = function() { + if (this.currentTimeTimer !== undefined) { + clearTimeout(this.currentTimeTimer); + delete this.currentTimeTimer; + } + }; + module.exports = CurrentTime; -/** - * Convert a position on the global screen (pixels) to a datetime - * @param {int} x Position on the screen in pixels - * @return {Date} time The datetime the corresponds with given position x - * @private - */ -// TODO: move this function to Range -Timeline.prototype._toGlobalTime = function(x) { - var conversion = this.range.conversion(this.props.root.width); - return new Date(x / conversion.scale + conversion.offset); -}; -/** - * Convert a datetime (Date object) into a position on the screen - * @param {Date} time A date - * @return {int} x The position on the screen in pixels which corresponds - * with the given date. - * @private - */ -// TODO: move this function to Range -Timeline.prototype._toScreen = function(time) { - var conversion = this.range.conversion(this.props.center.width); - return (time.valueOf() - conversion.offset) * conversion.scale; -}; +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + var Hammer = __webpack_require__(41); + var util = __webpack_require__(1); + var Component = __webpack_require__(18); -/** - * Convert a datetime (Date object) into a position on the root - * This is used to get the pixel density estimate for the screen, not the center panel - * @param {Date} time A date - * @return {int} x The position on root in pixels which corresponds - * with the given date. - * @private - */ -// TODO: move this function to Range -Timeline.prototype._toGlobalScreen = function(time) { - var conversion = this.range.conversion(this.props.root.width); - return (time.valueOf() - conversion.offset) * conversion.scale; -}; + /** + * A custom time bar + * @param {{range: Range, dom: Object}} body + * @param {Object} [options] Available parameters: + * {Boolean} [showCustomTime] + * @constructor CustomTime + * @extends Component + */ + function CustomTime (body, options) { + this.body = body; -/** - * Initialize watching when option autoResize is true - * @private - */ -Timeline.prototype._initAutoResize = function () { - if (this.options.autoResize == true) { - this._startAutoResize(); - } - else { - this._stopAutoResize(); - } -}; + // default options + this.defaultOptions = { + showCustomTime: false + }; + this.options = util.extend({}, this.defaultOptions); -/** - * Watch for changes in the size of the container. On resize, the Panel will - * automatically redraw itself. - * @private - */ -Timeline.prototype._startAutoResize = function () { - var me = this; + this.customTime = new Date(); + this.eventParams = {}; // stores state parameters while dragging the bar - this._stopAutoResize(); + // create the DOM + this._create(); - this._onResize = function() { - if (me.options.autoResize != true) { - // stop watching when the option autoResize is changed to false - me._stopAutoResize(); - return; - } + this.setOptions(options); + } - if (me.dom.root) { - // check whether the frame is resized - if ((me.dom.root.clientWidth != me.props.lastWidth) || - (me.dom.root.clientHeight != me.props.lastHeight)) { - me.props.lastWidth = me.dom.root.clientWidth; - me.props.lastHeight = me.dom.root.clientHeight; + CustomTime.prototype = new Component(); - me.emit('change'); - } + /** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {boolean} [showCustomTime] + */ + CustomTime.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['showCustomTime'], this.options, options); } }; - // add event listener to window resize - util.addEventListener(window, 'resize', this._onResize); + /** + * Create the DOM for the custom time + * @private + */ + CustomTime.prototype._create = function() { + var bar = document.createElement('div'); + bar.className = 'customtime'; + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + this.bar = bar; + + var drag = document.createElement('div'); + drag.style.position = 'relative'; + drag.style.top = '0px'; + drag.style.left = '-10px'; + drag.style.height = '100%'; + drag.style.width = '20px'; + bar.appendChild(drag); + + // attach event listeners + this.hammer = Hammer(bar, { + prevent_default: true + }); + this.hammer.on('dragstart', this._onDragStart.bind(this)); + this.hammer.on('drag', this._onDrag.bind(this)); + this.hammer.on('dragend', this._onDragEnd.bind(this)); + }; - this.watchTimer = setInterval(this._onResize, 1000); -}; + /** + * Destroy the CustomTime bar + */ + CustomTime.prototype.destroy = function () { + this.options.showCustomTime = false; + this.redraw(); // will remove the bar from the DOM -/** - * Stop watching for a resize of the frame. - * @private - */ -Timeline.prototype._stopAutoResize = function () { - if (this.watchTimer) { - clearInterval(this.watchTimer); - this.watchTimer = undefined; - } + this.hammer.enable(false); + this.hammer = null; - // remove event listener on window.resize - util.removeEventListener(window, 'resize', this._onResize); - this._onResize = null; -}; + this.body = null; + }; -/** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ -Timeline.prototype._onTouch = function (event) { - this.touch.allowDragging = true; -}; + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + CustomTime.prototype.redraw = function () { + if (this.options.showCustomTime) { + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); + } -/** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ -Timeline.prototype._onPinch = function (event) { - this.touch.allowDragging = false; -}; + var x = this.body.util.toScreen(this.customTime); -/** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ -Timeline.prototype._onDragStart = function (event) { - this.touch.initialScrollTop = this.props.scrollTop; -}; + this.bar.style.left = x + 'px'; + this.bar.title = 'Time: ' + this.customTime; + } + else { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + } -/** - * Move the timeline vertically - * @param {Event} event - * @private - */ -Timeline.prototype._onDrag = function (event) { - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.touch.allowDragging) return; + return false; + }; - var delta = event.gesture.deltaY; + /** + * Set custom time. + * @param {Date} time + */ + CustomTime.prototype.setCustomTime = function(time) { + this.customTime = new Date(time.valueOf()); + this.redraw(); + }; - var oldScrollTop = this._getScrollTop(); - var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); + /** + * Retrieve the current custom time. + * @return {Date} customTime + */ + CustomTime.prototype.getCustomTime = function() { + return new Date(this.customTime.valueOf()); + }; - if (newScrollTop != oldScrollTop) { - this.redraw(); // TODO: this causes two redraws when dragging, the other is triggered by rangechange already - } -}; + /** + * Start moving horizontally + * @param {Event} event + * @private + */ + CustomTime.prototype._onDragStart = function(event) { + this.eventParams.dragging = true; + this.eventParams.customTime = this.customTime; -/** - * Apply a scrollTop - * @param {Number} scrollTop - * @returns {Number} scrollTop Returns the applied scrollTop - * @private - */ -Timeline.prototype._setScrollTop = function (scrollTop) { - this.props.scrollTop = scrollTop; - this._updateScrollTop(); - return this.props.scrollTop; -}; + event.stopPropagation(); + event.preventDefault(); + }; -/** - * Update the current scrollTop when the height of the containers has been changed - * @returns {Number} scrollTop Returns the applied scrollTop - * @private - */ -Timeline.prototype._updateScrollTop = function () { - // recalculate the scrollTopMin - var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero - if (scrollTopMin != this.props.scrollTopMin) { - // in case of bottom orientation, change the scrollTop such that the contents - // do not move relative to the time axis at the bottom - if (this.options.orientation == 'bottom') { - this.props.scrollTop += (scrollTopMin - this.props.scrollTopMin); - } - this.props.scrollTopMin = scrollTopMin; - } + /** + * Perform moving operating. + * @param {Event} event + * @private + */ + CustomTime.prototype._onDrag = function (event) { + if (!this.eventParams.dragging) return; - // limit the scrollTop to the feasible scroll range - if (this.props.scrollTop > 0) this.props.scrollTop = 0; - if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; + var deltaX = event.gesture.deltaX, + x = this.body.util.toScreen(this.eventParams.customTime) + deltaX, + time = this.body.util.toTime(x); - return this.props.scrollTop; -}; + this.setCustomTime(time); -/** - * Get the current scrollTop - * @returns {number} scrollTop - * @private - */ -Timeline.prototype._getScrollTop = function () { - return this.props.scrollTop; -}; + // fire a timechange event + this.body.emitter.emit('timechange', { + time: new Date(this.customTime.valueOf()) + }); -/** - * Create a timeline visualization - * @param {HTMLElement} container - * @param {vis.DataSet | Array | google.visualization.DataTable} [items] - * @param {Object} [options] See Graph2d.setOptions for the available options. - * @constructor - */ -function Graph2d (container, items, options, groups) { - var me = this; - this.defaultOptions = { - start: null, - end: null, - - autoResize: true, - - orientation: 'bottom', - width: null, - height: null, - maxHeight: null, - minHeight: null - }; - this.options = util.deepExtend({}, this.defaultOptions); - - // Create the DOM, props, and emitter - this._create(container); - - // all components listed here will be repainted automatically - this.components = []; - - this.body = { - dom: this.dom, - domProps: this.props, - emitter: { - on: this.on.bind(this), - off: this.off.bind(this), - emit: this.emit.bind(this) - }, - util: { - snap: null, // will be specified after TimeAxis is created - toScreen: me._toScreen.bind(me), - toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width - toTime: me._toTime.bind(me), - toGlobalTime : me._toGlobalTime.bind(me) - } - }; - - // range - this.range = new Range(this.body); - this.components.push(this.range); - this.body.range = this.range; - - // time axis - this.timeAxis = new TimeAxis(this.body); - this.components.push(this.timeAxis); - this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); - - // current time bar - this.currentTime = new CurrentTime(this.body); - this.components.push(this.currentTime); - - // custom time bar - // Note: time bar will be attached in this.setOptions when selected - this.customTime = new CustomTime(this.body); - this.components.push(this.customTime); - - // item set - this.linegraph = new LineGraph(this.body); - this.components.push(this.linegraph); - - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet - - // apply options - if (options) { - this.setOptions(options); - } + event.stopPropagation(); + event.preventDefault(); + }; - // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! - if (groups) { - this.setGroups(groups); - } + /** + * Stop moving operating. + * @param {event} event + * @private + */ + CustomTime.prototype._onDragEnd = function (event) { + if (!this.eventParams.dragging) return; - // create itemset - if (items) { - this.setItems(items); - } - else { - this.redraw(); - } -} + // fire a timechanged event + this.body.emitter.emit('timechanged', { + time: new Date(this.customTime.valueOf()) + }); -// turn Graph2d into an event emitter -Emitter(Graph2d.prototype); + event.stopPropagation(); + event.preventDefault(); + }; -/** - * Create the main DOM for the Graph2d: a root panel containing left, right, - * top, bottom, content, and background panel. - * @param {Element} container The container element where the Graph2d will - * be attached. - * @private - */ -Graph2d.prototype._create = function (container) { - this.dom = {}; - - this.dom.root = document.createElement('div'); - this.dom.background = document.createElement('div'); - this.dom.backgroundVertical = document.createElement('div'); - this.dom.backgroundHorizontalContainer = document.createElement('div'); - this.dom.centerContainer = document.createElement('div'); - this.dom.leftContainer = document.createElement('div'); - this.dom.rightContainer = document.createElement('div'); - this.dom.backgroundHorizontal = document.createElement('div'); - this.dom.center = document.createElement('div'); - this.dom.left = document.createElement('div'); - this.dom.right = document.createElement('div'); - this.dom.top = document.createElement('div'); - this.dom.bottom = document.createElement('div'); - this.dom.shadowTop = document.createElement('div'); - this.dom.shadowBottom = document.createElement('div'); - this.dom.shadowTopLeft = document.createElement('div'); - this.dom.shadowBottomLeft = document.createElement('div'); - this.dom.shadowTopRight = document.createElement('div'); - this.dom.shadowBottomRight = document.createElement('div'); - - this.dom.background.className = 'vispanel background'; - this.dom.backgroundVertical.className = 'vispanel background vertical'; - this.dom.backgroundHorizontalContainer.className = 'vispanel background horizontal'; - this.dom.backgroundHorizontal.className = 'vispanel background horizontal'; - this.dom.centerContainer.className = 'vispanel center'; - this.dom.leftContainer.className = 'vispanel left'; - this.dom.rightContainer.className = 'vispanel right'; - this.dom.top.className = 'vispanel top'; - this.dom.bottom.className = 'vispanel bottom'; - this.dom.left.className = 'content'; - this.dom.center.className = 'content'; - this.dom.right.className = 'content'; - this.dom.shadowTop.className = 'shadow top'; - this.dom.shadowBottom.className = 'shadow bottom'; - this.dom.shadowTopLeft.className = 'shadow top'; - this.dom.shadowBottomLeft.className = 'shadow bottom'; - this.dom.shadowTopRight.className = 'shadow top'; - this.dom.shadowBottomRight.className = 'shadow bottom'; - - this.dom.root.appendChild(this.dom.background); - this.dom.root.appendChild(this.dom.backgroundVertical); - this.dom.root.appendChild(this.dom.backgroundHorizontalContainer); - this.dom.root.appendChild(this.dom.centerContainer); - this.dom.root.appendChild(this.dom.leftContainer); - this.dom.root.appendChild(this.dom.rightContainer); - this.dom.root.appendChild(this.dom.top); - this.dom.root.appendChild(this.dom.bottom); - - this.dom.backgroundHorizontalContainer.appendChild(this.dom.backgroundHorizontal); - this.dom.centerContainer.appendChild(this.dom.center); - this.dom.leftContainer.appendChild(this.dom.left); - this.dom.rightContainer.appendChild(this.dom.right); - - this.dom.centerContainer.appendChild(this.dom.shadowTop); - this.dom.centerContainer.appendChild(this.dom.shadowBottom); - this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); - this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); - this.dom.rightContainer.appendChild(this.dom.shadowTopRight); - this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); - - this.on('rangechange', this.redraw.bind(this)); - this.on('change', this.redraw.bind(this)); - this.on('touch', this._onTouch.bind(this)); - this.on('pinch', this._onPinch.bind(this)); - this.on('dragstart', this._onDragStart.bind(this)); - this.on('drag', this._onDrag.bind(this)); - - // create event listeners for all interesting events, these events will be - // emitted via emitter - this.hammer = Hammer(this.dom.root, { - prevent_default: true - }); - this.listeners = {}; - - var me = this; - var events = [ - 'touch', 'pinch', - 'tap', 'doubletap', 'hold', - 'dragstart', 'drag', 'dragend', - 'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox - ]; - events.forEach(function (event) { - var listener = function () { - var args = [event].concat(Array.prototype.slice.call(arguments, 0)); - me.emit.apply(me, args); - }; - me.hammer.on(event, listener); - me.listeners[event] = listener; - }); - - // size properties of each of the panels - this.props = { - root: {}, - background: {}, - centerContainer: {}, - leftContainer: {}, - rightContainer: {}, - center: {}, - left: {}, - right: {}, - top: {}, - bottom: {}, - border: {}, - scrollTop: 0, - scrollTopMin: 0 - }; - this.touch = {}; // store state information needed for touch events - - // attach the root panel to the provided container - if (!container) throw new Error('No container provided'); - container.appendChild(this.dom.root); -}; + module.exports = CustomTime; -/** - * Destroy the Graph2d, clean up all DOM elements and event listeners. - */ -Graph2d.prototype.destroy = function () { - // unbind datasets - this.clear(); - // remove all event listeners - this.off(); +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { - // stop checking for changed size - this._stopAutoResize(); + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(2); + var Component = __webpack_require__(18); + var DataStep = __webpack_require__(14); - // remove from DOM - if (this.dom.root.parentNode) { - this.dom.root.parentNode.removeChild(this.dom.root); - } - this.dom = null; + /** + * A horizontal time axis + * @param {Object} [options] See DataAxis.setOptions for the available + * options. + * @constructor DataAxis + * @extends Component + * @param body + */ + function DataAxis (body, options, svg) { + this.id = util.randomUUID(); + this.body = body; - // cleanup hammer touch events - for (var event in this.listeners) { - if (this.listeners.hasOwnProperty(event)) { - delete this.listeners[event]; - } - } - this.listeners = null; - this.hammer = null; + this.defaultOptions = { + orientation: 'left', // supported: 'left', 'right' + showMinorLabels: true, + showMajorLabels: true, + icons: true, + majorLinesOffset: 7, + minorLinesOffset: 4, + labelOffsetX: 10, + labelOffsetY: 2, + iconWidth: 20, + width: '40px', + visible: true + }; - // give all components the opportunity to cleanup - this.components.forEach(function (component) { - component.destroy(); - }); + this.linegraphSVG = svg; + this.props = {}; + this.DOMelements = { // dynamic elements + lines: {}, + labels: {} + }; - this.body = null; -}; + this.dom = {}; -/** - * Set options. Options will be passed to all components loaded in the Graph2d. - * @param {Object} [options] - * {String} orientation - * Vertical orientation for the Graph2d, - * can be 'bottom' (default) or 'top'. - * {String | Number} width - * Width for the timeline, a number in pixels or - * a css string like '1000px' or '75%'. '100%' by default. - * {String | Number} height - * Fixed height for the Graph2d, a number in pixels or - * a css string like '400px' or '75%'. If undefined, - * The Graph2d will automatically size such that - * its contents fit. - * {String | Number} minHeight - * Minimum height for the Graph2d, a number in pixels or - * a css string like '400px' or '75%'. - * {String | Number} maxHeight - * Maximum height for the Graph2d, a number in pixels or - * a css string like '400px' or '75%'. - * {Number | Date | String} start - * Start date for the visible window - * {Number | Date | String} end - * End date for the visible window - */ -Graph2d.prototype.setOptions = function (options) { - if (options) { - // copy the known options - var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation']; - util.selectiveExtend(fields, this.options, options); - - // enable/disable autoResize - this._initAutoResize(); - } + this.range = {start:0, end:0}; - // propagate options to all components - this.components.forEach(function (component) { - component.setOptions(options); - }); + this.options = util.extend({}, this.defaultOptions); + this.conversionFactor = 1; - // TODO: remove deprecation error one day (deprecated since version 0.8.0) - if (options && options.order) { - throw new Error('Option order is deprecated. There is no replacement for this feature.'); - } + this.setOptions(options); + this.width = Number(('' + this.options.width).replace("px","")); + this.minWidth = this.width; + this.height = this.linegraphSVG.offsetHeight; - // redraw everything - this.redraw(); -}; + this.stepPixels = 25; + this.stepPixelsForced = 25; + this.lineOffset = 0; + this.master = true; + this.svgElements = {}; -/** - * Set a custom time bar - * @param {Date} time - */ -Graph2d.prototype.setCustomTime = function (time) { - if (!this.customTime) { - throw new Error('Cannot get custom time: Custom time bar is not enabled'); - } - this.customTime.setCustomTime(time); -}; + this.groups = {}; + this.amountOfGroups = 0; -/** - * Retrieve the current custom time. - * @return {Date} customTime - */ -Graph2d.prototype.getCustomTime = function() { - if (!this.customTime) { - throw new Error('Cannot get custom time: Custom time bar is not enabled'); + // create the HTML DOM + this._create(); } - return this.customTime.getCustomTime(); -}; + DataAxis.prototype = new Component(); -/** - * Set items - * @param {vis.DataSet | Array | google.visualization.DataTable | null} items - */ -Graph2d.prototype.setItems = function(items) { - var initialLoad = (this.itemsData == null); - - // convert to type DataSet when needed - var newDataSet; - if (!items) { - newDataSet = null; - } - else if (items instanceof DataSet || items instanceof DataView) { - newDataSet = items; - } - else { - // turn an array into a dataset - newDataSet = new DataSet(items, { - type: { - start: 'Date', - end: 'Date' - } - }); - } - // set items - this.itemsData = newDataSet; - this.linegraph && this.linegraph.setItems(newDataSet); - if (initialLoad && ('start' in this.options || 'end' in this.options)) { - this.fit(); + DataAxis.prototype.addGroup = function(label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; + }; - var start = ('start' in this.options) ? util.convert(this.options.start, 'Date') : null; - var end = ('end' in this.options) ? util.convert(this.options.end, 'Date') : null; + DataAxis.prototype.updateGroup = function(label, graphOptions) { + this.groups[label] = graphOptions; + }; - this.setWindow(start, end); - } -}; + DataAxis.prototype.removeGroup = function(label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } + }; -/** - * Set groups - * @param {vis.DataSet | Array | google.visualization.DataTable} groups - */ -Graph2d.prototype.setGroups = function(groups) { - // convert to type DataSet when needed - var newDataSet; - if (!groups) { - newDataSet = null; - } - else if (groups instanceof DataSet || groups instanceof DataView) { - newDataSet = groups; - } - else { - // turn an array into a dataset - newDataSet = new DataSet(groups); - } - this.groupsData = newDataSet; - this.linegraph.setGroups(newDataSet); -}; + DataAxis.prototype.setOptions = function (options) { + if (options) { + var redraw = false; + if (this.options.orientation != options.orientation && options.orientation !== undefined) { + redraw = true; + } + var fields = [ + 'orientation', + 'showMinorLabels', + 'showMajorLabels', + 'icons', + 'majorLinesOffset', + 'minorLinesOffset', + 'labelOffsetX', + 'labelOffsetY', + 'iconWidth', + 'width', + 'visible']; + util.selectiveExtend(fields, this.options, options); -/** - * Clear the Graph2d. By Default, items, groups and options are cleared. - * Example usage: - * - * timeline.clear(); // clear items, groups, and options - * timeline.clear({options: true}); // clear options only - * - * @param {Object} [what] Optionally specify what to clear. By default: - * {items: true, groups: true, options: true} - */ -Graph2d.prototype.clear = function(what) { - // clear items - if (!what || what.items) { - this.setItems(null); - } + this.minWidth = Number(('' + this.options.width).replace("px","")); - // clear groups - if (!what || what.groups) { - this.setGroups(null); - } + if (redraw == true && this.dom.frame) { + this.hide(); + this.show(); + } + } + }; - // clear options of timeline and of each of the components - if (!what || what.options) { - this.components.forEach(function (component) { - component.setOptions(component.defaultOptions); - }); - this.setOptions(this.defaultOptions); // this will also do a redraw - } -}; + /** + * Create the HTML DOM for the DataAxis + */ + DataAxis.prototype._create = function() { + this.dom.frame = document.createElement('div'); + this.dom.frame.style.width = this.options.width; + this.dom.frame.style.height = this.height; + + this.dom.lineContainer = document.createElement('div'); + this.dom.lineContainer.style.width = '100%'; + this.dom.lineContainer.style.height = this.height; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); + this.svg.style.position = "absolute"; + this.svg.style.top = '0px'; + this.svg.style.height = '100%'; + this.svg.style.width = '100%'; + this.svg.style.display = "block"; + this.dom.frame.appendChild(this.svg); + }; -/** - * Set Graph2d window such that it fits all items - */ -Graph2d.prototype.fit = function() { - // apply the data range as range - var dataRange = this.getItemRange(); - - // add 5% space on both sides - var start = dataRange.min; - var end = dataRange.max; - if (start != null && end != null) { - var interval = (end.valueOf() - start.valueOf()); - if (interval <= 0) { - // prevent an empty interval - interval = 24 * 60 * 60 * 1000; // 1 day - } - start = new Date(start.valueOf() - interval * 0.05); - end = new Date(end.valueOf() + interval * 0.05); - } + DataAxis.prototype._redrawGroupIcons = function () { + DOMutil.prepareElements(this.svgElements); - // skip range set if there is no start and end date - if (start === null && end === null) { - return; - } + var x; + var iconWidth = this.options.iconWidth; + var iconHeight = 15; + var iconOffset = 4; + var y = iconOffset + 0.5 * iconHeight; - this.range.setRange(start, end); -}; + if (this.options.orientation == 'left') { + x = iconOffset; + } + else { + x = this.width - iconWidth - iconOffset; + } -/** - * Get the data range of the item set. - * @returns {{min: Date, max: Date}} range A range with a start and end Date. - * When no minimum is found, min==null - * When no maximum is found, max==null - */ -Graph2d.prototype.getItemRange = function() { - // calculate min from start filed - var itemsData = this.itemsData, - min = null, - max = null; - - if (itemsData) { - // calculate the minimum value of the field 'start' - var minItem = itemsData.min('start'); - min = minItem ? util.convert(minItem.start, 'Date').valueOf() : null; - // Note: we convert first to Date and then to number because else - // a conversion from ISODate to Number will fail - - // calculate maximum value of fields 'start' and 'end' - var maxStartItem = itemsData.max('start'); - if (maxStartItem) { - max = util.convert(maxStartItem.start, 'Date').valueOf(); - } - var maxEndItem = itemsData.max('end'); - if (maxEndItem) { - if (max == null) { - max = util.convert(maxEndItem.end, 'Date').valueOf(); - } - else { - max = Math.max(max, util.convert(maxEndItem.end, 'Date').valueOf()); + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight); + y += iconHeight + iconOffset; } } - } - return { - min: (min != null) ? new Date(min) : null, - max: (max != null) ? new Date(max) : null + DOMutil.cleanupElements(this.svgElements); }; -}; -/** - * Set the visible window. Both parameters are optional, you can change only - * start or only end. Syntax: - * - * TimeLine.setWindow(start, end) - * TimeLine.setWindow(range) - * - * Where start and end can be a Date, number, or string, and range is an - * object with properties start and end. - * - * @param {Date | Number | String | Object} [start] Start date of visible window - * @param {Date | Number | String} [end] End date of visible window - */ -Graph2d.prototype.setWindow = function(start, end) { - if (arguments.length == 1) { - var range = arguments[0]; - this.range.setRange(range.start, range.end); - } - else { - this.range.setRange(start, end); - } -}; + /** + * Create the HTML DOM for the DataAxis + */ + DataAxis.prototype.show = function() { + if (!this.dom.frame.parentNode) { + if (this.options.orientation == 'left') { + this.body.dom.left.appendChild(this.dom.frame); + } + else { + this.body.dom.right.appendChild(this.dom.frame); + } + } -/** - * Get the visible window - * @return {{start: Date, end: Date}} Visible range - */ -Graph2d.prototype.getWindow = function() { - var range = this.range.getRange(); - return { - start: new Date(range.start), - end: new Date(range.end) + if (!this.dom.lineContainer.parentNode) { + this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer); + } }; -}; -/** - * Force a redraw of the Graph2d. Can be useful to manually redraw when - * option autoResize=false - */ -Graph2d.prototype.redraw = function() { - var resized = false, - options = this.options, - props = this.props, - dom = this.dom; - - if (!dom) return; // when destroyed - - // update class names - dom.root.className = 'vis timeline root ' + options.orientation; - - // update root width and height options - dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); - dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); - dom.root.style.width = util.option.asSize(options.width, ''); - - // calculate border widths - props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; - props.border.right = props.border.left; - props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; - props.border.bottom = props.border.top; - var borderRootHeight= dom.root.offsetHeight - dom.root.clientHeight; - var borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; - - // calculate the heights. If any of the side panels is empty, we set the height to - // minus the border width, such that the border will be invisible - props.center.height = dom.center.offsetHeight; - props.left.height = dom.left.offsetHeight; - props.right.height = dom.right.offsetHeight; - props.top.height = dom.top.clientHeight || -props.border.top; - props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; - - // TODO: compensate borders when any of the panels is empty. - - // apply auto height - // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) - var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); - var autoHeight = props.top.height + contentHeight + props.bottom.height + - borderRootHeight + props.border.top + props.border.bottom; - dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); - - // calculate heights of the content panels - props.root.height = dom.root.offsetHeight; - props.background.height = props.root.height - borderRootHeight; - var containerHeight = props.root.height - props.top.height - props.bottom.height - - borderRootHeight; - props.centerContainer.height = containerHeight; - props.leftContainer.height = containerHeight; - props.rightContainer.height = props.leftContainer.height; - - // calculate the widths of the panels - props.root.width = dom.root.offsetWidth; - props.background.width = props.root.width - borderRootWidth; - props.left.width = dom.leftContainer.clientWidth || -props.border.left; - props.leftContainer.width = props.left.width; - props.right.width = dom.rightContainer.clientWidth || -props.border.right; - props.rightContainer.width = props.right.width; - var centerWidth = props.root.width - props.left.width - props.right.width - borderRootWidth; - props.center.width = centerWidth; - props.centerContainer.width = centerWidth; - props.top.width = centerWidth; - props.bottom.width = centerWidth; - - // resize the panels - dom.background.style.height = props.background.height + 'px'; - dom.backgroundVertical.style.height = props.background.height + 'px'; - dom.backgroundHorizontalContainer.style.height = props.centerContainer.height + 'px'; - dom.centerContainer.style.height = props.centerContainer.height + 'px'; - dom.leftContainer.style.height = props.leftContainer.height + 'px'; - dom.rightContainer.style.height = props.rightContainer.height + 'px'; - - dom.background.style.width = props.background.width + 'px'; - dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; - dom.backgroundHorizontalContainer.style.width = props.background.width + 'px'; - dom.backgroundHorizontal.style.width = props.background.width + 'px'; - dom.centerContainer.style.width = props.center.width + 'px'; - dom.top.style.width = props.top.width + 'px'; - dom.bottom.style.width = props.bottom.width + 'px'; - - // reposition the panels - dom.background.style.left = '0'; - dom.background.style.top = '0'; - dom.backgroundVertical.style.left = props.left.width + 'px'; - dom.backgroundVertical.style.top = '0'; - dom.backgroundHorizontalContainer.style.left = '0'; - dom.backgroundHorizontalContainer.style.top = props.top.height + 'px'; - dom.centerContainer.style.left = props.left.width + 'px'; - dom.centerContainer.style.top = props.top.height + 'px'; - dom.leftContainer.style.left = '0'; - dom.leftContainer.style.top = props.top.height + 'px'; - dom.rightContainer.style.left = (props.left.width + props.center.width) + 'px'; - dom.rightContainer.style.top = props.top.height + 'px'; - dom.top.style.left = props.left.width + 'px'; - dom.top.style.top = '0'; - dom.bottom.style.left = props.left.width + 'px'; - dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px'; - - // update the scrollTop, feasible range for the offset can be changed - // when the height of the Graph2d or of the contents of the center changed - this._updateScrollTop(); - - // reposition the scrollable contents - var offset = this.props.scrollTop; - if (options.orientation == 'bottom') { - offset += Math.max(this.props.centerContainer.height - this.props.center.height - - this.props.border.top - this.props.border.bottom, 0); - } - dom.center.style.left = '0'; - dom.center.style.top = offset + 'px'; - dom.backgroundHorizontal.style.left = '0'; - dom.backgroundHorizontal.style.top = offset + 'px'; - dom.left.style.left = '0'; - dom.left.style.top = offset + 'px'; - dom.right.style.left = '0'; - dom.right.style.top = offset + 'px'; - - // show shadows when vertical scrolling is available - var visibilityTop = this.props.scrollTop == 0 ? 'hidden' : ''; - var visibilityBottom = this.props.scrollTop == this.props.scrollTopMin ? 'hidden' : ''; - dom.shadowTop.style.visibility = visibilityTop; - dom.shadowBottom.style.visibility = visibilityBottom; - dom.shadowTopLeft.style.visibility = visibilityTop; - dom.shadowBottomLeft.style.visibility = visibilityBottom; - dom.shadowTopRight.style.visibility = visibilityTop; - dom.shadowBottomRight.style.visibility = visibilityBottom; - - // redraw all components - this.components.forEach(function (component) { - resized = component.redraw() || resized; - }); - if (resized) { - // keep redrawing until all sizes are settled - this.redraw(); - } -}; + /** + * Create the HTML DOM for the DataAxis + */ + DataAxis.prototype.hide = function() { + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } -/** - * Convert a position on screen (pixels) to a datetime - * @param {int} x Position on the screen in pixels - * @return {Date} time The datetime the corresponds with given position x - * @private - */ -// TODO: move this function to Range -Graph2d.prototype._toTime = function(x) { - var conversion = this.range.conversion(this.props.center.width); - return new Date(x / conversion.scale + conversion.offset); -}; + if (this.dom.lineContainer.parentNode) { + this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer); + } + }; -/** - * Convert a datetime (Date object) into a position on the root - * This is used to get the pixel density estimate for the screen, not the center panel - * @param {Date} time A date - * @return {int} x The position on root in pixels which corresponds - * with the given date. - * @private - */ -// TODO: move this function to Range -Graph2d.prototype._toGlobalTime = function(x) { - var conversion = this.range.conversion(this.props.root.width); - return new Date(x / conversion.scale + conversion.offset); -}; + /** + * Set a range (start and end) + * @param end + * @param start + * @param end + */ + DataAxis.prototype.setRange = function (start, end) { + this.range.start = start; + this.range.end = end; + }; -/** - * Convert a datetime (Date object) into a position on the screen - * @param {Date} time A date - * @return {int} x The position on the screen in pixels which corresponds - * with the given date. - * @private - */ -// TODO: move this function to Range -Graph2d.prototype._toScreen = function(time) { - var conversion = this.range.conversion(this.props.center.width); - return (time.valueOf() - conversion.offset) * conversion.scale; -}; + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + DataAxis.prototype.redraw = function () { + var changeCalled = false; + if (this.amountOfGroups == 0) { + this.hide(); + } + else { + this.show(); + this.height = Number(this.linegraphSVG.style.height.replace("px","")); + // svg offsetheight did not work in firefox and explorer... + this.dom.lineContainer.style.height = this.height + 'px'; + this.width = this.options.visible == true ? Number(('' + this.options.width).replace("px","")) : 0; -/** - * Convert a datetime (Date object) into a position on the root - * This is used to get the pixel density estimate for the screen, not the center panel - * @param {Date} time A date - * @return {int} x The position on root in pixels which corresponds - * with the given date. - * @private - */ -// TODO: move this function to Range -Graph2d.prototype._toGlobalScreen = function(time) { - var conversion = this.range.conversion(this.props.root.width); - return (time.valueOf() - conversion.offset) * conversion.scale; -}; + var props = this.props; + var frame = this.dom.frame; -/** - * Initialize watching when option autoResize is true - * @private - */ -Graph2d.prototype._initAutoResize = function () { - if (this.options.autoResize == true) { - this._startAutoResize(); - } - else { - this._stopAutoResize(); - } -}; + // update classname + frame.className = 'dataaxis'; -/** - * Watch for changes in the size of the container. On resize, the Panel will - * automatically redraw itself. - * @private - */ -Graph2d.prototype._startAutoResize = function () { - var me = this; + // calculate character width and height + this._calculateCharSize(); - this._stopAutoResize(); + var orientation = this.options.orientation; + var showMinorLabels = this.options.showMinorLabels; + var showMajorLabels = this.options.showMajorLabels; - this._onResize = function() { - if (me.options.autoResize != true) { - // stop watching when the option autoResize is changed to false - me._stopAutoResize(); - return; - } + // determine the width and height of the elemens for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; - if (me.dom.root) { - // check whether the frame is resized - if ((me.dom.root.clientWidth != me.props.lastWidth) || - (me.dom.root.clientHeight != me.props.lastHeight)) { - me.props.lastWidth = me.dom.root.clientWidth; - me.props.lastHeight = me.dom.root.clientHeight; + props.minorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.minorLinesOffset; + props.minorLineHeight = 1; + props.majorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.majorLinesOffset; + props.majorLineHeight = 1; - me.emit('change'); + // take frame offline while updating (is almost twice as fast) + if (orientation == 'left') { + frame.style.top = '0'; + frame.style.left = '0'; + frame.style.bottom = ''; + frame.style.width = this.width + 'px'; + frame.style.height = this.height + "px"; + } + else { // right + frame.style.top = ''; + frame.style.bottom = '0'; + frame.style.left = '0'; + frame.style.width = this.width + 'px'; + frame.style.height = this.height + "px"; + } + changeCalled = this._redrawLabels(); + if (this.options.icons == true) { + this._redrawGroupIcons(); } } + return changeCalled; }; - // add event listener to window resize - util.addEventListener(window, 'resize', this._onResize); + /** + * Repaint major and minor text labels and vertical grid lines + * @private + */ + DataAxis.prototype._redrawLabels = function () { + DOMutil.prepareElements(this.DOMelements); - this.watchTimer = setInterval(this._onResize, 1000); -}; + var orientation = this.options['orientation']; -/** - * Stop watching for a resize of the frame. - * @private - */ -Graph2d.prototype._stopAutoResize = function () { - if (this.watchTimer) { - clearInterval(this.watchTimer); - this.watchTimer = undefined; - } + // calculate range and step (step such that we have space for 7 characters per label) + var minimumStep = this.master ? this.props.majorCharHeight || 10 : this.stepPixelsForced; + var step = new DataStep(this.range.start, this.range.end, minimumStep, this.dom.frame.offsetHeight); + this.step = step; + step.first(); - // remove event listener on window.resize - util.removeEventListener(window, 'resize', this._onResize); - this._onResize = null; -}; + // get the distance in pixels for a step + var stepPixels = this.dom.frame.offsetHeight / ((step.marginRange / step.step) + 1); + this.stepPixels = stepPixels; -/** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ -Graph2d.prototype._onTouch = function (event) { - this.touch.allowDragging = true; -}; + var amountOfSteps = this.height / stepPixels; + var stepDifference = 0; -/** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ -Graph2d.prototype._onPinch = function (event) { - this.touch.allowDragging = false; -}; + if (this.master == false) { + stepPixels = this.stepPixelsForced; + stepDifference = Math.round((this.height / stepPixels) - amountOfSteps); + for (var i = 0; i < 0.5 * stepDifference; i++) { + step.previous(); + } + amountOfSteps = this.height / stepPixels; + } -/** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ -Graph2d.prototype._onDragStart = function (event) { - this.touch.initialScrollTop = this.props.scrollTop; -}; -/** - * Move the timeline vertically - * @param {Event} event - * @private - */ -Graph2d.prototype._onDrag = function (event) { - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.touch.allowDragging) return; + this.valueAtZero = step.marginEnd; + var marginStartPos = 0; - var delta = event.gesture.deltaY; + // do not draw the first label + var max = 1; + step.next(); - var oldScrollTop = this._getScrollTop(); - var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); + this.maxLabelSize = 0; + var y = 0; + while (max < Math.round(amountOfSteps)) { - if (newScrollTop != oldScrollTop) { - this.redraw(); // TODO: this causes two redraws when dragging, the other is triggered by rangechange already - } -}; + y = Math.round(max * stepPixels); + marginStartPos = max * stepPixels; + var isMajor = step.isMajor(); -/** - * Apply a scrollTop - * @param {Number} scrollTop - * @returns {Number} scrollTop Returns the applied scrollTop - * @private - */ -Graph2d.prototype._setScrollTop = function (scrollTop) { - this.props.scrollTop = scrollTop; - this._updateScrollTop(); - return this.props.scrollTop; -}; + if (this.options['showMinorLabels'] && isMajor == false || this.master == false && this.options['showMinorLabels'] == true) { + this._redrawLabel(y - 2, step.getCurrent(), orientation, 'yAxis minor', this.props.minorCharHeight); + } -/** - * Update the current scrollTop when the height of the containers has been changed - * @returns {Number} scrollTop Returns the applied scrollTop - * @private - */ -Graph2d.prototype._updateScrollTop = function () { - // recalculate the scrollTopMin - var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero - if (scrollTopMin != this.props.scrollTopMin) { - // in case of bottom orientation, change the scrollTop such that the contents - // do not move relative to the time axis at the bottom - if (this.options.orientation == 'bottom') { - this.props.scrollTop += (scrollTopMin - this.props.scrollTopMin); - } - this.props.scrollTopMin = scrollTopMin; - } + if (isMajor && this.options['showMajorLabels'] && this.master == true || + this.options['showMinorLabels'] == false && this.master == false && isMajor == true) { - // limit the scrollTop to the feasible scroll range - if (this.props.scrollTop > 0) this.props.scrollTop = 0; - if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; + if (y >= 0) { + this._redrawLabel(y - 2, step.getCurrent(), orientation, 'yAxis major', this.props.majorCharHeight); + } + this._redrawLine(y, orientation, 'grid horizontal major', this.options.majorLinesOffset, this.props.majorLineWidth); + } + else { + this._redrawLine(y, orientation, 'grid horizontal minor', this.options.minorLinesOffset, this.props.minorLineWidth); + } - return this.props.scrollTop; -}; + step.next(); + max++; + } -/** - * Get the current scrollTop - * @returns {number} scrollTop - * @private - */ -Graph2d.prototype._getScrollTop = function () { - return this.props.scrollTop; -}; + this.conversionFactor = marginStartPos/((amountOfSteps-1) * step.step); + + var offset = this.options.icons == true ? this.options.iconWidth + this.options.labelOffsetX + 15 : this.options.labelOffsetX + 15; + // this will resize the yAxis to accomodate the labels. + if (this.maxLabelSize > (this.width - offset) && this.options.visible == true) { + this.width = this.maxLabelSize + offset; + this.options.width = this.width + "px"; + DOMutil.cleanupElements(this.DOMelements); + this.redraw(); + return true; + } + // this will resize the yAxis if it is too big for the labels. + else if (this.maxLabelSize < (this.width - offset) && this.options.visible == true && this.width > this.minWidth) { + this.width = Math.max(this.minWidth,this.maxLabelSize + offset); + this.options.width = this.width + "px"; + DOMutil.cleanupElements(this.DOMelements); + this.redraw(); + return true; + } + else { + DOMutil.cleanupElements(this.DOMelements); + return false; + } + }; -(function(exports) { /** - * Parse a text source containing data in DOT language into a JSON object. - * The object contains two lists: one with nodes and one with edges. - * - * DOT language reference: http://www.graphviz.org/doc/info/lang.html - * - * @param {String} data Text containing a graph in DOT-notation - * @return {Object} graph An object containing two parameters: - * {Object[]} nodes - * {Object[]} edges + * Create a label for the axis at position x + * @private + * @param y + * @param text + * @param orientation + * @param className + * @param characterHeight */ - function parseDOT (data) { - dot = data; - return parseGraph(); - } + DataAxis.prototype._redrawLabel = function (y, text, orientation, className, characterHeight) { + // reuse redundant label + var label = DOMutil.getDOMElement('div',this.DOMelements, this.dom.frame); //this.dom.redundant.labels.shift(); + label.className = className; + label.innerHTML = text; - // token types enumeration - var TOKENTYPE = { - NULL : 0, - DELIMITER : 1, - IDENTIFIER: 2, - UNKNOWN : 3 - }; + if (orientation == 'left') { + label.style.left = '-' + this.options.labelOffsetX + 'px'; + label.style.textAlign = "right"; + } + else { + label.style.right = '-' + this.options.labelOffsetX + 'px'; + label.style.textAlign = "left"; + } - // map with all delimiters - var DELIMITERS = { - '{': true, - '}': true, - '[': true, - ']': true, - ';': true, - '=': true, - ',': true, + label.style.top = y - 0.5 * characterHeight + this.options.labelOffsetY + 'px'; - '->': true, - '--': true - }; + text += ''; - var dot = ''; // current dot file - var index = 0; // current index in dot file - var c = ''; // current token character in expr - var token = ''; // current token - var tokenType = TOKENTYPE.NULL; // type of the token + var largestWidth = Math.max(this.props.majorCharWidth,this.props.minorCharWidth); + if (this.maxLabelSize < text.length * largestWidth) { + this.maxLabelSize = text.length * largestWidth; + } + }; /** - * Get the first character from the dot file. - * The character is stored into the char c. If the end of the dot file is - * reached, the function puts an empty string in c. + * Create a minor line for the axis at position y + * @param y + * @param orientation + * @param className + * @param offset + * @param width */ - function first() { - index = 0; - c = dot.charAt(0); - } + DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) { + if (this.master == true) { + var line = DOMutil.getDOMElement('div',this.DOMelements, this.dom.lineContainer);//this.dom.redundant.lines.shift(); + line.className = className; + line.innerHTML = ''; + + if (orientation == 'left') { + line.style.left = (this.width - offset) + 'px'; + } + else { + line.style.right = (this.width - offset) + 'px'; + } + + line.style.width = width + 'px'; + line.style.top = y + 'px'; + } + }; + + + DataAxis.prototype.convertValue = function (value) { + var invertedValue = this.valueAtZero - value; + var convertedValue = invertedValue * this.conversionFactor; + return convertedValue; // the -2 is to compensate for the borders + }; + /** - * Get the next character from the dot file. - * The character is stored into the char c. If the end of the dot file is - * reached, the function puts an empty string in c. + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private */ - function next() { - index++; - c = dot.charAt(index); - } + DataAxis.prototype._calculateCharSize = function () { + // determine the char width and height on the minor axis + if (!('minorCharHeight' in this.props)) { + + var textMinor = document.createTextNode('0'); + var measureCharMinor = document.createElement('DIV'); + measureCharMinor.className = 'yAxis minor measure'; + measureCharMinor.appendChild(textMinor); + this.dom.frame.appendChild(measureCharMinor); + + this.props.minorCharHeight = measureCharMinor.clientHeight; + this.props.minorCharWidth = measureCharMinor.clientWidth; + + this.dom.frame.removeChild(measureCharMinor); + } + + if (!('majorCharHeight' in this.props)) { + var textMajor = document.createTextNode('0'); + var measureCharMajor = document.createElement('DIV'); + measureCharMajor.className = 'yAxis major measure'; + measureCharMajor.appendChild(textMajor); + this.dom.frame.appendChild(measureCharMajor); + + this.props.majorCharHeight = measureCharMajor.clientHeight; + this.props.majorCharWidth = measureCharMajor.clientWidth; + + this.dom.frame.removeChild(measureCharMajor); + } + }; /** - * Preview the next character from the dot file. - * @return {String} cNext + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate */ - function nextPreview() { - return dot.charAt(index + 1); - } + DataAxis.prototype.snap = function(date) { + return this.step.snap(date); + }; + + module.exports = DataAxis; + + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(2); /** - * Test whether given character is alphabetic or numeric - * @param {String} c - * @return {Boolean} isAlphaNumeric + * @constructor Group + * @param {Number | String} groupId + * @param {Object} data + * @param {ItemSet} itemSet */ - var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; - function isAlphaNumeric(c) { - return regexAlphaNumeric.test(c); + function GraphGroup (group, groupId, options, groupsUsingDefaultStyles) { + this.id = groupId; + var fields = ['sampling','style','sort','yAxisOrientation','barChart','drawPoints','shaded','catmullRom'] + this.options = util.selectiveBridgeObject(fields,options); + this.usingDefaultStyle = group.className === undefined; + this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; + this.zeroPosition = 0; + this.update(group); + if (this.usingDefaultStyle == true) { + this.groupsUsingDefaultStyles[0] += 1; + } + this.itemsData = []; } - /** - * Merge all properties of object b into object b - * @param {Object} a - * @param {Object} b - * @return {Object} a - */ - function merge (a, b) { - if (!a) { - a = {}; + GraphGroup.prototype.setItems = function(items) { + if (items != null) { + this.itemsData = items; + if (this.options.sort == true) { + this.itemsData.sort(function (a,b) {return a.x - b.x;}) + } + } + else { + this.itemsData = []; } + }; - if (b) { - for (var name in b) { - if (b.hasOwnProperty(name)) { - a[name] = b[name]; + GraphGroup.prototype.setZeroPosition = function(pos) { + this.zeroPosition = pos; + }; + + GraphGroup.prototype.setOptions = function(options) { + if (options !== undefined) { + var fields = ['sampling','style','sort','yAxisOrientation','barChart']; + util.selectiveDeepExtend(fields, this.options, options); + + util.mergeOptions(this.options, options,'catmullRom'); + util.mergeOptions(this.options, options,'drawPoints'); + util.mergeOptions(this.options, options,'shaded'); + + if (options.catmullRom) { + if (typeof options.catmullRom == 'object') { + if (options.catmullRom.parametrization) { + if (options.catmullRom.parametrization == 'uniform') { + this.options.catmullRom.alpha = 0; + } + else if (options.catmullRom.parametrization == 'chordal') { + this.options.catmullRom.alpha = 1.0; + } + else { + this.options.catmullRom.parametrization = 'centripetal'; + this.options.catmullRom.alpha = 0.5; + } + } } } } - return a; - } + }; - /** - * Set a value in an object, where the provided parameter name can be a - * path with nested parameters. For example: - * - * var obj = {a: 2}; - * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} - * - * @param {Object} obj - * @param {String} path A parameter name or dot-separated parameter path, - * like "color.highlight.border". - * @param {*} value - */ - function setValue(obj, path, value) { - var keys = path.split('.'); - var o = obj; - while (keys.length) { - var key = keys.shift(); - if (keys.length) { - // this isn't the end point - if (!o[key]) { - o[key] = {}; + GraphGroup.prototype.update = function(group) { + this.group = group; + this.content = group.content || 'graph'; + this.className = group.className || this.className || "graphGroup" + this.groupsUsingDefaultStyles[0] % 10; + this.setOptions(group.options); + }; + + GraphGroup.prototype.drawIcon = function(x, y, JSONcontainer, SVGcontainer, iconWidth, iconHeight) { + var fillHeight = iconHeight * 0.5; + var path, fillPath; + + var outline = DOMutil.getSVGElement("rect", JSONcontainer, SVGcontainer); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2*fillHeight); + outline.setAttributeNS(null, "class", "outline"); + + if (this.options.style == 'line') { + path = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); + path.setAttributeNS(null, "class", this.className); + path.setAttributeNS(null, "d", "M" + x + ","+y+" L" + (x + iconWidth) + ","+y+""); + if (this.options.shaded.enabled == true) { + fillPath = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); + if (this.options.shaded.orientation == 'top') { + fillPath.setAttributeNS(null, "d", "M"+x+", " + (y - fillHeight) + + "L"+x+","+y+" L"+ (x + iconWidth) + ","+y+" L"+ (x + iconWidth) + "," + (y - fillHeight)); } - o = o[key]; + else { + fillPath.setAttributeNS(null, "d", "M"+x+","+y+" " + + "L"+x+"," + (y + fillHeight) + " " + + "L"+ (x + iconWidth) + "," + (y + fillHeight) + + "L"+ (x + iconWidth) + ","+y); + } + fillPath.setAttributeNS(null, "class", this.className + " iconFill"); } - else { - // this is the end point - o[key] = value; + + if (this.options.drawPoints.enabled == true) { + DOMutil.drawPoint(x + 0.5 * iconWidth,y, this, JSONcontainer, SVGcontainer); } } - } + else { + var barWidth = Math.round(0.3 * iconWidth); + var bar1Height = Math.round(0.4 * iconHeight); + var bar2Height = Math.round(0.75 * iconHeight); + + var offset = Math.round((iconWidth - (2 * barWidth))/3); + + DOMutil.drawBar(x + 0.5*barWidth + offset , y + fillHeight - bar1Height - 1, barWidth, bar1Height, this.className + ' bar', JSONcontainer, SVGcontainer); + DOMutil.drawBar(x + 1.5*barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, this.className + ' bar', JSONcontainer, SVGcontainer); + } + }; + + module.exports = GraphGroup; + + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var stack = __webpack_require__(16); + var ItemRange = __webpack_require__(31); /** - * Add a node to a graph object. If there is already a node with - * the same id, their attributes will be merged. - * @param {Object} graph - * @param {Object} node + * @constructor Group + * @param {Number | String} groupId + * @param {Object} data + * @param {ItemSet} itemSet */ - function addNode(graph, node) { - var i, len; - var current = null; + function Group (groupId, data, itemSet) { + this.groupId = groupId; - // find root graph (in case of subgraph) - var graphs = [graph]; // list with all graphs from current graph to root graph - var root = graph; - while (root.parent) { - graphs.push(root.parent); - root = root.parent; - } + this.itemSet = itemSet; - // find existing node (at root level) by its id - if (root.nodes) { - for (i = 0, len = root.nodes.length; i < len; i++) { - if (node.id === root.nodes[i].id) { - current = root.nodes[i]; - break; - } + this.dom = {}; + this.props = { + label: { + width: 0, + height: 0 } + }; + this.className = null; + + this.items = {}; // items filtered by groupId of this group + this.visibleItems = []; // items currently visible in window + this.orderedItems = { // items sorted by start and by end + byStart: [], + byEnd: [] + }; + + this._create(); + + this.setData(data); + } + + /** + * Create DOM elements for the group + * @private + */ + Group.prototype._create = function() { + var label = document.createElement('div'); + label.className = 'vlabel'; + this.dom.label = label; + + var inner = document.createElement('div'); + inner.className = 'inner'; + label.appendChild(inner); + this.dom.inner = inner; + + var foreground = document.createElement('div'); + foreground.className = 'group'; + foreground['timeline-group'] = this; + this.dom.foreground = foreground; + + this.dom.background = document.createElement('div'); + this.dom.background.className = 'group'; + + this.dom.axis = document.createElement('div'); + this.dom.axis.className = 'group'; + + // create a hidden marker to detect when the Timelines container is attached + // to the DOM, or the style of a parent of the Timeline is changed from + // display:none is changed to visible. + this.dom.marker = document.createElement('div'); + this.dom.marker.style.visibility = 'hidden'; + this.dom.marker.innerHTML = '?'; + this.dom.background.appendChild(this.dom.marker); + }; + + /** + * Set the group data for this group + * @param {Object} data Group data, can contain properties content and className + */ + Group.prototype.setData = function(data) { + // update contents + var content = data && data.content; + if (content instanceof Element) { + this.dom.inner.appendChild(content); + } + else if (content != undefined) { + this.dom.inner.innerHTML = content; + } + else { + this.dom.inner.innerHTML = this.groupId; } - if (!current) { - // this is a new node - current = { - id: node.id - }; - if (graph.node) { - // clone default attributes - current.attr = merge(current.attr, graph.node); + // update title + this.dom.label.title = data && data.title || ''; + + if (!this.dom.inner.firstChild) { + util.addClassName(this.dom.inner, 'hidden'); + } + else { + util.removeClassName(this.dom.inner, 'hidden'); + } + + // update className + var className = data && data.className || null; + if (className != this.className) { + if (this.className) { + util.removeClassName(this.dom.label, className); + util.removeClassName(this.dom.foreground, className); + util.removeClassName(this.dom.background, className); + util.removeClassName(this.dom.axis, className); } + util.addClassName(this.dom.label, className); + util.addClassName(this.dom.foreground, className); + util.addClassName(this.dom.background, className); + util.addClassName(this.dom.axis, className); } + }; - // add node to this (sub)graph and all its parent graphs - for (i = graphs.length - 1; i >= 0; i--) { - var g = graphs[i]; + /** + * Get the width of the group label + * @return {number} width + */ + Group.prototype.getLabelWidth = function() { + return this.props.label.width; + }; - if (!g.nodes) { - g.nodes = []; - } - if (g.nodes.indexOf(current) == -1) { - g.nodes.push(current); + + /** + * Repaint this group + * @param {{start: number, end: number}} range + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @param {boolean} [restack=false] Force restacking of all items + * @return {boolean} Returns true if the group is resized + */ + Group.prototype.redraw = function(range, margin, restack) { + var resized = false; + + this.visibleItems = this._updateVisibleItems(this.orderedItems, this.visibleItems, range); + + // force recalculation of the height of the items when the marker height changed + // (due to the Timeline being attached to the DOM or changed from display:none to visible) + var markerHeight = this.dom.marker.clientHeight; + if (markerHeight != this.lastMarkerHeight) { + this.lastMarkerHeight = markerHeight; + + util.forEach(this.items, function (item) { + item.dirty = true; + if (item.displayed) item.redraw(); + }); + + restack = true; + } + + // reposition visible items vertically + if (this.itemSet.options.stack) { // TODO: ugly way to access options... + stack.stack(this.visibleItems, margin, restack); + } + else { // no stacking + stack.nostack(this.visibleItems, margin); + } + + // recalculate the height of the group + var height; + var visibleItems = this.visibleItems; + if (visibleItems.length) { + var min = visibleItems[0].top; + var max = visibleItems[0].top + visibleItems[0].height; + util.forEach(visibleItems, function (item) { + min = Math.min(min, item.top); + max = Math.max(max, (item.top + item.height)); + }); + if (min > margin.axis) { + // there is an empty gap between the lowest item and the axis + var offset = min - margin.axis; + max -= offset; + util.forEach(visibleItems, function (item) { + item.top -= offset; + }); } + height = max + margin.item.vertical / 2; + } + else { + height = margin.axis + margin.item.vertical; } + height = Math.max(height, this.props.label.height); - // merge attributes - if (node.attr) { - current.attr = merge(current.attr, node.attr); + // calculate actual size and position + var foreground = this.dom.foreground; + this.top = foreground.offsetTop; + this.left = foreground.offsetLeft; + this.width = foreground.offsetWidth; + resized = util.updateProperty(this, 'height', height) || resized; + + // recalculate size of label + resized = util.updateProperty(this.props.label, 'width', this.dom.inner.clientWidth) || resized; + resized = util.updateProperty(this.props.label, 'height', this.dom.inner.clientHeight) || resized; + + // apply new height + this.dom.background.style.height = height + 'px'; + this.dom.foreground.style.height = height + 'px'; + this.dom.label.style.height = height + 'px'; + + // update vertical position of items after they are re-stacked and the height of the group is calculated + for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { + var item = this.visibleItems[i]; + item.repositionY(); } - } + + return resized; + }; /** - * Add an edge to a graph object - * @param {Object} graph - * @param {Object} edge + * Show this group: attach to the DOM */ - function addEdge(graph, edge) { - if (!graph.edges) { - graph.edges = []; + Group.prototype.show = function() { + if (!this.dom.label.parentNode) { + this.itemSet.dom.labelSet.appendChild(this.dom.label); } - graph.edges.push(edge); - if (graph.edge) { - var attr = merge({}, graph.edge); // clone default attributes - edge.attr = merge(attr, edge.attr); // merge attributes + + if (!this.dom.foreground.parentNode) { + this.itemSet.dom.foreground.appendChild(this.dom.foreground); } - } + + if (!this.dom.background.parentNode) { + this.itemSet.dom.background.appendChild(this.dom.background); + } + + if (!this.dom.axis.parentNode) { + this.itemSet.dom.axis.appendChild(this.dom.axis); + } + }; /** - * Create an edge to a graph object - * @param {Object} graph - * @param {String | Number | Object} from - * @param {String | Number | Object} to - * @param {String} type - * @param {Object | null} attr - * @return {Object} edge + * Hide this group: remove from the DOM */ - function createEdge(graph, from, to, type, attr) { - var edge = { - from: from, - to: to, - type: type - }; + Group.prototype.hide = function() { + var label = this.dom.label; + if (label.parentNode) { + label.parentNode.removeChild(label); + } - if (graph.edge) { - edge.attr = merge({}, graph.edge); // clone default attributes + var foreground = this.dom.foreground; + if (foreground.parentNode) { + foreground.parentNode.removeChild(foreground); } - edge.attr = merge(edge.attr || {}, attr); // merge attributes - return edge; - } + var background = this.dom.background; + if (background.parentNode) { + background.parentNode.removeChild(background); + } + + var axis = this.dom.axis; + if (axis.parentNode) { + axis.parentNode.removeChild(axis); + } + }; /** - * Get next token in the current dot file. - * The token and token type are available as token and tokenType + * Add an item to the group + * @param {Item} item */ - function getToken() { - tokenType = TOKENTYPE.NULL; - token = ''; + Group.prototype.add = function(item) { + this.items[item.id] = item; + item.setParent(this); - // skip over whitespaces - while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter - next(); + if (item instanceof ItemRange && this.visibleItems.indexOf(item) == -1) { + var range = this.itemSet.body.range; // TODO: not nice accessing the range like this + this._checkIfVisible(item, this.visibleItems, range); } + }; - do { - var isComment = false; + /** + * Remove an item from the group + * @param {Item} item + */ + Group.prototype.remove = function(item) { + delete this.items[item.id]; + item.setParent(this.itemSet); - // skip comment - if (c == '#') { - // find the previous non-space character - var i = index - 1; - while (dot.charAt(i) == ' ' || dot.charAt(i) == '\t') { - i--; - } - if (dot.charAt(i) == '\n' || dot.charAt(i) == '') { - // the # is at the start of a line, this is indeed a line comment - while (c != '' && c != '\n') { - next(); - } - isComment = true; - } - } - if (c == '/' && nextPreview() == '/') { - // skip line comment - while (c != '' && c != '\n') { - next(); - } - isComment = true; - } - if (c == '/' && nextPreview() == '*') { - // skip block comment - while (c != '') { - if (c == '*' && nextPreview() == '/') { - // end of block comment found. skip these last two characters - next(); - next(); - break; - } - else { - next(); - } - } - isComment = true; - } + // remove from visible items + var index = this.visibleItems.indexOf(item); + if (index != -1) this.visibleItems.splice(index, 1); - // skip over whitespaces - while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter - next(); + // TODO: also remove from ordered items? + }; + + /** + * Remove an item from the corresponding DataSet + * @param {Item} item + */ + Group.prototype.removeFromDataSet = function(item) { + this.itemSet.removeItem(item.id); + }; + + /** + * Reorder the items + */ + Group.prototype.order = function() { + var array = util.toArray(this.items); + this.orderedItems.byStart = array; + this.orderedItems.byEnd = this._constructByEndArray(array); + + stack.orderByStart(this.orderedItems.byStart); + stack.orderByEnd(this.orderedItems.byEnd); + }; + + /** + * Create an array containing all items being a range (having an end date) + * @param {Item[]} array + * @returns {ItemRange[]} + * @private + */ + Group.prototype._constructByEndArray = function(array) { + var endArray = []; + + for (var i = 0; i < array.length; i++) { + if (array[i] instanceof ItemRange) { + endArray.push(array[i]); } } - while (isComment); + return endArray; + }; - // check for end of dot file - if (c == '') { - // token is still empty - tokenType = TOKENTYPE.DELIMITER; - return; - } + /** + * Update the visible items + * @param {{byStart: Item[], byEnd: Item[]}} orderedItems All items ordered by start date and by end date + * @param {Item[]} visibleItems The previously visible items. + * @param {{start: number, end: number}} range Visible range + * @return {Item[]} visibleItems The new visible items. + * @private + */ + Group.prototype._updateVisibleItems = function(orderedItems, visibleItems, range) { + var initialPosByStart, + newVisibleItems = [], + i; - // check for delimiters consisting of 2 characters - var c2 = c + nextPreview(); - if (DELIMITERS[c2]) { - tokenType = TOKENTYPE.DELIMITER; - token = c2; - next(); - next(); - return; + // first check if the items that were in view previously are still in view. + // this handles the case for the ItemRange that is both before and after the current one. + if (visibleItems.length > 0) { + for (i = 0; i < visibleItems.length; i++) { + this._checkIfVisible(visibleItems[i], newVisibleItems, range); + } } - // check for delimiters consisting of 1 character - if (DELIMITERS[c]) { - tokenType = TOKENTYPE.DELIMITER; - token = c; - next(); - return; + // If there were no visible items previously, use binarySearch to find a visible ItemPoint or ItemRange (based on startTime) + if (newVisibleItems.length == 0) { + initialPosByStart = util.binarySearch(orderedItems.byStart, range, 'data','start'); + } + else { + initialPosByStart = orderedItems.byStart.indexOf(newVisibleItems[0]); } - // check for an identifier (number or string) - // TODO: more precise parsing of numbers/strings (and the port separator ':') - if (isAlphaNumeric(c) || c == '-') { - token += c; - next(); + // use visible search to find a visible ItemRange (only based on endTime) + var initialPosByEnd = util.binarySearch(orderedItems.byEnd, range, 'data','end'); - while (isAlphaNumeric(c)) { - token += c; - next(); + // if we found a initial ID to use, trace it up and down until we meet an invisible item. + if (initialPosByStart != -1) { + for (i = initialPosByStart; i >= 0; i--) { + if (this._checkIfInvisible(orderedItems.byStart[i], newVisibleItems, range)) {break;} } - if (token == 'false') { - token = false; // convert to boolean + for (i = initialPosByStart + 1; i < orderedItems.byStart.length; i++) { + if (this._checkIfInvisible(orderedItems.byStart[i], newVisibleItems, range)) {break;} } - else if (token == 'true') { - token = true; // convert to boolean + } + + // if we found a initial ID to use, trace it up and down until we meet an invisible item. + if (initialPosByEnd != -1) { + for (i = initialPosByEnd; i >= 0; i--) { + if (this._checkIfInvisible(orderedItems.byEnd[i], newVisibleItems, range)) {break;} } - else if (!isNaN(Number(token))) { - token = Number(token); // convert to number + for (i = initialPosByEnd + 1; i < orderedItems.byEnd.length; i++) { + if (this._checkIfInvisible(orderedItems.byEnd[i], newVisibleItems, range)) {break;} } - tokenType = TOKENTYPE.IDENTIFIER; - return; } - // check for a string enclosed by double quotes - if (c == '"') { - next(); - while (c != '' && (c != '"' || (c == '"' && nextPreview() == '"'))) { - token += c; - if (c == '"') { // skip the escape character - next(); - } - next(); - } - if (c != '"') { - throw newSyntaxError('End of string " expected'); + return newVisibleItems; + }; + + + + /** + * this function checks if an item is invisible. If it is NOT we make it visible + * and add it to the global visible items. If it is, return true. + * + * @param {Item} item + * @param {Item[]} visibleItems + * @param {{start:number, end:number}} range + * @returns {boolean} + * @private + */ + Group.prototype._checkIfInvisible = function(item, visibleItems, range) { + if (item.isVisible(range)) { + if (!item.displayed) item.show(); + item.repositionX(); + if (visibleItems.indexOf(item) == -1) { + visibleItems.push(item); } - next(); - tokenType = TOKENTYPE.IDENTIFIER; - return; + return false; } + else { + if (item.displayed) item.hide(); + return true; + } + }; - // something unknown is found, wrong characters, a syntax error - tokenType = TOKENTYPE.UNKNOWN; - while (c != '') { - token += c; - next(); + /** + * this function is very similar to the _checkIfInvisible() but it does not + * return booleans, hides the item if it should not be seen and always adds to + * the visibleItems. + * this one is for brute forcing and hiding. + * + * @param {Item} item + * @param {Array} visibleItems + * @param {{start:number, end:number}} range + * @private + */ + Group.prototype._checkIfVisible = function(item, visibleItems, range) { + if (item.isVisible(range)) { + if (!item.displayed) item.show(); + // reposition item horizontally + item.repositionX(); + visibleItems.push(item); } - throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"'); - } + else { + if (item.displayed) item.hide(); + } + }; + + module.exports = Group; + + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + var Hammer = __webpack_require__(41); + var util = __webpack_require__(1); + var DataSet = __webpack_require__(3); + var DataView = __webpack_require__(4); + var Component = __webpack_require__(18); + var Group = __webpack_require__(23); + var ItemBox = __webpack_require__(29); + var ItemPoint = __webpack_require__(30); + var ItemRange = __webpack_require__(31); + + + var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items /** - * Parse a graph. - * @returns {Object} graph + * An ItemSet holds a set of items and ranges which can be displayed in a + * range. The width is determined by the parent of the ItemSet, and the height + * is determined by the size of the items. + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See ItemSet.setOptions for the available options. + * @constructor ItemSet + * @extends Component */ - function parseGraph() { - var graph = {}; + function ItemSet(body, options) { + this.body = body; + + this.defaultOptions = { + type: null, // 'box', 'point', 'range' + orientation: 'bottom', // 'top' or 'bottom' + align: 'center', // alignment of box items + stack: true, + groupOrder: null, + + selectable: true, + editable: { + updateTime: false, + updateGroup: false, + add: false, + remove: false + }, - first(); - getToken(); + onAdd: function (item, callback) { + callback(item); + }, + onUpdate: function (item, callback) { + callback(item); + }, + onMove: function (item, callback) { + callback(item); + }, + onRemove: function (item, callback) { + callback(item); + }, - // optional strict keyword - if (token == 'strict') { - graph.strict = true; - getToken(); - } + margin: { + item: { + horizontal: 10, + vertical: 10 + }, + axis: 20 + }, + padding: 5 + }; - // graph or digraph keyword - if (token == 'graph' || token == 'digraph') { - graph.type = token; - getToken(); - } + // options is shared by this ItemSet and all its items + this.options = util.extend({}, this.defaultOptions); - // optional graph id - if (tokenType == TOKENTYPE.IDENTIFIER) { - graph.id = token; - getToken(); - } + // options for getting items from the DataSet with the correct type + this.itemOptions = { + type: {start: 'Date', end: 'Date'} + }; - // open angle bracket - if (token != '{') { - throw newSyntaxError('Angle bracket { expected'); - } - getToken(); + this.conversion = { + toScreen: body.util.toScreen, + toTime: body.util.toTime + }; + this.dom = {}; + this.props = {}; + this.hammer = null; - // statements - parseStatements(graph); + var me = this; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet - // close angle bracket - if (token != '}') { - throw newSyntaxError('Angle bracket } expected'); - } - getToken(); + // listeners for the DataSet of the items + this.itemListeners = { + 'add': function (event, params, senderId) { + me._onAdd(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdate(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemove(params.items); + } + }; - // end of file - if (token !== '') { - throw newSyntaxError('End of file expected'); - } - getToken(); + // listeners for the DataSet of the groups + this.groupListeners = { + 'add': function (event, params, senderId) { + me._onAddGroups(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdateGroups(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemoveGroups(params.items); + } + }; - // remove temporary default properties - delete graph.node; - delete graph.edge; - delete graph.graph; + this.items = {}; // object with an Item for every data item + this.groups = {}; // Group object for every group + this.groupIds = []; - return graph; + this.selection = []; // list with the ids of all selected nodes + this.stackDirty = true; // if true, all items will be restacked on next redraw + + this.touchParams = {}; // stores properties while dragging + // create the HTML DOM + + this._create(); + + this.setOptions(options); } + ItemSet.prototype = new Component(); + + // available item types will be registered here + ItemSet.types = { + box: ItemBox, + range: ItemRange, + point: ItemPoint + }; + /** - * Parse a list with statements. - * @param {Object} graph + * Create the HTML DOM for the ItemSet */ - function parseStatements (graph) { - while (token !== '' && token != '}') { - parseStatement(graph); - if (token == ';') { - getToken(); + ItemSet.prototype._create = function(){ + var frame = document.createElement('div'); + frame.className = 'itemset'; + frame['timeline-itemset'] = this; + this.dom.frame = frame; + + // create background panel + var background = document.createElement('div'); + background.className = 'background'; + frame.appendChild(background); + this.dom.background = background; + + // create foreground panel + var foreground = document.createElement('div'); + foreground.className = 'foreground'; + frame.appendChild(foreground); + this.dom.foreground = foreground; + + // create axis panel + var axis = document.createElement('div'); + axis.className = 'axis'; + this.dom.axis = axis; + + // create labelset + var labelSet = document.createElement('div'); + labelSet.className = 'labelset'; + this.dom.labelSet = labelSet; + + // create ungrouped Group + this._updateUngrouped(); + + // attach event listeners + // Note: we bind to the centerContainer for the case where the height + // of the center container is larger than of the ItemSet, so we + // can click in the empty area to create a new item or deselect an item. + this.hammer = Hammer(this.body.dom.centerContainer, { + prevent_default: true + }); + + // drag items when selected + this.hammer.on('touch', this._onTouch.bind(this)); + this.hammer.on('dragstart', this._onDragStart.bind(this)); + this.hammer.on('drag', this._onDrag.bind(this)); + this.hammer.on('dragend', this._onDragEnd.bind(this)); + + // single select (or unselect) when tapping an item + this.hammer.on('tap', this._onSelectItem.bind(this)); + + // multi select when holding mouse/touch, or on ctrl+click + this.hammer.on('hold', this._onMultiSelectItem.bind(this)); + + // add item on doubletap + this.hammer.on('doubletap', this._onAddItem.bind(this)); + + // attach to the DOM + this.show(); + }; + + /** + * Set options for the ItemSet. Existing options will be extended/overwritten. + * @param {Object} [options] The following options are available: + * {String} type + * Default type for the items. Choose from 'box' + * (default), 'point', or 'range'. The default + * Style can be overwritten by individual items. + * {String} align + * Alignment for the items, only applicable for + * ItemBox. Choose 'center' (default), 'left', or + * 'right'. + * {String} orientation + * Orientation of the item set. Choose 'top' or + * 'bottom' (default). + * {Function} groupOrder + * A sorting function for ordering groups + * {Boolean} stack + * If true (deafult), items will be stacked on + * top of each other. + * {Number} margin.axis + * Margin between the axis and the items in pixels. + * Default is 20. + * {Number} margin.item.horizontal + * Horizontal margin between items in pixels. + * Default is 10. + * {Number} margin.item.vertical + * Vertical Margin between items in pixels. + * Default is 10. + * {Number} margin.item + * Margin between items in pixels in both horizontal + * and vertical direction. Default is 10. + * {Number} margin + * Set margin for both axis and items in pixels. + * {Number} padding + * Padding of the contents of an item in pixels. + * Must correspond with the items css. Default is 5. + * {Boolean} selectable + * If true (default), items can be selected. + * {Boolean} editable + * Set all editable options to true or false + * {Boolean} editable.updateTime + * Allow dragging an item to an other moment in time + * {Boolean} editable.updateGroup + * Allow dragging an item to an other group + * {Boolean} editable.add + * Allow creating new items on double tap + * {Boolean} editable.remove + * Allow removing items by clicking the delete button + * top right of a selected item. + * {Function(item: Item, callback: Function)} onAdd + * Callback function triggered when an item is about to be added: + * when the user double taps an empty space in the Timeline. + * {Function(item: Item, callback: Function)} onUpdate + * Callback function fired when an item is about to be updated. + * This function typically has to show a dialog where the user + * change the item. If not implemented, nothing happens. + * {Function(item: Item, callback: Function)} onMove + * Fired when an item has been moved. If not implemented, + * the move action will be accepted. + * {Function(item: Item, callback: Function)} onRemove + * Fired when an item is about to be deleted. + * If not implemented, the item will be always removed. + */ + ItemSet.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + var fields = ['type', 'align', 'orientation', 'padding', 'stack', 'selectable', 'groupOrder']; + util.selectiveExtend(fields, this.options, options); + + if ('margin' in options) { + if (typeof options.margin === 'number') { + this.options.margin.axis = options.margin; + this.options.margin.item.horizontal = options.margin; + this.options.margin.item.vertical = options.margin; + } + else if (typeof options.margin === 'object') { + util.selectiveExtend(['axis'], this.options.margin, options.margin); + if ('item' in options.margin) { + if (typeof options.margin.item === 'number') { + this.options.margin.item.horizontal = options.margin.item; + this.options.margin.item.vertical = options.margin.item; + } + else if (typeof options.margin.item === 'object') { + util.selectiveExtend(['horizontal', 'vertical'], this.options.margin.item, options.margin.item); + } + } + } + } + + if ('editable' in options) { + if (typeof options.editable === 'boolean') { + this.options.editable.updateTime = options.editable; + this.options.editable.updateGroup = options.editable; + this.options.editable.add = options.editable; + this.options.editable.remove = options.editable; + } + else if (typeof options.editable === 'object') { + util.selectiveExtend(['updateTime', 'updateGroup', 'add', 'remove'], this.options.editable, options.editable); + } } + + // callback functions + var addCallback = (function (name) { + if (name in options) { + var fn = options[name]; + if (!(fn instanceof Function)) { + throw new Error('option ' + name + ' must be a function ' + name + '(item, callback)'); + } + this.options[name] = fn; + } + }).bind(this); + ['onAdd', 'onUpdate', 'onRemove', 'onMove'].forEach(addCallback); + + // force the itemSet to refresh: options like orientation and margins may be changed + this.markDirty(); } - } + }; /** - * Parse a single statement. Can be a an attribute statement, node - * statement, a series of node statements and edge statements, or a - * parameter. - * @param {Object} graph + * Mark the ItemSet dirty so it will refresh everything with next redraw */ - function parseStatement(graph) { - // parse subgraph - var subgraph = parseSubgraph(graph); - if (subgraph) { - // edge statements - parseEdge(graph, subgraph); + ItemSet.prototype.markDirty = function() { + this.groupIds = []; + this.stackDirty = true; + }; - return; - } + /** + * Destroy the ItemSet + */ + ItemSet.prototype.destroy = function() { + this.hide(); + this.setItems(null); + this.setGroups(null); - // parse an attribute statement - var attr = parseAttributeStatement(graph); - if (attr) { - return; - } + this.hammer = null; - // parse node - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier expected'); + this.body = null; + this.conversion = null; + }; + + /** + * Hide the component from the DOM + */ + ItemSet.prototype.hide = function() { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); } - var id = token; // id can be a string or a number - getToken(); - if (token == '=') { - // id statement - getToken(); - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier expected'); - } - graph[id] = token; - getToken(); - // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " + // remove the axis with dots + if (this.dom.axis.parentNode) { + this.dom.axis.parentNode.removeChild(this.dom.axis); } - else { - parseNodeStatement(graph, id); + + // remove the labelset containing all group labels + if (this.dom.labelSet.parentNode) { + this.dom.labelSet.parentNode.removeChild(this.dom.labelSet); } - } + }; /** - * Parse a subgraph - * @param {Object} graph parent graph object - * @return {Object | null} subgraph + * Show the component in the DOM (when not already visible). + * @return {Boolean} changed */ - function parseSubgraph (graph) { - var subgraph = null; + ItemSet.prototype.show = function() { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } - // optional subgraph keyword - if (token == 'subgraph') { - subgraph = {}; - subgraph.type = 'subgraph'; - getToken(); + // show axis with dots + if (!this.dom.axis.parentNode) { + this.body.dom.backgroundVertical.appendChild(this.dom.axis); + } - // optional graph id - if (tokenType == TOKENTYPE.IDENTIFIER) { - subgraph.id = token; - getToken(); - } + // show labelset containing labels + if (!this.dom.labelSet.parentNode) { + this.body.dom.left.appendChild(this.dom.labelSet); } + }; - // open angle bracket - if (token == '{') { - getToken(); + /** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {Array} [ids] An array with zero or more id's of the items to be + * selected. If ids is an empty array, all items will be + * unselected. + */ + ItemSet.prototype.setSelection = function(ids) { + var i, ii, id, item; - if (!subgraph) { - subgraph = {}; + if (ids) { + if (!Array.isArray(ids)) { + throw new TypeError('Array expected'); } - subgraph.parent = graph; - subgraph.node = graph.node; - subgraph.edge = graph.edge; - subgraph.graph = graph.graph; - // statements - parseStatements(subgraph); - - // close angle bracket - if (token != '}') { - throw newSyntaxError('Angle bracket } expected'); + // unselect currently selected items + for (i = 0, ii = this.selection.length; i < ii; i++) { + id = this.selection[i]; + item = this.items[id]; + if (item) item.unselect(); } - getToken(); - - // remove temporary default properties - delete subgraph.node; - delete subgraph.edge; - delete subgraph.graph; - delete subgraph.parent; - // register at the parent graph - if (!graph.subgraphs) { - graph.subgraphs = []; + // select items + this.selection = []; + for (i = 0, ii = ids.length; i < ii; i++) { + id = ids[i]; + item = this.items[id]; + if (item) { + this.selection.push(id); + item.select(); + } } - graph.subgraphs.push(subgraph); } + }; - return subgraph; - } + /** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ + ItemSet.prototype.getSelection = function() { + return this.selection.concat([]); + }; /** - * parse an attribute statement like "node [shape=circle fontSize=16]". - * Available keywords are 'node', 'edge', 'graph'. - * The previous list with default attributes will be replaced - * @param {Object} graph - * @returns {String | null} keyword Returns the name of the parsed attribute - * (node, edge, graph), or null if nothing - * is parsed. + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items */ - function parseAttributeStatement (graph) { - // attribute statements - if (token == 'node') { - getToken(); + ItemSet.prototype.getVisibleItems = function() { + var range = this.body.range.getRange(); + var left = this.body.util.toScreen(range.start); + var right = this.body.util.toScreen(range.end); - // node attributes - graph.node = parseAttributeList(); - return 'node'; + var ids = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + var rawVisibleItems = group.visibleItems; + + // filter the "raw" set with visibleItems into a set which is really + // visible by pixels + for (var i = 0; i < rawVisibleItems.length; i++) { + var item = rawVisibleItems[i]; + // TODO: also check whether visible vertically + if ((item.left < right) && (item.left + item.width > left)) { + ids.push(item.id); + } + } + } } - else if (token == 'edge') { - getToken(); - // edge attributes - graph.edge = parseAttributeList(); - return 'edge'; - } - else if (token == 'graph') { - getToken(); + return ids; + }; - // graph attributes - graph.graph = parseAttributeList(); - return 'graph'; + /** + * Deselect a selected item + * @param {String | Number} id + * @private + */ + ItemSet.prototype._deselect = function(id) { + var selection = this.selection; + for (var i = 0, ii = selection.length; i < ii; i++) { + if (selection[i] == id) { // non-strict comparison! + selection.splice(i, 1); + break; + } } + }; - return null; - } + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + ItemSet.prototype.redraw = function() { + var margin = this.options.margin, + range = this.body.range, + asSize = util.option.asSize, + options = this.options, + orientation = options.orientation, + resized = false, + frame = this.dom.frame, + editable = options.editable.updateTime || options.editable.updateGroup; + + // update class name + frame.className = 'itemset' + (editable ? ' editable' : ''); + + // reorder the groups (if needed) + resized = this._orderGroups() || resized; + + // check whether zoomed (in that case we need to re-stack everything) + // TODO: would be nicer to get this as a trigger from Range + var visibleInterval = range.end - range.start; + var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.props.width != this.props.lastWidth); + if (zoomed) this.stackDirty = true; + this.lastVisibleInterval = visibleInterval; + this.props.lastWidth = this.props.width; + + // redraw all groups + var restack = this.stackDirty, + firstGroup = this._firstGroup(), + firstMargin = { + item: margin.item, + axis: margin.axis + }, + nonFirstMargin = { + item: margin.item, + axis: margin.item.vertical / 2 + }, + height = 0, + minHeight = margin.axis + margin.item.vertical; + util.forEach(this.groups, function (group) { + var groupMargin = (group == firstGroup) ? firstMargin : nonFirstMargin; + var groupResized = group.redraw(range, groupMargin, restack); + resized = groupResized || resized; + height += group.height; + }); + height = Math.max(height, minHeight); + this.stackDirty = false; + + // update frame height + frame.style.height = asSize(height); + + // calculate actual size and position + this.props.top = frame.offsetTop; + this.props.left = frame.offsetLeft; + this.props.width = frame.offsetWidth; + this.props.height = height; + + // reposition axis + this.dom.axis.style.top = asSize((orientation == 'top') ? + (this.body.domProps.top.height + this.body.domProps.border.top) : + (this.body.domProps.top.height + this.body.domProps.centerContainer.height)); + this.dom.axis.style.left = this.body.domProps.border.left + 'px'; + + // check if this component is resized + resized = this._isResized() || resized; + + return resized; + }; /** - * parse a node statement - * @param {Object} graph - * @param {String | Number} id + * Get the first group, aligned with the axis + * @return {Group | null} firstGroup + * @private */ - function parseNodeStatement(graph, id) { - // node statement - var node = { - id: id - }; - var attr = parseAttributeList(); - if (attr) { - node.attr = attr; - } - addNode(graph, node); + ItemSet.prototype._firstGroup = function() { + var firstGroupIndex = (this.options.orientation == 'top') ? 0 : (this.groupIds.length - 1); + var firstGroupId = this.groupIds[firstGroupIndex]; + var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED]; - // edge statements - parseEdge(graph, id); - } + return firstGroup || null; + }; /** - * Parse an edge or a series of edges - * @param {Object} graph - * @param {String | Number} from Id of the from node + * Create or delete the group holding all ungrouped items. This group is used when + * there are no groups specified. + * @protected */ - function parseEdge(graph, from) { - while (token == '->' || token == '--') { - var to; - var type = token; - getToken(); + ItemSet.prototype._updateUngrouped = function() { + var ungrouped = this.groups[UNGROUPED]; - var subgraph = parseSubgraph(graph); - if (subgraph) { - to = subgraph; + if (this.groupsData) { + // remove the group holding all ungrouped items + if (ungrouped) { + ungrouped.hide(); + delete this.groups[UNGROUPED]; } - else { - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier or subgraph expected'); + } + else { + // create a group holding all (unfiltered) items + if (!ungrouped) { + var id = null; + var data = null; + ungrouped = new Group(id, data, this); + this.groups[UNGROUPED] = ungrouped; + + for (var itemId in this.items) { + if (this.items.hasOwnProperty(itemId)) { + ungrouped.add(this.items[itemId]); + } } - to = token; - addNode(graph, { - id: to - }); - getToken(); + + ungrouped.show(); } + } + }; - // parse edge attributes - var attr = parseAttributeList(); + /** + * Get the element for the labelset + * @return {HTMLElement} labelSet + */ + ItemSet.prototype.getLabelSet = function() { + return this.dom.labelSet; + }; - // create edge - var edge = createEdge(graph, from, to, type, attr); - addEdge(graph, edge); + /** + * Set items + * @param {vis.DataSet | null} items + */ + ItemSet.prototype.setItems = function(items) { + var me = this, + ids, + oldItemsData = this.itemsData; - from = to; + // replace the dataset + if (!items) { + this.itemsData = null; } - } + else if (items instanceof DataSet || items instanceof DataView) { + this.itemsData = items; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } + + if (oldItemsData) { + // unsubscribe from old dataset + util.forEach(this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); + + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } + + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); + + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); + + // update the group holding all ungrouped items + this._updateUngrouped(); + } + }; /** - * Parse a set with attributes, - * for example [label="1.000", shape=solid] - * @return {Object | null} attr + * Get the current items + * @returns {vis.DataSet | null} */ - function parseAttributeList() { - var attr = null; + ItemSet.prototype.getItems = function() { + return this.itemsData; + }; - while (token == '[') { - getToken(); - attr = {}; - while (token !== '' && token != ']') { - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Attribute name expected'); - } - var name = token; + /** + * Set groups + * @param {vis.DataSet} groups + */ + ItemSet.prototype.setGroups = function(groups) { + var me = this, + ids; - getToken(); - if (token != '=') { - throw newSyntaxError('Equal sign = expected'); - } - getToken(); + // unsubscribe from current dataset + if (this.groupsData) { + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.unsubscribe(event, callback); + }); - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Attribute value expected'); - } - var value = token; - setValue(attr, name, value); // name can be a path + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + this._onRemoveGroups(ids); // note: this will cause a redraw + } - getToken(); - if (token ==',') { - getToken(); - } - } + // replace the dataset + if (!groups) { + this.groupsData = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + this.groupsData = groups; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } - if (token != ']') { - throw newSyntaxError('Bracket ] expected'); - } - getToken(); + if (this.groupsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); + + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); } - return attr; - } + // update the group holding all ungrouped items + this._updateUngrouped(); + + // update the order of all items in each group + this._order(); + + this.body.emitter.emit('change'); + }; /** - * Create a syntax error with extra information on current token and index. - * @param {String} message - * @returns {SyntaxError} err + * Get the current groups + * @returns {vis.DataSet | null} groups */ - function newSyntaxError(message) { - return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')'); - } + ItemSet.prototype.getGroups = function() { + return this.groupsData; + }; /** - * Chop off text after a maximum length - * @param {String} text - * @param {Number} maxLength - * @returns {String} + * Remove an item by its id + * @param {String | Number} id */ - function chop (text, maxLength) { - return (text.length <= maxLength) ? text : (text.substr(0, 27) + '...'); - } + ItemSet.prototype.removeItem = function(id) { + var item = this.itemsData.get(id), + dataset = this.itemsData.getDataSet(); + + if (item) { + // confirm deletion + this.options.onRemove(item, function (item) { + if (item) { + // remove by id here, it is possible that an item has no id defined + // itself, so better not delete by the item itself + dataset.remove(id); + } + }); + } + }; /** - * Execute a function fn for each pair of elements in two arrays - * @param {Array | *} array1 - * @param {Array | *} array2 - * @param {function} fn + * Handle updated items + * @param {Number[]} ids + * @protected */ - function forEach2(array1, array2, fn) { - if (array1 instanceof Array) { - array1.forEach(function (elem1) { - if (array2 instanceof Array) { - array2.forEach(function (elem2) { - fn(elem1, elem2); - }); + ItemSet.prototype._onUpdate = function(ids) { + var me = this; + + ids.forEach(function (id) { + var itemData = me.itemsData.get(id, me.itemOptions), + item = me.items[id], + type = itemData.type || me.options.type || (itemData.end ? 'range' : 'box'); + + var constructor = ItemSet.types[type]; + + if (item) { + // update item + if (!constructor || !(item instanceof constructor)) { + // item type has changed, delete the item and recreate it + me._removeItem(item); + item = null; } else { - fn(elem1, array2); + me._updateItem(item, itemData); } - }); - } - else { - if (array2 instanceof Array) { - array2.forEach(function (elem2) { - fn(array1, elem2); - }); } - else { - fn(array1, array2); + + if (!item) { + // create item + if (constructor) { + item = new constructor(itemData, me.conversion, me.options); + item.id = id; // TODO: not so nice setting id afterwards + me._addItem(item); + } + else if (type == 'rangeoverflow') { + // TODO: deprecated since version 2.1.0 (or 3.0.0?). cleanup some day + throw new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: ' + + '.vis.timeline .item.range .content {overflow: visible;}'); + } + else { + throw new TypeError('Unknown item type "' + type + '"'); + } } - } - } + }); + + this._order(); + this.stackDirty = true; // force re-stacking of all items next redraw + this.body.emitter.emit('change'); + }; /** - * Convert a string containing a graph in DOT language into a map containing - * with nodes and edges in the format of graph. - * @param {String} data Text containing a graph in DOT-notation - * @return {Object} graphData + * Handle added items + * @param {Number[]} ids + * @protected */ - function DOTToGraph (data) { - // parse the DOT file - var dotData = parseDOT(data); - var graphData = { - nodes: [], - edges: [], - options: {} - }; + ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate; - // copy the nodes - if (dotData.nodes) { - dotData.nodes.forEach(function (dotNode) { - var graphNode = { - id: dotNode.id, - label: String(dotNode.label || dotNode.id) - }; - merge(graphNode, dotNode.attr); - if (graphNode.image) { - graphNode.shape = 'image'; - } - graphData.nodes.push(graphNode); - }); - } - - // copy the edges - if (dotData.edges) { - /** - * Convert an edge in DOT format to an edge with VisGraph format - * @param {Object} dotEdge - * @returns {Object} graphEdge - */ - function convertEdge(dotEdge) { - var graphEdge = { - from: dotEdge.from, - to: dotEdge.to - }; - merge(graphEdge, dotEdge.attr); - graphEdge.style = (dotEdge.type == '->') ? 'arrow' : 'line'; - return graphEdge; + /** + * Handle removed items + * @param {Number[]} ids + * @protected + */ + ItemSet.prototype._onRemove = function(ids) { + var count = 0; + var me = this; + ids.forEach(function (id) { + var item = me.items[id]; + if (item) { + count++; + me._removeItem(item); } + }); - dotData.edges.forEach(function (dotEdge) { - var from, to; - if (dotEdge.from instanceof Object) { - from = dotEdge.from.nodes; - } - else { - from = { - id: dotEdge.from - } - } + if (count) { + // update order + this._order(); + this.stackDirty = true; // force re-stacking of all items next redraw + this.body.emitter.emit('change'); + } + }; - if (dotEdge.to instanceof Object) { - to = dotEdge.to.nodes; - } - else { - to = { - id: dotEdge.to - } - } + /** + * Update the order of item in all groups + * @private + */ + ItemSet.prototype._order = function() { + // reorder the items in all groups + // TODO: optimization: only reorder groups affected by the changed items + util.forEach(this.groups, function (group) { + group.order(); + }); + }; - if (dotEdge.from instanceof Object && dotEdge.from.edges) { - dotEdge.from.edges.forEach(function (subEdge) { - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); + /** + * Handle updated groups + * @param {Number[]} ids + * @private + */ + ItemSet.prototype._onUpdateGroups = function(ids) { + this._onAddGroups(ids); + }; + + /** + * Handle changed groups + * @param {Number[]} ids + * @private + */ + ItemSet.prototype._onAddGroups = function(ids) { + var me = this; + + ids.forEach(function (id) { + var groupData = me.groupsData.get(id); + var group = me.groups[id]; + + if (!group) { + // check for reserved ids + if (id == UNGROUPED) { + throw new Error('Illegal group id. ' + id + ' is a reserved id.'); } - forEach2(from, to, function (from, to) { - var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr); - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); + var groupOptions = Object.create(me.options); + util.extend(groupOptions, { + height: null }); - if (dotEdge.to instanceof Object && dotEdge.to.edges) { - dotEdge.to.edges.forEach(function (subEdge) { - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); + group = new Group(id, groupData, me); + me.groups[id] = group; + + // add items with this groupId to the new group + for (var itemId in me.items) { + if (me.items.hasOwnProperty(itemId)) { + var item = me.items[itemId]; + if (item.data.group == id) { + group.add(item); + } + } } - }); - } - // copy the options - if (dotData.attr) { - graphData.options = dotData.attr; - } + group.order(); + group.show(); + } + else { + // update group + group.setData(groupData); + } + }); - return graphData; - } + this.body.emitter.emit('change'); + }; - // exports - exports.parseDOT = parseDOT; - exports.DOTToGraph = DOTToGraph; + /** + * Handle removed groups + * @param {Number[]} ids + * @private + */ + ItemSet.prototype._onRemoveGroups = function(ids) { + var groups = this.groups; + ids.forEach(function (id) { + var group = groups[id]; -})(typeof util !== 'undefined' ? util : exports); + if (group) { + group.hide(); + delete groups[id]; + } + }); -/** - * Canvas shapes used by Network - */ -if (typeof CanvasRenderingContext2D !== 'undefined') { + this.markDirty(); + + this.body.emitter.emit('change'); + }; /** - * Draw a circle shape + * Reorder the groups if needed + * @return {boolean} changed + * @private */ - CanvasRenderingContext2D.prototype.circle = function(x, y, r) { - this.beginPath(); - this.arc(x, y, r, 0, 2*Math.PI, false); + ItemSet.prototype._orderGroups = function () { + if (this.groupsData) { + // reorder the groups + var groupIds = this.groupsData.getIds({ + order: this.options.groupOrder + }); + + var changed = !util.equalArray(groupIds, this.groupIds); + if (changed) { + // hide all groups, removes them from the DOM + var groups = this.groups; + groupIds.forEach(function (groupId) { + groups[groupId].hide(); + }); + + // show the groups again, attach them to the DOM in correct order + groupIds.forEach(function (groupId) { + groups[groupId].show(); + }); + + this.groupIds = groupIds; + } + + return changed; + } + else { + return false; + } }; /** - * Draw a square shape - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r size, width and height of the square + * Add a new item + * @param {Item} item + * @private */ - CanvasRenderingContext2D.prototype.square = function(x, y, r) { - this.beginPath(); - this.rect(x - r, y - r, r * 2, r * 2); + ItemSet.prototype._addItem = function(item) { + this.items[item.id] = item; + + // add to group + var groupId = this.groupsData ? item.data.group : UNGROUPED; + var group = this.groups[groupId]; + if (group) group.add(item); }; /** - * Draw a triangle shape - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r radius, half the length of the sides of the triangle + * Update an existing item + * @param {Item} item + * @param {Object} itemData + * @private */ - CanvasRenderingContext2D.prototype.triangle = function(x, y, r) { - // http://en.wikipedia.org/wiki/Equilateral_triangle - this.beginPath(); + ItemSet.prototype._updateItem = function(item, itemData) { + var oldGroupId = item.data.group; + + item.data = itemData; + if (item.displayed) { + item.redraw(); + } - var s = r * 2; - var s2 = s / 2; - var ir = Math.sqrt(3) / 6 * s; // radius of inner circle - var h = Math.sqrt(s * s - s2 * s2); // height + // update group + if (oldGroupId != item.data.group) { + var oldGroup = this.groups[oldGroupId]; + if (oldGroup) oldGroup.remove(item); - this.moveTo(x, y - (h - ir)); - this.lineTo(x + s2, y + ir); - this.lineTo(x - s2, y + ir); - this.lineTo(x, y - (h - ir)); - this.closePath(); + var groupId = this.groupsData ? item.data.group : UNGROUPED; + var group = this.groups[groupId]; + if (group) group.add(item); + } }; /** - * Draw a triangle shape in downward orientation - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r radius + * Delete an item from the ItemSet: remove it from the DOM, from the map + * with items, and from the map with visible items, and from the selection + * @param {Item} item + * @private */ - CanvasRenderingContext2D.prototype.triangleDown = function(x, y, r) { - // http://en.wikipedia.org/wiki/Equilateral_triangle - this.beginPath(); + ItemSet.prototype._removeItem = function(item) { + // remove from DOM + item.hide(); + + // remove from items + delete this.items[item.id]; - var s = r * 2; - var s2 = s / 2; - var ir = Math.sqrt(3) / 6 * s; // radius of inner circle - var h = Math.sqrt(s * s - s2 * s2); // height + // remove from selection + var index = this.selection.indexOf(item.id); + if (index != -1) this.selection.splice(index, 1); - this.moveTo(x, y + (h - ir)); - this.lineTo(x + s2, y - ir); - this.lineTo(x - s2, y - ir); - this.lineTo(x, y + (h - ir)); - this.closePath(); + // remove from group + var groupId = this.groupsData ? item.data.group : UNGROUPED; + var group = this.groups[groupId]; + if (group) group.remove(item); }; /** - * Draw a star shape, a star with 5 points - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r radius, half the length of the sides of the triangle + * Create an array containing all items being a range (having an end date) + * @param array + * @returns {Array} + * @private */ - CanvasRenderingContext2D.prototype.star = function(x, y, r) { - // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ - this.beginPath(); + ItemSet.prototype._constructByEndArray = function(array) { + var endArray = []; - for (var n = 0; n < 10; n++) { - var radius = (n % 2 === 0) ? r * 1.3 : r * 0.5; - this.lineTo( - x + radius * Math.sin(n * 2 * Math.PI / 10), - y - radius * Math.cos(n * 2 * Math.PI / 10) - ); + for (var i = 0; i < array.length; i++) { + if (array[i] instanceof ItemRange) { + endArray.push(array[i]); + } } - - this.closePath(); + return endArray; }; /** - * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas + * Register the clicked item on touch, before dragStart is initiated. + * + * dragStart is initiated from a mousemove event, which can have left the item + * already resulting in an item == null + * + * @param {Event} event + * @private */ - CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) { - var r2d = Math.PI/180; - if( w - ( 2 * r ) < 0 ) { r = ( w / 2 ); } //ensure that the radius isn't too large for x - if( h - ( 2 * r ) < 0 ) { r = ( h / 2 ); } //ensure that the radius isn't too large for y - this.beginPath(); - this.moveTo(x+r,y); - this.lineTo(x+w-r,y); - this.arc(x+w-r,y+r,r,r2d*270,r2d*360,false); - this.lineTo(x+w,y+h-r); - this.arc(x+w-r,y+h-r,r,0,r2d*90,false); - this.lineTo(x+r,y+h); - this.arc(x+r,y+h-r,r,r2d*90,r2d*180,false); - this.lineTo(x,y+r); - this.arc(x+r,y+r,r,r2d*180,r2d*270,false); + ItemSet.prototype._onTouch = function (event) { + // store the touched item, used in _onDragStart + this.touchParams.item = ItemSet.itemFromTarget(event); }; /** - * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + * Start dragging the selected events + * @param {Event} event + * @private */ - CanvasRenderingContext2D.prototype.ellipse = function(x, y, w, h) { - var kappa = .5522848, - ox = (w / 2) * kappa, // control point offset horizontal - oy = (h / 2) * kappa, // control point offset vertical - xe = x + w, // x-end - ye = y + h, // y-end - xm = x + w / 2, // x-middle - ym = y + h / 2; // y-middle - - this.beginPath(); - this.moveTo(x, ym); - this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); - this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); - this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); - this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); - }; + ItemSet.prototype._onDragStart = function (event) { + if (!this.options.editable.updateTime && !this.options.editable.updateGroup) { + return; + } + var item = this.touchParams.item || null, + me = this, + props; + if (item && item.selected) { + var dragLeftItem = event.target.dragLeftItem; + var dragRightItem = event.target.dragRightItem; - /** - * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas - */ - CanvasRenderingContext2D.prototype.database = function(x, y, w, h) { - var f = 1/3; - var wEllipse = w; - var hEllipse = h * f; + if (dragLeftItem) { + props = { + item: dragLeftItem + }; - var kappa = .5522848, - ox = (wEllipse / 2) * kappa, // control point offset horizontal - oy = (hEllipse / 2) * kappa, // control point offset vertical - xe = x + wEllipse, // x-end - ye = y + hEllipse, // y-end - xm = x + wEllipse / 2, // x-middle - ym = y + hEllipse / 2, // y-middle - ymb = y + (h - hEllipse/2), // y-midlle, bottom ellipse - yeb = y + h; // y-end, bottom ellipse + if (me.options.editable.updateTime) { + props.start = item.data.start.valueOf(); + } + if (me.options.editable.updateGroup) { + if ('group' in item.data) props.group = item.data.group; + } - this.beginPath(); - this.moveTo(xe, ym); + this.touchParams.itemProps = [props]; + } + else if (dragRightItem) { + props = { + item: dragRightItem + }; - this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); - this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + if (me.options.editable.updateTime) { + props.end = item.data.end.valueOf(); + } + if (me.options.editable.updateGroup) { + if ('group' in item.data) props.group = item.data.group; + } - this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); - this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + this.touchParams.itemProps = [props]; + } + else { + this.touchParams.itemProps = this.getSelection().map(function (id) { + var item = me.items[id]; + var props = { + item: item + }; - this.lineTo(xe, ymb); + if (me.options.editable.updateTime) { + if ('start' in item.data) props.start = item.data.start.valueOf(); + if ('end' in item.data) props.end = item.data.end.valueOf(); + } + if (me.options.editable.updateGroup) { + if ('group' in item.data) props.group = item.data.group; + } - this.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb); - this.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb); + return props; + }); + } - this.lineTo(x, ym); + event.stopPropagation(); + } }; - /** - * Draw an arrow point (no line) + * Drag selected items + * @param {Event} event + * @private */ - CanvasRenderingContext2D.prototype.arrow = function(x, y, angle, length) { - // tail - var xt = x - length * Math.cos(angle); - var yt = y - length * Math.sin(angle); - - // inner tail - // TODO: allow to customize different shapes - var xi = x - length * 0.9 * Math.cos(angle); - var yi = y - length * 0.9 * Math.sin(angle); + ItemSet.prototype._onDrag = function (event) { + if (this.touchParams.itemProps) { + var range = this.body.range, + snap = this.body.util.snap || null, + deltaX = event.gesture.deltaX, + scale = (this.props.width / (range.end - range.start)), + offset = deltaX / scale; + + // move + this.touchParams.itemProps.forEach(function (props) { + if ('start' in props) { + var start = new Date(props.start + offset); + props.item.data.start = snap ? snap(start) : start; + } + + if ('end' in props) { + var end = new Date(props.end + offset); + props.item.data.end = snap ? snap(end) : end; + } + + if ('group' in props) { + // drag from one group to another + var group = ItemSet.groupFromTarget(event); + if (group && group.groupId != props.item.data.group) { + var oldGroup = props.item.parent; + oldGroup.remove(props.item); + oldGroup.order(); + group.add(props.item); + group.order(); + + props.item.data.group = group.groupId; + } + } + }); - // left - var xl = xt + length / 3 * Math.cos(angle + 0.5 * Math.PI); - var yl = yt + length / 3 * Math.sin(angle + 0.5 * Math.PI); + // TODO: implement onMoving handler - // right - var xr = xt + length / 3 * Math.cos(angle - 0.5 * Math.PI); - var yr = yt + length / 3 * Math.sin(angle - 0.5 * Math.PI); + this.stackDirty = true; // force re-stacking of all items next redraw + this.body.emitter.emit('change'); - this.beginPath(); - this.moveTo(x, y); - this.lineTo(xl, yl); - this.lineTo(xi, yi); - this.lineTo(xr, yr); - this.closePath(); + event.stopPropagation(); + } }; /** - * Sets up the dashedLine functionality for drawing - * Original code came from http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas - * @author David Jordan - * @date 2012-08-08 + * End of dragging selected items + * @param {Event} event + * @private */ - CanvasRenderingContext2D.prototype.dashedLine = function(x,y,x2,y2,dashArray){ - if (!dashArray) dashArray=[10,5]; - if (dashLength==0) dashLength = 0.001; // Hack for Safari - var dashCount = dashArray.length; - this.moveTo(x, y); - var dx = (x2-x), dy = (y2-y); - var slope = dy/dx; - var distRemaining = Math.sqrt( dx*dx + dy*dy ); - var dashIndex=0, draw=true; - while (distRemaining>=0.1){ - var dashLength = dashArray[dashIndex++%dashCount]; - if (dashLength > distRemaining) dashLength = distRemaining; - var xStep = Math.sqrt( dashLength*dashLength / (1 + slope*slope) ); - if (dx<0) xStep = -xStep; - x += xStep; - y += slope*xStep; - this[draw ? 'lineTo' : 'moveTo'](x,y); - distRemaining -= dashLength; - draw = !draw; - } - }; - - // TODO: add diamond shape -} - -/** - * @class Node - * A node. A node can be connected to other nodes via one or multiple edges. - * @param {object} properties An object containing properties for the node. All - * properties are optional, except for the id. - * {number} id Id of the node. Required - * {string} label Text label for the node - * {number} x Horizontal position of the node - * {number} y Vertical position of the node - * {string} shape Node shape, available: - * "database", "circle", "ellipse", - * "box", "image", "text", "dot", - * "star", "triangle", "triangleDown", - * "square" - * {string} image An image url - * {string} title An title text, can be HTML - * {anytype} group A group name or number - * @param {Network.Images} imagelist A list with images. Only needed - * when the node has an image - * @param {Network.Groups} grouplist A list with groups. Needed for - * retrieving group properties - * @param {Object} constants An object with default values for - * example for the color - * - */ -function Node(properties, imagelist, grouplist, constants) { - this.selected = false; - this.hover = false; - - this.edges = []; // all edges connected to this node - this.dynamicEdges = []; - this.reroutedEdges = {}; - - this.group = constants.nodes.group; - this.fontSize = Number(constants.nodes.fontSize); - this.fontFace = constants.nodes.fontFace; - this.fontColor = constants.nodes.fontColor; - this.fontDrawThreshold = 3; - - this.color = constants.nodes.color; - - // set defaults for the properties - this.id = undefined; - this.shape = constants.nodes.shape; - this.image = constants.nodes.image; - this.x = null; - this.y = null; - this.xFixed = false; - this.yFixed = false; - this.horizontalAlignLeft = true; // these are for the navigation controls - this.verticalAlignTop = true; // these are for the navigation controls - this.radius = constants.nodes.radius; - this.baseRadiusValue = constants.nodes.radius; - this.radiusFixed = false; - this.radiusMin = constants.nodes.radiusMin; - this.radiusMax = constants.nodes.radiusMax; - this.level = -1; - this.preassignedLevel = false; - - - this.imagelist = imagelist; - this.grouplist = grouplist; - - // physics properties - this.fx = 0.0; // external force x - this.fy = 0.0; // external force y - this.vx = 0.0; // velocity x - this.vy = 0.0; // velocity y - this.minForce = constants.minForce; - this.damping = constants.physics.damping; - this.mass = 1; // kg - this.fixedData = {x:null,y:null}; - - this.setProperties(properties, constants); - - // creating the variables for clustering - this.resetCluster(); - this.dynamicEdgesLength = 0; - this.clusterSession = 0; - this.clusterSizeWidthFactor = constants.clustering.nodeScaling.width; - this.clusterSizeHeightFactor = constants.clustering.nodeScaling.height; - this.clusterSizeRadiusFactor = constants.clustering.nodeScaling.radius; - this.maxNodeSizeIncrements = constants.clustering.maxNodeSizeIncrements; - this.growthIndicator = 0; - - // variables to tell the node about the network. - this.networkScaleInv = 1; - this.networkScale = 1; - this.canvasTopLeft = {"x": -300, "y": -300}; - this.canvasBottomRight = {"x": 300, "y": 300}; - this.parentEdgeId = null; -} - -/** - * (re)setting the clustering variables and objects - */ -Node.prototype.resetCluster = function() { - // clustering variables - this.formationScale = undefined; // this is used to determine when to open the cluster - this.clusterSize = 1; // this signifies the total amount of nodes in this cluster - this.containedNodes = {}; - this.containedEdges = {}; - this.clusterSessions = []; -}; - -/** - * Attach a edge to the node - * @param {Edge} edge - */ -Node.prototype.attachEdge = function(edge) { - if (this.edges.indexOf(edge) == -1) { - this.edges.push(edge); - } - if (this.dynamicEdges.indexOf(edge) == -1) { - this.dynamicEdges.push(edge); - } - this.dynamicEdgesLength = this.dynamicEdges.length; -}; - -/** - * Detach a edge from the node - * @param {Edge} edge - */ -Node.prototype.detachEdge = function(edge) { - var index = this.edges.indexOf(edge); - if (index != -1) { - this.edges.splice(index, 1); - this.dynamicEdges.splice(index, 1); - } - this.dynamicEdgesLength = this.dynamicEdges.length; -}; - + ItemSet.prototype._onDragEnd = function (event) { + if (this.touchParams.itemProps) { + // prepare a change set for the changed items + var changes = [], + me = this, + dataset = this.itemsData.getDataSet(); + + this.touchParams.itemProps.forEach(function (props) { + var id = props.item.id, + itemData = me.itemsData.get(id, me.itemOptions); + + var changed = false; + if ('start' in props.item.data) { + changed = (props.start != props.item.data.start.valueOf()); + itemData.start = util.convert(props.item.data.start, + dataset._options.type && dataset._options.type.start || 'Date'); + } + if ('end' in props.item.data) { + changed = changed || (props.end != props.item.data.end.valueOf()); + itemData.end = util.convert(props.item.data.end, + dataset._options.type && dataset._options.type.end || 'Date'); + } + if ('group' in props.item.data) { + changed = changed || (props.group != props.item.data.group); + itemData.group = props.item.data.group; + } + + // only apply changes when start or end is actually changed + if (changed) { + me.options.onMove(itemData, function (itemData) { + if (itemData) { + // apply changes + itemData[dataset._fieldId] = id; // ensure the item contains its id (can be undefined) + changes.push(itemData); + } + else { + // restore original values + if ('start' in props) props.item.data.start = props.start; + if ('end' in props) props.item.data.end = props.end; -/** - * Set or overwrite properties for the node - * @param {Object} properties an object with properties - * @param {Object} constants and object with default, global properties - */ -Node.prototype.setProperties = function(properties, constants) { - if (!properties) { - return; - } - this.originalLabel = undefined; - // basic properties - if (properties.id !== undefined) {this.id = properties.id;} - if (properties.label !== undefined) {this.label = properties.label; this.originalLabel = properties.label;} - if (properties.title !== undefined) {this.title = properties.title;} - if (properties.group !== undefined) {this.group = properties.group;} - if (properties.x !== undefined) {this.x = properties.x;} - if (properties.y !== undefined) {this.y = properties.y;} - if (properties.value !== undefined) {this.value = properties.value;} - if (properties.level !== undefined) {this.level = properties.level; this.preassignedLevel = true;} - - - // physics - if (properties.mass !== undefined) {this.mass = properties.mass;} - - // navigation controls properties - if (properties.horizontalAlignLeft !== undefined) {this.horizontalAlignLeft = properties.horizontalAlignLeft;} - if (properties.verticalAlignTop !== undefined) {this.verticalAlignTop = properties.verticalAlignTop;} - if (properties.triggerFunction !== undefined) {this.triggerFunction = properties.triggerFunction;} - - if (this.id === undefined) { - throw "Node must have an id"; - } + me.stackDirty = true; // force re-stacking of all items next redraw + me.body.emitter.emit('change'); + } + }); + } + }); + this.touchParams.itemProps = null; - // copy group properties - if (this.group) { - var groupObj = this.grouplist.get(this.group); - for (var prop in groupObj) { - if (groupObj.hasOwnProperty(prop)) { - this[prop] = groupObj[prop]; + // apply the changes to the data (if there are changes) + if (changes.length) { + dataset.update(changes); } - } - } - // individual shape properties - if (properties.shape !== undefined) {this.shape = properties.shape;} - if (properties.image !== undefined) {this.image = properties.image;} - if (properties.radius !== undefined) {this.radius = properties.radius;} - if (properties.color !== undefined) {this.color = util.parseColor(properties.color);} + event.stopPropagation(); + } + }; - if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} - if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} - if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} + /** + * Handle selecting/deselecting an item when tapping it + * @param {Event} event + * @private + */ + ItemSet.prototype._onSelectItem = function (event) { + if (!this.options.selectable) return; - if (this.image !== undefined && this.image != "") { - if (this.imagelist) { - this.imageObj = this.imagelist.load(this.image); - } - else { - throw "No imagelist provided"; + var ctrlKey = event.gesture.srcEvent && event.gesture.srcEvent.ctrlKey; + var shiftKey = event.gesture.srcEvent && event.gesture.srcEvent.shiftKey; + if (ctrlKey || shiftKey) { + this._onMultiSelectItem(event); + return; } - } - this.xFixed = this.xFixed || (properties.x !== undefined && !properties.allowedToMoveX); - this.yFixed = this.yFixed || (properties.y !== undefined && !properties.allowedToMoveY); - this.radiusFixed = this.radiusFixed || (properties.radius !== undefined); + var oldSelection = this.getSelection(); - if (this.shape == 'image') { - this.radiusMin = constants.nodes.widthMin; - this.radiusMax = constants.nodes.widthMax; - } + var item = ItemSet.itemFromTarget(event); + var selection = item ? [item.id] : []; + this.setSelection(selection); - // choose draw method depending on the shape - switch (this.shape) { - case 'database': this.draw = this._drawDatabase; this.resize = this._resizeDatabase; break; - case 'box': this.draw = this._drawBox; this.resize = this._resizeBox; break; - case 'circle': this.draw = this._drawCircle; this.resize = this._resizeCircle; break; - case 'ellipse': this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break; - // TODO: add diamond shape - case 'image': this.draw = this._drawImage; this.resize = this._resizeImage; break; - case 'text': this.draw = this._drawText; this.resize = this._resizeText; break; - case 'dot': this.draw = this._drawDot; this.resize = this._resizeShape; break; - case 'square': this.draw = this._drawSquare; this.resize = this._resizeShape; break; - case 'triangle': this.draw = this._drawTriangle; this.resize = this._resizeShape; break; - case 'triangleDown': this.draw = this._drawTriangleDown; this.resize = this._resizeShape; break; - case 'star': this.draw = this._drawStar; this.resize = this._resizeShape; break; - default: this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break; - } - // reset the size of the node, this can be changed - this._reset(); -}; + var newSelection = this.getSelection(); -/** - * select this node - */ -Node.prototype.select = function() { - this.selected = true; - this._reset(); -}; + // emit a select event, + // except when old selection is empty and new selection is still empty + if (newSelection.length > 0 || oldSelection.length > 0) { + this.body.emitter.emit('select', { + items: this.getSelection() + }); + } -/** - * unselect this node - */ -Node.prototype.unselect = function() { - this.selected = false; - this._reset(); -}; + event.stopPropagation(); + }; + /** + * Handle creation and updates of an item on double tap + * @param event + * @private + */ + ItemSet.prototype._onAddItem = function (event) { + if (!this.options.selectable) return; + if (!this.options.editable.add) return; -/** - * Reset the calculated size of the node, forces it to recalculate its size - */ -Node.prototype.clearSizeCache = function() { - this._reset(); -}; + var me = this, + snap = this.body.util.snap || null, + item = ItemSet.itemFromTarget(event); -/** - * Reset the calculated size of the node, forces it to recalculate its size - * @private - */ -Node.prototype._reset = function() { - this.width = undefined; - this.height = undefined; -}; + if (item) { + // update item -/** - * get the title of this node. - * @return {string} title The title of the node, or undefined when no title - * has been set. - */ -Node.prototype.getTitle = function() { - return typeof this.title === "function" ? this.title() : this.title; -}; + // execute async handler to update the item (or cancel it) + var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset + this.options.onUpdate(itemData, function (itemData) { + if (itemData) { + me.itemsData.update(itemData); + } + }); + } + else { + // add item + var xAbs = util.getAbsoluteLeft(this.dom.frame); + var x = event.gesture.center.pageX - xAbs; + var start = this.body.util.toTime(x); + var newItem = { + start: snap ? snap(start) : start, + content: 'new item' + }; -/** - * Calculate the distance to the border of the Node - * @param {CanvasRenderingContext2D} ctx - * @param {Number} angle Angle in radians - * @returns {number} distance Distance to the border in pixels - */ -Node.prototype.distanceToBorder = function (ctx, angle) { - var borderWidth = 1; + // when default type is a range, add a default end date to the new item + if (this.options.type === 'range') { + var end = this.body.util.toTime(x + this.props.width / 5); + newItem.end = snap ? snap(end) : end; + } - if (!this.width) { - this.resize(ctx); - } + newItem[this.itemsData.fieldId] = util.randomUUID(); - switch (this.shape) { - case 'circle': - case 'dot': - return this.radius + borderWidth; - - case 'ellipse': - var a = this.width / 2; - var b = this.height / 2; - var w = (Math.sin(angle) * a); - var h = (Math.cos(angle) * b); - return a * b / Math.sqrt(w * w + h * h); - - // TODO: implement distanceToBorder for database - // TODO: implement distanceToBorder for triangle - // TODO: implement distanceToBorder for triangleDown - - case 'box': - case 'image': - case 'text': - default: - if (this.width) { - return Math.min( - Math.abs(this.width / 2 / Math.cos(angle)), - Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; - // TODO: reckon with border radius too in case of box + var group = ItemSet.groupFromTarget(event); + if (group) { + newItem.group = group.groupId; } - else { - return 0; - } - - } - // TODO: implement calculation of distance to border for all shapes -}; - -/** - * Set forces acting on the node - * @param {number} fx Force in horizontal direction - * @param {number} fy Force in vertical direction - */ -Node.prototype._setForce = function(fx, fy) { - this.fx = fx; - this.fy = fy; -}; - -/** - * Add forces acting on the node - * @param {number} fx Force in horizontal direction - * @param {number} fy Force in vertical direction - * @private - */ -Node.prototype._addForce = function(fx, fy) { - this.fx += fx; - this.fy += fy; -}; - -/** - * Perform one discrete step for the node - * @param {number} interval Time interval in seconds - */ -Node.prototype.discreteStep = function(interval) { - if (!this.xFixed) { - var dx = this.damping * this.vx; // damping force - var ax = (this.fx - dx) / this.mass; // acceleration - this.vx += ax * interval; // velocity - this.x += this.vx * interval; // position - } - - if (!this.yFixed) { - var dy = this.damping * this.vy; // damping force - var ay = (this.fy - dy) / this.mass; // acceleration - this.vy += ay * interval; // velocity - this.y += this.vy * interval; // position - } -}; + // execute async handler to customize (or cancel) adding an item + this.options.onAdd(newItem, function (item) { + if (item) { + me.itemsData.add(newItem); + // TODO: need to trigger a redraw? + } + }); + } + }; + /** + * Handle selecting/deselecting multiple items when holding an item + * @param {Event} event + * @private + */ + ItemSet.prototype._onMultiSelectItem = function (event) { + if (!this.options.selectable) return; -/** - * Perform one discrete step for the node - * @param {number} interval Time interval in seconds - * @param {number} maxVelocity The speed limit imposed on the velocity - */ -Node.prototype.discreteStepLimited = function(interval, maxVelocity) { - if (!this.xFixed) { - var dx = this.damping * this.vx; // damping force - var ax = (this.fx - dx) / this.mass; // acceleration - this.vx += ax * interval; // velocity - this.vx = (Math.abs(this.vx) > maxVelocity) ? ((this.vx > 0) ? maxVelocity : -maxVelocity) : this.vx; - this.x += this.vx * interval; // position - } - else { - this.fx = 0; - } - - if (!this.yFixed) { - var dy = this.damping * this.vy; // damping force - var ay = (this.fy - dy) / this.mass; // acceleration - this.vy += ay * interval; // velocity - this.vy = (Math.abs(this.vy) > maxVelocity) ? ((this.vy > 0) ? maxVelocity : -maxVelocity) : this.vy; - this.y += this.vy * interval; // position - } - else { - this.fy = 0; - } -}; - -/** - * Check if this node has a fixed x and y position - * @return {boolean} true if fixed, false if not - */ -Node.prototype.isFixed = function() { - return (this.xFixed && this.yFixed); -}; + var selection, + item = ItemSet.itemFromTarget(event); -/** - * Check if this node is moving - * @param {number} vmin the minimum velocity considered as "moving" - * @return {boolean} true if moving, false if it has no velocity - */ -// TODO: replace this method with calculating the kinetic energy -Node.prototype.isMoving = function(vmin) { - return (Math.abs(this.vx) > vmin || Math.abs(this.vy) > vmin); -}; + if (item) { + // multi select items + selection = this.getSelection(); // current selection + var index = selection.indexOf(item.id); + if (index == -1) { + // item is not yet selected -> select it + selection.push(item.id); + } + else { + // item is already selected -> deselect it + selection.splice(index, 1); + } + this.setSelection(selection); -/** - * check if this node is selecte - * @return {boolean} selected True if node is selected, else false - */ -Node.prototype.isSelected = function() { - return this.selected; -}; + this.body.emitter.emit('select', { + items: this.getSelection() + }); -/** - * Retrieve the value of the node. Can be undefined - * @return {Number} value - */ -Node.prototype.getValue = function() { - return this.value; -}; + event.stopPropagation(); + } + }; -/** - * Calculate the distance from the nodes location to the given location (x,y) - * @param {Number} x - * @param {Number} y - * @return {Number} value - */ -Node.prototype.getDistance = function(x, y) { - var dx = this.x - x, - dy = this.y - y; - return Math.sqrt(dx * dx + dy * dy); -}; + /** + * Find an item from an event target: + * searches for the attribute 'timeline-item' in the event target's element tree + * @param {Event} event + * @return {Item | null} item + */ + ItemSet.itemFromTarget = function(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('timeline-item')) { + return target['timeline-item']; + } + target = target.parentNode; + } + return null; + }; -/** - * Adjust the value range of the node. The node will adjust it's radius - * based on its value. - * @param {Number} min - * @param {Number} max - */ -Node.prototype.setValueRange = function(min, max) { - if (!this.radiusFixed && this.value !== undefined) { - if (max == min) { - this.radius = (this.radiusMin + this.radiusMax) / 2; - } - else { - var scale = (this.radiusMax - this.radiusMin) / (max - min); - this.radius = (this.value - min) * scale + this.radiusMin; + /** + * Find the Group from an event target: + * searches for the attribute 'timeline-group' in the event target's element tree + * @param {Event} event + * @return {Group | null} group + */ + ItemSet.groupFromTarget = function(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('timeline-group')) { + return target['timeline-group']; + } + target = target.parentNode; } - } - this.baseRadiusValue = this.radius; -}; - -/** - * Draw this node in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - */ -Node.prototype.draw = function(ctx) { - throw "Draw method not initialized for node"; -}; -/** - * Recalculate the size of this node in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - */ -Node.prototype.resize = function(ctx) { - throw "Resize method not initialized for node"; -}; + return null; + }; -/** - * Check if this object is overlapping with the provided object - * @param {Object} obj an object with parameters left, top, right, bottom - * @return {boolean} True if location is located on node - */ -Node.prototype.isOverlappingWith = function(obj) { - return (this.left < obj.right && - this.left + this.width > obj.left && - this.top < obj.bottom && - this.top + this.height > obj.top); -}; - -Node.prototype._resizeImage = function (ctx) { - // TODO: pre calculate the image size - - if (!this.width || !this.height) { // undefined or 0 - var width, height; - if (this.value) { - this.radius = this.baseRadiusValue; - var scale = this.imageObj.height / this.imageObj.width; - if (scale !== undefined) { - width = this.radius || this.imageObj.width; - height = this.radius * scale || this.imageObj.height; - } - else { - width = 0; - height = 0; + /** + * Find the ItemSet from an event target: + * searches for the attribute 'timeline-itemset' in the event target's element tree + * @param {Event} event + * @return {ItemSet | null} item + */ + ItemSet.itemSetFromTarget = function(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('timeline-itemset')) { + return target['timeline-itemset']; } + target = target.parentNode; } - else { - width = this.imageObj.width; - height = this.imageObj.height; - } - this.width = width; - this.height = height; - this.growthIndicator = 0; - if (this.width > 0 && this.height > 0) { - this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; - this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; - this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; - this.growthIndicator = this.width - width; - } - } + return null; + }; -}; + module.exports = ItemSet; -Node.prototype._drawImage = function (ctx) { - this._resizeImage(ctx); - this.left = this.x - this.width / 2; - this.top = this.y - this.height / 2; +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { - var yLabel; - if (this.imageObj.width != 0 ) { - // draw the shade - if (this.clusterSize > 1) { - var lineWidth = ((this.clusterSize > 1) ? 10 : 0.0); - lineWidth *= this.networkScaleInv; - lineWidth = Math.min(0.2 * this.width,lineWidth); + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(2); + var Component = __webpack_require__(18); - ctx.globalAlpha = 0.5; - ctx.drawImage(this.imageObj, this.left - lineWidth, this.top - lineWidth, this.width + 2*lineWidth, this.height + 2*lineWidth); + /** + * Legend for Graph2d + */ + function Legend(body, options, side) { + this.body = body; + this.defaultOptions = { + enabled: true, + icons: true, + iconSize: 20, + iconSpacing: 6, + left: { + visible: true, + position: 'top-left' // top/bottom - left,center,right + }, + right: { + visible: true, + position: 'top-left' // top/bottom - left,center,right + } } + this.side = side; + this.options = util.extend({},this.defaultOptions); - // draw the image - ctx.globalAlpha = 1.0; - ctx.drawImage(this.imageObj, this.left, this.top, this.width, this.height); - yLabel = this.y + this.height / 2; - } - else { - // image still loading... just draw the label for now - yLabel = this.y; - } - - this._label(ctx, this.label, this.x, yLabel, undefined, "top"); -}; + this.svgElements = {}; + this.dom = {}; + this.groups = {}; + this.amountOfGroups = 0; + this._create(); + this.setOptions(options); + } -Node.prototype._resizeBox = function (ctx) { - if (!this.width) { - var margin = 5; - var textSize = this.getTextSize(ctx); - this.width = textSize.width + 2 * margin; - this.height = textSize.height + 2 * margin; + Legend.prototype = new Component(); - this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor; - this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor; - this.growthIndicator = this.width - (textSize.width + 2 * margin); -// this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; - } -}; + Legend.prototype.addGroup = function(label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; + }; -Node.prototype._drawBox = function (ctx) { - this._resizeBox(ctx); + Legend.prototype.updateGroup = function(label, graphOptions) { + this.groups[label] = graphOptions; + }; - this.left = this.x - this.width / 2; - this.top = this.y - this.height / 2; + Legend.prototype.removeGroup = function(label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } + }; - var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + Legend.prototype._create = function() { + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'legend'; + this.dom.frame.style.position = "absolute"; + this.dom.frame.style.top = "10px"; + this.dom.frame.style.display = "block"; + + this.dom.textArea = document.createElement('div'); + this.dom.textArea.className = 'legendText'; + this.dom.textArea.style.position = "relative"; + this.dom.textArea.style.top = "0px"; + + this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); + this.svg.style.position = 'absolute'; + this.svg.style.top = 0 +'px'; + this.svg.style.width = this.options.iconSize + 5 + 'px'; + + this.dom.frame.appendChild(this.svg); + this.dom.frame.appendChild(this.dom.textArea); + }; - ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + /** + * Hide the component from the DOM + */ + Legend.prototype.hide = function() { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + }; - // draw the outer border - if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + /** + * Show the component in the DOM (when not already visible). + * @return {Boolean} changed + */ + Legend.prototype.show = function() { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + }; - ctx.roundRect(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth, this.radius); - ctx.stroke(); - } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + Legend.prototype.setOptions = function(options) { + var fields = ['enabled','orientation','icons','left','right']; + util.selectiveDeepExtend(fields, this.options, options); + }; - ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background; + Legend.prototype.redraw = function() { + if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false) { + this.hide(); + } + else { + this.show(); + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') { + this.dom.frame.style.left = '4px'; + this.dom.frame.style.textAlign = "left"; + this.dom.textArea.style.textAlign = "left"; + this.dom.textArea.style.left = (this.options.iconSize + 15) + 'px'; + this.dom.textArea.style.right = ''; + this.svg.style.left = 0 +'px'; + this.svg.style.right = ''; + } + else { + this.dom.frame.style.right = '4px'; + this.dom.frame.style.textAlign = "right"; + this.dom.textArea.style.textAlign = "right"; + this.dom.textArea.style.right = (this.options.iconSize + 15) + 'px'; + this.dom.textArea.style.left = ''; + this.svg.style.right = 0 +'px'; + this.svg.style.left = ''; + } - ctx.roundRect(this.left, this.top, this.width, this.height, this.radius); - ctx.fill(); - ctx.stroke(); + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') { + this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px","")) + 'px'; + this.dom.frame.style.bottom = ''; + } + else { + this.dom.frame.style.bottom = 4 - Number(this.body.dom.center.style.top.replace("px","")) + 'px'; + this.dom.frame.style.top = ''; + } - this._label(ctx, this.label, this.x, this.y); -}; + if (this.options.icons == false) { + this.dom.frame.style.width = this.dom.textArea.offsetWidth + 10 + 'px'; + this.dom.textArea.style.right = ''; + this.dom.textArea.style.left = ''; + this.svg.style.width = '0px'; + } + else { + this.dom.frame.style.width = this.options.iconSize + 15 + this.dom.textArea.offsetWidth + 10 + 'px' + this.drawLegendIcons(); + } + var content = ''; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + content += this.groups[groupId].content + '
'; + } + } + this.dom.textArea.innerHTML = content; + this.dom.textArea.style.lineHeight = ((0.75 * this.options.iconSize) + this.options.iconSpacing) + 'px'; + } + }; -Node.prototype._resizeDatabase = function (ctx) { - if (!this.width) { - var margin = 5; - var textSize = this.getTextSize(ctx); - var size = textSize.width + 2 * margin; - this.width = size; - this.height = size; + Legend.prototype.drawLegendIcons = function() { + if (this.dom.frame.parentNode) { + DOMutil.prepareElements(this.svgElements); + var padding = window.getComputedStyle(this.dom.frame).paddingTop; + var iconOffset = Number(padding.replace('px','')); + var x = iconOffset; + var iconWidth = this.options.iconSize; + var iconHeight = 0.75 * this.options.iconSize; + var y = iconOffset + 0.5 * iconHeight + 3; - // scaling used for clustering - this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; - this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; - this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; - this.growthIndicator = this.width - size; - } -}; + this.svg.style.width = iconWidth + 5 + iconOffset + 'px'; -Node.prototype._drawDatabase = function (ctx) { - this._resizeDatabase(ctx); - this.left = this.x - this.width / 2; - this.top = this.y - this.height / 2; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight); + y += iconHeight + this.options.iconSpacing; + } + } - var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + DOMutil.cleanupElements(this.svgElements); + } + }; - ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + module.exports = Legend; - // draw the outer border - if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); - ctx.database(this.x - this.width/2 - 2*ctx.lineWidth, this.y - this.height*0.5 - 2*ctx.lineWidth, this.width + 4*ctx.lineWidth, this.height + 4*ctx.lineWidth); - ctx.stroke(); - } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); - - ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; - ctx.database(this.x - this.width/2, this.y - this.height*0.5, this.width, this.height); - ctx.fill(); - ctx.stroke(); - - this._label(ctx, this.label, this.x, this.y); -}; - - -Node.prototype._resizeCircle = function (ctx) { - if (!this.width) { - var margin = 5; - var textSize = this.getTextSize(ctx); - var diameter = Math.max(textSize.width, textSize.height) + 2 * margin; - this.radius = diameter / 2; - - this.width = diameter; - this.height = diameter; - - // scaling used for clustering -// this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor; -// this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor; - this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; - this.growthIndicator = this.radius - 0.5*diameter; - } -}; +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { -Node.prototype._drawCircle = function (ctx) { - this._resizeCircle(ctx); - this.left = this.x - this.width / 2; - this.top = this.y - this.height / 2; + var util = __webpack_require__(1); + var DOMutil = __webpack_require__(2); + var DataSet = __webpack_require__(3); + var DataView = __webpack_require__(4); + var Component = __webpack_require__(18); + var DataAxis = __webpack_require__(21); + var GraphGroup = __webpack_require__(22); + var Legend = __webpack_require__(25); - var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items - ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + /** + * This is the constructor of the LineGraph. It requires a Timeline body and options. + * + * @param body + * @param options + * @constructor + */ + function LineGraph(body, options) { + this.id = util.randomUUID(); + this.body = body; + + this.defaultOptions = { + yAxisOrientation: 'left', + defaultGroup: 'default', + sort: true, + sampling: true, + graphHeight: '400px', + shaded: { + enabled: false, + orientation: 'bottom' // top, bottom + }, + style: 'line', // line, bar + barChart: { + width: 50, + align: 'center' // left, center, right + }, + catmullRom: { + enabled: true, + parametrization: 'centripetal', // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + alpha: 0.5 + }, + drawPoints: { + enabled: true, + size: 6, + style: 'square' // square, circle + }, + dataAxis: { + showMinorLabels: true, + showMajorLabels: true, + icons: false, + width: '40px', + visible: true + }, + legend: { + enabled: false, + icons: true, + left: { + visible: true, + position: 'top-left' // top/bottom - left,right + }, + right: { + visible: true, + position: 'top-right' // top/bottom - left,right + } + } + }; - // draw the outer border - if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + // options is shared by this ItemSet and all its items + this.options = util.extend({}, this.defaultOptions); + this.dom = {}; + this.props = {}; + this.hammer = null; + this.groups = {}; - ctx.circle(this.x, this.y, this.radius+2*ctx.lineWidth); - ctx.stroke(); - } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + var me = this; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet - ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; - ctx.circle(this.x, this.y, this.radius); - ctx.fill(); - ctx.stroke(); + // listeners for the DataSet of the items + this.itemListeners = { + 'add': function (event, params, senderId) { + me._onAdd(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdate(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemove(params.items); + } + }; - this._label(ctx, this.label, this.x, this.y); -}; + // listeners for the DataSet of the groups + this.groupListeners = { + 'add': function (event, params, senderId) { + me._onAddGroups(params.items); + }, + 'update': function (event, params, senderId) { + me._onUpdateGroups(params.items); + }, + 'remove': function (event, params, senderId) { + me._onRemoveGroups(params.items); + } + }; -Node.prototype._resizeEllipse = function (ctx) { - if (!this.width) { - var textSize = this.getTextSize(ctx); + this.items = {}; // object with an Item for every data item + this.selection = []; // list with the ids of all selected nodes + this.lastStart = this.body.range.start; + this.touchParams = {}; // stores properties while dragging - this.width = textSize.width * 1.5; - this.height = textSize.height * 2; - if (this.width < this.height) { - this.width = this.height; - } - var defaultSize = this.width; + this.svgElements = {}; + this.setOptions(options); + this.groupsUsingDefaultStyles = [0]; + + this.body.emitter.on("rangechange",function() { + if (me.lastStart != 0) { + var offset = me.body.range.start - me.lastStart; + var range = me.body.range.end - me.body.range.start; + if (me.width != 0) { + var rangePerPixelInv = me.width/range; + var xOffset = offset * rangePerPixelInv; + me.svg.style.left = (-me.width - xOffset) + "px"; + } + } + }); + this.body.emitter.on("rangechanged", function() { + me.lastStart = me.body.range.start; + me.svg.style.left = util.option.asSize(-me.width); + me._updateGraph.apply(me); + }); - // scaling used for clustering - this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; - this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; - this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; - this.growthIndicator = this.width - defaultSize; + // create the HTML DOM + this._create(); + this.body.emitter.emit("change"); } -}; -Node.prototype._drawEllipse = function (ctx) { - this._resizeEllipse(ctx); - this.left = this.x - this.width / 2; - this.top = this.y - this.height / 2; + LineGraph.prototype = new Component(); - var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + /** + * Create the HTML DOM for the ItemSet + */ + LineGraph.prototype._create = function(){ + var frame = document.createElement('div'); + frame.className = 'LineGraph'; + this.dom.frame = frame; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg',"svg"); + this.svg.style.position = "relative"; + this.svg.style.height = ('' + this.options.graphHeight).replace("px",'') + 'px'; + this.svg.style.display = "block"; + frame.appendChild(this.svg); + + // data axis + this.options.dataAxis.orientation = 'left'; + this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg); + + this.options.dataAxis.orientation = 'right'; + this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg); + delete this.options.dataAxis.orientation; + + // legends + this.legendLeft = new Legend(this.body, this.options.legend, 'left'); + this.legendRight = new Legend(this.body, this.options.legend, 'right'); - ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + this.show(); + }; - // draw the outer border - if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + /** + * set the options of the LineGraph. the mergeOptions is used for subObjects that have an enabled element. + * @param options + */ + LineGraph.prototype.setOptions = function(options) { + if (options) { + var fields = ['sampling','defaultGroup','graphHeight','yAxisOrientation','style','barChart','dataAxis','sort']; + util.selectiveDeepExtend(fields, this.options, options); + util.mergeOptions(this.options, options,'catmullRom'); + util.mergeOptions(this.options, options,'drawPoints'); + util.mergeOptions(this.options, options,'shaded'); + util.mergeOptions(this.options, options,'legend'); + + if (options.catmullRom) { + if (typeof options.catmullRom == 'object') { + if (options.catmullRom.parametrization) { + if (options.catmullRom.parametrization == 'uniform') { + this.options.catmullRom.alpha = 0; + } + else if (options.catmullRom.parametrization == 'chordal') { + this.options.catmullRom.alpha = 1.0; + } + else { + this.options.catmullRom.parametrization = 'centripetal'; + this.options.catmullRom.alpha = 0.5; + } + } + } + } - ctx.ellipse(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth); - ctx.stroke(); - } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); - - ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; - - ctx.ellipse(this.left, this.top, this.width, this.height); - ctx.fill(); - ctx.stroke(); - this._label(ctx, this.label, this.x, this.y); -}; - -Node.prototype._drawDot = function (ctx) { - this._drawShape(ctx, 'circle'); -}; - -Node.prototype._drawTriangle = function (ctx) { - this._drawShape(ctx, 'triangle'); -}; - -Node.prototype._drawTriangleDown = function (ctx) { - this._drawShape(ctx, 'triangleDown'); -}; - -Node.prototype._drawSquare = function (ctx) { - this._drawShape(ctx, 'square'); -}; - -Node.prototype._drawStar = function (ctx) { - this._drawShape(ctx, 'star'); -}; - -Node.prototype._resizeShape = function (ctx) { - if (!this.width) { - this.radius = this.baseRadiusValue; - var size = 2 * this.radius; - this.width = size; - this.height = size; - - // scaling used for clustering - this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; - this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; - this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; - this.growthIndicator = this.width - size; - } -}; + if (this.yAxisLeft) { + if (options.dataAxis !== undefined) { + this.yAxisLeft.setOptions(this.options.dataAxis); + this.yAxisRight.setOptions(this.options.dataAxis); + } + } -Node.prototype._drawShape = function (ctx, shape) { - this._resizeShape(ctx); + if (this.legendLeft) { + if (options.legend !== undefined) { + this.legendLeft.setOptions(this.options.legend); + this.legendRight.setOptions(this.options.legend); + } + } - this.left = this.x - this.width / 2; - this.top = this.y - this.height / 2; + if (this.groups.hasOwnProperty(UNGROUPED)) { + this.groups[UNGROUPED].setOptions(options); + } + } + if (this.dom.frame) { + this._updateGraph(); + } + }; - var clusterLineWidth = 2.5; - var selectionLineWidth = 2; - var radiusMultiplier = 2; + /** + * Hide the component from the DOM + */ + LineGraph.prototype.hide = function() { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + }; - // choose draw method depending on the shape - switch (shape) { - case 'dot': radiusMultiplier = 2; break; - case 'square': radiusMultiplier = 2; break; - case 'triangle': radiusMultiplier = 3; break; - case 'triangleDown': radiusMultiplier = 3; break; - case 'star': radiusMultiplier = 4; break; - } + /** + * Show the component in the DOM (when not already visible). + * @return {Boolean} changed + */ + LineGraph.prototype.show = function() { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + }; - ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; - // draw the outer border - if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + /** + * Set items + * @param {vis.DataSet | null} items + */ + LineGraph.prototype.setItems = function(items) { + var me = this, + ids, + oldItemsData = this.itemsData; - ctx[shape](this.x, this.y, this.radius + radiusMultiplier * ctx.lineWidth); - ctx.stroke(); - } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); - ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + // replace the dataset + if (!items) { + this.itemsData = null; + } + else if (items instanceof DataSet || items instanceof DataView) { + this.itemsData = items; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } - ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; - ctx[shape](this.x, this.y, this.radius); - ctx.fill(); - ctx.stroke(); + if (oldItemsData) { + // unsubscribe from old dataset + util.forEach(this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); - if (this.label) { - this._label(ctx, this.label, this.x, this.y + this.height / 2, undefined, 'top',true); - } -}; - -Node.prototype._resizeText = function (ctx) { - if (!this.width) { - var margin = 5; - var textSize = this.getTextSize(ctx); - this.width = textSize.width + 2 * margin; - this.height = textSize.height + 2 * margin; - - // scaling used for clustering - this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; - this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; - this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; - this.growthIndicator = this.width - (textSize.width + 2 * margin); - } -}; + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } -Node.prototype._drawText = function (ctx) { - this._resizeText(ctx); - this.left = this.x - this.width / 2; - this.top = this.y - this.height / 2; + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); - this._label(ctx, this.label, this.x, this.y); -}; + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); + } + this._updateUngrouped(); + this._updateGraph(); + this.redraw(); + }; + /** + * Set groups + * @param {vis.DataSet} groups + */ + LineGraph.prototype.setGroups = function(groups) { + var me = this, + ids; -Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNode) { - if (text && this.fontSize * this.networkScale > this.fontDrawThreshold) { - ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace; - ctx.fillStyle = this.fontColor || "black"; - ctx.textAlign = align || "center"; - ctx.textBaseline = baseline || "middle"; + // unsubscribe from current dataset + if (this.groupsData) { + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.unsubscribe(event, callback); + }); - var lines = text.split('\n'); - var lineCount = lines.length; - var fontSize = (this.fontSize + 4); - var yLine = y + (1 - lineCount) / 2 * fontSize; - if (labelUnderNode == true) { - yLine = y + (1 - lineCount) / (2 * fontSize); + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + this._onRemoveGroups(ids); // note: this will cause a redraw } - for (var i = 0; i < lineCount; i++) { - ctx.fillText(lines[i], x, yLine); - yLine += fontSize; + // replace the dataset + if (!groups) { + this.groupsData = null; + } + else if (groups instanceof DataSet || groups instanceof DataView) { + this.groupsData = groups; + } + else { + throw new TypeError('Data must be an instance of DataSet or DataView'); } - } -}; - -Node.prototype.getTextSize = function(ctx) { - if (this.label !== undefined) { - ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace; + if (this.groupsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); - var lines = this.label.split('\n'), - height = (this.fontSize + 4) * lines.length, - width = 0; - - for (var i = 0, iMax = lines.length; i < iMax; i++) { - width = Math.max(width, ctx.measureText(lines[i]).width); + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); } + this._onUpdate(); + }; - return {"width": width, "height": height}; - } - else { - return {"width": 0, "height": 0}; - } -}; - -/** - * this is used to determine if a node is visible at all. this is used to determine when it needs to be drawn. - * there is a safety margin of 0.3 * width; - * - * @returns {boolean} - */ -Node.prototype.inArea = function() { - if (this.width !== undefined) { - return (this.x + this.width *this.networkScaleInv >= this.canvasTopLeft.x && - this.x - this.width *this.networkScaleInv < this.canvasBottomRight.x && - this.y + this.height*this.networkScaleInv >= this.canvasTopLeft.y && - this.y - this.height*this.networkScaleInv < this.canvasBottomRight.y); - } - else { - return true; - } -}; - -/** - * checks if the core of the node is in the display area, this is used for opening clusters around zoom - * @returns {boolean} - */ -Node.prototype.inView = function() { - return (this.x >= this.canvasTopLeft.x && - this.x < this.canvasBottomRight.x && - this.y >= this.canvasTopLeft.y && - this.y < this.canvasBottomRight.y); -}; - -/** - * This allows the zoom level of the network to influence the rendering - * We store the inverted scale and the coordinates of the top left, and bottom right points of the canvas - * - * @param scale - * @param canvasTopLeft - * @param canvasBottomRight - */ -Node.prototype.setScaleAndPos = function(scale,canvasTopLeft,canvasBottomRight) { - this.networkScaleInv = 1.0/scale; - this.networkScale = scale; - this.canvasTopLeft = canvasTopLeft; - this.canvasBottomRight = canvasBottomRight; -}; - - -/** - * This allows the zoom level of the network to influence the rendering - * - * @param scale - */ -Node.prototype.setScale = function(scale) { - this.networkScaleInv = 1.0/scale; - this.networkScale = scale; -}; - - - -/** - * set the velocity at 0. Is called when this node is contained in another during clustering - */ -Node.prototype.clearVelocity = function() { - this.vx = 0; - this.vy = 0; -}; - - -/** - * Basic preservation of (kinectic) energy - * - * @param massBeforeClustering - */ -Node.prototype.updateVelocity = function(massBeforeClustering) { - var energyBefore = this.vx * this.vx * massBeforeClustering; - //this.vx = (this.vx < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass); - this.vx = Math.sqrt(energyBefore/this.mass); - energyBefore = this.vy * this.vy * massBeforeClustering; - //this.vy = (this.vy < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass); - this.vy = Math.sqrt(energyBefore/this.mass); -}; -/** - * @class Edge - * - * A edge connects two nodes - * @param {Object} properties Object with properties. Must contain - * At least properties from and to. - * Available properties: from (number), - * to (number), label (string, color (string), - * width (number), style (string), - * length (number), title (string) - * @param {Network} network A Network object, used to find and edge to - * nodes. - * @param {Object} constants An object with default values for - * example for the color - */ -function Edge (properties, network, constants) { - if (!network) { - throw "No network provided"; - } - this.network = network; - - // initialize constants - this.widthMin = constants.edges.widthMin; - this.widthMax = constants.edges.widthMax; - - // initialize variables - this.id = undefined; - this.fromId = undefined; - this.toId = undefined; - this.style = constants.edges.style; - this.title = undefined; - this.width = constants.edges.width; - this.widthSelectionMultiplier = constants.edges.widthSelectionMultiplier; - this.widthSelected = this.width * this.widthSelectionMultiplier; - this.hoverWidth = constants.edges.hoverWidth; - this.value = undefined; - this.length = constants.physics.springLength; - this.customLength = false; - this.selected = false; - this.hover = false; - this.smooth = constants.smoothCurves; - this.arrowScaleFactor = constants.edges.arrowScaleFactor; - - this.from = null; // a node - this.to = null; // a node - this.via = null; // a temp node - - // we use this to be able to reconnect the edge to a cluster if its node is put into a cluster - // by storing the original information we can revert to the original connection when the cluser is opened. - this.originalFromId = []; - this.originalToId = []; - - this.connected = false; - - // Added to support dashed lines - // David Jordan - // 2012-08-08 - this.dash = util.extend({}, constants.edges.dash); // contains properties length, gap, altLength - - this.color = {color:constants.edges.color.color, - highlight:constants.edges.color.highlight, - hover:constants.edges.color.hover}; - this.widthFixed = false; - this.lengthFixed = false; - - this.setProperties(properties, constants); - - this.controlNodesEnabled = false; - this.controlNodes = {from:null, to:null, positions:{}}; - this.connectedNode = null; -} + LineGraph.prototype._onUpdate = function(ids) { + this._updateUngrouped(); + this._updateAllGroupData(); + this._updateGraph(); + this.redraw(); + }; + LineGraph.prototype._onAdd = function (ids) {this._onUpdate(ids);}; + LineGraph.prototype._onRemove = function (ids) {this._onUpdate(ids);}; + LineGraph.prototype._onUpdateGroups = function (groupIds) { + for (var i = 0; i < groupIds.length; i++) { + var group = this.groupsData.get(groupIds[i]); + this._updateGroup(group, groupIds[i]); + } -/** - * Set or overwrite properties for the edge - * @param {Object} properties an object with properties - * @param {Object} constants and object with default, global properties - */ -Edge.prototype.setProperties = function(properties, constants) { - if (!properties) { - return; - } + this._updateGraph(); + this.redraw(); + }; + LineGraph.prototype._onAddGroups = function (groupIds) {this._onUpdateGroups(groupIds);}; - if (properties.from !== undefined) {this.fromId = properties.from;} - if (properties.to !== undefined) {this.toId = properties.to;} + LineGraph.prototype._onRemoveGroups = function (groupIds) { + for (var i = 0; i < groupIds.length; i++) { + if (!this.groups.hasOwnProperty(groupIds[i])) { + if (this.groups[groupIds[i]].options.yAxisOrientation == 'right') { + this.yAxisRight.removeGroup(groupIds[i]); + this.legendRight.removeGroup(groupIds[i]); + this.legendRight.redraw(); + } + else { + this.yAxisLeft.removeGroup(groupIds[i]); + this.legendLeft.removeGroup(groupIds[i]); + this.legendLeft.redraw(); + } + delete this.groups[groupIds[i]]; + } + } + this._updateUngrouped(); + this._updateGraph(); + this.redraw(); + }; - if (properties.id !== undefined) {this.id = properties.id;} - if (properties.style !== undefined) {this.style = properties.style;} - if (properties.label !== undefined) {this.label = properties.label;} + /** + * update a group object + * + * @param group + * @param groupId + * @private + */ + LineGraph.prototype._updateGroup = function (group, groupId) { + if (!this.groups.hasOwnProperty(groupId)) { + this.groups[groupId] = new GraphGroup(group, groupId, this.options, this.groupsUsingDefaultStyles); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.addGroup(groupId, this.groups[groupId]); + this.legendRight.addGroup(groupId, this.groups[groupId]); + } + else { + this.yAxisLeft.addGroup(groupId, this.groups[groupId]); + this.legendLeft.addGroup(groupId, this.groups[groupId]); + } + } + else { + this.groups[groupId].update(group); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.updateGroup(groupId, this.groups[groupId]); + this.legendRight.updateGroup(groupId, this.groups[groupId]); + } + else { + this.yAxisLeft.updateGroup(groupId, this.groups[groupId]); + this.legendLeft.updateGroup(groupId, this.groups[groupId]); + } + } + this.legendLeft.redraw(); + this.legendRight.redraw(); + }; - if (this.label) { - this.fontSize = constants.edges.fontSize; - this.fontFace = constants.edges.fontFace; - this.fontColor = constants.edges.fontColor; - this.fontFill = constants.edges.fontFill; + LineGraph.prototype._updateAllGroupData = function () { + if (this.itemsData != null) { + // ~450 ms @ 500k - if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} - if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} - if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} - if (properties.fontFill !== undefined) {this.fontFill = properties.fontFill;} - } + var groupsContent = {}; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + groupsContent[groupId] = []; + } + } + for (var itemId in this.itemsData._data) { + if (this.itemsData._data.hasOwnProperty(itemId)) { + var item = this.itemsData._data[itemId]; + item.x = util.convert(item.x,"Date"); + groupsContent[item.group].push(item); + } + } + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + this.groups[groupId].setItems(groupsContent[groupId]); + } + } + // // ~4500ms @ 500k + // for (var groupId in this.groups) { + // if (this.groups.hasOwnProperty(groupId)) { + // this.groups[groupId].setItems(this.itemsData.get({filter: + // function (item) { + // return (item.group == groupId); + // }, type:{x:"Date"}} + // )); + // } + // } + } + }; - if (properties.title !== undefined) {this.title = properties.title;} - if (properties.width !== undefined) {this.width = properties.width;} - if (properties.widthSelectionMultiplier !== undefined) - {this.widthSelectionMultiplier = properties.widthSelectionMultiplier;} - if (properties.hoverWidth !== undefined) {this.hoverWidth = properties.hoverWidth;} - if (properties.value !== undefined) {this.value = properties.value;} - if (properties.length !== undefined) {this.length = properties.length; - this.customLength = true;} - - // scale the arrow - if (properties.arrowScaleFactor !== undefined) {this.arrowScaleFactor = properties.arrowScaleFactor;} - - // Added to support dashed lines - // David Jordan - // 2012-08-08 - if (properties.dash) { - if (properties.dash.length !== undefined) {this.dash.length = properties.dash.length;} - if (properties.dash.gap !== undefined) {this.dash.gap = properties.dash.gap;} - if (properties.dash.altLength !== undefined) {this.dash.altLength = properties.dash.altLength;} - } + /** + * Create or delete the group holding all ungrouped items. This group is used when + * there are no groups specified. This anonymous group is called 'graph'. + * @protected + */ + LineGraph.prototype._updateUngrouped = function() { + if (this.itemsData != null) { + // var t0 = new Date(); + var group = {id: UNGROUPED, content: this.options.defaultGroup}; + this._updateGroup(group, UNGROUPED); + var ungroupedCounter = 0; + if (this.itemsData) { + for (var itemId in this.itemsData._data) { + if (this.itemsData._data.hasOwnProperty(itemId)) { + var item = this.itemsData._data[itemId]; + if (item != undefined) { + if (item.hasOwnProperty('group')) { + if (item.group === undefined) { + item.group = UNGROUPED; + } + } + else { + item.group = UNGROUPED; + } + ungroupedCounter = item.group == UNGROUPED ? ungroupedCounter + 1 : ungroupedCounter; + } + } + } + } - if (properties.color !== undefined) { - if (util.isString(properties.color)) { - this.color.color = properties.color; - this.color.highlight = properties.color; + // much much slower + // var datapoints = this.itemsData.get({ + // filter: function (item) {return item.group === undefined;}, + // showInternalIds:true + // }); + // if (datapoints.length > 0) { + // var updateQuery = []; + // for (var i = 0; i < datapoints.length; i++) { + // updateQuery.push({id:datapoints[i].id, group: UNGROUPED}); + // } + // this.itemsData.update(updateQuery, true); + // } + // var t1 = new Date(); + // var pointInUNGROUPED = this.itemsData.get({filter: function (item) {return item.group == UNGROUPED;}}); + if (ungroupedCounter == 0) { + delete this.groups[UNGROUPED]; + this.legendLeft.removeGroup(UNGROUPED); + this.legendRight.removeGroup(UNGROUPED); + this.yAxisLeft.removeGroup(UNGROUPED); + this.yAxisRight.removeGroup(UNGROUPED); + } + // console.log("getting amount ungrouped",new Date() - t1); + // console.log("putting in ungrouped",new Date() - t0); } else { - if (properties.color.color !== undefined) {this.color.color = properties.color.color;} - if (properties.color.highlight !== undefined) {this.color.highlight = properties.color.highlight;} - if (properties.color.hover !== undefined) {this.color.hover = properties.color.hover;} + delete this.groups[UNGROUPED]; + this.legendLeft.removeGroup(UNGROUPED); + this.legendRight.removeGroup(UNGROUPED); + this.yAxisLeft.removeGroup(UNGROUPED); + this.yAxisRight.removeGroup(UNGROUPED); } - } - - // A node is connected when it has a from and to node. - this.connect(); - this.widthFixed = this.widthFixed || (properties.width !== undefined); - this.lengthFixed = this.lengthFixed || (properties.length !== undefined); + this.legendLeft.redraw(); + this.legendRight.redraw(); + }; - this.widthSelected = this.width * this.widthSelectionMultiplier; - // set draw method based on style - switch (this.style) { - case 'line': this.draw = this._drawLine; break; - case 'arrow': this.draw = this._drawArrow; break; - case 'arrow-center': this.draw = this._drawArrowCenter; break; - case 'dash-line': this.draw = this._drawDashLine; break; - default: this.draw = this._drawLine; break; - } -}; + /** + * Redraw the component, mandatory function + * @return {boolean} Returns true if the component is resized + */ + LineGraph.prototype.redraw = function() { + var resized = false; -/** - * Connect an edge to its nodes - */ -Edge.prototype.connect = function () { - this.disconnect(); + this.svg.style.height = ('' + this.options.graphHeight).replace('px','') + 'px'; + if (this.lastWidth === undefined && this.width || this.lastWidth != this.width) { + resized = true; + } + // check if this component is resized + resized = this._isResized() || resized; + // check whether zoomed (in that case we need to re-stack everything) + var visibleInterval = this.body.range.end - this.body.range.start; + var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.width != this.lastWidth); + this.lastVisibleInterval = visibleInterval; + this.lastWidth = this.width; - this.from = this.network.nodes[this.fromId] || null; - this.to = this.network.nodes[this.toId] || null; - this.connected = (this.from && this.to); + // calculate actual size and position + this.width = this.dom.frame.offsetWidth; - if (this.connected) { - this.from.attachEdge(this); - this.to.attachEdge(this); - } - else { - if (this.from) { - this.from.detachEdge(this); + // the svg element is three times as big as the width, this allows for fully dragging left and right + // without reloading the graph. the controls for this are bound to events in the constructor + if (resized == true) { + this.svg.style.width = util.option.asSize(3*this.width); + this.svg.style.left = util.option.asSize(-this.width); } - if (this.to) { - this.to.detachEdge(this); + if (zoomed == true) { + this._updateGraph(); } - } -}; -/** - * Disconnect an edge from its nodes - */ -Edge.prototype.disconnect = function () { - if (this.from) { - this.from.detachEdge(this); - this.from = null; - } - if (this.to) { - this.to.detachEdge(this); - this.to = null; - } - - this.connected = false; -}; - -/** - * get the title of this edge. - * @return {string} title The title of the edge, or undefined when no title - * has been set. - */ -Edge.prototype.getTitle = function() { - return typeof this.title === "function" ? this.title() : this.title; -}; + this.legendLeft.redraw(); + this.legendRight.redraw(); + return resized; + }; -/** - * Retrieve the value of the edge. Can be undefined - * @return {Number} value - */ -Edge.prototype.getValue = function() { - return this.value; -}; + /** + * Update and redraw the graph. + * + */ + LineGraph.prototype._updateGraph = function () { + // reset the svg elements + DOMutil.prepareElements(this.svgElements); + // // very slow... + // groupData = group.itemsData.get({filter: + // function (item) { + // return (item.x > minDate && item.x < maxDate); + // }} + // ); + + + if (this.width != 0 && this.itemsData != null) { + var group, groupData, preprocessedGroup, i; + var preprocessedGroupData = []; + var processedGroupData = []; + var groupRanges = []; + var changeCalled = false; + + // getting group Ids + var groupIds = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + groupIds.push(groupId); + } + } + + // this is the range of the SVG canvas + var minDate = this.body.util.toGlobalTime(- this.body.domProps.root.width); + var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width); + + // first select and preprocess the data from the datasets. + // the groups have their preselection of data, we now loop over this data to see + // what data we need to draw. Sorted data is much faster. + // more optimization is possible by doing the sampling before and using the binary search + // to find the end date to determine the increment. + if (groupIds.length > 0) { + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + groupData = []; + // optimization for sorted data + if (group.options.sort == true) { + var guess = Math.max(0,util.binarySearchGeneric(group.itemsData, minDate, 'x', 'before')); + + for (var j = guess; j < group.itemsData.length; j++) { + var item = group.itemsData[j]; + if (item !== undefined) { + if (item.x > maxDate) { + groupData.push(item); + break; + } + else { + groupData.push(item); + } + } + } + } + else { + for (var j = 0; j < group.itemsData.length; j++) { + var item = group.itemsData[j]; + if (item !== undefined) { + if (item.x > minDate && item.x < maxDate) { + groupData.push(item); + } + } + } + } + // preprocess, split into ranges and data + preprocessedGroup = this._preprocessData(groupData, group); + groupRanges.push({min: preprocessedGroup.min, max: preprocessedGroup.max}); + preprocessedGroupData.push(preprocessedGroup.data); + } + + // update the Y axis first, we use this data to draw at the correct Y points + // changeCalled is required to clean the SVG on a change emit. + changeCalled = this._updateYAxis(groupIds, groupRanges); + if (changeCalled == true) { + DOMutil.cleanupElements(this.svgElements); + this.body.emitter.emit("change"); + return; + } -/** - * Adjust the value range of the edge. The edge will adjust it's width - * based on its value. - * @param {Number} min - * @param {Number} max - */ -Edge.prototype.setValueRange = function(min, max) { - if (!this.widthFixed && this.value !== undefined) { - var scale = (this.widthMax - this.widthMin) / (max - min); - this.width = (this.value - min) * scale + this.widthMin; - } -}; + // with the yAxis scaled correctly, use this to get the Y values of the points. + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + processedGroupData.push(this._convertYvalues(preprocessedGroupData[i],group)) + } -/** - * Redraw a edge - * Draw this edge in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - */ -Edge.prototype.draw = function(ctx) { - throw "Method draw not initialized in edge"; -}; + // draw the groups + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (group.options.style == 'line') { + this._drawLineGraph(processedGroupData[i], group); + } + else { + this._drawBarGraph (processedGroupData[i], group); + } + } + } + } -/** - * Check if this object is overlapping with the provided object - * @param {Object} obj an object with parameters left, top - * @return {boolean} True if location is located on the edge - */ -Edge.prototype.isOverlappingWith = function(obj) { - if (this.connected) { - var distMax = 10; - var xFrom = this.from.x; - var yFrom = this.from.y; - var xTo = this.to.x; - var yTo = this.to.y; - var xObj = obj.left; - var yObj = obj.top; - - var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj); - - return (dist < distMax); - } - else { - return false - } -}; + // cleanup unused svg elements + DOMutil.cleanupElements(this.svgElements); + }; + /** + * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden. + * @param {array} groupIds + * @private + */ + LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { + var changeCalled = false; + var yAxisLeftUsed = false; + var yAxisRightUsed = false; + var minLeft = 1e9, minRight = 1e9, maxLeft = -1e9, maxRight = -1e9, minVal, maxVal; + var orientation = 'left'; -/** - * Redraw a edge as a line - * Draw this edge in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - * @private - */ -Edge.prototype._drawLine = function(ctx) { - // set style - if (this.selected == true) {ctx.strokeStyle = this.color.highlight;} - else if (this.hover == true) {ctx.strokeStyle = this.color.hover;} - else {ctx.strokeStyle = this.color.color;} - ctx.lineWidth = this._getLineWidth(); + // if groups are present + if (groupIds.length > 0) { + for (var i = 0; i < groupIds.length; i++) { + orientation = 'left'; + var group = this.groups[groupIds[i]]; + if (group.options.yAxisOrientation == 'right') { + orientation = 'right'; + } - if (this.from != this.to) { - // draw line - this._line(ctx); + minVal = groupRanges[i].min; + maxVal = groupRanges[i].max; - // draw label - var point; - if (this.label) { - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); - point = {x:midpointX, y:midpointY}; + if (orientation == 'left') { + yAxisLeftUsed = true; + minLeft = minLeft > minVal ? minVal : minLeft; + maxLeft = maxLeft < maxVal ? maxVal : maxLeft; + } + else { + yAxisRightUsed = true; + minRight = minRight > minVal ? minVal : minRight; + maxRight = maxRight < maxVal ? maxVal : maxRight; + } } - else { - point = this._pointOnLine(0.5); + if (yAxisLeftUsed == true) { + this.yAxisLeft.setRange(minLeft, maxLeft); + } + if (yAxisRightUsed == true) { + this.yAxisRight.setRange(minRight, maxRight); } - this._label(ctx, this.label, point.x, point.y); - } - } - else { - var x, y; - var radius = this.length / 4; - var node = this.from; - if (!node.width) { - node.resize(ctx); } - if (node.width > node.height) { - x = node.x + node.width / 2; - y = node.y - radius; + + changeCalled = this._toggleAxisVisiblity(yAxisLeftUsed , this.yAxisLeft) || changeCalled; + changeCalled = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || changeCalled; + + if (yAxisRightUsed == true && yAxisLeftUsed == true) { + this.yAxisLeft.drawIcons = true; + this.yAxisRight.drawIcons = true; } else { - x = node.x + radius; - y = node.y - node.height / 2; + this.yAxisLeft.drawIcons = false; + this.yAxisRight.drawIcons = false; } - this._circle(ctx, x, y, radius); - point = this._pointOnCircle(x, y, radius, 0.5); - this._label(ctx, this.label, point.x, point.y); - } -}; -/** - * Get the line width of the edge. Depends on width and whether one of the - * connected nodes is selected. - * @return {Number} width - * @private - */ -Edge.prototype._getLineWidth = function() { - if (this.selected == true) { - return Math.min(this.widthSelected, this.widthMax)*this.networkScaleInv; - } - else { - if (this.hover == true) { - return Math.min(this.hoverWidth, this.widthMax)*this.networkScaleInv; + this.yAxisRight.master = !yAxisLeftUsed; + + if (this.yAxisRight.master == false) { + if (yAxisRightUsed == true) { + this.yAxisLeft.lineOffset = this.yAxisRight.width; + } + changeCalled = this.yAxisLeft.redraw() || changeCalled; + this.yAxisRight.stepPixelsForced = this.yAxisLeft.stepPixels; + changeCalled = this.yAxisRight.redraw() || changeCalled; } else { - return this.width*this.networkScaleInv; + changeCalled = this.yAxisRight.redraw() || changeCalled; } - } -}; + return changeCalled; + }; -/** - * Draw a line between two nodes - * @param {CanvasRenderingContext2D} ctx - * @private - */ -Edge.prototype._line = function (ctx) { - // draw a straight line - ctx.beginPath(); - ctx.moveTo(this.from.x, this.from.y); - if (this.smooth == true) { - ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y); - } - else { - ctx.lineTo(this.to.x, this.to.y); - } - ctx.stroke(); -}; + /** + * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function + * + * @param {boolean} axisUsed + * @returns {boolean} + * @private + * @param axis + */ + LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) { + var changed = false; + if (axisUsed == false) { + if (axis.dom.frame.parentNode) { + axis.hide(); + changed = true; + } + } + else { + if (!axis.dom.frame.parentNode) { + axis.show(); + changed = true; + } + } + return changed; + }; -/** - * Draw a line from a node to itself, a circle - * @param {CanvasRenderingContext2D} ctx - * @param {Number} x - * @param {Number} y - * @param {Number} radius - * @private - */ -Edge.prototype._circle = function (ctx, x, y, radius) { - // draw a circle - ctx.beginPath(); - ctx.arc(x, y, radius, 0, 2 * Math.PI, false); - ctx.stroke(); -}; -/** - * Draw label with white background and with the middle at (x, y) - * @param {CanvasRenderingContext2D} ctx - * @param {String} text - * @param {Number} x - * @param {Number} y - * @private - */ -Edge.prototype._label = function (ctx, text, x, y) { - if (text) { - // TODO: cache the calculated size - ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") + - this.fontSize + "px " + this.fontFace; - ctx.fillStyle = this.fontFill; - var width = ctx.measureText(text).width; - var height = this.fontSize; - var left = x - width / 2; - var top = y - height / 2; - - ctx.fillRect(left, top, width, height); - - // draw text - ctx.fillStyle = this.fontColor || "black"; - ctx.textAlign = "left"; - ctx.textBaseline = "top"; - ctx.fillText(text, left, top); - } -}; + /** + * draw a bar graph + * @param datapoints + * @param group + */ + LineGraph.prototype._drawBarGraph = function (dataset, group) { + if (dataset != null) { + if (dataset.length > 0) { + var coreDistance; + var minWidth = 0.1 * group.options.barChart.width; + var offset = 0; + var width = group.options.barChart.width; -/** - * Redraw a edge as a dashed line - * Draw this edge in the given canvas - * @author David Jordan - * @date 2012-08-08 - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - * @private - */ -Edge.prototype._drawDashLine = function(ctx) { - // set style - if (this.selected == true) {ctx.strokeStyle = this.color.highlight;} - else if (this.hover == true) {ctx.strokeStyle = this.color.hover;} - else {ctx.strokeStyle = this.color.color;} + if (group.options.barChart.align == 'left') {offset -= 0.5*width;} + else if (group.options.barChart.align == 'right') {offset += 0.5*width;} - ctx.lineWidth = this._getLineWidth(); + for (var i = 0; i < dataset.length; i++) { + // dynammically downscale the width so there is no overlap up to 1/10th the original width + if (i+1 < dataset.length) {coreDistance = Math.abs(dataset[i+1].x - dataset[i].x);} + if (i > 0) {coreDistance = Math.min(coreDistance,Math.abs(dataset[i-1].x - dataset[i].x));} + if (coreDistance < width) {width = coreDistance < minWidth ? minWidth : coreDistance;} - // only firefox and chrome support this method, else we use the legacy one. - if (ctx.mozDash !== undefined || ctx.setLineDash !== undefined) { - ctx.beginPath(); - ctx.moveTo(this.from.x, this.from.y); + DOMutil.drawBar(dataset[i].x + offset, dataset[i].y, width, group.zeroPosition - dataset[i].y, group.className + ' bar', this.svgElements, this.svg); + } - // configure the dash pattern - var pattern = [0]; - if (this.dash.length !== undefined && this.dash.gap !== undefined) { - pattern = [this.dash.length,this.dash.gap]; - } - else { - pattern = [5,5]; + // draw points + if (group.options.drawPoints.enabled == true) { + this._drawPoints(dataset, group, this.svgElements, this.svg, offset); + } + } } + }; - // set dash settings for chrome or firefox - if (typeof ctx.setLineDash !== 'undefined') { //Chrome - ctx.setLineDash(pattern); - ctx.lineDashOffset = 0; - - } else { //Firefox - ctx.mozDash = pattern; - ctx.mozDashOffset = 0; - } - // draw the line - if (this.smooth == true) { - ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y); - } - else { - ctx.lineTo(this.to.x, this.to.y); - } - ctx.stroke(); + /** + * draw a line graph + * + * @param datapoints + * @param group + */ + LineGraph.prototype._drawLineGraph = function (dataset, group) { + if (dataset != null) { + if (dataset.length > 0) { + var path, d; + var svgHeight = Number(this.svg.style.height.replace("px","")); + path = DOMutil.getSVGElement('path', this.svgElements, this.svg); + path.setAttributeNS(null, "class", group.className); + + // construct path from dataset + if (group.options.catmullRom.enabled == true) { + d = this._catmullRom(dataset, group); + } + else { + d = this._linear(dataset); + } - // restore the dash settings. - if (typeof ctx.setLineDash !== 'undefined') { //Chrome - ctx.setLineDash([0]); - ctx.lineDashOffset = 0; + // append with points for fill and finalize the path + if (group.options.shaded.enabled == true) { + var fillPath = DOMutil.getSVGElement('path',this.svgElements, this.svg); + var dFill; + if (group.options.shaded.orientation == 'top') { + dFill = "M" + dataset[0].x + "," + 0 + " " + d + "L" + dataset[dataset.length - 1].x + "," + 0; + } + else { + dFill = "M" + dataset[0].x + "," + svgHeight + " " + d + "L" + dataset[dataset.length - 1].x + "," + svgHeight; + } + fillPath.setAttributeNS(null, "class", group.className + " fill"); + fillPath.setAttributeNS(null, "d", dFill); + } + // copy properties to path for drawing. + path.setAttributeNS(null, "d", "M" + d); - } else { //Firefox - ctx.mozDash = [0]; - ctx.mozDashOffset = 0; + // draw points + if (group.options.drawPoints.enabled == true) { + this._drawPoints(dataset, group, this.svgElements, this.svg); + } + } } - } - else { // unsupporting smooth lines - // draw dashed line - ctx.beginPath(); - ctx.lineCap = 'round'; - if (this.dash.altLength !== undefined) //If an alt dash value has been set add to the array this value - { - ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y, - [this.dash.length,this.dash.gap,this.dash.altLength,this.dash.gap]); - } - else if (this.dash.length !== undefined && this.dash.gap !== undefined) //If a dash and gap value has been set add to the array this value - { - ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y, - [this.dash.length,this.dash.gap]); - } - else //If all else fails draw a line - { - ctx.moveTo(this.from.x, this.from.y); - ctx.lineTo(this.to.x, this.to.y); - } - ctx.stroke(); - } + }; - // draw label - if (this.label) { - var point; - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); - point = {x:midpointX, y:midpointY}; - } - else { - point = this._pointOnLine(0.5); + /** + * draw the data points + * + * @param dataset + * @param JSONcontainer + * @param svg + * @param group + */ + LineGraph.prototype._drawPoints = function (dataset, group, JSONcontainer, svg, offset) { + if (offset === undefined) {offset = 0;} + for (var i = 0; i < dataset.length; i++) { + DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, group, JSONcontainer, svg); } - this._label(ctx, this.label, point.x, point.y); - } -}; + }; -/** - * Get a point on a line - * @param {Number} percentage. Value between 0 (line start) and 1 (line end) - * @return {Object} point - * @private - */ -Edge.prototype._pointOnLine = function (percentage) { - return { - x: (1 - percentage) * this.from.x + percentage * this.to.x, - y: (1 - percentage) * this.from.y + percentage * this.to.y - } -}; -/** - * Get a point on a circle - * @param {Number} x - * @param {Number} y - * @param {Number} radius - * @param {Number} percentage. Value between 0 (line start) and 1 (line end) - * @return {Object} point - * @private - */ -Edge.prototype._pointOnCircle = function (x, y, radius, percentage) { - var angle = (percentage - 3/8) * 2 * Math.PI; - return { - x: x + radius * Math.cos(angle), - y: y - radius * Math.sin(angle) - } -}; -/** - * Redraw a edge as a line with an arrow halfway the line - * Draw this edge in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - * @private - */ -Edge.prototype._drawArrowCenter = function(ctx) { - var point; - // set style - if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;} - else if (this.hover == true) {ctx.strokeStyle = this.color.hover; ctx.fillStyle = this.color.hover;} - else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;} - ctx.lineWidth = this._getLineWidth(); - - if (this.from != this.to) { - // draw line - this._line(ctx); + /** + * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for + * the yAxis. + * + * @param datapoints + * @returns {Array} + * @private + */ + LineGraph.prototype._preprocessData = function (datapoints, group) { + var extractedData = []; + var xValue, yValue; + var toScreen = this.body.util.toScreen; - var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); - var length = (10 + 5 * this.width) * this.arrowScaleFactor; - // draw an arrow halfway the line - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); - point = {x:midpointX, y:midpointY}; - } - else { - point = this._pointOnLine(0.5); - } + var increment = 1; + var amountOfPoints = datapoints.length; - ctx.arrow(point.x, point.y, angle, length); - ctx.fill(); - ctx.stroke(); + var yMin = datapoints[0].y; + var yMax = datapoints[0].y; - // draw label - if (this.label) { - this._label(ctx, this.label, point.x, point.y); + // the global screen is used because changing the width of the yAxis may affect the increment, resulting in an endless loop + // of width changing of the yAxis. + if (group.options.sampling == true) { + var xDistance = this.body.util.toGlobalScreen(datapoints[datapoints.length-1].x) - this.body.util.toGlobalScreen(datapoints[0].x); + var pointsPerPixel = amountOfPoints/xDistance; + increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1,Math.round(pointsPerPixel))); } - } - else { - // draw circle - var x, y; - var radius = 0.25 * Math.max(100,this.length); - var node = this.from; - if (!node.width) { - node.resize(ctx); + + for (var i = 0; i < amountOfPoints; i += increment) { + xValue = toScreen(datapoints[i].x) + this.width - 1; + yValue = datapoints[i].y; + extractedData.push({x: xValue, y: yValue}); + yMin = yMin > yValue ? yValue : yMin; + yMax = yMax < yValue ? yValue : yMax; } - if (node.width > node.height) { - x = node.x + node.width * 0.5; - y = node.y - radius; + + // extractedData.sort(function (a,b) {return a.x - b.x;}); + return {min: yMin, max: yMax, data: extractedData}; + }; + + /** + * This uses the DataAxis object to generate the correct Y coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. + * + * @param datapoints + * @param options + * @returns {Array} + * @private + */ + LineGraph.prototype._convertYvalues = function (datapoints, group) { + var extractedData = []; + var xValue, yValue; + var axis = this.yAxisLeft; + var svgHeight = Number(this.svg.style.height.replace("px","")); + + if (group.options.yAxisOrientation == 'right') { + axis = this.yAxisRight; } - else { - x = node.x + radius; - y = node.y - node.height * 0.5; + + for (var i = 0; i < datapoints.length; i++) { + xValue = datapoints[i].x; + yValue = Math.round(axis.convertValue(datapoints[i].y)); + extractedData.push({x: xValue, y: yValue}); } - this._circle(ctx, x, y, radius); - // draw all arrows - var angle = 0.2 * Math.PI; - var length = (10 + 5 * this.width) * this.arrowScaleFactor; - point = this._pointOnCircle(x, y, radius, 0.5); - ctx.arrow(point.x, point.y, angle, length); - ctx.fill(); - ctx.stroke(); + group.setZeroPosition(Math.min(svgHeight, axis.convertValue(0))); - // draw label - if (this.label) { - point = this._pointOnCircle(x, y, radius, 0.5); - this._label(ctx, this.label, point.x, point.y); - } - } -}; + // extractedData.sort(function (a,b) {return a.x - b.x;}); + return extractedData; + }; + /** + * This uses an uniform parametrization of the CatmullRom algorithm: + * "On the Parameterization of Catmull-Rom Curves" by Cem Yuksel et al. + * @param data + * @returns {string} + * @private + */ + LineGraph.prototype._catmullRomUniform = function(data) { + // catmull rom + var p0, p1, p2, p3, bp1, bp2; + var d = Math.round(data[0].x) + "," + Math.round(data[0].y) + " "; + var normalization = 1/6; + var length = data.length; + for (var i = 0; i < length - 1; i++) { + + p0 = (i == 0) ? data[0] : data[i-1]; + p1 = data[i]; + p2 = data[i+1]; + p3 = (i + 2 < length) ? data[i+2] : p2; -/** - * Redraw a edge as a line with an arrow - * Draw this edge in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - * @private - */ -Edge.prototype._drawArrow = function(ctx) { - // set style - if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;} - else if (this.hover == true) {ctx.strokeStyle = this.color.hover; ctx.fillStyle = this.color.hover;} - else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;} - - ctx.lineWidth = this._getLineWidth(); - - var angle, length; - //draw a line - if (this.from != this.to) { - angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); - var dx = (this.to.x - this.from.x); - var dy = (this.to.y - this.from.y); - var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); - var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI); - var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength; - var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; - var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; + // Catmull-Rom to Cubic Bezier conversion matrix + // 0 1 0 0 + // -1/6 1 1/6 0 + // 0 1/6 1 -1/6 + // 0 0 1 0 + // bp0 = { x: p1.x, y: p1.y }; + bp1 = { x: ((-p0.x + 6*p1.x + p2.x) *normalization), y: ((-p0.y + 6*p1.y + p2.y) *normalization)}; + bp2 = { x: (( p1.x + 6*p2.x - p3.x) *normalization), y: (( p1.y + 6*p2.y - p3.y) *normalization)}; + // bp0 = { x: p2.x, y: p2.y }; - if (this.smooth == true) { - angle = Math.atan2((this.to.y - this.via.y), (this.to.x - this.via.x)); - dx = (this.to.x - this.via.x); - dy = (this.to.y - this.via.y); - edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + d += "C" + + bp1.x + "," + + bp1.y + " " + + bp2.x + "," + + bp2.y + " " + + p2.x + "," + + p2.y + " "; } - var toBorderDist = this.to.distanceToBorder(ctx, angle); - var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; - var xTo,yTo; - if (this.smooth == true) { - xTo = (1 - toBorderPoint) * this.via.x + toBorderPoint * this.to.x; - yTo = (1 - toBorderPoint) * this.via.y + toBorderPoint * this.to.y; - } - else { - xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; - yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y; - } + return d; + }; - ctx.beginPath(); - ctx.moveTo(xFrom,yFrom); - if (this.smooth == true) { - ctx.quadraticCurveTo(this.via.x,this.via.y,xTo, yTo); + /** + * This uses either the chordal or centripetal parameterization of the catmull-rom algorithm. + * By default, the centripetal parameterization is used because this gives the nicest results. + * These parameterizations are relatively heavy because the distance between 4 points have to be calculated. + * + * One optimization can be used to reuse distances since this is a sliding window approach. + * @param data + * @returns {string} + * @private + */ + LineGraph.prototype._catmullRom = function(data, group) { + var alpha = group.options.catmullRom.alpha; + if (alpha == 0 || alpha === undefined) { + return this._catmullRomUniform(data); } else { - ctx.lineTo(xTo, yTo); + var p0, p1, p2, p3, bp1, bp2, d1,d2,d3, A, B, N, M; + var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA; + var d = Math.round(data[0].x) + "," + Math.round(data[0].y) + " "; + var length = data.length; + for (var i = 0; i < length - 1; i++) { + + p0 = (i == 0) ? data[0] : data[i-1]; + p1 = data[i]; + p2 = data[i+1]; + p3 = (i + 2 < length) ? data[i+2] : p2; + + d1 = Math.sqrt(Math.pow(p0.x - p1.x,2) + Math.pow(p0.y - p1.y,2)); + d2 = Math.sqrt(Math.pow(p1.x - p2.x,2) + Math.pow(p1.y - p2.y,2)); + d3 = Math.sqrt(Math.pow(p2.x - p3.x,2) + Math.pow(p2.y - p3.y,2)); + + // Catmull-Rom to Cubic Bezier conversion matrix + // + // A = 2d1^2a + 3d1^a * d2^a + d3^2a + // B = 2d3^2a + 3d3^a * d2^a + d2^2a + // + // [ 0 1 0 0 ] + // [ -d2^2a/N A/N d1^2a/N 0 ] + // [ 0 d3^2a/M B/M -d2^2a/M ] + // [ 0 0 1 0 ] + + // [ 0 1 0 0 ] + // [ -d2pow2a/N A/N d1pow2a/N 0 ] + // [ 0 d3pow2a/M B/M -d2pow2a/M ] + // [ 0 0 1 0 ] + + d3powA = Math.pow(d3, alpha); + d3pow2A = Math.pow(d3,2*alpha); + d2powA = Math.pow(d2, alpha); + d2pow2A = Math.pow(d2,2*alpha); + d1powA = Math.pow(d1, alpha); + d1pow2A = Math.pow(d1,2*alpha); + + A = 2*d1pow2A + 3*d1powA * d2powA + d2pow2A; + B = 2*d3pow2A + 3*d3powA * d2powA + d2pow2A; + N = 3*d1powA * (d1powA + d2powA); + if (N > 0) {N = 1 / N;} + M = 3*d3powA * (d3powA + d2powA); + if (M > 0) {M = 1 / M;} + + bp1 = { x: ((-d2pow2A * p0.x + A*p1.x + d1pow2A * p2.x) * N), + y: ((-d2pow2A * p0.y + A*p1.y + d1pow2A * p2.y) * N)}; + + bp2 = { x: (( d3pow2A * p1.x + B*p2.x - d2pow2A * p3.x) * M), + y: (( d3pow2A * p1.y + B*p2.y - d2pow2A * p3.y) * M)}; + + if (bp1.x == 0 && bp1.y == 0) {bp1 = p1;} + if (bp2.x == 0 && bp2.y == 0) {bp2 = p2;} + d += "C" + + bp1.x + "," + + bp1.y + " " + + bp2.x + "," + + bp2.y + " " + + p2.x + "," + + p2.y + " "; + } + + return d; } - ctx.stroke(); - - // draw arrow at the end of the line - length = (10 + 5 * this.width) * this.arrowScaleFactor; - ctx.arrow(xTo, yTo, angle, length); - ctx.fill(); - ctx.stroke(); + }; - // draw label - if (this.label) { - var point; - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); - point = {x:midpointX, y:midpointY}; + /** + * this generates the SVG path for a linear drawing between datapoints. + * @param data + * @returns {string} + * @private + */ + LineGraph.prototype._linear = function(data) { + // linear + var d = ""; + for (var i = 0; i < data.length; i++) { + if (i == 0) { + d += data[i].x + "," + data[i].y; } else { - point = this._pointOnLine(0.5); + d += " " + data[i].x + "," + data[i].y; } - this._label(ctx, this.label, point.x, point.y); - } - } - else { - // draw circle - var node = this.from; - var x, y, arrow; - var radius = 0.25 * Math.max(100,this.length); - if (!node.width) { - node.resize(ctx); - } - if (node.width > node.height) { - x = node.x + node.width * 0.5; - y = node.y - radius; - arrow = { - x: x, - y: node.y, - angle: 0.9 * Math.PI - }; - } - else { - x = node.x + radius; - y = node.y - node.height * 0.5; - arrow = { - x: node.x, - y: y, - angle: 0.6 * Math.PI - }; } - ctx.beginPath(); - // TODO: similarly, for a line without arrows, draw to the border of the nodes instead of the center - ctx.arc(x, y, radius, 0, 2 * Math.PI, false); - ctx.stroke(); - - // draw all arrows - var length = (10 + 5 * this.width) * this.arrowScaleFactor; - ctx.arrow(arrow.x, arrow.y, arrow.angle, length); - ctx.fill(); - ctx.stroke(); + return d; + }; - // draw label - if (this.label) { - point = this._pointOnCircle(x, y, radius, 0.5); - this._label(ctx, this.label, point.x, point.y); - } - } -}; + module.exports = LineGraph; +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Calculate the distance between a point (x3,y3) and a line segment from - * (x1,y1) to (x2,y2). - * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment - * @param {number} x1 - * @param {number} y1 - * @param {number} x2 - * @param {number} y2 - * @param {number} x3 - * @param {number} y3 - * @private - */ -Edge.prototype._getDistanceToEdge = function (x1,y1, x2,y2, x3,y3) { // x3,y3 is the point - if (this.from != this.to) { - if (this.smooth == true) { - var minDistance = 1e9; - var i,t,x,y,dx,dy; - for (i = 0; i < 10; i++) { - t = 0.1*i; - x = Math.pow(1-t,2)*x1 + (2*t*(1 - t))*this.via.x + Math.pow(t,2)*x2; - y = Math.pow(1-t,2)*y1 + (2*t*(1 - t))*this.via.y + Math.pow(t,2)*y2; - dx = Math.abs(x3-x); - dy = Math.abs(y3-y); - minDistance = Math.min(minDistance,Math.sqrt(dx*dx + dy*dy)); - } - return minDistance - } - else { - var px = x2-x1, - py = y2-y1, - something = px*px + py*py, - u = ((x3 - x1) * px + (y3 - y1) * py) / something; + var util = __webpack_require__(1); + var Component = __webpack_require__(18); + var TimeStep = __webpack_require__(17); - if (u > 1) { - u = 1; - } - else if (u < 0) { - u = 0; + /** + * A horizontal time axis + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See TimeAxis.setOptions for the available + * options. + * @constructor TimeAxis + * @extends Component + */ + function TimeAxis (body, options) { + this.dom = { + foreground: null, + majorLines: [], + majorTexts: [], + minorLines: [], + minorTexts: [], + redundant: { + majorLines: [], + majorTexts: [], + minorLines: [], + minorTexts: [] } + }; + this.props = { + range: { + start: 0, + end: 0, + minimumStep: 0 + }, + lineTop: 0 + }; - var x = x1 + u * px, - y = y1 + u * py, - dx = x - x3, - dy = y - y3; + this.defaultOptions = { + orientation: 'bottom', // supported: 'top', 'bottom' + // TODO: implement timeaxis orientations 'left' and 'right' + showMinorLabels: true, + showMajorLabels: true + }; + this.options = util.extend({}, this.defaultOptions); - //# Note: If the actual distance does not matter, - //# if you only want to compare what this function - //# returns to other results of this function, you - //# can just return the squared distance instead - //# (i.e. remove the sqrt) to gain a little performance + this.body = body; - return Math.sqrt(dx*dx + dy*dy); - } - } - else { - var x, y, dx, dy; - var radius = this.length / 4; - var node = this.from; - if (!node.width) { - node.resize(ctx); - } - if (node.width > node.height) { - x = node.x + node.width / 2; - y = node.y - radius; - } - else { - x = node.x + radius; - y = node.y - node.height / 2; - } - dx = x - x3; - dy = y - y3; - return Math.abs(Math.sqrt(dx*dx + dy*dy) - radius); - } -}; + // create the HTML DOM + this._create(); + this.setOptions(options); + } + TimeAxis.prototype = new Component(); -/** - * This allows the zoom level of the network to influence the rendering - * - * @param scale - */ -Edge.prototype.setScale = function(scale) { - this.networkScaleInv = 1.0/scale; -}; + /** + * Set options for the TimeAxis. + * Parameters will be merged in current options. + * @param {Object} options Available options: + * {string} [orientation] + * {boolean} [showMinorLabels] + * {boolean} [showMajorLabels] + */ + TimeAxis.prototype.setOptions = function(options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['orientation', 'showMinorLabels', 'showMajorLabels'], this.options, options); + } + }; + /** + * Create the HTML DOM for the TimeAxis + */ + TimeAxis.prototype._create = function() { + this.dom.foreground = document.createElement('div'); + this.dom.background = document.createElement('div'); -Edge.prototype.select = function() { - this.selected = true; -}; + this.dom.foreground.className = 'timeaxis foreground'; + this.dom.background.className = 'timeaxis background'; + }; -Edge.prototype.unselect = function() { - this.selected = false; -}; + /** + * Destroy the TimeAxis + */ + TimeAxis.prototype.destroy = function() { + // remove from DOM + if (this.dom.foreground.parentNode) { + this.dom.foreground.parentNode.removeChild(this.dom.foreground); + } + if (this.dom.background.parentNode) { + this.dom.background.parentNode.removeChild(this.dom.background); + } -Edge.prototype.positionBezierNode = function() { - if (this.via !== null) { - this.via.x = 0.5 * (this.from.x + this.to.x); - this.via.y = 0.5 * (this.from.y + this.to.y); - } -}; + this.body = null; + }; -/** - * This function draws the control nodes for the manipulator. In order to enable this, only set the this.controlNodesEnabled to true. - * @param ctx - */ -Edge.prototype._drawControlNodes = function(ctx) { - if (this.controlNodesEnabled == true) { - if (this.controlNodes.from === null && this.controlNodes.to === null) { - var nodeIdFrom = "edgeIdFrom:".concat(this.id); - var nodeIdTo = "edgeIdTo:".concat(this.id); - var constants = { - nodes:{group:'', radius:8}, - physics:{damping:0}, - clustering: {maxNodeSizeIncrements: 0 ,nodeScaling: {width:0, height: 0, radius:0}} - }; - this.controlNodes.from = new Node( - {id:nodeIdFrom, - shape:'dot', - color:{background:'#ff4e00', border:'#3c3c3c', highlight: {background:'#07f968'}} - },{},{},constants); - this.controlNodes.to = new Node( - {id:nodeIdTo, - shape:'dot', - color:{background:'#ff4e00', border:'#3c3c3c', highlight: {background:'#07f968'}} - },{},{},constants); - } + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + TimeAxis.prototype.redraw = function () { + var options = this.options, + props = this.props, + foreground = this.dom.foreground, + background = this.dom.background; - if (this.controlNodes.from.selected == false && this.controlNodes.to.selected == false) { - this.controlNodes.positions = this.getControlNodePositions(ctx); - this.controlNodes.from.x = this.controlNodes.positions.from.x; - this.controlNodes.from.y = this.controlNodes.positions.from.y; - this.controlNodes.to.x = this.controlNodes.positions.to.x; - this.controlNodes.to.y = this.controlNodes.positions.to.y; - } + // determine the correct parent DOM element (depending on option orientation) + var parent = (options.orientation == 'top') ? this.body.dom.top : this.body.dom.bottom; + var parentChanged = (foreground.parentNode !== parent); - this.controlNodes.from.draw(ctx); - this.controlNodes.to.draw(ctx); - } - else { - this.controlNodes = {from:null, to:null, positions:{}}; - } -} + // calculate character width and height + this._calculateCharSize(); -/** - * Enable control nodes. - * @private - */ -Edge.prototype._enableControlNodes = function() { - this.controlNodesEnabled = true; -} + // TODO: recalculate sizes only needed when parent is resized or options is changed + var orientation = this.options.orientation, + showMinorLabels = this.options.showMinorLabels, + showMajorLabels = this.options.showMajorLabels; -/** - * disable control nodes - * @private - */ -Edge.prototype._disableControlNodes = function() { - this.controlNodesEnabled = false; -} + // determine the width and height of the elemens for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; + props.height = props.minorLabelHeight + props.majorLabelHeight; + props.width = foreground.offsetWidth; -/** - * This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null. - * @param x - * @param y - * @returns {null} - * @private - */ -Edge.prototype._getSelectedControlNode = function(x,y) { - var positions = this.controlNodes.positions; - var fromDistance = Math.sqrt(Math.pow(x - positions.from.x,2) + Math.pow(y - positions.from.y,2)); - var toDistance = Math.sqrt(Math.pow(x - positions.to.x ,2) + Math.pow(y - positions.to.y ,2)); - - if (fromDistance < 15) { - this.connectedNode = this.from; - this.from = this.controlNodes.from; - return this.controlNodes.from; - } - else if (toDistance < 15) { - this.connectedNode = this.to; - this.to = this.controlNodes.to; - return this.controlNodes.to; - } - else { - return null; - } -} + props.minorLineHeight = this.body.domProps.root.height - props.majorLabelHeight - + (options.orientation == 'top' ? this.body.domProps.bottom.height : this.body.domProps.top.height); + props.minorLineWidth = 1; // TODO: really calculate width + props.majorLineHeight = props.minorLineHeight + props.majorLabelHeight; + props.majorLineWidth = 1; // TODO: really calculate width + // take foreground and background offline while updating (is almost twice as fast) + var foregroundNextSibling = foreground.nextSibling; + var backgroundNextSibling = background.nextSibling; + foreground.parentNode && foreground.parentNode.removeChild(foreground); + background.parentNode && background.parentNode.removeChild(background); -/** - * this resets the control nodes to their original position. - * @private - */ -Edge.prototype._restoreControlNodes = function() { - if (this.controlNodes.from.selected == true) { - this.from = this.connectedNode; - this.connectedNode = null; - this.controlNodes.from.unselect(); - } - if (this.controlNodes.to.selected == true) { - this.to = this.connectedNode; - this.connectedNode = null; - this.controlNodes.to.unselect(); - } -} + foreground.style.height = this.props.height + 'px'; -/** - * this calculates the position of the control nodes on the edges of the parent nodes. - * - * @param ctx - * @returns {{from: {x: number, y: number}, to: {x: *, y: *}}} - */ -Edge.prototype.getControlNodePositions = function(ctx) { - var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); - var dx = (this.to.x - this.from.x); - var dy = (this.to.y - this.from.y); - var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); - var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI); - var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength; - var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; - var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; - - - if (this.smooth == true) { - angle = Math.atan2((this.to.y - this.via.y), (this.to.x - this.via.x)); - dx = (this.to.x - this.via.x); - dy = (this.to.y - this.via.y); - edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); - } - var toBorderDist = this.to.distanceToBorder(ctx, angle); - var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; + this._repaintLabels(); - var xTo,yTo; - if (this.smooth == true) { - xTo = (1 - toBorderPoint) * this.via.x + toBorderPoint * this.to.x; - yTo = (1 - toBorderPoint) * this.via.y + toBorderPoint * this.to.y; - } - else { - xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; - yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y; - } + // put DOM online again (at the same place) + if (foregroundNextSibling) { + parent.insertBefore(foreground, foregroundNextSibling); + } + else { + parent.appendChild(foreground) + } + if (backgroundNextSibling) { + this.body.dom.backgroundVertical.insertBefore(background, backgroundNextSibling); + } + else { + this.body.dom.backgroundVertical.appendChild(background) + } - return {from:{x:xFrom,y:yFrom},to:{x:xTo,y:yTo}}; -} + return this._isResized() || parentChanged; + }; -/** - * Popup is a class to create a popup window with some text - * @param {Element} container The container object. - * @param {Number} [x] - * @param {Number} [y] - * @param {String} [text] - * @param {Object} [style] An object containing borderColor, - * backgroundColor, etc. - */ -function Popup(container, x, y, text, style) { - if (container) { - this.container = container; - } - else { - this.container = document.body; - } + /** + * Repaint major and minor text labels and vertical grid lines + * @private + */ + TimeAxis.prototype._repaintLabels = function () { + var orientation = this.options.orientation; - // x, y and text are optional, see if a style object was passed in their place - if (style === undefined) { - if (typeof x === "object") { - style = x; - x = undefined; - } else if (typeof text === "object") { - style = text; - text = undefined; - } else { - // for backwards compatibility, in case clients other than Network are creating Popup directly - style = { - fontColor: 'black', - fontSize: 14, // px - fontFace: 'verdana', - color: { - border: '#666', - background: '#FFFFC6' + // calculate range and step (step such that we have space for 7 characters per label) + var start = util.convert(this.body.range.start, 'Number'), + end = util.convert(this.body.range.end, 'Number'), + minimumStep = this.body.util.toTime((this.props.minorCharWidth || 10) * 7).valueOf() + -this.body.util.toTime(0).valueOf(); + var step = new TimeStep(new Date(start), new Date(end), minimumStep); + this.step = step; + + // Move all DOM elements to a "redundant" list, where they + // can be picked for re-use, and clear the lists with lines and texts. + // At the end of the function _repaintLabels, left over elements will be cleaned up + var dom = this.dom; + dom.redundant.majorLines = dom.majorLines; + dom.redundant.majorTexts = dom.majorTexts; + dom.redundant.minorLines = dom.minorLines; + dom.redundant.minorTexts = dom.minorTexts; + dom.majorLines = []; + dom.majorTexts = []; + dom.minorLines = []; + dom.minorTexts = []; + + step.first(); + var xFirstMajorLabel = undefined; + var max = 0; + while (step.hasNext() && max < 1000) { + max++; + var cur = step.getCurrent(), + x = this.body.util.toScreen(cur), + isMajor = step.isMajor(); + + // TODO: lines must have a width, such that we can create css backgrounds + + if (this.options.showMinorLabels) { + this._repaintMinorText(x, step.getLabelMinor(), orientation); + } + + if (isMajor && this.options.showMajorLabels) { + if (x > 0) { + if (xFirstMajorLabel == undefined) { + xFirstMajorLabel = x; + } + this._repaintMajorText(x, step.getLabelMajor(), orientation); } + this._repaintMajorLine(x, orientation); + } + else { + this._repaintMinorLine(x, orientation); } + + step.next(); } - } - this.x = 0; - this.y = 0; - this.padding = 5; + // create a major label on the left when needed + if (this.options.showMajorLabels) { + var leftTime = this.body.util.toTime(0), + leftText = step.getLabelMajor(leftTime), + widthText = leftText.length * (this.props.majorCharWidth || 10) + 10; // upper bound estimation - if (x !== undefined && y !== undefined ) { - this.setPosition(x, y); - } - if (text !== undefined) { - this.setText(text); - } + if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) { + this._repaintMajorText(0, leftText, orientation); + } + } - // create the frame - this.frame = document.createElement("div"); - var styleAttr = this.frame.style; - styleAttr.position = "absolute"; - styleAttr.visibility = "hidden"; - styleAttr.border = "1px solid " + style.color.border; - styleAttr.color = style.fontColor; - styleAttr.fontSize = style.fontSize + "px"; - styleAttr.fontFamily = style.fontFace; - styleAttr.padding = this.padding + "px"; - styleAttr.backgroundColor = style.color.background; - styleAttr.borderRadius = "3px"; - styleAttr.MozBorderRadius = "3px"; - styleAttr.WebkitBorderRadius = "3px"; - styleAttr.boxShadow = "3px 3px 10px rgba(128, 128, 128, 0.5)"; - styleAttr.whiteSpace = "nowrap"; - this.container.appendChild(this.frame); -} + // Cleanup leftover DOM elements from the redundant list + util.forEach(this.dom.redundant, function (arr) { + while (arr.length) { + var elem = arr.pop(); + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + } + }); + }; -/** - * @param {number} x Horizontal position of the popup window - * @param {number} y Vertical position of the popup window - */ -Popup.prototype.setPosition = function(x, y) { - this.x = parseInt(x); - this.y = parseInt(y); -}; + /** + * Create a minor label for the axis at position x + * @param {Number} x + * @param {String} text + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMinorText = function (x, text, orientation) { + // reuse redundant label + var label = this.dom.redundant.minorTexts.shift(); -/** - * Set the text for the popup window. This can be HTML code - * @param {string} text - */ -Popup.prototype.setText = function(text) { - this.frame.innerHTML = text; -}; + if (!label) { + // create new label + var content = document.createTextNode(''); + label = document.createElement('div'); + label.appendChild(content); + label.className = 'text minor'; + this.dom.foreground.appendChild(label); + } + this.dom.minorTexts.push(label); -/** - * Show the popup window - * @param {boolean} show Optional. Show or hide the window - */ -Popup.prototype.show = function (show) { - if (show === undefined) { - show = true; - } + label.childNodes[0].nodeValue = text; + + label.style.top = (orientation == 'top') ? (this.props.majorLabelHeight + 'px') : '0'; + label.style.left = x + 'px'; + //label.title = title; // TODO: this is a heavy operation + }; - if (show) { - var height = this.frame.clientHeight; - var width = this.frame.clientWidth; - var maxHeight = this.frame.parentNode.clientHeight; - var maxWidth = this.frame.parentNode.clientWidth; + /** + * Create a Major label for the axis at position x + * @param {Number} x + * @param {String} text + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMajorText = function (x, text, orientation) { + // reuse redundant label + var label = this.dom.redundant.majorTexts.shift(); - var top = (this.y - height); - if (top + height + this.padding > maxHeight) { - top = maxHeight - height - this.padding; + if (!label) { + // create label + var content = document.createTextNode(text); + label = document.createElement('div'); + label.className = 'text major'; + label.appendChild(content); + this.dom.foreground.appendChild(label); } - if (top < this.padding) { - top = this.padding; + this.dom.majorTexts.push(label); + + label.childNodes[0].nodeValue = text; + //label.title = title; // TODO: this is a heavy operation + + label.style.top = (orientation == 'top') ? '0' : (this.props.minorLabelHeight + 'px'); + label.style.left = x + 'px'; + }; + + /** + * Create a minor line for the axis at position x + * @param {Number} x + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMinorLine = function (x, orientation) { + // reuse redundant line + var line = this.dom.redundant.minorLines.shift(); + + if (!line) { + // create vertical line + line = document.createElement('div'); + line.className = 'grid vertical minor'; + this.dom.background.appendChild(line); } + this.dom.minorLines.push(line); - var left = this.x; - if (left + width + this.padding > maxWidth) { - left = maxWidth - width - this.padding; + var props = this.props; + if (orientation == 'top') { + line.style.top = props.majorLabelHeight + 'px'; } - if (left < this.padding) { - left = this.padding; + else { + line.style.top = this.body.domProps.top.height + 'px'; } + line.style.height = props.minorLineHeight + 'px'; + line.style.left = (x - props.minorLineWidth / 2) + 'px'; + }; - this.frame.style.left = left + "px"; - this.frame.style.top = top + "px"; - this.frame.style.visibility = "visible"; - } - else { - this.hide(); - } -}; + /** + * Create a Major line for the axis at position x + * @param {Number} x + * @param {String} orientation "top" or "bottom" (default) + * @private + */ + TimeAxis.prototype._repaintMajorLine = function (x, orientation) { + // reuse redundant line + var line = this.dom.redundant.majorLines.shift(); -/** - * Hide the popup window - */ -Popup.prototype.hide = function () { - this.frame.style.visibility = "hidden"; -}; + if (!line) { + // create vertical line + line = document.createElement('DIV'); + line.className = 'grid vertical major'; + this.dom.background.appendChild(line); + } + this.dom.majorLines.push(line); -/** - * @class Groups - * This class can store groups and properties specific for groups. - */ -function Groups() { - this.clear(); - this.defaultIndex = 0; -} + var props = this.props; + if (orientation == 'top') { + line.style.top = '0'; + } + else { + line.style.top = this.body.domProps.top.height + 'px'; + } + line.style.left = (x - props.majorLineWidth / 2) + 'px'; + line.style.height = props.majorLineHeight + 'px'; + }; + /** + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private + */ + TimeAxis.prototype._calculateCharSize = function () { + // Note: We calculate char size with every redraw. Size may change, for + // example when any of the timelines parents had display:none for example. -/** - * default constants for group colors - */ -Groups.DEFAULT = [ - {border: "#2B7CE9", background: "#97C2FC", highlight: {border: "#2B7CE9", background: "#D2E5FF"}}, // blue - {border: "#FFA500", background: "#FFFF00", highlight: {border: "#FFA500", background: "#FFFFA3"}}, // yellow - {border: "#FA0A10", background: "#FB7E81", highlight: {border: "#FA0A10", background: "#FFAFB1"}}, // red - {border: "#41A906", background: "#7BE141", highlight: {border: "#41A906", background: "#A1EC76"}}, // green - {border: "#E129F0", background: "#EB7DF4", highlight: {border: "#E129F0", background: "#F0B3F5"}}, // magenta - {border: "#7C29F0", background: "#AD85E4", highlight: {border: "#7C29F0", background: "#D3BDF0"}}, // purple - {border: "#C37F00", background: "#FFA807", highlight: {border: "#C37F00", background: "#FFCA66"}}, // orange - {border: "#4220FB", background: "#6E6EFD", highlight: {border: "#4220FB", background: "#9B9BFD"}}, // darkblue - {border: "#FD5A77", background: "#FFC0CB", highlight: {border: "#FD5A77", background: "#FFD1D9"}}, // pink - {border: "#4AD63A", background: "#C2FABC", highlight: {border: "#4AD63A", background: "#E6FFE3"}} // mint -]; + // determine the char width and height on the minor axis + if (!this.dom.measureCharMinor) { + this.dom.measureCharMinor = document.createElement('DIV'); + this.dom.measureCharMinor.className = 'text minor measure'; + this.dom.measureCharMinor.style.position = 'absolute'; + this.dom.measureCharMinor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMinor); + } + this.props.minorCharHeight = this.dom.measureCharMinor.clientHeight; + this.props.minorCharWidth = this.dom.measureCharMinor.clientWidth; -/** - * Clear all groups - */ -Groups.prototype.clear = function () { - this.groups = {}; - this.groups.length = function() - { - var i = 0; - for ( var p in this ) { - if (this.hasOwnProperty(p)) { - i++; - } + // determine the char width and height on the major axis + if (!this.dom.measureCharMajor) { + this.dom.measureCharMajor = document.createElement('DIV'); + this.dom.measureCharMajor.className = 'text minor measure'; + this.dom.measureCharMajor.style.position = 'absolute'; + + this.dom.measureCharMajor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMajor); } - return i; - } -}; + this.props.majorCharHeight = this.dom.measureCharMajor.clientHeight; + this.props.majorCharWidth = this.dom.measureCharMajor.clientWidth; + }; + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * @param {Date} date the date to be snapped. + * @return {Date} snappedDate + */ + TimeAxis.prototype.snap = function(date) { + return this.step.snap(date); + }; -/** - * get group properties of a groupname. If groupname is not found, a new group - * is added. - * @param {*} groupname Can be a number, string, Date, etc. - * @return {Object} group The created group, containing all group properties - */ -Groups.prototype.get = function (groupname) { - var group = this.groups[groupname]; - - if (group == undefined) { - // create new group - var index = this.defaultIndex % Groups.DEFAULT.length; - this.defaultIndex++; - group = {}; - group.color = Groups.DEFAULT[index]; - this.groups[groupname] = group; - } + module.exports = TimeAxis; - return group; -}; -/** - * Add a custom group style - * @param {String} groupname - * @param {Object} style An object containing borderColor, - * backgroundColor, etc. - * @return {Object} group The created group object - */ -Groups.prototype.add = function (groupname, style) { - this.groups[groupname] = style; - if (style.color) { - style.color = util.parseColor(style.color); - } - return style; -}; +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { -/** - * @class Images - * This class loads images and keeps them stored. - */ -function Images() { - this.images = {}; + var Hammer = __webpack_require__(41); + + /** + * @constructor Item + * @param {Object} data Object containing (optional) parameters type, + * start, end, content, group, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} options Configuration options + * // TODO: describe available options + */ + function Item (data, conversion, options) { + this.id = null; + this.parent = null; + this.data = data; + this.dom = null; + this.conversion = conversion || {}; + this.options = options || {}; + + this.selected = false; + this.displayed = false; + this.dirty = true; - this.callback = undefined; -} + this.top = null; + this.left = null; + this.width = null; + this.height = null; + } -/** - * Set an onload callback function. This will be called each time an image - * is loaded - * @param {function} callback - */ -Images.prototype.setOnloadCallback = function(callback) { - this.callback = callback; -}; + /** + * Select current item + */ + Item.prototype.select = function() { + this.selected = true; + if (this.displayed) this.redraw(); + }; -/** - * - * @param {string} url Url of the image - * @return {Image} img The image object - */ -Images.prototype.load = function(url) { - var img = this.images[url]; - if (img == undefined) { - // create the image - var images = this; - img = new Image(); - this.images[url] = img; - img.onload = function() { - if (images.callback) { - images.callback(this); + /** + * Unselect current item + */ + Item.prototype.unselect = function() { + this.selected = false; + if (this.displayed) this.redraw(); + }; + + /** + * Set a parent for the item + * @param {ItemSet | Group} parent + */ + Item.prototype.setParent = function(parent) { + if (this.displayed) { + this.hide(); + this.parent = parent; + if (this.parent) { + this.show(); } - }; - img.src = url; - } + } + else { + this.parent = parent; + } + }; - return img; -}; + /** + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + Item.prototype.isVisible = function(range) { + // Should be implemented by Item implementations + return false; + }; -/** - * Created by Alex on 2/6/14. - */ + /** + * Show the Item in the DOM (when not already visible) + * @return {Boolean} changed + */ + Item.prototype.show = function() { + return false; + }; + /** + * Hide the Item from the DOM (when visible) + * @return {Boolean} changed + */ + Item.prototype.hide = function() { + return false; + }; -var physicsMixin = { + /** + * Repaint the item + */ + Item.prototype.redraw = function() { + // should be implemented by the item + }; /** - * Toggling barnes Hut calculation on and off. - * - * @private + * Reposition the Item horizontally */ - _toggleBarnesHut: function () { - this.constants.physics.barnesHut.enabled = !this.constants.physics.barnesHut.enabled; - this._loadSelectedForceSolver(); - this.moving = true; - this.start(); - }, + Item.prototype.repositionX = function() { + // should be implemented by the item + }; + /** + * Reposition the Item vertically + */ + Item.prototype.repositionY = function() { + // should be implemented by the item + }; /** - * This loads the node force solver based on the barnes hut or repulsion algorithm - * - * @private + * Repaint a delete button on the top right of the item when the item is selected + * @param {HTMLElement} anchor + * @protected */ - _loadSelectedForceSolver: function () { - // this overloads the this._calculateNodeForces - if (this.constants.physics.barnesHut.enabled == true) { - this._clearMixin(repulsionMixin); - this._clearMixin(hierarchalRepulsionMixin); + Item.prototype._repaintDeleteButton = function (anchor) { + if (this.selected && this.options.editable.remove && !this.dom.deleteButton) { + // create and show button + var me = this; - this.constants.physics.centralGravity = this.constants.physics.barnesHut.centralGravity; - this.constants.physics.springLength = this.constants.physics.barnesHut.springLength; - this.constants.physics.springConstant = this.constants.physics.barnesHut.springConstant; - this.constants.physics.damping = this.constants.physics.barnesHut.damping; + var deleteButton = document.createElement('div'); + deleteButton.className = 'delete'; + deleteButton.title = 'Delete this item'; + + Hammer(deleteButton, { + preventDefault: true + }).on('tap', function (event) { + me.parent.removeFromDataSet(me); + event.stopPropagation(); + }); - this._loadMixin(barnesHutMixin); + anchor.appendChild(deleteButton); + this.dom.deleteButton = deleteButton; } - else if (this.constants.physics.hierarchicalRepulsion.enabled == true) { - this._clearMixin(barnesHutMixin); - this._clearMixin(repulsionMixin); + else if (!this.selected && this.dom.deleteButton) { + // remove button + if (this.dom.deleteButton.parentNode) { + this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton); + } + this.dom.deleteButton = null; + } + }; - this.constants.physics.centralGravity = this.constants.physics.hierarchicalRepulsion.centralGravity; - this.constants.physics.springLength = this.constants.physics.hierarchicalRepulsion.springLength; - this.constants.physics.springConstant = this.constants.physics.hierarchicalRepulsion.springConstant; - this.constants.physics.damping = this.constants.physics.hierarchicalRepulsion.damping; + module.exports = Item; - this._loadMixin(hierarchalRepulsionMixin); - } - else { - this._clearMixin(barnesHutMixin); - this._clearMixin(hierarchalRepulsionMixin); - this.barnesHutTree = undefined; - this.constants.physics.centralGravity = this.constants.physics.repulsion.centralGravity; - this.constants.physics.springLength = this.constants.physics.repulsion.springLength; - this.constants.physics.springConstant = this.constants.physics.repulsion.springConstant; - this.constants.physics.damping = this.constants.physics.repulsion.damping; +/***/ }, +/* 29 */ +/***/ function(module, exports, __webpack_require__) { - this._loadMixin(repulsionMixin); - } - }, + var Item = __webpack_require__(28); /** - * Before calculating the forces, we check if we need to cluster to keep up performance and we check - * if there is more than one node. If it is just one node, we dont calculate anything. - * - * @private + * @constructor ItemBox + * @extends Item + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options */ - _initializeForceCalculation: function () { - // stop calculation if there is only one node - if (this.nodeIndices.length == 1) { - this.nodes[this.nodeIndices[0]]._setForce(0, 0); - } - else { - // if there are too many nodes on screen, we cluster without repositioning - if (this.nodeIndices.length > this.constants.clustering.clusterThreshold && this.constants.clustering.enabled == true) { - this.clusterToFit(this.constants.clustering.reduceToNodes, false); + function ItemBox (data, conversion, options) { + this.props = { + dot: { + width: 0, + height: 0 + }, + line: { + width: 0, + height: 0 } + }; - // we now start the force calculation - this._calculateForces(); + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data); + } } - }, + Item.call(this, data, conversion, options); + } + + ItemBox.prototype = new Item (null, null, null); /** - * Calculate the external forces acting on the nodes - * Forces are caused by: edges, repulsing forces between nodes, gravity - * @private + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible */ - _calculateForces: function () { - // Gravity is required to keep separated groups from floating off - // the forces are reset to zero in this loop by using _setForce instead - // of _addForce + ItemBox.prototype.isVisible = function(range) { + // determine visibility + // TODO: account for the real width of the item. Right now we just add 1/4 to the window + var interval = (range.end - range.start) / 4; + return (this.data.start > range.start - interval) && (this.data.start < range.end + interval); + }; - this._calculateGravitationalForces(); - this._calculateNodeForces(); + /** + * Repaint the item + */ + ItemBox.prototype.redraw = function() { + var dom = this.dom; + if (!dom) { + // create DOM + this.dom = {}; + dom = this.dom; + + // create main box + dom.box = document.createElement('DIV'); + + // contents box (inside the background box). used for making margins + dom.content = document.createElement('DIV'); + dom.content.className = 'content'; + dom.box.appendChild(dom.content); + + // line to axis + dom.line = document.createElement('DIV'); + dom.line.className = 'line'; + + // dot on axis + dom.dot = document.createElement('DIV'); + dom.dot.className = 'dot'; - if (this.constants.smoothCurves == true) { - this._calculateSpringForcesWithSupport(); + // attach this item as attribute + dom.box['timeline-item'] = this; } - else { - if (this.constants.physics.hierarchicalRepulsion.enabled == true) { - this._calculateHierarchicalSpringForces(); + + // append DOM to parent DOM + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) throw new Error('Cannot redraw time axis: parent has no foreground container element'); + foreground.appendChild(dom.box); + } + if (!dom.line.parentNode) { + var background = this.parent.dom.background; + if (!background) throw new Error('Cannot redraw time axis: parent has no background container element'); + background.appendChild(dom.line); + } + if (!dom.dot.parentNode) { + var axis = this.parent.dom.axis; + if (!background) throw new Error('Cannot redraw time axis: parent has no axis container element'); + axis.appendChild(dom.dot); + } + this.displayed = true; + + // update contents + if (this.data.content != this.content) { + this.content = this.data.content; + if (this.content instanceof Element) { + dom.content.innerHTML = ''; + dom.content.appendChild(this.content); + } + else if (this.data.content != undefined) { + dom.content.innerHTML = this.content; } else { - this._calculateSpringForces(); + throw new Error('Property "content" missing in item ' + this.data.id); } - } - }, + this.dirty = true; + } - /** - * Smooth curves are created by adding invisible nodes in the center of the edges. These nodes are also - * handled in the calculateForces function. We then use a quadratic curve with the center node as control. - * This function joins the datanodes and invisible (called support) nodes into one object. - * We do this so we do not contaminate this.nodes with the support nodes. - * - * @private - */ - _updateCalculationNodes: function () { - if (this.constants.smoothCurves == true) { - this.calculationNodes = {}; - this.calculationNodeIndices = []; + // update title + if (this.data.title != this.title) { + dom.box.title = this.data.title; + this.title = this.data.title; + } - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - this.calculationNodes[nodeId] = this.nodes[nodeId]; - } - } - var supportNodes = this.sectors['support']['nodes']; - for (var supportNodeId in supportNodes) { - if (supportNodes.hasOwnProperty(supportNodeId)) { - if (this.edges.hasOwnProperty(supportNodes[supportNodeId].parentEdgeId)) { - this.calculationNodes[supportNodeId] = supportNodes[supportNodeId]; - } - else { - supportNodes[supportNodeId]._setForce(0, 0); - } - } - } + // update class + var className = (this.data.className? ' ' + this.data.className : '') + + (this.selected ? ' selected' : ''); + if (this.className != className) { + this.className = className; + dom.box.className = 'item box' + className; + dom.line.className = 'item line' + className; + dom.dot.className = 'item dot' + className; - for (var idx in this.calculationNodes) { - if (this.calculationNodes.hasOwnProperty(idx)) { - this.calculationNodeIndices.push(idx); - } - } + this.dirty = true; } - else { - this.calculationNodes = this.nodes; - this.calculationNodeIndices = this.nodeIndices; + + // recalculate size + if (this.dirty) { + this.props.dot.height = dom.dot.offsetHeight; + this.props.dot.width = dom.dot.offsetWidth; + this.props.line.width = dom.line.offsetWidth; + this.width = dom.box.offsetWidth; + this.height = dom.box.offsetHeight; + + this.dirty = false; } - }, + this._repaintDeleteButton(dom.box); + }; /** - * this function applies the central gravity effect to keep groups from floating off - * - * @private + * Show the item in the DOM (when not already displayed). The items DOM will + * be created when needed. */ - _calculateGravitationalForces: function () { - var dx, dy, distance, node, i; - var nodes = this.calculationNodes; - var gravity = this.constants.physics.centralGravity; - var gravityForce = 0; - - for (i = 0; i < this.calculationNodeIndices.length; i++) { - node = nodes[this.calculationNodeIndices[i]]; - node.damping = this.constants.physics.damping; // possibly add function to alter damping properties of clusters. - // gravity does not apply when we are in a pocket sector - if (this._sector() == "default" && gravity != 0) { - dx = -node.x; - dy = -node.y; - distance = Math.sqrt(dx * dx + dy * dy); + ItemBox.prototype.show = function() { + if (!this.displayed) { + this.redraw(); + } + }; - gravityForce = (distance == 0) ? 0 : (gravity / distance); - node.fx = dx * gravityForce; - node.fy = dy * gravityForce; + /** + * Hide the item from the DOM (when visible) + */ + ItemBox.prototype.hide = function() { + if (this.displayed) { + var dom = this.dom; + + if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box); + if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line); + if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot); + + this.top = null; + this.left = null; + + this.displayed = false; + } + }; + + /** + * Reposition the item horizontally + * @Override + */ + ItemBox.prototype.repositionX = function() { + var start = this.conversion.toScreen(this.data.start), + align = this.options.align, + left, + box = this.dom.box, + line = this.dom.line, + dot = this.dom.dot; + + // calculate left position of the box + if (align == 'right') { + this.left = start - this.width; + } + else if (align == 'left') { + this.left = start; + } + else { + // default or 'center' + this.left = start - this.width / 2; + } + + // reposition box + box.style.left = this.left + 'px'; + + // reposition line + line.style.left = (start - this.props.line.width / 2) + 'px'; + + // reposition dot + dot.style.left = (start - this.props.dot.width / 2) + 'px'; + }; + + /** + * Reposition the item vertically + * @Override + */ + ItemBox.prototype.repositionY = function() { + var orientation = this.options.orientation, + box = this.dom.box, + line = this.dom.line, + dot = this.dom.dot; + + if (orientation == 'top') { + box.style.top = (this.top || 0) + 'px'; + + line.style.top = '0'; + line.style.height = (this.parent.top + this.top + 1) + 'px'; + line.style.bottom = ''; + } + else { // orientation 'bottom' + var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty + var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top; + + box.style.top = (this.parent.height - this.top - this.height || 0) + 'px'; + line.style.top = (itemSetHeight - lineHeight) + 'px'; + line.style.bottom = '0'; + } + + dot.style.top = (-this.props.dot.height / 2) + 'px'; + }; + + module.exports = ItemBox; + + +/***/ }, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + var Item = __webpack_require__(28); + + /** + * @constructor ItemPoint + * @extends Item + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options + */ + function ItemPoint (data, conversion, options) { + this.props = { + dot: { + top: 0, + width: 0, + height: 0 + }, + content: { + height: 0, + marginLeft: 0 + } + }; + + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data); + } + } + + Item.call(this, data, conversion, options); + } + + ItemPoint.prototype = new Item (null, null, null); + + /** + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + ItemPoint.prototype.isVisible = function(range) { + // determine visibility + // TODO: account for the real width of the item. Right now we just add 1/4 to the window + var interval = (range.end - range.start) / 4; + return (this.data.start > range.start - interval) && (this.data.start < range.end + interval); + }; + + /** + * Repaint the item + */ + ItemPoint.prototype.redraw = function() { + var dom = this.dom; + if (!dom) { + // create DOM + this.dom = {}; + dom = this.dom; + + // background box + dom.point = document.createElement('div'); + // className is updated in redraw() + + // contents box, right from the dot + dom.content = document.createElement('div'); + dom.content.className = 'content'; + dom.point.appendChild(dom.content); + + // dot at start + dom.dot = document.createElement('div'); + dom.point.appendChild(dom.dot); + + // attach this item as attribute + dom.point['timeline-item'] = this; + } + + // append DOM to parent DOM + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!dom.point.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw time axis: parent has no foreground container element'); + } + foreground.appendChild(dom.point); + } + this.displayed = true; + + // update contents + if (this.data.content != this.content) { + this.content = this.data.content; + if (this.content instanceof Element) { + dom.content.innerHTML = ''; + dom.content.appendChild(this.content); + } + else if (this.data.content != undefined) { + dom.content.innerHTML = this.content; } else { - node.fx = 0; - node.fy = 0; + throw new Error('Property "content" missing in item ' + this.data.id); } + + this.dirty = true; + } + + // update title + if (this.data.title != this.title) { + dom.point.title = this.data.title; + this.title = this.data.title; } - }, + // update class + var className = (this.data.className? ' ' + this.data.className : '') + + (this.selected ? ' selected' : ''); + if (this.className != className) { + this.className = className; + dom.point.className = 'item point' + className; + dom.dot.className = 'item dot' + className; + + this.dirty = true; + } + + // recalculate size + if (this.dirty) { + this.width = dom.point.offsetWidth; + this.height = dom.point.offsetHeight; + this.props.dot.width = dom.dot.offsetWidth; + this.props.dot.height = dom.dot.offsetHeight; + this.props.content.height = dom.content.offsetHeight; + + // resize contents + dom.content.style.marginLeft = 2 * this.props.dot.width + 'px'; + //dom.content.style.marginRight = ... + 'px'; // TODO: margin right + dom.dot.style.top = ((this.height - this.props.dot.height) / 2) + 'px'; + dom.dot.style.left = (this.props.dot.width / 2) + 'px'; + this.dirty = false; + } + + this._repaintDeleteButton(dom.point); + }; /** - * this function calculates the effects of the springs in the case of unsmooth curves. - * - * @private + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. */ - _calculateSpringForces: function () { - var edgeLength, edge, edgeId; - var dx, dy, fx, fy, springForce, distance; - var edges = this.edges; + ItemPoint.prototype.show = function() { + if (!this.displayed) { + this.redraw(); + } + }; - // forces caused by the edges, modelled as springs - for (edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - edge = edges[edgeId]; - if (edge.connected) { - // only calculate forces if nodes are in the same sector - if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { - edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; - // this implies that the edges between big clusters are longer - edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; + /** + * Hide the item from the DOM (when visible) + */ + ItemPoint.prototype.hide = function() { + if (this.displayed) { + if (this.dom.point.parentNode) { + this.dom.point.parentNode.removeChild(this.dom.point); + } - dx = (edge.from.x - edge.to.x); - dy = (edge.from.y - edge.to.y); - distance = Math.sqrt(dx * dx + dy * dy); + this.top = null; + this.left = null; - if (distance == 0) { - distance = 0.01; - } + this.displayed = false; + } + }; - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + /** + * Reposition the item horizontally + * @Override + */ + ItemPoint.prototype.repositionX = function() { + var start = this.conversion.toScreen(this.data.start); - fx = dx * springForce; - fy = dy * springForce; + this.left = start - this.props.dot.width; - edge.from.fx += fx; - edge.from.fy += fy; - edge.to.fx -= fx; - edge.to.fy -= fy; - } - } + // reposition point + this.dom.point.style.left = this.left + 'px'; + }; + + /** + * Reposition the item vertically + * @Override + */ + ItemPoint.prototype.repositionY = function() { + var orientation = this.options.orientation, + point = this.dom.point; + + if (orientation == 'top') { + point.style.top = this.top + 'px'; + } + else { + point.style.top = (this.parent.height - this.top - this.height) + 'px'; + } + }; + + module.exports = ItemPoint; + + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + var Hammer = __webpack_require__(41); + var Item = __webpack_require__(28); + + /** + * @constructor ItemRange + * @extends Item + * @param {Object} data Object containing parameters start, end + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe options + */ + function ItemRange (data, conversion, options) { + this.props = { + content: { + width: 0 + } + }; + this.overflow = false; // if contents can overflow (css styling), this flag is set to true + + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data.id); + } + if (data.end == undefined) { + throw new Error('Property "end" missing in item ' + data.id); } } - }, + Item.call(this, data, conversion, options); + } + ItemRange.prototype = new Item (null, null, null); + ItemRange.prototype.baseClassName = 'item range'; /** - * This function calculates the springforces on the nodes, accounting for the support nodes. - * - * @private + * Check whether this item is visible inside given range + * @returns {{start: Number, end: Number}} range with a timestamp for start and end + * @returns {boolean} True if visible */ - _calculateSpringForcesWithSupport: function () { - var edgeLength, edge, edgeId, combinedClusterSize; - var edges = this.edges; + ItemRange.prototype.isVisible = function(range) { + // determine visibility + return (this.data.start < range.end) && (this.data.end > range.start); + }; - // forces caused by the edges, modelled as springs - for (edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - edge = edges[edgeId]; - if (edge.connected) { - // only calculate forces if nodes are in the same sector - if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { - if (edge.via != null) { - var node1 = edge.to; - var node2 = edge.via; - var node3 = edge.from; + /** + * Repaint the item + */ + ItemRange.prototype.redraw = function() { + var dom = this.dom; + if (!dom) { + // create DOM + this.dom = {}; + dom = this.dom; - edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + // background box + dom.box = document.createElement('div'); + // className is updated in redraw() - combinedClusterSize = node1.clusterSize + node3.clusterSize - 2; + // contents box + dom.content = document.createElement('div'); + dom.content.className = 'content'; + dom.box.appendChild(dom.content); - // this implies that the edges between big clusters are longer - edgeLength += combinedClusterSize * this.constants.clustering.edgeGrowth; - this._calculateSpringForce(node1, node2, 0.5 * edgeLength); - this._calculateSpringForce(node2, node3, 0.5 * edgeLength); - } - } - } + // attach this item as attribute + dom.box['timeline-item'] = this; + } + + // append DOM to parent DOM + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw time axis: parent has no foreground container element'); + } + foreground.appendChild(dom.box); + } + this.displayed = true; + + // update contents + if (this.data.content != this.content) { + this.content = this.data.content; + if (this.content instanceof Element) { + dom.content.innerHTML = ''; + dom.content.appendChild(this.content); + } + else if (this.data.content != undefined) { + dom.content.innerHTML = this.content; + } + else { + throw new Error('Property "content" missing in item ' + this.data.id); } + + this.dirty = true; + } + + // update title + if (this.data.title != this.title) { + dom.box.title = this.data.title; + this.title = this.data.title; + } + + // update class + var className = (this.data.className ? (' ' + this.data.className) : '') + + (this.selected ? ' selected' : ''); + if (this.className != className) { + this.className = className; + dom.box.className = this.baseClassName + className; + + this.dirty = true; + } + + // recalculate size + if (this.dirty) { + // determine from css whether this box has overflow + this.overflow = window.getComputedStyle(dom.content).overflow !== 'hidden'; + + this.props.content.width = this.dom.content.offsetWidth; + this.height = this.dom.box.offsetHeight; + + this.dirty = false; } - }, + this._repaintDeleteButton(dom.box); + this._repaintDragLeft(); + this._repaintDragRight(); + }; /** - * This is the code actually performing the calculation for the function above. It is split out to avoid repetition. - * - * @param node1 - * @param node2 - * @param edgeLength - * @private + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. */ - _calculateSpringForce: function (node1, node2, edgeLength) { - var dx, dy, fx, fy, springForce, distance; + ItemRange.prototype.show = function() { + if (!this.displayed) { + this.redraw(); + } + }; - dx = (node1.x - node2.x); - dy = (node1.y - node2.y); - distance = Math.sqrt(dx * dx + dy * dy); + /** + * Hide the item from the DOM (when visible) + * @return {Boolean} changed + */ + ItemRange.prototype.hide = function() { + if (this.displayed) { + var box = this.dom.box; - if (distance == 0) { - distance = 0.01; + if (box.parentNode) { + box.parentNode.removeChild(box); + } + + this.top = null; + this.left = null; + + this.displayed = false; } + }; - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + /** + * Reposition the item horizontally + * @Override + */ + // TODO: delete the old function + ItemRange.prototype.repositionX = function() { + var props = this.props, + parentWidth = this.parent.width, + start = this.conversion.toScreen(this.data.start), + end = this.conversion.toScreen(this.data.end), + padding = this.options.padding, + contentLeft; + + // limit the width of the this, as browsers cannot draw very wide divs + if (start < -parentWidth) { + start = -parentWidth; + } + if (end > 2 * parentWidth) { + end = 2 * parentWidth; + } + var boxWidth = Math.max(end - start, 1); + + if (this.overflow) { + // when range exceeds left of the window, position the contents at the left of the visible area + contentLeft = Math.max(-start, 0); + + this.left = start; + this.width = boxWidth + this.props.content.width; + // Note: The calculation of width is an optimistic calculation, giving + // a width which will not change when moving the Timeline + // So no restacking needed, which is nicer for the eye; + } + else { // no overflow + // when range exceeds left of the window, position the contents at the left of the visible area + if (start < 0) { + contentLeft = Math.min(-start, + (end - start - props.content.width - 2 * padding)); + // TODO: remove the need for options.padding. it's terrible. + } + else { + contentLeft = 0; + } - fx = dx * springForce; - fy = dy * springForce; + this.left = start; + this.width = boxWidth; + } - node1.fx += fx; - node1.fy += fy; - node2.fx -= fx; - node2.fy -= fy; - }, + this.dom.box.style.left = this.left + 'px'; + this.dom.box.style.width = boxWidth + 'px'; + this.dom.content.style.left = contentLeft + 'px'; + }; + + /** + * Reposition the item vertically + * @Override + */ + ItemRange.prototype.repositionY = function() { + var orientation = this.options.orientation, + box = this.dom.box; + if (orientation == 'top') { + box.style.top = this.top + 'px'; + } + else { + box.style.top = (this.parent.height - this.top - this.height) + 'px'; + } + }; /** - * Load the HTML for the physics config and bind it - * @private + * Repaint a drag area on the left side of the range when the range is selected + * @protected */ - _loadPhysicsConfiguration: function () { - if (this.physicsConfiguration === undefined) { - this.backupConstants = {}; - util.deepExtend(this.backupConstants,this.constants); + ItemRange.prototype._repaintDragLeft = function () { + if (this.selected && this.options.editable.updateTime && !this.dom.dragLeft) { + // create and show drag area + var dragLeft = document.createElement('div'); + dragLeft.className = 'drag-left'; + dragLeft.dragLeftItem = this; + + // TODO: this should be redundant? + Hammer(dragLeft, { + preventDefault: true + }).on('drag', function () { + //console.log('drag left') + }); - var hierarchicalLayoutDirections = ["LR", "RL", "UD", "DU"]; - this.physicsConfiguration = document.createElement('div'); - this.physicsConfiguration.className = "PhysicsConfiguration"; - this.physicsConfiguration.innerHTML = '' + - '' + - '' + - '' + - '' + - '' + - '' + - '
Simulation Mode:
Barnes HutRepulsionHierarchical
' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '
Options:
' - this.containerElement.parentElement.insertBefore(this.physicsConfiguration, this.containerElement); - this.optionsDiv = document.createElement("div"); - this.optionsDiv.style.fontSize = "14px"; - this.optionsDiv.style.fontFamily = "verdana"; - this.containerElement.parentElement.insertBefore(this.optionsDiv, this.containerElement); - - var rangeElement; - rangeElement = document.getElementById('graph_BH_gc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_gc', -1, "physics_barnesHut_gravitationalConstant"); - rangeElement = document.getElementById('graph_BH_cg'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_cg', 1, "physics_centralGravity"); - rangeElement = document.getElementById('graph_BH_sc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sc', 1, "physics_springConstant"); - rangeElement = document.getElementById('graph_BH_sl'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sl', 1, "physics_springLength"); - rangeElement = document.getElementById('graph_BH_damp'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_damp', 1, "physics_damping"); - - rangeElement = document.getElementById('graph_R_nd'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_nd', 1, "physics_repulsion_nodeDistance"); - rangeElement = document.getElementById('graph_R_cg'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_cg', 1, "physics_centralGravity"); - rangeElement = document.getElementById('graph_R_sc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sc', 1, "physics_springConstant"); - rangeElement = document.getElementById('graph_R_sl'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sl', 1, "physics_springLength"); - rangeElement = document.getElementById('graph_R_damp'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_damp', 1, "physics_damping"); + this.dom.box.appendChild(dragLeft); + this.dom.dragLeft = dragLeft; + } + else if (!this.selected && this.dom.dragLeft) { + // delete drag area + if (this.dom.dragLeft.parentNode) { + this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft); + } + this.dom.dragLeft = null; + } + }; - rangeElement = document.getElementById('graph_H_nd'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); - rangeElement = document.getElementById('graph_H_cg'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_cg', 1, "physics_centralGravity"); - rangeElement = document.getElementById('graph_H_sc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sc', 1, "physics_springConstant"); - rangeElement = document.getElementById('graph_H_sl'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sl', 1, "physics_springLength"); - rangeElement = document.getElementById('graph_H_damp'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_damp', 1, "physics_damping"); - rangeElement = document.getElementById('graph_H_direction'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_direction', hierarchicalLayoutDirections, "hierarchicalLayout_direction"); - rangeElement = document.getElementById('graph_H_levsep'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_levsep', 1, "hierarchicalLayout_levelSeparation"); - rangeElement = document.getElementById('graph_H_nspac'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nspac', 1, "hierarchicalLayout_nodeSpacing"); + /** + * Repaint a drag area on the right side of the range when the range is selected + * @protected + */ + ItemRange.prototype._repaintDragRight = function () { + if (this.selected && this.options.editable.updateTime && !this.dom.dragRight) { + // create and show drag area + var dragRight = document.createElement('div'); + dragRight.className = 'drag-right'; + dragRight.dragRightItem = this; + + // TODO: this should be redundant? + Hammer(dragRight, { + preventDefault: true + }).on('drag', function () { + //console.log('drag right') + }); - var radioButton1 = document.getElementById("graph_physicsMethod1"); - var radioButton2 = document.getElementById("graph_physicsMethod2"); - var radioButton3 = document.getElementById("graph_physicsMethod3"); - radioButton2.checked = true; - if (this.constants.physics.barnesHut.enabled) { - radioButton1.checked = true; - } - if (this.constants.hierarchicalLayout.enabled) { - radioButton3.checked = true; + this.dom.box.appendChild(dragRight); + this.dom.dragRight = dragRight; + } + else if (!this.selected && this.dom.dragRight) { + // delete drag area + if (this.dom.dragRight.parentNode) { + this.dom.dragRight.parentNode.removeChild(this.dom.dragRight); } + this.dom.dragRight = null; + } + }; - var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); - var graph_repositionNodes = document.getElementById("graph_repositionNodes"); - var graph_generateOptions = document.getElementById("graph_generateOptions"); + module.exports = ItemRange; - graph_toggleSmooth.onclick = graphToggleSmoothCurves.bind(this); - graph_repositionNodes.onclick = graphRepositionNodes.bind(this); - graph_generateOptions.onclick = graphGenerateOptions.bind(this); - if (this.constants.smoothCurves == true) { - graph_toggleSmooth.style.background = "#A4FF56"; - } - else { - graph_toggleSmooth.style.background = "#FF8532"; - } +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { - switchConfigurations.apply(this); + var Emitter = __webpack_require__(45); + var Hammer = __webpack_require__(41); + var mousetrap = __webpack_require__(46); + var util = __webpack_require__(1); + var hammerUtil = __webpack_require__(42); + var DataSet = __webpack_require__(3); + var DataView = __webpack_require__(4); + var dotparser = __webpack_require__(38); + var gephiParser = __webpack_require__(39); + var Groups = __webpack_require__(34); + var Images = __webpack_require__(35); + var Node = __webpack_require__(36); + var Edge = __webpack_require__(33); + var Popup = __webpack_require__(37); + var MixinLoader = __webpack_require__(44); - radioButton1.onchange = switchConfigurations.bind(this); - radioButton2.onchange = switchConfigurations.bind(this); - radioButton3.onchange = switchConfigurations.bind(this); - } - }, + // Load custom shapes into CanvasRenderingContext2D + __webpack_require__(43); /** - * This overwrites the this.constants. + * @constructor Network + * Create a network visualization, displaying nodes and edges. * - * @param constantsVariableName - * @param value - * @private + * @param {Element} container The DOM element in which the Network will + * be created. Normally a div element. + * @param {Object} data An object containing parameters + * {Array} nodes + * {Array} edges + * @param {Object} options Options */ - _overWriteGraphConstants: function (constantsVariableName, value) { - var nameArray = constantsVariableName.split("_"); - if (nameArray.length == 1) { - this.constants[nameArray[0]] = value; - } - else if (nameArray.length == 2) { - this.constants[nameArray[0]][nameArray[1]] = value; - } - else if (nameArray.length == 3) { - this.constants[nameArray[0]][nameArray[1]][nameArray[2]] = value; - } - } -}; - -/** - * this function is bound to the toggle smooth curves button. That is also why it is not in the prototype. - */ -function graphToggleSmoothCurves () { - this.constants.smoothCurves = !this.constants.smoothCurves; - var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); - if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";} - else {graph_toggleSmooth.style.background = "#FF8532";} + function Network (container, data, options) { + if (!(this instanceof Network)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + + this._initializeMixinLoaders(); + + // create variables and set default values + this.containerElement = container; + this.width = '100%'; + this.height = '100%'; + + // render and calculation settings + this.renderRefreshRate = 60; // hz (fps) + this.renderTimestep = 1000 / this.renderRefreshRate; // ms -- saves calculation later on + this.renderTime = 0.5 * this.renderTimestep; // measured time it takes to render a frame + this.maxPhysicsTicksPerRender = 3; // max amount of physics ticks per render step. + this.physicsDiscreteStepsize = 0.50; // discrete stepsize of the simulation + + this.stabilize = true; // stabilize before displaying the network + this.selectable = true; + this.initializing = true; + + // these functions are triggered when the dataset is edited + this.triggerFunctions = {add:null,edit:null,editEdge:null,connect:null,del:null}; + + + // set constant values + this.constants = { + nodes: { + radiusMin: 10, + radiusMax: 30, + radius: 10, + shape: 'ellipse', + image: undefined, + widthMin: 16, // px + widthMax: 64, // px + fixed: false, + fontColor: 'black', + fontSize: 14, // px + fontFace: 'verdana', + level: -1, + color: { + border: '#2B7CE9', + background: '#97C2FC', + highlight: { + border: '#2B7CE9', + background: '#D2E5FF' + }, + hover: { + border: '#2B7CE9', + background: '#D2E5FF' + } + }, + borderColor: '#2B7CE9', + backgroundColor: '#97C2FC', + highlightColor: '#D2E5FF', + group: undefined, + borderWidth: 1 + }, + edges: { + widthMin: 1, + widthMax: 15, + width: 1, + widthSelectionMultiplier: 2, + hoverWidth: 1.5, + style: 'line', + color: { + color:'#848484', + highlight:'#848484', + hover: '#848484' + }, + fontColor: '#343434', + fontSize: 14, // px + fontFace: 'arial', + fontFill: 'white', + arrowScaleFactor: 1, + dash: { + length: 10, + gap: 5, + altLength: undefined + }, + inheritColor: "from" // to, from, false, true (== from) + }, + configurePhysics:false, + physics: { + barnesHut: { + enabled: true, + theta: 1 / 0.6, // inverted to save time during calculation + gravitationalConstant: -2000, + centralGravity: 0.3, + springLength: 95, + springConstant: 0.04, + damping: 0.09 + }, + repulsion: { + centralGravity: 0.0, + springLength: 200, + springConstant: 0.05, + nodeDistance: 100, + damping: 0.09 + }, + hierarchicalRepulsion: { + enabled: false, + centralGravity: 0.0, + springLength: 100, + springConstant: 0.01, + nodeDistance: 150, + damping: 0.09 + }, + damping: null, + centralGravity: null, + springLength: null, + springConstant: null + }, + clustering: { // Per Node in Cluster = PNiC + enabled: false, // (Boolean) | global on/off switch for clustering. + initialMaxNodes: 100, // (# nodes) | if the initial amount of nodes is larger than this, we cluster until the total number is less than this threshold. + clusterThreshold:500, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than this. If it is, cluster until reduced to reduceToNodes + reduceToNodes:300, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than clusterThreshold. If it is, cluster until reduced to this + chainThreshold: 0.4, // (% of all drawn nodes)| maximum percentage of allowed chainnodes (long strings of connected nodes) within all nodes. (lower means less chains). + clusterEdgeThreshold: 20, // (px) | edge length threshold. if smaller, this node is clustered. + sectorThreshold: 100, // (# nodes in cluster) | cluster size threshold. If larger, expanding in own sector. + screenSizeThreshold: 0.2, // (% of canvas) | relative size threshold. If the width or height of a clusternode takes up this much of the screen, decluster node. + fontSizeMultiplier: 4.0, // (px PNiC) | how much the cluster font size grows per node in cluster (in px). + maxFontSize: 1000, + forceAmplification: 0.1, // (multiplier PNiC) | factor of increase fo the repulsion force of a cluster (per node in cluster). + distanceAmplification: 0.1, // (multiplier PNiC) | factor how much the repulsion distance of a cluster increases (per node in cluster). + edgeGrowth: 20, // (px PNiC) | amount of clusterSize connected to the edge is multiplied with this and added to edgeLength. + nodeScaling: {width: 1, // (px PNiC) | growth of the width per node in cluster. + height: 1, // (px PNiC) | growth of the height per node in cluster. + radius: 1}, // (px PNiC) | growth of the radius per node in cluster. + maxNodeSizeIncrements: 600, // (# increments) | max growth of the width per node in cluster. + activeAreaBoxSize: 80, // (px) | box area around the curser where clusters are popped open. + clusterLevelDifference: 2 + }, + navigation: { + enabled: false + }, + keyboard: { + enabled: false, + speed: {x: 10, y: 10, zoom: 0.02} + }, + dataManipulation: { + enabled: false, + initiallyVisible: false + }, + hierarchicalLayout: { + enabled:false, + levelSeparation: 150, + nodeSpacing: 100, + direction: "UD" // UD, DU, LR, RL + }, + freezeForStabilization: false, + smoothCurves: { + enabled: true, + dynamic: true, + type: "continuous", + roundness: 0.5 + }, + dynamicSmoothCurves: true, + maxVelocity: 30, + minVelocity: 0.1, // px/s + stabilizationIterations: 1000, // maximum number of iteration to stabilize + labels:{ + add:"Add Node", + edit:"Edit", + link:"Add Link", + del:"Delete selected", + editNode:"Edit Node", + editEdge:"Edit Edge", + back:"Back", + addDescription:"Click in an empty space to place a new node.", + linkDescription:"Click on a node and drag the edge to another node to connect them.", + editEdgeDescription:"Click on the control points and drag them to a node to connect to it.", + addError:"The function for add does not support two arguments (data,callback).", + linkError:"The function for connect does not support two arguments (data,callback).", + editError:"The function for edit does not support two arguments (data, callback).", + editBoundError:"No edit function has been bound to this button.", + deleteError:"The function for delete does not support two arguments (data, callback).", + deleteClusterError:"Clusters cannot be deleted." + }, + tooltip: { + delay: 300, + fontColor: 'black', + fontSize: 14, // px + fontFace: 'verdana', + color: { + border: '#666', + background: '#FFFFC6' + } + }, + dragNetwork: true, + dragNodes: true, + zoomable: true, + hover: false, + hideEdgesOnDrag: false, + hideNodesOnDrag: false + }; + this.hoverObj = {nodes:{},edges:{}}; + this.controlNodesActive = false; + + // Node variables + var network = this; + this.groups = new Groups(); // object with groups + this.images = new Images(); // object with images + this.images.setOnloadCallback(function () { + network._redraw(); + }); - this._configureSmoothCurves(false); -}; + // keyboard navigation variables + this.xIncrement = 0; + this.yIncrement = 0; + this.zoomIncrement = 0; -/** - * this function is used to scramble the nodes - * - */ -function graphRepositionNodes () { - for (var nodeId in this.calculationNodes) { - if (this.calculationNodes.hasOwnProperty(nodeId)) { - this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0; - this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0; - } - } - if (this.constants.hierarchicalLayout.enabled == true) { - this._setupHierarchicalLayout(); - } - else { - this.repositionNodes(); - } - this.moving = true; - this.start(); -}; + // loading all the mixins: + // load the force calculation functions, grouped under the physics system. + this._loadPhysicsSystem(); + // create a frame and canvas + this._create(); + // load the sector system. (mandatory, fully integrated with Network) + this._loadSectorSystem(); + // load the cluster system. (mandatory, even when not using the cluster system, there are function calls to it) + this._loadClusterSystem(); + // load the selection system. (mandatory, required by Network) + this._loadSelectionSystem(); + // load the selection system. (mandatory, required by Network) + this._loadHierarchySystem(); + + // apply options + this._setTranslation(this.frame.clientWidth / 2, this.frame.clientHeight / 2); + this._setScale(1); + this.setOptions(options); -/** - * this is used to generate an options file from the playing with physics system. - */ -function graphGenerateOptions () { - var options = "No options are required, default values used."; - var optionsSpecific = []; - var radioButton1 = document.getElementById("graph_physicsMethod1"); - var radioButton2 = document.getElementById("graph_physicsMethod2"); - if (radioButton1.checked == true) { - if (this.constants.physics.barnesHut.gravitationalConstant != this.backupConstants.physics.barnesHut.gravitationalConstant) {optionsSpecific.push("gravitationalConstant: " + this.constants.physics.barnesHut.gravitationalConstant);} - if (this.constants.physics.centralGravity != this.backupConstants.physics.barnesHut.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} - if (this.constants.physics.springLength != this.backupConstants.physics.barnesHut.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} - if (this.constants.physics.springConstant != this.backupConstants.physics.barnesHut.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} - if (this.constants.physics.damping != this.backupConstants.physics.barnesHut.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} - if (optionsSpecific.length != 0) { - options = "var options = {"; - options += "physics: {barnesHut: {"; - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", " - } + // other vars + this.freezeSimulation = false;// freeze the simulation + this.cachedFunctions = {}; + + // containers for nodes and edges + this.calculationNodes = {}; + this.calculationNodeIndices = []; + this.nodeIndices = []; // array with all the indices of the nodes. Used to speed up forces calculation + this.nodes = {}; // object with Node objects + this.edges = {}; // object with Edge objects + + // position and scale variables and objects + this.canvasTopLeft = {"x": 0,"y": 0}; // coordinates of the top left of the canvas. they will be set during _redraw. + this.canvasBottomRight = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw + this.pointerPosition = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw + this.areaCenter = {}; // object with x and y elements used for determining the center of the zoom action + this.scale = 1; // defining the global scale variable in the constructor + this.previousScale = this.scale; // this is used to check if the zoom operation is zooming in or out + + // datasets or dataviews + this.nodesData = null; // A DataSet or DataView + this.edgesData = null; // A DataSet or DataView + + // create event listeners used to subscribe on the DataSets of the nodes and edges + this.nodesListeners = { + 'add': function (event, params) { + network._addNodes(params.items); + network.start(); + }, + 'update': function (event, params) { + network._updateNodes(params.items); + network.start(); + }, + 'remove': function (event, params) { + network._removeNodes(params.items); + network.start(); } - options += '}}' - } - if (this.constants.smoothCurves != this.backupConstants.smoothCurves) { - if (optionsSpecific.length == 0) {options = "var options = {";} - else {options += ", "} - options += "smoothCurves: " + this.constants.smoothCurves; - } - if (options != "No options are required, default values used.") { - options += '};' - } - } - else if (radioButton2.checked == true) { - options = "var options = {"; - options += "physics: {barnesHut: {enabled: false}"; - if (this.constants.physics.repulsion.nodeDistance != this.backupConstants.physics.repulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.repulsion.nodeDistance);} - if (this.constants.physics.centralGravity != this.backupConstants.physics.repulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} - if (this.constants.physics.springLength != this.backupConstants.physics.repulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} - if (this.constants.physics.springConstant != this.backupConstants.physics.repulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} - if (this.constants.physics.damping != this.backupConstants.physics.repulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} - if (optionsSpecific.length != 0) { - options += ", repulsion: {"; - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", " - } - } - options += '}}' - } - if (optionsSpecific.length == 0) {options += "}"} - if (this.constants.smoothCurves != this.backupConstants.smoothCurves) { - options += ", smoothCurves: " + this.constants.smoothCurves; - } - options += '};' - } - else { - options = "var options = {"; - if (this.constants.physics.hierarchicalRepulsion.nodeDistance != this.backupConstants.physics.hierarchicalRepulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.hierarchicalRepulsion.nodeDistance);} - if (this.constants.physics.centralGravity != this.backupConstants.physics.hierarchicalRepulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} - if (this.constants.physics.springLength != this.backupConstants.physics.hierarchicalRepulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} - if (this.constants.physics.springConstant != this.backupConstants.physics.hierarchicalRepulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} - if (this.constants.physics.damping != this.backupConstants.physics.hierarchicalRepulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} - if (optionsSpecific.length != 0) { - options += "physics: {hierarchicalRepulsion: {"; - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", "; - } - } - options += '}},'; - } - options += 'hierarchicalLayout: {'; - optionsSpecific = []; - if (this.constants.hierarchicalLayout.direction != this.backupConstants.hierarchicalLayout.direction) {optionsSpecific.push("direction: " + this.constants.hierarchicalLayout.direction);} - if (Math.abs(this.constants.hierarchicalLayout.levelSeparation) != this.backupConstants.hierarchicalLayout.levelSeparation) {optionsSpecific.push("levelSeparation: " + this.constants.hierarchicalLayout.levelSeparation);} - if (this.constants.hierarchicalLayout.nodeSpacing != this.backupConstants.hierarchicalLayout.nodeSpacing) {optionsSpecific.push("nodeSpacing: " + this.constants.hierarchicalLayout.nodeSpacing);} - if (optionsSpecific.length != 0) { - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", " - } - } - options += '}' - } - else { - options += "enabled:true}"; - } - options += '};' - } - + }; + this.edgesListeners = { + 'add': function (event, params) { + network._addEdges(params.items); + network.start(); + }, + 'update': function (event, params) { + network._updateEdges(params.items); + network.start(); + }, + 'remove': function (event, params) { + network._removeEdges(params.items); + network.start(); + } + }; - this.optionsDiv.innerHTML = options; + // properties for the animation + this.moving = true; + this.timer = undefined; // Scheduling function. Is definded in this.start(); -}; + // load data (the disable start variable will be the same as the enabled clustering) + this.setData(data,this.constants.clustering.enabled || this.constants.hierarchicalLayout.enabled); -/** - * this is used to switch between barnesHut, repulsion and hierarchical. - * - */ -function switchConfigurations () { - var ids = ["graph_BH_table", "graph_R_table", "graph_H_table"]; - var radioButton = document.querySelector('input[name="graph_physicsMethod"]:checked').value; - var tableId = "graph_" + radioButton + "_table"; - var table = document.getElementById(tableId); - table.style.display = "block"; - for (var i = 0; i < ids.length; i++) { - if (ids[i] != tableId) { - table = document.getElementById(ids[i]); - table.style.display = "none"; - } - } - this._restoreNodes(); - if (radioButton == "R") { - this.constants.hierarchicalLayout.enabled = false; - this.constants.physics.hierarchicalRepulsion.enabled = false; - this.constants.physics.barnesHut.enabled = false; - } - else if (radioButton == "H") { - if (this.constants.hierarchicalLayout.enabled == false) { - this.constants.hierarchicalLayout.enabled = true; - this.constants.physics.hierarchicalRepulsion.enabled = true; - this.constants.physics.barnesHut.enabled = false; + // hierarchical layout + this.initializing = false; + if (this.constants.hierarchicalLayout.enabled == true) { this._setupHierarchicalLayout(); } - } - else { - this.constants.hierarchicalLayout.enabled = false; - this.constants.physics.hierarchicalRepulsion.enabled = false; - this.constants.physics.barnesHut.enabled = true; - } - this._loadSelectedForceSolver(); - var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); - if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";} - else {graph_toggleSmooth.style.background = "#FF8532";} - this.moving = true; - this.start(); - -} - - -/** - * this generates the ranges depending on the iniital values. - * - * @param id - * @param map - * @param constantsVariableName - */ -function showValueOfRange (id,map,constantsVariableName) { - var valueId = id + "_value"; - var rangeValue = document.getElementById(id).value; - - if (map instanceof Array) { - document.getElementById(valueId).value = map[parseInt(rangeValue)]; - this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]); - } - else { - document.getElementById(valueId).value = parseInt(map) * parseFloat(rangeValue); - this._overWriteGraphConstants(constantsVariableName, parseInt(map) * parseFloat(rangeValue)); - } + else { + // zoom so all data will fit on the screen, if clustering is enabled, we do not want start to be called here. + if (this.stabilize == false) { + this.zoomExtent(true,this.constants.clustering.enabled); + } + } - if (constantsVariableName == "hierarchicalLayout_direction" || - constantsVariableName == "hierarchicalLayout_levelSeparation" || - constantsVariableName == "hierarchicalLayout_nodeSpacing") { - this._setupHierarchicalLayout(); + // if clustering is disabled, the simulation will have started in the setData function + if (this.constants.clustering.enabled) { + this.startWithClustering(); + } } - this.moving = true; - this.start(); -}; - - - -/** - * Created by Alex on 2/10/14. - */ - -var hierarchalRepulsionMixin = { + // Extend Network with an Emitter mixin + Emitter(Network.prototype); /** - * Calculate the forces the nodes apply on eachother based on a repulsion field. - * This field is linearly approximated. + * Get the script path where the vis.js library is located * + * @returns {string | null} path Path or null when not found. Path does not + * end with a slash. * @private */ - _calculateNodeForces: function () { - var dx, dy, distance, fx, fy, combinedClusterSize, - repulsingForce, node1, node2, i, j; - - var nodes = this.calculationNodes; - var nodeIndices = this.calculationNodeIndices; - - // approximation constants - var b = 5; - var a_base = 0.5 * -b; - - - // repulsing forces between nodes - var nodeDistance = this.constants.physics.hierarchicalRepulsion.nodeDistance; - var minimumDistance = nodeDistance; - var a = a_base / minimumDistance; - - // we loop from i over all but the last entree in the array - // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j - for (i = 0; i < nodeIndices.length - 1; i++) { - - node1 = nodes[nodeIndices[i]]; - for (j = i + 1; j < nodeIndices.length; j++) { - node2 = nodes[nodeIndices[j]]; - if (node1.level == node2.level) { - - dx = node2.x - node1.x; - dy = node2.y - node1.y; - distance = Math.sqrt(dx * dx + dy * dy); - - - if (distance < 2 * minimumDistance) { - repulsingForce = a * distance + b; - var c = 0.05; - var d = 2 * minimumDistance * 2 * c; - repulsingForce = c * Math.pow(distance,2) - d * distance + d*d/(4*c); + Network.prototype._getScriptPath = function() { + var scripts = document.getElementsByTagName( 'script' ); - // normalize force with - if (distance == 0) { - distance = 0.01; - } - else { - repulsingForce = repulsingForce / distance; - } - fx = dx * repulsingForce; - fy = dy * repulsingForce; - - node1.fx -= fx; - node1.fy -= fy; - node2.fx += fx; - node2.fy += fy; - } - } + // find script named vis.js or vis.min.js + for (var i = 0; i < scripts.length; i++) { + var src = scripts[i].src; + var match = src && /\/?vis(.min)?\.js$/.exec(src); + if (match) { + // return path without the script name + return src.substring(0, src.length - match[0].length); } } - }, + + return null; + }; /** - * this function calculates the effects of the springs in the case of unsmooth curves. - * + * Find the center position of the network * @private */ - _calculateHierarchicalSpringForces: function () { - var edgeLength, edge, edgeId; - var dx, dy, fx, fy, springForce, distance; - var edges = this.edges; - - // forces caused by the edges, modelled as springs - for (edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - edge = edges[edgeId]; - if (edge.connected) { - // only calculate forces if nodes are in the same sector - if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { - edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; - // this implies that the edges between big clusters are longer - edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; - - dx = (edge.from.x - edge.to.x); - dy = (edge.from.y - edge.to.y); - distance = Math.sqrt(dx * dx + dy * dy); - - if (distance == 0) { - distance = 0.01; - } - - distance = Math.max(0.8*edgeLength,Math.min(5*edgeLength, distance)); - - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; - - fx = dx * springForce; - fy = dy * springForce; - - edge.to.fx -= fx; - edge.to.fy -= fy; - edge.from.fx += fx; - edge.from.fy += fy; - - - var factor = 5; - if (distance > edgeLength) { - factor = 25; - } - - if (edge.from.level > edge.to.level) { - edge.to.fx -= factor*fx; - edge.to.fy -= factor*fy; - } - else if (edge.from.level < edge.to.level) { - edge.from.fx += factor*fx; - edge.from.fy += factor*fy; - } - } - } + Network.prototype._getRange = function() { + var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (minX > (node.x)) {minX = node.x;} + if (maxX < (node.x)) {maxX = node.x;} + if (minY > (node.y)) {minY = node.y;} + if (maxY < (node.y)) {maxY = node.y;} } } - } -}; -/** - * Created by Alex on 2/10/14. - */ + if (minX == 1e9 && maxX == -1e9 && minY == 1e9 && maxY == -1e9) { + minY = 0, maxY = 0, minX = 0, maxX = 0; + } + return {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; + }; -var barnesHutMixin = { /** - * This function calculates the forces the nodes apply on eachother based on a gravitational model. - * The Barnes Hut method is used to speed up this N-body simulation. - * + * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; + * @returns {{x: number, y: number}} * @private */ - _calculateNodeForces : function() { - if (this.constants.physics.barnesHut.gravitationalConstant != 0) { - var node; - var nodes = this.calculationNodes; - var nodeIndices = this.calculationNodeIndices; - var nodeCount = nodeIndices.length; + Network.prototype._findCenter = function(range) { + return {x: (0.5 * (range.maxX + range.minX)), + y: (0.5 * (range.maxY + range.minY))}; + }; - this._formBarnesHutTree(nodes,nodeIndices); - var barnesHutTree = this.barnesHutTree; + /** + * center the network + * + * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; + */ + Network.prototype._centerNetwork = function(range) { + var center = this._findCenter(range); - // place the nodes one by one recursively - for (var i = 0; i < nodeCount; i++) { - node = nodes[nodeIndices[i]]; - // starting with root is irrelevant, it never passes the BarnesHut condition - this._getForceContribution(barnesHutTree.root.children.NW,node); - this._getForceContribution(barnesHutTree.root.children.NE,node); - this._getForceContribution(barnesHutTree.root.children.SW,node); - this._getForceContribution(barnesHutTree.root.children.SE,node); - } - } - }, + center.x *= this.scale; + center.y *= this.scale; + center.x -= 0.5 * this.frame.canvas.clientWidth; + center.y -= 0.5 * this.frame.canvas.clientHeight; + + this._setTranslation(-center.x,-center.y); // set at 0,0 + }; /** - * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. - * If a region contains a single node, we check if it is not itself, then we apply the force. + * This function zooms out to fit all data on screen based on amount of nodes * - * @param parentBranch - * @param node - * @private + * @param {Boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false; + * @param {Boolean} [disableStart] | If true, start is not called. */ - _getForceContribution : function(parentBranch,node) { - // we get no force contribution from an empty region - if (parentBranch.childrenCount > 0) { - var dx,dy,distance; + Network.prototype.zoomExtent = function(initialZoom, disableStart) { + if (initialZoom === undefined) { + initialZoom = false; + } + if (disableStart === undefined) { + disableStart = false; + } - // get the distance from the center of mass to the node. - dx = parentBranch.centerOfMass.x - node.x; - dy = parentBranch.centerOfMass.y - node.y; - distance = Math.sqrt(dx * dx + dy * dy); + var range = this._getRange(); + var zoomLevel; - // BarnesHut condition - // original condition : s/d < theta = passed === d/s > 1/theta = passed - // calcSize = 1/s --> d * 1/s > 1/theta = passed - if (distance * parentBranch.calcSize > this.constants.physics.barnesHut.theta) { - // duplicate code to reduce function calls to speed up program - if (distance == 0) { - distance = 0.1*Math.random(); - dx = distance; + if (initialZoom == true) { + var numberOfNodes = this.nodeIndices.length; + if (this.constants.smoothCurves == true) { + if (this.constants.clustering.enabled == true && + numberOfNodes >= this.constants.clustering.initialMaxNodes) { + zoomLevel = 49.07548 / (numberOfNodes + 142.05338) + 9.1444e-04; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. + } + else { + zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. } - var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); - var fx = dx * gravityForce; - var fy = dy * gravityForce; - node.fx += fx; - node.fy += fy; } else { - // Did not pass the condition, go into children if available - if (parentBranch.childrenCount == 4) { - this._getForceContribution(parentBranch.children.NW,node); - this._getForceContribution(parentBranch.children.NE,node); - this._getForceContribution(parentBranch.children.SW,node); - this._getForceContribution(parentBranch.children.SE,node); + if (this.constants.clustering.enabled == true && + numberOfNodes >= this.constants.clustering.initialMaxNodes) { + zoomLevel = 77.5271985 / (numberOfNodes + 187.266146) + 4.76710517e-05; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. } - else { // parentBranch must have only one node, if it was empty we wouldnt be here - if (parentBranch.children.data.id != node.id) { // if it is not self - // duplicate code to reduce function calls to speed up program - if (distance == 0) { - distance = 0.5*Math.random(); - dx = distance; - } - var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); - var fx = dx * gravityForce; - var fy = dy * gravityForce; - node.fx += fx; - node.fy += fy; - } + else { + zoomLevel = 30.5062972 / (numberOfNodes + 19.93597763) + 0.08413486; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. } } - } - }, - - /** - * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. - * - * @param nodes - * @param nodeIndices - * @private - */ - _formBarnesHutTree : function(nodes,nodeIndices) { - var node; - var nodeCount = nodeIndices.length; - - var minX = Number.MAX_VALUE, - minY = Number.MAX_VALUE, - maxX =-Number.MAX_VALUE, - maxY =-Number.MAX_VALUE; - - // get the range of the nodes - for (var i = 0; i < nodeCount; i++) { - var x = nodes[nodeIndices[i]].x; - var y = nodes[nodeIndices[i]].y; - if (x < minX) { minX = x; } - if (x > maxX) { maxX = x; } - if (y < minY) { minY = y; } - if (y > maxY) { maxY = y; } - } - // make the range a square - var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y - if (sizeDiff > 0) {minY -= 0.5 * sizeDiff; maxY += 0.5 * sizeDiff;} // xSize > ySize - else {minX += 0.5 * sizeDiff; maxX -= 0.5 * sizeDiff;} // xSize < ySize - - var minimumTreeSize = 1e-5; - var rootSize = Math.max(minimumTreeSize,Math.abs(maxX - minX)); - var halfRootSize = 0.5 * rootSize; - var centerX = 0.5 * (minX + maxX), centerY = 0.5 * (minY + maxY); + // correct for larger canvasses. + var factor = Math.min(this.frame.canvas.clientWidth / 600, this.frame.canvas.clientHeight / 600); + zoomLevel *= factor; + } + else { + var xDistance = (Math.abs(range.minX) + Math.abs(range.maxX)) * 1.1; + var yDistance = (Math.abs(range.minY) + Math.abs(range.maxY)) * 1.1; - // construct the barnesHutTree - var barnesHutTree = {root:{ - centerOfMass:{x:0,y:0}, // Center of Mass - mass:0, - range: {minX:centerX-halfRootSize,maxX:centerX+halfRootSize, - minY:centerY-halfRootSize,maxY:centerY+halfRootSize}, + var xZoomLevel = this.frame.canvas.clientWidth / xDistance; + var yZoomLevel = this.frame.canvas.clientHeight / yDistance; - size: rootSize, - calcSize: 1 / rootSize, - children: {data:null}, - maxWidth: 0, - level: 0, - childrenCount: 4 - }}; - this._splitBranch(barnesHutTree.root); + zoomLevel = (xZoomLevel <= yZoomLevel) ? xZoomLevel : yZoomLevel; + } - // place the nodes one by one recursively - for (i = 0; i < nodeCount; i++) { - node = nodes[nodeIndices[i]]; - this._placeInTree(barnesHutTree.root,node); + if (zoomLevel > 1.0) { + zoomLevel = 1.0; } - // make global - this.barnesHutTree = barnesHutTree - }, + + this._setScale(zoomLevel); + this._centerNetwork(range); + if (disableStart == false) { + this.moving = true; + this.start(); + } + }; /** - * this updates the mass of a branch. this is increased by adding a node. - * - * @param parentBranch - * @param node + * Update the this.nodeIndices with the most recent node index list * @private */ - _updateBranchMass : function(parentBranch, node) { - var totalMass = parentBranch.mass + node.mass; - var totalMassInv = 1/totalMass; - - parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.mass; - parentBranch.centerOfMass.x *= totalMassInv; - - parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.mass; - parentBranch.centerOfMass.y *= totalMassInv; - - parentBranch.mass = totalMass; - var biggestSize = Math.max(Math.max(node.height,node.radius),node.width); - parentBranch.maxWidth = (parentBranch.maxWidth < biggestSize) ? biggestSize : parentBranch.maxWidth; - - }, + Network.prototype._updateNodeIndexList = function() { + this._clearNodeIndexList(); + for (var idx in this.nodes) { + if (this.nodes.hasOwnProperty(idx)) { + this.nodeIndices.push(idx); + } + } + }; /** - * determine in which branch the node will be placed. + * Set nodes and edges, and optionally options as well. * - * @param parentBranch - * @param node - * @param skipMassUpdate - * @private + * @param {Object} data Object containing parameters: + * {Array | DataSet | DataView} [nodes] Array with nodes + * {Array | DataSet | DataView} [edges] Array with edges + * {String} [dot] String containing data in DOT format + * {String} [gephi] String containing data in gephi JSON format + * {Options} [options] Object with options + * @param {Boolean} [disableStart] | optional: disable the calling of the start function. */ - _placeInTree : function(parentBranch,node,skipMassUpdate) { - if (skipMassUpdate != true || skipMassUpdate === undefined) { - // update the mass of the branch. - this._updateBranchMass(parentBranch,node); + Network.prototype.setData = function(data, disableStart) { + if (disableStart === undefined) { + disableStart = false; } - if (parentBranch.children.NW.range.maxX > node.x) { // in NW or SW - if (parentBranch.children.NW.range.maxY > node.y) { // in NW - this._placeInRegion(parentBranch,node,"NW"); + if (data && data.dot && (data.nodes || data.edges)) { + throw new SyntaxError('Data must contain either parameter "dot" or ' + + ' parameter pair "nodes" and "edges", but not both.'); + } + + // set options + this.setOptions(data && data.options); + + // set all data + if (data && data.dot) { + // parse DOT file + if(data && data.dot) { + var dotData = dotparser.DOTToGraph(data.dot); + this.setData(dotData); + return; } - else { // in SW - this._placeInRegion(parentBranch,node,"SW"); + } + else if (data && data.gephi) { + // parse DOT file + if(data && data.gephi) { + var gephiData = gephiParser.parseGephi(data.gephi); + this.setData(gephiData); + return; } } - else { // in NE or SE - if (parentBranch.children.NW.range.maxY > node.y) { // in NE - this._placeInRegion(parentBranch,node,"NE"); + else { + this._setNodes(data && data.nodes); + this._setEdges(data && data.edges); + } + + this._putDataInSector(); + if (!disableStart) { + // find a stable position or start animating to a stable position + if (this.stabilize) { + var me = this; + setTimeout(function() {me._stabilize(); me.start();},0) } - else { // in SE - this._placeInRegion(parentBranch,node,"SE"); + else { + this.start(); } } - }, - + }; /** - * actually place the node in a region (or branch) - * - * @param parentBranch - * @param node - * @param region - * @private + * Set options + * @param {Object} options + * @param {Boolean} [initializeView] | set zoom and translation to default. */ - _placeInRegion : function(parentBranch,node,region) { - switch (parentBranch.children[region].childrenCount) { - case 0: // place node here - parentBranch.children[region].children.data = node; - parentBranch.children[region].childrenCount = 1; - this._updateBranchMass(parentBranch.children[region],node); - break; - case 1: // convert into children - // if there are two nodes exactly overlapping (on init, on opening of cluster etc.) - // we move one node a pixel and we do not put it in the tree. - if (parentBranch.children[region].children.data.x == node.x && - parentBranch.children[region].children.data.y == node.y) { - node.x += Math.random(); - node.y += Math.random(); + Network.prototype.setOptions = function (options) { + if (options) { + var prop; + // retrieve parameter values + if (options.width !== undefined) {this.width = options.width;} + if (options.height !== undefined) {this.height = options.height;} + if (options.stabilize !== undefined) {this.stabilize = options.stabilize;} + if (options.selectable !== undefined) {this.selectable = options.selectable;} + if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;} + if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;} + if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;} + if (options.dragNetwork !== undefined) {this.constants.dragNetwork = options.dragNetwork;} + if (options.dragNodes !== undefined) {this.constants.dragNodes = options.dragNodes;} + if (options.zoomable !== undefined) {this.constants.zoomable = options.zoomable;} + if (options.hover !== undefined) {this.constants.hover = options.hover;} + if (options.hideEdgesOnDrag !== undefined) {this.constants.hideEdgesOnDrag = options.hideEdgesOnDrag;} + if (options.hideNodesOnDrag !== undefined) {this.constants.hideNodesOnDrag = options.hideNodesOnDrag;} + + // TODO: deprecated since version 3.0.0. Cleanup some day + if (options.dragGraph !== undefined) { + throw new Error('Option dragGraph is renamed to dragNetwork'); + } + + if (options.labels !== undefined) { + for (prop in options.labels) { + if (options.labels.hasOwnProperty(prop)) { + this.constants.labels[prop] = options.labels[prop]; + } + } + } + + if (options.onAdd) { + this.triggerFunctions.add = options.onAdd; + } + + if (options.onEdit) { + this.triggerFunctions.edit = options.onEdit; + } + + if (options.onEditEdge) { + this.triggerFunctions.editEdge = options.onEditEdge; + } + + if (options.onConnect) { + this.triggerFunctions.connect = options.onConnect; + } + + if (options.onDelete) { + this.triggerFunctions.del = options.onDelete; + } + + if (options.physics) { + if (options.physics.barnesHut) { + this.constants.physics.barnesHut.enabled = true; + for (prop in options.physics.barnesHut) { + if (options.physics.barnesHut.hasOwnProperty(prop)) { + this.constants.physics.barnesHut[prop] = options.physics.barnesHut[prop]; + } + } + } + + if (options.physics.repulsion) { + this.constants.physics.barnesHut.enabled = false; + for (prop in options.physics.repulsion) { + if (options.physics.repulsion.hasOwnProperty(prop)) { + this.constants.physics.repulsion[prop] = options.physics.repulsion[prop]; + } + } + } + + if (options.physics.hierarchicalRepulsion) { + this.constants.hierarchicalLayout.enabled = true; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this.constants.physics.barnesHut.enabled = false; + for (prop in options.physics.hierarchicalRepulsion) { + if (options.physics.hierarchicalRepulsion.hasOwnProperty(prop)) { + this.constants.physics.hierarchicalRepulsion[prop] = options.physics.hierarchicalRepulsion[prop]; + } + } + } + } + + if (options.smoothCurves !== undefined) { + if (typeof options.smoothCurves == 'boolean') { + this.constants.smoothCurves.enabled = options.smoothCurves; } else { - this._splitBranch(parentBranch.children[region]); - this._placeInTree(parentBranch.children[region],node); + this.constants.smoothCurves.enabled = true; + for (prop in options.smoothCurves) { + if (options.smoothCurves.hasOwnProperty(prop)) { + this.constants.smoothCurves[prop] = options.smoothCurves[prop]; + } + } } - break; - case 4: // place in branch - this._placeInTree(parentBranch.children[region],node); - break; + } + + if (options.hierarchicalLayout) { + this.constants.hierarchicalLayout.enabled = true; + for (prop in options.hierarchicalLayout) { + if (options.hierarchicalLayout.hasOwnProperty(prop)) { + this.constants.hierarchicalLayout[prop] = options.hierarchicalLayout[prop]; + } + } + } + else if (options.hierarchicalLayout !== undefined) { + this.constants.hierarchicalLayout.enabled = false; + } + + if (options.clustering) { + this.constants.clustering.enabled = true; + for (prop in options.clustering) { + if (options.clustering.hasOwnProperty(prop)) { + this.constants.clustering[prop] = options.clustering[prop]; + } + } + } + else if (options.clustering !== undefined) { + this.constants.clustering.enabled = false; + } + + if (options.navigation) { + this.constants.navigation.enabled = true; + for (prop in options.navigation) { + if (options.navigation.hasOwnProperty(prop)) { + this.constants.navigation[prop] = options.navigation[prop]; + } + } + } + else if (options.navigation !== undefined) { + this.constants.navigation.enabled = false; + } + + if (options.keyboard) { + this.constants.keyboard.enabled = true; + for (prop in options.keyboard) { + if (options.keyboard.hasOwnProperty(prop)) { + this.constants.keyboard[prop] = options.keyboard[prop]; + } + } + } + else if (options.keyboard !== undefined) { + this.constants.keyboard.enabled = false; + } + + if (options.dataManipulation) { + this.constants.dataManipulation.enabled = true; + for (prop in options.dataManipulation) { + if (options.dataManipulation.hasOwnProperty(prop)) { + this.constants.dataManipulation[prop] = options.dataManipulation[prop]; + } + } + this.editMode = this.constants.dataManipulation.initiallyVisible; + } + else if (options.dataManipulation !== undefined) { + this.constants.dataManipulation.enabled = false; + } + + // TODO: work out these options and document them + if (options.edges) { + for (prop in options.edges) { + if (options.edges.hasOwnProperty(prop)) { + if (typeof options.edges[prop] != "object") { + this.constants.edges[prop] = options.edges[prop]; + } + } + } + + if (options.edges.color !== undefined) { + if (util.isString(options.edges.color)) { + this.constants.edges.color = {}; + this.constants.edges.color.color = options.edges.color; + this.constants.edges.color.highlight = options.edges.color; + this.constants.edges.color.hover = options.edges.color; + } + else { + if (options.edges.color.color !== undefined) {this.constants.edges.color.color = options.edges.color.color;} + if (options.edges.color.highlight !== undefined) {this.constants.edges.color.highlight = options.edges.color.highlight;} + if (options.edges.color.hover !== undefined) {this.constants.edges.color.hover = options.edges.color.hover;} + } + } + + if (!options.edges.fontColor) { + if (options.edges.color !== undefined) { + if (util.isString(options.edges.color)) {this.constants.edges.fontColor = options.edges.color;} + else if (options.edges.color.color !== undefined) {this.constants.edges.fontColor = options.edges.color.color;} + } + } + + // Added to support dashed lines + // David Jordan + // 2012-08-08 + if (options.edges.dash) { + if (options.edges.dash.length !== undefined) { + this.constants.edges.dash.length = options.edges.dash.length; + } + if (options.edges.dash.gap !== undefined) { + this.constants.edges.dash.gap = options.edges.dash.gap; + } + if (options.edges.dash.altLength !== undefined) { + this.constants.edges.dash.altLength = options.edges.dash.altLength; + } + } + } + + if (options.nodes) { + for (prop in options.nodes) { + if (options.nodes.hasOwnProperty(prop)) { + this.constants.nodes[prop] = options.nodes[prop]; + } + } + + if (options.nodes.color) { + this.constants.nodes.color = util.parseColor(options.nodes.color); + } + + /* + if (options.nodes.widthMin) this.constants.nodes.radiusMin = options.nodes.widthMin; + if (options.nodes.widthMax) this.constants.nodes.radiusMax = options.nodes.widthMax; + */ + } + if (options.groups) { + for (var groupname in options.groups) { + if (options.groups.hasOwnProperty(groupname)) { + var group = options.groups[groupname]; + this.groups.add(groupname, group); + } + } + } + + if (options.tooltip) { + for (prop in options.tooltip) { + if (options.tooltip.hasOwnProperty(prop)) { + this.constants.tooltip[prop] = options.tooltip[prop]; + } + } + if (options.tooltip.color) { + this.constants.tooltip.color = util.parseColor(options.tooltip.color); + } + } } - }, + // (Re)loading the mixins that can be enabled or disabled in the options. + // load the force calculation functions, grouped under the physics system. + this._loadPhysicsSystem(); + // load the navigation system. + this._loadNavigationControls(); + // load the data manipulation system + this._loadManipulationSystem(); + // configure the smooth curves + this._configureSmoothCurves(); + + + // bind keys. If disabled, this will not do anything; + this._createKeyBinds(); + this.setSize(this.width, this.height); + this.moving = true; + this.start(); + + }; + /** - * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch - * after the split is complete. - * - * @param parentBranch + * Create the main frame for the Network. + * This function is executed once when a Network object is created. The frame + * contains a canvas, and this canvas contains all objects like the axis and + * nodes. * @private */ - _splitBranch : function(parentBranch) { - // if the branch is shaded with a node, replace the node in the new subset. - var containedNode = null; - if (parentBranch.childrenCount == 1) { - containedNode = parentBranch.children.data; - parentBranch.mass = 0; parentBranch.centerOfMass.x = 0; parentBranch.centerOfMass.y = 0; + Network.prototype._create = function () { + // remove all elements from the container element. + while (this.containerElement.hasChildNodes()) { + this.containerElement.removeChild(this.containerElement.firstChild); } - parentBranch.childrenCount = 4; - parentBranch.children.data = null; - this._insertRegion(parentBranch,"NW"); - this._insertRegion(parentBranch,"NE"); - this._insertRegion(parentBranch,"SW"); - this._insertRegion(parentBranch,"SE"); - if (containedNode != null) { - this._placeInTree(parentBranch,containedNode); + this.frame = document.createElement('div'); + this.frame.className = 'network-frame'; + this.frame.style.position = 'relative'; + this.frame.style.overflow = 'hidden'; + + // create the network canvas (HTML canvas element) + this.frame.canvas = document.createElement( 'canvas' ); + this.frame.canvas.style.position = 'relative'; + this.frame.appendChild(this.frame.canvas); + if (!this.frame.canvas.getContext) { + var noCanvas = document.createElement( 'DIV' ); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold' ; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.frame.canvas.appendChild(noCanvas); } - }, + + var me = this; + this.drag = {}; + this.pinch = {}; + this.hammer = Hammer(this.frame.canvas, { + prevent_default: true + }); + this.hammer.on('tap', me._onTap.bind(me) ); + this.hammer.on('doubletap', me._onDoubleTap.bind(me) ); + this.hammer.on('hold', me._onHold.bind(me) ); + this.hammer.on('pinch', me._onPinch.bind(me) ); + this.hammer.on('touch', me._onTouch.bind(me) ); + this.hammer.on('dragstart', me._onDragStart.bind(me) ); + this.hammer.on('drag', me._onDrag.bind(me) ); + this.hammer.on('dragend', me._onDragEnd.bind(me) ); + this.hammer.on('release', me._onRelease.bind(me) ); + this.hammer.on('mousewheel',me._onMouseWheel.bind(me) ); + this.hammer.on('DOMMouseScroll',me._onMouseWheel.bind(me) ); // for FF + this.hammer.on('mousemove', me._onMouseMoveTitle.bind(me) ); + + // add the frame to the container element + this.containerElement.appendChild(this.frame); + + }; /** - * This function subdivides the region into four new segments. - * Specifically, this inserts a single new segment. - * It fills the children section of the parentBranch - * - * @param parentBranch - * @param region - * @param parentRange + * Binding the keys for keyboard navigation. These functions are defined in the NavigationMixin * @private */ - _insertRegion : function(parentBranch, region) { - var minX,maxX,minY,maxY; - var childSize = 0.5 * parentBranch.size; - switch (region) { - case "NW": - minX = parentBranch.range.minX; - maxX = parentBranch.range.minX + childSize; - minY = parentBranch.range.minY; - maxY = parentBranch.range.minY + childSize; - break; - case "NE": - minX = parentBranch.range.minX + childSize; - maxX = parentBranch.range.maxX; - minY = parentBranch.range.minY; - maxY = parentBranch.range.minY + childSize; - break; - case "SW": - minX = parentBranch.range.minX; - maxX = parentBranch.range.minX + childSize; - minY = parentBranch.range.minY + childSize; - maxY = parentBranch.range.maxY; - break; - case "SE": - minX = parentBranch.range.minX + childSize; - maxX = parentBranch.range.maxX; - minY = parentBranch.range.minY + childSize; - maxY = parentBranch.range.maxY; - break; + Network.prototype._createKeyBinds = function() { + var me = this; + this.mousetrap = mousetrap; + + this.mousetrap.reset(); + + if (this.constants.keyboard.enabled == true) { + this.mousetrap.bind("up", this._moveUp.bind(me) , "keydown"); + this.mousetrap.bind("up", this._yStopMoving.bind(me), "keyup"); + this.mousetrap.bind("down", this._moveDown.bind(me) , "keydown"); + this.mousetrap.bind("down", this._yStopMoving.bind(me), "keyup"); + this.mousetrap.bind("left", this._moveLeft.bind(me) , "keydown"); + this.mousetrap.bind("left", this._xStopMoving.bind(me), "keyup"); + this.mousetrap.bind("right",this._moveRight.bind(me), "keydown"); + this.mousetrap.bind("right",this._xStopMoving.bind(me), "keyup"); + this.mousetrap.bind("=", this._zoomIn.bind(me), "keydown"); + this.mousetrap.bind("=", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("-", this._zoomOut.bind(me), "keydown"); + this.mousetrap.bind("-", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("[", this._zoomIn.bind(me), "keydown"); + this.mousetrap.bind("[", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("]", this._zoomOut.bind(me), "keydown"); + this.mousetrap.bind("]", this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("pageup",this._zoomIn.bind(me), "keydown"); + this.mousetrap.bind("pageup",this._stopZoom.bind(me), "keyup"); + this.mousetrap.bind("pagedown",this._zoomOut.bind(me),"keydown"); + this.mousetrap.bind("pagedown",this._stopZoom.bind(me), "keyup"); } + if (this.constants.dataManipulation.enabled == true) { + this.mousetrap.bind("escape",this._createManipulatorBar.bind(me)); + this.mousetrap.bind("del",this._deleteSelected.bind(me)); + } + }; - parentBranch.children[region] = { - centerOfMass:{x:0,y:0}, - mass:0, - range:{minX:minX,maxX:maxX,minY:minY,maxY:maxY}, - size: 0.5 * parentBranch.size, - calcSize: 2 * parentBranch.calcSize, - children: {data:null}, - maxWidth: 0, - level: parentBranch.level+1, - childrenCount: 0 + /** + * Get the pointer location from a touch location + * @param {{pageX: Number, pageY: Number}} touch + * @return {{x: Number, y: Number}} pointer + * @private + */ + Network.prototype._getPointer = function (touch) { + return { + x: touch.pageX - util.getAbsoluteLeft(this.frame.canvas), + y: touch.pageY - util.getAbsoluteTop(this.frame.canvas) }; - }, + }; + + /** + * On start of a touch gesture, store the pointer + * @param event + * @private + */ + Network.prototype._onTouch = function (event) { + this.drag.pointer = this._getPointer(event.gesture.center); + this.drag.pinched = false; + this.pinch.scale = this._getScale(); + this._handleTouch(this.drag.pointer); + }; /** - * This function is for debugging purposed, it draws the tree. + * handle drag start event + * @private + */ + Network.prototype._onDragStart = function () { + this._handleDragStart(); + }; + + + /** + * This function is called by _onDragStart. + * It is separated out because we can then overload it for the datamanipulation system. * - * @param ctx - * @param color * @private */ - _drawTree : function(ctx,color) { - if (this.barnesHutTree !== undefined) { + Network.prototype._handleDragStart = function() { + var drag = this.drag; + var node = this._getNodeAt(drag.pointer); + // note: drag.pointer is set in _onTouch to get the initial touch location - ctx.lineWidth = 1; + drag.dragging = true; + drag.selection = []; + drag.translation = this._getTranslation(); + drag.nodeId = null; - this._drawBranch(this.barnesHutTree.root,ctx,color); + if (node != null) { + drag.nodeId = node.id; + // select the clicked node if not yet selected + if (!node.isSelected()) { + this._selectObject(node,false); + } + + // create an array with the selected nodes and their original location and status + for (var objectId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(objectId)) { + var object = this.selectionObj.nodes[objectId]; + var s = { + id: object.id, + node: object, + + // store original x, y, xFixed and yFixed, make the node temporarily Fixed + x: object.x, + y: object.y, + xFixed: object.xFixed, + yFixed: object.yFixed + }; + + object.xFixed = true; + object.yFixed = true; + + drag.selection.push(s); + } + } } - }, + }; /** - * This function is for debugging purposes. It draws the branches recursively. + * handle drag event + * @private + */ + Network.prototype._onDrag = function (event) { + this._handleOnDrag(event) + }; + + + /** + * This function is called by _onDrag. + * It is separated out because we can then overload it for the datamanipulation system. * - * @param branch - * @param ctx - * @param color * @private */ - _drawBranch : function(branch,ctx,color) { - if (color === undefined) { - color = "#FF0000"; + Network.prototype._handleOnDrag = function(event) { + if (this.drag.pinched) { + return; } - if (branch.childrenCount == 4) { - this._drawBranch(branch.children.NW,ctx); - this._drawBranch(branch.children.NE,ctx); - this._drawBranch(branch.children.SE,ctx); - this._drawBranch(branch.children.SW,ctx); - } - ctx.strokeStyle = color; - ctx.beginPath(); - ctx.moveTo(branch.range.minX,branch.range.minY); - ctx.lineTo(branch.range.maxX,branch.range.minY); - ctx.stroke(); + var pointer = this._getPointer(event.gesture.center); - ctx.beginPath(); - ctx.moveTo(branch.range.maxX,branch.range.minY); - ctx.lineTo(branch.range.maxX,branch.range.maxY); - ctx.stroke(); + var me = this; + var drag = this.drag; + var selection = drag.selection; + if (selection && selection.length && this.constants.dragNodes == true) { + // calculate delta's and new location + var deltaX = pointer.x - drag.pointer.x; + var deltaY = pointer.y - drag.pointer.y; - ctx.beginPath(); - ctx.moveTo(branch.range.maxX,branch.range.maxY); - ctx.lineTo(branch.range.minX,branch.range.maxY); - ctx.stroke(); + // update position of all selected nodes + selection.forEach(function (s) { + var node = s.node; - ctx.beginPath(); - ctx.moveTo(branch.range.minX,branch.range.maxY); - ctx.lineTo(branch.range.minX,branch.range.minY); - ctx.stroke(); + if (!s.xFixed) { + node.x = me._XconvertDOMtoCanvas(me._XconvertCanvasToDOM(s.x) + deltaX); + } - /* - if (branch.mass > 0) { - ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass); - ctx.stroke(); - } - */ - } + if (!s.yFixed) { + node.y = me._YconvertDOMtoCanvas(me._YconvertCanvasToDOM(s.y) + deltaY); + } + }); -}; -/** - * Created by Alex on 2/10/14. - */ -var repulsionMixin = { + // start _animationStep if not yet running + if (!this.moving) { + this.moving = true; + this.start(); + } + } + else { + if (this.constants.dragNetwork == true) { + // move the network + var diffX = pointer.x - this.drag.pointer.x; + var diffY = pointer.y - this.drag.pointer.y; + this._setTranslation( + this.drag.translation.x + diffX, + this.drag.translation.y + diffY + ); + this._redraw(); + // this.moving = true; + // this.start(); + } + } + }; /** - * Calculate the forces the nodes apply on eachother based on a repulsion field. - * This field is linearly approximated. - * + * handle drag start event * @private */ - _calculateNodeForces: function () { - var dx, dy, angle, distance, fx, fy, combinedClusterSize, - repulsingForce, node1, node2, i, j; - - var nodes = this.calculationNodes; - var nodeIndices = this.calculationNodeIndices; - - // approximation constants - var a_base = -2 / 3; - var b = 4 / 3; + Network.prototype._onDragEnd = function () { + this.drag.dragging = false; + var selection = this.drag.selection; + if (selection && selection.length) { + selection.forEach(function (s) { + // restore original xFixed and yFixed + s.node.xFixed = s.xFixed; + s.node.yFixed = s.yFixed; + }); + this.moving = true; + this.start(); + } + else { + this._redraw(); + } - // repulsing forces between nodes - var nodeDistance = this.constants.physics.repulsion.nodeDistance; - var minimumDistance = nodeDistance; + }; - // we loop from i over all but the last entree in the array - // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j - for (i = 0; i < nodeIndices.length - 1; i++) { - node1 = nodes[nodeIndices[i]]; - for (j = i + 1; j < nodeIndices.length; j++) { - node2 = nodes[nodeIndices[j]]; - combinedClusterSize = node1.clusterSize + node2.clusterSize - 2; + /** + * handle tap/click event: select/unselect a node + * @private + */ + Network.prototype._onTap = function (event) { + var pointer = this._getPointer(event.gesture.center); + this.pointerPosition = pointer; + this._handleTap(pointer); - dx = node2.x - node1.x; - dy = node2.y - node1.y; - distance = Math.sqrt(dx * dx + dy * dy); + }; - minimumDistance = (combinedClusterSize == 0) ? nodeDistance : (nodeDistance * (1 + combinedClusterSize * this.constants.clustering.distanceAmplification)); - var a = a_base / minimumDistance; - if (distance < 2 * minimumDistance) { - if (distance < 0.5 * minimumDistance) { - repulsingForce = 1.0; - } - else { - repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / minimumDistance - 1) * steepness)) - } - // amplify the repulsion for clusters. - repulsingForce *= (combinedClusterSize == 0) ? 1 : 1 + combinedClusterSize * this.constants.clustering.forceAmplification; - repulsingForce = repulsingForce / distance; + /** + * handle doubletap event + * @private + */ + Network.prototype._onDoubleTap = function (event) { + var pointer = this._getPointer(event.gesture.center); + this._handleDoubleTap(pointer); + }; - fx = dx * repulsingForce; - fy = dy * repulsingForce; - node1.fx -= fx; - node1.fy -= fy; - node2.fx += fx; - node2.fy += fy; - } - } - } - } -}; -var HierarchicalLayoutMixin = { + /** + * handle long tap event: multi select nodes + * @private + */ + Network.prototype._onHold = function (event) { + var pointer = this._getPointer(event.gesture.center); + this.pointerPosition = pointer; + this._handleOnHold(pointer); + }; + /** + * handle the release of the screen + * + * @private + */ + Network.prototype._onRelease = function (event) { + var pointer = this._getPointer(event.gesture.center); + this._handleOnRelease(pointer); + }; + /** + * Handle pinch event + * @param event + * @private + */ + Network.prototype._onPinch = function (event) { + var pointer = this._getPointer(event.gesture.center); - _resetLevels : function() { - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - var node = this.nodes[nodeId]; - if (node.preassignedLevel == false) { - node.level = -1; - } - } + this.drag.pinched = true; + if (!('scale' in this.pinch)) { + this.pinch.scale = 1; } - }, + + // TODO: enabled moving while pinching? + var scale = this.pinch.scale * event.gesture.scale; + this._zoom(scale, pointer) + }; /** - * This is the main function to layout the nodes in a hierarchical way. - * It checks if the node details are supplied correctly - * + * Zoom the network in or out + * @param {Number} scale a number around 1, and between 0.01 and 10 + * @param {{x: Number, y: Number}} pointer Position on screen + * @return {Number} appliedScale scale is limited within the boundaries * @private */ - _setupHierarchicalLayout : function() { - if (this.constants.hierarchicalLayout.enabled == true && this.nodeIndices.length > 0) { - if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "DU") { - this.constants.hierarchicalLayout.levelSeparation *= -1; + Network.prototype._zoom = function(scale, pointer) { + if (this.constants.zoomable == true) { + var scaleOld = this._getScale(); + if (scale < 0.00001) { + scale = 0.00001; } - else { - this.constants.hierarchicalLayout.levelSeparation = Math.abs(this.constants.hierarchicalLayout.levelSeparation); + if (scale > 10) { + scale = 10; } - // get the size of the largest hubs and check if the user has defined a level for a node. - var hubsize = 0; - var node, nodeId; - var definedLevel = false; - var undefinedLevel = false; - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.level != -1) { - definedLevel = true; - } - else { - undefinedLevel = true; - } - if (hubsize < node.edges.length) { - hubsize = node.edges.length; - } + var preScaleDragPointer = null; + if (this.drag !== undefined) { + if (this.drag.dragging == true) { + preScaleDragPointer = this.DOMtoCanvas(this.drag.pointer); } } + // + this.frame.canvas.clientHeight / 2 + var translation = this._getTranslation(); - // if the user defined some levels but not all, alert and run without hierarchical layout - if (undefinedLevel == true && definedLevel == true) { - alert("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes."); - this.zoomExtent(true,this.constants.clustering.enabled); - if (!this.constants.clustering.enabled) { - this.start(); - } + var scaleFrac = scale / scaleOld; + var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac; + var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac; + + this.areaCenter = {"x" : this._XconvertDOMtoCanvas(pointer.x), + "y" : this._YconvertDOMtoCanvas(pointer.y)}; + + this._setScale(scale); + this._setTranslation(tx, ty); + this.updateClustersDefault(); + + if (preScaleDragPointer != null) { + var postScaleDragPointer = this.canvasToDOM(preScaleDragPointer); + this.drag.pointer.x = postScaleDragPointer.x; + this.drag.pointer.y = postScaleDragPointer.y; + } + + this._redraw(); + + if (scaleOld < scale) { + this.emit("zoom", {direction:"+"}); } else { - // setup the system to use hierarchical method. - this._changeConstants(); + this.emit("zoom", {direction:"-"}); + } - // define levels if undefined by the users. Based on hubsize - if (undefinedLevel == true) { - this._determineLevels(hubsize); - } - // check the distribution of the nodes per level. - var distribution = this._getDistribution(); + return scale; + } + }; - // place the nodes on the canvas. This also stablilizes the system. - this._placeNodesByHierarchy(distribution); - // start the simulation. - this.start(); + /** + * Event handler for mouse wheel event, used to zoom the timeline + * See http://adomas.org/javascript-mouse-wheel/ + * https://github.com/EightMedia/hammer.js/issues/256 + * @param {MouseEvent} event + * @private + */ + Network.prototype._onMouseWheel = function(event) { + // retrieve delta + var delta = 0; + if (event.wheelDelta) { /* IE/Opera. */ + delta = event.wheelDelta/120; + } else if (event.detail) { /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail/3; + } + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + + // calculate the new scale + var scale = this._getScale(); + var zoom = delta / 10; + if (delta < 0) { + zoom = zoom / (1 - zoom); } + scale *= (1 + zoom); + + // calculate the pointer location + var gesture = hammerUtil.fakeGesture(this, event); + var pointer = this._getPointer(gesture.center); + + // apply the new scale + this._zoom(scale, pointer); } - }, + + // Prevent default actions caused by mouse wheel. + event.preventDefault(); + }; /** - * This function places the nodes on the canvas based on the hierarchial distribution. - * - * @param {Object} distribution | obtained by the function this._getDistribution() + * Mouse move handler for checking whether the title moves over a node with a title. + * @param {Event} event * @private */ - _placeNodesByHierarchy : function(distribution) { - var nodeId, node; + Network.prototype._onMouseMoveTitle = function (event) { + var gesture = hammerUtil.fakeGesture(this, event); + var pointer = this._getPointer(gesture.center); - // start placing all the level 0 nodes first. Then recursively position their branches. - for (nodeId in distribution[0].nodes) { - if (distribution[0].nodes.hasOwnProperty(nodeId)) { - node = distribution[0].nodes[nodeId]; - if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { - if (node.xFixed) { - node.x = distribution[0].minPos; - node.xFixed = false; + // check if the previously selected node is still selected + if (this.popupObj) { + this._checkHidePopup(pointer); + } - distribution[0].minPos += distribution[0].nodeSpacing; - } + // start a timeout that will check if the mouse is positioned above + // an element + var me = this; + var checkShow = function() { + me._checkShowPopup(pointer); + }; + if (this.popupTimer) { + clearInterval(this.popupTimer); // stop any running calculationTimer + } + if (!this.drag.dragging) { + this.popupTimer = setTimeout(checkShow, this.constants.tooltip.delay); + } + + + /** + * Adding hover highlights + */ + if (this.constants.hover == true) { + // removing all hover highlights + for (var edgeId in this.hoverObj.edges) { + if (this.hoverObj.edges.hasOwnProperty(edgeId)) { + this.hoverObj.edges[edgeId].hover = false; + delete this.hoverObj.edges[edgeId]; } - else { - if (node.yFixed) { - node.y = distribution[0].minPos; - node.yFixed = false; + } + + // adding hover highlights + var obj = this._getNodeAt(pointer); + if (obj == null) { + obj = this._getEdgeAt(pointer); + } + if (obj != null) { + this._hoverObject(obj); + } - distribution[0].minPos += distribution[0].nodeSpacing; + // removing all node hover highlights except for the selected one. + for (var nodeId in this.hoverObj.nodes) { + if (this.hoverObj.nodes.hasOwnProperty(nodeId)) { + if (obj instanceof Node && obj.id != nodeId || obj instanceof Edge || obj == null) { + this._blurObject(this.hoverObj.nodes[nodeId]); + delete this.hoverObj.nodes[nodeId]; } } - this._placeBranchNodes(node.edges,node.id,distribution,node.level); } + this.redraw(); } - - // stabilize the system after positioning. This function calls zoomExtent. - this._stabilize(); - }, - + }; /** - * This function get the distribution of levels based on hubsize + * Check if there is an element on the given position in the network + * (a node or edge). If so, and if this element has a title, + * show a popup window with its title. * - * @returns {Object} + * @param {{x:Number, y:Number}} pointer * @private */ - _getDistribution : function() { - var distribution = {}; - var nodeId, node, level; + Network.prototype._checkShowPopup = function (pointer) { + var obj = { + left: this._XconvertDOMtoCanvas(pointer.x), + top: this._YconvertDOMtoCanvas(pointer.y), + right: this._XconvertDOMtoCanvas(pointer.x), + bottom: this._YconvertDOMtoCanvas(pointer.y) + }; - // we fix Y because the hierarchy is vertical, we fix X so we do not give a node an x position for a second time. - // the fix of X is removed after the x value has been set. - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - node.xFixed = true; - node.yFixed = true; - if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { - node.y = this.constants.hierarchicalLayout.levelSeparation*node.level; - } - else { - node.x = this.constants.hierarchicalLayout.levelSeparation*node.level; - } - if (!distribution.hasOwnProperty(node.level)) { - distribution[node.level] = {amount: 0, nodes: {}, minPos:0, nodeSpacing:0}; + var id; + var lastPopupNode = this.popupObj; + + if (this.popupObj == undefined) { + // search the nodes for overlap, select the top one in case of multiple nodes + var nodes = this.nodes; + for (id in nodes) { + if (nodes.hasOwnProperty(id)) { + var node = nodes[id]; + if (node.getTitle() !== undefined && node.isOverlappingWith(obj)) { + this.popupObj = node; + break; + } } - distribution[node.level].amount += 1; - distribution[node.level].nodes[node.id] = node; } } - // determine the largest amount of nodes of all levels - var maxCount = 0; - for (level in distribution) { - if (distribution.hasOwnProperty(level)) { - if (maxCount < distribution[level].amount) { - maxCount = distribution[level].amount; + if (this.popupObj === undefined) { + // search the edges for overlap + var edges = this.edges; + for (id in edges) { + if (edges.hasOwnProperty(id)) { + var edge = edges[id]; + if (edge.connected && (edge.getTitle() !== undefined) && + edge.isOverlappingWith(obj)) { + this.popupObj = edge; + break; + } } } } - // set the initial position and spacing of each nodes accordingly - for (level in distribution) { - if (distribution.hasOwnProperty(level)) { - distribution[level].nodeSpacing = (maxCount + 1) * this.constants.hierarchicalLayout.nodeSpacing; - distribution[level].nodeSpacing /= (distribution[level].amount + 1); - distribution[level].minPos = distribution[level].nodeSpacing - (0.5 * (distribution[level].amount + 1) * distribution[level].nodeSpacing); - } - } - - return distribution; - }, - - - /** - * this function allocates nodes in levels based on the recursive branching from the largest hubs. - * - * @param hubsize - * @private - */ - _determineLevels : function(hubsize) { - var nodeId, node; - - // determine hubs - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.edges.length == hubsize) { - node.level = 0; + if (this.popupObj) { + // show popup message window + if (this.popupObj != lastPopupNode) { + var me = this; + if (!me.popup) { + me.popup = new Popup(me.frame, me.constants.tooltip); } + + // adjust a small offset such that the mouse cursor is located in the + // bottom left location of the popup, and you can easily move over the + // popup area + me.popup.setPosition(pointer.x - 3, pointer.y - 3); + me.popup.setText(me.popupObj.getTitle()); + me.popup.show(); } } - - // branch from hubs - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.level == 0) { - this._setLevel(1,node.edges,node.id); - } + else { + if (this.popup) { + this.popup.hide(); } } - }, + }; /** - * Since hierarchical layout does not support: - * - smooth curves (based on the physics), - * - clustering (based on dynamic node counts) - * - * We disable both features so there will be no problems. - * + * Check if the popup must be hided, which is the case when the mouse is no + * longer hovering on the object + * @param {{x:Number, y:Number}} pointer * @private */ - _changeConstants : function() { - this.constants.clustering.enabled = false; - this.constants.physics.barnesHut.enabled = false; - this.constants.physics.hierarchicalRepulsion.enabled = true; - this._loadSelectedForceSolver(); - this.constants.smoothCurves = false; - this._configureSmoothCurves(); - }, + Network.prototype._checkHidePopup = function (pointer) { + if (!this.popupObj || !this._getNodeAt(pointer) ) { + this.popupObj = undefined; + if (this.popup) { + this.popup.hide(); + } + } + }; /** - * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes - * on a X position that ensures there will be no overlap. - * - * @param edges - * @param parentId - * @param distribution - * @param parentLevel - * @private + * Set a new size for the network + * @param {string} width Width in pixels or percentage (for example '800px' + * or '50%') + * @param {string} height Height in pixels or percentage (for example '400px' + * or '30%') */ - _placeBranchNodes : function(edges, parentId, distribution, parentLevel) { - for (var i = 0; i < edges.length; i++) { - var childNode = null; - if (edges[i].toId == parentId) { - childNode = edges[i].from; - } - else { - childNode = edges[i].to; - } + Network.prototype.setSize = function(width, height) { + this.frame.style.width = width; + this.frame.style.height = height; - // if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here. - var nodeMoved = false; - if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { - if (childNode.xFixed && childNode.level > parentLevel) { - childNode.xFixed = false; - childNode.x = distribution[childNode.level].minPos; - nodeMoved = true; - } - } - else { - if (childNode.yFixed && childNode.level > parentLevel) { - childNode.yFixed = false; - childNode.y = distribution[childNode.level].minPos; - nodeMoved = true; - } - } + this.frame.canvas.style.width = '100%'; + this.frame.canvas.style.height = '100%'; - if (nodeMoved == true) { - distribution[childNode.level].minPos += distribution[childNode.level].nodeSpacing; - if (childNode.edges.length > 1) { - this._placeBranchNodes(childNode.edges,childNode.id,distribution,childNode.level); - } + this.frame.canvas.width = this.frame.canvas.clientWidth; + this.frame.canvas.height = this.frame.canvas.clientHeight; + + if (this.manipulationDiv !== undefined) { + this.manipulationDiv.style.width = this.frame.canvas.clientWidth + "px"; + } + if (this.navigationDivs !== undefined) { + if (this.navigationDivs['wrapper'] !== undefined) { + this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; + this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; } } - }, + this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height}); + }; /** - * this function is called recursively to enumerate the barnches of the largest hubs and give each node a level. - * - * @param level - * @param edges - * @param parentId + * Set a data set with nodes for the network + * @param {Array | DataSet | DataView} nodes The data containing the nodes. * @private */ - _setLevel : function(level, edges, parentId) { - for (var i = 0; i < edges.length; i++) { - var childNode = null; - if (edges[i].toId == parentId) { - childNode = edges[i].from; - } - else { - childNode = edges[i].to; - } - if (childNode.level == -1 || childNode.level > level) { - childNode.level = level; - if (edges.length > 1) { - this._setLevel(level+1, childNode.edges, childNode.id); - } - } + Network.prototype._setNodes = function(nodes) { + var oldNodesData = this.nodesData; + + if (nodes instanceof DataSet || nodes instanceof DataView) { + this.nodesData = nodes; + } + else if (nodes instanceof Array) { + this.nodesData = new DataSet(); + this.nodesData.add(nodes); + } + else if (!nodes) { + this.nodesData = new DataSet(); + } + else { + throw new TypeError('Array or DataSet expected'); + } + + if (oldNodesData) { + // unsubscribe from old dataset + util.forEach(this.nodesListeners, function (callback, event) { + oldNodesData.off(event, callback); + }); } - }, + // remove drawn nodes + this.nodes = {}; + + if (this.nodesData) { + // subscribe to new dataset + var me = this; + util.forEach(this.nodesListeners, function (callback, event) { + me.nodesData.on(event, callback); + }); + + // draw all new nodes + var ids = this.nodesData.getIds(); + this._addNodes(ids); + } + this._updateSelection(); + }; /** - * Unfix nodes - * + * Add nodes + * @param {Number[] | String[]} ids * @private */ - _restoreNodes : function() { - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - this.nodes[nodeId].xFixed = false; - this.nodes[nodeId].yFixed = false; + Network.prototype._addNodes = function(ids) { + var id; + for (var i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + var data = this.nodesData.get(id); + var node = new Node(data, this.images, this.groups, this.constants); + this.nodes[id] = node; // note: this may replace an existing node + + if ((node.xFixed == false || node.yFixed == false) && (node.x === null || node.y === null)) { + var radius = 10 * 0.1*ids.length; + var angle = 2 * Math.PI * Math.random(); + if (node.xFixed == false) {node.x = radius * Math.cos(angle);} + if (node.yFixed == false) {node.y = radius * Math.sin(angle);} } + this.moving = true; } - } - - -}; -/** - * Created by Alex on 2/4/14. - */ - -var manipulationMixin = { + this._updateNodeIndexList(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateCalculationNodes(); + this._reconnectEdges(); + this._updateValueRange(this.nodes); + this.updateLabels(); + }; /** - * clears the toolbar div element of children - * + * Update existing nodes, or create them when not yet existing + * @param {Number[] | String[]} ids * @private */ - _clearManipulatorBar : function() { - while (this.manipulationDiv.hasChildNodes()) { - this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); + Network.prototype._updateNodes = function(ids) { + var nodes = this.nodes, + nodesData = this.nodesData; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + var node = nodes[id]; + var data = nodesData.get(id); + if (node) { + // update node + node.setProperties(data, this.constants); + } + else { + // create node + node = new Node(properties, this.images, this.groups, this.constants); + nodes[id] = node; + } + } + this.moving = true; + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); } - }, + this._updateNodeIndexList(); + this._reconnectEdges(); + this._updateValueRange(nodes); + }; /** - * Manipulation UI temporarily overloads certain functions to extend or replace them. To be able to restore - * these functions to their original functionality, we saved them in this.cachedFunctions. - * This function restores these functions to their original function. - * + * Remove existing nodes. If nodes do not exist, the method will just ignore it. + * @param {Number[] | String[]} ids * @private */ - _restoreOverloadedFunctions : function() { - for (var functionName in this.cachedFunctions) { - if (this.cachedFunctions.hasOwnProperty(functionName)) { - this[functionName] = this.cachedFunctions[functionName]; - } + Network.prototype._removeNodes = function(ids) { + var nodes = this.nodes; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + delete nodes[id]; + } + this._updateNodeIndexList(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); } - }, + this._updateCalculationNodes(); + this._reconnectEdges(); + this._updateSelection(); + this._updateValueRange(nodes); + }; /** - * Enable or disable edit-mode. - * + * Load edges by reading the data table + * @param {Array | DataSet | DataView} edges The data containing the edges. + * @private * @private */ - _toggleEditMode : function() { - this.editMode = !this.editMode; - var toolbar = document.getElementById("network-manipulationDiv"); - var closeDiv = document.getElementById("network-manipulation-closeDiv"); - var editModeDiv = document.getElementById("network-manipulation-editMode"); - if (this.editMode == true) { - toolbar.style.display="block"; - closeDiv.style.display="block"; - editModeDiv.style.display="none"; - closeDiv.onclick = this._toggleEditMode.bind(this); + Network.prototype._setEdges = function(edges) { + var oldEdgesData = this.edgesData; + + if (edges instanceof DataSet || edges instanceof DataView) { + this.edgesData = edges; + } + else if (edges instanceof Array) { + this.edgesData = new DataSet(); + this.edgesData.add(edges); + } + else if (!edges) { + this.edgesData = new DataSet(); } else { - toolbar.style.display="none"; - closeDiv.style.display="none"; - editModeDiv.style.display="block"; - closeDiv.onclick = null; + throw new TypeError('Array or DataSet expected'); + } + + if (oldEdgesData) { + // unsubscribe from old dataset + util.forEach(this.edgesListeners, function (callback, event) { + oldEdgesData.off(event, callback); + }); + } + + // remove drawn edges + this.edges = {}; + + if (this.edgesData) { + // subscribe to new dataset + var me = this; + util.forEach(this.edgesListeners, function (callback, event) { + me.edgesData.on(event, callback); + }); + + // draw all new nodes + var ids = this.edgesData.getIds(); + this._addEdges(ids); } - this._createManipulatorBar() - }, + + this._reconnectEdges(); + }; /** - * main function, creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. - * + * Add edges + * @param {Number[] | String[]} ids * @private */ - _createManipulatorBar : function() { - // remove bound functions - if (this.boundFunction) { - this.off('select', this.boundFunction); - } - if (this.edgeBeingEdited !== undefined) { - this.edgeBeingEdited._disableControlNodes(); - this.edgeBeingEdited = undefined; - this.selectedControlNode = null; - } + Network.prototype._addEdges = function (ids) { + var edges = this.edges, + edgesData = this.edgesData; - // restore overloaded functions - this._restoreOverloadedFunctions(); + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; - // resume calculation - this.freezeSimulation = false; + var oldEdge = edges[id]; + if (oldEdge) { + oldEdge.disconnect(); + } - // reset global variables - this.blockConnectingEdgeSelection = false; - this.forceAppendSelection = false; + var data = edgesData.get(id, {"showInternalIds" : true}); + edges[id] = new Edge(data, this, this.constants); + } - if (this.editMode == true) { - while (this.manipulationDiv.hasChildNodes()) { - this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); - } - // add the icons to the manipulator div - this.manipulationDiv.innerHTML = "" + - "" + - ""+this.constants.labels['add'] +"" + - "
" + - "" + - ""+this.constants.labels['link'] +""; - if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { - this.manipulationDiv.innerHTML += "" + - "
" + - "" + - ""+this.constants.labels['editNode'] +""; - } - else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { - this.manipulationDiv.innerHTML += "" + - "
" + - "" + - ""+this.constants.labels['editEdge'] +""; - } - if (this._selectionIsEmpty() == false) { - this.manipulationDiv.innerHTML += "" + - "
" + - "" + - ""+this.constants.labels['del'] +""; - } + this.moving = true; + this._updateValueRange(edges); + this._createBezierNodes(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateCalculationNodes(); + }; + /** + * Update existing edges, or create them when not yet existing + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._updateEdges = function (ids) { + var edges = this.edges, + edgesData = this.edgesData; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; - // bind the icons - var addNodeButton = document.getElementById("network-manipulate-addNode"); - addNodeButton.onclick = this._createAddNodeToolbar.bind(this); - var addEdgeButton = document.getElementById("network-manipulate-connectNode"); - addEdgeButton.onclick = this._createAddEdgeToolbar.bind(this); - if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { - var editButton = document.getElementById("network-manipulate-editNode"); - editButton.onclick = this._editNode.bind(this); - } - else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { - var editButton = document.getElementById("network-manipulate-editEdge"); - editButton.onclick = this._createEditEdgeToolbar.bind(this); + var data = edgesData.get(id); + var edge = edges[id]; + if (edge) { + // update edge + edge.disconnect(); + edge.setProperties(data, this.constants); + edge.connect(); } - if (this._selectionIsEmpty() == false) { - var deleteButton = document.getElementById("network-manipulate-delete"); - deleteButton.onclick = this._deleteSelected.bind(this); + else { + // create edge + edge = new Edge(data, this, this.constants); + this.edges[id] = edge; } - var closeDiv = document.getElementById("network-manipulation-closeDiv"); - closeDiv.onclick = this._toggleEditMode.bind(this); - - this.boundFunction = this._createManipulatorBar.bind(this); - this.on('select', this.boundFunction); } - else { - this.editModeDiv.innerHTML = "" + - "" + - "" + this.constants.labels['edit'] + ""; - var editModeButton = document.getElementById("network-manipulate-editModeButton"); - editModeButton.onclick = this._toggleEditMode.bind(this); + + this._createBezierNodes(); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); } - }, + this.moving = true; + this._updateValueRange(edges); + }; + /** + * Remove existing edges. Non existing ids will be ignored + * @param {Number[] | String[]} ids + * @private + */ + Network.prototype._removeEdges = function (ids) { + var edges = this.edges; + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + var edge = edges[id]; + if (edge) { + if (edge.via != null) { + delete this.sectors['support']['nodes'][edge.via.id]; + } + edge.disconnect(); + delete edges[id]; + } + } + this.moving = true; + this._updateValueRange(edges); + if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { + this._resetLevels(); + this._setupHierarchicalLayout(); + } + this._updateCalculationNodes(); + }; /** - * Create the toolbar for adding Nodes - * + * Reconnect all edges * @private */ - _createAddNodeToolbar : function() { - // clear the toolbar - this._clearManipulatorBar(); - if (this.boundFunction) { - this.off('select', this.boundFunction); + Network.prototype._reconnectEdges = function() { + var id, + nodes = this.nodes, + edges = this.edges; + for (id in nodes) { + if (nodes.hasOwnProperty(id)) { + nodes[id].edges = []; + } } - // create the toolbar contents - this.manipulationDiv.innerHTML = "" + - "" + - "" + this.constants.labels['back'] + " " + - "
" + - "" + - "" + this.constants.labels['addDescription'] + ""; + for (id in edges) { + if (edges.hasOwnProperty(id)) { + var edge = edges[id]; + edge.from = null; + edge.to = null; + edge.connect(); + } + } + }; - // bind the icon - var backButton = document.getElementById("network-manipulate-back"); - backButton.onclick = this._createManipulatorBar.bind(this); + /** + * Update the values of all object in the given array according to the current + * value range of the objects in the array. + * @param {Object} obj An object containing a set of Edges or Nodes + * The objects must have a method getValue() and + * setValueRange(min, max). + * @private + */ + Network.prototype._updateValueRange = function(obj) { + var id; - // we use the boundFunction so we can reference it when we unbind it from the "select" event. - this.boundFunction = this._addNode.bind(this); - this.on('select', this.boundFunction); - }, + // determine the range of the objects + var valueMin = undefined; + var valueMax = undefined; + for (id in obj) { + if (obj.hasOwnProperty(id)) { + var value = obj[id].getValue(); + if (value !== undefined) { + valueMin = (valueMin === undefined) ? value : Math.min(value, valueMin); + valueMax = (valueMax === undefined) ? value : Math.max(value, valueMax); + } + } + } + // adjust the range of all objects + if (valueMin !== undefined && valueMax !== undefined) { + for (id in obj) { + if (obj.hasOwnProperty(id)) { + obj[id].setValueRange(valueMin, valueMax); + } + } + } + }; /** - * create the toolbar to connect nodes - * - * @private + * Redraw the network with the current data + * chart will be resized too. */ - _createAddEdgeToolbar : function() { - // clear the toolbar - this._clearManipulatorBar(); - this._unselectAll(true); - this.freezeSimulation = true; + Network.prototype.redraw = function() { + this.setSize(this.width, this.height); + this._redraw(); + }; - if (this.boundFunction) { - this.off('select', this.boundFunction); - } + /** + * Redraw the network with the current data + * @private + */ + Network.prototype._redraw = function() { + var ctx = this.frame.canvas.getContext('2d'); + // clear the canvas + var w = this.frame.canvas.width; + var h = this.frame.canvas.height; + ctx.clearRect(0, 0, w, h); + + // set scaling and translation + ctx.save(); + ctx.translate(this.translation.x, this.translation.y); + ctx.scale(this.scale, this.scale); + + this.canvasTopLeft = { + "x": this._XconvertDOMtoCanvas(0), + "y": this._YconvertDOMtoCanvas(0) + }; + this.canvasBottomRight = { + "x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth), + "y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight) + }; - this._unselectAll(); - this.forceAppendSelection = false; - this.blockConnectingEdgeSelection = true; - this.manipulationDiv.innerHTML = "" + - "" + - "" + this.constants.labels['back'] + " " + - "
" + - "" + - "" + this.constants.labels['linkDescription'] + ""; + this._doInAllSectors("_drawAllSectorNodes",ctx); + if (this.drag.dragging == false || this.drag.dragging === undefined || this.constants.hideEdgesOnDrag == false) { + this._doInAllSectors("_drawEdges",ctx); + } - // bind the icon - var backButton = document.getElementById("network-manipulate-back"); - backButton.onclick = this._createManipulatorBar.bind(this); + if (this.drag.dragging == false || this.drag.dragging === undefined || this.constants.hideNodesOnDrag == false) { + this._doInAllSectors("_drawNodes",ctx,false); + } - // we use the boundFunction so we can reference it when we unbind it from the "select" event. - this.boundFunction = this._handleConnect.bind(this); - this.on('select', this.boundFunction); + if (this.controlNodesActive == true) { + this._doInAllSectors("_drawControlNodes",ctx); + } - // temporarily overload functions - this.cachedFunctions["_handleTouch"] = this._handleTouch; - this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; - this._handleTouch = this._handleConnect; - this._handleOnRelease = this._finishConnect; + // this._doInSupportSector("_drawNodes",ctx,true); + // this._drawTree(ctx,"#F00F0F"); - // redraw to show the unselect - this._redraw(); - }, + // restore original scaling and translation + ctx.restore(); + }; /** - * create the toolbar to edit edges - * + * Set the translation of the network + * @param {Number} offsetX Horizontal offset + * @param {Number} offsetY Vertical offset * @private */ - _createEditEdgeToolbar : function() { - // clear the toolbar - this._clearManipulatorBar(); + Network.prototype._setTranslation = function(offsetX, offsetY) { + if (this.translation === undefined) { + this.translation = { + x: 0, + y: 0 + }; + } - if (this.boundFunction) { - this.off('select', this.boundFunction); + if (offsetX !== undefined) { + this.translation.x = offsetX; + } + if (offsetY !== undefined) { + this.translation.y = offsetY; } - this.edgeBeingEdited = this._getSelectedEdge(); - this.edgeBeingEdited._enableControlNodes(); + this.emit('viewChanged'); + }; - this.manipulationDiv.innerHTML = "" + - "" + - "" + this.constants.labels['back'] + " " + - "
" + - "" + - "" + this.constants.labels['editEdgeDescription'] + ""; + /** + * Get the translation of the network + * @return {Object} translation An object with parameters x and y, both a number + * @private + */ + Network.prototype._getTranslation = function() { + return { + x: this.translation.x, + y: this.translation.y + }; + }; - // bind the icon - var backButton = document.getElementById("network-manipulate-back"); - backButton.onclick = this._createManipulatorBar.bind(this); + /** + * Scale the network + * @param {Number} scale Scaling factor 1.0 is unscaled + * @private + */ + Network.prototype._setScale = function(scale) { + this.scale = scale; + }; - // temporarily overload functions - this.cachedFunctions["_handleTouch"] = this._handleTouch; - this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; - this.cachedFunctions["_handleTap"] = this._handleTap; - this.cachedFunctions["_handleDragStart"] = this._handleDragStart; - this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; - this._handleTouch = this._selectControlNode; - this._handleTap = function () {}; - this._handleOnDrag = this._controlNodeDrag; - this._handleDragStart = function () {} - this._handleOnRelease = this._releaseControlNode; + /** + * Get the current scale of the network + * @return {Number} scale Scaling factor 1.0 is unscaled + * @private + */ + Network.prototype._getScale = function() { + return this.scale; + }; - // redraw to show the unselect - this._redraw(); - }, + /** + * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to + * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) + * @param {number} x + * @returns {number} + * @private + */ + Network.prototype._XconvertDOMtoCanvas = function(x) { + return (x - this.translation.x) / this.scale; + }; + /** + * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to + * the X coordinate in DOM-space (coordinate point in browser relative to the container div) + * @param {number} x + * @returns {number} + * @private + */ + Network.prototype._XconvertCanvasToDOM = function(x) { + return x * this.scale + this.translation.x; + }; + /** + * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to + * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) + * @param {number} y + * @returns {number} + * @private + */ + Network.prototype._YconvertDOMtoCanvas = function(y) { + return (y - this.translation.y) / this.scale; + }; + /** + * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to + * the Y coordinate in DOM-space (coordinate point in browser relative to the container div) + * @param {number} y + * @returns {number} + * @private + */ + Network.prototype._YconvertCanvasToDOM = function(y) { + return y * this.scale + this.translation.y ; + }; /** - * the function bound to the selection event. It checks if you want to connect a cluster and changes the description - * to walk the user through the process. * - * @private + * @param {object} pos = {x: number, y: number} + * @returns {{x: number, y: number}} + * @constructor */ - _selectControlNode : function(pointer) { - this.edgeBeingEdited.controlNodes.from.unselect(); - this.edgeBeingEdited.controlNodes.to.unselect(); - this.selectedControlNode = this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(pointer.x),this._YconvertDOMtoCanvas(pointer.y)); - if (this.selectedControlNode !== null) { - this.selectedControlNode.select(); - this.freezeSimulation = true; - } - this._redraw(); - }, + Network.prototype.canvasToDOM = function(pos) { + return {x:this._XconvertCanvasToDOM(pos.x),y:this._YconvertCanvasToDOM(pos.y)}; + } /** - * the function bound to the selection event. It checks if you want to connect a cluster and changes the description - * to walk the user through the process. * - * @private + * @param {object} pos = {x: number, y: number} + * @returns {{x: number, y: number}} + * @constructor */ - _controlNodeDrag : function(event) { - var pointer = this._getPointer(event.gesture.center); - if (this.selectedControlNode !== null && this.selectedControlNode !== undefined) { - this.selectedControlNode.x = this._XconvertDOMtoCanvas(pointer.x); - this.selectedControlNode.y = this._YconvertDOMtoCanvas(pointer.y); - } - this._redraw(); - }, - - _releaseControlNode : function(pointer) { - var newNode = this._getNodeAt(pointer); - if (newNode != null) { - if (this.edgeBeingEdited.controlNodes.from.selected == true) { - this._editEdge(newNode.id, this.edgeBeingEdited.to.id); - this.edgeBeingEdited.controlNodes.from.unselect(); - } - if (this.edgeBeingEdited.controlNodes.to.selected == true) { - this._editEdge(this.edgeBeingEdited.from.id, newNode.id); - this.edgeBeingEdited.controlNodes.to.unselect(); - } - } - else { - this.edgeBeingEdited._restoreControlNodes(); - } - this.freezeSimulation = false; - this._redraw(); - }, + Network.prototype.DOMtoCanvas = function(pos) { + return {x:this._XconvertDOMtoCanvas(pos.x),y:this._YconvertDOMtoCanvas(pos.y)}; + } /** - * the function bound to the selection event. It checks if you want to connect a cluster and changes the description - * to walk the user through the process. - * + * Redraw all nodes + * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); + * @param {CanvasRenderingContext2D} ctx + * @param {Boolean} [alwaysShow] * @private */ - _handleConnect : function(pointer) { - if (this._getSelectedNodeCount() == 0) { - var node = this._getNodeAt(pointer); - if (node != null) { - if (node.clusterSize > 1) { - alert("Cannot create edges to a cluster.") - } - else { - this._selectObject(node,false); - // create a node the temporary line can look at - this.sectors['support']['nodes']['targetNode'] = new Node({id:'targetNode'},{},{},this.constants); - this.sectors['support']['nodes']['targetNode'].x = node.x; - this.sectors['support']['nodes']['targetNode'].y = node.y; - this.sectors['support']['nodes']['targetViaNode'] = new Node({id:'targetViaNode'},{},{},this.constants); - this.sectors['support']['nodes']['targetViaNode'].x = node.x; - this.sectors['support']['nodes']['targetViaNode'].y = node.y; - this.sectors['support']['nodes']['targetViaNode'].parentEdgeId = "connectionEdge"; - - // create a temporary edge - this.edges['connectionEdge'] = new Edge({id:"connectionEdge",from:node.id,to:this.sectors['support']['nodes']['targetNode'].id}, this, this.constants); - this.edges['connectionEdge'].from = node; - this.edges['connectionEdge'].connected = true; - this.edges['connectionEdge'].smooth = true; - this.edges['connectionEdge'].selected = true; - this.edges['connectionEdge'].to = this.sectors['support']['nodes']['targetNode']; - this.edges['connectionEdge'].via = this.sectors['support']['nodes']['targetViaNode']; - - this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; - this._handleOnDrag = function(event) { - var pointer = this._getPointer(event.gesture.center); - this.sectors['support']['nodes']['targetNode'].x = this._XconvertDOMtoCanvas(pointer.x); - this.sectors['support']['nodes']['targetNode'].y = this._YconvertDOMtoCanvas(pointer.y); - this.sectors['support']['nodes']['targetViaNode'].x = 0.5 * (this._XconvertDOMtoCanvas(pointer.x) + this.edges['connectionEdge'].from.x); - this.sectors['support']['nodes']['targetViaNode'].y = this._YconvertDOMtoCanvas(pointer.y); - }; - - this.moving = true; - this.start(); - } - } + Network.prototype._drawNodes = function(ctx,alwaysShow) { + if (alwaysShow === undefined) { + alwaysShow = false; } - }, - - _finishConnect : function(pointer) { - if (this._getSelectedNodeCount() == 1) { - - // restore the drag function - this._handleOnDrag = this.cachedFunctions["_handleOnDrag"]; - delete this.cachedFunctions["_handleOnDrag"]; - - // remember the edge id - var connectFromId = this.edges['connectionEdge'].fromId; - // remove the temporary nodes and edge - delete this.edges['connectionEdge']; - delete this.sectors['support']['nodes']['targetNode']; - delete this.sectors['support']['nodes']['targetViaNode']; + // first draw the unselected nodes + var nodes = this.nodes; + var selected = []; - var node = this._getNodeAt(pointer); - if (node != null) { - if (node.clusterSize > 1) { - alert("Cannot create edges to a cluster.") + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + nodes[id].setScaleAndPos(this.scale,this.canvasTopLeft,this.canvasBottomRight); + if (nodes[id].isSelected()) { + selected.push(id); } else { - this._createEdge(connectFromId,node.id); - this._createManipulatorBar(); + if (nodes[id].inArea() || alwaysShow) { + nodes[id].draw(ctx); + } } } - this._unselectAll(); } - }, + // draw the selected nodes on top + for (var s = 0, sMax = selected.length; s < sMax; s++) { + if (nodes[selected[s]].inArea() || alwaysShow) { + nodes[selected[s]].draw(ctx); + } + } + }; /** - * Adds a node on the specified location + * Redraw all edges + * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); + * @param {CanvasRenderingContext2D} ctx + * @private */ - _addNode : function() { - if (this._selectionIsEmpty() && this.editMode == true) { - var positionObject = this._pointerToPositionObject(this.pointerPosition); - var defaultData = {id:util.randomUUID(),x:positionObject.left,y:positionObject.top,label:"new",allowedToMoveX:true,allowedToMoveY:true}; - if (this.triggerFunctions.add) { - if (this.triggerFunctions.add.length == 2) { - var me = this; - this.triggerFunctions.add(defaultData, function(finalizedData) { - me.nodesData.add(finalizedData); - me._createManipulatorBar(); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels['addError']); - this._createManipulatorBar(); - this.moving = true; - this.start(); + Network.prototype._drawEdges = function(ctx) { + var edges = this.edges; + for (var id in edges) { + if (edges.hasOwnProperty(id)) { + var edge = edges[id]; + edge.setScale(this.scale); + if (edge.connected) { + edges[id].draw(ctx); } } - else { - this.nodesData.add(defaultData); - this._createManipulatorBar(); - this.moving = true; - this.start(); + } + }; + + /** + * Redraw all edges + * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Network.prototype._drawControlNodes = function(ctx) { + var edges = this.edges; + for (var id in edges) { + if (edges.hasOwnProperty(id)) { + edges[id]._drawControlNodes(ctx); } } - }, + }; + + /** + * Find a stable position for all nodes + * @private + */ + Network.prototype._stabilize = function() { + if (this.constants.freezeForStabilization == true) { + this._freezeDefinedNodes(); + } + // find stable position + var count = 0; + while (this.moving && count < this.constants.stabilizationIterations) { + this._physicsTick(); + count++; + } + this.zoomExtent(false,true); + if (this.constants.freezeForStabilization == true) { + this._restoreFrozenNodes(); + } + this.emit("stabilized",{iterations:count}); + }; /** - * connect two nodes with a new edge. + * When initializing and stabilizing, we can freeze nodes with a predefined position. This greatly speeds up stabilization + * because only the supportnodes for the smoothCurves have to settle. * * @private */ - _createEdge : function(sourceNodeId,targetNodeId) { - if (this.editMode == true) { - var defaultData = {from:sourceNodeId, to:targetNodeId}; - if (this.triggerFunctions.connect) { - if (this.triggerFunctions.connect.length == 2) { - var me = this; - this.triggerFunctions.connect(defaultData, function(finalizedData) { - me.edgesData.add(finalizedData); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["linkError"]); - this.moving = true; - this.start(); + Network.prototype._freezeDefinedNodes = function() { + var nodes = this.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + if (nodes[id].x != null && nodes[id].y != null) { + nodes[id].fixedData.x = nodes[id].xFixed; + nodes[id].fixedData.y = nodes[id].yFixed; + nodes[id].xFixed = true; + nodes[id].yFixed = true; } } - else { - this.edgesData.add(defaultData); - this.moving = true; - this.start(); - } } - }, + }; /** - * connect two nodes with a new edge. + * Unfreezes the nodes that have been frozen by _freezeDefinedNodes. * * @private */ - _editEdge : function(sourceNodeId,targetNodeId) { - if (this.editMode == true) { - var defaultData = {id: this.edgeBeingEdited.id, from:sourceNodeId, to:targetNodeId}; - if (this.triggerFunctions.editEdge) { - if (this.triggerFunctions.editEdge.length == 2) { - var me = this; - this.triggerFunctions.editEdge(defaultData, function(finalizedData) { - me.edgesData.update(finalizedData); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["linkError"]); - this.moving = true; - this.start(); + Network.prototype._restoreFrozenNodes = function() { + var nodes = this.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + if (nodes[id].fixedData.x != null) { + nodes[id].xFixed = nodes[id].fixedData.x; + nodes[id].yFixed = nodes[id].fixedData.y; } } - else { - this.edgesData.update(defaultData); - this.moving = true; - this.start(); + } + }; + + + /** + * Check if any of the nodes is still moving + * @param {number} vmin the minimum velocity considered as 'moving' + * @return {boolean} true if moving, false if non of the nodes is moving + * @private + */ + Network.prototype._isMoving = function(vmin) { + var nodes = this.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id) && nodes[id].isMoving(vmin)) { + return true; } } - }, + return false; + }; + /** - * Create the toolbar to edit the selected node. The label and the color can be changed. Other colors are derived from the chosen color. + * /** + * Perform one discrete step for all nodes * * @private */ - _editNode : function() { - if (this.triggerFunctions.edit && this.editMode == true) { - var node = this._getSelectedNode(); - var data = {id:node.id, - label: node.label, - group: node.group, - shape: node.shape, - color: { - background:node.color.background, - border:node.color.border, - highlight: { - background:node.color.highlight.background, - border:node.color.highlight.border - } - }}; - if (this.triggerFunctions.edit.length == 2) { - var me = this; - this.triggerFunctions.edit(data, function (finalizedData) { - me.nodesData.update(finalizedData); - me._createManipulatorBar(); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["editError"]); + Network.prototype._discreteStepNodes = function() { + var interval = this.physicsDiscreteStepsize; + var nodes = this.nodes; + var nodeId; + var nodesPresent = false; + + if (this.constants.maxVelocity > 0) { + for (nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity); + nodesPresent = true; + } } } else { - alert(this.constants.labels["editBoundError"]); + for (nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + nodes[nodeId].discreteStep(interval); + nodesPresent = true; + } + } } - }, - + if (nodesPresent == true) { + var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05); + if (vminCorrected > 0.5*this.constants.maxVelocity) { + this.moving = true; + } + else { + this.moving = this._isMoving(vminCorrected); + if (this.moving == false) { + this.emit("stabilized",{iterations:null}); + } + this.moving = this.moving || this.configurePhysics; + } + } + }; /** - * delete everything in the selection + * A single simulation step (or "tick") in the physics simulation * * @private */ - _deleteSelected : function() { - if (!this._selectionIsEmpty() && this.editMode == true) { - if (!this._clusterInSelection()) { - var selectedNodes = this.getSelectedNodes(); - var selectedEdges = this.getSelectedEdges(); - if (this.triggerFunctions.del) { - var me = this; - var data = {nodes: selectedNodes, edges: selectedEdges}; - if (this.triggerFunctions.del.length = 2) { - this.triggerFunctions.del(data, function (finalizedData) { - me.edgesData.remove(finalizedData.edges); - me.nodesData.remove(finalizedData.nodes); - me._unselectAll(); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["deleteError"]) - } - } - else { - this.edgesData.remove(selectedEdges); - this.nodesData.remove(selectedNodes); - this._unselectAll(); - this.moving = true; - this.start(); + Network.prototype._physicsTick = function() { + if (!this.freezeSimulation) { + if (this.moving == true) { + this._doInAllActiveSectors("_initializeForceCalculation"); + this._doInAllActiveSectors("_discreteStepNodes"); + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this._doInSupportSector("_discreteStepNodes"); } - } - else { - alert(this.constants.labels["deleteClusterError"]); + this._findCenter(this._getRange()) } } - } -}; -/** - * Creation of the SectorMixin var. - * - * This contains all the functions the Network object can use to employ the sector system. - * The sector system is always used by Network, though the benefits only apply to the use of clustering. - * If clustering is not used, there is no overhead except for a duplicate object with references to nodes and edges. - * - * Alex de Mulder - * 21-01-2013 - */ -var SectorMixin = { + }; + /** - * This function is only called by the setData function of the Network object. - * This loads the global references into the active sector. This initializes the sector. + * This function runs one step of the animation. It calls an x amount of physics ticks and one render tick. + * It reschedules itself at the beginning of the function * * @private */ - _putDataInSector : function() { - this.sectors["active"][this._sector()].nodes = this.nodes; - this.sectors["active"][this._sector()].edges = this.edges; - this.sectors["active"][this._sector()].nodeIndices = this.nodeIndices; - }, + Network.prototype._animationStep = function() { + // reset the timer so a new scheduled animation step can be set + this.timer = undefined; + // handle the keyboad movement + this._handleNavigation(); + + // this schedules a new animation step + this.start(); + + // start the physics simulation + var calculationTime = Date.now(); + var maxSteps = 1; + this._physicsTick(); + var timeRequired = Date.now() - calculationTime; + while (timeRequired < 0.9*(this.renderTimestep - this.renderTime) && maxSteps < this.maxPhysicsTicksPerRender) { + this._physicsTick(); + timeRequired = Date.now() - calculationTime; + maxSteps++; + } + // start the rendering process + var renderTime = Date.now(); + this._redraw(); + this.renderTime = Date.now() - renderTime; + + }; + if (typeof window !== 'undefined') { + window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + } /** - * /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied (active) sector. If a type is defined, do the specific type - * - * @param {String} sectorId - * @param {String} [sectorType] | "active" or "frozen" - * @private + * Schedule a animation step with the refreshrate interval. */ - _switchToSector : function(sectorId, sectorType) { - if (sectorType === undefined || sectorType == "active") { - this._switchToActiveSector(sectorId); + Network.prototype.start = function() { + if (this.moving == true || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { + if (!this.timer) { + var ua = navigator.userAgent.toLowerCase(); + + var requiresTimeout = false; + if (ua.indexOf('msie 9.0') != -1) { // IE 9 + requiresTimeout = true; + } + else if (ua.indexOf('safari') != -1) { // safari + if (ua.indexOf('chrome') <= -1) { + requiresTimeout = true; + } + } + + if (requiresTimeout == true) { + this.timer = window.setTimeout(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + } + else{ + this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + } + } } else { - this._switchToFrozenSector(sectorId); + this._redraw(); } - }, + }; /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied active sector. + * Move the network according to the keyboard presses. * - * @param sectorId * @private */ - _switchToActiveSector : function(sectorId) { - this.nodeIndices = this.sectors["active"][sectorId]["nodeIndices"]; - this.nodes = this.sectors["active"][sectorId]["nodes"]; - this.edges = this.sectors["active"][sectorId]["edges"]; - }, + Network.prototype._handleNavigation = function() { + if (this.xIncrement != 0 || this.yIncrement != 0) { + var translation = this._getTranslation(); + this._setTranslation(translation.x+this.xIncrement, translation.y+this.yIncrement); + } + if (this.zoomIncrement != 0) { + var center = { + x: this.frame.canvas.clientWidth / 2, + y: this.frame.canvas.clientHeight / 2 + }; + this._zoom(this.scale*(1 + this.zoomIncrement), center); + } + }; /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied active sector. - * - * @param sectorId - * @private + * Freeze the _animationStep */ - _switchToSupportSector : function() { - this.nodeIndices = this.sectors["support"]["nodeIndices"]; - this.nodes = this.sectors["support"]["nodes"]; - this.edges = this.sectors["support"]["edges"]; - }, + Network.prototype.toggleFreeze = function() { + if (this.freezeSimulation == false) { + this.freezeSimulation = true; + } + else { + this.freezeSimulation = false; + this.start(); + } + }; /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied frozen sector. + * This function cleans the support nodes if they are not needed and adds them when they are. * - * @param sectorId + * @param {boolean} [disableStart] * @private */ - _switchToFrozenSector : function(sectorId) { - this.nodeIndices = this.sectors["frozen"][sectorId]["nodeIndices"]; - this.nodes = this.sectors["frozen"][sectorId]["nodes"]; - this.edges = this.sectors["frozen"][sectorId]["edges"]; - }, + Network.prototype._configureSmoothCurves = function(disableStart) { + if (disableStart === undefined) { + disableStart = true; + } + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this._createBezierNodes(); + // cleanup unused support nodes + for (var nodeId in this.sectors['support']['nodes']) { + if (this.sectors['support']['nodes'].hasOwnProperty(nodeId)) { + if (this.edges[this.sectors['support']['nodes'][nodeId]] === undefined) { + delete this.sectors['support']['nodes'][nodeId]; + } + } + } + } + else { + // delete the support nodes + this.sectors['support']['nodes'] = {}; + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + this.edges[edgeId].smooth = false; + this.edges[edgeId].via = null; + } + } + } + + + this._updateCalculationNodes(); + if (!disableStart) { + this.moving = true; + this.start(); + } + }; /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the currently active sector. + * Bezier curves require an anchor point to calculate the smooth flow. These points are nodes. These nodes are invisible but + * are used for the force calculation. * * @private */ - _loadLatestSector : function() { - this._switchToSector(this._sector()); - }, - + Network.prototype._createBezierNodes = function() { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + var edge = this.edges[edgeId]; + if (edge.via == null) { + edge.smooth = true; + var nodeId = "edgeId:".concat(edge.id); + this.sectors['support']['nodes'][nodeId] = new Node( + {id:nodeId, + mass:1, + shape:'circle', + image:"", + internalMultiplier:1 + },{},{},this.constants); + edge.via = this.sectors['support']['nodes'][nodeId]; + edge.via.parentEdgeId = edge.id; + edge.positionBezierNode(); + } + } + } + } + }; /** - * This function returns the currently active sector Id + * load the functions that load the mixins into the prototype. * - * @returns {String} * @private */ - _sector : function() { - return this.activeSector[this.activeSector.length-1]; - }, + Network.prototype._initializeMixinLoaders = function () { + for (var mixin in MixinLoader) { + if (MixinLoader.hasOwnProperty(mixin)) { + Network.prototype[mixin] = MixinLoader[mixin]; + } + } + }; + + /** + * Load the XY positions of the nodes into the dataset. + */ + Network.prototype.storePosition = function() { + var dataArray = []; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + var allowedToMoveX = !this.nodes.xFixed; + var allowedToMoveY = !this.nodes.yFixed; + if (this.nodesData._data[nodeId].x != Math.round(node.x) || this.nodesData._data[nodeId].y != Math.round(node.y)) { + dataArray.push({id:nodeId,x:Math.round(node.x),y:Math.round(node.y),allowedToMoveX:allowedToMoveX,allowedToMoveY:allowedToMoveY}); + } + } + } + this.nodesData.update(dataArray); + }; /** - * This function returns the previously active sector Id + * Center a node in view. * - * @returns {String} - * @private + * @param {Number} nodeId + * @param {Number} [zoomLevel] */ - _previousSector : function() { - if (this.activeSector.length > 1) { - return this.activeSector[this.activeSector.length-2]; + Network.prototype.focusOnNode = function (nodeId, zoomLevel) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (zoomLevel === undefined) { + zoomLevel = this._getScale(); + } + var nodePosition= {x: this.nodes[nodeId].x, y: this.nodes[nodeId].y}; + + var requiredScale = zoomLevel; + this._setScale(requiredScale); + + var canvasCenter = this.DOMtoCanvas({x:0.5 * this.frame.canvas.width,y:0.5 * this.frame.canvas.height}); + var translation = this._getTranslation(); + + var distanceFromCenter = {x:canvasCenter.x - nodePosition.x, + y:canvasCenter.y - nodePosition.y}; + + this._setTranslation(translation.x + requiredScale * distanceFromCenter.x, + translation.y + requiredScale * distanceFromCenter.y); + this.redraw(); } else { - throw new TypeError('there are not enough sectors in the this.activeSector array.'); + console.log("This nodeId cannot be found.") } - }, + }; + module.exports = Network; + + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); + var Node = __webpack_require__(36); /** - * We add the active sector at the end of the this.activeSector array - * This ensures it is the currently active sector returned by _sector() and it reaches the top - * of the activeSector stack. When we reverse our steps we move from the end to the beginning of this stack. + * @class Edge * - * @param newId - * @private + * A edge connects two nodes + * @param {Object} properties Object with properties. Must contain + * At least properties from and to. + * Available properties: from (number), + * to (number), label (string, color (string), + * width (number), style (string), + * length (number), title (string) + * @param {Network} network A Network object, used to find and edge to + * nodes. + * @param {Object} constants An object with default values for + * example for the color */ - _setActiveSector : function(newId) { - this.activeSector.push(newId); - }, - + function Edge (properties, network, constants) { + if (!network) { + throw "No network provided"; + } + this.network = network; + + // initialize constants + this.widthMin = constants.edges.widthMin; + this.widthMax = constants.edges.widthMax; + + // initialize variables + this.id = undefined; + this.fromId = undefined; + this.toId = undefined; + this.style = constants.edges.style; + this.title = undefined; + this.width = constants.edges.width; + this.widthSelectionMultiplier = constants.edges.widthSelectionMultiplier; + this.widthSelected = this.width * this.widthSelectionMultiplier; + this.hoverWidth = constants.edges.hoverWidth; + this.value = undefined; + this.length = constants.physics.springLength; + this.customLength = false; + this.selected = false; + this.hover = false; + this.smoothCurves = constants.smoothCurves; + this.dynamicSmoothCurves = constants.dynamicSmoothCurves; + this.arrowScaleFactor = constants.edges.arrowScaleFactor; + this.inheritColor = constants.edges.inheritColor; + + this.from = null; // a node + this.to = null; // a node + this.via = null; // a temp node + + // we use this to be able to reconnect the edge to a cluster if its node is put into a cluster + // by storing the original information we can revert to the original connection when the cluser is opened. + this.originalFromId = []; + this.originalToId = []; + + this.connected = false; + + // Added to support dashed lines + // David Jordan + // 2012-08-08 + this.dash = util.extend({}, constants.edges.dash); // contains properties length, gap, altLength + + this.color = {color:constants.edges.color.color, + highlight:constants.edges.color.highlight, + hover:constants.edges.color.hover}; + this.widthFixed = false; + this.lengthFixed = false; + + this.setProperties(properties, constants); + + this.controlNodesEnabled = false; + this.controlNodes = {from:null, to:null, positions:{}}; + this.connectedNode = null; + } /** - * We remove the currently active sector id from the active sector stack. This happens when - * we reactivate the previously active sector - * - * @private + * Set or overwrite properties for the edge + * @param {Object} properties an object with properties + * @param {Object} constants and object with default, global properties */ - _forgetLastSector : function() { - this.activeSector.pop(); - }, + Edge.prototype.setProperties = function(properties, constants) { + if (!properties) { + return; + } + + if (properties.from !== undefined) {this.fromId = properties.from;} + if (properties.to !== undefined) {this.toId = properties.to;} + + if (properties.id !== undefined) {this.id = properties.id;} + if (properties.style !== undefined) {this.style = properties.style;} + if (properties.label !== undefined) {this.label = properties.label;} + + if (this.label) { + this.fontSize = constants.edges.fontSize; + this.fontFace = constants.edges.fontFace; + this.fontColor = constants.edges.fontColor; + this.fontFill = constants.edges.fontFill; + + if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} + if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} + if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} + if (properties.fontFill !== undefined) {this.fontFill = properties.fontFill;} + } + + if (properties.title !== undefined) {this.title = properties.title;} + if (properties.width !== undefined) {this.width = properties.width;} + if (properties.widthSelectionMultiplier !== undefined) + {this.widthSelectionMultiplier = properties.widthSelectionMultiplier;} + if (properties.hoverWidth !== undefined) {this.hoverWidth = properties.hoverWidth;} + if (properties.value !== undefined) {this.value = properties.value;} + if (properties.length !== undefined) {this.length = properties.length; + this.customLength = true;} + + // scale the arrow + if (properties.arrowScaleFactor !== undefined) {this.arrowScaleFactor = properties.arrowScaleFactor;} + + if (properties.inheritColor !== undefined) {this.inheritColor = properties.inheritColor;} + + // Added to support dashed lines + // David Jordan + // 2012-08-08 + if (properties.dash) { + if (properties.dash.length !== undefined) {this.dash.length = properties.dash.length;} + if (properties.dash.gap !== undefined) {this.dash.gap = properties.dash.gap;} + if (properties.dash.altLength !== undefined) {this.dash.altLength = properties.dash.altLength;} + } + + if (properties.color !== undefined) { + if (util.isString(properties.color)) { + this.color.color = properties.color; + this.color.highlight = properties.color; + } + else { + if (properties.color.color !== undefined) {this.color.color = properties.color.color;} + if (properties.color.highlight !== undefined) {this.color.highlight = properties.color.highlight;} + if (properties.color.hover !== undefined) {this.color.hover = properties.color.hover;} + } + } + // A node is connected when it has a from and to node. + this.connect(); + + this.widthFixed = this.widthFixed || (properties.width !== undefined); + this.lengthFixed = this.lengthFixed || (properties.length !== undefined); + + this.widthSelected = this.width * this.widthSelectionMultiplier; + + // set draw method based on style + switch (this.style) { + case 'line': this.draw = this._drawLine; break; + case 'arrow': this.draw = this._drawArrow; break; + case 'arrow-center': this.draw = this._drawArrowCenter; break; + case 'dash-line': this.draw = this._drawDashLine; break; + default: this.draw = this._drawLine; break; + } + }; /** - * This function creates a new active sector with the supplied newId. This newId - * is the expanding node id. - * - * @param {String} newId | Id of the new active sector - * @private + * Connect an edge to its nodes */ - _createNewSector : function(newId) { - // create the new sector - this.sectors["active"][newId] = {"nodes":{}, - "edges":{}, - "nodeIndices":[], - "formationScale": this.scale, - "drawingNode": undefined}; + Edge.prototype.connect = function () { + this.disconnect(); - // create the new sector render node. This gives visual feedback that you are in a new sector. - this.sectors["active"][newId]['drawingNode'] = new Node( - {id:newId, - color: { - background: "#eaefef", - border: "495c5e" - } - },{},{},this.constants); - this.sectors["active"][newId]['drawingNode'].clusterSize = 2; - }, + this.from = this.network.nodes[this.fromId] || null; + this.to = this.network.nodes[this.toId] || null; + this.connected = (this.from && this.to); + if (this.connected) { + this.from.attachEdge(this); + this.to.attachEdge(this); + } + else { + if (this.from) { + this.from.detachEdge(this); + } + if (this.to) { + this.to.detachEdge(this); + } + } + }; /** - * This function removes the currently active sector. This is called when we create a new - * active sector. - * - * @param {String} sectorId | Id of the active sector that will be removed - * @private + * Disconnect an edge from its nodes */ - _deleteActiveSector : function(sectorId) { - delete this.sectors["active"][sectorId]; - }, + Edge.prototype.disconnect = function () { + if (this.from) { + this.from.detachEdge(this); + this.from = null; + } + if (this.to) { + this.to.detachEdge(this); + this.to = null; + } + this.connected = false; + }; /** - * This function removes the currently active sector. This is called when we reactivate - * the previously active sector. - * - * @param {String} sectorId | Id of the active sector that will be removed - * @private + * get the title of this edge. + * @return {string} title The title of the edge, or undefined when no title + * has been set. */ - _deleteFrozenSector : function(sectorId) { - delete this.sectors["frozen"][sectorId]; - }, + Edge.prototype.getTitle = function() { + return typeof this.title === "function" ? this.title() : this.title; + }; + + + /** + * Retrieve the value of the edge. Can be undefined + * @return {Number} value + */ + Edge.prototype.getValue = function() { + return this.value; + }; + /** + * Adjust the value range of the edge. The edge will adjust it's width + * based on its value. + * @param {Number} min + * @param {Number} max + */ + Edge.prototype.setValueRange = function(min, max) { + if (!this.widthFixed && this.value !== undefined) { + var scale = (this.widthMax - this.widthMin) / (max - min); + this.width = (this.value - min) * scale + this.widthMin; + this.widthSelected = this.width * this.widthSelectionMultiplier; + } + }; + + /** + * Redraw a edge + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ + Edge.prototype.draw = function(ctx) { + throw "Method draw not initialized in edge"; + }; /** - * Freezing an active sector means moving it from the "active" object to the "frozen" object. - * We copy the references, then delete the active entree. - * - * @param sectorId - * @private + * Check if this object is overlapping with the provided object + * @param {Object} obj an object with parameters left, top + * @return {boolean} True if location is located on the edge */ - _freezeSector : function(sectorId) { - // we move the set references from the active to the frozen stack. - this.sectors["frozen"][sectorId] = this.sectors["active"][sectorId]; + Edge.prototype.isOverlappingWith = function(obj) { + if (this.connected) { + var distMax = 10; + var xFrom = this.from.x; + var yFrom = this.from.y; + var xTo = this.to.x; + var yTo = this.to.y; + var xObj = obj.left; + var yObj = obj.top; - // we have moved the sector data into the frozen set, we now remove it from the active set - this._deleteActiveSector(sectorId); - }, + var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj); + + return (dist < distMax); + } + else { + return false + } + }; + + Edge.prototype._getColor = function() { + var colorObj = this.color; + if (this.inheritColor == "to") { + colorObj = { + highlight: this.to.color.highlight.border, + hover: this.to.color.hover.border, + color: this.to.color.border + }; + } + else if (this.inheritColor == "from" || this.inheritColor == true) { + colorObj = { + highlight: this.from.color.highlight.border, + hover: this.from.color.hover.border, + color: this.from.color.border + }; + } + + if (this.selected == true) {return colorObj.highlight;} + else if (this.hover == true) {return colorObj.hover;} + else {return colorObj.color;} + } /** - * This is the reverse operation of _freezeSector. Activating means moving the sector from the "frozen" - * object to the "active" object. - * - * @param sectorId + * Redraw a edge as a line + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx * @private */ - _activateSector : function(sectorId) { - // we move the set references from the frozen to the active stack. - this.sectors["active"][sectorId] = this.sectors["frozen"][sectorId]; + Edge.prototype._drawLine = function(ctx) { + // set style + ctx.strokeStyle = this._getColor(); + ctx.lineWidth = this._getLineWidth(); - // we have moved the sector data into the active set, we now remove it from the frozen stack - this._deleteFrozenSector(sectorId); - }, + if (this.from != this.to) { + // draw line + var via = this._line(ctx); + // draw label + var point; + if (this.label) { + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; + } + else { + point = this._pointOnLine(0.5); + } + this._label(ctx, this.label, point.x, point.y); + } + } + else { + var x, y; + var radius = this.length / 4; + var node = this.from; + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width / 2; + y = node.y - radius; + } + else { + x = node.x + radius; + y = node.y - node.height / 2; + } + this._circle(ctx, x, y, radius); + point = this._pointOnCircle(x, y, radius, 0.5); + this._label(ctx, this.label, point.x, point.y); + } + }; /** - * This function merges the data from the currently active sector with a frozen sector. This is used - * in the process of reverting back to the previously active sector. - * The data that is placed in the frozen (the previously active) sector is the node that has been removed from it - * upon the creation of a new active sector. - * - * @param sectorId + * Get the line width of the edge. Depends on width and whether one of the + * connected nodes is selected. + * @return {Number} width * @private */ - _mergeThisWithFrozen : function(sectorId) { - // copy all nodes - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - this.sectors["frozen"][sectorId]["nodes"][nodeId] = this.nodes[nodeId]; + Edge.prototype._getLineWidth = function() { + if (this.selected == true) { + return Math.min(this.widthSelected, this.widthMax)*this.networkScaleInv; + } + else { + if (this.hover == true) { + return Math.min(this.hoverWidth, this.widthMax)*this.networkScaleInv; + } + else { + return this.width*this.networkScaleInv; } } + }; - // copy all edges (if not fully clustered, else there are no edges) - for (var edgeId in this.edges) { - if (this.edges.hasOwnProperty(edgeId)) { - this.sectors["frozen"][sectorId]["edges"][edgeId] = this.edges[edgeId]; + Edge.prototype._getViaCoordinates = function () { + var xVia = null; + var yVia = null; + var factor = this.smoothCurves.roundness; + var type = this.smoothCurves.type; + + var dx = Math.abs(this.from.x - this.to.x); + var dy = Math.abs(this.from.y - this.to.y); + if (type == 'discrete' || type == 'diagonalCross') { + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dy; + yVia = this.from.y - factor * dy; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dy; + yVia = this.from.y - factor * dy; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dy; + yVia = this.from.y + factor * dy; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dy; + yVia = this.from.y + factor * dy; + } + } + if (type == "discrete") { + xVia = dx < factor * dy ? this.from.x : xVia; + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dx; + yVia = this.from.y - factor * dx; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dx; + yVia = this.from.y - factor * dx; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dx; + yVia = this.from.y + factor * dx; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dx; + yVia = this.from.y + factor * dx; + } + } + if (type == "discrete") { + yVia = dy < factor * dx ? this.from.y : yVia; + } } } - - // merge the nodeIndices - for (var i = 0; i < this.nodeIndices.length; i++) { - this.sectors["frozen"][sectorId]["nodeIndices"].push(this.nodeIndices[i]); + else if (type == "straightCross") { + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { // up - down + xVia = this.from.x; + if (this.from.y < this.to.y) { + yVia = this.to.y - (1-factor) * dy; + } + else { + yVia = this.to.y + (1-factor) * dy; + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { // left - right + if (this.from.x < this.to.x) { + xVia = this.to.x - (1-factor) * dx; + } + else { + xVia = this.to.x + (1-factor) * dx; + } + yVia = this.from.y; + } + } + else if (type == 'horizontal') { + if (this.from.x < this.to.x) { + xVia = this.to.x - (1-factor) * dx; + } + else { + xVia = this.to.x + (1-factor) * dx; + } + yVia = this.from.y; + } + else if (type == 'vertical') { + xVia = this.from.x; + if (this.from.y < this.to.y) { + yVia = this.to.y - (1-factor) * dy; + } + else { + yVia = this.to.y + (1-factor) * dy; + } + } + else { // continuous + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + // console.log(1) + xVia = this.from.x + factor * dy; + yVia = this.from.y - factor * dy; + xVia = this.to.x < xVia ? this.to.x : xVia; + } + else if (this.from.x > this.to.x) { + // console.log(2) + xVia = this.from.x - factor * dy; + yVia = this.from.y - factor * dy; + xVia = this.to.x > xVia ? this.to.x :xVia; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + // console.log(3) + xVia = this.from.x + factor * dy; + yVia = this.from.y + factor * dy; + xVia = this.to.x < xVia ? this.to.x : xVia; + } + else if (this.from.x > this.to.x) { + // console.log(4, this.from.x, this.to.x) + xVia = this.from.x - factor * dy; + yVia = this.from.y + factor * dy; + xVia = this.to.x > xVia ? this.to.x : xVia; + } + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + // console.log(5) + xVia = this.from.x + factor * dx; + yVia = this.from.y - factor * dx; + yVia = this.to.y > yVia ? this.to.y : yVia; + } + else if (this.from.x > this.to.x) { + // console.log(6) + xVia = this.from.x - factor * dx; + yVia = this.from.y - factor * dx; + yVia = this.to.y > yVia ? this.to.y : yVia; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + // console.log(7) + xVia = this.from.x + factor * dx; + yVia = this.from.y + factor * dx; + yVia = this.to.y < yVia ? this.to.y : yVia; + } + else if (this.from.x > this.to.x) { + // console.log(8) + xVia = this.from.x - factor * dx; + yVia = this.from.y + factor * dx; + yVia = this.to.y < yVia ? this.to.y : yVia; + } + } + } } - }, + return {x:xVia, y:yVia}; + } + /** - * This clusters the sector to one cluster. It was a single cluster before this process started so - * we revert to that state. The clusterToFit function with a maximum size of 1 node does this. - * + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx * @private */ - _collapseThisToSingleCluster : function() { - this.clusterToFit(1,false); - }, - + Edge.prototype._line = function (ctx) { + // draw a straight line + ctx.beginPath(); + ctx.moveTo(this.from.x, this.from.y); + if (this.smoothCurves.enabled == true) { + if (this.smoothCurves.dynamic == false) { + var via = this._getViaCoordinates(); + if (via.x == null) { + ctx.lineTo(this.to.x, this.to.y); + ctx.stroke(); + return null; + } + else { + // this.via.x = via.x; + // this.via.y = via.y; + ctx.quadraticCurveTo(via.x,via.y,this.to.x, this.to.y); + ctx.stroke(); + return via; + } + } + else { + ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y); + ctx.stroke(); + return this.via; + } + } + else { + ctx.lineTo(this.to.x, this.to.y); + ctx.stroke(); + return null; + } + }; /** - * We create a new active sector from the node that we want to open. - * - * @param node + * Draw a line from a node to itself, a circle + * @param {CanvasRenderingContext2D} ctx + * @param {Number} x + * @param {Number} y + * @param {Number} radius * @private */ - _addSector : function(node) { - // this is the currently active sector - var sector = this._sector(); - -// // this should allow me to select nodes from a frozen set. -// if (this.sectors['active'][sector]["nodes"].hasOwnProperty(node.id)) { -// console.log("the node is part of the active sector"); -// } -// else { -// console.log("I dont know what happened!!"); -// } - - // when we switch to a new sector, we remove the node that will be expanded from the current nodes list. - delete this.nodes[node.id]; - - var unqiueIdentifier = util.randomUUID(); - - // we fully freeze the currently active sector - this._freezeSector(sector); - - // we create a new active sector. This sector has the Id of the node to ensure uniqueness - this._createNewSector(unqiueIdentifier); - - // we add the active sector to the sectors array to be able to revert these steps later on - this._setActiveSector(unqiueIdentifier); - - // we redirect the global references to the new sector's references. this._sector() now returns unqiueIdentifier - this._switchToSector(this._sector()); - - // finally we add the node we removed from our previous active sector to the new active sector - this.nodes[node.id] = node; - }, - + Edge.prototype._circle = function (ctx, x, y, radius) { + // draw a circle + ctx.beginPath(); + ctx.arc(x, y, radius, 0, 2 * Math.PI, false); + ctx.stroke(); + }; /** - * We close the sector that is currently open and revert back to the one before. - * If the active sector is the "default" sector, nothing happens. - * + * Draw label with white background and with the middle at (x, y) + * @param {CanvasRenderingContext2D} ctx + * @param {String} text + * @param {Number} x + * @param {Number} y * @private */ - _collapseSector : function() { - // the currently active sector - var sector = this._sector(); - - // we cannot collapse the default sector - if (sector != "default") { - if ((this.nodeIndices.length == 1) || - (this.sectors["active"][sector]["drawingNode"].width*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || - (this.sectors["active"][sector]["drawingNode"].height*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { - var previousSector = this._previousSector(); - - // we collapse the sector back to a single cluster - this._collapseThisToSingleCluster(); - - // we move the remaining nodes, edges and nodeIndices to the previous sector. - // This previous sector is the one we will reactivate - this._mergeThisWithFrozen(previousSector); + Edge.prototype._label = function (ctx, text, x, y) { + if (text) { + // TODO: cache the calculated size + ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") + + this.fontSize + "px " + this.fontFace; + ctx.fillStyle = this.fontFill; + var width = ctx.measureText(text).width; + var height = this.fontSize; + var left = x - width / 2; + var top = y - height / 2; + + ctx.fillRect(left, top, width, height); + + // draw text + ctx.fillStyle = this.fontColor || "black"; + ctx.textAlign = "left"; + ctx.textBaseline = "top"; + ctx.fillText(text, left, top); + } + }; - // the previously active (frozen) sector now has all the data from the currently active sector. - // we can now delete the active sector. - this._deleteActiveSector(sector); + /** + * Redraw a edge as a dashed line + * Draw this edge in the given canvas + * @author David Jordan + * @date 2012-08-08 + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Edge.prototype._drawDashLine = function(ctx) { + // set style + if (this.selected == true) {ctx.strokeStyle = this.color.highlight;} + else if (this.hover == true) {ctx.strokeStyle = this.color.hover;} + else {ctx.strokeStyle = this.color.color;} + + ctx.lineWidth = this._getLineWidth(); + + var via = null; + // only firefox and chrome support this method, else we use the legacy one. + if (ctx.mozDash !== undefined || ctx.setLineDash !== undefined) { + // configure the dash pattern + var pattern = [0]; + if (this.dash.length !== undefined && this.dash.gap !== undefined) { + pattern = [this.dash.length,this.dash.gap]; + } + else { + pattern = [5,5]; + } - // we activate the previously active (and currently frozen) sector. - this._activateSector(previousSector); + // set dash settings for chrome or firefox + if (typeof ctx.setLineDash !== 'undefined') { //Chrome + ctx.setLineDash(pattern); + ctx.lineDashOffset = 0; - // we load the references from the newly active sector into the global references - this._switchToSector(previousSector); + } else { //Firefox + ctx.mozDash = pattern; + ctx.mozDashOffset = 0; + } - // we forget the previously active sector because we reverted to the one before - this._forgetLastSector(); + // draw the line + via = this._line(ctx); - // finally, we update the node index list. - this._updateNodeIndexList(); + // restore the dash settings. + if (typeof ctx.setLineDash !== 'undefined') { //Chrome + ctx.setLineDash([0]); + ctx.lineDashOffset = 0; - // we refresh the list with calulation nodes and calculation node indices. - this._updateCalculationNodes(); + } else { //Firefox + ctx.mozDash = [0]; + ctx.mozDashOffset = 0; } } - }, - - - /** - * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we dont pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction - * @private - */ - _doInAllActiveSectors : function(runFunction,argument) { - if (argument === undefined) { - for (var sector in this.sectors["active"]) { - if (this.sectors["active"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToActiveSector(sector); - this[runFunction](); - } + else { // unsupporting smooth lines + // draw dashed line + ctx.beginPath(); + ctx.lineCap = 'round'; + if (this.dash.altLength !== undefined) //If an alt dash value has been set add to the array this value + { + ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y, + [this.dash.length,this.dash.gap,this.dash.altLength,this.dash.gap]); + } + else if (this.dash.length !== undefined && this.dash.gap !== undefined) //If a dash and gap value has been set add to the array this value + { + ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y, + [this.dash.length,this.dash.gap]); + } + else //If all else fails draw a line + { + ctx.moveTo(this.from.x, this.from.y); + ctx.lineTo(this.to.x, this.to.y); } + ctx.stroke(); } - else { - for (var sector in this.sectors["active"]) { - if (this.sectors["active"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToActiveSector(sector); - var args = Array.prototype.splice.call(arguments, 1); - if (args.length > 1) { - this[runFunction](args[0],args[1]); - } - else { - this[runFunction](argument); - } - } + + // draw label + if (this.label) { + var point; + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; } - } - // we revert the global references back to our active sector - this._loadLatestSector(); - }, + else { + point = this._pointOnLine(0.5); + } + this._label(ctx, this.label, point.x, point.y); + } + }; + /** + * Get a point on a line + * @param {Number} percentage. Value between 0 (line start) and 1 (line end) + * @return {Object} point + * @private + */ + Edge.prototype._pointOnLine = function (percentage) { + return { + x: (1 - percentage) * this.from.x + percentage * this.to.x, + y: (1 - percentage) * this.from.y + percentage * this.to.y + } + }; /** - * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we dont pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction + * Get a point on a circle + * @param {Number} x + * @param {Number} y + * @param {Number} radius + * @param {Number} percentage. Value between 0 (line start) and 1 (line end) + * @return {Object} point * @private */ - _doInSupportSector : function(runFunction,argument) { - if (argument === undefined) { - this._switchToSupportSector(); - this[runFunction](); + Edge.prototype._pointOnCircle = function (x, y, radius, percentage) { + var angle = (percentage - 3/8) * 2 * Math.PI; + return { + x: x + radius * Math.cos(angle), + y: y - radius * Math.sin(angle) } - else { - this._switchToSupportSector(); - var args = Array.prototype.splice.call(arguments, 1); - if (args.length > 1) { - this[runFunction](args[0],args[1]); + }; + + /** + * Redraw a edge as a line with an arrow halfway the line + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + * @private + */ + Edge.prototype._drawArrowCenter = function(ctx) { + var point; + // set style + if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;} + else if (this.hover == true) {ctx.strokeStyle = this.color.hover; ctx.fillStyle = this.color.hover;} + else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;} + ctx.lineWidth = this._getLineWidth(); + + if (this.from != this.to) { + // draw line + var via = this._line(ctx); + + var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); + var length = (10 + 5 * this.width) * this.arrowScaleFactor; + // draw an arrow halfway the line + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; } else { - this[runFunction](argument); + point = this._pointOnLine(0.5); } - } - // we revert the global references back to our active sector - this._loadLatestSector(); - }, + ctx.arrow(point.x, point.y, angle, length); + ctx.fill(); + ctx.stroke(); - /** - * This runs a function in all frozen sectors. This is used in the _redraw(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we don't pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction - * @private - */ - _doInAllFrozenSectors : function(runFunction,argument) { - if (argument === undefined) { - for (var sector in this.sectors["frozen"]) { - if (this.sectors["frozen"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToFrozenSector(sector); - this[runFunction](); - } + // draw label + if (this.label) { + this._label(ctx, this.label, point.x, point.y); } } else { - for (var sector in this.sectors["frozen"]) { - if (this.sectors["frozen"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToFrozenSector(sector); - var args = Array.prototype.splice.call(arguments, 1); - if (args.length > 1) { - this[runFunction](args[0],args[1]); - } - else { - this[runFunction](argument); - } - } + // draw circle + var x, y; + var radius = 0.25 * Math.max(100,this.length); + var node = this.from; + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width * 0.5; + y = node.y - radius; + } + else { + x = node.x + radius; + y = node.y - node.height * 0.5; + } + this._circle(ctx, x, y, radius); + + // draw all arrows + var angle = 0.2 * Math.PI; + var length = (10 + 5 * this.width) * this.arrowScaleFactor; + point = this._pointOnCircle(x, y, radius, 0.5); + ctx.arrow(point.x, point.y, angle, length); + ctx.fill(); + ctx.stroke(); + + // draw label + if (this.label) { + point = this._pointOnCircle(x, y, radius, 0.5); + this._label(ctx, this.label, point.x, point.y); } } - this._loadLatestSector(); - }, + }; + /** - * This runs a function in all sectors. This is used in the _redraw(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we don't pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction + * Redraw a edge as a line with an arrow + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx * @private */ - _doInAllSectors : function(runFunction,argument) { - var args = Array.prototype.splice.call(arguments, 1); - if (argument === undefined) { - this._doInAllActiveSectors(runFunction); - this._doInAllFrozenSectors(runFunction); + Edge.prototype._drawArrow = function(ctx) { + // set style + if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;} + else if (this.hover == true) {ctx.strokeStyle = this.color.hover; ctx.fillStyle = this.color.hover;} + else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;} + + ctx.lineWidth = this._getLineWidth(); + + var angle, length; + //draw a line + if (this.from != this.to) { + angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); + var dx = (this.to.x - this.from.x); + var dy = (this.to.y - this.from.y); + var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + + var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI); + var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength; + var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; + var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; + + var via; + if (this.smoothCurves.dynamic == true && this.smoothCurves.enabled == true ) { + via = this.via; + } + else if (this.smoothCurves.enabled == true) { + via = this._getViaCoordinates(); + } + + if (this.smoothCurves.enabled == true && via.x != null) { + angle = Math.atan2((this.to.y - via.y), (this.to.x - via.x)); + dx = (this.to.x - via.x); + dy = (this.to.y - via.y); + edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + } + var toBorderDist = this.to.distanceToBorder(ctx, angle); + var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; + + var xTo,yTo; + if (this.smoothCurves.enabled == true && via.x != null) { + xTo = (1 - toBorderPoint) * via.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * via.y + toBorderPoint * this.to.y; + } + else { + xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y; + } + + ctx.beginPath(); + ctx.moveTo(xFrom,yFrom); + if (this.smoothCurves.enabled == true && via.x != null) { + ctx.quadraticCurveTo(via.x,via.y,xTo, yTo); + } + else { + ctx.lineTo(xTo, yTo); + } + ctx.stroke(); + + // draw arrow at the end of the line + length = (10 + 5 * this.width) * this.arrowScaleFactor; + ctx.arrow(xTo, yTo, angle, length); + ctx.fill(); + ctx.stroke(); + + // draw label + if (this.label) { + var point; + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); + point = {x:midpointX, y:midpointY}; + } + else { + point = this._pointOnLine(0.5); + } + this._label(ctx, this.label, point.x, point.y); + } } else { - if (args.length > 1) { - this._doInAllActiveSectors(runFunction,args[0],args[1]); - this._doInAllFrozenSectors(runFunction,args[0],args[1]); + // draw circle + var node = this.from; + var x, y, arrow; + var radius = 0.25 * Math.max(100,this.length); + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width * 0.5; + y = node.y - radius; + arrow = { + x: x, + y: node.y, + angle: 0.9 * Math.PI + }; } else { - this._doInAllActiveSectors(runFunction,argument); - this._doInAllFrozenSectors(runFunction,argument); + x = node.x + radius; + y = node.y - node.height * 0.5; + arrow = { + x: node.x, + y: y, + angle: 0.6 * Math.PI + }; } - } - }, + ctx.beginPath(); + // TODO: similarly, for a line without arrows, draw to the border of the nodes instead of the center + ctx.arc(x, y, radius, 0, 2 * Math.PI, false); + ctx.stroke(); + // draw all arrows + var length = (10 + 5 * this.width) * this.arrowScaleFactor; + ctx.arrow(arrow.x, arrow.y, arrow.angle, length); + ctx.fill(); + ctx.stroke(); + + // draw label + if (this.label) { + point = this._pointOnCircle(x, y, radius, 0.5); + this._label(ctx, this.label, point.x, point.y); + } + } + }; - /** - * This clears the nodeIndices list. We cannot use this.nodeIndices = [] because we would break the link with the - * active sector. Thus we clear the nodeIndices in the active sector, then reconnect the this.nodeIndices to it. - * - * @private - */ - _clearNodeIndexList : function() { - var sector = this._sector(); - this.sectors["active"][sector]["nodeIndices"] = []; - this.nodeIndices = this.sectors["active"][sector]["nodeIndices"]; - }, /** - * Draw the encompassing sector node - * - * @param ctx - * @param sectorType + * Calculate the distance between a point (x3,y3) and a line segment from + * (x1,y1) to (x2,y2). + * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 * @private */ - _drawSectorNodes : function(ctx,sectorType) { - var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; - for (var sector in this.sectors[sectorType]) { - if (this.sectors[sectorType].hasOwnProperty(sector)) { - if (this.sectors[sectorType][sector]["drawingNode"] !== undefined) { - - this._switchToSector(sector,sectorType); - - minY = 1e9; maxY = -1e9; minX = 1e9; maxX = -1e9; - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - node.resize(ctx); - if (minX > node.x - 0.5 * node.width) {minX = node.x - 0.5 * node.width;} - if (maxX < node.x + 0.5 * node.width) {maxX = node.x + 0.5 * node.width;} - if (minY > node.y - 0.5 * node.height) {minY = node.y - 0.5 * node.height;} - if (maxY < node.y + 0.5 * node.height) {maxY = node.y + 0.5 * node.height;} - } + Edge.prototype._getDistanceToEdge = function (x1,y1, x2,y2, x3,y3) { // x3,y3 is the point + if (this.from != this.to) { + if (this.smoothCurves.enabled == true) { + var xVia, yVia; + if (this.smoothCurves.enabled == true && this.smoothCurves.dynamic == true) { + xVia = this.via.x; + yVia = this.via.y; + } + else { + var via = this._getViaCoordinates(); + xVia = via.x; + yVia = via.y; + } + var minDistance = 1e9; + var distance; + var i,t,x,y, lastX, lastY; + for (i = 0; i < 10; i++) { + t = 0.1*i; + x = Math.pow(1-t,2)*x1 + (2*t*(1 - t))*xVia + Math.pow(t,2)*x2; + y = Math.pow(1-t,2)*y1 + (2*t*(1 - t))*yVia + Math.pow(t,2)*y2; + if (i > 0) { + distance = this._getDistanceToLine(lastX,lastY,x,y, x3,y3); + minDistance = distance < minDistance ? distance : minDistance; } - node = this.sectors[sectorType][sector]["drawingNode"]; - node.x = 0.5 * (maxX + minX); - node.y = 0.5 * (maxY + minY); - node.width = 2 * (node.x - minX); - node.height = 2 * (node.y - minY); - node.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2)); - node.setScale(this.scale); - node._drawCircle(ctx); + lastX = x; lastY = y; } + return minDistance + } + else { + return this._getDistanceToLine(x1,y1,x2,y2,x3,y3); + } + } + else { + var x, y, dx, dy; + var radius = this.length / 4; + var node = this.from; + if (!node.width) { + node.resize(ctx); + } + if (node.width > node.height) { + x = node.x + node.width / 2; + y = node.y - radius; + } + else { + x = node.x + radius; + y = node.y - node.height / 2; } + dx = x - x3; + dy = y - y3; + return Math.abs(Math.sqrt(dx*dx + dy*dy) - radius); } - }, + }; - _drawAllSectorNodes : function(ctx) { - this._drawSectorNodes(ctx,"frozen"); - this._drawSectorNodes(ctx,"active"); - this._loadLatestSector(); - } -}; + Edge.prototype._getDistanceToLine = function(x1,y1,x2,y2,x3,y3) { + var px = x2-x1, + py = y2-y1, + something = px*px + py*py, + u = ((x3 - x1) * px + (y3 - y1) * py) / something; -/** - * Creation of the ClusterMixin var. - * - * This contains all the functions the Network object can use to employ clustering - * - * Alex de Mulder - * 21-01-2013 - */ -var ClusterMixin = { + if (u > 1) { + u = 1; + } + else if (u < 0) { + u = 0; + } - /** - * This is only called in the constructor of the network object - * - */ - startWithClustering : function() { - // cluster if the data set is big - this.clusterToFit(this.constants.clustering.initialMaxNodes, true); + var x = x1 + u * px, + y = y1 + u * py, + dx = x - x3, + dy = y - y3; - // updates the lables after clustering - this.updateLabels(); + //# Note: If the actual distance does not matter, + //# if you only want to compare what this function + //# returns to other results of this function, you + //# can just return the squared distance instead + //# (i.e. remove the sqrt) to gain a little performance - // this is called here because if clusterin is disabled, the start and stabilize are called in - // the setData function. - if (this.stabilize) { - this._stabilize(); - } - this.start(); - }, + return Math.sqrt(dx*dx + dy*dy); + } /** - * This function clusters until the initialMaxNodes has been reached + * This allows the zoom level of the network to influence the rendering * - * @param {Number} maxNumberOfNodes - * @param {Boolean} reposition + * @param scale */ - clusterToFit : function(maxNumberOfNodes, reposition) { - var numberOfNodes = this.nodeIndices.length; + Edge.prototype.setScale = function(scale) { + this.networkScaleInv = 1.0/scale; + }; - var maxLevels = 50; - var level = 0; - // we first cluster the hubs, then we pull in the outliers, repeat - while (numberOfNodes > maxNumberOfNodes && level < maxLevels) { - if (level % 3 == 0) { - this.forceAggregateHubs(true); - this.normalizeClusterLevels(); - } - else { - this.increaseClusterLevel(); // this also includes a cluster normalization - } + Edge.prototype.select = function() { + this.selected = true; + }; - numberOfNodes = this.nodeIndices.length; - level += 1; - } + Edge.prototype.unselect = function() { + this.selected = false; + }; - // after the clustering we reposition the nodes to reduce the initial chaos - if (level > 0 && reposition == true) { - this.repositionNodes(); + Edge.prototype.positionBezierNode = function() { + if (this.via !== null) { + this.via.x = 0.5 * (this.from.x + this.to.x); + this.via.y = 0.5 * (this.from.y + this.to.y); } - this._updateCalculationNodes(); - }, + }; /** - * This function can be called to open up a specific cluster. It is only called by - * It will unpack the cluster back one level. - * - * @param node | Node object: cluster to open. + * This function draws the control nodes for the manipulator. In order to enable this, only set the this.controlNodesEnabled to true. + * @param ctx */ - openCluster : function(node) { - var isMovingBeforeClustering = this.moving; - if (node.clusterSize > this.constants.clustering.sectorThreshold && this._nodeInActiveArea(node) && - !(this._sector() == "default" && this.nodeIndices.length == 1)) { - // this loads a new sector, loads the nodes and edges and nodeIndices of it. - this._addSector(node); - var level = 0; - - // we decluster until we reach a decent number of nodes - while ((this.nodeIndices.length < this.constants.clustering.initialMaxNodes) && (level < 10)) { - this.decreaseClusterLevel(); - level += 1; + Edge.prototype._drawControlNodes = function(ctx) { + if (this.controlNodesEnabled == true) { + if (this.controlNodes.from === null && this.controlNodes.to === null) { + var nodeIdFrom = "edgeIdFrom:".concat(this.id); + var nodeIdTo = "edgeIdTo:".concat(this.id); + var constants = { + nodes:{group:'', radius:8}, + physics:{damping:0}, + clustering: {maxNodeSizeIncrements: 0 ,nodeScaling: {width:0, height: 0, radius:0}} + }; + this.controlNodes.from = new Node( + {id:nodeIdFrom, + shape:'dot', + color:{background:'#ff4e00', border:'#3c3c3c', highlight: {background:'#07f968'}} + },{},{},constants); + this.controlNodes.to = new Node( + {id:nodeIdTo, + shape:'dot', + color:{background:'#ff4e00', border:'#3c3c3c', highlight: {background:'#07f968'}} + },{},{},constants); } - } - else { - this._expandClusterNode(node,false,true); - - // update the index list, dynamic edges and labels - this._updateNodeIndexList(); - this._updateDynamicEdges(); - this._updateCalculationNodes(); - this.updateLabels(); - } + if (this.controlNodes.from.selected == false && this.controlNodes.to.selected == false) { + this.controlNodes.positions = this.getControlNodePositions(ctx); + this.controlNodes.from.x = this.controlNodes.positions.from.x; + this.controlNodes.from.y = this.controlNodes.positions.from.y; + this.controlNodes.to.x = this.controlNodes.positions.to.x; + this.controlNodes.to.y = this.controlNodes.positions.to.y; + } - // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded - if (this.moving != isMovingBeforeClustering) { - this.start(); + this.controlNodes.from.draw(ctx); + this.controlNodes.to.draw(ctx); } - }, - + else { + this.controlNodes = {from:null, to:null, positions:{}}; + } + }; /** - * This calls the updateClustes with default arguments + * Enable control nodes. + * @private */ - updateClustersDefault : function() { - if (this.constants.clustering.enabled == true) { - this.updateClusters(0,false,false); - } - }, + Edge.prototype._enableControlNodes = function() { + this.controlNodesEnabled = true; + }; + /** + * disable control nodes + * @private + */ + Edge.prototype._disableControlNodes = function() { + this.controlNodesEnabled = false; + }; /** - * This function can be called to increase the cluster level. This means that the nodes with only one edge connection will - * be clustered with their connected node. This can be repeated as many times as needed. - * This can be called externally (by a keybind for instance) to reduce the complexity of big datasets. + * This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null. + * @param x + * @param y + * @returns {null} + * @private */ - increaseClusterLevel : function() { - this.updateClusters(-1,false,true); - }, + Edge.prototype._getSelectedControlNode = function(x,y) { + var positions = this.controlNodes.positions; + var fromDistance = Math.sqrt(Math.pow(x - positions.from.x,2) + Math.pow(y - positions.from.y,2)); + var toDistance = Math.sqrt(Math.pow(x - positions.to.x ,2) + Math.pow(y - positions.to.y ,2)); + + if (fromDistance < 15) { + this.connectedNode = this.from; + this.from = this.controlNodes.from; + return this.controlNodes.from; + } + else if (toDistance < 15) { + this.connectedNode = this.to; + this.to = this.controlNodes.to; + return this.controlNodes.to; + } + else { + return null; + } + }; /** - * This function can be called to decrease the cluster level. This means that the nodes with only one edge connection will - * be unpacked if they are a cluster. This can be repeated as many times as needed. - * This can be called externally (by a key-bind for instance) to look into clusters without zooming. + * this resets the control nodes to their original position. + * @private */ - decreaseClusterLevel : function() { - this.updateClusters(1,false,true); - }, - + Edge.prototype._restoreControlNodes = function() { + if (this.controlNodes.from.selected == true) { + this.from = this.connectedNode; + this.connectedNode = null; + this.controlNodes.from.unselect(); + } + if (this.controlNodes.to.selected == true) { + this.to = this.connectedNode; + this.connectedNode = null; + this.controlNodes.to.unselect(); + } + }; /** - * This is the main clustering function. It clusters and declusters on zoom or forced - * This function clusters on zoom, it can be called with a predefined zoom direction - * If out, check if we can form clusters, if in, check if we can open clusters. - * This function is only called from _zoom() - * - * @param {Number} zoomDirection | -1 / 0 / +1 for zoomOut / determineByZoom / zoomIn - * @param {Boolean} recursive | enabled or disable recursive calling of the opening of clusters - * @param {Boolean} force | enabled or disable forcing - * @param {Boolean} doNotStart | if true do not call start + * this calculates the position of the control nodes on the edges of the parent nodes. * + * @param ctx + * @returns {{from: {x: number, y: number}, to: {x: *, y: *}}} */ - updateClusters : function(zoomDirection,recursive,force,doNotStart) { - var isMovingBeforeClustering = this.moving; - var amountOfNodes = this.nodeIndices.length; - - // on zoom out collapse the sector if the scale is at the level the sector was made - if (this.previousScale > this.scale && zoomDirection == 0) { - this._collapseSector(); - } + Edge.prototype.getControlNodePositions = function(ctx) { + var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); + var dx = (this.to.x - this.from.x); + var dy = (this.to.y - this.from.y); + var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI); + var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength; + var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; + var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; - // check if we zoom in or out - if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out - // forming clusters when forced pulls outliers in. When not forced, the edge length of the - // outer nodes determines if it is being clustered - this._formClusters(force); + var via; + if (this.smoothCurves.dynamic == true && this.smoothCurves.enabled == true) { + via = this.via; } - else if (this.previousScale < this.scale || zoomDirection == 1) { // zoom in - if (force == true) { - // _openClusters checks for each node if the formationScale of the cluster is smaller than - // the current scale and if so, declusters. When forced, all clusters are reduced by one step - this._openClusters(recursive,force); - } - else { - // if a cluster takes up a set percentage of the active window - this._openClustersBySize(); - } + else if (this.smoothCurves.enabled == true) { + via = this._getViaCoordinates(); } - this._updateNodeIndexList(); - // if a cluster was NOT formed and the user zoomed out, we try clustering by hubs - if (this.nodeIndices.length == amountOfNodes && (this.previousScale > this.scale || zoomDirection == -1)) { - this._aggregateHubs(force); - this._updateNodeIndexList(); + if (this.smoothCurves.enabled == true && via.x != null) { + angle = Math.atan2((this.to.y - via.y), (this.to.x - via.x)); + dx = (this.to.x - via.x); + dy = (this.to.y - via.y); + edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); } + var toBorderDist = this.to.distanceToBorder(ctx, angle); + var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; - // we now reduce chains. - if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out - this.handleChains(); - this._updateNodeIndexList(); + var xTo,yTo; + if (this.smoothCurves.enabled == true && via.x != null) { + xTo = (1 - toBorderPoint) * via.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * via.y + toBorderPoint * this.to.y; + } + else { + xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y; } - this.previousScale = this.scale; - - // rest of the update the index list, dynamic edges and labels - this._updateDynamicEdges(); - this.updateLabels(); + return {from:{x:xFrom,y:yFrom},to:{x:xTo,y:yTo}}; + }; - // if a cluster was formed, we increase the clusterSession - if (this.nodeIndices.length < amountOfNodes) { // this means a clustering operation has taken place - this.clusterSession += 1; - // if clusters have been made, we normalize the cluster level - this.normalizeClusterLevels(); - } + module.exports = Edge; - if (doNotStart == false || doNotStart === undefined) { - // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded - if (this.moving != isMovingBeforeClustering) { - this.start(); - } - } +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { - this._updateCalculationNodes(); - }, + var util = __webpack_require__(1); /** - * This function handles the chains. It is called on every updateClusters(). + * @class Groups + * This class can store groups and properties specific for groups. */ - handleChains : function() { - // after clustering we check how many chains there are - var chainPercentage = this._getChainFraction(); - if (chainPercentage > this.constants.clustering.chainThreshold) { - this._reduceAmountOfChains(1 - this.constants.clustering.chainThreshold / chainPercentage) + function Groups() { + this.clear(); + this.defaultIndex = 0; + } - } - }, /** - * this functions starts clustering by hubs - * The minimum hub threshold is set globally - * - * @private + * default constants for group colors */ - _aggregateHubs : function(force) { - this._getHubSize(); - this._formClustersByHub(force,false); - }, + Groups.DEFAULT = [ + {border: "#2B7CE9", background: "#97C2FC", highlight: {border: "#2B7CE9", background: "#D2E5FF"}, hover: {border: "#2B7CE9", background: "#D2E5FF"}}, // blue + {border: "#FFA500", background: "#FFFF00", highlight: {border: "#FFA500", background: "#FFFFA3"}, hover: {border: "#FFA500", background: "#FFFFA3"}}, // yellow + {border: "#FA0A10", background: "#FB7E81", highlight: {border: "#FA0A10", background: "#FFAFB1"}, hover: {border: "#FA0A10", background: "#FFAFB1"}}, // red + {border: "#41A906", background: "#7BE141", highlight: {border: "#41A906", background: "#A1EC76"}, hover: {border: "#41A906", background: "#A1EC76"}}, // green + {border: "#E129F0", background: "#EB7DF4", highlight: {border: "#E129F0", background: "#F0B3F5"}, hover: {border: "#E129F0", background: "#F0B3F5"}}, // magenta + {border: "#7C29F0", background: "#AD85E4", highlight: {border: "#7C29F0", background: "#D3BDF0"}, hover: {border: "#7C29F0", background: "#D3BDF0"}}, // purple + {border: "#C37F00", background: "#FFA807", highlight: {border: "#C37F00", background: "#FFCA66"}, hover: {border: "#C37F00", background: "#FFCA66"}}, // orange + {border: "#4220FB", background: "#6E6EFD", highlight: {border: "#4220FB", background: "#9B9BFD"}, hover: {border: "#4220FB", background: "#9B9BFD"}}, // darkblue + {border: "#FD5A77", background: "#FFC0CB", highlight: {border: "#FD5A77", background: "#FFD1D9"}, hover: {border: "#FD5A77", background: "#FFD1D9"}}, // pink + {border: "#4AD63A", background: "#C2FABC", highlight: {border: "#4AD63A", background: "#E6FFE3"}, hover: {border: "#4AD63A", background: "#E6FFE3"}} // mint + ]; /** - * This function is fired by keypress. It forces hubs to form. - * + * Clear all groups */ - forceAggregateHubs : function(doNotStart) { - var isMovingBeforeClustering = this.moving; - var amountOfNodes = this.nodeIndices.length; + Groups.prototype.clear = function () { + this.groups = {}; + this.groups.length = function() + { + var i = 0; + for ( var p in this ) { + if (this.hasOwnProperty(p)) { + i++; + } + } + return i; + } + }; - this._aggregateHubs(true); - // update the index list, dynamic edges and labels - this._updateNodeIndexList(); - this._updateDynamicEdges(); - this.updateLabels(); + /** + * get group properties of a groupname. If groupname is not found, a new group + * is added. + * @param {*} groupname Can be a number, string, Date, etc. + * @return {Object} group The created group, containing all group properties + */ + Groups.prototype.get = function (groupname) { + var group = this.groups[groupname]; + if (group == undefined) { + // create new group + var index = this.defaultIndex % Groups.DEFAULT.length; + this.defaultIndex++; + group = {}; + group.color = Groups.DEFAULT[index]; + this.groups[groupname] = group; + } + + return group; + }; - // if a cluster was formed, we increase the clusterSession - if (this.nodeIndices.length != amountOfNodes) { - this.clusterSession += 1; + /** + * Add a custom group style + * @param {String} groupname + * @param {Object} style An object containing borderColor, + * backgroundColor, etc. + * @return {Object} group The created group object + */ + Groups.prototype.add = function (groupname, style) { + this.groups[groupname] = style; + if (style.color) { + style.color = util.parseColor(style.color); } + return style; + }; - if (doNotStart == false || doNotStart === undefined) { - // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded - if (this.moving != isMovingBeforeClustering) { - this.start(); - } - } - }, + module.exports = Groups; + + +/***/ }, +/* 35 */ +/***/ function(module, exports, __webpack_require__) { /** - * If a cluster takes up more than a set percentage of the screen, open the cluster - * - * @private + * @class Images + * This class loads images and keeps them stored. */ - _openClustersBySize : function() { - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - var node = this.nodes[nodeId]; - if (node.inView() == true) { - if ((node.width*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || - (node.height*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { - this.openCluster(node); - } - } - } - } - }, + function Images() { + this.images = {}; + this.callback = undefined; + } /** - * This function loops over all nodes in the nodeIndices list. For each node it checks if it is a cluster and if it - * has to be opened based on the current zoom level. - * - * @private + * Set an onload callback function. This will be called each time an image + * is loaded + * @param {function} callback */ - _openClusters : function(recursive,force) { - for (var i = 0; i < this.nodeIndices.length; i++) { - var node = this.nodes[this.nodeIndices[i]]; - this._expandClusterNode(node,recursive,force); - this._updateCalculationNodes(); - } - }, + Images.prototype.setOnloadCallback = function(callback) { + this.callback = callback; + }; /** - * This function checks if a node has to be opened. This is done by checking the zoom level. - * If the node contains child nodes, this function is recursively called on the child nodes as well. - * This recursive behaviour is optional and can be set by the recursive argument. * - * @param {Node} parentNode | to check for cluster and expand - * @param {Boolean} recursive | enabled or disable recursive calling - * @param {Boolean} force | enabled or disable forcing - * @param {Boolean} [openAll] | This will recursively force all nodes in the parent to be released - * @private + * @param {string} url Url of the image + * @return {Image} img The image object */ - _expandClusterNode : function(parentNode, recursive, force, openAll) { - // first check if node is a cluster - if (parentNode.clusterSize > 1) { - // this means that on a double tap event or a zoom event, the cluster fully unpacks if it is smaller than 20 - if (parentNode.clusterSize < this.constants.clustering.sectorThreshold) { - openAll = true; - } - recursive = openAll ? true : recursive; - - // if the last child has been added on a smaller scale than current scale decluster - if (parentNode.formationScale < this.scale || force == true) { - // we will check if any of the contained child nodes should be removed from the cluster - for (var containedNodeId in parentNode.containedNodes) { - if (parentNode.containedNodes.hasOwnProperty(containedNodeId)) { - var childNode = parentNode.containedNodes[containedNodeId]; - - // force expand will expand the largest cluster size clusters. Since we cluster from outside in, we assume that - // the largest cluster is the one that comes from outside - if (force == true) { - if (childNode.clusterSession == parentNode.clusterSessions[parentNode.clusterSessions.length-1] - || openAll) { - this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); - } - } - else { - if (this._nodeInActiveArea(parentNode)) { - this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); - } - } - } + Images.prototype.load = function(url) { + var img = this.images[url]; + if (img == undefined) { + // create the image + var images = this; + img = new Image(); + this.images[url] = img; + img.onload = function() { + if (images.callback) { + images.callback(this); } - } + }; + img.src = url; } - }, + + return img; + }; + + module.exports = Images; + + +/***/ }, +/* 36 */ +/***/ function(module, exports, __webpack_require__) { + + var util = __webpack_require__(1); /** - * ONLY CALLED FROM _expandClusterNode - * - * This function will expel a child_node from a parent_node. This is to de-cluster the node. This function will remove - * the child node from the parent contained_node object and put it back into the global nodes object. - * The same holds for the edge that was connected to the child node. It is moved back into the global edges object. + * @class Node + * A node. A node can be connected to other nodes via one or multiple edges. + * @param {object} properties An object containing properties for the node. All + * properties are optional, except for the id. + * {number} id Id of the node. Required + * {string} label Text label for the node + * {number} x Horizontal position of the node + * {number} y Vertical position of the node + * {string} shape Node shape, available: + * "database", "circle", "ellipse", + * "box", "image", "text", "dot", + * "star", "triangle", "triangleDown", + * "square" + * {string} image An image url + * {string} title An title text, can be HTML + * {anytype} group A group name or number + * @param {Network.Images} imagelist A list with images. Only needed + * when the node has an image + * @param {Network.Groups} grouplist A list with groups. Needed for + * retrieving group properties + * @param {Object} constants An object with default values for + * example for the color * - * @param {Node} parentNode | the parent node - * @param {String} containedNodeId | child_node id as it is contained in the containedNodes object of the parent node - * @param {Boolean} recursive | This will also check if the child needs to be expanded. - * With force and recursive both true, the entire cluster is unpacked - * @param {Boolean} force | This will disregard the zoom level and will expel this child from the parent - * @param {Boolean} openAll | This will recursively force all nodes in the parent to be released - * @private */ - _expelChildFromParent : function(parentNode, containedNodeId, recursive, force, openAll) { - var childNode = parentNode.containedNodes[containedNodeId]; + function Node(properties, imagelist, grouplist, constants) { + this.selected = false; + this.hover = false; + + this.edges = []; // all edges connected to this node + this.dynamicEdges = []; + this.reroutedEdges = {}; + + this.group = constants.nodes.group; + this.fontSize = Number(constants.nodes.fontSize); + this.fontFace = constants.nodes.fontFace; + this.fontColor = constants.nodes.fontColor; + this.fontDrawThreshold = 3; + + this.color = constants.nodes.color; + + // set defaults for the properties + this.id = undefined; + this.shape = constants.nodes.shape; + this.image = constants.nodes.image; + this.x = null; + this.y = null; + this.xFixed = false; + this.yFixed = false; + this.horizontalAlignLeft = true; // these are for the navigation controls + this.verticalAlignTop = true; // these are for the navigation controls + this.radius = constants.nodes.radius; + this.baseRadiusValue = constants.nodes.radius; + this.radiusFixed = false; + this.radiusMin = constants.nodes.radiusMin; + this.radiusMax = constants.nodes.radiusMax; + this.level = -1; + this.preassignedLevel = false; + this.borderWidth = constants.nodes.borderWidth; + this.borderWidthSelected = constants.nodes.borderWidthSelected; + + + this.imagelist = imagelist; + this.grouplist = grouplist; + + // physics properties + this.fx = 0.0; // external force x + this.fy = 0.0; // external force y + this.vx = 0.0; // velocity x + this.vy = 0.0; // velocity y + this.minForce = constants.minForce; + this.damping = constants.physics.damping; + this.mass = 1; // kg + this.fixedData = {x:null,y:null}; + + + this.setProperties(properties, constants); + + // creating the variables for clustering + this.resetCluster(); + this.dynamicEdgesLength = 0; + this.clusterSession = 0; + this.clusterSizeWidthFactor = constants.clustering.nodeScaling.width; + this.clusterSizeHeightFactor = constants.clustering.nodeScaling.height; + this.clusterSizeRadiusFactor = constants.clustering.nodeScaling.radius; + this.maxNodeSizeIncrements = constants.clustering.maxNodeSizeIncrements; + this.growthIndicator = 0; - // if child node has been added on smaller scale than current, kick out - if (childNode.formationScale < this.scale || force == true) { - // unselect all selected items - this._unselectAll(); + // variables to tell the node about the network. + this.networkScaleInv = 1; + this.networkScale = 1; + this.canvasTopLeft = {"x": -300, "y": -300}; + this.canvasBottomRight = {"x": 300, "y": 300}; + this.parentEdgeId = null; + } - // put the child node back in the global nodes object - this.nodes[containedNodeId] = childNode; + /** + * (re)setting the clustering variables and objects + */ + Node.prototype.resetCluster = function() { + // clustering variables + this.formationScale = undefined; // this is used to determine when to open the cluster + this.clusterSize = 1; // this signifies the total amount of nodes in this cluster + this.containedNodes = {}; + this.containedEdges = {}; + this.clusterSessions = []; + }; + + /** + * Attach a edge to the node + * @param {Edge} edge + */ + Node.prototype.attachEdge = function(edge) { + if (this.edges.indexOf(edge) == -1) { + this.edges.push(edge); + } + if (this.dynamicEdges.indexOf(edge) == -1) { + this.dynamicEdges.push(edge); + } + this.dynamicEdgesLength = this.dynamicEdges.length; + }; - // release the contained edges from this childNode back into the global edges - this._releaseContainedEdges(parentNode,childNode); + /** + * Detach a edge from the node + * @param {Edge} edge + */ + Node.prototype.detachEdge = function(edge) { + var index = this.edges.indexOf(edge); + if (index != -1) { + this.edges.splice(index, 1); + this.dynamicEdges.splice(index, 1); + } + this.dynamicEdgesLength = this.dynamicEdges.length; + }; - // reconnect rerouted edges to the childNode - this._connectEdgeBackToChild(parentNode,childNode); - // validate all edges in dynamicEdges - this._validateEdges(parentNode); + /** + * Set or overwrite properties for the node + * @param {Object} properties an object with properties + * @param {Object} constants and object with default, global properties + */ + Node.prototype.setProperties = function(properties, constants) { + if (!properties) { + return; + } + this.originalLabel = undefined; + // basic properties + if (properties.id !== undefined) {this.id = properties.id;} + if (properties.label !== undefined) {this.label = properties.label; this.originalLabel = properties.label;} + if (properties.title !== undefined) {this.title = properties.title;} + if (properties.group !== undefined) {this.group = properties.group;} + if (properties.x !== undefined) {this.x = properties.x;} + if (properties.y !== undefined) {this.y = properties.y;} + if (properties.value !== undefined) {this.value = properties.value;} + if (properties.level !== undefined) {this.level = properties.level; this.preassignedLevel = true;} + if (properties.borderWidth !== undefined) {this.borderWidth = properties.borderWidth;} + if (properties.borderWidthSelected !== undefined) {this.borderWidthSelected = properties.borderWidthSelected;} - // undo the changes from the clustering operation on the parent node - parentNode.mass -= childNode.mass; - parentNode.clusterSize -= childNode.clusterSize; - parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); - parentNode.dynamicEdgesLength = parentNode.dynamicEdges.length; + // physics + if (properties.mass !== undefined) {this.mass = properties.mass;} - // place the child node near the parent, not at the exact same location to avoid chaos in the system - childNode.x = parentNode.x + parentNode.growthIndicator * (0.5 - Math.random()); - childNode.y = parentNode.y + parentNode.growthIndicator * (0.5 - Math.random()); + // navigation controls properties + if (properties.horizontalAlignLeft !== undefined) {this.horizontalAlignLeft = properties.horizontalAlignLeft;} + if (properties.verticalAlignTop !== undefined) {this.verticalAlignTop = properties.verticalAlignTop;} + if (properties.triggerFunction !== undefined) {this.triggerFunction = properties.triggerFunction;} - // remove node from the list - delete parentNode.containedNodes[containedNodeId]; + if (this.id === undefined) { + throw "Node must have an id"; + } - // check if there are other childs with this clusterSession in the parent. - var othersPresent = false; - for (var childNodeId in parentNode.containedNodes) { - if (parentNode.containedNodes.hasOwnProperty(childNodeId)) { - if (parentNode.containedNodes[childNodeId].clusterSession == childNode.clusterSession) { - othersPresent = true; - break; - } + // copy group properties + if (this.group !== undefined && this.group != "") { + var groupObj = this.grouplist.get(this.group); + for (var prop in groupObj) { + if (groupObj.hasOwnProperty(prop)) { + this[prop] = groupObj[prop]; } } - // if there are no others, remove the cluster session from the list - if (othersPresent == false) { - parentNode.clusterSessions.pop(); - } + } - this._repositionBezierNodes(childNode); -// this._repositionBezierNodes(parentNode); + // individual shape properties + if (properties.shape !== undefined) {this.shape = properties.shape;} + if (properties.image !== undefined) {this.image = properties.image;} + if (properties.radius !== undefined) {this.radius = properties.radius; this.baseRadiusValue = this.radius;} + if (properties.color !== undefined) {this.color = util.parseColor(properties.color);} - // remove the clusterSession from the child node - childNode.clusterSession = 0; + if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} + if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} + if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} - // recalculate the size of the node on the next time the node is rendered - parentNode.clearSizeCache(); + if (this.image !== undefined && this.image != "") { + if (this.imagelist) { + this.imageObj = this.imagelist.load(this.image); + } + else { + throw "No imagelist provided"; + } + } - // restart the simulation to reorganise all nodes - this.moving = true; + this.xFixed = this.xFixed || (properties.x !== undefined && !properties.allowedToMoveX); + this.yFixed = this.yFixed || (properties.y !== undefined && !properties.allowedToMoveY); + this.radiusFixed = this.radiusFixed || (properties.radius !== undefined); + + if (this.shape == 'image') { + this.radiusMin = constants.nodes.widthMin; + this.radiusMax = constants.nodes.widthMax; } - // check if a further expansion step is possible if recursivity is enabled - if (recursive == true) { - this._expandClusterNode(childNode,recursive,force,openAll); + // choose draw method depending on the shape + switch (this.shape) { + case 'database': this.draw = this._drawDatabase; this.resize = this._resizeDatabase; break; + case 'box': this.draw = this._drawBox; this.resize = this._resizeBox; break; + case 'circle': this.draw = this._drawCircle; this.resize = this._resizeCircle; break; + case 'ellipse': this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break; + // TODO: add diamond shape + case 'image': this.draw = this._drawImage; this.resize = this._resizeImage; break; + case 'text': this.draw = this._drawText; this.resize = this._resizeText; break; + case 'dot': this.draw = this._drawDot; this.resize = this._resizeShape; break; + case 'square': this.draw = this._drawSquare; this.resize = this._resizeShape; break; + case 'triangle': this.draw = this._drawTriangle; this.resize = this._resizeShape; break; + case 'triangleDown': this.draw = this._drawTriangleDown; this.resize = this._resizeShape; break; + case 'star': this.draw = this._drawStar; this.resize = this._resizeShape; break; + default: this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break; } - }, + // reset the size of the node, this can be changed + this._reset(); + }; + /** + * select this node + */ + Node.prototype.select = function() { + this.selected = true; + this._reset(); + }; /** - * position the bezier nodes at the center of the edges - * - * @param node - * @private + * unselect this node */ - _repositionBezierNodes : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - node.dynamicEdges[i].positionBezierNode(); - } - }, + Node.prototype.unselect = function() { + this.selected = false; + this._reset(); + }; /** - * This function checks if any nodes at the end of their trees have edges below a threshold length - * This function is called only from updateClusters() - * forceLevelCollapse ignores the length of the edge and collapses one level - * This means that a node with only one edge will be clustered with its connected node - * + * Reset the calculated size of the node, forces it to recalculate its size + */ + Node.prototype.clearSizeCache = function() { + this._reset(); + }; + + /** + * Reset the calculated size of the node, forces it to recalculate its size * @private - * @param {Boolean} force */ - _formClusters : function(force) { - if (force == false) { - this._formClustersByZoom(); - } - else { - this._forceClustersByZoom(); - } - }, + Node.prototype._reset = function() { + this.width = undefined; + this.height = undefined; + }; + /** + * get the title of this node. + * @return {string} title The title of the node, or undefined when no title + * has been set. + */ + Node.prototype.getTitle = function() { + return typeof this.title === "function" ? this.title() : this.title; + }; /** - * This function handles the clustering by zooming out, this is based on a minimum edge distance - * - * @private + * Calculate the distance to the border of the Node + * @param {CanvasRenderingContext2D} ctx + * @param {Number} angle Angle in radians + * @returns {number} distance Distance to the border in pixels */ - _formClustersByZoom : function() { - var dx,dy,length, - minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; + Node.prototype.distanceToBorder = function (ctx, angle) { + var borderWidth = 1; - // check if any edges are shorter than minLength and start the clustering - // the clustering favours the node with the larger mass - for (var edgeId in this.edges) { - if (this.edges.hasOwnProperty(edgeId)) { - var edge = this.edges[edgeId]; - if (edge.connected) { - if (edge.toId != edge.fromId) { - dx = (edge.to.x - edge.from.x); - dy = (edge.to.y - edge.from.y); - length = Math.sqrt(dx * dx + dy * dy); + if (!this.width) { + this.resize(ctx); + } + switch (this.shape) { + case 'circle': + case 'dot': + return this.radius + borderWidth; - if (length < minLength) { - // first check which node is larger - var parentNode = edge.from; - var childNode = edge.to; - if (edge.to.mass > edge.from.mass) { - parentNode = edge.to; - childNode = edge.from; - } + case 'ellipse': + var a = this.width / 2; + var b = this.height / 2; + var w = (Math.sin(angle) * a); + var h = (Math.cos(angle) * b); + return a * b / Math.sqrt(w * w + h * h); - if (childNode.dynamicEdgesLength == 1) { - this._addToCluster(parentNode,childNode,false); - } - else if (parentNode.dynamicEdgesLength == 1) { - this._addToCluster(childNode,parentNode,false); - } - } - } + // TODO: implement distanceToBorder for database + // TODO: implement distanceToBorder for triangle + // TODO: implement distanceToBorder for triangleDown + + case 'box': + case 'image': + case 'text': + default: + if (this.width) { + return Math.min( + Math.abs(this.width / 2 / Math.cos(angle)), + Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; + // TODO: reckon with border radius too in case of box } - } + else { + return 0; + } + } - }, + // TODO: implement calculation of distance to border for all shapes + }; /** - * This function forces the network to cluster all nodes with only one connecting edge to their - * connected node. - * + * Set forces acting on the node + * @param {number} fx Force in horizontal direction + * @param {number} fy Force in vertical direction + */ + Node.prototype._setForce = function(fx, fy) { + this.fx = fx; + this.fy = fy; + }; + + /** + * Add forces acting on the node + * @param {number} fx Force in horizontal direction + * @param {number} fy Force in vertical direction * @private */ - _forceClustersByZoom : function() { - for (var nodeId in this.nodes) { - // another node could have absorbed this child. - if (this.nodes.hasOwnProperty(nodeId)) { - var childNode = this.nodes[nodeId]; + Node.prototype._addForce = function(fx, fy) { + this.fx += fx; + this.fy += fy; + }; - // the edges can be swallowed by another decrease - if (childNode.dynamicEdgesLength == 1 && childNode.dynamicEdges.length != 0) { - var edge = childNode.dynamicEdges[0]; - var parentNode = (edge.toId == childNode.id) ? this.nodes[edge.fromId] : this.nodes[edge.toId]; + /** + * Perform one discrete step for the node + * @param {number} interval Time interval in seconds + */ + Node.prototype.discreteStep = function(interval) { + if (!this.xFixed) { + var dx = this.damping * this.vx; // damping force + var ax = (this.fx - dx) / this.mass; // acceleration + this.vx += ax * interval; // velocity + this.x += this.vx * interval; // position + } - // group to the largest node - if (childNode.id != parentNode.id) { - if (parentNode.mass > childNode.mass) { - this._addToCluster(parentNode,childNode,true); - } - else { - this._addToCluster(childNode,parentNode,true); - } - } - } - } + if (!this.yFixed) { + var dy = this.damping * this.vy; // damping force + var ay = (this.fy - dy) / this.mass; // acceleration + this.vy += ay * interval; // velocity + this.y += this.vy * interval; // position } - }, + }; + /** - * To keep the nodes of roughly equal size we normalize the cluster levels. - * This function clusters a node to its smallest connected neighbour. - * - * @param node - * @private + * Perform one discrete step for the node + * @param {number} interval Time interval in seconds + * @param {number} maxVelocity The speed limit imposed on the velocity */ - _clusterToSmallestNeighbour : function(node) { - var smallestNeighbour = -1; - var smallestNeighbourNode = null; - for (var i = 0; i < node.dynamicEdges.length; i++) { - if (node.dynamicEdges[i] !== undefined) { - var neighbour = null; - if (node.dynamicEdges[i].fromId != node.id) { - neighbour = node.dynamicEdges[i].from; - } - else if (node.dynamicEdges[i].toId != node.id) { - neighbour = node.dynamicEdges[i].to; - } - - - if (neighbour != null && smallestNeighbour > neighbour.clusterSessions.length) { - smallestNeighbour = neighbour.clusterSessions.length; - smallestNeighbourNode = neighbour; - } - } + Node.prototype.discreteStepLimited = function(interval, maxVelocity) { + if (!this.xFixed) { + var dx = this.damping * this.vx; // damping force + var ax = (this.fx - dx) / this.mass; // acceleration + this.vx += ax * interval; // velocity + this.vx = (Math.abs(this.vx) > maxVelocity) ? ((this.vx > 0) ? maxVelocity : -maxVelocity) : this.vx; + this.x += this.vx * interval; // position } - - if (neighbour != null && this.nodes[neighbour.id] !== undefined) { - this._addToCluster(neighbour, node, true); + else { + this.fx = 0; } - }, + if (!this.yFixed) { + var dy = this.damping * this.vy; // damping force + var ay = (this.fy - dy) / this.mass; // acceleration + this.vy += ay * interval; // velocity + this.vy = (Math.abs(this.vy) > maxVelocity) ? ((this.vy > 0) ? maxVelocity : -maxVelocity) : this.vy; + this.y += this.vy * interval; // position + } + else { + this.fy = 0; + } + }; /** - * This function forms clusters from hubs, it loops over all nodes - * - * @param {Boolean} force | Disregard zoom level - * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges - * @private + * Check if this node has a fixed x and y position + * @return {boolean} true if fixed, false if not */ - _formClustersByHub : function(force, onlyEqual) { - // we loop over all nodes in the list - for (var nodeId in this.nodes) { - // we check if it is still available since it can be used by the clustering in this loop - if (this.nodes.hasOwnProperty(nodeId)) { - this._formClusterFromHub(this.nodes[nodeId],force,onlyEqual); - } - } - }, + Node.prototype.isFixed = function() { + return (this.xFixed && this.yFixed); + }; /** - * This function forms a cluster from a specific preselected hub node - * - * @param {Node} hubNode | the node we will cluster as a hub - * @param {Boolean} force | Disregard zoom level - * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges - * @param {Number} [absorptionSizeOffset] | - * @private + * Check if this node is moving + * @param {number} vmin the minimum velocity considered as "moving" + * @return {boolean} true if moving, false if it has no velocity */ - _formClusterFromHub : function(hubNode, force, onlyEqual, absorptionSizeOffset) { - if (absorptionSizeOffset === undefined) { - absorptionSizeOffset = 0; - } - // we decide if the node is a hub - if ((hubNode.dynamicEdgesLength >= this.hubThreshold && onlyEqual == false) || - (hubNode.dynamicEdgesLength == this.hubThreshold && onlyEqual == true)) { - // initialize variables - var dx,dy,length; - var minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; - var allowCluster = false; + // TODO: replace this method with calculating the kinetic energy + Node.prototype.isMoving = function(vmin) { + return (Math.abs(this.vx) > vmin || Math.abs(this.vy) > vmin); + }; - // we create a list of edges because the dynamicEdges change over the course of this loop - var edgesIdarray = []; - var amountOfInitialEdges = hubNode.dynamicEdges.length; - for (var j = 0; j < amountOfInitialEdges; j++) { - edgesIdarray.push(hubNode.dynamicEdges[j].id); - } + /** + * check if this node is selecte + * @return {boolean} selected True if node is selected, else false + */ + Node.prototype.isSelected = function() { + return this.selected; + }; - // if the hub clustering is not forces, we check if one of the edges connected - // to a cluster is small enough based on the constants.clustering.clusterEdgeThreshold - if (force == false) { - allowCluster = false; - for (j = 0; j < amountOfInitialEdges; j++) { - var edge = this.edges[edgesIdarray[j]]; - if (edge !== undefined) { - if (edge.connected) { - if (edge.toId != edge.fromId) { - dx = (edge.to.x - edge.from.x); - dy = (edge.to.y - edge.from.y); - length = Math.sqrt(dx * dx + dy * dy); + /** + * Retrieve the value of the node. Can be undefined + * @return {Number} value + */ + Node.prototype.getValue = function() { + return this.value; + }; - if (length < minLength) { - allowCluster = true; - break; - } - } - } - } - } - } + /** + * Calculate the distance from the nodes location to the given location (x,y) + * @param {Number} x + * @param {Number} y + * @return {Number} value + */ + Node.prototype.getDistance = function(x, y) { + var dx = this.x - x, + dy = this.y - y; + return Math.sqrt(dx * dx + dy * dy); + }; - // start the clustering if allowed - if ((!force && allowCluster) || force) { - // we loop over all edges INITIALLY connected to this hub - for (j = 0; j < amountOfInitialEdges; j++) { - edge = this.edges[edgesIdarray[j]]; - // the edge can be clustered by this function in a previous loop - if (edge !== undefined) { - var childNode = this.nodes[(edge.fromId == hubNode.id) ? edge.toId : edge.fromId]; - // we do not want hubs to merge with other hubs nor do we want to cluster itself. - if ((childNode.dynamicEdges.length <= (this.hubThreshold + absorptionSizeOffset)) && - (childNode.id != hubNode.id)) { - this._addToCluster(hubNode,childNode,force); - } - } - } + + /** + * Adjust the value range of the node. The node will adjust it's radius + * based on its value. + * @param {Number} min + * @param {Number} max + */ + Node.prototype.setValueRange = function(min, max) { + if (!this.radiusFixed && this.value !== undefined) { + if (max == min) { + this.radius = (this.radiusMin + this.radiusMax) / 2; + } + else { + var scale = (this.radiusMax - this.radiusMin) / (max - min); + this.radius = (this.value - min) * scale + this.radiusMin; } } - }, + this.baseRadiusValue = this.radius; + }; + /** + * Draw this node in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ + Node.prototype.draw = function(ctx) { + throw "Draw method not initialized for node"; + }; + /** + * Recalculate the size of this node in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ + Node.prototype.resize = function(ctx) { + throw "Resize method not initialized for node"; + }; /** - * This function adds the child node to the parent node, creating a cluster if it is not already. - * - * @param {Node} parentNode | this is the node that will house the child node - * @param {Node} childNode | this node will be deleted from the global this.nodes and stored in the parent node - * @param {Boolean} force | true will only update the remainingEdges at the very end of the clustering, ensuring single level collapse - * @private + * Check if this object is overlapping with the provided object + * @param {Object} obj an object with parameters left, top, right, bottom + * @return {boolean} True if location is located on node */ - _addToCluster : function(parentNode, childNode, force) { - // join child node in the parent node - parentNode.containedNodes[childNode.id] = childNode; + Node.prototype.isOverlappingWith = function(obj) { + return (this.left < obj.right && + this.left + this.width > obj.left && + this.top < obj.bottom && + this.top + this.height > obj.top); + }; - // manage all the edges connected to the child and parent nodes - for (var i = 0; i < childNode.dynamicEdges.length; i++) { - var edge = childNode.dynamicEdges[i]; - if (edge.toId == parentNode.id || edge.fromId == parentNode.id) { // edge connected to parentNode - this._addToContainedEdges(parentNode,childNode,edge); + Node.prototype._resizeImage = function (ctx) { + // TODO: pre calculate the image size + + if (!this.width || !this.height) { // undefined or 0 + var width, height; + if (this.value) { + this.radius = this.baseRadiusValue; + var scale = this.imageObj.height / this.imageObj.width; + if (scale !== undefined) { + width = this.radius || this.imageObj.width; + height = this.radius * scale || this.imageObj.height; + } + else { + width = 0; + height = 0; + } } else { - this._connectEdgeToCluster(parentNode,childNode,edge); + width = this.imageObj.width; + height = this.imageObj.height; + } + this.width = width; + this.height = height; + + this.growthIndicator = 0; + if (this.width > 0 && this.height > 0) { + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - width; } } - // a contained node has no dynamic edges. - childNode.dynamicEdges = []; - // remove circular edges from clusters - this._containCircularEdgesFromNode(parentNode,childNode); + }; + Node.prototype._drawImage = function (ctx) { + this._resizeImage(ctx); - // remove the childNode from the global nodes object - delete this.nodes[childNode.id]; + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; - // update the properties of the child and parent - var massBefore = parentNode.mass; - childNode.clusterSession = this.clusterSession; - parentNode.mass += childNode.mass; - parentNode.clusterSize += childNode.clusterSize; - parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); + var yLabel; + if (this.imageObj.width != 0 ) { + // draw the shade + if (this.clusterSize > 1) { + var lineWidth = ((this.clusterSize > 1) ? 10 : 0.0); + lineWidth *= this.networkScaleInv; + lineWidth = Math.min(0.2 * this.width,lineWidth); - // keep track of the clustersessions so we can open the cluster up as it has been formed. - if (parentNode.clusterSessions[parentNode.clusterSessions.length - 1] != this.clusterSession) { - parentNode.clusterSessions.push(this.clusterSession); - } + ctx.globalAlpha = 0.5; + ctx.drawImage(this.imageObj, this.left - lineWidth, this.top - lineWidth, this.width + 2*lineWidth, this.height + 2*lineWidth); + } - // forced clusters only open from screen size and double tap - if (force == true) { - // parentNode.formationScale = Math.pow(1 - (1.0/11.0),this.clusterSession+3); - parentNode.formationScale = 0; + // draw the image + ctx.globalAlpha = 1.0; + ctx.drawImage(this.imageObj, this.left, this.top, this.width, this.height); + yLabel = this.y + this.height / 2; } else { - parentNode.formationScale = this.scale; // The latest child has been added on this scale + // image still loading... just draw the label for now + yLabel = this.y; } - // recalculate the size of the node on the next time the node is rendered - parentNode.clearSizeCache(); + this._label(ctx, this.label, this.x, yLabel, undefined, "top"); + }; - // set the pop-out scale for the childnode - parentNode.containedNodes[childNode.id].formationScale = parentNode.formationScale; - // nullify the movement velocity of the child, this is to avoid hectic behaviour - childNode.clearVelocity(); + Node.prototype._resizeBox = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + this.width = textSize.width + 2 * margin; + this.height = textSize.height + 2 * margin; - // the mass has altered, preservation of energy dictates the velocity to be updated - parentNode.updateVelocity(massBefore); + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor; + this.growthIndicator = this.width - (textSize.width + 2 * margin); + // this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; - // restart the simulation to reorganise all nodes - this.moving = true; - }, + } + }; + Node.prototype._drawBox = function (ctx) { + this._resizeBox(ctx); - /** - * This function will apply the changes made to the remainingEdges during the formation of the clusters. - * This is a seperate function to allow for level-wise collapsing of the node barnesHutTree. - * It has to be called if a level is collapsed. It is called by _formClusters(). - * @private - */ - _updateDynamicEdges : function() { - for (var i = 0; i < this.nodeIndices.length; i++) { - var node = this.nodes[this.nodeIndices[i]]; - node.dynamicEdgesLength = node.dynamicEdges.length; + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; - // this corrects for multiple edges pointing at the same other node - var correction = 0; - if (node.dynamicEdgesLength > 1) { - for (var j = 0; j < node.dynamicEdgesLength - 1; j++) { - var edgeToId = node.dynamicEdges[j].toId; - var edgeFromId = node.dynamicEdges[j].fromId; - for (var k = j+1; k < node.dynamicEdgesLength; k++) { - if ((node.dynamicEdges[k].toId == edgeToId && node.dynamicEdges[k].fromId == edgeFromId) || - (node.dynamicEdges[k].fromId == edgeToId && node.dynamicEdges[k].toId == edgeFromId)) { - correction += 1; - } - } - } - } - node.dynamicEdgesLength -= correction; - } - }, + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; - /** - * This adds an edge from the childNode to the contained edges of the parent node - * - * @param parentNode | Node object - * @param childNode | Node object - * @param edge | Edge object - * @private - */ - _addToContainedEdges : function(parentNode, childNode, edge) { - // create an array object if it does not yet exist for this childNode - if (!(parentNode.containedEdges.hasOwnProperty(childNode.id))) { - parentNode.containedEdges[childNode.id] = [] + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.roundRect(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth, this.radius); + ctx.stroke(); } - // add this edge to the list - parentNode.containedEdges[childNode.id].push(edge); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); - // remove the edge from the global edges object - delete this.edges[edge.id]; + ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background; - // remove the edge from the parent object - for (var i = 0; i < parentNode.dynamicEdges.length; i++) { - if (parentNode.dynamicEdges[i].id == edge.id) { - parentNode.dynamicEdges.splice(i,1); - break; - } - } - }, + ctx.roundRect(this.left, this.top, this.width, this.height, this.radius); + ctx.fill(); + ctx.stroke(); - /** - * This function connects an edge that was connected to a child node to the parent node. - * It keeps track of which nodes it has been connected to with the originalId array. - * - * @param {Node} parentNode | Node object - * @param {Node} childNode | Node object - * @param {Edge} edge | Edge object - * @private - */ - _connectEdgeToCluster : function(parentNode, childNode, edge) { - // handle circular edges - if (edge.toId == edge.fromId) { - this._addToContainedEdges(parentNode, childNode, edge); - } - else { - if (edge.toId == childNode.id) { // edge connected to other node on the "to" side - edge.originalToId.push(childNode.id); - edge.to = parentNode; - edge.toId = parentNode.id; - } - else { // edge connected to other node with the "from" side + this._label(ctx, this.label, this.x, this.y); + }; - edge.originalFromId.push(childNode.id); - edge.from = parentNode; - edge.fromId = parentNode.id; - } - this._addToReroutedEdges(parentNode,childNode,edge); + Node.prototype._resizeDatabase = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + var size = textSize.width + 2 * margin; + this.width = size; + this.height = size; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - size; } - }, + }; + Node.prototype._drawDatabase = function (ctx) { + this._resizeDatabase(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; - /** - * If a node is connected to itself, a circular edge is drawn. When clustering we want to contain - * these edges inside of the cluster. - * - * @param parentNode - * @param childNode - * @private - */ - _containCircularEdgesFromNode : function(parentNode, childNode) { - // manage all the edges connected to the child and parent nodes - for (var i = 0; i < parentNode.dynamicEdges.length; i++) { - var edge = parentNode.dynamicEdges[i]; - // handle circular edges - if (edge.toId == edge.fromId) { - this._addToContainedEdges(parentNode, childNode, edge); - } - } - }, + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; - /** - * This adds an edge from the childNode to the rerouted edges of the parent node - * - * @param parentNode | Node object - * @param childNode | Node object - * @param edge | Edge object - * @private - */ - _addToReroutedEdges : function(parentNode, childNode, edge) { - // create an array object if it does not yet exist for this childNode - // we store the edge in the rerouted edges so we can restore it when the cluster pops open - if (!(parentNode.reroutedEdges.hasOwnProperty(childNode.id))) { - parentNode.reroutedEdges[childNode.id] = []; + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.database(this.x - this.width/2 - 2*ctx.lineWidth, this.y - this.height*0.5 - 2*ctx.lineWidth, this.width + 4*ctx.lineWidth, this.height + 4*ctx.lineWidth); + ctx.stroke(); } - parentNode.reroutedEdges[childNode.id].push(edge); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); - // this edge becomes part of the dynamicEdges of the cluster node - parentNode.dynamicEdges.push(edge); - }, + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + ctx.database(this.x - this.width/2, this.y - this.height*0.5, this.width, this.height); + ctx.fill(); + ctx.stroke(); + this._label(ctx, this.label, this.x, this.y); + }; - /** - * This function connects an edge that was connected to a cluster node back to the child node. - * - * @param parentNode | Node object - * @param childNode | Node object - * @private - */ - _connectEdgeBackToChild : function(parentNode, childNode) { - if (parentNode.reroutedEdges.hasOwnProperty(childNode.id)) { - for (var i = 0; i < parentNode.reroutedEdges[childNode.id].length; i++) { - var edge = parentNode.reroutedEdges[childNode.id][i]; - if (edge.originalFromId[edge.originalFromId.length-1] == childNode.id) { - edge.originalFromId.pop(); - edge.fromId = childNode.id; - edge.from = childNode; - } - else { - edge.originalToId.pop(); - edge.toId = childNode.id; - edge.to = childNode; - } + Node.prototype._resizeCircle = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + var diameter = Math.max(textSize.width, textSize.height) + 2 * margin; + this.radius = diameter / 2; - // append this edge to the list of edges connecting to the childnode - childNode.dynamicEdges.push(edge); + this.width = diameter; + this.height = diameter; - // remove the edge from the parent object - for (var j = 0; j < parentNode.dynamicEdges.length; j++) { - if (parentNode.dynamicEdges[j].id == edge.id) { - parentNode.dynamicEdges.splice(j,1); - break; - } - } - } - // remove the entry from the rerouted edges - delete parentNode.reroutedEdges[childNode.id]; + // scaling used for clustering + // this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor; + // this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; + this.growthIndicator = this.radius - 0.5*diameter; + } + }; + + Node.prototype._drawCircle = function (ctx) { + this._resizeCircle(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; + + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.circle(this.x, this.y, this.radius+2*ctx.lineWidth); + ctx.stroke(); } - }, + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + ctx.circle(this.x, this.y, this.radius); + ctx.fill(); + ctx.stroke(); + + this._label(ctx, this.label, this.x, this.y); + }; + Node.prototype._resizeEllipse = function (ctx) { + if (!this.width) { + var textSize = this.getTextSize(ctx); - /** - * When loops are clustered, an edge can be both in the rerouted array and the contained array. - * This function is called last to verify that all edges in dynamicEdges are in fact connected to the - * parentNode - * - * @param parentNode | Node object - * @private - */ - _validateEdges : function(parentNode) { - for (var i = 0; i < parentNode.dynamicEdges.length; i++) { - var edge = parentNode.dynamicEdges[i]; - if (parentNode.id != edge.toId && parentNode.id != edge.fromId) { - parentNode.dynamicEdges.splice(i,1); + this.width = textSize.width * 1.5; + this.height = textSize.height * 2; + if (this.width < this.height) { + this.width = this.height; } + var defaultSize = this.width; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - defaultSize; } - }, + }; + Node.prototype._drawEllipse = function (ctx) { + this._resizeEllipse(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; - /** - * This function released the contained edges back into the global domain and puts them back into the - * dynamic edges of both parent and child. - * - * @param {Node} parentNode | - * @param {Node} childNode | - * @private - */ - _releaseContainedEdges : function(parentNode, childNode) { - for (var i = 0; i < parentNode.containedEdges[childNode.id].length; i++) { - var edge = parentNode.containedEdges[childNode.id][i]; + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; - // put the edge back in the global edges object - this.edges[edge.id] = edge; + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; - // put the edge back in the dynamic edges of the child and parent - childNode.dynamicEdges.push(edge); - parentNode.dynamicEdges.push(edge); + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + + ctx.ellipse(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth); + ctx.stroke(); } - // remove the entry from the contained edges - delete parentNode.containedEdges[childNode.id]; + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); - }, + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + ctx.ellipse(this.left, this.top, this.width, this.height); + ctx.fill(); + ctx.stroke(); + this._label(ctx, this.label, this.x, this.y); + }; + Node.prototype._drawDot = function (ctx) { + this._drawShape(ctx, 'circle'); + }; + Node.prototype._drawTriangle = function (ctx) { + this._drawShape(ctx, 'triangle'); + }; - // ------------------- UTILITY FUNCTIONS ---------------------------- // + Node.prototype._drawTriangleDown = function (ctx) { + this._drawShape(ctx, 'triangleDown'); + }; + Node.prototype._drawSquare = function (ctx) { + this._drawShape(ctx, 'square'); + }; - /** - * This updates the node labels for all nodes (for debugging purposes) - */ - updateLabels : function() { - var nodeId; - // update node labels - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - var node = this.nodes[nodeId]; - if (node.clusterSize > 1) { - node.label = "[".concat(String(node.clusterSize),"]"); - } - } + Node.prototype._drawStar = function (ctx) { + this._drawShape(ctx, 'star'); + }; + + Node.prototype._resizeShape = function (ctx) { + if (!this.width) { + this.radius = this.baseRadiusValue; + var size = 2 * this.radius; + this.width = size; + this.height = size; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - size; } + }; - // update node labels - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.clusterSize == 1) { - if (node.originalLabel !== undefined) { - node.label = node.originalLabel; - } - else { - node.label = String(node.id); - } - } - } + Node.prototype._drawShape = function (ctx, shape) { + this._resizeShape(ctx); + + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + var clusterLineWidth = 2.5; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; + var radiusMultiplier = 2; + + // choose draw method depending on the shape + switch (shape) { + case 'dot': radiusMultiplier = 2; break; + case 'square': radiusMultiplier = 2; break; + case 'triangle': radiusMultiplier = 3; break; + case 'triangleDown': radiusMultiplier = 3; break; + case 'star': radiusMultiplier = 4; break; } -// /* Debug Override */ -// for (nodeId in this.nodes) { -// if (this.nodes.hasOwnProperty(nodeId)) { -// node = this.nodes[nodeId]; -// node.label = String(node.level); -// } -// } + ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; - }, + // draw the outer border + if (this.clusterSize > 1) { + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); + ctx[shape](this.x, this.y, this.radius + radiusMultiplier * ctx.lineWidth); + ctx.stroke(); + } + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth *= this.networkScaleInv; + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); - /** - * We want to keep the cluster level distribution rather small. This means we do not want unclustered nodes - * if the rest of the nodes are already a few cluster levels in. - * To fix this we use this function. It determines the min and max cluster level and sends nodes that have not - * clustered enough to the clusterToSmallestNeighbours function. - */ - normalizeClusterLevels : function() { - var maxLevel = 0; - var minLevel = 1e9; - var clusterLevel = 0; - var nodeId; + ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; + ctx[shape](this.x, this.y, this.radius); + ctx.fill(); + ctx.stroke(); - // we loop over all nodes in the list - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - clusterLevel = this.nodes[nodeId].clusterSessions.length; - if (maxLevel < clusterLevel) {maxLevel = clusterLevel;} - if (minLevel > clusterLevel) {minLevel = clusterLevel;} - } + if (this.label) { + this._label(ctx, this.label, this.x, this.y + this.height / 2, undefined, 'top',true); } + }; - if (maxLevel - minLevel > this.constants.clustering.clusterLevelDifference) { - var amountOfNodes = this.nodeIndices.length; - var targetLevel = maxLevel - this.constants.clustering.clusterLevelDifference; - // we loop over all nodes in the list - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - if (this.nodes[nodeId].clusterSessions.length < targetLevel) { - this._clusterToSmallestNeighbour(this.nodes[nodeId]); - } - } + Node.prototype._resizeText = function (ctx) { + if (!this.width) { + var margin = 5; + var textSize = this.getTextSize(ctx); + this.width = textSize.width + 2 * margin; + this.height = textSize.height + 2 * margin; + + // scaling used for clustering + this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; + this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; + this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; + this.growthIndicator = this.width - (textSize.width + 2 * margin); + } + }; + + Node.prototype._drawText = function (ctx) { + this._resizeText(ctx); + this.left = this.x - this.width / 2; + this.top = this.y - this.height / 2; + + this._label(ctx, this.label, this.x, this.y); + }; + + + Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNode) { + if (text && this.fontSize * this.networkScale > this.fontDrawThreshold) { + ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace; + ctx.fillStyle = this.fontColor || "black"; + ctx.textAlign = align || "center"; + ctx.textBaseline = baseline || "middle"; + + var lines = text.split('\n'); + var lineCount = lines.length; + var fontSize = (this.fontSize + 4); + var yLine = y + (1 - lineCount) / 2 * fontSize; + if (labelUnderNode == true) { + yLine = y + (1 - lineCount) / (2 * fontSize); } - this._updateNodeIndexList(); - this._updateDynamicEdges(); - // if a cluster was formed, we increase the clusterSession - if (this.nodeIndices.length != amountOfNodes) { - this.clusterSession += 1; + + for (var i = 0; i < lineCount; i++) { + ctx.fillText(lines[i], x, yLine); + yLine += fontSize; } } - }, + }; + + Node.prototype.getTextSize = function(ctx) { + if (this.label !== undefined) { + ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace; + var lines = this.label.split('\n'), + height = (this.fontSize + 4) * lines.length, + width = 0; + + for (var i = 0, iMax = lines.length; i < iMax; i++) { + width = Math.max(width, ctx.measureText(lines[i]).width); + } + + return {"width": width, "height": height}; + } + else { + return {"width": 0, "height": 0}; + } + }; /** - * This function determines if the cluster we want to decluster is in the active area - * this means around the zoom center + * this is used to determine if a node is visible at all. this is used to determine when it needs to be drawn. + * there is a safety margin of 0.3 * width; * - * @param {Node} node * @returns {boolean} - * @private */ - _nodeInActiveArea : function(node) { - return ( - Math.abs(node.x - this.areaCenter.x) <= this.constants.clustering.activeAreaBoxSize/this.scale - && - Math.abs(node.y - this.areaCenter.y) <= this.constants.clustering.activeAreaBoxSize/this.scale - ) - }, + Node.prototype.inArea = function() { + if (this.width !== undefined) { + return (this.x + this.width *this.networkScaleInv >= this.canvasTopLeft.x && + this.x - this.width *this.networkScaleInv < this.canvasBottomRight.x && + this.y + this.height*this.networkScaleInv >= this.canvasTopLeft.y && + this.y - this.height*this.networkScaleInv < this.canvasBottomRight.y); + } + else { + return true; + } + }; + /** + * checks if the core of the node is in the display area, this is used for opening clusters around zoom + * @returns {boolean} + */ + Node.prototype.inView = function() { + return (this.x >= this.canvasTopLeft.x && + this.x < this.canvasBottomRight.x && + this.y >= this.canvasTopLeft.y && + this.y < this.canvasBottomRight.y); + }; /** - * This is an adaptation of the original repositioning function. This is called if the system is clustered initially - * It puts large clusters away from the center and randomizes the order. + * This allows the zoom level of the network to influence the rendering + * We store the inverted scale and the coordinates of the top left, and bottom right points of the canvas * + * @param scale + * @param canvasTopLeft + * @param canvasBottomRight */ - repositionNodes : function() { - for (var i = 0; i < this.nodeIndices.length; i++) { - var node = this.nodes[this.nodeIndices[i]]; - if ((node.xFixed == false || node.yFixed == false)) { - var radius = 10 * 0.1*this.nodeIndices.length * Math.min(100,node.mass); - var angle = 2 * Math.PI * Math.random(); - if (node.xFixed == false) {node.x = radius * Math.cos(angle);} - if (node.yFixed == false) {node.y = radius * Math.sin(angle);} - this._repositionBezierNodes(node); - } - } - }, + Node.prototype.setScaleAndPos = function(scale,canvasTopLeft,canvasBottomRight) { + this.networkScaleInv = 1.0/scale; + this.networkScale = scale; + this.canvasTopLeft = canvasTopLeft; + this.canvasBottomRight = canvasBottomRight; + }; /** - * We determine how many connections denote an important hub. - * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) + * This allows the zoom level of the network to influence the rendering * - * @private + * @param scale */ - _getHubSize : function() { - var average = 0; - var averageSquared = 0; - var hubCounter = 0; - var largestHub = 0; + Node.prototype.setScale = function(scale) { + this.networkScaleInv = 1.0/scale; + this.networkScale = scale; + }; - for (var i = 0; i < this.nodeIndices.length; i++) { - var node = this.nodes[this.nodeIndices[i]]; - if (node.dynamicEdgesLength > largestHub) { - largestHub = node.dynamicEdgesLength; - } - average += node.dynamicEdgesLength; - averageSquared += Math.pow(node.dynamicEdgesLength,2); - hubCounter += 1; - } - average = average / hubCounter; - averageSquared = averageSquared / hubCounter; - var variance = averageSquared - Math.pow(average,2); + /** + * set the velocity at 0. Is called when this node is contained in another during clustering + */ + Node.prototype.clearVelocity = function() { + this.vx = 0; + this.vy = 0; + }; - var standardDeviation = Math.sqrt(variance); - this.hubThreshold = Math.floor(average + 2*standardDeviation); + /** + * Basic preservation of (kinectic) energy + * + * @param massBeforeClustering + */ + Node.prototype.updateVelocity = function(massBeforeClustering) { + var energyBefore = this.vx * this.vx * massBeforeClustering; + //this.vx = (this.vx < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass); + this.vx = Math.sqrt(energyBefore/this.mass); + energyBefore = this.vy * this.vy * massBeforeClustering; + //this.vy = (this.vy < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass); + this.vy = Math.sqrt(energyBefore/this.mass); + }; - // always have at least one to cluster - if (this.hubThreshold > largestHub) { - this.hubThreshold = largestHub; - } + module.exports = Node; - // console.log("average",average,"averageSQ",averageSquared,"var",variance,"std",standardDeviation); - // console.log("hubThreshold:",this.hubThreshold); - }, +/***/ }, +/* 37 */ +/***/ function(module, exports, __webpack_require__) { /** - * We reduce the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods - * with this amount we can cluster specifically on these chains. - * - * @param {Number} fraction | between 0 and 1, the percentage of chains to reduce - * @private + * Popup is a class to create a popup window with some text + * @param {Element} container The container object. + * @param {Number} [x] + * @param {Number} [y] + * @param {String} [text] + * @param {Object} [style] An object containing borderColor, + * backgroundColor, etc. */ - _reduceAmountOfChains : function(fraction) { - this.hubThreshold = 2; - var reduceAmount = Math.floor(this.nodeIndices.length * fraction); - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { - if (reduceAmount > 0) { - this._formClusterFromHub(this.nodes[nodeId],true,true,1); - reduceAmount -= 1; + function Popup(container, x, y, text, style) { + if (container) { + this.container = container; + } + else { + this.container = document.body; + } + + // x, y and text are optional, see if a style object was passed in their place + if (style === undefined) { + if (typeof x === "object") { + style = x; + x = undefined; + } else if (typeof text === "object") { + style = text; + text = undefined; + } else { + // for backwards compatibility, in case clients other than Network are creating Popup directly + style = { + fontColor: 'black', + fontSize: 14, // px + fontFace: 'verdana', + color: { + border: '#666', + background: '#FFFFC6' } } } } - }, - /** - * We get the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods - * with this amount we can cluster specifically on these chains. - * - * @private - */ - _getChainFraction : function() { - var chains = 0; - var total = 0; - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { - chains += 1; - } - total += 1; - } + this.x = 0; + this.y = 0; + this.padding = 5; + + if (x !== undefined && y !== undefined ) { + this.setPosition(x, y); } - return chains/total; + if (text !== undefined) { + this.setText(text); + } + + // create the frame + this.frame = document.createElement("div"); + var styleAttr = this.frame.style; + styleAttr.position = "absolute"; + styleAttr.visibility = "hidden"; + styleAttr.border = "1px solid " + style.color.border; + styleAttr.color = style.fontColor; + styleAttr.fontSize = style.fontSize + "px"; + styleAttr.fontFamily = style.fontFace; + styleAttr.padding = this.padding + "px"; + styleAttr.backgroundColor = style.color.background; + styleAttr.borderRadius = "3px"; + styleAttr.MozBorderRadius = "3px"; + styleAttr.WebkitBorderRadius = "3px"; + styleAttr.boxShadow = "3px 3px 10px rgba(128, 128, 128, 0.5)"; + styleAttr.whiteSpace = "nowrap"; + this.container.appendChild(this.frame); } -}; + /** + * @param {number} x Horizontal position of the popup window + * @param {number} y Vertical position of the popup window + */ + Popup.prototype.setPosition = function(x, y) { + this.x = parseInt(x); + this.y = parseInt(y); + }; + + /** + * Set the text for the popup window. This can be HTML code + * @param {string} text + */ + Popup.prototype.setText = function(text) { + this.frame.innerHTML = text; + }; + + /** + * Show the popup window + * @param {boolean} show Optional. Show or hide the window + */ + Popup.prototype.show = function (show) { + if (show === undefined) { + show = true; + } + if (show) { + var height = this.frame.clientHeight; + var width = this.frame.clientWidth; + var maxHeight = this.frame.parentNode.clientHeight; + var maxWidth = this.frame.parentNode.clientWidth; -var SelectionMixin = { + var top = (this.y - height); + if (top + height + this.padding > maxHeight) { + top = maxHeight - height - this.padding; + } + if (top < this.padding) { + top = this.padding; + } - /** - * This function can be called from the _doInAllSectors function - * - * @param object - * @param overlappingNodes - * @private - */ - _getNodesOverlappingWith : function(object, overlappingNodes) { - var nodes = this.nodes; - for (var nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - if (nodes[nodeId].isOverlappingWith(object)) { - overlappingNodes.push(nodeId); - } + var left = this.x; + if (left + width + this.padding > maxWidth) { + left = maxWidth - width - this.padding; } + if (left < this.padding) { + left = this.padding; + } + + this.frame.style.left = left + "px"; + this.frame.style.top = top + "px"; + this.frame.style.visibility = "visible"; } - }, + else { + this.hide(); + } + }; /** - * retrieve all nodes overlapping with given object - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private + * Hide the popup window */ - _getAllNodesOverlappingWith : function (object) { - var overlappingNodes = []; - this._doInAllActiveSectors("_getNodesOverlappingWith",object,overlappingNodes); - return overlappingNodes; - }, + Popup.prototype.hide = function () { + this.frame.style.visibility = "hidden"; + }; + module.exports = Popup; + + +/***/ }, +/* 38 */ +/***/ function(module, exports, __webpack_require__) { /** - * Return a position object in canvasspace from a single point in screenspace + * Parse a text source containing data in DOT language into a JSON object. + * The object contains two lists: one with nodes and one with edges. * - * @param pointer - * @returns {{left: number, top: number, right: number, bottom: number}} - * @private + * DOT language reference: http://www.graphviz.org/doc/info/lang.html + * + * @param {String} data Text containing a graph in DOT-notation + * @return {Object} graph An object containing two parameters: + * {Object[]} nodes + * {Object[]} edges */ - _pointerToPositionObject : function(pointer) { - var x = this._XconvertDOMtoCanvas(pointer.x); - var y = this._YconvertDOMtoCanvas(pointer.y); + function parseDOT (data) { + dot = data; + return parseGraph(); + } + + // token types enumeration + var TOKENTYPE = { + NULL : 0, + DELIMITER : 1, + IDENTIFIER: 2, + UNKNOWN : 3 + }; + + // map with all delimiters + var DELIMITERS = { + '{': true, + '}': true, + '[': true, + ']': true, + ';': true, + '=': true, + ',': true, - return {left: x, - top: y, - right: x, - bottom: y}; - }, + '->': true, + '--': true + }; + var dot = ''; // current dot file + var index = 0; // current index in dot file + var c = ''; // current token character in expr + var token = ''; // current token + var tokenType = TOKENTYPE.NULL; // type of the token /** - * Get the top node at the a specific point (like a click) - * - * @param {{x: Number, y: Number}} pointer - * @return {Node | null} node - * @private + * Get the first character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. */ - _getNodeAt : function (pointer) { - // we first check if this is an navigation controls element - var positionObject = this._pointerToPositionObject(pointer); - var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); + function first() { + index = 0; + c = dot.charAt(0); + } - // if there are overlapping nodes, select the last one, this is the - // one which is drawn on top of the others - if (overlappingNodes.length > 0) { - return this.nodes[overlappingNodes[overlappingNodes.length - 1]]; - } - else { - return null; - } - }, + /** + * Get the next character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. + */ + function next() { + index++; + c = dot.charAt(index); + } + /** + * Preview the next character from the dot file. + * @return {String} cNext + */ + function nextPreview() { + return dot.charAt(index + 1); + } /** - * retrieve all edges overlapping with given object, selector is around center - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private + * Test whether given character is alphabetic or numeric + * @param {String} c + * @return {Boolean} isAlphaNumeric */ - _getEdgesOverlappingWith : function (object, overlappingEdges) { - var edges = this.edges; - for (var edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - if (edges[edgeId].isOverlappingWith(object)) { - overlappingEdges.push(edgeId); + var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; + function isAlphaNumeric(c) { + return regexAlphaNumeric.test(c); + } + + /** + * Merge all properties of object b into object b + * @param {Object} a + * @param {Object} b + * @return {Object} a + */ + function merge (a, b) { + if (!a) { + a = {}; + } + + if (b) { + for (var name in b) { + if (b.hasOwnProperty(name)) { + a[name] = b[name]; } } } - }, - + return a; + } /** - * retrieve all nodes overlapping with given object - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private + * Set a value in an object, where the provided parameter name can be a + * path with nested parameters. For example: + * + * var obj = {a: 2}; + * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} + * + * @param {Object} obj + * @param {String} path A parameter name or dot-separated parameter path, + * like "color.highlight.border". + * @param {*} value */ - _getAllEdgesOverlappingWith : function (object) { - var overlappingEdges = []; - this._doInAllActiveSectors("_getEdgesOverlappingWith",object,overlappingEdges); - return overlappingEdges; - }, + function setValue(obj, path, value) { + var keys = path.split('.'); + var o = obj; + while (keys.length) { + var key = keys.shift(); + if (keys.length) { + // this isn't the end point + if (!o[key]) { + o[key] = {}; + } + o = o[key]; + } + else { + // this is the end point + o[key] = value; + } + } + } /** - * Place holder. To implement change the _getNodeAt to a _getObjectAt. Have the _getObjectAt call - * _getNodeAt and _getEdgesAt, then priortize the selection to user preferences. - * - * @param pointer - * @returns {null} - * @private + * Add a node to a graph object. If there is already a node with + * the same id, their attributes will be merged. + * @param {Object} graph + * @param {Object} node */ - _getEdgeAt : function(pointer) { - var positionObject = this._pointerToPositionObject(pointer); - var overlappingEdges = this._getAllEdgesOverlappingWith(positionObject); + function addNode(graph, node) { + var i, len; + var current = null; - if (overlappingEdges.length > 0) { - return this.edges[overlappingEdges[overlappingEdges.length - 1]]; + // find root graph (in case of subgraph) + var graphs = [graph]; // list with all graphs from current graph to root graph + var root = graph; + while (root.parent) { + graphs.push(root.parent); + root = root.parent; } - else { - return null; + + // find existing node (at root level) by its id + if (root.nodes) { + for (i = 0, len = root.nodes.length; i < len; i++) { + if (node.id === root.nodes[i].id) { + current = root.nodes[i]; + break; + } + } + } + + if (!current) { + // this is a new node + current = { + id: node.id + }; + if (graph.node) { + // clone default attributes + current.attr = merge(current.attr, graph.node); + } } - }, + // add node to this (sub)graph and all its parent graphs + for (i = graphs.length - 1; i >= 0; i--) { + var g = graphs[i]; - /** - * Add object to the selection array. - * - * @param obj - * @private - */ - _addToSelection : function(obj) { - if (obj instanceof Node) { - this.selectionObj.nodes[obj.id] = obj; + if (!g.nodes) { + g.nodes = []; + } + if (g.nodes.indexOf(current) == -1) { + g.nodes.push(current); + } } - else { - this.selectionObj.edges[obj.id] = obj; + + // merge attributes + if (node.attr) { + current.attr = merge(current.attr, node.attr); } - }, + } /** - * Add object to the selection array. - * - * @param obj - * @private + * Add an edge to a graph object + * @param {Object} graph + * @param {Object} edge */ - _addToHover : function(obj) { - if (obj instanceof Node) { - this.hoverObj.nodes[obj.id] = obj; + function addEdge(graph, edge) { + if (!graph.edges) { + graph.edges = []; } - else { - this.hoverObj.edges[obj.id] = obj; + graph.edges.push(edge); + if (graph.edge) { + var attr = merge({}, graph.edge); // clone default attributes + edge.attr = merge(attr, edge.attr); // merge attributes } - }, - + } /** - * Remove a single option from selection. - * - * @param {Object} obj - * @private + * Create an edge to a graph object + * @param {Object} graph + * @param {String | Number | Object} from + * @param {String | Number | Object} to + * @param {String} type + * @param {Object | null} attr + * @return {Object} edge */ - _removeFromSelection : function(obj) { - if (obj instanceof Node) { - delete this.selectionObj.nodes[obj.id]; - } - else { - delete this.selectionObj.edges[obj.id]; + function createEdge(graph, from, to, type, attr) { + var edge = { + from: from, + to: to, + type: type + }; + + if (graph.edge) { + edge.attr = merge({}, graph.edge); // clone default attributes } - }, + edge.attr = merge(edge.attr || {}, attr); // merge attributes + + return edge; + } /** - * Unselect all. The selectionObj is useful for this. - * - * @param {Boolean} [doNotTrigger] | ignore trigger - * @private + * Get next token in the current dot file. + * The token and token type are available as token and tokenType */ - _unselectAll : function(doNotTrigger) { - if (doNotTrigger === undefined) { - doNotTrigger = false; + function getToken() { + tokenType = TOKENTYPE.NULL; + token = ''; + + // skip over whitespaces + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter + next(); } - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - this.selectionObj.nodes[nodeId].unselect(); + + do { + var isComment = false; + + // skip comment + if (c == '#') { + // find the previous non-space character + var i = index - 1; + while (dot.charAt(i) == ' ' || dot.charAt(i) == '\t') { + i--; + } + if (dot.charAt(i) == '\n' || dot.charAt(i) == '') { + // the # is at the start of a line, this is indeed a line comment + while (c != '' && c != '\n') { + next(); + } + isComment = true; + } } - } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - this.selectionObj.edges[edgeId].unselect(); + if (c == '/' && nextPreview() == '/') { + // skip line comment + while (c != '' && c != '\n') { + next(); + } + isComment = true; + } + if (c == '/' && nextPreview() == '*') { + // skip block comment + while (c != '') { + if (c == '*' && nextPreview() == '/') { + // end of block comment found. skip these last two characters + next(); + next(); + break; + } + else { + next(); + } + } + isComment = true; + } + + // skip over whitespaces + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter + next(); } } + while (isComment); - this.selectionObj = {nodes:{},edges:{}}; + // check for end of dot file + if (c == '') { + // token is still empty + tokenType = TOKENTYPE.DELIMITER; + return; + } - if (doNotTrigger == false) { - this.emit('select', this.getSelection()); + // check for delimiters consisting of 2 characters + var c2 = c + nextPreview(); + if (DELIMITERS[c2]) { + tokenType = TOKENTYPE.DELIMITER; + token = c2; + next(); + next(); + return; } - }, - /** - * Unselect all clusters. The selectionObj is useful for this. - * - * @param {Boolean} [doNotTrigger] | ignore trigger - * @private - */ - _unselectClusters : function(doNotTrigger) { - if (doNotTrigger === undefined) { - doNotTrigger = false; + // check for delimiters consisting of 1 character + if (DELIMITERS[c]) { + tokenType = TOKENTYPE.DELIMITER; + token = c; + next(); + return; } - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (this.selectionObj.nodes[nodeId].clusterSize > 1) { - this.selectionObj.nodes[nodeId].unselect(); - this._removeFromSelection(this.selectionObj.nodes[nodeId]); - } + // check for an identifier (number or string) + // TODO: more precise parsing of numbers/strings (and the port separator ':') + if (isAlphaNumeric(c) || c == '-') { + token += c; + next(); + + while (isAlphaNumeric(c)) { + token += c; + next(); + } + if (token == 'false') { + token = false; // convert to boolean + } + else if (token == 'true') { + token = true; // convert to boolean } + else if (!isNaN(Number(token))) { + token = Number(token); // convert to number + } + tokenType = TOKENTYPE.IDENTIFIER; + return; } - if (doNotTrigger == false) { - this.emit('select', this.getSelection()); + // check for a string enclosed by double quotes + if (c == '"') { + next(); + while (c != '' && (c != '"' || (c == '"' && nextPreview() == '"'))) { + token += c; + if (c == '"') { // skip the escape character + next(); + } + next(); + } + if (c != '"') { + throw newSyntaxError('End of string " expected'); + } + next(); + tokenType = TOKENTYPE.IDENTIFIER; + return; } - }, + // something unknown is found, wrong characters, a syntax error + tokenType = TOKENTYPE.UNKNOWN; + while (c != '') { + token += c; + next(); + } + throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"'); + } /** - * return the number of selected nodes - * - * @returns {number} - * @private + * Parse a graph. + * @returns {Object} graph */ - _getSelectedNodeCount : function() { - var count = 0; - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - count += 1; - } + function parseGraph() { + var graph = {}; + + first(); + getToken(); + + // optional strict keyword + if (token == 'strict') { + graph.strict = true; + getToken(); } - return count; - }, - /** - * return the selected node - * - * @returns {number} - * @private - */ - _getSelectedNode : function() { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - return this.selectionObj.nodes[nodeId]; - } + // graph or digraph keyword + if (token == 'graph' || token == 'digraph') { + graph.type = token; + getToken(); } - return null; - }, - /** - * return the selected edge - * - * @returns {number} - * @private - */ - _getSelectedEdge : function() { - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - return this.selectionObj.edges[edgeId]; - } + // optional graph id + if (tokenType == TOKENTYPE.IDENTIFIER) { + graph.id = token; + getToken(); } - return null; - }, + // open angle bracket + if (token != '{') { + throw newSyntaxError('Angle bracket { expected'); + } + getToken(); + + // statements + parseStatements(graph); - /** - * return the number of selected edges - * - * @returns {number} - * @private - */ - _getSelectedEdgeCount : function() { - var count = 0; - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - count += 1; - } + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); } - return count; - }, + getToken(); + + // end of file + if (token !== '') { + throw newSyntaxError('End of file expected'); + } + getToken(); + + // remove temporary default properties + delete graph.node; + delete graph.edge; + delete graph.graph; + return graph; + } /** - * return the number of selected objects. - * - * @returns {number} - * @private + * Parse a list with statements. + * @param {Object} graph */ - _getSelectedObjectCount : function() { - var count = 0; - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - count += 1; - } - } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - count += 1; + function parseStatements (graph) { + while (token !== '' && token != '}') { + parseStatement(graph); + if (token == ';') { + getToken(); } } - return count; - }, + } /** - * Check if anything is selected - * - * @returns {boolean} - * @private + * Parse a single statement. Can be a an attribute statement, node + * statement, a series of node statements and edge statements, or a + * parameter. + * @param {Object} graph */ - _selectionIsEmpty : function() { - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - return false; - } + function parseStatement(graph) { + // parse subgraph + var subgraph = parseSubgraph(graph); + if (subgraph) { + // edge statements + parseEdge(graph, subgraph); + + return; } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - return false; - } + + // parse an attribute statement + var attr = parseAttributeStatement(graph); + if (attr) { + return; } - return true; - }, + // parse node + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); + } + var id = token; // id can be a string or a number + getToken(); - /** - * check if one of the selected nodes is a cluster. - * - * @returns {boolean} - * @private - */ - _clusterInSelection : function() { - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (this.selectionObj.nodes[nodeId].clusterSize > 1) { - return true; - } + if (token == '=') { + // id statement + getToken(); + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); } + graph[id] = token; + getToken(); + // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " } - return false; - }, - - /** - * select the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ - _selectConnectedEdges : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - var edge = node.dynamicEdges[i]; - edge.select(); - this._addToSelection(edge); + else { + parseNodeStatement(graph, id); } - }, + } /** - * select the edges connected to the node that is being selected - * - * @param {Node} node - * @private + * Parse a subgraph + * @param {Object} graph parent graph object + * @return {Object | null} subgraph */ - _hoverConnectedEdges : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - var edge = node.dynamicEdges[i]; - edge.hover = true; - this._addToHover(edge); - } - }, + function parseSubgraph (graph) { + var subgraph = null; + // optional subgraph keyword + if (token == 'subgraph') { + subgraph = {}; + subgraph.type = 'subgraph'; + getToken(); - /** - * unselect the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ - _unselectConnectedEdges : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - var edge = node.dynamicEdges[i]; - edge.unselect(); - this._removeFromSelection(edge); + // optional graph id + if (tokenType == TOKENTYPE.IDENTIFIER) { + subgraph.id = token; + getToken(); + } } - }, + // open angle bracket + if (token == '{') { + getToken(); + if (!subgraph) { + subgraph = {}; + } + subgraph.parent = graph; + subgraph.node = graph.node; + subgraph.edge = graph.edge; + subgraph.graph = graph.graph; + // statements + parseStatements(subgraph); - /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @param {Boolean} append - * @param {Boolean} [doNotTrigger] | ignore trigger - * @private - */ - _selectObject : function(object, append, doNotTrigger, highlightEdges) { - if (doNotTrigger === undefined) { - doNotTrigger = false; - } - if (highlightEdges === undefined) { - highlightEdges = true; - } + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); + } + getToken(); - if (this._selectionIsEmpty() == false && append == false && this.forceAppendSelection == false) { - this._unselectAll(true); - } + // remove temporary default properties + delete subgraph.node; + delete subgraph.edge; + delete subgraph.graph; + delete subgraph.parent; - if (object.selected == false) { - object.select(); - this._addToSelection(object); - if (object instanceof Node && this.blockConnectingEdgeSelection == false && highlightEdges == true) { - this._selectConnectedEdges(object); + // register at the parent graph + if (!graph.subgraphs) { + graph.subgraphs = []; } + graph.subgraphs.push(subgraph); } - else { - object.unselect(); - this._removeFromSelection(object); - } - - if (doNotTrigger == false) { - this.emit('select', this.getSelection()); - } - }, + return subgraph; + } /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @private + * parse an attribute statement like "node [shape=circle fontSize=16]". + * Available keywords are 'node', 'edge', 'graph'. + * The previous list with default attributes will be replaced + * @param {Object} graph + * @returns {String | null} keyword Returns the name of the parsed attribute + * (node, edge, graph), or null if nothing + * is parsed. */ - _blurObject : function(object) { - if (object.hover == true) { - object.hover = false; - this.emit("blurNode",{node:object.id}); - } - }, + function parseAttributeStatement (graph) { + // attribute statements + if (token == 'node') { + getToken(); - /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @private - */ - _hoverObject : function(object) { - if (object.hover == false) { - object.hover = true; - this._addToHover(object); - if (object instanceof Node) { - this.emit("hoverNode",{node:object.id}); - } + // node attributes + graph.node = parseAttributeList(); + return 'node'; + } + else if (token == 'edge') { + getToken(); + + // edge attributes + graph.edge = parseAttributeList(); + return 'edge'; } - if (object instanceof Node) { - this._hoverConnectedEdges(object); + else if (token == 'graph') { + getToken(); + + // graph attributes + graph.graph = parseAttributeList(); + return 'graph'; } - }, + return null; + } /** - * handles the selection part of the touch, only for navigation controls elements; - * Touch is triggered before tap, also before hold. Hold triggers after a while. - * This is the most responsive solution - * - * @param {Object} pointer - * @private + * parse a node statement + * @param {Object} graph + * @param {String | Number} id */ - _handleTouch : function(pointer) { - }, + function parseNodeStatement(graph, id) { + // node statement + var node = { + id: id + }; + var attr = parseAttributeList(); + if (attr) { + node.attr = attr; + } + addNode(graph, node); + // edge statements + parseEdge(graph, id); + } /** - * handles the selection part of the tap; - * - * @param {Object} pointer - * @private + * Parse an edge or a series of edges + * @param {Object} graph + * @param {String | Number} from Id of the from node */ - _handleTap : function(pointer) { - var node = this._getNodeAt(pointer); - if (node != null) { - this._selectObject(node,false); - } - else { - var edge = this._getEdgeAt(pointer); - if (edge != null) { - this._selectObject(edge,false); + function parseEdge(graph, from) { + while (token == '->' || token == '--') { + var to; + var type = token; + getToken(); + + var subgraph = parseSubgraph(graph); + if (subgraph) { + to = subgraph; } else { - this._unselectAll(); + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier or subgraph expected'); + } + to = token; + addNode(graph, { + id: to + }); + getToken(); } - } - this.emit("click", this.getSelection()); - this._redraw(); - }, + // parse edge attributes + var attr = parseAttributeList(); - /** - * handles the selection part of the double tap and opens a cluster if needed - * - * @param {Object} pointer - * @private - */ - _handleDoubleTap : function(pointer) { - var node = this._getNodeAt(pointer); - if (node != null && node !== undefined) { - // we reset the areaCenter here so the opening of the node will occur - this.areaCenter = {"x" : this._XconvertDOMtoCanvas(pointer.x), - "y" : this._YconvertDOMtoCanvas(pointer.y)}; - this.openCluster(node); - } - this.emit("doubleClick", this.getSelection()); - }, + // create edge + var edge = createEdge(graph, from, to, type, attr); + addEdge(graph, edge); + from = to; + } + } /** - * Handle the onHold selection part - * - * @param pointer - * @private + * Parse a set with attributes, + * for example [label="1.000", shape=solid] + * @return {Object | null} attr */ - _handleOnHold : function(pointer) { - var node = this._getNodeAt(pointer); - if (node != null) { - this._selectObject(node,true); - } - else { - var edge = this._getEdgeAt(pointer); - if (edge != null) { - this._selectObject(edge,true); + function parseAttributeList() { + var attr = null; + + while (token == '[') { + getToken(); + attr = {}; + while (token !== '' && token != ']') { + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute name expected'); + } + var name = token; + + getToken(); + if (token != '=') { + throw newSyntaxError('Equal sign = expected'); + } + getToken(); + + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute value expected'); + } + var value = token; + setValue(attr, name, value); // name can be a path + + getToken(); + if (token ==',') { + getToken(); + } + } + + if (token != ']') { + throw newSyntaxError('Bracket ] expected'); } + getToken(); } - this._redraw(); - }, + return attr; + } /** - * handle the onRelease event. These functions are here for the navigation controls module. - * - * @private + * Create a syntax error with extra information on current token and index. + * @param {String} message + * @returns {SyntaxError} err */ - _handleOnRelease : function(pointer) { - - }, - - + function newSyntaxError(message) { + return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')'); + } /** - * - * retrieve the currently selected objects - * @return {Number[] | String[]} selection An array with the ids of the - * selected nodes. + * Chop off text after a maximum length + * @param {String} text + * @param {Number} maxLength + * @returns {String} */ - getSelection : function() { - var nodeIds = this.getSelectedNodes(); - var edgeIds = this.getSelectedEdges(); - return {nodes:nodeIds, edges:edgeIds}; - }, + function chop (text, maxLength) { + return (text.length <= maxLength) ? text : (text.substr(0, 27) + '...'); + } /** - * - * retrieve the currently selected nodes - * @return {String} selection An array with the ids of the - * selected nodes. + * Execute a function fn for each pair of elements in two arrays + * @param {Array | *} array1 + * @param {Array | *} array2 + * @param {function} fn */ - getSelectedNodes : function() { - var idArray = []; - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - idArray.push(nodeId); + function forEach2(array1, array2, fn) { + if (array1 instanceof Array) { + array1.forEach(function (elem1) { + if (array2 instanceof Array) { + array2.forEach(function (elem2) { + fn(elem1, elem2); + }); + } + else { + fn(elem1, array2); + } + }); + } + else { + if (array2 instanceof Array) { + array2.forEach(function (elem2) { + fn(array1, elem2); + }); + } + else { + fn(array1, array2); } } - return idArray - }, + } /** - * - * retrieve the currently selected edges - * @return {Array} selection An array with the ids of the - * selected nodes. + * Convert a string containing a graph in DOT language into a map containing + * with nodes and edges in the format of graph. + * @param {String} data Text containing a graph in DOT-notation + * @return {Object} graphData */ - getSelectedEdges : function() { - var idArray = []; - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - idArray.push(edgeId); - } + function DOTToGraph (data) { + // parse the DOT file + var dotData = parseDOT(data); + var graphData = { + nodes: [], + edges: [], + options: {} + }; + + // copy the nodes + if (dotData.nodes) { + dotData.nodes.forEach(function (dotNode) { + var graphNode = { + id: dotNode.id, + label: String(dotNode.label || dotNode.id) + }; + merge(graphNode, dotNode.attr); + if (graphNode.image) { + graphNode.shape = 'image'; + } + graphData.nodes.push(graphNode); + }); } - return idArray; - }, + // copy the edges + if (dotData.edges) { + /** + * Convert an edge in DOT format to an edge with VisGraph format + * @param {Object} dotEdge + * @returns {Object} graphEdge + */ + function convertEdge(dotEdge) { + var graphEdge = { + from: dotEdge.from, + to: dotEdge.to + }; + merge(graphEdge, dotEdge.attr); + graphEdge.style = (dotEdge.type == '->') ? 'arrow' : 'line'; + return graphEdge; + } - /** - * select zero or more nodes - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - */ - setSelection : function(selection) { - var i, iMax, id; + dotData.edges.forEach(function (dotEdge) { + var from, to; + if (dotEdge.from instanceof Object) { + from = dotEdge.from.nodes; + } + else { + from = { + id: dotEdge.from + } + } - if (!selection || (selection.length == undefined)) - throw 'Selection must be an array with ids'; + if (dotEdge.to instanceof Object) { + to = dotEdge.to.nodes; + } + else { + to = { + id: dotEdge.to + } + } - // first unselect any selected node - this._unselectAll(true); + if (dotEdge.from instanceof Object && dotEdge.from.edges) { + dotEdge.from.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + } - for (i = 0, iMax = selection.length; i < iMax; i++) { - id = selection[i]; + forEach2(from, to, function (from, to) { + var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr); + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); - var node = this.nodes[id]; - if (!node) { - throw new RangeError('Node with id "' + id + '" not found'); - } - this._selectObject(node,true,true); + if (dotEdge.to instanceof Object && dotEdge.to.edges) { + dotEdge.to.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + } + }); } - console.log("setSelection is deprecated. Please use selectNodes instead.") - - this.redraw(); - }, + // copy the options + if (dotData.attr) { + graphData.options = dotData.attr; + } + return graphData; + } - /** - * select zero or more nodes with the option to highlight edges - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - * @param {boolean} [highlightEdges] - */ - selectNodes : function(selection, highlightEdges) { - var i, iMax, id; + // exports + exports.parseDOT = parseDOT; + exports.DOTToGraph = DOTToGraph; - if (!selection || (selection.length == undefined)) - throw 'Selection must be an array with ids'; - // first unselect any selected node - this._unselectAll(true); +/***/ }, +/* 39 */ +/***/ function(module, exports, __webpack_require__) { - for (i = 0, iMax = selection.length; i < iMax; i++) { - id = selection[i]; + + function parseGephi(gephiJSON, options) { + var edges = []; + var nodes = []; + this.options = { + edges: { + inheritColor: true + }, + nodes: { + allowedToMove: false, + parseColor: false + } + }; - var node = this.nodes[id]; - if (!node) { - throw new RangeError('Node with id "' + id + '" not found'); + if (options !== undefined) { + this.options.nodes['allowedToMove'] = options.allowedToMove | false; + this.options.nodes['parseColor'] = options.parseColor | false; + this.options.edges['inheritColor'] = options.inheritColor | true; + } + + var gEdges = gephiJSON.edges; + var gNodes = gephiJSON.nodes; + for (var i = 0; i < gEdges.length; i++) { + var edge = {}; + var gEdge = gEdges[i]; + edge['id'] = gEdge.id; + edge['from'] = gEdge.source; + edge['to'] = gEdge.target; + edge['attributes'] = gEdge.attributes; + // edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined; + // edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size; + edge['color'] = gEdge.color; + edge['inheritColor'] = edge['color'] !== undefined ? false : this.options.inheritColor; + edges.push(edge); + } + + for (var i = 0; i < gNodes.length; i++) { + var node = {}; + var gNode = gNodes[i]; + node['id'] = gNode.id; + node['attributes'] = gNode.attributes; + node['x'] = gNode.x; + node['y'] = gNode.y; + node['label'] = gNode.label; + if (this.options.nodes.parseColor == true) { + node['color'] = gNode.color; } - this._selectObject(node,true,true,highlightEdges); + else { + node['color'] = gNode.color !== undefined ? {background:gNode.color, border:gNode.color} : undefined; + } + node['radius'] = gNode.size; + node['allowedToMoveX'] = this.options.nodes.allowedToMove; + node['allowedToMoveY'] = this.options.nodes.allowedToMove; + nodes.push(node); } - this.redraw(); - }, + return {nodes:nodes, edges:edges}; + } - /** - * select zero or more edges - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - */ - selectEdges : function(selection) { - var i, iMax, id; + exports.parseGephi = parseGephi; - if (!selection || (selection.length == undefined)) - throw 'Selection must be an array with ids'; +/***/ }, +/* 40 */ +/***/ function(module, exports, __webpack_require__) { - // first unselect any selected node - this._unselectAll(true); + // first check if moment.js is already loaded in the browser window, if so, + // use this instance. Else, load via commonjs. + module.exports = (typeof window !== 'undefined') && window['moment'] || __webpack_require__(47); - for (i = 0, iMax = selection.length; i < iMax; i++) { - id = selection[i]; - var edge = this.edges[id]; - if (!edge) { - throw new RangeError('Edge with id "' + id + '" not found'); - } - this._selectObject(edge,true,true,highlightEdges); - } - this.redraw(); - }, +/***/ }, +/* 41 */ +/***/ function(module, exports, __webpack_require__) { - /** - * Validate the selection: remove ids of nodes which no longer exist - * @private - */ - _updateSelection : function () { - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (!this.nodes.hasOwnProperty(nodeId)) { - delete this.selectionObj.nodes[nodeId]; - } - } - } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - if (!this.edges.hasOwnProperty(edgeId)) { - delete this.selectionObj.edges[edgeId]; - } - } + // Only load hammer.js when in a browser environment + // (loading hammer.js in a node.js environment gives errors) + if (typeof window !== 'undefined') { + module.exports = window['Hammer'] || __webpack_require__(48); + } + else { + module.exports = function () { + throw Error('hammer.js is only available in a browser, not in node.js.'); } } -}; +/***/ }, +/* 42 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Created by Alex on 1/22/14. - */ - -var NavigationMixin = { - - _cleanNavigation : function() { - // clean up previosu navigation items - var wrapper = document.getElementById('network-navigation_wrapper'); - if (wrapper != null) { - this.containerElement.removeChild(wrapper); - } - document.onmouseup = null; - }, + var Hammer = __webpack_require__(41); /** - * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation - * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent - * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. - * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. - * - * @private + * Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent + * @param {Element} element + * @param {Event} event */ - _loadNavigationElements : function() { - this._cleanNavigation(); + exports.fakeGesture = function(element, event) { + var eventType = null; - this.navigationDivs = {}; - var navigationDivs = ['up','down','left','right','zoomIn','zoomOut','zoomExtends']; - var navigationDivActions = ['_moveUp','_moveDown','_moveLeft','_moveRight','_zoomIn','_zoomOut','zoomExtent']; + // for hammer.js 1.0.5 + // var gesture = Hammer.event.collectEventData(this, eventType, event); - this.navigationDivs['wrapper'] = document.createElement('div'); - this.navigationDivs['wrapper'].id = "network-navigation_wrapper"; - this.navigationDivs['wrapper'].style.position = "absolute"; - this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; - this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; - this.containerElement.insertBefore(this.navigationDivs['wrapper'],this.frame); + // for hammer.js 1.0.6+ + var touches = Hammer.event.getTouchList(event, eventType); + var gesture = Hammer.event.collectEventData(this, eventType, touches, event); - for (var i = 0; i < navigationDivs.length; i++) { - this.navigationDivs[navigationDivs[i]] = document.createElement('div'); - this.navigationDivs[navigationDivs[i]].id = "network-navigation_" + navigationDivs[i]; - this.navigationDivs[navigationDivs[i]].className = "network-navigation " + navigationDivs[i]; - this.navigationDivs['wrapper'].appendChild(this.navigationDivs[navigationDivs[i]]); - this.navigationDivs[navigationDivs[i]].onmousedown = this[navigationDivActions[i]].bind(this); + // on IE in standards mode, no touches are recognized by hammer.js, + // resulting in NaN values for center.pageX and center.pageY + if (isNaN(gesture.center.pageX)) { + gesture.center.pageX = event.pageX; + } + if (isNaN(gesture.center.pageY)) { + gesture.center.pageY = event.pageY; } - document.onmouseup = this._stopMovement.bind(this); - }, + return gesture; + }; - /** - * this stops all movement induced by the navigation buttons - * - * @private - */ - _stopMovement : function() { - this._xStopMoving(); - this._yStopMoving(); - this._stopZoom(); - }, +/***/ }, +/* 43 */ +/***/ function(module, exports, __webpack_require__) { /** - * stops the actions performed by page up and down etc. - * - * @param event - * @private + * Canvas shapes used by Network */ - _preventDefault : function(event) { - if (event !== undefined) { - if (event.preventDefault) { - event.preventDefault(); - } else { - event.returnValue = false; - } - } - }, + if (typeof CanvasRenderingContext2D !== 'undefined') { + /** + * Draw a circle shape + */ + CanvasRenderingContext2D.prototype.circle = function(x, y, r) { + this.beginPath(); + this.arc(x, y, r, 0, 2*Math.PI, false); + }; - /** - * move the screen up - * By using the increments, instead of adding a fixed number to the translation, we keep fluent and - * instant movement. The onKeypress event triggers immediately, then pauses, then triggers frequently - * To avoid this behaviour, we do the translation in the start loop. - * - * @private - */ - _moveUp : function(event) { - this.yIncrement = this.constants.keyboard.speed.y; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['up'].className += " active"; - } - }, + /** + * Draw a square shape + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r size, width and height of the square + */ + CanvasRenderingContext2D.prototype.square = function(x, y, r) { + this.beginPath(); + this.rect(x - r, y - r, r * 2, r * 2); + }; + /** + * Draw a triangle shape + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r radius, half the length of the sides of the triangle + */ + CanvasRenderingContext2D.prototype.triangle = function(x, y, r) { + // http://en.wikipedia.org/wiki/Equilateral_triangle + this.beginPath(); + + var s = r * 2; + var s2 = s / 2; + var ir = Math.sqrt(3) / 6 * s; // radius of inner circle + var h = Math.sqrt(s * s - s2 * s2); // height + + this.moveTo(x, y - (h - ir)); + this.lineTo(x + s2, y + ir); + this.lineTo(x - s2, y + ir); + this.lineTo(x, y - (h - ir)); + this.closePath(); + }; - /** - * move the screen down - * @private - */ - _moveDown : function(event) { - this.yIncrement = -this.constants.keyboard.speed.y; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['down'].className += " active"; - } - }, + /** + * Draw a triangle shape in downward orientation + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r radius + */ + CanvasRenderingContext2D.prototype.triangleDown = function(x, y, r) { + // http://en.wikipedia.org/wiki/Equilateral_triangle + this.beginPath(); + + var s = r * 2; + var s2 = s / 2; + var ir = Math.sqrt(3) / 6 * s; // radius of inner circle + var h = Math.sqrt(s * s - s2 * s2); // height + + this.moveTo(x, y + (h - ir)); + this.lineTo(x + s2, y - ir); + this.lineTo(x - s2, y - ir); + this.lineTo(x, y + (h - ir)); + this.closePath(); + }; + /** + * Draw a star shape, a star with 5 points + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r radius, half the length of the sides of the triangle + */ + CanvasRenderingContext2D.prototype.star = function(x, y, r) { + // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ + this.beginPath(); - /** - * move the screen left - * @private - */ - _moveLeft : function(event) { - this.xIncrement = this.constants.keyboard.speed.x; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['left'].className += " active"; - } - }, + for (var n = 0; n < 10; n++) { + var radius = (n % 2 === 0) ? r * 1.3 : r * 0.5; + this.lineTo( + x + radius * Math.sin(n * 2 * Math.PI / 10), + y - radius * Math.cos(n * 2 * Math.PI / 10) + ); + } + this.closePath(); + }; - /** - * move the screen right - * @private - */ - _moveRight : function(event) { - this.xIncrement = -this.constants.keyboard.speed.y; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['right'].className += " active"; - } - }, + /** + * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas + */ + CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) { + var r2d = Math.PI/180; + if( w - ( 2 * r ) < 0 ) { r = ( w / 2 ); } //ensure that the radius isn't too large for x + if( h - ( 2 * r ) < 0 ) { r = ( h / 2 ); } //ensure that the radius isn't too large for y + this.beginPath(); + this.moveTo(x+r,y); + this.lineTo(x+w-r,y); + this.arc(x+w-r,y+r,r,r2d*270,r2d*360,false); + this.lineTo(x+w,y+h-r); + this.arc(x+w-r,y+h-r,r,0,r2d*90,false); + this.lineTo(x+r,y+h); + this.arc(x+r,y+h-r,r,r2d*90,r2d*180,false); + this.lineTo(x,y+r); + this.arc(x+r,y+r,r,r2d*180,r2d*270,false); + }; + /** + * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + */ + CanvasRenderingContext2D.prototype.ellipse = function(x, y, w, h) { + var kappa = .5522848, + ox = (w / 2) * kappa, // control point offset horizontal + oy = (h / 2) * kappa, // control point offset vertical + xe = x + w, // x-end + ye = y + h, // y-end + xm = x + w / 2, // x-middle + ym = y + h / 2; // y-middle + + this.beginPath(); + this.moveTo(x, ym); + this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + }; - /** - * Zoom in, using the same method as the movement. - * @private - */ - _zoomIn : function(event) { - this.zoomIncrement = this.constants.keyboard.speed.zoom; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['zoomIn'].className += " active"; - } - }, - /** - * Zoom out - * @private - */ - _zoomOut : function() { - this.zoomIncrement = -this.constants.keyboard.speed.zoom; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['zoomOut'].className += " active"; - } - }, + /** + * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + */ + CanvasRenderingContext2D.prototype.database = function(x, y, w, h) { + var f = 1/3; + var wEllipse = w; + var hEllipse = h * f; + var kappa = .5522848, + ox = (wEllipse / 2) * kappa, // control point offset horizontal + oy = (hEllipse / 2) * kappa, // control point offset vertical + xe = x + wEllipse, // x-end + ye = y + hEllipse, // y-end + xm = x + wEllipse / 2, // x-middle + ym = y + hEllipse / 2, // y-middle + ymb = y + (h - hEllipse/2), // y-midlle, bottom ellipse + yeb = y + h; // y-end, bottom ellipse - /** - * Stop zooming and unhighlight the zoom controls - * @private - */ - _stopZoom : function() { - this.zoomIncrement = 0; - if (this.navigationDivs) { - this.navigationDivs['zoomIn'].className = this.navigationDivs['zoomIn'].className.replace(" active",""); - this.navigationDivs['zoomOut'].className = this.navigationDivs['zoomOut'].className.replace(" active",""); - } - }, + this.beginPath(); + this.moveTo(xe, ym); + this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); - /** - * Stop moving in the Y direction and unHighlight the up and down - * @private - */ - _yStopMoving : function() { - this.yIncrement = 0; - if (this.navigationDivs) { - this.navigationDivs['up'].className = this.navigationDivs['up'].className.replace(" active",""); - this.navigationDivs['down'].className = this.navigationDivs['down'].className.replace(" active",""); - } - }, + this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + this.lineTo(xe, ymb); - /** - * Stop moving in the X direction and unHighlight left and right. - * @private - */ - _xStopMoving : function() { - this.xIncrement = 0; - if (this.navigationDivs) { - this.navigationDivs['left'].className = this.navigationDivs['left'].className.replace(" active",""); - this.navigationDivs['right'].className = this.navigationDivs['right'].className.replace(" active",""); - } - } + this.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb); + this.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb); + this.lineTo(x, ym); + }; -}; -/** - * Created by Alex on 2/10/14. - */ + /** + * Draw an arrow point (no line) + */ + CanvasRenderingContext2D.prototype.arrow = function(x, y, angle, length) { + // tail + var xt = x - length * Math.cos(angle); + var yt = y - length * Math.sin(angle); + + // inner tail + // TODO: allow to customize different shapes + var xi = x - length * 0.9 * Math.cos(angle); + var yi = y - length * 0.9 * Math.sin(angle); + + // left + var xl = xt + length / 3 * Math.cos(angle + 0.5 * Math.PI); + var yl = yt + length / 3 * Math.sin(angle + 0.5 * Math.PI); + + // right + var xr = xt + length / 3 * Math.cos(angle - 0.5 * Math.PI); + var yr = yt + length / 3 * Math.sin(angle - 0.5 * Math.PI); + + this.beginPath(); + this.moveTo(x, y); + this.lineTo(xl, yl); + this.lineTo(xi, yi); + this.lineTo(xr, yr); + this.closePath(); + }; + + /** + * Sets up the dashedLine functionality for drawing + * Original code came from http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas + * @author David Jordan + * @date 2012-08-08 + */ + CanvasRenderingContext2D.prototype.dashedLine = function(x,y,x2,y2,dashArray){ + if (!dashArray) dashArray=[10,5]; + if (dashLength==0) dashLength = 0.001; // Hack for Safari + var dashCount = dashArray.length; + this.moveTo(x, y); + var dx = (x2-x), dy = (y2-y); + var slope = dy/dx; + var distRemaining = Math.sqrt( dx*dx + dy*dy ); + var dashIndex=0, draw=true; + while (distRemaining>=0.1){ + var dashLength = dashArray[dashIndex++%dashCount]; + if (dashLength > distRemaining) dashLength = distRemaining; + var xStep = Math.sqrt( dashLength*dashLength / (1 + slope*slope) ); + if (dx<0) xStep = -xStep; + x += xStep; + y += slope*xStep; + this[draw ? 'lineTo' : 'moveTo'](x,y); + distRemaining -= dashLength; + draw = !draw; + } + }; + + // TODO: add diamond shape + } -var networkMixinLoaders = { +/***/ }, +/* 44 */ +/***/ function(module, exports, __webpack_require__) { + + var PhysicsMixin = __webpack_require__(55); + var ClusterMixin = __webpack_require__(49); + var SectorsMixin = __webpack_require__(50); + var SelectionMixin = __webpack_require__(51); + var ManipulationMixin = __webpack_require__(52); + var NavigationMixin = __webpack_require__(53); + var HierarchicalLayoutMixin = __webpack_require__(54); /** * Load a mixin into the network object @@ -19297,13 +20644,13 @@ var networkMixinLoaders = { * @param {Object} sourceVariable | this object has to contain functions. * @private */ - _loadMixin: function (sourceVariable) { + exports._loadMixin = function (sourceVariable) { for (var mixinFunction in sourceVariable) { if (sourceVariable.hasOwnProperty(mixinFunction)) { - Network.prototype[mixinFunction] = sourceVariable[mixinFunction]; + this[mixinFunction] = sourceVariable[mixinFunction]; } } - }, + }; /** @@ -19312,13 +20659,13 @@ var networkMixinLoaders = { * @param {Object} sourceVariable | this object has to contain functions. * @private */ - _clearMixin: function (sourceVariable) { + exports._clearMixin = function (sourceVariable) { for (var mixinFunction in sourceVariable) { if (sourceVariable.hasOwnProperty(mixinFunction)) { - Network.prototype[mixinFunction] = undefined; + this[mixinFunction] = undefined; } } - }, + }; /** @@ -19326,13 +20673,13 @@ var networkMixinLoaders = { * * @private */ - _loadPhysicsSystem: function () { - this._loadMixin(physicsMixin); + exports._loadPhysicsSystem = function () { + this._loadMixin(PhysicsMixin); this._loadSelectedForceSolver(); if (this.constants.configurePhysics == true) { this._loadPhysicsConfiguration(); } - }, + }; /** @@ -19340,11 +20687,11 @@ var networkMixinLoaders = { * * @private */ - _loadClusterSystem: function () { + exports._loadClusterSystem = function () { this.clusterSession = 0; this.hubThreshold = 5; this._loadMixin(ClusterMixin); - }, + }; /** @@ -19352,26 +20699,26 @@ var networkMixinLoaders = { * * @private */ - _loadSectorSystem: function () { + exports._loadSectorSystem = function () { this.sectors = {}; this.activeSector = ["default"]; this.sectors["active"] = {}; this.sectors["active"]["default"] = {"nodes": {}, - "edges": {}, - "nodeIndices": [], - "formationScale": 1.0, - "drawingNode": undefined }; + "edges": {}, + "nodeIndices": [], + "formationScale": 1.0, + "drawingNode": undefined }; this.sectors["frozen"] = {}; - this.sectors["support"] = {"nodes": {}, - "edges": {}, - "nodeIndices": [], - "formationScale": 1.0, - "drawingNode": undefined }; + this.sectors["support"] = {"nodes": {}, + "edges": {}, + "nodeIndices": [], + "formationScale": 1.0, + "drawingNode": undefined }; this.nodeIndices = this.sectors["active"]["default"]["nodeIndices"]; // the node indices list is used to speed up the computation of the repulsion fields - this._loadMixin(SectorMixin); - }, + this._loadMixin(SectorsMixin); + }; /** @@ -19379,11 +20726,11 @@ var networkMixinLoaders = { * * @private */ - _loadSelectionSystem: function () { + exports._loadSelectionSystem = function () { this.selectionObj = {nodes: {}, edges: {}}; this._loadMixin(SelectionMixin); - }, + }; /** @@ -19391,7 +20738,7 @@ var networkMixinLoaders = { * * @private */ - _loadManipulationSystem: function () { + exports._loadManipulationSystem = function () { // reset global variables -- these are used by the selection of nodes and edges. this.blockConnectingEdgeSelection = false; this.forceAppendSelection = false; @@ -19433,7 +20780,7 @@ var networkMixinLoaders = { } // load the manipulation functions - this._loadMixin(manipulationMixin); + this._loadMixin(ManipulationMixin); // create the manipulator toolbar this._createManipulatorBar(); @@ -19451,10737 +20798,10672 @@ var networkMixinLoaders = { this.editModeDiv = undefined; this.closeDiv = undefined; // remove the mixin functions - this._clearMixin(manipulationMixin); + this._clearMixin(ManipulationMixin); + } + } + }; + + + /** + * Mixin the navigation (User Interface) system and initialize the parameters required + * + * @private + */ + exports._loadNavigationControls = function () { + this._loadMixin(NavigationMixin); + + // the clean function removes the button divs, this is done to remove the bindings. + this._cleanNavigation(); + if (this.constants.navigation.enabled == true) { + this._loadNavigationElements(); + } + }; + + + /** + * Mixin the hierarchical layout system. + * + * @private + */ + exports._loadHierarchySystem = function () { + this._loadMixin(HierarchicalLayoutMixin); + }; + + +/***/ }, +/* 45 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * Expose `Emitter`. + */ + + module.exports = Emitter; + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + }; + + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks[event] = this._callbacks[event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + var self = this; + this._callbacks = this._callbacks || {}; + + function on() { + self.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks[event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks[event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks[event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); } } - }, + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks[event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + + +/***/ }, +/* 46 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Copyright 2012 Craig Campbell + * + * 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. + * + * Mousetrap is a simple keyboard shortcut library for Javascript with + * no external dependencies + * + * @version 1.1.2 + * @url craig.is/killing/mice + */ + + /** + * mapping of special keycodes to their corresponding keys + * + * everything in this dictionary cannot use keypress events + * so it has to be here to map to the correct keycodes for + * keyup/keydown events + * + * @type {Object} + */ + var _MAP = { + 8: 'backspace', + 9: 'tab', + 13: 'enter', + 16: 'shift', + 17: 'ctrl', + 18: 'alt', + 20: 'capslock', + 27: 'esc', + 32: 'space', + 33: 'pageup', + 34: 'pagedown', + 35: 'end', + 36: 'home', + 37: 'left', + 38: 'up', + 39: 'right', + 40: 'down', + 45: 'ins', + 46: 'del', + 91: 'meta', + 93: 'meta', + 224: 'meta' + }, + + /** + * mapping for special characters so they can support + * + * this dictionary is only used incase you want to bind a + * keyup or keydown event to one of these keys + * + * @type {Object} + */ + _KEYCODE_MAP = { + 106: '*', + 107: '+', + 109: '-', + 110: '.', + 111 : '/', + 186: ';', + 187: '=', + 188: ',', + 189: '-', + 190: '.', + 191: '/', + 192: '`', + 219: '[', + 220: '\\', + 221: ']', + 222: '\'' + }, + + /** + * this is a mapping of keys that require shift on a US keypad + * back to the non shift equivelents + * + * this is so you can use keyup events with these keys + * + * note that this will only work reliably on US keyboards + * + * @type {Object} + */ + _SHIFT_MAP = { + '~': '`', + '!': '1', + '@': '2', + '#': '3', + '$': '4', + '%': '5', + '^': '6', + '&': '7', + '*': '8', + '(': '9', + ')': '0', + '_': '-', + '+': '=', + ':': ';', + '\"': '\'', + '<': ',', + '>': '.', + '?': '/', + '|': '\\' + }, + + /** + * this is a list of special strings you can use to map + * to modifier keys when you specify your keyboard shortcuts + * + * @type {Object} + */ + _SPECIAL_ALIASES = { + 'option': 'alt', + 'command': 'meta', + 'return': 'enter', + 'escape': 'esc' + }, + + /** + * variable to store the flipped version of _MAP from above + * needed to check if we should use keypress or not when no action + * is specified + * + * @type {Object|undefined} + */ + _REVERSE_MAP, + + /** + * a list of all the callbacks setup via Mousetrap.bind() + * + * @type {Object} + */ + _callbacks = {}, + + /** + * direct map of string combinations to callbacks used for trigger() + * + * @type {Object} + */ + _direct_map = {}, + + /** + * keeps track of what level each sequence is at since multiple + * sequences can start out with the same sequence + * + * @type {Object} + */ + _sequence_levels = {}, + + /** + * variable to store the setTimeout call + * + * @type {null|number} + */ + _reset_timer, + + /** + * temporary state where we will ignore the next keyup + * + * @type {boolean|string} + */ + _ignore_next_keyup = false, + + /** + * are we currently inside of a sequence? + * type of action ("keyup" or "keydown" or "keypress") or false + * + * @type {boolean|string} + */ + _inside_sequence = false; + + /** + * loop through the f keys, f1 to f19 and add them to the map + * programatically + */ + for (var i = 1; i < 20; ++i) { + _MAP[111 + i] = 'f' + i; + } + + /** + * loop through to map numbers on the numeric keypad + */ + for (i = 0; i <= 9; ++i) { + _MAP[i + 96] = i; + } + + /** + * cross browser add event method + * + * @param {Element|HTMLDocument} object + * @param {string} type + * @param {Function} callback + * @returns void + */ + function _addEvent(object, type, callback) { + if (object.addEventListener) { + return object.addEventListener(type, callback, false); + } + + object.attachEvent('on' + type, callback); + } + + /** + * takes the event and returns the key character + * + * @param {Event} e + * @return {string} + */ + function _characterFromEvent(e) { + + // for keypress events we should return the character as is + if (e.type == 'keypress') { + return String.fromCharCode(e.which); + } + + // for non keypress events the special maps are needed + if (_MAP[e.which]) { + return _MAP[e.which]; + } + + if (_KEYCODE_MAP[e.which]) { + return _KEYCODE_MAP[e.which]; + } + + // if it is not in the special map + return String.fromCharCode(e.which).toLowerCase(); + } + + /** + * should we stop this event before firing off callbacks + * + * @param {Event} e + * @return {boolean} + */ + function _stop(e) { + var element = e.target || e.srcElement, + tag_name = element.tagName; + + // if the element has the class "mousetrap" then no need to stop + if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) { + return false; + } + + // stop for input, select, and textarea + return tag_name == 'INPUT' || tag_name == 'SELECT' || tag_name == 'TEXTAREA' || (element.contentEditable && element.contentEditable == 'true'); + } + + /** + * checks if two arrays are equal + * + * @param {Array} modifiers1 + * @param {Array} modifiers2 + * @returns {boolean} + */ + function _modifiersMatch(modifiers1, modifiers2) { + return modifiers1.sort().join(',') === modifiers2.sort().join(','); + } + + /** + * resets all sequence counters except for the ones passed in + * + * @param {Object} do_not_reset + * @returns void + */ + function _resetSequences(do_not_reset) { + do_not_reset = do_not_reset || {}; + + var active_sequences = false, + key; + + for (key in _sequence_levels) { + if (do_not_reset[key]) { + active_sequences = true; + continue; + } + _sequence_levels[key] = 0; + } + + if (!active_sequences) { + _inside_sequence = false; + } + } + + /** + * finds all callbacks that match based on the keycode, modifiers, + * and action + * + * @param {string} character + * @param {Array} modifiers + * @param {string} action + * @param {boolean=} remove - should we remove any matches + * @param {string=} combination + * @returns {Array} + */ + function _getMatches(character, modifiers, action, remove, combination) { + var i, + callback, + matches = []; + + // if there are no events related to this keycode + if (!_callbacks[character]) { + return []; + } + + // if a modifier key is coming up on its own we should allow it + if (action == 'keyup' && _isModifier(character)) { + modifiers = [character]; + } + + // loop through all callbacks for the key that was pressed + // and see if any of them match + for (i = 0; i < _callbacks[character].length; ++i) { + callback = _callbacks[character][i]; + + // if this is a sequence but it is not at the right level + // then move onto the next match + if (callback.seq && _sequence_levels[callback.seq] != callback.level) { + continue; + } + + // if the action we are looking for doesn't match the action we got + // then we should keep going + if (action != callback.action) { + continue; + } + + // if this is a keypress event that means that we need to only + // look at the character, otherwise check the modifiers as + // well + if (action == 'keypress' || _modifiersMatch(modifiers, callback.modifiers)) { + + // remove is used so if you change your mind and call bind a + // second time with a new function the first one is overwritten + if (remove && callback.combo == combination) { + _callbacks[character].splice(i, 1); + } + + matches.push(callback); + } + } + + return matches; + } + + /** + * takes a key event and figures out what the modifiers are + * + * @param {Event} e + * @returns {Array} + */ + function _eventModifiers(e) { + var modifiers = []; + + if (e.shiftKey) { + modifiers.push('shift'); + } + + if (e.altKey) { + modifiers.push('alt'); + } + + if (e.ctrlKey) { + modifiers.push('ctrl'); + } + + if (e.metaKey) { + modifiers.push('meta'); + } + + return modifiers; + } + + /** + * actually calls the callback function + * + * if your callback function returns false this will use the jquery + * convention - prevent default and stop propogation on the event + * + * @param {Function} callback + * @param {Event} e + * @returns void + */ + function _fireCallback(callback, e) { + if (callback(e) === false) { + if (e.preventDefault) { + e.preventDefault(); + } - /** - * Mixin the navigation (User Interface) system and initialize the parameters required - * - * @private - */ - _loadNavigationControls: function () { - this._loadMixin(NavigationMixin); + if (e.stopPropagation) { + e.stopPropagation(); + } - // the clean function removes the button divs, this is done to remove the bindings. - this._cleanNavigation(); - if (this.constants.navigation.enabled == true) { - this._loadNavigationElements(); + e.returnValue = false; + e.cancelBubble = true; + } } - }, + /** + * handles a character key event + * + * @param {string} character + * @param {Event} e + * @returns void + */ + function _handleCharacter(character, e) { - /** - * Mixin the hierarchical layout system. - * - * @private - */ - _loadHierarchySystem: function () { - this._loadMixin(HierarchicalLayoutMixin); - } + // if this event should not happen stop here + if (_stop(e)) { + return; + } -}; + var callbacks = _getMatches(character, _eventModifiers(e), e.type), + i, + do_not_reset = {}, + processed_sequence_callback = false; + + // loop through matching callbacks for this key event + for (i = 0; i < callbacks.length; ++i) { + + // fire for all sequence callbacks + // this is because if for example you have multiple sequences + // bound such as "g i" and "g t" they both need to fire the + // callback for matching g cause otherwise you can only ever + // match the first one + if (callbacks[i].seq) { + processed_sequence_callback = true; + + // keep a list of which sequences were matches for later + do_not_reset[callbacks[i].seq] = 1; + _fireCallback(callbacks[i].callback, e); + continue; + } -/** - * @constructor Network - * Create a network visualization, displaying nodes and edges. - * - * @param {Element} container The DOM element in which the Network will - * be created. Normally a div element. - * @param {Object} data An object containing parameters - * {Array} nodes - * {Array} edges - * @param {Object} options Options - */ -function Network (container, data, options) { - if (!(this instanceof Network)) { - throw new SyntaxError('Constructor must be called with the new operator'); - } + // if there were no sequence matches but we are still here + // that means this is a regular match so we should fire that + if (!processed_sequence_callback && !_inside_sequence) { + _fireCallback(callbacks[i].callback, e); + } + } - this._initializeMixinLoaders(); - - // create variables and set default values - this.containerElement = container; - this.width = '100%'; - this.height = '100%'; - - // render and calculation settings - this.renderRefreshRate = 60; // hz (fps) - this.renderTimestep = 1000 / this.renderRefreshRate; // ms -- saves calculation later on - this.renderTime = 0.5 * this.renderTimestep; // measured time it takes to render a frame - this.maxPhysicsTicksPerRender = 3; // max amount of physics ticks per render step. - this.physicsDiscreteStepsize = 0.50; // discrete stepsize of the simulation - - this.stabilize = true; // stabilize before displaying the network - this.selectable = true; - this.initializing = true; - - // these functions are triggered when the dataset is edited - this.triggerFunctions = {add:null,edit:null,editEdge:null,connect:null,del:null}; - - - // set constant values - this.constants = { - nodes: { - radiusMin: 5, - radiusMax: 20, - radius: 5, - shape: 'ellipse', - image: undefined, - widthMin: 16, // px - widthMax: 64, // px - fixed: false, - fontColor: 'black', - fontSize: 14, // px - fontFace: 'verdana', - level: -1, - color: { - border: '#2B7CE9', - background: '#97C2FC', - highlight: { - border: '#2B7CE9', - background: '#D2E5FF' - }, - hover: { - border: '#2B7CE9', - background: '#D2E5FF' + // if you are inside of a sequence and the key you are pressing + // is not a modifier key then we should reset all sequences + // that were not matched by this key event + if (e.type == _inside_sequence && !_isModifier(character)) { + _resetSequences(do_not_reset); } - }, - borderColor: '#2B7CE9', - backgroundColor: '#97C2FC', - highlightColor: '#D2E5FF', - group: undefined - }, - edges: { - widthMin: 1, - widthMax: 15, - width: 1, - widthSelectionMultiplier: 2, - hoverWidth: 1.5, - style: 'line', - color: { - color:'#848484', - highlight:'#848484', - hover: '#848484' - }, - fontColor: '#343434', - fontSize: 14, // px - fontFace: 'arial', - fontFill: 'white', - arrowScaleFactor: 1, - dash: { - length: 10, - gap: 5, - altLength: undefined - } - }, - configurePhysics:false, - physics: { - barnesHut: { - enabled: true, - theta: 1 / 0.6, // inverted to save time during calculation - gravitationalConstant: -2000, - centralGravity: 0.3, - springLength: 95, - springConstant: 0.04, - damping: 0.09 - }, - repulsion: { - centralGravity: 0.1, - springLength: 200, - springConstant: 0.05, - nodeDistance: 100, - damping: 0.09 - }, - hierarchicalRepulsion: { - enabled: false, - centralGravity: 0.5, - springLength: 150, - springConstant: 0.01, - nodeDistance: 60, - damping: 0.09 - }, - damping: null, - centralGravity: null, - springLength: null, - springConstant: null - }, - clustering: { // Per Node in Cluster = PNiC - enabled: false, // (Boolean) | global on/off switch for clustering. - initialMaxNodes: 100, // (# nodes) | if the initial amount of nodes is larger than this, we cluster until the total number is less than this threshold. - clusterThreshold:500, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than this. If it is, cluster until reduced to reduceToNodes - reduceToNodes:300, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than clusterThreshold. If it is, cluster until reduced to this - chainThreshold: 0.4, // (% of all drawn nodes)| maximum percentage of allowed chainnodes (long strings of connected nodes) within all nodes. (lower means less chains). - clusterEdgeThreshold: 20, // (px) | edge length threshold. if smaller, this node is clustered. - sectorThreshold: 100, // (# nodes in cluster) | cluster size threshold. If larger, expanding in own sector. - screenSizeThreshold: 0.2, // (% of canvas) | relative size threshold. If the width or height of a clusternode takes up this much of the screen, decluster node. - fontSizeMultiplier: 4.0, // (px PNiC) | how much the cluster font size grows per node in cluster (in px). - maxFontSize: 1000, - forceAmplification: 0.1, // (multiplier PNiC) | factor of increase fo the repulsion force of a cluster (per node in cluster). - distanceAmplification: 0.1, // (multiplier PNiC) | factor how much the repulsion distance of a cluster increases (per node in cluster). - edgeGrowth: 20, // (px PNiC) | amount of clusterSize connected to the edge is multiplied with this and added to edgeLength. - nodeScaling: {width: 1, // (px PNiC) | growth of the width per node in cluster. - height: 1, // (px PNiC) | growth of the height per node in cluster. - radius: 1}, // (px PNiC) | growth of the radius per node in cluster. - maxNodeSizeIncrements: 600, // (# increments) | max growth of the width per node in cluster. - activeAreaBoxSize: 80, // (px) | box area around the curser where clusters are popped open. - clusterLevelDifference: 2 - }, - navigation: { - enabled: false - }, - keyboard: { - enabled: false, - speed: {x: 10, y: 10, zoom: 0.02} - }, - dataManipulation: { - enabled: false, - initiallyVisible: false - }, - hierarchicalLayout: { - enabled:false, - levelSeparation: 150, - nodeSpacing: 100, - direction: "UD" // UD, DU, LR, RL - }, - freezeForStabilization: false, - smoothCurves: true, - maxVelocity: 10, - minVelocity: 0.1, // px/s - stabilizationIterations: 1000, // maximum number of iteration to stabilize - labels:{ - add:"Add Node", - edit:"Edit", - link:"Add Link", - del:"Delete selected", - editNode:"Edit Node", - editEdge:"Edit Edge", - back:"Back", - addDescription:"Click in an empty space to place a new node.", - linkDescription:"Click on a node and drag the edge to another node to connect them.", - editEdgeDescription:"Click on the control points and drag them to a node to connect to it.", - addError:"The function for add does not support two arguments (data,callback).", - linkError:"The function for connect does not support two arguments (data,callback).", - editError:"The function for edit does not support two arguments (data, callback).", - editBoundError:"No edit function has been bound to this button.", - deleteError:"The function for delete does not support two arguments (data, callback).", - deleteClusterError:"Clusters cannot be deleted." - }, - tooltip: { - delay: 300, - fontColor: 'black', - fontSize: 14, // px - fontFace: 'verdana', - color: { - border: '#666', - background: '#FFFFC6' - } - }, - dragNetwork: true, - dragNodes: true, - zoomable: true, - hover: false - }; - this.hoverObj = {nodes:{},edges:{}}; - - - // Node variables - var network = this; - this.groups = new Groups(); // object with groups - this.images = new Images(); // object with images - this.images.setOnloadCallback(function () { - network._redraw(); - }); - - // keyboard navigation variables - this.xIncrement = 0; - this.yIncrement = 0; - this.zoomIncrement = 0; - - // loading all the mixins: - // load the force calculation functions, grouped under the physics system. - this._loadPhysicsSystem(); - // create a frame and canvas - this._create(); - // load the sector system. (mandatory, fully integrated with Network) - this._loadSectorSystem(); - // load the cluster system. (mandatory, even when not using the cluster system, there are function calls to it) - this._loadClusterSystem(); - // load the selection system. (mandatory, required by Network) - this._loadSelectionSystem(); - // load the selection system. (mandatory, required by Network) - this._loadHierarchySystem(); - - // apply options - this._setTranslation(this.frame.clientWidth / 2, this.frame.clientHeight / 2); - this._setScale(1); - this.setOptions(options); - - // other vars - this.freezeSimulation = false;// freeze the simulation - this.cachedFunctions = {}; - - // containers for nodes and edges - this.calculationNodes = {}; - this.calculationNodeIndices = []; - this.nodeIndices = []; // array with all the indices of the nodes. Used to speed up forces calculation - this.nodes = {}; // object with Node objects - this.edges = {}; // object with Edge objects - - // position and scale variables and objects - this.canvasTopLeft = {"x": 0,"y": 0}; // coordinates of the top left of the canvas. they will be set during _redraw. - this.canvasBottomRight = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw - this.pointerPosition = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw - this.areaCenter = {}; // object with x and y elements used for determining the center of the zoom action - this.scale = 1; // defining the global scale variable in the constructor - this.previousScale = this.scale; // this is used to check if the zoom operation is zooming in or out - - // datasets or dataviews - this.nodesData = null; // A DataSet or DataView - this.edgesData = null; // A DataSet or DataView - - // create event listeners used to subscribe on the DataSets of the nodes and edges - this.nodesListeners = { - 'add': function (event, params) { - network._addNodes(params.items); - network.start(); - }, - 'update': function (event, params) { - network._updateNodes(params.items); - network.start(); - }, - 'remove': function (event, params) { - network._removeNodes(params.items); - network.start(); - } - }; - this.edgesListeners = { - 'add': function (event, params) { - network._addEdges(params.items); - network.start(); - }, - 'update': function (event, params) { - network._updateEdges(params.items); - network.start(); - }, - 'remove': function (event, params) { - network._removeEdges(params.items); - network.start(); - } - }; - - // properties for the animation - this.moving = true; - this.timer = undefined; // Scheduling function. Is definded in this.start(); - - // load data (the disable start variable will be the same as the enabled clustering) - this.setData(data,this.constants.clustering.enabled || this.constants.hierarchicalLayout.enabled); - - // hierarchical layout - this.initializing = false; - if (this.constants.hierarchicalLayout.enabled == true) { - this._setupHierarchicalLayout(); - } - else { - // zoom so all data will fit on the screen, if clustering is enabled, we do not want start to be called here. - if (this.stabilize == false) { - this.zoomExtent(true,this.constants.clustering.enabled); } - } - // if clustering is disabled, the simulation will have started in the setData function - if (this.constants.clustering.enabled) { - this.startWithClustering(); - } -} + /** + * handles a keydown event + * + * @param {Event} e + * @returns void + */ + function _handleKey(e) { -// Extend Network with an Emitter mixin -Emitter(Network.prototype); + // normalize e.which for key events + // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion + e.which = typeof e.which == "number" ? e.which : e.keyCode; -/** - * Get the script path where the vis.js library is located - * - * @returns {string | null} path Path or null when not found. Path does not - * end with a slash. - * @private - */ -Network.prototype._getScriptPath = function() { - var scripts = document.getElementsByTagName( 'script' ); + var character = _characterFromEvent(e); - // find script named vis.js or vis.min.js - for (var i = 0; i < scripts.length; i++) { - var src = scripts[i].src; - var match = src && /\/?vis(.min)?\.js$/.exec(src); - if (match) { - // return path without the script name - return src.substring(0, src.length - match[0].length); - } - } + // no character found then stop + if (!character) { + return; + } - return null; -}; + if (e.type == 'keyup' && _ignore_next_keyup == character) { + _ignore_next_keyup = false; + return; + } + _handleCharacter(character, e); + } -/** - * Find the center position of the network - * @private - */ -Network.prototype._getRange = function() { - var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (minX > (node.x)) {minX = node.x;} - if (maxX < (node.x)) {maxX = node.x;} - if (minY > (node.y)) {minY = node.y;} - if (maxY < (node.y)) {maxY = node.y;} + /** + * determines if the keycode specified is a modifier key or not + * + * @param {string} key + * @returns {boolean} + */ + function _isModifier(key) { + return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta'; } - } - if (minX == 1e9 && maxX == -1e9 && minY == 1e9 && maxY == -1e9) { - minY = 0, maxY = 0, minX = 0, maxX = 0; - } - return {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; -}; + /** + * called to set a 1 second timeout on the specified sequence + * + * this is so after each key press in the sequence you have 1 second + * to press the next key before you have to start over + * + * @returns void + */ + function _resetSequenceTimer() { + clearTimeout(_reset_timer); + _reset_timer = setTimeout(_resetSequences, 1000); + } -/** - * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; - * @returns {{x: number, y: number}} - * @private - */ -Network.prototype._findCenter = function(range) { - return {x: (0.5 * (range.maxX + range.minX)), - y: (0.5 * (range.maxY + range.minY))}; -}; + /** + * reverses the map lookup so that we can look for specific keys + * to see what can and can't use keypress + * + * @return {Object} + */ + function _getReverseMap() { + if (!_REVERSE_MAP) { + _REVERSE_MAP = {}; + for (var key in _MAP) { + + // pull out the numeric keypad from here cause keypress should + // be able to detect the keys from the character + if (key > 95 && key < 112) { + continue; + } + if (_MAP.hasOwnProperty(key)) { + _REVERSE_MAP[_MAP[key]] = key; + } + } + } + return _REVERSE_MAP; + } -/** - * center the network - * - * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; - */ -Network.prototype._centerNetwork = function(range) { - var center = this._findCenter(range); + /** + * picks the best action based on the key combination + * + * @param {string} key - character for key + * @param {Array} modifiers + * @param {string=} action passed in + */ + function _pickBestAction(key, modifiers, action) { - center.x *= this.scale; - center.y *= this.scale; - center.x -= 0.5 * this.frame.canvas.clientWidth; - center.y -= 0.5 * this.frame.canvas.clientHeight; + // if no action was picked in we should try to pick the one + // that we think would work best for this key + if (!action) { + action = _getReverseMap()[key] ? 'keydown' : 'keypress'; + } - this._setTranslation(-center.x,-center.y); // set at 0,0 -}; + // modifier keys don't work as expected with keypress, + // switch to keydown + if (action == 'keypress' && modifiers.length) { + action = 'keydown'; + } + return action; + } -/** - * This function zooms out to fit all data on screen based on amount of nodes - * - * @param {Boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false; - * @param {Boolean} [disableStart] | If true, start is not called. - */ -Network.prototype.zoomExtent = function(initialZoom, disableStart) { - if (initialZoom === undefined) { - initialZoom = false; - } - if (disableStart === undefined) { - disableStart = false; - } + /** + * binds a key sequence to an event + * + * @param {string} combo - combo specified in bind call + * @param {Array} keys + * @param {Function} callback + * @param {string=} action + * @returns void + */ + function _bindSequence(combo, keys, callback, action) { + + // start off by adding a sequence level record for this combination + // and setting the level to 0 + _sequence_levels[combo] = 0; + + // if there is no action pick the best one for the first key + // in the sequence + if (!action) { + action = _pickBestAction(keys[0], []); + } + + /** + * callback to increase the sequence level for this sequence and reset + * all other sequences that were active + * + * @param {Event} e + * @returns void + */ + var _increaseSequence = function(e) { + _inside_sequence = action; + ++_sequence_levels[combo]; + _resetSequenceTimer(); + }, - var range = this._getRange(); - var zoomLevel; + /** + * wraps the specified callback inside of another function in order + * to reset all sequence counters as soon as this sequence is done + * + * @param {Event} e + * @returns void + */ + _callbackAndReset = function(e) { + _fireCallback(callback, e); + + // we should ignore the next key up if the action is key down + // or keypress. this is so if you finish a sequence and + // release the key the final key will not trigger a keyup + if (action !== 'keyup') { + _ignore_next_keyup = _characterFromEvent(e); + } - if (initialZoom == true) { - var numberOfNodes = this.nodeIndices.length; - if (this.constants.smoothCurves == true) { - if (this.constants.clustering.enabled == true && - numberOfNodes >= this.constants.clustering.initialMaxNodes) { - zoomLevel = 49.07548 / (numberOfNodes + 142.05338) + 9.1444e-04; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. - } - else { - zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. - } - } - else { - if (this.constants.clustering.enabled == true && - numberOfNodes >= this.constants.clustering.initialMaxNodes) { - zoomLevel = 77.5271985 / (numberOfNodes + 187.266146) + 4.76710517e-05; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. - } - else { - zoomLevel = 30.5062972 / (numberOfNodes + 19.93597763) + 0.08413486; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. - } + // weird race condition if a sequence ends with the key + // another sequence begins with + setTimeout(_resetSequences, 10); + }, + i; + + // loop through keys one at a time and bind the appropriate callback + // function. for any key leading up to the final one it should + // increase the sequence. after the final, it should reset all sequences + for (i = 0; i < keys.length; ++i) { + _bindSingle(keys[i], i < keys.length - 1 ? _increaseSequence : _callbackAndReset, action, combo, i); + } } - // correct for larger canvasses. - var factor = Math.min(this.frame.canvas.clientWidth / 600, this.frame.canvas.clientHeight / 600); - zoomLevel *= factor; - } - else { - var xDistance = (Math.abs(range.minX) + Math.abs(range.maxX)) * 1.1; - var yDistance = (Math.abs(range.minY) + Math.abs(range.maxY)) * 1.1; + /** + * binds a single keyboard combination + * + * @param {string} combination + * @param {Function} callback + * @param {string=} action + * @param {string=} sequence_name - name of sequence if part of sequence + * @param {number=} level - what part of the sequence the command is + * @returns void + */ + function _bindSingle(combination, callback, action, sequence_name, level) { - var xZoomLevel = this.frame.canvas.clientWidth / xDistance; - var yZoomLevel = this.frame.canvas.clientHeight / yDistance; + // make sure multiple spaces in a row become a single space + combination = combination.replace(/\s+/g, ' '); - zoomLevel = (xZoomLevel <= yZoomLevel) ? xZoomLevel : yZoomLevel; - } + var sequence = combination.split(' '), + i, + key, + keys, + modifiers = []; - if (zoomLevel > 1.0) { - zoomLevel = 1.0; - } + // if this pattern is a sequence of keys then run through this method + // to reprocess each pattern one key at a time + if (sequence.length > 1) { + return _bindSequence(combination, sequence, callback, action); + } + // take the keys from this pattern and figure out what the actual + // pattern is all about + keys = combination === '+' ? ['+'] : combination.split('+'); - this._setScale(zoomLevel); - this._centerNetwork(range); - if (disableStart == false) { - this.moving = true; - this.start(); - } -}; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + // normalize key names + if (_SPECIAL_ALIASES[key]) { + key = _SPECIAL_ALIASES[key]; + } -/** - * Update the this.nodeIndices with the most recent node index list - * @private - */ -Network.prototype._updateNodeIndexList = function() { - this._clearNodeIndexList(); - for (var idx in this.nodes) { - if (this.nodes.hasOwnProperty(idx)) { - this.nodeIndices.push(idx); - } - } -}; + // if this is not a keypress event then we should + // be smart about using shift keys + // this will only work for US keyboards however + if (action && action != 'keypress' && _SHIFT_MAP[key]) { + key = _SHIFT_MAP[key]; + modifiers.push('shift'); + } + // if this key is a modifier then add it to the list of modifiers + if (_isModifier(key)) { + modifiers.push(key); + } + } -/** - * Set nodes and edges, and optionally options as well. - * - * @param {Object} data Object containing parameters: - * {Array | DataSet | DataView} [nodes] Array with nodes - * {Array | DataSet | DataView} [edges] Array with edges - * {String} [dot] String containing data in DOT format - * {Options} [options] Object with options - * @param {Boolean} [disableStart] | optional: disable the calling of the start function. - */ -Network.prototype.setData = function(data, disableStart) { - if (disableStart === undefined) { - disableStart = false; - } + // depending on what the key combination is + // we will try to pick the best event for it + action = _pickBestAction(key, modifiers, action); - if (data && data.dot && (data.nodes || data.edges)) { - throw new SyntaxError('Data must contain either parameter "dot" or ' + - ' parameter pair "nodes" and "edges", but not both.'); - } + // make sure to initialize array if this is the first time + // a callback is added for this key + if (!_callbacks[key]) { + _callbacks[key] = []; + } - // set options - this.setOptions(data && data.options); + // remove an existing match if there is one + _getMatches(key, modifiers, action, !sequence_name, combination); - // set all data - if (data && data.dot) { - // parse DOT file - if(data && data.dot) { - var dotData = vis.util.DOTToGraph(data.dot); - this.setData(dotData); - return; + // add this call back to the array + // if it is a sequence put it at the beginning + // if not put it at the end + // + // this is important because the way these are processed expects + // the sequence ones to come first + _callbacks[key][sequence_name ? 'unshift' : 'push']({ + callback: callback, + modifiers: modifiers, + action: action, + seq: sequence_name, + level: level, + combo: combination + }); } - } - else { - this._setNodes(data && data.nodes); - this._setEdges(data && data.edges); - } - this._putDataInSector(); - - if (!disableStart) { - // find a stable position or start animating to a stable position - if (this.stabilize) { - var me = this; - setTimeout(function() {me._stabilize(); me.start();},0) - } - else { - this.start(); - } - } -}; + /** + * binds multiple combinations to the same callback + * + * @param {Array} combinations + * @param {Function} callback + * @param {string|undefined} action + * @returns void + */ + function _bindMultiple(combinations, callback, action) { + for (var i = 0; i < combinations.length; ++i) { + _bindSingle(combinations[i], callback, action); + } + } + + // start! + _addEvent(document, 'keypress', _handleKey); + _addEvent(document, 'keydown', _handleKey); + _addEvent(document, 'keyup', _handleKey); + + var mousetrap = { + + /** + * binds an event to mousetrap + * + * can be a single key, a combination of keys separated with +, + * a comma separated list of keys, an array of keys, or + * a sequence of keys separated by spaces + * + * be sure to list the modifier keys first to make sure that the + * correct key ends up getting bound (the last key in the pattern) + * + * @param {string|Array} keys + * @param {Function} callback + * @param {string=} action - 'keypress', 'keydown', or 'keyup' + * @returns void + */ + bind: function(keys, callback, action) { + _bindMultiple(keys instanceof Array ? keys : [keys], callback, action); + _direct_map[keys + ':' + action] = callback; + return this; + }, -/** - * Set options - * @param {Object} options - * @param {Boolean} [initializeView] | set zoom and translation to default. - */ -Network.prototype.setOptions = function (options) { - if (options) { - var prop; - // retrieve parameter values - if (options.width !== undefined) {this.width = options.width;} - if (options.height !== undefined) {this.height = options.height;} - if (options.stabilize !== undefined) {this.stabilize = options.stabilize;} - if (options.selectable !== undefined) {this.selectable = options.selectable;} - if (options.smoothCurves !== undefined) {this.constants.smoothCurves = options.smoothCurves;} - if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;} - if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;} - if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;} - if (options.dragNetwork !== undefined) {this.constants.dragNetwork = options.dragNetwork;} - if (options.dragNodes !== undefined) {this.constants.dragNodes = options.dragNodes;} - if (options.zoomable !== undefined) {this.constants.zoomable = options.zoomable;} - if (options.hover !== undefined) {this.constants.hover = options.hover;} + /** + * unbinds an event to mousetrap + * + * the unbinding sets the callback function of the specified key combo + * to an empty function and deletes the corresponding key in the + * _direct_map dict. + * + * the keycombo+action has to be exactly the same as + * it was defined in the bind method + * + * TODO: actually remove this from the _callbacks dictionary instead + * of binding an empty function + * + * @param {string|Array} keys + * @param {string} action + * @returns void + */ + unbind: function(keys, action) { + if (_direct_map[keys + ':' + action]) { + delete _direct_map[keys + ':' + action]; + this.bind(keys, function() {}, action); + } + return this; + }, - // TODO: deprecated since version 3.0.0. Cleanup some day - if (options.dragGraph !== undefined) { - throw new Error('Option dragGraph is renamed to dragNetwork'); - } + /** + * triggers an event that has already been bound + * + * @param {string} keys + * @param {string=} action + * @returns void + */ + trigger: function(keys, action) { + _direct_map[keys + ':' + action](); + return this; + }, - if (options.labels !== undefined) { - for (prop in options.labels) { - if (options.labels.hasOwnProperty(prop)) { - this.constants.labels[prop] = options.labels[prop]; + /** + * resets the library back to its initial state. this is useful + * if you want to clear out the current keyboard shortcuts and bind + * new ones - for example if you switch to another page + * + * @returns void + */ + reset: function() { + _callbacks = {}; + _direct_map = {}; + return this; } - } - } + }; - if (options.onAdd) { - this.triggerFunctions.add = options.onAdd; - } + module.exports = mousetrap; - if (options.onEdit) { - this.triggerFunctions.edit = options.onEdit; - } - if (options.onEditEdge) { - this.triggerFunctions.editEdge = options.onEditEdge; - } - if (options.onConnect) { - this.triggerFunctions.connect = options.onConnect; - } +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { - if (options.onDelete) { - this.triggerFunctions.del = options.onDelete; - } + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, module) {//! moment.js + //! version : 2.7.0 + //! authors : Tim Wood, Iskren Chernev, Moment.js contributors + //! license : MIT + //! momentjs.com + + (function (undefined) { + + /************************************ + Constants + ************************************/ + + var moment, + VERSION = "2.7.0", + // the global-scope this is NOT the global object in Node.js + globalScope = typeof global !== 'undefined' ? global : this, + oldGlobalMoment, + round = Math.round, + i, + + YEAR = 0, + MONTH = 1, + DATE = 2, + HOUR = 3, + MINUTE = 4, + SECOND = 5, + MILLISECOND = 6, + + // internal storage for language config files + languages = {}, + + // moment internal properties + momentProperties = { + _isAMomentObject: null, + _i : null, + _f : null, + _l : null, + _strict : null, + _tzm : null, + _isUTC : null, + _offset : null, // optional. Combine with _isUTC + _pf : null, + _lang : null // optional + }, + + // check for nodeJS + hasModule = (typeof module !== 'undefined' && module.exports), + + // ASP.NET json date format regex + aspNetJsonRegex = /^\/?Date\((\-?\d+)/i, + aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/, + + // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, + + // format tokens + formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g, + localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g, + + // parsing token regexes + parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99 + parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999 + parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999 + parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999 + parseTokenDigits = /\d+/, // nonzero number of digits + parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic. + parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z + parseTokenT = /T/i, // T (ISO separator) + parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 + parseTokenOrdinal = /\d{1,2}/, + + //strict parsing regexes + parseTokenOneDigit = /\d/, // 0 - 9 + parseTokenTwoDigits = /\d\d/, // 00 - 99 + parseTokenThreeDigits = /\d{3}/, // 000 - 999 + parseTokenFourDigits = /\d{4}/, // 0000 - 9999 + parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999 + parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf + + // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + + isoFormat = 'YYYY-MM-DDTHH:mm:ssZ', + + isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/], + ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/], + ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/], + ['GGGG-[W]WW', /\d{4}-W\d{2}/], + ['YYYY-DDD', /\d{4}-\d{3}/] + ], + + // iso time formats and regexes + isoTimes = [ + ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/], + ['HH:mm', /(T| )\d\d:\d\d/], + ['HH', /(T| )\d\d/] + ], + + // timezone chunker "+10:00" > ["10", "00"] or "-1530" > ["-15", "30"] + parseTimezoneChunker = /([\+\-]|\d\d)/gi, + + // getter and setter names + proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'), + unitMillisecondFactors = { + 'Milliseconds' : 1, + 'Seconds' : 1e3, + 'Minutes' : 6e4, + 'Hours' : 36e5, + 'Days' : 864e5, + 'Months' : 2592e6, + 'Years' : 31536e6 + }, + + unitAliases = { + ms : 'millisecond', + s : 'second', + m : 'minute', + h : 'hour', + d : 'day', + D : 'date', + w : 'week', + W : 'isoWeek', + M : 'month', + Q : 'quarter', + y : 'year', + DDD : 'dayOfYear', + e : 'weekday', + E : 'isoWeekday', + gg: 'weekYear', + GG: 'isoWeekYear' + }, + + camelFunctions = { + dayofyear : 'dayOfYear', + isoweekday : 'isoWeekday', + isoweek : 'isoWeek', + weekyear : 'weekYear', + isoweekyear : 'isoWeekYear' + }, + + // format function strings + formatFunctions = {}, + + // default relative time thresholds + relativeTimeThresholds = { + s: 45, //seconds to minutes + m: 45, //minutes to hours + h: 22, //hours to days + dd: 25, //days to month (month == 1) + dm: 45, //days to months (months > 1) + dy: 345 //days to year + }, + + // tokens to ordinalize and pad + ordinalizeTokens = 'DDD w W M D d'.split(' '), + paddedTokens = 'M D H h m s w W'.split(' '), + + formatTokenFunctions = { + M : function () { + return this.month() + 1; + }, + MMM : function (format) { + return this.lang().monthsShort(this, format); + }, + MMMM : function (format) { + return this.lang().months(this, format); + }, + D : function () { + return this.date(); + }, + DDD : function () { + return this.dayOfYear(); + }, + d : function () { + return this.day(); + }, + dd : function (format) { + return this.lang().weekdaysMin(this, format); + }, + ddd : function (format) { + return this.lang().weekdaysShort(this, format); + }, + dddd : function (format) { + return this.lang().weekdays(this, format); + }, + w : function () { + return this.week(); + }, + W : function () { + return this.isoWeek(); + }, + YY : function () { + return leftZeroFill(this.year() % 100, 2); + }, + YYYY : function () { + return leftZeroFill(this.year(), 4); + }, + YYYYY : function () { + return leftZeroFill(this.year(), 5); + }, + YYYYYY : function () { + var y = this.year(), sign = y >= 0 ? '+' : '-'; + return sign + leftZeroFill(Math.abs(y), 6); + }, + gg : function () { + return leftZeroFill(this.weekYear() % 100, 2); + }, + gggg : function () { + return leftZeroFill(this.weekYear(), 4); + }, + ggggg : function () { + return leftZeroFill(this.weekYear(), 5); + }, + GG : function () { + return leftZeroFill(this.isoWeekYear() % 100, 2); + }, + GGGG : function () { + return leftZeroFill(this.isoWeekYear(), 4); + }, + GGGGG : function () { + return leftZeroFill(this.isoWeekYear(), 5); + }, + e : function () { + return this.weekday(); + }, + E : function () { + return this.isoWeekday(); + }, + a : function () { + return this.lang().meridiem(this.hours(), this.minutes(), true); + }, + A : function () { + return this.lang().meridiem(this.hours(), this.minutes(), false); + }, + H : function () { + return this.hours(); + }, + h : function () { + return this.hours() % 12 || 12; + }, + m : function () { + return this.minutes(); + }, + s : function () { + return this.seconds(); + }, + S : function () { + return toInt(this.milliseconds() / 100); + }, + SS : function () { + return leftZeroFill(toInt(this.milliseconds() / 10), 2); + }, + SSS : function () { + return leftZeroFill(this.milliseconds(), 3); + }, + SSSS : function () { + return leftZeroFill(this.milliseconds(), 3); + }, + Z : function () { + var a = -this.zone(), + b = "+"; + if (a < 0) { + a = -a; + b = "-"; + } + return b + leftZeroFill(toInt(a / 60), 2) + ":" + leftZeroFill(toInt(a) % 60, 2); + }, + ZZ : function () { + var a = -this.zone(), + b = "+"; + if (a < 0) { + a = -a; + b = "-"; + } + return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2); + }, + z : function () { + return this.zoneAbbr(); + }, + zz : function () { + return this.zoneName(); + }, + X : function () { + return this.unix(); + }, + Q : function () { + return this.quarter(); + } + }, + + lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin']; - if (options.physics) { - if (options.physics.barnesHut) { - this.constants.physics.barnesHut.enabled = true; - for (prop in options.physics.barnesHut) { - if (options.physics.barnesHut.hasOwnProperty(prop)) { - this.constants.physics.barnesHut[prop] = options.physics.barnesHut[prop]; + // Pick the first defined of two or three arguments. dfl comes from + // default. + function dfl(a, b, c) { + switch (arguments.length) { + case 2: return a != null ? a : b; + case 3: return a != null ? a : b != null ? b : c; + default: throw new Error("Implement me"); } - } } - if (options.physics.repulsion) { - this.constants.physics.barnesHut.enabled = false; - for (prop in options.physics.repulsion) { - if (options.physics.repulsion.hasOwnProperty(prop)) { - this.constants.physics.repulsion[prop] = options.physics.repulsion[prop]; - } - } + function defaultParsingFlags() { + // We need to deep clone this object, and es5 standard is not very + // helpful. + return { + empty : false, + unusedTokens : [], + unusedInput : [], + overflow : -2, + charsLeftOver : 0, + nullInput : false, + invalidMonth : null, + invalidFormat : false, + userInvalidated : false, + iso: false + }; } - if (options.physics.hierarchicalRepulsion) { - this.constants.hierarchicalLayout.enabled = true; - this.constants.physics.hierarchicalRepulsion.enabled = true; - this.constants.physics.barnesHut.enabled = false; - for (prop in options.physics.hierarchicalRepulsion) { - if (options.physics.hierarchicalRepulsion.hasOwnProperty(prop)) { - this.constants.physics.hierarchicalRepulsion[prop] = options.physics.hierarchicalRepulsion[prop]; + function deprecate(msg, fn) { + var firstTime = true; + function printMsg() { + if (moment.suppressDeprecationWarnings === false && + typeof console !== 'undefined' && console.warn) { + console.warn("Deprecation warning: " + msg); + } } - } + return extend(function () { + if (firstTime) { + printMsg(); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); } - } - if (options.hierarchicalLayout) { - this.constants.hierarchicalLayout.enabled = true; - for (prop in options.hierarchicalLayout) { - if (options.hierarchicalLayout.hasOwnProperty(prop)) { - this.constants.hierarchicalLayout[prop] = options.hierarchicalLayout[prop]; - } + function padToken(func, count) { + return function (a) { + return leftZeroFill(func.call(this, a), count); + }; } - } - else if (options.hierarchicalLayout !== undefined) { - this.constants.hierarchicalLayout.enabled = false; - } - - if (options.clustering) { - this.constants.clustering.enabled = true; - for (prop in options.clustering) { - if (options.clustering.hasOwnProperty(prop)) { - this.constants.clustering[prop] = options.clustering[prop]; - } + function ordinalizeToken(func, period) { + return function (a) { + return this.lang().ordinal(func.call(this, a), period); + }; } - } - else if (options.clustering !== undefined) { - this.constants.clustering.enabled = false; - } - if (options.navigation) { - this.constants.navigation.enabled = true; - for (prop in options.navigation) { - if (options.navigation.hasOwnProperty(prop)) { - this.constants.navigation[prop] = options.navigation[prop]; - } + while (ordinalizeTokens.length) { + i = ordinalizeTokens.pop(); + formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i); } - } - else if (options.navigation !== undefined) { - this.constants.navigation.enabled = false; - } - - if (options.keyboard) { - this.constants.keyboard.enabled = true; - for (prop in options.keyboard) { - if (options.keyboard.hasOwnProperty(prop)) { - this.constants.keyboard[prop] = options.keyboard[prop]; - } + while (paddedTokens.length) { + i = paddedTokens.pop(); + formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2); } - } - else if (options.keyboard !== undefined) { - this.constants.keyboard.enabled = false; - } + formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3); - if (options.dataManipulation) { - this.constants.dataManipulation.enabled = true; - for (prop in options.dataManipulation) { - if (options.dataManipulation.hasOwnProperty(prop)) { - this.constants.dataManipulation[prop] = options.dataManipulation[prop]; - } - } - this.editMode = this.constants.dataManipulation.initiallyVisible; - } - else if (options.dataManipulation !== undefined) { - this.constants.dataManipulation.enabled = false; - } - // TODO: work out these options and document them - if (options.edges) { - for (prop in options.edges) { - if (options.edges.hasOwnProperty(prop)) { - if (typeof options.edges[prop] != "object") { - this.constants.edges[prop] = options.edges[prop]; - } - } - } + /************************************ + Constructors + ************************************/ + function Language() { - if (options.edges.color !== undefined) { - if (util.isString(options.edges.color)) { - this.constants.edges.color = {}; - this.constants.edges.color.color = options.edges.color; - this.constants.edges.color.highlight = options.edges.color; - this.constants.edges.color.hover = options.edges.color; - } - else { - if (options.edges.color.color !== undefined) {this.constants.edges.color.color = options.edges.color.color;} - if (options.edges.color.highlight !== undefined) {this.constants.edges.color.highlight = options.edges.color.highlight;} - if (options.edges.color.hover !== undefined) {this.constants.edges.color.hover = options.edges.color.hover;} - } } - if (!options.edges.fontColor) { - if (options.edges.color !== undefined) { - if (util.isString(options.edges.color)) {this.constants.edges.fontColor = options.edges.color;} - else if (options.edges.color.color !== undefined) {this.constants.edges.fontColor = options.edges.color.color;} - } + // Moment prototype object + function Moment(config) { + checkOverflow(config); + extend(this, config); } - // Added to support dashed lines - // David Jordan - // 2012-08-08 - if (options.edges.dash) { - if (options.edges.dash.length !== undefined) { - this.constants.edges.dash.length = options.edges.dash.length; - } - if (options.edges.dash.gap !== undefined) { - this.constants.edges.dash.gap = options.edges.dash.gap; - } - if (options.edges.dash.altLength !== undefined) { - this.constants.edges.dash.altLength = options.edges.dash.altLength; - } - } - } + // Duration Constructor + function Duration(duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; - if (options.nodes) { - for (prop in options.nodes) { - if (options.nodes.hasOwnProperty(prop)) { - this.constants.nodes[prop] = options.nodes[prop]; - } - } + // representation for dateAddRemove + this._milliseconds = +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 36e5; // 1000 * 60 * 60 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + + weeks * 7; + // It is impossible translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + + quarters * 3 + + years * 12; - if (options.nodes.color) { - this.constants.nodes.color = util.parseColor(options.nodes.color); + this._data = {}; + + this._bubble(); } - /* - if (options.nodes.widthMin) this.constants.nodes.radiusMin = options.nodes.widthMin; - if (options.nodes.widthMax) this.constants.nodes.radiusMax = options.nodes.widthMax; - */ - } - if (options.groups) { - for (var groupname in options.groups) { - if (options.groups.hasOwnProperty(groupname)) { - var group = options.groups[groupname]; - this.groups.add(groupname, group); - } + /************************************ + Helpers + ************************************/ + + + function extend(a, b) { + for (var i in b) { + if (b.hasOwnProperty(i)) { + a[i] = b[i]; + } + } + + if (b.hasOwnProperty("toString")) { + a.toString = b.toString; + } + + if (b.hasOwnProperty("valueOf")) { + a.valueOf = b.valueOf; + } + + return a; } - } - if (options.tooltip) { - for (prop in options.tooltip) { - if (options.tooltip.hasOwnProperty(prop)) { - this.constants.tooltip[prop] = options.tooltip[prop]; - } + function cloneMoment(m) { + var result = {}, i; + for (i in m) { + if (m.hasOwnProperty(i) && momentProperties.hasOwnProperty(i)) { + result[i] = m[i]; + } + } + + return result; } - if (options.tooltip.color) { - this.constants.tooltip.color = util.parseColor(options.tooltip.color); - } - } - } + function absRound(number) { + if (number < 0) { + return Math.ceil(number); + } else { + return Math.floor(number); + } + } - // (Re)loading the mixins that can be enabled or disabled in the options. - // load the force calculation functions, grouped under the physics system. - this._loadPhysicsSystem(); - // load the navigation system. - this._loadNavigationControls(); - // load the data manipulation system - this._loadManipulationSystem(); - // configure the smooth curves - this._configureSmoothCurves(); + // left zero fill a number + // see http://jsperf.com/left-zero-filling for performance comparison + function leftZeroFill(number, targetLength, forceSign) { + var output = '' + Math.abs(number), + sign = number >= 0; + while (output.length < targetLength) { + output = '0' + output; + } + return (sign ? (forceSign ? '+' : '') : '-') + output; + } - // bind keys. If disabled, this will not do anything; - this._createKeyBinds(); - this.setSize(this.width, this.height); - this.moving = true; - this.start(); + // helper function for _.addTime and _.subtractTime + function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = duration._days, + months = duration._months; + updateOffset = updateOffset == null ? true : updateOffset; -}; + if (milliseconds) { + mom._d.setTime(+mom._d + milliseconds * isAdding); + } + if (days) { + rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding); + } + if (months) { + rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding); + } + if (updateOffset) { + moment.updateOffset(mom, days || months); + } + } -/** - * Create the main frame for the Network. - * This function is executed once when a Network object is created. The frame - * contains a canvas, and this canvas contains all objects like the axis and - * nodes. - * @private - */ -Network.prototype._create = function () { - // remove all elements from the container element. - while (this.containerElement.hasChildNodes()) { - this.containerElement.removeChild(this.containerElement.firstChild); - } + // check if is an array + function isArray(input) { + return Object.prototype.toString.call(input) === '[object Array]'; + } - this.frame = document.createElement('div'); - this.frame.className = 'network-frame'; - this.frame.style.position = 'relative'; - this.frame.style.overflow = 'hidden'; - - // create the network canvas (HTML canvas element) - this.frame.canvas = document.createElement( 'canvas' ); - this.frame.canvas.style.position = 'relative'; - this.frame.appendChild(this.frame.canvas); - if (!this.frame.canvas.getContext) { - var noCanvas = document.createElement( 'DIV' ); - noCanvas.style.color = 'red'; - noCanvas.style.fontWeight = 'bold' ; - noCanvas.style.padding = '10px'; - noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; - this.frame.canvas.appendChild(noCanvas); - } + function isDate(input) { + return Object.prototype.toString.call(input) === '[object Date]' || + input instanceof Date; + } - var me = this; - this.drag = {}; - this.pinch = {}; - this.hammer = Hammer(this.frame.canvas, { - prevent_default: true - }); - this.hammer.on('tap', me._onTap.bind(me) ); - this.hammer.on('doubletap', me._onDoubleTap.bind(me) ); - this.hammer.on('hold', me._onHold.bind(me) ); - this.hammer.on('pinch', me._onPinch.bind(me) ); - this.hammer.on('touch', me._onTouch.bind(me) ); - this.hammer.on('dragstart', me._onDragStart.bind(me) ); - this.hammer.on('drag', me._onDrag.bind(me) ); - this.hammer.on('dragend', me._onDragEnd.bind(me) ); - this.hammer.on('release', me._onRelease.bind(me) ); - this.hammer.on('mousewheel',me._onMouseWheel.bind(me) ); - this.hammer.on('DOMMouseScroll',me._onMouseWheel.bind(me) ); // for FF - this.hammer.on('mousemove', me._onMouseMoveTitle.bind(me) ); - - // add the frame to the container element - this.containerElement.appendChild(this.frame); - -}; + // compare two arrays, return the number of differences + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ((dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { + diffs++; + } + } + return diffs + lengthDiff; + } + function normalizeUnits(units) { + if (units) { + var lowered = units.toLowerCase().replace(/(.)s$/, '$1'); + units = unitAliases[units] || camelFunctions[lowered] || lowered; + } + return units; + } -/** - * Binding the keys for keyboard navigation. These functions are defined in the NavigationMixin - * @private - */ -Network.prototype._createKeyBinds = function() { - var me = this; - this.mousetrap = mousetrap; - - this.mousetrap.reset(); - - if (this.constants.keyboard.enabled == true) { - this.mousetrap.bind("up", this._moveUp.bind(me) , "keydown"); - this.mousetrap.bind("up", this._yStopMoving.bind(me), "keyup"); - this.mousetrap.bind("down", this._moveDown.bind(me) , "keydown"); - this.mousetrap.bind("down", this._yStopMoving.bind(me), "keyup"); - this.mousetrap.bind("left", this._moveLeft.bind(me) , "keydown"); - this.mousetrap.bind("left", this._xStopMoving.bind(me), "keyup"); - this.mousetrap.bind("right",this._moveRight.bind(me), "keydown"); - this.mousetrap.bind("right",this._xStopMoving.bind(me), "keyup"); - this.mousetrap.bind("=", this._zoomIn.bind(me), "keydown"); - this.mousetrap.bind("=", this._stopZoom.bind(me), "keyup"); - this.mousetrap.bind("-", this._zoomOut.bind(me), "keydown"); - this.mousetrap.bind("-", this._stopZoom.bind(me), "keyup"); - this.mousetrap.bind("[", this._zoomIn.bind(me), "keydown"); - this.mousetrap.bind("[", this._stopZoom.bind(me), "keyup"); - this.mousetrap.bind("]", this._zoomOut.bind(me), "keydown"); - this.mousetrap.bind("]", this._stopZoom.bind(me), "keyup"); - this.mousetrap.bind("pageup",this._zoomIn.bind(me), "keydown"); - this.mousetrap.bind("pageup",this._stopZoom.bind(me), "keyup"); - this.mousetrap.bind("pagedown",this._zoomOut.bind(me),"keydown"); - this.mousetrap.bind("pagedown",this._stopZoom.bind(me), "keyup"); - } + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; - if (this.constants.dataManipulation.enabled == true) { - this.mousetrap.bind("escape",this._createManipulatorBar.bind(me)); - this.mousetrap.bind("del",this._deleteSelected.bind(me)); - } -}; + for (prop in inputObject) { + if (inputObject.hasOwnProperty(prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } -/** - * Get the pointer location from a touch location - * @param {{pageX: Number, pageY: Number}} touch - * @return {{x: Number, y: Number}} pointer - * @private - */ -Network.prototype._getPointer = function (touch) { - return { - x: touch.pageX - vis.util.getAbsoluteLeft(this.frame.canvas), - y: touch.pageY - vis.util.getAbsoluteTop(this.frame.canvas) - }; -}; + return normalizedInput; + } -/** - * On start of a touch gesture, store the pointer - * @param event - * @private - */ -Network.prototype._onTouch = function (event) { - this.drag.pointer = this._getPointer(event.gesture.center); - this.drag.pinched = false; - this.pinch.scale = this._getScale(); + function makeList(field) { + var count, setter; - this._handleTouch(this.drag.pointer); -}; + if (field.indexOf('week') === 0) { + count = 7; + setter = 'day'; + } + else if (field.indexOf('month') === 0) { + count = 12; + setter = 'month'; + } + else { + return; + } -/** - * handle drag start event - * @private - */ -Network.prototype._onDragStart = function () { - this._handleDragStart(); -}; + moment[field] = function (format, index) { + var i, getter, + method = moment.fn._lang[field], + results = []; + if (typeof format === 'number') { + index = format; + format = undefined; + } -/** - * This function is called by _onDragStart. - * It is separated out because we can then overload it for the datamanipulation system. - * - * @private - */ -Network.prototype._handleDragStart = function() { - var drag = this.drag; - var node = this._getNodeAt(drag.pointer); - // note: drag.pointer is set in _onTouch to get the initial touch location - - drag.dragging = true; - drag.selection = []; - drag.translation = this._getTranslation(); - drag.nodeId = null; - - if (node != null) { - drag.nodeId = node.id; - // select the clicked node if not yet selected - if (!node.isSelected()) { - this._selectObject(node,false); - } + getter = function (i) { + var m = moment().utc().set(setter, i); + return method.call(moment.fn._lang, m, format || ''); + }; - // create an array with the selected nodes and their original location and status - for (var objectId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(objectId)) { - var object = this.selectionObj.nodes[objectId]; - var s = { - id: object.id, - node: object, + if (index != null) { + return getter(index); + } + else { + for (i = 0; i < count; i++) { + results.push(getter(i)); + } + return results; + } + }; + } - // store original x, y, xFixed and yFixed, make the node temporarily Fixed - x: object.x, - y: object.y, - xFixed: object.xFixed, - yFixed: object.yFixed - }; + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; - object.xFixed = true; - object.yFixed = true; + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + if (coercedNumber >= 0) { + value = Math.floor(coercedNumber); + } else { + value = Math.ceil(coercedNumber); + } + } - drag.selection.push(s); + return value; } - } - } -}; - -/** - * handle drag event - * @private - */ -Network.prototype._onDrag = function (event) { - this._handleOnDrag(event) -}; + function daysInMonth(year, month) { + return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); + } + function weeksInYear(year, dow, doy) { + return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week; + } -/** - * This function is called by _onDrag. - * It is separated out because we can then overload it for the datamanipulation system. - * - * @private - */ -Network.prototype._handleOnDrag = function(event) { - if (this.drag.pinched) { - return; - } + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } - var pointer = this._getPointer(event.gesture.center); + function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + } - var me = this, - drag = this.drag, - selection = drag.selection; - if (selection && selection.length && this.constants.dragNodes == true) { - // calculate delta's and new location - var deltaX = pointer.x - drag.pointer.x, - deltaY = pointer.y - drag.pointer.y; + function checkOverflow(m) { + var overflow; + if (m._a && m._pf.overflow === -2) { + overflow = + m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH : + m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE : + m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR : + m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE : + m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND : + m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND : + -1; - // update position of all selected nodes - selection.forEach(function (s) { - var node = s.node; + if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { + overflow = DATE; + } - if (!s.xFixed) { - node.x = me._XconvertDOMtoCanvas(me._XconvertCanvasToDOM(s.x) + deltaX); + m._pf.overflow = overflow; + } } - if (!s.yFixed) { - node.y = me._YconvertDOMtoCanvas(me._YconvertCanvasToDOM(s.y) + deltaY); + function isValid(m) { + if (m._isValid == null) { + m._isValid = !isNaN(m._d.getTime()) && + m._pf.overflow < 0 && + !m._pf.empty && + !m._pf.invalidMonth && + !m._pf.nullInput && + !m._pf.invalidFormat && + !m._pf.userInvalidated; + + if (m._strict) { + m._isValid = m._isValid && + m._pf.charsLeftOver === 0 && + m._pf.unusedTokens.length === 0; + } + } + return m._isValid; } - }); - - // start _animationStep if not yet running - if (!this.moving) { - this.moving = true; - this.start(); - } - } - else { - if (this.constants.dragNetwork == true) { - // move the network - var diffX = pointer.x - this.drag.pointer.x; - var diffY = pointer.y - this.drag.pointer.y; - - this._setTranslation( - this.drag.translation.x + diffX, - this.drag.translation.y + diffY); - this._redraw(); - this.moving = true; - this.start(); - } - } -}; - -/** - * handle drag start event - * @private - */ -Network.prototype._onDragEnd = function () { - this.drag.dragging = false; - var selection = this.drag.selection; - if (selection) { - selection.forEach(function (s) { - // restore original xFixed and yFixed - s.node.xFixed = s.xFixed; - s.node.yFixed = s.yFixed; - }); - } -}; -/** - * handle tap/click event: select/unselect a node - * @private - */ -Network.prototype._onTap = function (event) { - var pointer = this._getPointer(event.gesture.center); - this.pointerPosition = pointer; - this._handleTap(pointer); + function normalizeLanguage(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } -}; + // Return a moment from input, that is local/utc/zone equivalent to model. + function makeAs(input, model) { + return model._isUTC ? moment(input).zone(model._offset || 0) : + moment(input).local(); + } + /************************************ + Languages + ************************************/ -/** - * handle doubletap event - * @private - */ -Network.prototype._onDoubleTap = function (event) { - var pointer = this._getPointer(event.gesture.center); - this._handleDoubleTap(pointer); -}; + extend(Language.prototype, { -/** - * handle long tap event: multi select nodes - * @private - */ -Network.prototype._onHold = function (event) { - var pointer = this._getPointer(event.gesture.center); - this.pointerPosition = pointer; - this._handleOnHold(pointer); -}; + set : function (config) { + var prop, i; + for (i in config) { + prop = config[i]; + if (typeof prop === 'function') { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + }, -/** - * handle the release of the screen - * - * @private - */ -Network.prototype._onRelease = function (event) { - var pointer = this._getPointer(event.gesture.center); - this._handleOnRelease(pointer); -}; + _months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), + months : function (m) { + return this._months[m.month()]; + }, -/** - * Handle pinch event - * @param event - * @private - */ -Network.prototype._onPinch = function (event) { - var pointer = this._getPointer(event.gesture.center); + _monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), + monthsShort : function (m) { + return this._monthsShort[m.month()]; + }, - this.drag.pinched = true; - if (!('scale' in this.pinch)) { - this.pinch.scale = 1; - } + monthsParse : function (monthName) { + var i, mom, regex; - // TODO: enabled moving while pinching? - var scale = this.pinch.scale * event.gesture.scale; - this._zoom(scale, pointer) -}; + if (!this._monthsParse) { + this._monthsParse = []; + } -/** - * Zoom the network in or out - * @param {Number} scale a number around 1, and between 0.01 and 10 - * @param {{x: Number, y: Number}} pointer Position on screen - * @return {Number} appliedScale scale is limited within the boundaries - * @private - */ -Network.prototype._zoom = function(scale, pointer) { - if (this.constants.zoomable == true) { - var scaleOld = this._getScale(); - if (scale < 0.00001) { - scale = 0.00001; - } - if (scale > 10) { - scale = 10; - } - // + this.frame.canvas.clientHeight / 2 - var translation = this._getTranslation(); + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + if (!this._monthsParse[i]) { + mom = moment.utc([2000, i]); + regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if (this._monthsParse[i].test(monthName)) { + return i; + } + } + }, - var scaleFrac = scale / scaleOld; - var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac; - var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac; + _weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), + weekdays : function (m) { + return this._weekdays[m.day()]; + }, - this.areaCenter = {"x" : this._XconvertDOMtoCanvas(pointer.x), - "y" : this._YconvertDOMtoCanvas(pointer.y)}; + _weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), + weekdaysShort : function (m) { + return this._weekdaysShort[m.day()]; + }, - this._setScale(scale); - this._setTranslation(tx, ty); - this.updateClustersDefault(); - this._redraw(); + _weekdaysMin : "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), + weekdaysMin : function (m) { + return this._weekdaysMin[m.day()]; + }, - if (scaleOld < scale) { - this.emit("zoom", {direction:"+"}); - } - else { - this.emit("zoom", {direction:"-"}); - } + weekdaysParse : function (weekdayName) { + var i, mom, regex; - return scale; - } -}; + if (!this._weekdaysParse) { + this._weekdaysParse = []; + } + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + if (!this._weekdaysParse[i]) { + mom = moment([2000, 1]).day(i); + regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if (this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + }, -/** - * Event handler for mouse wheel event, used to zoom the timeline - * See http://adomas.org/javascript-mouse-wheel/ - * https://github.com/EightMedia/hammer.js/issues/256 - * @param {MouseEvent} event - * @private - */ -Network.prototype._onMouseWheel = function(event) { - // retrieve delta - var delta = 0; - if (event.wheelDelta) { /* IE/Opera. */ - delta = event.wheelDelta/120; - } else if (event.detail) { /* Mozilla case. */ - // In Mozilla, sign of delta is different than in IE. - // Also, delta is multiple of 3. - delta = -event.detail/3; - } + _longDateFormat : { + LT : "h:mm A", + L : "MM/DD/YYYY", + LL : "MMMM D YYYY", + LLL : "MMMM D YYYY LT", + LLLL : "dddd, MMMM D YYYY LT" + }, + longDateFormat : function (key) { + var output = this._longDateFormat[key]; + if (!output && this._longDateFormat[key.toUpperCase()]) { + output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) { + return val.slice(1); + }); + this._longDateFormat[key] = output; + } + return output; + }, - // If delta is nonzero, handle it. - // Basically, delta is now positive if wheel was scrolled up, - // and negative, if wheel was scrolled down. - if (delta) { + isPM : function (input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return ((input + '').toLowerCase().charAt(0) === 'p'); + }, - // calculate the new scale - var scale = this._getScale(); - var zoom = delta / 10; - if (delta < 0) { - zoom = zoom / (1 - zoom); - } - scale *= (1 + zoom); + _meridiemParse : /[ap]\.?m?\.?/i, + meridiem : function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } + }, - // calculate the pointer location - var gesture = util.fakeGesture(this, event); - var pointer = this._getPointer(gesture.center); + _calendar : { + sameDay : '[Today at] LT', + nextDay : '[Tomorrow at] LT', + nextWeek : 'dddd [at] LT', + lastDay : '[Yesterday at] LT', + lastWeek : '[Last] dddd [at] LT', + sameElse : 'L' + }, + calendar : function (key, mom) { + var output = this._calendar[key]; + return typeof output === 'function' ? output.apply(mom) : output; + }, - // apply the new scale - this._zoom(scale, pointer); - } + _relativeTime : { + future : "in %s", + past : "%s ago", + s : "a few seconds", + m : "a minute", + mm : "%d minutes", + h : "an hour", + hh : "%d hours", + d : "a day", + dd : "%d days", + M : "a month", + MM : "%d months", + y : "a year", + yy : "%d years" + }, + relativeTime : function (number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return (typeof output === 'function') ? + output(number, withoutSuffix, string, isFuture) : + output.replace(/%d/i, number); + }, + pastFuture : function (diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return typeof format === 'function' ? format(output) : format.replace(/%s/i, output); + }, - // Prevent default actions caused by mouse wheel. - event.preventDefault(); -}; + ordinal : function (number) { + return this._ordinal.replace("%d", number); + }, + _ordinal : "%d", + preparse : function (string) { + return string; + }, -/** - * Mouse move handler for checking whether the title moves over a node with a title. - * @param {Event} event - * @private - */ -Network.prototype._onMouseMoveTitle = function (event) { - var gesture = util.fakeGesture(this, event); - var pointer = this._getPointer(gesture.center); + postformat : function (string) { + return string; + }, - // check if the previously selected node is still selected - if (this.popupObj) { - this._checkHidePopup(pointer); - } + week : function (mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + }, - // start a timeout that will check if the mouse is positioned above - // an element - var me = this; - var checkShow = function() { - me._checkShowPopup(pointer); - }; - if (this.popupTimer) { - clearInterval(this.popupTimer); // stop any running calculationTimer - } - if (!this.drag.dragging) { - this.popupTimer = setTimeout(checkShow, this.constants.tooltip.delay); - } + _week : { + dow : 0, // Sunday is the first day of the week. + doy : 6 // The week that contains Jan 1st is the first week of the year. + }, + _invalidDate: 'Invalid date', + invalidDate: function () { + return this._invalidDate; + } + }); - /** - * Adding hover highlights - */ - if (this.constants.hover == true) { - // removing all hover highlights - for (var edgeId in this.hoverObj.edges) { - if (this.hoverObj.edges.hasOwnProperty(edgeId)) { - this.hoverObj.edges[edgeId].hover = false; - delete this.hoverObj.edges[edgeId]; + // Loads a language definition into the `languages` cache. The function + // takes a key and optionally values. If not in the browser and no values + // are provided, it will load the language file module. As a convenience, + // this function also returns the language values. + function loadLang(key, values) { + values.abbr = key; + if (!languages[key]) { + languages[key] = new Language(); + } + languages[key].set(values); + return languages[key]; } - } - - // adding hover highlights - var obj = this._getNodeAt(pointer); - if (obj == null) { - obj = this._getEdgeAt(pointer); - } - if (obj != null) { - this._hoverObject(obj); - } - // removing all node hover highlights except for the selected one. - for (var nodeId in this.hoverObj.nodes) { - if (this.hoverObj.nodes.hasOwnProperty(nodeId)) { - if (obj instanceof Node && obj.id != nodeId || obj instanceof Edge || obj == null) { - this._blurObject(this.hoverObj.nodes[nodeId]); - delete this.hoverObj.nodes[nodeId]; - } + // Remove a language from the `languages` cache. Mostly useful in tests. + function unloadLang(key) { + delete languages[key]; } - } - this.redraw(); - } -}; -/** - * Check if there is an element on the given position in the network - * (a node or edge). If so, and if this element has a title, - * show a popup window with its title. - * - * @param {{x:Number, y:Number}} pointer - * @private - */ -Network.prototype._checkShowPopup = function (pointer) { - var obj = { - left: this._XconvertDOMtoCanvas(pointer.x), - top: this._YconvertDOMtoCanvas(pointer.y), - right: this._XconvertDOMtoCanvas(pointer.x), - bottom: this._YconvertDOMtoCanvas(pointer.y) - }; + // Determines which language definition to use and returns it. + // + // With no parameters, it will return the global language. If you + // pass in a language key, such as 'en', it will return the + // definition for 'en', so long as 'en' has already been loaded using + // moment.lang. + function getLangDefinition(key) { + var i = 0, j, lang, next, split, + get = function (k) { + if (!languages[k] && hasModule) { + try { + __webpack_require__(56)("./" + k); + } catch (e) { } + } + return languages[k]; + }; + + if (!key) { + return moment.fn._lang; + } - var id; - var lastPopupNode = this.popupObj; + if (!isArray(key)) { + //short-circuit everything else + lang = get(key); + if (lang) { + return lang; + } + key = [key]; + } - if (this.popupObj == undefined) { - // search the nodes for overlap, select the top one in case of multiple nodes - var nodes = this.nodes; - for (id in nodes) { - if (nodes.hasOwnProperty(id)) { - var node = nodes[id]; - if (node.getTitle() !== undefined && node.isOverlappingWith(obj)) { - this.popupObj = node; - break; - } + //pick the language from the array + //try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + //substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + while (i < key.length) { + split = normalizeLanguage(key[i]).split('-'); + j = split.length; + next = normalizeLanguage(key[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + lang = get(split.slice(0, j).join('-')); + if (lang) { + return lang; + } + if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { + //the next array item is better than a shallower substring of this one + break; + } + j--; + } + i++; + } + return moment.fn._lang; } - } - } - if (this.popupObj === undefined) { - // search the edges for overlap - var edges = this.edges; - for (id in edges) { - if (edges.hasOwnProperty(id)) { - var edge = edges[id]; - if (edge.connected && (edge.getTitle() !== undefined) && - edge.isOverlappingWith(obj)) { - this.popupObj = edge; - break; - } - } - } - } + /************************************ + Formatting + ************************************/ - if (this.popupObj) { - // show popup message window - if (this.popupObj != lastPopupNode) { - var me = this; - if (!me.popup) { - me.popup = new Popup(me.frame, me.constants.tooltip); + + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ""); + } + return input.replace(/\\/g, ""); } - // adjust a small offset such that the mouse cursor is located in the - // bottom left location of the popup, and you can easily move over the - // popup area - me.popup.setPosition(pointer.x - 3, pointer.y - 3); - me.popup.setText(me.popupObj.getTitle()); - me.popup.show(); - } - } - else { - if (this.popup) { - this.popup.hide(); - } - } -}; + function makeFormatFunction(format) { + var array = format.match(formattingTokens), i, length; + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } -/** - * Check if the popup must be hided, which is the case when the mouse is no - * longer hovering on the object - * @param {{x:Number, y:Number}} pointer - * @private - */ -Network.prototype._checkHidePopup = function (pointer) { - if (!this.popupObj || !this._getNodeAt(pointer) ) { - this.popupObj = undefined; - if (this.popup) { - this.popup.hide(); - } - } -}; + return function (mom) { + var output = ""; + for (i = 0; i < length; i++) { + output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; + } + return output; + }; + } + // format date using native date object + function formatMoment(m, format) { -/** - * Set a new size for the network - * @param {string} width Width in pixels or percentage (for example '800px' - * or '50%') - * @param {string} height Height in pixels or percentage (for example '400px' - * or '30%') - */ -Network.prototype.setSize = function(width, height) { - this.frame.style.width = width; - this.frame.style.height = height; + if (!m.isValid()) { + return m.lang().invalidDate(); + } - this.frame.canvas.style.width = '100%'; - this.frame.canvas.style.height = '100%'; + format = expandFormat(format, m.lang()); - this.frame.canvas.width = this.frame.canvas.clientWidth; - this.frame.canvas.height = this.frame.canvas.clientHeight; + if (!formatFunctions[format]) { + formatFunctions[format] = makeFormatFunction(format); + } - if (this.manipulationDiv !== undefined) { - this.manipulationDiv.style.width = this.frame.canvas.clientWidth + "px"; - } - if (this.navigationDivs !== undefined) { - if (this.navigationDivs['wrapper'] !== undefined) { - this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; - this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; - } - } + return formatFunctions[format](m); + } - this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height}); -}; + function expandFormat(format, lang) { + var i = 5; -/** - * Set a data set with nodes for the network - * @param {Array | DataSet | DataView} nodes The data containing the nodes. - * @private - */ -Network.prototype._setNodes = function(nodes) { - var oldNodesData = this.nodesData; + function replaceLongDateFormatTokens(input) { + return lang.longDateFormat(input) || input; + } - if (nodes instanceof DataSet || nodes instanceof DataView) { - this.nodesData = nodes; - } - else if (nodes instanceof Array) { - this.nodesData = new DataSet(); - this.nodesData.add(nodes); - } - else if (!nodes) { - this.nodesData = new DataSet(); - } - else { - throw new TypeError('Array or DataSet expected'); - } + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); + localFormattingTokens.lastIndex = 0; + i -= 1; + } - if (oldNodesData) { - // unsubscribe from old dataset - util.forEach(this.nodesListeners, function (callback, event) { - oldNodesData.off(event, callback); - }); - } + return format; + } + + + /************************************ + Parsing + ************************************/ + + + // get the regex to find the next token + function getParseRegexForToken(token, config) { + var a, strict = config._strict; + switch (token) { + case 'Q': + return parseTokenOneDigit; + case 'DDDD': + return parseTokenThreeDigits; + case 'YYYY': + case 'GGGG': + case 'gggg': + return strict ? parseTokenFourDigits : parseTokenOneToFourDigits; + case 'Y': + case 'G': + case 'g': + return parseTokenSignedNumber; + case 'YYYYYY': + case 'YYYYY': + case 'GGGGG': + case 'ggggg': + return strict ? parseTokenSixDigits : parseTokenOneToSixDigits; + case 'S': + if (strict) { return parseTokenOneDigit; } + /* falls through */ + case 'SS': + if (strict) { return parseTokenTwoDigits; } + /* falls through */ + case 'SSS': + if (strict) { return parseTokenThreeDigits; } + /* falls through */ + case 'DDD': + return parseTokenOneToThreeDigits; + case 'MMM': + case 'MMMM': + case 'dd': + case 'ddd': + case 'dddd': + return parseTokenWord; + case 'a': + case 'A': + return getLangDefinition(config._l)._meridiemParse; + case 'X': + return parseTokenTimestampMs; + case 'Z': + case 'ZZ': + return parseTokenTimezone; + case 'T': + return parseTokenT; + case 'SSSS': + return parseTokenDigits; + case 'MM': + case 'DD': + case 'YY': + case 'GG': + case 'gg': + case 'HH': + case 'hh': + case 'mm': + case 'ss': + case 'ww': + case 'WW': + return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits; + case 'M': + case 'D': + case 'd': + case 'H': + case 'h': + case 'm': + case 's': + case 'w': + case 'W': + case 'e': + case 'E': + return parseTokenOneOrTwoDigits; + case 'Do': + return parseTokenOrdinal; + default : + a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i")); + return a; + } + } - // remove drawn nodes - this.nodes = {}; + function timezoneMinutesFromString(string) { + string = string || ""; + var possibleTzMatches = (string.match(parseTokenTimezone) || []), + tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [], + parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0], + minutes = +(parts[1] * 60) + toInt(parts[2]); - if (this.nodesData) { - // subscribe to new dataset - var me = this; - util.forEach(this.nodesListeners, function (callback, event) { - me.nodesData.on(event, callback); - }); + return parts[0] === '+' ? -minutes : minutes; + } - // draw all new nodes - var ids = this.nodesData.getIds(); - this._addNodes(ids); - } - this._updateSelection(); -}; + // function to convert string input to date + function addTimeToArrayFromToken(token, input, config) { + var a, datePartArray = config._a; -/** - * Add nodes - * @param {Number[] | String[]} ids - * @private - */ -Network.prototype._addNodes = function(ids) { - var id; - for (var i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - var data = this.nodesData.get(id); - var node = new Node(data, this.images, this.groups, this.constants); - this.nodes[id] = node; // note: this may replace an existing node - - if ((node.xFixed == false || node.yFixed == false) && (node.x === null || node.y === null)) { - var radius = 10 * 0.1*ids.length; - var angle = 2 * Math.PI * Math.random(); - if (node.xFixed == false) {node.x = radius * Math.cos(angle);} - if (node.yFixed == false) {node.y = radius * Math.sin(angle);} - } - this.moving = true; - } - this._updateNodeIndexList(); - if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { - this._resetLevels(); - this._setupHierarchicalLayout(); - } - this._updateCalculationNodes(); - this._reconnectEdges(); - this._updateValueRange(this.nodes); - this.updateLabels(); -}; + switch (token) { + // QUARTER + case 'Q': + if (input != null) { + datePartArray[MONTH] = (toInt(input) - 1) * 3; + } + break; + // MONTH + case 'M' : // fall through to MM + case 'MM' : + if (input != null) { + datePartArray[MONTH] = toInt(input) - 1; + } + break; + case 'MMM' : // fall through to MMMM + case 'MMMM' : + a = getLangDefinition(config._l).monthsParse(input); + // if we didn't find a month name, mark the date as invalid. + if (a != null) { + datePartArray[MONTH] = a; + } else { + config._pf.invalidMonth = input; + } + break; + // DAY OF MONTH + case 'D' : // fall through to DD + case 'DD' : + if (input != null) { + datePartArray[DATE] = toInt(input); + } + break; + case 'Do' : + if (input != null) { + datePartArray[DATE] = toInt(parseInt(input, 10)); + } + break; + // DAY OF YEAR + case 'DDD' : // fall through to DDDD + case 'DDDD' : + if (input != null) { + config._dayOfYear = toInt(input); + } -/** - * Update existing nodes, or create them when not yet existing - * @param {Number[] | String[]} ids - * @private - */ -Network.prototype._updateNodes = function(ids) { - var nodes = this.nodes, - nodesData = this.nodesData; - for (var i = 0, len = ids.length; i < len; i++) { - var id = ids[i]; - var node = nodes[id]; - var data = nodesData.get(id); - if (node) { - // update node - node.setProperties(data, this.constants); - } - else { - // create node - node = new Node(properties, this.images, this.groups, this.constants); - nodes[id] = node; - } - } - this.moving = true; - if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { - this._resetLevels(); - this._setupHierarchicalLayout(); - } - this._updateNodeIndexList(); - this._reconnectEdges(); - this._updateValueRange(nodes); -}; + break; + // YEAR + case 'YY' : + datePartArray[YEAR] = moment.parseTwoDigitYear(input); + break; + case 'YYYY' : + case 'YYYYY' : + case 'YYYYYY' : + datePartArray[YEAR] = toInt(input); + break; + // AM / PM + case 'a' : // fall through to A + case 'A' : + config._isPm = getLangDefinition(config._l).isPM(input); + break; + // 24 HOUR + case 'H' : // fall through to hh + case 'HH' : // fall through to hh + case 'h' : // fall through to hh + case 'hh' : + datePartArray[HOUR] = toInt(input); + break; + // MINUTE + case 'm' : // fall through to mm + case 'mm' : + datePartArray[MINUTE] = toInt(input); + break; + // SECOND + case 's' : // fall through to ss + case 'ss' : + datePartArray[SECOND] = toInt(input); + break; + // MILLISECOND + case 'S' : + case 'SS' : + case 'SSS' : + case 'SSSS' : + datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000); + break; + // UNIX TIMESTAMP WITH MS + case 'X': + config._d = new Date(parseFloat(input) * 1000); + break; + // TIMEZONE + case 'Z' : // fall through to ZZ + case 'ZZ' : + config._useUTC = true; + config._tzm = timezoneMinutesFromString(input); + break; + // WEEKDAY - human + case 'dd': + case 'ddd': + case 'dddd': + a = getLangDefinition(config._l).weekdaysParse(input); + // if we didn't get a weekday name, mark the date as invalid + if (a != null) { + config._w = config._w || {}; + config._w['d'] = a; + } else { + config._pf.invalidWeekday = input; + } + break; + // WEEK, WEEK DAY - numeric + case 'w': + case 'ww': + case 'W': + case 'WW': + case 'd': + case 'e': + case 'E': + token = token.substr(0, 1); + /* falls through */ + case 'gggg': + case 'GGGG': + case 'GGGGG': + token = token.substr(0, 2); + if (input) { + config._w = config._w || {}; + config._w[token] = toInt(input); + } + break; + case 'gg': + case 'GG': + config._w = config._w || {}; + config._w[token] = moment.parseTwoDigitYear(input); + } + } -/** - * Remove existing nodes. If nodes do not exist, the method will just ignore it. - * @param {Number[] | String[]} ids - * @private - */ -Network.prototype._removeNodes = function(ids) { - var nodes = this.nodes; - for (var i = 0, len = ids.length; i < len; i++) { - var id = ids[i]; - delete nodes[id]; - } - this._updateNodeIndexList(); - if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { - this._resetLevels(); - this._setupHierarchicalLayout(); - } - this._updateCalculationNodes(); - this._reconnectEdges(); - this._updateSelection(); - this._updateValueRange(nodes); -}; + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, lang; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = dfl(w.GG, config._a[YEAR], weekOfYear(moment(), 1, 4).year); + week = dfl(w.W, 1); + weekday = dfl(w.E, 1); + } else { + lang = getLangDefinition(config._l); + dow = lang._week.dow; + doy = lang._week.doy; + + weekYear = dfl(w.gg, config._a[YEAR], weekOfYear(moment(), dow, doy).year); + week = dfl(w.w, 1); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < dow) { + ++week; + } + } else if (w.e != null) { + // local weekday -- counting starts from begining of week + weekday = w.e + dow; + } else { + // default to begining of week + weekday = dow; + } + } + temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow); -/** - * Load edges by reading the data table - * @param {Array | DataSet | DataView} edges The data containing the edges. - * @private - * @private - */ -Network.prototype._setEdges = function(edges) { - var oldEdgesData = this.edgesData; + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } - if (edges instanceof DataSet || edges instanceof DataView) { - this.edgesData = edges; - } - else if (edges instanceof Array) { - this.edgesData = new DataSet(); - this.edgesData.add(edges); - } - else if (!edges) { - this.edgesData = new DataSet(); - } - else { - throw new TypeError('Array or DataSet expected'); - } + // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] + function dateFromConfig(config) { + var i, date, input = [], currentDate, yearToUse; - if (oldEdgesData) { - // unsubscribe from old dataset - util.forEach(this.edgesListeners, function (callback, event) { - oldEdgesData.off(event, callback); - }); - } + if (config._d) { + return; + } - // remove drawn edges - this.edges = {}; + currentDate = currentDateArray(config); - if (this.edgesData) { - // subscribe to new dataset - var me = this; - util.forEach(this.edgesListeners, function (callback, event) { - me.edgesData.on(event, callback); - }); + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } - // draw all new nodes - var ids = this.edgesData.getIds(); - this._addEdges(ids); - } + //if the day of the year is set, figure out what it is + if (config._dayOfYear) { + yearToUse = dfl(config._a[YEAR], currentDate[YEAR]); - this._reconnectEdges(); -}; + if (config._dayOfYear > daysInYear(yearToUse)) { + config._pf._overflowDayOfYear = true; + } -/** - * Add edges - * @param {Number[] | String[]} ids - * @private - */ -Network.prototype._addEdges = function (ids) { - var edges = this.edges, - edgesData = this.edgesData; + date = makeUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } - for (var i = 0, len = ids.length; i < len; i++) { - var id = ids[i]; + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } - var oldEdge = edges[id]; - if (oldEdge) { - oldEdge.disconnect(); - } + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; + } - var data = edgesData.get(id, {"showInternalIds" : true}); - edges[id] = new Edge(data, this, this.constants); - } + config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input); + // Apply timezone offset from input. The actual zone can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm); + } + } - this.moving = true; - this._updateValueRange(edges); - this._createBezierNodes(); - if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { - this._resetLevels(); - this._setupHierarchicalLayout(); - } - this._updateCalculationNodes(); -}; + function dateFromObject(config) { + var normalizedInput; -/** - * Update existing edges, or create them when not yet existing - * @param {Number[] | String[]} ids - * @private - */ -Network.prototype._updateEdges = function (ids) { - var edges = this.edges, - edgesData = this.edgesData; - for (var i = 0, len = ids.length; i < len; i++) { - var id = ids[i]; - - var data = edgesData.get(id); - var edge = edges[id]; - if (edge) { - // update edge - edge.disconnect(); - edge.setProperties(data, this.constants); - edge.connect(); - } - else { - // create edge - edge = new Edge(data, this, this.constants); - this.edges[id] = edge; - } - } + if (config._d) { + return; + } - this._createBezierNodes(); - if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { - this._resetLevels(); - this._setupHierarchicalLayout(); - } - this.moving = true; - this._updateValueRange(edges); -}; + normalizedInput = normalizeObjectUnits(config._i); + config._a = [ + normalizedInput.year, + normalizedInput.month, + normalizedInput.day, + normalizedInput.hour, + normalizedInput.minute, + normalizedInput.second, + normalizedInput.millisecond + ]; + + dateFromConfig(config); + } + + function currentDateArray(config) { + var now = new Date(); + if (config._useUTC) { + return [ + now.getUTCFullYear(), + now.getUTCMonth(), + now.getUTCDate() + ]; + } else { + return [now.getFullYear(), now.getMonth(), now.getDate()]; + } + } -/** - * Remove existing edges. Non existing ids will be ignored - * @param {Number[] | String[]} ids - * @private - */ -Network.prototype._removeEdges = function (ids) { - var edges = this.edges; - for (var i = 0, len = ids.length; i < len; i++) { - var id = ids[i]; - var edge = edges[id]; - if (edge) { - if (edge.via != null) { - delete this.sectors['support']['nodes'][edge.via.id]; - } - edge.disconnect(); - delete edges[id]; - } - } + // date from string and format string + function makeDateFromStringAndFormat(config) { - this.moving = true; - this._updateValueRange(edges); - if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { - this._resetLevels(); - this._setupHierarchicalLayout(); - } - this._updateCalculationNodes(); -}; + if (config._f === moment.ISO_8601) { + parseISO(config); + return; + } -/** - * Reconnect all edges - * @private - */ -Network.prototype._reconnectEdges = function() { - var id, - nodes = this.nodes, - edges = this.edges; - for (id in nodes) { - if (nodes.hasOwnProperty(id)) { - nodes[id].edges = []; - } - } + config._a = []; + config._pf.empty = true; + + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var lang = getLangDefinition(config._l), + string = '' + config._i, + i, parsedInput, tokens, token, skipped, + stringLength = string.length, + totalParsedInputLength = 0; + + tokens = expandFormat(config._f, lang).match(formattingTokens) || []; + + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + config._pf.unusedInput.push(skipped); + } + string = string.slice(string.indexOf(parsedInput) + parsedInput.length); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + config._pf.empty = false; + } + else { + config._pf.unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } + else if (config._strict && !parsedInput) { + config._pf.unusedTokens.push(token); + } + } - for (id in edges) { - if (edges.hasOwnProperty(id)) { - var edge = edges[id]; - edge.from = null; - edge.to = null; - edge.connect(); - } - } -}; + // add remaining unparsed input length to the string + config._pf.charsLeftOver = stringLength - totalParsedInputLength; + if (string.length > 0) { + config._pf.unusedInput.push(string); + } -/** - * Update the values of all object in the given array according to the current - * value range of the objects in the array. - * @param {Object} obj An object containing a set of Edges or Nodes - * The objects must have a method getValue() and - * setValueRange(min, max). - * @private - */ -Network.prototype._updateValueRange = function(obj) { - var id; + // handle am pm + if (config._isPm && config._a[HOUR] < 12) { + config._a[HOUR] += 12; + } + // if is 12 am, change hours to 0 + if (config._isPm === false && config._a[HOUR] === 12) { + config._a[HOUR] = 0; + } - // determine the range of the objects - var valueMin = undefined; - var valueMax = undefined; - for (id in obj) { - if (obj.hasOwnProperty(id)) { - var value = obj[id].getValue(); - if (value !== undefined) { - valueMin = (valueMin === undefined) ? value : Math.min(value, valueMin); - valueMax = (valueMax === undefined) ? value : Math.max(value, valueMax); + dateFromConfig(config); + checkOverflow(config); } - } - } - // adjust the range of all objects - if (valueMin !== undefined && valueMax !== undefined) { - for (id in obj) { - if (obj.hasOwnProperty(id)) { - obj[id].setValueRange(valueMin, valueMax); + function unescapeFormat(s) { + return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { + return p1 || p2 || p3 || p4; + }); } - } - } -}; -/** - * Redraw the network with the current data - * chart will be resized too. - */ -Network.prototype.redraw = function() { - this.setSize(this.width, this.height); - this._redraw(); -}; + // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + function regexpEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } -/** - * Redraw the network with the current data - * @private - */ -Network.prototype._redraw = function() { - var ctx = this.frame.canvas.getContext('2d'); - // clear the canvas - var w = this.frame.canvas.width; - var h = this.frame.canvas.height; - ctx.clearRect(0, 0, w, h); + // date from string and array of format strings + function makeDateFromStringAndArray(config) { + var tempConfig, + bestMoment, - // set scaling and translation - ctx.save(); - ctx.translate(this.translation.x, this.translation.y); - ctx.scale(this.scale, this.scale); + scoreToBeat, + i, + currentScore; - this.canvasTopLeft = { - "x": this._XconvertDOMtoCanvas(0), - "y": this._YconvertDOMtoCanvas(0) - }; - this.canvasBottomRight = { - "x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth), - "y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight) - }; + if (config._f.length === 0) { + config._pf.invalidFormat = true; + config._d = new Date(NaN); + return; + } - this._doInAllSectors("_drawAllSectorNodes",ctx); - this._doInAllSectors("_drawEdges",ctx); - this._doInAllSectors("_drawNodes",ctx,false); - this._doInAllSectors("_drawControlNodes",ctx); + for (i = 0; i < config._f.length; i++) { + currentScore = 0; + tempConfig = extend({}, config); + tempConfig._pf = defaultParsingFlags(); + tempConfig._f = config._f[i]; + makeDateFromStringAndFormat(tempConfig); -// this._doInSupportSector("_drawNodes",ctx,true); -// this._drawTree(ctx,"#F00F0F"); + if (!isValid(tempConfig)) { + continue; + } - // restore original scaling and translation - ctx.restore(); -}; + // if there is any input that was not parsed add a penalty for that format + currentScore += tempConfig._pf.charsLeftOver; -/** - * Set the translation of the network - * @param {Number} offsetX Horizontal offset - * @param {Number} offsetY Vertical offset - * @private - */ -Network.prototype._setTranslation = function(offsetX, offsetY) { - if (this.translation === undefined) { - this.translation = { - x: 0, - y: 0 - }; - } + //or tokens + currentScore += tempConfig._pf.unusedTokens.length * 10; - if (offsetX !== undefined) { - this.translation.x = offsetX; - } - if (offsetY !== undefined) { - this.translation.y = offsetY; - } + tempConfig._pf.score = currentScore; - this.emit('viewChanged'); -}; + if (scoreToBeat == null || currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } + } -/** - * Get the translation of the network - * @return {Object} translation An object with parameters x and y, both a number - * @private - */ -Network.prototype._getTranslation = function() { - return { - x: this.translation.x, - y: this.translation.y - }; -}; + extend(config, bestMoment || tempConfig); + } -/** - * Scale the network - * @param {Number} scale Scaling factor 1.0 is unscaled - * @private - */ -Network.prototype._setScale = function(scale) { - this.scale = scale; -}; + // date from iso format + function parseISO(config) { + var i, l, + string = config._i, + match = isoRegex.exec(string); -/** - * Get the current scale of the network - * @return {Number} scale Scaling factor 1.0 is unscaled - * @private - */ -Network.prototype._getScale = function() { - return this.scale; -}; + if (match) { + config._pf.iso = true; + for (i = 0, l = isoDates.length; i < l; i++) { + if (isoDates[i][1].exec(string)) { + // match[5] should be "T" or undefined + config._f = isoDates[i][0] + (match[6] || " "); + break; + } + } + for (i = 0, l = isoTimes.length; i < l; i++) { + if (isoTimes[i][1].exec(string)) { + config._f += isoTimes[i][0]; + break; + } + } + if (string.match(parseTokenTimezone)) { + config._f += "Z"; + } + makeDateFromStringAndFormat(config); + } else { + config._isValid = false; + } + } -/** - * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to - * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) - * @param {number} x - * @returns {number} - * @private - */ -Network.prototype._XconvertDOMtoCanvas = function(x) { - return (x - this.translation.x) / this.scale; -}; + // date from iso format or fallback + function makeDateFromString(config) { + parseISO(config); + if (config._isValid === false) { + delete config._isValid; + moment.createFromInputFallback(config); + } + } -/** - * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to - * the X coordinate in DOM-space (coordinate point in browser relative to the container div) - * @param {number} x - * @returns {number} - * @private - */ -Network.prototype._XconvertCanvasToDOM = function(x) { - return x * this.scale + this.translation.x; -}; + function makeDateFromInput(config) { + var input = config._i, + matched = aspNetJsonRegex.exec(input); + + if (input === undefined) { + config._d = new Date(); + } else if (matched) { + config._d = new Date(+matched[1]); + } else if (typeof input === 'string') { + makeDateFromString(config); + } else if (isArray(input)) { + config._a = input.slice(0); + dateFromConfig(config); + } else if (isDate(input)) { + config._d = new Date(+input); + } else if (typeof(input) === 'object') { + dateFromObject(config); + } else if (typeof(input) === 'number') { + // from milliseconds + config._d = new Date(input); + } else { + moment.createFromInputFallback(config); + } + } -/** - * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to - * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) - * @param {number} y - * @returns {number} - * @private - */ -Network.prototype._YconvertDOMtoCanvas = function(y) { - return (y - this.translation.y) / this.scale; -}; + function makeDate(y, m, d, h, M, s, ms) { + //can't just apply() to create a date: + //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply + var date = new Date(y, m, d, h, M, s, ms); -/** - * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to - * the Y coordinate in DOM-space (coordinate point in browser relative to the container div) - * @param {number} y - * @returns {number} - * @private - */ -Network.prototype._YconvertCanvasToDOM = function(y) { - return y * this.scale + this.translation.y ; -}; + //the date constructor doesn't accept years < 1970 + if (y < 1970) { + date.setFullYear(y); + } + return date; + } + function makeUTCDate(y) { + var date = new Date(Date.UTC.apply(null, arguments)); + if (y < 1970) { + date.setUTCFullYear(y); + } + return date; + } -/** - * - * @param {object} pos = {x: number, y: number} - * @returns {{x: number, y: number}} - * @constructor - */ -Network.prototype.canvasToDOM = function(pos) { - return {x:this._XconvertCanvasToDOM(pos.x),y:this._YconvertCanvasToDOM(pos.y)}; -} + function parseWeekday(input, language) { + if (typeof input === 'string') { + if (!isNaN(input)) { + input = parseInt(input, 10); + } + else { + input = language.weekdaysParse(input); + if (typeof input !== 'number') { + return null; + } + } + } + return input; + } + + /************************************ + Relative Time + ************************************/ + + + // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) { + return lang.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function relativeTime(milliseconds, withoutSuffix, lang) { + var seconds = round(Math.abs(milliseconds) / 1000), + minutes = round(seconds / 60), + hours = round(minutes / 60), + days = round(hours / 24), + years = round(days / 365), + args = seconds < relativeTimeThresholds.s && ['s', seconds] || + minutes === 1 && ['m'] || + minutes < relativeTimeThresholds.m && ['mm', minutes] || + hours === 1 && ['h'] || + hours < relativeTimeThresholds.h && ['hh', hours] || + days === 1 && ['d'] || + days <= relativeTimeThresholds.dd && ['dd', days] || + days <= relativeTimeThresholds.dm && ['M'] || + days < relativeTimeThresholds.dy && ['MM', round(days / 30)] || + years === 1 && ['y'] || ['yy', years]; + args[2] = withoutSuffix; + args[3] = milliseconds > 0; + args[4] = lang; + return substituteTimeAgo.apply({}, args); + } + + + /************************************ + Week of Year + ************************************/ + + + // firstDayOfWeek 0 = sun, 6 = sat + // the day of the week that starts the week + // (usually sunday or monday) + // firstDayOfWeekOfYear 0 = sun, 6 = sat + // the first week is the week that contains the first + // of this day of the week + // (eg. ISO weeks use thursday (4)) + function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) { + var end = firstDayOfWeekOfYear - firstDayOfWeek, + daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(), + adjustedMoment; + + + if (daysToDayOfWeek > end) { + daysToDayOfWeek -= 7; + } -/** - * - * @param {object} pos = {x: number, y: number} - * @returns {{x: number, y: number}} - * @constructor - */ -Network.prototype.DOMtoCanvas = function(pos) { - return {x:this._XconvertDOMtoCanvas(pos.x),y:this._YconvertDOMtoCanvas(pos.y)}; -} + if (daysToDayOfWeek < end - 7) { + daysToDayOfWeek += 7; + } -/** - * Redraw all nodes - * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); - * @param {CanvasRenderingContext2D} ctx - * @param {Boolean} [alwaysShow] - * @private - */ -Network.prototype._drawNodes = function(ctx,alwaysShow) { - if (alwaysShow === undefined) { - alwaysShow = false; - } + adjustedMoment = moment(mom).add('d', daysToDayOfWeek); + return { + week: Math.ceil(adjustedMoment.dayOfYear() / 7), + year: adjustedMoment.year() + }; + } - // first draw the unselected nodes - var nodes = this.nodes; - var selected = []; + //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) { + var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear; - for (var id in nodes) { - if (nodes.hasOwnProperty(id)) { - nodes[id].setScaleAndPos(this.scale,this.canvasTopLeft,this.canvasBottomRight); - if (nodes[id].isSelected()) { - selected.push(id); - } - else { - if (nodes[id].inArea() || alwaysShow) { - nodes[id].draw(ctx); - } + d = d === 0 ? 7 : d; + weekday = weekday != null ? weekday : firstDayOfWeek; + daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0); + dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1; + + return { + year: dayOfYear > 0 ? year : year - 1, + dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear + }; } - } - } - // draw the selected nodes on top - for (var s = 0, sMax = selected.length; s < sMax; s++) { - if (nodes[selected[s]].inArea() || alwaysShow) { - nodes[selected[s]].draw(ctx); - } - } -}; + /************************************ + Top Level Functions + ************************************/ -/** - * Redraw all edges - * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); - * @param {CanvasRenderingContext2D} ctx - * @private - */ -Network.prototype._drawEdges = function(ctx) { - var edges = this.edges; - for (var id in edges) { - if (edges.hasOwnProperty(id)) { - var edge = edges[id]; - edge.setScale(this.scale); - if (edge.connected) { - edges[id].draw(ctx); - } - } - } -}; + function makeMoment(config) { + var input = config._i, + format = config._f; -/** - * Redraw all edges - * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); - * @param {CanvasRenderingContext2D} ctx - * @private - */ -Network.prototype._drawControlNodes = function(ctx) { - var edges = this.edges; - for (var id in edges) { - if (edges.hasOwnProperty(id)) { - edges[id]._drawControlNodes(ctx); - } - } -}; + if (input === null || (format === undefined && input === '')) { + return moment.invalid({nullInput: true}); + } -/** - * Find a stable position for all nodes - * @private - */ -Network.prototype._stabilize = function() { - if (this.constants.freezeForStabilization == true) { - this._freezeDefinedNodes(); - } + if (typeof input === 'string') { + config._i = input = getLangDefinition().preparse(input); + } - // find stable position - var count = 0; - while (this.moving && count < this.constants.stabilizationIterations) { - this._physicsTick(); - count++; - } - this.zoomExtent(false,true); - if (this.constants.freezeForStabilization == true) { - this._restoreFrozenNodes(); - } - this.emit("stabilized",{iterations:count}); -}; + if (moment.isMoment(input)) { + config = cloneMoment(input); -/** - * When initializing and stabilizing, we can freeze nodes with a predefined position. This greatly speeds up stabilization - * because only the supportnodes for the smoothCurves have to settle. - * - * @private - */ -Network.prototype._freezeDefinedNodes = function() { - var nodes = this.nodes; - for (var id in nodes) { - if (nodes.hasOwnProperty(id)) { - if (nodes[id].x != null && nodes[id].y != null) { - nodes[id].fixedData.x = nodes[id].xFixed; - nodes[id].fixedData.y = nodes[id].yFixed; - nodes[id].xFixed = true; - nodes[id].yFixed = true; - } - } - } -}; + config._d = new Date(+input._d); + } else if (format) { + if (isArray(format)) { + makeDateFromStringAndArray(config); + } else { + makeDateFromStringAndFormat(config); + } + } else { + makeDateFromInput(config); + } -/** - * Unfreezes the nodes that have been frozen by _freezeDefinedNodes. - * - * @private - */ -Network.prototype._restoreFrozenNodes = function() { - var nodes = this.nodes; - for (var id in nodes) { - if (nodes.hasOwnProperty(id)) { - if (nodes[id].fixedData.x != null) { - nodes[id].xFixed = nodes[id].fixedData.x; - nodes[id].yFixed = nodes[id].fixedData.y; + return new Moment(config); } - } - } -}; + moment = function (input, format, lang, strict) { + var c; -/** - * Check if any of the nodes is still moving - * @param {number} vmin the minimum velocity considered as 'moving' - * @return {boolean} true if moving, false if non of the nodes is moving - * @private - */ -Network.prototype._isMoving = function(vmin) { - var nodes = this.nodes; - for (var id in nodes) { - if (nodes.hasOwnProperty(id) && nodes[id].isMoving(vmin)) { - return true; - } - } - return false; -}; + if (typeof(lang) === "boolean") { + strict = lang; + lang = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c = {}; + c._isAMomentObject = true; + c._i = input; + c._f = format; + c._l = lang; + c._strict = strict; + c._isUTC = false; + c._pf = defaultParsingFlags(); + + return makeMoment(c); + }; + moment.suppressDeprecationWarnings = false; -/** - * /** - * Perform one discrete step for all nodes - * - * @private - */ -Network.prototype._discreteStepNodes = function() { - var interval = this.physicsDiscreteStepsize; - var nodes = this.nodes; - var nodeId; - var nodesPresent = false; - - if (this.constants.maxVelocity > 0) { - for (nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity); - nodesPresent = true; - } - } - } - else { - for (nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - nodes[nodeId].discreteStep(interval); - nodesPresent = true; + moment.createFromInputFallback = deprecate( + "moment construction falls back to js Date. This is " + + "discouraged and will be removed in upcoming major " + + "release. Please refer to " + + "https://github.com/moment/moment/issues/1407 for more info.", + function (config) { + config._d = new Date(config._i); + }); + + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return moment(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (moments[i][fn](res)) { + res = moments[i]; + } + } + return res; } - } - } - if (nodesPresent == true) { - var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05); - if (vminCorrected > 0.5*this.constants.maxVelocity) { - this.moving = true; - } - else { - this.moving = this._isMoving(vminCorrected); - } - } -}; + moment.min = function () { + var args = [].slice.call(arguments, 0); -/** - * A single simulation step (or "tick") in the physics simulation - * - * @private - */ -Network.prototype._physicsTick = function() { - if (!this.freezeSimulation) { - if (this.moving) { - this._doInAllActiveSectors("_initializeForceCalculation"); - this._doInAllActiveSectors("_discreteStepNodes"); - if (this.constants.smoothCurves) { - this._doInSupportSector("_discreteStepNodes"); - } - this._findCenter(this._getRange()) - } - } -}; + return pickBy('isBefore', args); + }; + moment.max = function () { + var args = [].slice.call(arguments, 0); -/** - * This function runs one step of the animation. It calls an x amount of physics ticks and one render tick. - * It reschedules itself at the beginning of the function - * - * @private - */ -Network.prototype._animationStep = function() { - // reset the timer so a new scheduled animation step can be set - this.timer = undefined; - // handle the keyboad movement - this._handleNavigation(); - - // this schedules a new animation step - this.start(); - - // start the physics simulation - var calculationTime = Date.now(); - var maxSteps = 1; - this._physicsTick(); - var timeRequired = Date.now() - calculationTime; - while (timeRequired < 0.9*(this.renderTimestep - this.renderTime) && maxSteps < this.maxPhysicsTicksPerRender) { - this._physicsTick(); - timeRequired = Date.now() - calculationTime; - maxSteps++; - } - // start the rendering process - var renderTime = Date.now(); - this._redraw(); - this.renderTime = Date.now() - renderTime; -}; + return pickBy('isAfter', args); + }; -if (typeof window !== 'undefined') { - window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || - window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; -} + // creating with utc + moment.utc = function (input, format, lang, strict) { + var c; -/** - * Schedule a animation step with the refreshrate interval. - */ -Network.prototype.start = function() { - if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { - if (!this.timer) { - var ua = navigator.userAgent.toLowerCase(); + if (typeof(lang) === "boolean") { + strict = lang; + lang = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c = {}; + c._isAMomentObject = true; + c._useUTC = true; + c._isUTC = true; + c._l = lang; + c._i = input; + c._f = format; + c._strict = strict; + c._pf = defaultParsingFlags(); + + return makeMoment(c).utc(); + }; - var requiresTimeout = false; - if (ua.indexOf('msie 9.0') != -1) { // IE 9 - requiresTimeout = true; - } - else if (ua.indexOf('safari') != -1) { // safari - if (ua.indexOf('chrome') <= -1) { - requiresTimeout = true; - } - } + // creating with unix timestamp (in seconds) + moment.unix = function (input) { + return moment(input * 1000); + }; - if (requiresTimeout == true) { - this.timer = window.setTimeout(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function - } - else{ - this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function - } - } - } - else { - this._redraw(); - } -}; + // duration + moment.duration = function (input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + parseIso; + + if (moment.isDuration(input)) { + duration = { + ms: input._milliseconds, + d: input._days, + M: input._months + }; + } else if (typeof input === 'number') { + duration = {}; + if (key) { + duration[key] = input; + } else { + duration.milliseconds = input; + } + } else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) { + sign = (match[1] === "-") ? -1 : 1; + duration = { + y: 0, + d: toInt(match[DATE]) * sign, + h: toInt(match[HOUR]) * sign, + m: toInt(match[MINUTE]) * sign, + s: toInt(match[SECOND]) * sign, + ms: toInt(match[MILLISECOND]) * sign + }; + } else if (!!(match = isoDurationRegex.exec(input))) { + sign = (match[1] === "-") ? -1 : 1; + parseIso = function (inp) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; + }; + duration = { + y: parseIso(match[2]), + M: parseIso(match[3]), + d: parseIso(match[4]), + h: parseIso(match[5]), + m: parseIso(match[6]), + s: parseIso(match[7]), + w: parseIso(match[8]) + }; + } + ret = new Duration(duration); -/** - * Move the network according to the keyboard presses. - * - * @private - */ -Network.prototype._handleNavigation = function() { - if (this.xIncrement != 0 || this.yIncrement != 0) { - var translation = this._getTranslation(); - this._setTranslation(translation.x+this.xIncrement, translation.y+this.yIncrement); - } - if (this.zoomIncrement != 0) { - var center = { - x: this.frame.canvas.clientWidth / 2, - y: this.frame.canvas.clientHeight / 2 - }; - this._zoom(this.scale*(1 + this.zoomIncrement), center); - } -}; + if (moment.isDuration(input) && input.hasOwnProperty('_lang')) { + ret._lang = input._lang; + } + + return ret; + }; + + // version number + moment.version = VERSION; + + // default format + moment.defaultFormat = isoFormat; + + // constant that refers to the ISO standard + moment.ISO_8601 = function () {}; + + // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + moment.momentProperties = momentProperties; + + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + moment.updateOffset = function () {}; + + // This function allows you to set a threshold for relative time strings + moment.relativeTimeThreshold = function(threshold, limit) { + if (relativeTimeThresholds[threshold] === undefined) { + return false; + } + relativeTimeThresholds[threshold] = limit; + return true; + }; + // This function will load languages and then set the global language. If + // no arguments are passed in, it will simply return the current global + // language key. + moment.lang = function (key, values) { + var r; + if (!key) { + return moment.fn._lang._abbr; + } + if (values) { + loadLang(normalizeLanguage(key), values); + } else if (values === null) { + unloadLang(key); + key = 'en'; + } else if (!languages[key]) { + getLangDefinition(key); + } + r = moment.duration.fn._lang = moment.fn._lang = getLangDefinition(key); + return r._abbr; + }; -/** - * Freeze the _animationStep - */ -Network.prototype.toggleFreeze = function() { - if (this.freezeSimulation == false) { - this.freezeSimulation = true; - } - else { - this.freezeSimulation = false; - this.start(); - } -}; + // returns language data + moment.langData = function (key) { + if (key && key._lang && key._lang._abbr) { + key = key._lang._abbr; + } + return getLangDefinition(key); + }; + // compare moment object + moment.isMoment = function (obj) { + return obj instanceof Moment || + (obj != null && obj.hasOwnProperty('_isAMomentObject')); + }; -/** - * This function cleans the support nodes if they are not needed and adds them when they are. - * - * @param {boolean} [disableStart] - * @private - */ -Network.prototype._configureSmoothCurves = function(disableStart) { - if (disableStart === undefined) { - disableStart = true; - } + // for typechecking Duration objects + moment.isDuration = function (obj) { + return obj instanceof Duration; + }; - if (this.constants.smoothCurves == true) { - this._createBezierNodes(); - } - else { - // delete the support nodes - this.sectors['support']['nodes'] = {}; - for (var edgeId in this.edges) { - if (this.edges.hasOwnProperty(edgeId)) { - this.edges[edgeId].smooth = false; - this.edges[edgeId].via = null; + for (i = lists.length - 1; i >= 0; --i) { + makeList(lists[i]); } - } - } - this._updateCalculationNodes(); - if (!disableStart) { - this.moving = true; - this.start(); - } -}; + moment.normalizeUnits = function (units) { + return normalizeUnits(units); + }; -/** - * Bezier curves require an anchor point to calculate the smooth flow. These points are nodes. These nodes are invisible but - * are used for the force calculation. - * - * @private - */ -Network.prototype._createBezierNodes = function() { - if (this.constants.smoothCurves == true) { - for (var edgeId in this.edges) { - if (this.edges.hasOwnProperty(edgeId)) { - var edge = this.edges[edgeId]; - if (edge.via == null) { - edge.smooth = true; - var nodeId = "edgeId:".concat(edge.id); - this.sectors['support']['nodes'][nodeId] = new Node( - {id:nodeId, - mass:1, - shape:'circle', - image:"", - internalMultiplier:1 - },{},{},this.constants); - edge.via = this.sectors['support']['nodes'][nodeId]; - edge.via.parentEdgeId = edge.id; - edge.positionBezierNode(); - } - } - } - } -}; + moment.invalid = function (flags) { + var m = moment.utc(NaN); + if (flags != null) { + extend(m._pf, flags); + } + else { + m._pf.userInvalidated = true; + } -/** - * load the functions that load the mixins into the prototype. - * - * @private - */ -Network.prototype._initializeMixinLoaders = function () { - for (var mixinFunction in networkMixinLoaders) { - if (networkMixinLoaders.hasOwnProperty(mixinFunction)) { - Network.prototype[mixinFunction] = networkMixinLoaders[mixinFunction]; - } - } -}; + return m; + }; -/** - * Load the XY positions of the nodes into the dataset. - */ -Network.prototype.storePosition = function() { - var dataArray = []; - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - var node = this.nodes[nodeId]; - var allowedToMoveX = !this.nodes.xFixed; - var allowedToMoveY = !this.nodes.yFixed; - if (this.nodesData._data[nodeId].x != Math.round(node.x) || this.nodesData._data[nodeId].y != Math.round(node.y)) { - dataArray.push({id:nodeId,x:Math.round(node.x),y:Math.round(node.y),allowedToMoveX:allowedToMoveX,allowedToMoveY:allowedToMoveY}); - } - } - } - this.nodesData.update(dataArray); -}; + moment.parseZone = function () { + return moment.apply(null, arguments).parseZone(); + }; + moment.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; -/** - * Center a node in view. - * - * @param {Number} nodeId - * @param {Number} [zoomLevel] - */ -Network.prototype.focusOnNode = function (nodeId, zoomLevel) { - if (this.nodes.hasOwnProperty(nodeId)) { - if (zoomLevel === undefined) { - zoomLevel = this._getScale(); - } - var nodePosition= {x: this.nodes[nodeId].x, y: this.nodes[nodeId].y}; + /************************************ + Moment Prototype + ************************************/ - var requiredScale = zoomLevel; - this._setScale(requiredScale); - var canvasCenter = this.DOMtoCanvas({x:0.5 * this.frame.canvas.width,y:0.5 * this.frame.canvas.height}); - var translation = this._getTranslation(); + extend(moment.fn = Moment.prototype, { - var distanceFromCenter = {x:canvasCenter.x - nodePosition.x, - y:canvasCenter.y - nodePosition.y}; + clone : function () { + return moment(this); + }, - this._setTranslation(translation.x + requiredScale * distanceFromCenter.x, - translation.y + requiredScale * distanceFromCenter.y); - this.redraw(); - } - else { - console.log("This nodeId cannot be found.") - } -}; + valueOf : function () { + return +this._d + ((this._offset || 0) * 60000); + }, + unix : function () { + return Math.floor(+this / 1000); + }, + toString : function () { + return this.clone().lang('en').format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ"); + }, + toDate : function () { + return this._offset ? new Date(+this) : this._d; + }, + toISOString : function () { + var m = moment(this).utc(); + if (0 < m.year() && m.year() <= 9999) { + return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); + } else { + return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); + } + }, + toArray : function () { + var m = this; + return [ + m.year(), + m.month(), + m.date(), + m.hours(), + m.minutes(), + m.seconds(), + m.milliseconds() + ]; + }, + isValid : function () { + return isValid(this); + }, + isDSTShifted : function () { + if (this._a) { + return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0; + } + return false; + }, -/** - * @constructor Graph3d - * Graph3d displays data in 3d. - * - * Graph3d is developed in javascript as a Google Visualization Chart. - * - * @param {Element} container The DOM element in which the Graph3d will - * be created. Normally a div element. - * @param {DataSet | DataView | Array} [data] - * @param {Object} [options] - */ -function Graph3d(container, data, options) { - if (!(this instanceof Graph3d)) { - throw new SyntaxError('Constructor must be called with the new operator'); - } + parsingFlags : function () { + return extend({}, this._pf); + }, - // create variables and set default values - this.containerElement = container; - this.width = '400px'; - this.height = '400px'; - this.margin = 10; // px - this.defaultXCenter = '55%'; - this.defaultYCenter = '50%'; - - this.xLabel = 'x'; - this.yLabel = 'y'; - this.zLabel = 'z'; - this.filterLabel = 'time'; - this.legendLabel = 'value'; - - this.style = Graph3d.STYLE.DOT; - this.showPerspective = true; - this.showGrid = true; - this.keepAspectRatio = true; - this.showShadow = false; - this.showGrayBottom = false; // TODO: this does not work correctly - this.showTooltip = false; - this.verticalRatio = 0.5; // 0.1 to 1.0, where 1.0 results in a 'cube' - - this.animationInterval = 1000; // milliseconds - this.animationPreload = false; - - this.camera = new Graph3d.Camera(); - this.eye = new Point3d(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window? - - this.dataTable = null; // The original data table - this.dataPoints = null; // The table with point objects - - // the column indexes - this.colX = undefined; - this.colY = undefined; - this.colZ = undefined; - this.colValue = undefined; - this.colFilter = undefined; - - this.xMin = 0; - this.xStep = undefined; // auto by default - this.xMax = 1; - this.yMin = 0; - this.yStep = undefined; // auto by default - this.yMax = 1; - this.zMin = 0; - this.zStep = undefined; // auto by default - this.zMax = 1; - this.valueMin = 0; - this.valueMax = 1; - this.xBarWidth = 1; - this.yBarWidth = 1; - // TODO: customize axis range - - // constants - this.colorAxis = '#4D4D4D'; - this.colorGrid = '#D3D3D3'; - this.colorDot = '#7DC1FF'; - this.colorDotBorder = '#3267D2'; - - // create a frame and canvas - this.create(); - - // apply options (also when undefined) - this.setOptions(options); - - // apply data - if (data) { - this.setData(data); - } -} + invalidAt: function () { + return this._pf.overflow; + }, -// Extend Graph3d with an Emitter mixin -Emitter(Graph3d.prototype); + utc : function () { + return this.zone(0); + }, -/** - * @class Camera - * The camera is mounted on a (virtual) camera arm. The camera arm can rotate - * The camera is always looking in the direction of the origin of the arm. - * This way, the camera always rotates around one fixed point, the location - * of the camera arm. - * - * Documentation: - * http://en.wikipedia.org/wiki/3D_projection - */ -Graph3d.Camera = function () { - this.armLocation = new Point3d(); - this.armRotation = {}; - this.armRotation.horizontal = 0; - this.armRotation.vertical = 0; - this.armLength = 1.7; + local : function () { + this.zone(0); + this._isUTC = false; + return this; + }, - this.cameraLocation = new Point3d(); - this.cameraRotation = new Point3d(0.5*Math.PI, 0, 0); + format : function (inputString) { + var output = formatMoment(this, inputString || moment.defaultFormat); + return this.lang().postformat(output); + }, - this.calculateCameraOrientation(); -}; + add : function (input, val) { + var dur; + // switch args to support add('s', 1) and add(1, 's') + if (typeof input === 'string' && typeof val === 'string') { + dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input); + } else if (typeof input === 'string') { + dur = moment.duration(+val, input); + } else { + dur = moment.duration(input, val); + } + addOrSubtractDurationFromMoment(this, dur, 1); + return this; + }, -/** - * Set the location (origin) of the arm - * @param {Number} x Normalized value of x - * @param {Number} y Normalized value of y - * @param {Number} z Normalized value of z - */ -Graph3d.Camera.prototype.setArmLocation = function(x, y, z) { - this.armLocation.x = x; - this.armLocation.y = y; - this.armLocation.z = z; + subtract : function (input, val) { + var dur; + // switch args to support subtract('s', 1) and subtract(1, 's') + if (typeof input === 'string' && typeof val === 'string') { + dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input); + } else if (typeof input === 'string') { + dur = moment.duration(+val, input); + } else { + dur = moment.duration(input, val); + } + addOrSubtractDurationFromMoment(this, dur, -1); + return this; + }, - this.calculateCameraOrientation(); -}; + diff : function (input, units, asFloat) { + var that = makeAs(input, this), + zoneDiff = (this.zone() - that.zone()) * 6e4, + diff, output; + + units = normalizeUnits(units); + + if (units === 'year' || units === 'month') { + // average number of days in the months in the given dates + diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2 + // difference in months + output = ((this.year() - that.year()) * 12) + (this.month() - that.month()); + // adjust by taking difference in days, average number of days + // and dst in the given months. + output += ((this - moment(this).startOf('month')) - + (that - moment(that).startOf('month'))) / diff; + // same as above but with zones, to negate all dst + output -= ((this.zone() - moment(this).startOf('month').zone()) - + (that.zone() - moment(that).startOf('month').zone())) * 6e4 / diff; + if (units === 'year') { + output = output / 12; + } + } else { + diff = (this - that); + output = units === 'second' ? diff / 1e3 : // 1000 + units === 'minute' ? diff / 6e4 : // 1000 * 60 + units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60 + units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst + units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst + diff; + } + return asFloat ? output : absRound(output); + }, -/** - * Set the rotation of the camera arm - * @param {Number} horizontal The horizontal rotation, between 0 and 2*PI. - * Optional, can be left undefined. - * @param {Number} vertical The vertical rotation, between 0 and 0.5*PI - * if vertical=0.5*PI, the graph is shown from the - * top. Optional, can be left undefined. - */ -Graph3d.Camera.prototype.setArmRotation = function(horizontal, vertical) { - if (horizontal !== undefined) { - this.armRotation.horizontal = horizontal; - } + from : function (time, withoutSuffix) { + return moment.duration(this.diff(time)).lang(this.lang()._abbr).humanize(!withoutSuffix); + }, - if (vertical !== undefined) { - this.armRotation.vertical = vertical; - if (this.armRotation.vertical < 0) this.armRotation.vertical = 0; - if (this.armRotation.vertical > 0.5*Math.PI) this.armRotation.vertical = 0.5*Math.PI; - } + fromNow : function (withoutSuffix) { + return this.from(moment(), withoutSuffix); + }, - if (horizontal !== undefined || vertical !== undefined) { - this.calculateCameraOrientation(); - } -}; + calendar : function (time) { + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're zone'd or not. + var now = time || moment(), + sod = makeAs(now, this).startOf('day'), + diff = this.diff(sod, 'days', true), + format = diff < -6 ? 'sameElse' : + diff < -1 ? 'lastWeek' : + diff < 0 ? 'lastDay' : + diff < 1 ? 'sameDay' : + diff < 2 ? 'nextDay' : + diff < 7 ? 'nextWeek' : 'sameElse'; + return this.format(this.lang().calendar(format, this)); + }, -/** - * Retrieve the current arm rotation - * @return {object} An object with parameters horizontal and vertical - */ -Graph3d.Camera.prototype.getArmRotation = function() { - var rot = {}; - rot.horizontal = this.armRotation.horizontal; - rot.vertical = this.armRotation.vertical; + isLeapYear : function () { + return isLeapYear(this.year()); + }, - return rot; -}; + isDST : function () { + return (this.zone() < this.clone().month(0).zone() || + this.zone() < this.clone().month(5).zone()); + }, -/** - * Set the (normalized) length of the camera arm. - * @param {Number} length A length between 0.71 and 5.0 - */ -Graph3d.Camera.prototype.setArmLength = function(length) { - if (length === undefined) - return; + day : function (input) { + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + if (input != null) { + input = parseWeekday(input, this.lang()); + return this.add({ d : input - day }); + } else { + return day; + } + }, - this.armLength = length; + month : makeAccessor('Month', true), + + startOf: function (units) { + units = normalizeUnits(units); + // the following switch intentionally omits break keywords + // to utilize falling through the cases. + switch (units) { + case 'year': + this.month(0); + /* falls through */ + case 'quarter': + case 'month': + this.date(1); + /* falls through */ + case 'week': + case 'isoWeek': + case 'day': + this.hours(0); + /* falls through */ + case 'hour': + this.minutes(0); + /* falls through */ + case 'minute': + this.seconds(0); + /* falls through */ + case 'second': + this.milliseconds(0); + /* falls through */ + } - // Radius must be larger than the corner of the graph, - // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the - // graph - if (this.armLength < 0.71) this.armLength = 0.71; - if (this.armLength > 5.0) this.armLength = 5.0; + // weeks are a special case + if (units === 'week') { + this.weekday(0); + } else if (units === 'isoWeek') { + this.isoWeekday(1); + } - this.calculateCameraOrientation(); -}; + // quarters are also special + if (units === 'quarter') { + this.month(Math.floor(this.month() / 3) * 3); + } -/** - * Retrieve the arm length - * @return {Number} length - */ -Graph3d.Camera.prototype.getArmLength = function() { - return this.armLength; -}; + return this; + }, -/** - * Retrieve the camera location - * @return {Point3d} cameraLocation - */ -Graph3d.Camera.prototype.getCameraLocation = function() { - return this.cameraLocation; -}; + endOf: function (units) { + units = normalizeUnits(units); + return this.startOf(units).add((units === 'isoWeek' ? 'week' : units), 1).subtract('ms', 1); + }, -/** - * Retrieve the camera rotation - * @return {Point3d} cameraRotation - */ -Graph3d.Camera.prototype.getCameraRotation = function() { - return this.cameraRotation; -}; + isAfter: function (input, units) { + units = typeof units !== 'undefined' ? units : 'millisecond'; + return +this.clone().startOf(units) > +moment(input).startOf(units); + }, -/** - * Calculate the location and rotation of the camera based on the - * position and orientation of the camera arm - */ -Graph3d.Camera.prototype.calculateCameraOrientation = function() { - // calculate location of the camera - this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); - this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); - this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); - - // calculate rotation of the camera - this.cameraRotation.x = Math.PI/2 - this.armRotation.vertical; - this.cameraRotation.y = 0; - this.cameraRotation.z = -this.armRotation.horizontal; -}; + isBefore: function (input, units) { + units = typeof units !== 'undefined' ? units : 'millisecond'; + return +this.clone().startOf(units) < +moment(input).startOf(units); + }, -/** - * Calculate the scaling values, dependent on the range in x, y, and z direction - */ -Graph3d.prototype._setScale = function() { - this.scale = new Point3d(1 / (this.xMax - this.xMin), - 1 / (this.yMax - this.yMin), - 1 / (this.zMax - this.zMin)); + isSame: function (input, units) { + units = units || 'ms'; + return +this.clone().startOf(units) === +makeAs(input, this).startOf(units); + }, - // keep aspect ration between x and y scale if desired - if (this.keepAspectRatio) { - if (this.scale.x < this.scale.y) { - //noinspection JSSuspiciousNameCombination - this.scale.y = this.scale.x; - } - else { - //noinspection JSSuspiciousNameCombination - this.scale.x = this.scale.y; - } - } + min: deprecate( + "moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548", + function (other) { + other = moment.apply(null, arguments); + return other < this ? this : other; + } + ), + + max: deprecate( + "moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548", + function (other) { + other = moment.apply(null, arguments); + return other > this ? this : other; + } + ), + + // keepTime = true means only change the timezone, without affecting + // the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200 + // It is possible that 5:31:26 doesn't exist int zone +0200, so we + // adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + zone : function (input, keepTime) { + var offset = this._offset || 0; + if (input != null) { + if (typeof input === "string") { + input = timezoneMinutesFromString(input); + } + if (Math.abs(input) < 16) { + input = input * 60; + } + this._offset = input; + this._isUTC = true; + if (offset !== input) { + if (!keepTime || this._changeInProgress) { + addOrSubtractDurationFromMoment(this, + moment.duration(offset - input, 'm'), 1, false); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + moment.updateOffset(this, true); + this._changeInProgress = null; + } + } + } else { + return this._isUTC ? offset : this._d.getTimezoneOffset(); + } + return this; + }, - // scale the vertical axis - this.scale.z *= this.verticalRatio; - // TODO: can this be automated? verticalRatio? + zoneAbbr : function () { + return this._isUTC ? "UTC" : ""; + }, - // determine scale for (optional) value - this.scale.value = 1 / (this.valueMax - this.valueMin); + zoneName : function () { + return this._isUTC ? "Coordinated Universal Time" : ""; + }, - // position the camera arm - var xCenter = (this.xMax + this.xMin) / 2 * this.scale.x; - var yCenter = (this.yMax + this.yMin) / 2 * this.scale.y; - var zCenter = (this.zMax + this.zMin) / 2 * this.scale.z; - this.camera.setArmLocation(xCenter, yCenter, zCenter); -}; + parseZone : function () { + if (this._tzm) { + this.zone(this._tzm); + } else if (typeof this._i === 'string') { + this.zone(this._i); + } + return this; + }, + hasAlignedHourOffset : function (input) { + if (!input) { + input = 0; + } + else { + input = moment(input).zone(); + } -/** - * Convert a 3D location to a 2D location on screen - * http://en.wikipedia.org/wiki/3D_projection - * @param {Point3d} point3d A 3D point with parameters x, y, z - * @return {Point2d} point2d A 2D point with parameters x, y - */ -Graph3d.prototype._convert3Dto2D = function(point3d) { - var translation = this._convertPointToTranslation(point3d); - return this._convertTranslationToScreen(translation); -}; + return (this.zone() - input) % 60 === 0; + }, -/** - * Convert a 3D location its translation seen from the camera - * http://en.wikipedia.org/wiki/3D_projection - * @param {Point3d} point3d A 3D point with parameters x, y, z - * @return {Point3d} translation A 3D point with parameters x, y, z This is - * the translation of the point, seen from the - * camera - */ -Graph3d.prototype._convertPointToTranslation = function(point3d) { - var ax = point3d.x * this.scale.x, - ay = point3d.y * this.scale.y, - az = point3d.z * this.scale.z, - - cx = this.camera.getCameraLocation().x, - cy = this.camera.getCameraLocation().y, - cz = this.camera.getCameraLocation().z, - - // calculate angles - sinTx = Math.sin(this.camera.getCameraRotation().x), - cosTx = Math.cos(this.camera.getCameraRotation().x), - sinTy = Math.sin(this.camera.getCameraRotation().y), - cosTy = Math.cos(this.camera.getCameraRotation().y), - sinTz = Math.sin(this.camera.getCameraRotation().z), - cosTz = Math.cos(this.camera.getCameraRotation().z), - - // calculate translation - dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz), - dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax-cx)), - dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax-cx)); - - return new Point3d(dx, dy, dz); -}; + daysInMonth : function () { + return daysInMonth(this.year(), this.month()); + }, -/** - * Convert a translation point to a point on the screen - * @param {Point3d} translation A 3D point with parameters x, y, z This is - * the translation of the point, seen from the - * camera - * @return {Point2d} point2d A 2D point with parameters x, y - */ -Graph3d.prototype._convertTranslationToScreen = function(translation) { - var ex = this.eye.x, - ey = this.eye.y, - ez = this.eye.z, - dx = translation.x, - dy = translation.y, - dz = translation.z; - - // calculate position on screen from translation - var bx; - var by; - if (this.showPerspective) { - bx = (dx - ex) * (ez / dz); - by = (dy - ey) * (ez / dz); - } - else { - bx = dx * -(ez / this.camera.getArmLength()); - by = dy * -(ez / this.camera.getArmLength()); - } + dayOfYear : function (input) { + var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1; + return input == null ? dayOfYear : this.add("d", (input - dayOfYear)); + }, - // shift and scale the point to the center of the screen - // use the width of the graph to scale both horizontally and vertically. - return new Point2d( - this.xcenter + bx * this.frame.canvas.clientWidth, - this.ycenter - by * this.frame.canvas.clientWidth); -}; + quarter : function (input) { + return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); + }, -/** - * Set the background styling for the graph - * @param {string | {fill: string, stroke: string, strokeWidth: string}} backgroundColor - */ -Graph3d.prototype._setBackgroundColor = function(backgroundColor) { - var fill = 'white'; - var stroke = 'gray'; - var strokeWidth = 1; - - if (typeof(backgroundColor) === 'string') { - fill = backgroundColor; - stroke = 'none'; - strokeWidth = 0; - } - else if (typeof(backgroundColor) === 'object') { - if (backgroundColor.fill !== undefined) fill = backgroundColor.fill; - if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke; - if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth; - } - else if (backgroundColor === undefined) { - // use use defaults - } - else { - throw 'Unsupported type of backgroundColor'; - } + weekYear : function (input) { + var year = weekOfYear(this, this.lang()._week.dow, this.lang()._week.doy).year; + return input == null ? year : this.add("y", (input - year)); + }, - this.frame.style.backgroundColor = fill; - this.frame.style.borderColor = stroke; - this.frame.style.borderWidth = strokeWidth + 'px'; - this.frame.style.borderStyle = 'solid'; -}; - - -/// enumerate the available styles -Graph3d.STYLE = { - BAR: 0, - BARCOLOR: 1, - BARSIZE: 2, - DOT : 3, - DOTLINE : 4, - DOTCOLOR: 5, - DOTSIZE: 6, - GRID : 7, - LINE: 8, - SURFACE : 9 -}; + isoWeekYear : function (input) { + var year = weekOfYear(this, 1, 4).year; + return input == null ? year : this.add("y", (input - year)); + }, -/** - * Retrieve the style index from given styleName - * @param {string} styleName Style name such as 'dot', 'grid', 'dot-line' - * @return {Number} styleNumber Enumeration value representing the style, or -1 - * when not found - */ -Graph3d.prototype._getStyleNumber = function(styleName) { - switch (styleName) { - case 'dot': return Graph3d.STYLE.DOT; - case 'dot-line': return Graph3d.STYLE.DOTLINE; - case 'dot-color': return Graph3d.STYLE.DOTCOLOR; - case 'dot-size': return Graph3d.STYLE.DOTSIZE; - case 'line': return Graph3d.STYLE.LINE; - case 'grid': return Graph3d.STYLE.GRID; - case 'surface': return Graph3d.STYLE.SURFACE; - case 'bar': return Graph3d.STYLE.BAR; - case 'bar-color': return Graph3d.STYLE.BARCOLOR; - case 'bar-size': return Graph3d.STYLE.BARSIZE; - } + week : function (input) { + var week = this.lang().week(this); + return input == null ? week : this.add("d", (input - week) * 7); + }, - return -1; -}; + isoWeek : function (input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add("d", (input - week) * 7); + }, -/** - * Determine the indexes of the data columns, based on the given style and data - * @param {DataSet} data - * @param {Number} style - */ -Graph3d.prototype._determineColumnIndexes = function(data, style) { - if (this.style === Graph3d.STYLE.DOT || - this.style === Graph3d.STYLE.DOTLINE || - this.style === Graph3d.STYLE.LINE || - this.style === Graph3d.STYLE.GRID || - this.style === Graph3d.STYLE.SURFACE || - this.style === Graph3d.STYLE.BAR) { - // 3 columns expected, and optionally a 4th with filter values - this.colX = 0; - this.colY = 1; - this.colZ = 2; - this.colValue = undefined; + weekday : function (input) { + var weekday = (this.day() + 7 - this.lang()._week.dow) % 7; + return input == null ? weekday : this.add("d", input - weekday); + }, - if (data.getNumberOfColumns() > 3) { - this.colFilter = 3; - } - } - else if (this.style === Graph3d.STYLE.DOTCOLOR || - this.style === Graph3d.STYLE.DOTSIZE || - this.style === Graph3d.STYLE.BARCOLOR || - this.style === Graph3d.STYLE.BARSIZE) { - // 4 columns expected, and optionally a 5th with filter values - this.colX = 0; - this.colY = 1; - this.colZ = 2; - this.colValue = 3; - - if (data.getNumberOfColumns() > 4) { - this.colFilter = 4; - } - } - else { - throw 'Unknown style "' + this.style + '"'; - } -}; + isoWeekday : function (input) { + // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. + return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); + }, -Graph3d.prototype.getNumberOfRows = function(data) { - return data.length; -} + isoWeeksInYear : function () { + return weeksInYear(this.year(), 1, 4); + }, + weeksInYear : function () { + var weekInfo = this._lang._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + }, -Graph3d.prototype.getNumberOfColumns = function(data) { - var counter = 0; - for (var column in data[0]) { - if (data[0].hasOwnProperty(column)) { - counter++; - } - } - return counter; -} + get : function (units) { + units = normalizeUnits(units); + return this[units](); + }, + set : function (units, value) { + units = normalizeUnits(units); + if (typeof this[units] === 'function') { + this[units](value); + } + return this; + }, -Graph3d.prototype.getDistinctValues = function(data, column) { - var distinctValues = []; - for (var i = 0; i < data.length; i++) { - if (distinctValues.indexOf(data[i][column]) == -1) { - distinctValues.push(data[i][column]); - } - } - return distinctValues; -} + // If passed a language key, it will set the language for this + // instance. Otherwise, it will return the language configuration + // variables for this instance. + lang : function (key) { + if (key === undefined) { + return this._lang; + } else { + this._lang = getLangDefinition(key); + return this; + } + } + }); + function rawMonthSetter(mom, value) { + var dayOfMonth; -Graph3d.prototype.getColumnRange = function(data,column) { - var minMax = {min:data[0][column],max:data[0][column]}; - for (var i = 0; i < data.length; i++) { - if (minMax.min > data[i][column]) { minMax.min = data[i][column]; } - if (minMax.max < data[i][column]) { minMax.max = data[i][column]; } - } - return minMax; -}; + // TODO: Move this out of here! + if (typeof value === 'string') { + value = mom.lang().monthsParse(value); + // TODO: Another silent failure? + if (typeof value !== 'number') { + return mom; + } + } -/** - * Initialize the data from the data table. Calculate minimum and maximum values - * and column index values - * @param {Array | DataSet | DataView} rawData The data containing the items for the Graph. - * @param {Number} style Style Number - */ -Graph3d.prototype._dataInitialize = function (rawData, style) { - var me = this; + dayOfMonth = Math.min(mom.date(), + daysInMonth(mom.year(), value)); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + return mom; + } - // unsubscribe from the dataTable - if (this.dataSet) { - this.dataSet.off('*', this._onChange); - } + function rawGetter(mom, unit) { + return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit](); + } - if (rawData === undefined) - return; + function rawSetter(mom, unit, value) { + if (unit === 'Month') { + return rawMonthSetter(mom, value); + } else { + return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } - if (Array.isArray(rawData)) { - rawData = new DataSet(rawData); - } + function makeAccessor(unit, keepTime) { + return function (value) { + if (value != null) { + rawSetter(this, unit, value); + moment.updateOffset(this, keepTime); + return this; + } else { + return rawGetter(this, unit); + } + }; + } - var data; - if (rawData instanceof DataSet || rawData instanceof DataView) { - data = rawData.get(); - } - else { - throw new Error('Array, DataSet, or DataView expected'); - } + moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false); + moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false); + moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false); + // Setting the hour should keep the time, because the user explicitly + // specified which hour he wants. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true); + // moment.fn.month is defined separately + moment.fn.date = makeAccessor('Date', true); + moment.fn.dates = deprecate("dates accessor is deprecated. Use date instead.", makeAccessor('Date', true)); + moment.fn.year = makeAccessor('FullYear', true); + moment.fn.years = deprecate("years accessor is deprecated. Use year instead.", makeAccessor('FullYear', true)); - if (data.length == 0) - return; + // add plural methods + moment.fn.days = moment.fn.day; + moment.fn.months = moment.fn.month; + moment.fn.weeks = moment.fn.week; + moment.fn.isoWeeks = moment.fn.isoWeek; + moment.fn.quarters = moment.fn.quarter; - this.dataSet = rawData; - this.dataTable = data; + // add aliased format methods + moment.fn.toJSON = moment.fn.toISOString; - // subscribe to changes in the dataset - this._onChange = function () { - me.setData(me.dataSet); - }; - this.dataSet.on('*', this._onChange); + /************************************ + Duration Prototype + ************************************/ - // _determineColumnIndexes - // getNumberOfRows (points) - // getNumberOfColumns (x,y,z,v,t,t1,t2...) - // getDistinctValues (unique values?) - // getColumnRange - // determine the location of x,y,z,value,filter columns - this.colX = 'x'; - this.colY = 'y'; - this.colZ = 'z'; - this.colValue = 'style'; - this.colFilter = 'filter'; + extend(moment.duration.fn = Duration.prototype, { + _bubble : function () { + var milliseconds = this._milliseconds, + days = this._days, + months = this._months, + data = this._data, + seconds, minutes, hours, years; + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; - // check if a filter column is provided - if (data[0].hasOwnProperty('filter')) { - if (this.dataFilter === undefined) { - this.dataFilter = new Filter(rawData, this.colFilter, this); - this.dataFilter.setOnLoadCallback(function() {me.redraw();}); - } - } + seconds = absRound(milliseconds / 1000); + data.seconds = seconds % 60; + minutes = absRound(seconds / 60); + data.minutes = minutes % 60; - var withBars = this.style == Graph3d.STYLE.BAR || - this.style == Graph3d.STYLE.BARCOLOR || - this.style == Graph3d.STYLE.BARSIZE; + hours = absRound(minutes / 60); + data.hours = hours % 24; - // determine barWidth from data - if (withBars) { - if (this.defaultXBarWidth !== undefined) { - this.xBarWidth = this.defaultXBarWidth; - } - else { - var dataX = this.getDistinctValues(data,this.colX); - this.xBarWidth = (dataX[1] - dataX[0]) || 1; - } + days += absRound(hours / 24); + data.days = days % 30; - if (this.defaultYBarWidth !== undefined) { - this.yBarWidth = this.defaultYBarWidth; - } - else { - var dataY = this.getDistinctValues(data,this.colY); - this.yBarWidth = (dataY[1] - dataY[0]) || 1; - } - } + months += absRound(days / 30); + data.months = months % 12; - // calculate minimums and maximums - var xRange = this.getColumnRange(data,this.colX); - if (withBars) { - xRange.min -= this.xBarWidth / 2; - xRange.max += this.xBarWidth / 2; - } - this.xMin = (this.defaultXMin !== undefined) ? this.defaultXMin : xRange.min; - this.xMax = (this.defaultXMax !== undefined) ? this.defaultXMax : xRange.max; - if (this.xMax <= this.xMin) this.xMax = this.xMin + 1; - this.xStep = (this.defaultXStep !== undefined) ? this.defaultXStep : (this.xMax-this.xMin)/5; - - var yRange = this.getColumnRange(data,this.colY); - if (withBars) { - yRange.min -= this.yBarWidth / 2; - yRange.max += this.yBarWidth / 2; - } - this.yMin = (this.defaultYMin !== undefined) ? this.defaultYMin : yRange.min; - this.yMax = (this.defaultYMax !== undefined) ? this.defaultYMax : yRange.max; - if (this.yMax <= this.yMin) this.yMax = this.yMin + 1; - this.yStep = (this.defaultYStep !== undefined) ? this.defaultYStep : (this.yMax-this.yMin)/5; - - var zRange = this.getColumnRange(data,this.colZ); - this.zMin = (this.defaultZMin !== undefined) ? this.defaultZMin : zRange.min; - this.zMax = (this.defaultZMax !== undefined) ? this.defaultZMax : zRange.max; - if (this.zMax <= this.zMin) this.zMax = this.zMin + 1; - this.zStep = (this.defaultZStep !== undefined) ? this.defaultZStep : (this.zMax-this.zMin)/5; - - if (this.colValue !== undefined) { - var valueRange = this.getColumnRange(data,this.colValue); - this.valueMin = (this.defaultValueMin !== undefined) ? this.defaultValueMin : valueRange.min; - this.valueMax = (this.defaultValueMax !== undefined) ? this.defaultValueMax : valueRange.max; - if (this.valueMax <= this.valueMin) this.valueMax = this.valueMin + 1; - } + years = absRound(months / 12); + data.years = years; + }, - // set the scale dependent on the ranges. - this._setScale(); -}; + weeks : function () { + return absRound(this.days() / 7); + }, + valueOf : function () { + return this._milliseconds + + this._days * 864e5 + + (this._months % 12) * 2592e6 + + toInt(this._months / 12) * 31536e6; + }, + humanize : function (withSuffix) { + var difference = +this, + output = relativeTime(difference, !withSuffix, this.lang()); -/** - * Filter the data based on the current filter - * @param {Array} data - * @return {Array} dataPoints Array with point objects which can be drawn on screen - */ -Graph3d.prototype._getDataPoints = function (data) { - // TODO: store the created matrix dataPoints in the filters instead of reloading each time - var x, y, i, z, obj, point; + if (withSuffix) { + output = this.lang().pastFuture(difference, output); + } - var dataPoints = []; + return this.lang().postformat(output); + }, - if (this.style === Graph3d.STYLE.GRID || - this.style === Graph3d.STYLE.SURFACE) { - // copy all values from the google data table to a matrix - // the provided values are supposed to form a grid of (x,y) positions + add : function (input, val) { + // supports only 2.0-style add(1, 's') or add(moment) + var dur = moment.duration(input, val); - // create two lists with all present x and y values - var dataX = []; - var dataY = []; - for (i = 0; i < this.getNumberOfRows(data); i++) { - x = data[i][this.colX] || 0; - y = data[i][this.colY] || 0; + this._milliseconds += dur._milliseconds; + this._days += dur._days; + this._months += dur._months; - if (dataX.indexOf(x) === -1) { - dataX.push(x); - } - if (dataY.indexOf(y) === -1) { - dataY.push(y); - } - } + this._bubble(); - function sortNumber(a, b) { - return a - b; - } - dataX.sort(sortNumber); - dataY.sort(sortNumber); + return this; + }, - // create a grid, a 2d matrix, with all values. - var dataMatrix = []; // temporary data matrix - for (i = 0; i < data.length; i++) { - x = data[i][this.colX] || 0; - y = data[i][this.colY] || 0; - z = data[i][this.colZ] || 0; + subtract : function (input, val) { + var dur = moment.duration(input, val); - var xIndex = dataX.indexOf(x); // TODO: implement Array().indexOf() for Internet Explorer - var yIndex = dataY.indexOf(y); + this._milliseconds -= dur._milliseconds; + this._days -= dur._days; + this._months -= dur._months; - if (dataMatrix[xIndex] === undefined) { - dataMatrix[xIndex] = []; - } + this._bubble(); - var point3d = new Point3d(); - point3d.x = x; - point3d.y = y; - point3d.z = z; + return this; + }, - obj = {}; - obj.point = point3d; - obj.trans = undefined; - obj.screen = undefined; - obj.bottom = new Point3d(x, y, this.zMin); + get : function (units) { + units = normalizeUnits(units); + return this[units.toLowerCase() + 's'](); + }, - dataMatrix[xIndex][yIndex] = obj; + as : function (units) { + units = normalizeUnits(units); + return this['as' + units.charAt(0).toUpperCase() + units.slice(1) + 's'](); + }, - dataPoints.push(obj); - } + lang : moment.fn.lang, + + toIsoString : function () { + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + var years = Math.abs(this.years()), + months = Math.abs(this.months()), + days = Math.abs(this.days()), + hours = Math.abs(this.hours()), + minutes = Math.abs(this.minutes()), + seconds = Math.abs(this.seconds() + this.milliseconds() / 1000); + + if (!this.asSeconds()) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } - // fill in the pointers to the neighbors. - for (x = 0; x < dataMatrix.length; x++) { - for (y = 0; y < dataMatrix[x].length; y++) { - if (dataMatrix[x][y]) { - dataMatrix[x][y].pointRight = (x < dataMatrix.length-1) ? dataMatrix[x+1][y] : undefined; - dataMatrix[x][y].pointTop = (y < dataMatrix[x].length-1) ? dataMatrix[x][y+1] : undefined; - dataMatrix[x][y].pointCross = - (x < dataMatrix.length-1 && y < dataMatrix[x].length-1) ? - dataMatrix[x+1][y+1] : - undefined; - } + return (this.asSeconds() < 0 ? '-' : '') + + 'P' + + (years ? years + 'Y' : '') + + (months ? months + 'M' : '') + + (days ? days + 'D' : '') + + ((hours || minutes || seconds) ? 'T' : '') + + (hours ? hours + 'H' : '') + + (minutes ? minutes + 'M' : '') + + (seconds ? seconds + 'S' : ''); + } + }); + + function makeDurationGetter(name) { + moment.duration.fn[name] = function () { + return this._data[name]; + }; } - } - } - else { // 'dot', 'dot-line', etc. - // copy all values from the google data table to a list with Point3d objects - for (i = 0; i < data.length; i++) { - point = new Point3d(); - point.x = data[i][this.colX] || 0; - point.y = data[i][this.colY] || 0; - point.z = data[i][this.colZ] || 0; - if (this.colValue !== undefined) { - point.value = data[i][this.colValue] || 0; + function makeDurationAsGetter(name, factor) { + moment.duration.fn['as' + name] = function () { + return +this / factor; + }; } - obj = {}; - obj.point = point; - obj.bottom = new Point3d(point.x, point.y, this.zMin); - obj.trans = undefined; - obj.screen = undefined; + for (i in unitMillisecondFactors) { + if (unitMillisecondFactors.hasOwnProperty(i)) { + makeDurationAsGetter(i, unitMillisecondFactors[i]); + makeDurationGetter(i.toLowerCase()); + } + } - dataPoints.push(obj); - } - } + makeDurationAsGetter('Weeks', 6048e5); + moment.duration.fn.asMonths = function () { + return (+this - this.years() * 31536e6) / 2592e6 + this.years() * 12; + }; - return dataPoints; -}; + /************************************ + Default Lang + ************************************/ + // Set default language, other languages will inherit from English. + moment.lang('en', { + ordinal : function (number) { + var b = number % 10, + output = (toInt(number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + return number + output; + } + }); -/** - * Append suffix 'px' to provided value x - * @param {int} x An integer value - * @return {string} the string value of x, followed by the suffix 'px' - */ -Graph3d.px = function(x) { - return x + 'px'; -}; + /* EMBED_LANGUAGES */ + /************************************ + Exposing Moment + ************************************/ -/** - * Create the main frame for the Graph3d. - * This function is executed once when a Graph3d object is created. The frame - * contains a canvas, and this canvas contains all objects like the axis and - * nodes. - */ -Graph3d.prototype.create = function () { - // remove all elements from the container element. - while (this.containerElement.hasChildNodes()) { - this.containerElement.removeChild(this.containerElement.firstChild); - } + function makeGlobal(shouldDeprecate) { + /*global ender:false */ + if (typeof ender !== 'undefined') { + return; + } + oldGlobalMoment = globalScope.moment; + if (shouldDeprecate) { + globalScope.moment = deprecate( + "Accessing Moment through the global scope is " + + "deprecated, and will be removed in an upcoming " + + "release.", + moment); + } else { + globalScope.moment = moment; + } + } - this.frame = document.createElement('div'); - this.frame.style.position = 'relative'; - this.frame.style.overflow = 'hidden'; - - // create the graph canvas (HTML canvas element) - this.frame.canvas = document.createElement( 'canvas' ); - this.frame.canvas.style.position = 'relative'; - this.frame.appendChild(this.frame.canvas); - //if (!this.frame.canvas.getContext) { - { - var noCanvas = document.createElement( 'DIV' ); - noCanvas.style.color = 'red'; - noCanvas.style.fontWeight = 'bold' ; - noCanvas.style.padding = '10px'; - noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; - this.frame.canvas.appendChild(noCanvas); - } + // CommonJS module is defined + if (hasModule) { + module.exports = moment; + } else if (true) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, module) { + if (module.config && module.config() && module.config().noGlobal === true) { + // release the global variable + globalScope.moment = oldGlobalMoment; + } - this.frame.filter = document.createElement( 'div' ); - this.frame.filter.style.position = 'absolute'; - this.frame.filter.style.bottom = '0px'; - this.frame.filter.style.left = '0px'; - this.frame.filter.style.width = '100%'; - this.frame.appendChild(this.frame.filter); + return moment; + }.call(exports, __webpack_require__, exports, module)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + makeGlobal(true); + } else { + makeGlobal(); + } + }).call(this); + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(60)(module))) - // add event listeners to handle moving and zooming the contents - var me = this; - var onmousedown = function (event) {me._onMouseDown(event);}; - var ontouchstart = function (event) {me._onTouchStart(event);}; - var onmousewheel = function (event) {me._onWheel(event);}; - var ontooltip = function (event) {me._onTooltip(event);}; - // TODO: these events are never cleaned up... can give a 'memory leakage' +/***/ }, +/* 48 */ +/***/ function(module, exports, __webpack_require__) { - G3DaddEventListener(this.frame.canvas, 'keydown', onkeydown); - G3DaddEventListener(this.frame.canvas, 'mousedown', onmousedown); - G3DaddEventListener(this.frame.canvas, 'touchstart', ontouchstart); - G3DaddEventListener(this.frame.canvas, 'mousewheel', onmousewheel); - G3DaddEventListener(this.frame.canvas, 'mousemove', ontooltip); + var __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v1.1.3 - 2014-05-20 + * http://eightmedia.github.io/hammer.js + * + * Copyright (c) 2014 Jorik Tangelder ; + * Licensed under the MIT license */ - // add the new graph to the container element - this.containerElement.appendChild(this.frame); -}; + (function(window, undefined) { + 'use strict'; + /** + * @main + * @module hammer + * + * @class Hammer + * @static + */ -/** - * Set a new size for the graph - * @param {string} width Width in pixels or percentage (for example '800px' - * or '50%') - * @param {string} height Height in pixels or percentage (for example '400px' - * or '30%') - */ -Graph3d.prototype.setSize = function(width, height) { - this.frame.style.width = width; - this.frame.style.height = height; + /** + * Hammer, use this to create instances + * ```` + * var hammertime = new Hammer(myElement); + * ```` + * + * @method Hammer + * @param {HTMLElement} element + * @param {Object} [options={}] + * @return {Hammer.Instance} + */ + var Hammer = function Hammer(element, options) { + return new Hammer.Instance(element, options || {}); + }; - this._resizeCanvas(); -}; + /** + * version, as defined in package.json + * the value will be set at each build + * @property VERSION + * @final + * @type {String} + */ + Hammer.VERSION = '1.1.3'; -/** - * Resize the canvas to the current size of the frame - */ -Graph3d.prototype._resizeCanvas = function() { - this.frame.canvas.style.width = '100%'; - this.frame.canvas.style.height = '100%'; + /** + * default settings. + * more settings are defined per gesture at `/gestures`. Each gesture can be disabled/enabled + * by setting it's name (like `swipe`) to false. + * You can set the defaults for all instances by changing this object before creating an instance. + * @example + * ```` + * Hammer.defaults.drag = false; + * Hammer.defaults.behavior.touchAction = 'pan-y'; + * delete Hammer.defaults.behavior.userSelect; + * ```` + * @property defaults + * @type {Object} + */ + Hammer.defaults = { + /** + * this setting object adds styles and attributes to the element to prevent the browser from doing + * its native behavior. The css properties are auto prefixed for the browsers when needed. + * @property defaults.behavior + * @type {Object} + */ + behavior: { + /** + * Disables text selection to improve the dragging gesture. When the value is `none` it also sets + * `onselectstart=false` for IE on the element. Mainly for desktop browsers. + * @property defaults.behavior.userSelect + * @type {String} + * @default 'none' + */ + userSelect: 'none', - this.frame.canvas.width = this.frame.canvas.clientWidth; - this.frame.canvas.height = this.frame.canvas.clientHeight; + /** + * Specifies whether and how a given region can be manipulated by the user (for instance, by panning or zooming). + * Used by Chrome 35> and IE10>. By default this makes the element blocking any touch event. + * @property defaults.behavior.touchAction + * @type {String} + * @default: 'pan-y' + */ + touchAction: 'pan-y', - // adjust with for margin - this.frame.filter.style.width = (this.frame.canvas.clientWidth - 2 * 10) + 'px'; -}; + /** + * Disables the default callout shown when you touch and hold a touch target. + * On iOS, when you touch and hold a touch target such as a link, Safari displays + * a callout containing information about the link. This property allows you to disable that callout. + * @property defaults.behavior.touchCallout + * @type {String} + * @default 'none' + */ + touchCallout: 'none', -/** - * Start animation - */ -Graph3d.prototype.animationStart = function() { - if (!this.frame.filter || !this.frame.filter.slider) - throw 'No animation available'; + /** + * Specifies whether zooming is enabled. Used by IE10> + * @property defaults.behavior.contentZooming + * @type {String} + * @default 'none' + */ + contentZooming: 'none', - this.frame.filter.slider.play(); -}; + /** + * Specifies that an entire element should be draggable instead of its contents. + * Mainly for desktop browsers. + * @property defaults.behavior.userDrag + * @type {String} + * @default 'none' + */ + userDrag: 'none', + /** + * Overrides the highlight color shown when the user taps a link or a JavaScript + * clickable element in Safari on iPhone. This property obeys the alpha value, if specified. + * + * If you don't specify an alpha value, Safari on iPhone applies a default alpha value + * to the color. To disable tap highlighting, set the alpha value to 0 (invisible). + * If you set the alpha value to 1.0 (opaque), the element is not visible when tapped. + * @property defaults.behavior.tapHighlightColor + * @type {String} + * @default 'rgba(0,0,0,0)' + */ + tapHighlightColor: 'rgba(0,0,0,0)' + } + }; -/** - * Stop animation - */ -Graph3d.prototype.animationStop = function() { - if (!this.frame.filter || !this.frame.filter.slider) return; + /** + * hammer document where the base events are added at + * @property DOCUMENT + * @type {HTMLElement} + * @default window.document + */ + Hammer.DOCUMENT = document; - this.frame.filter.slider.stop(); -}; + /** + * detect support for pointer events + * @property HAS_POINTEREVENTS + * @type {Boolean} + */ + Hammer.HAS_POINTEREVENTS = navigator.pointerEnabled || navigator.msPointerEnabled; + /** + * detect support for touch events + * @property HAS_TOUCHEVENTS + * @type {Boolean} + */ + Hammer.HAS_TOUCHEVENTS = ('ontouchstart' in window); -/** - * Resize the center position based on the current values in this.defaultXCenter - * and this.defaultYCenter (which are strings with a percentage or a value - * in pixels). The center positions are the variables this.xCenter - * and this.yCenter - */ -Graph3d.prototype._resizeCenter = function() { - // calculate the horizontal center position - if (this.defaultXCenter.charAt(this.defaultXCenter.length-1) === '%') { - this.xcenter = - parseFloat(this.defaultXCenter) / 100 * - this.frame.canvas.clientWidth; - } - else { - this.xcenter = parseFloat(this.defaultXCenter); // supposed to be in px - } + /** + * detect mobile browsers + * @property IS_MOBILE + * @type {Boolean} + */ + Hammer.IS_MOBILE = /mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent); - // calculate the vertical center position - if (this.defaultYCenter.charAt(this.defaultYCenter.length-1) === '%') { - this.ycenter = - parseFloat(this.defaultYCenter) / 100 * - (this.frame.canvas.clientHeight - this.frame.filter.clientHeight); - } - else { - this.ycenter = parseFloat(this.defaultYCenter); // supposed to be in px - } -}; + /** + * detect if we want to support mouseevents at all + * @property NO_MOUSEEVENTS + * @type {Boolean} + */ + Hammer.NO_MOUSEEVENTS = (Hammer.HAS_TOUCHEVENTS && Hammer.IS_MOBILE) || Hammer.HAS_POINTEREVENTS; -/** - * Set the rotation and distance of the camera - * @param {Object} pos An object with the camera position. The object - * contains three parameters: - * - horizontal {Number} - * The horizontal rotation, between 0 and 2*PI. - * Optional, can be left undefined. - * - vertical {Number} - * The vertical rotation, between 0 and 0.5*PI - * if vertical=0.5*PI, the graph is shown from the - * top. Optional, can be left undefined. - * - distance {Number} - * The (normalized) distance of the camera to the - * center of the graph, a value between 0.71 and 5.0. - * Optional, can be left undefined. - */ -Graph3d.prototype.setCameraPosition = function(pos) { - if (pos === undefined) { - return; - } + /** + * interval in which Hammer recalculates current velocity/direction/angle in ms + * @property CALCULATE_INTERVAL + * @type {Number} + * @default 25 + */ + Hammer.CALCULATE_INTERVAL = 25; - if (pos.horizontal !== undefined && pos.vertical !== undefined) { - this.camera.setArmRotation(pos.horizontal, pos.vertical); - } + /** + * eventtypes per touchevent (start, move, end) are filled by `Event.determineEventTypes` on `setup` + * the object contains the DOM event names per type (`EVENT_START`, `EVENT_MOVE`, `EVENT_END`) + * @property EVENT_TYPES + * @private + * @writeOnce + * @type {Object} + */ + var EVENT_TYPES = {}; - if (pos.distance !== undefined) { - this.camera.setArmLength(pos.distance); - } + /** + * direction strings, for safe comparisons + * @property DIRECTION_DOWN|LEFT|UP|RIGHT + * @final + * @type {String} + * @default 'down' 'left' 'up' 'right' + */ + var DIRECTION_DOWN = Hammer.DIRECTION_DOWN = 'down'; + var DIRECTION_LEFT = Hammer.DIRECTION_LEFT = 'left'; + var DIRECTION_UP = Hammer.DIRECTION_UP = 'up'; + var DIRECTION_RIGHT = Hammer.DIRECTION_RIGHT = 'right'; - this.redraw(); -}; + /** + * pointertype strings, for safe comparisons + * @property POINTER_MOUSE|TOUCH|PEN + * @final + * @type {String} + * @default 'mouse' 'touch' 'pen' + */ + var POINTER_MOUSE = Hammer.POINTER_MOUSE = 'mouse'; + var POINTER_TOUCH = Hammer.POINTER_TOUCH = 'touch'; + var POINTER_PEN = Hammer.POINTER_PEN = 'pen'; + /** + * eventtypes + * @property EVENT_START|MOVE|END|RELEASE|TOUCH + * @final + * @type {String} + * @default 'start' 'change' 'move' 'end' 'release' 'touch' + */ + var EVENT_START = Hammer.EVENT_START = 'start'; + var EVENT_MOVE = Hammer.EVENT_MOVE = 'move'; + var EVENT_END = Hammer.EVENT_END = 'end'; + var EVENT_RELEASE = Hammer.EVENT_RELEASE = 'release'; + var EVENT_TOUCH = Hammer.EVENT_TOUCH = 'touch'; -/** - * Retrieve the current camera rotation - * @return {object} An object with parameters horizontal, vertical, and - * distance - */ -Graph3d.prototype.getCameraPosition = function() { - var pos = this.camera.getArmRotation(); - pos.distance = this.camera.getArmLength(); - return pos; -}; + /** + * if the window events are set... + * @property READY + * @writeOnce + * @type {Boolean} + * @default false + */ + Hammer.READY = false; -/** - * Load data into the 3D Graph - */ -Graph3d.prototype._readData = function(data) { - // read the data - this._dataInitialize(data, this.style); + /** + * plugins namespace + * @property plugins + * @type {Object} + */ + Hammer.plugins = Hammer.plugins || {}; + /** + * gestures namespace + * see `/gestures` for the definitions + * @property gestures + * @type {Object} + */ + Hammer.gestures = Hammer.gestures || {}; - if (this.dataFilter) { - // apply filtering - this.dataPoints = this.dataFilter._getDataPoints(); - } - else { - // no filtering. load all data - this.dataPoints = this._getDataPoints(this.dataTable); - } + /** + * setup events to detect gestures on the document + * this function is called when creating an new instance + * @private + */ + function setup() { + if(Hammer.READY) { + return; + } - // draw the filter - this._redrawFilter(); -}; + // find what eventtypes we add listeners to + Event.determineEventTypes(); -/** - * Replace the dataset of the Graph3d - * @param {Array | DataSet | DataView} data - */ -Graph3d.prototype.setData = function (data) { - this._readData(data); - this.redraw(); + // Register all gestures inside Hammer.gestures + Utils.each(Hammer.gestures, function(gesture) { + Detection.register(gesture); + }); - // start animation when option is true - if (this.animationAutoStart && this.dataFilter) { - this.animationStart(); - } -}; + // Add touch events on the document + Event.onTouch(Hammer.DOCUMENT, EVENT_MOVE, Detection.detect); + Event.onTouch(Hammer.DOCUMENT, EVENT_END, Detection.detect); -/** - * Update the options. Options will be merged with current options - * @param {Object} options - */ -Graph3d.prototype.setOptions = function (options) { - var cameraPosition = undefined; - - this.animationStop(); - - if (options !== undefined) { - // retrieve parameter values - if (options.width !== undefined) this.width = options.width; - if (options.height !== undefined) this.height = options.height; - - if (options.xCenter !== undefined) this.defaultXCenter = options.xCenter; - if (options.yCenter !== undefined) this.defaultYCenter = options.yCenter; - - if (options.filterLabel !== undefined) this.filterLabel = options.filterLabel; - if (options.legendLabel !== undefined) this.legendLabel = options.legendLabel; - if (options.xLabel !== undefined) this.xLabel = options.xLabel; - if (options.yLabel !== undefined) this.yLabel = options.yLabel; - if (options.zLabel !== undefined) this.zLabel = options.zLabel; - - if (options.style !== undefined) { - var styleNumber = this._getStyleNumber(options.style); - if (styleNumber !== -1) { - this.style = styleNumber; - } - } - if (options.showGrid !== undefined) this.showGrid = options.showGrid; - if (options.showPerspective !== undefined) this.showPerspective = options.showPerspective; - if (options.showShadow !== undefined) this.showShadow = options.showShadow; - if (options.tooltip !== undefined) this.showTooltip = options.tooltip; - if (options.showAnimationControls !== undefined) this.showAnimationControls = options.showAnimationControls; - if (options.keepAspectRatio !== undefined) this.keepAspectRatio = options.keepAspectRatio; - if (options.verticalRatio !== undefined) this.verticalRatio = options.verticalRatio; - - if (options.animationInterval !== undefined) this.animationInterval = options.animationInterval; - if (options.animationPreload !== undefined) this.animationPreload = options.animationPreload; - if (options.animationAutoStart !== undefined)this.animationAutoStart = options.animationAutoStart; - - if (options.xBarWidth !== undefined) this.defaultXBarWidth = options.xBarWidth; - if (options.yBarWidth !== undefined) this.defaultYBarWidth = options.yBarWidth; - - if (options.xMin !== undefined) this.defaultXMin = options.xMin; - if (options.xStep !== undefined) this.defaultXStep = options.xStep; - if (options.xMax !== undefined) this.defaultXMax = options.xMax; - if (options.yMin !== undefined) this.defaultYMin = options.yMin; - if (options.yStep !== undefined) this.defaultYStep = options.yStep; - if (options.yMax !== undefined) this.defaultYMax = options.yMax; - if (options.zMin !== undefined) this.defaultZMin = options.zMin; - if (options.zStep !== undefined) this.defaultZStep = options.zStep; - if (options.zMax !== undefined) this.defaultZMax = options.zMax; - if (options.valueMin !== undefined) this.defaultValueMin = options.valueMin; - if (options.valueMax !== undefined) this.defaultValueMax = options.valueMax; - - if (options.cameraPosition !== undefined) cameraPosition = options.cameraPosition; - - if (cameraPosition !== undefined) { - this.camera.setArmRotation(cameraPosition.horizontal, cameraPosition.vertical); - this.camera.setArmLength(cameraPosition.distance); - } - else { - this.camera.setArmRotation(1.0, 0.5); - this.camera.setArmLength(1.7); - } + // Hammer is ready...! + Hammer.READY = true; } - this._setBackgroundColor(options && options.backgroundColor); - - this.setSize(this.width, this.height); - - // re-load the data - if (this.dataTable) { - this.setData(this.dataTable); - } + /** + * @module hammer + * + * @class Utils + * @static + */ + var Utils = Hammer.utils = { + /** + * extend method, could also be used for cloning when `dest` is an empty object. + * changes the dest object + * @method extend + * @param {Object} dest + * @param {Object} src + * @param {Boolean} [merge=false] do a merge + * @return {Object} dest + */ + extend: function extend(dest, src, merge) { + for(var key in src) { + if(!src.hasOwnProperty(key) || (dest[key] !== undefined && merge)) { + continue; + } + dest[key] = src[key]; + } + return dest; + }, - // start animation when option is true - if (this.animationAutoStart && this.dataFilter) { - this.animationStart(); - } -}; + /** + * simple addEventListener wrapper + * @method on + * @param {HTMLElement} element + * @param {String} type + * @param {Function} handler + */ + on: function on(element, type, handler) { + element.addEventListener(type, handler, false); + }, -/** - * Redraw the Graph. - */ -Graph3d.prototype.redraw = function() { - if (this.dataPoints === undefined) { - throw 'Error: graph data not initialized'; - } + /** + * simple removeEventListener wrapper + * @method off + * @param {HTMLElement} element + * @param {String} type + * @param {Function} handler + */ + off: function off(element, type, handler) { + element.removeEventListener(type, handler, false); + }, - this._resizeCanvas(); - this._resizeCenter(); - this._redrawSlider(); - this._redrawClear(); - this._redrawAxis(); + /** + * forEach over arrays and objects + * @method each + * @param {Object|Array} obj + * @param {Function} iterator + * @param {any} iterator.item + * @param {Number} iterator.index + * @param {Object|Array} iterator.obj the source object + * @param {Object} context value to use as `this` in the iterator + */ + each: function each(obj, iterator, context) { + var i, len; + + // native forEach on arrays + if('forEach' in obj) { + obj.forEach(iterator, context); + // arrays + } else if(obj.length !== undefined) { + for(i = 0, len = obj.length; i < len; i++) { + if(iterator.call(context, obj[i], i, obj) === false) { + return; + } + } + // objects + } else { + for(i in obj) { + if(obj.hasOwnProperty(i) && + iterator.call(context, obj[i], i, obj) === false) { + return; + } + } + } + }, - if (this.style === Graph3d.STYLE.GRID || - this.style === Graph3d.STYLE.SURFACE) { - this._redrawDataGrid(); - } - else if (this.style === Graph3d.STYLE.LINE) { - this._redrawDataLine(); - } - else if (this.style === Graph3d.STYLE.BAR || - this.style === Graph3d.STYLE.BARCOLOR || - this.style === Graph3d.STYLE.BARSIZE) { - this._redrawDataBar(); - } - else { - // style is DOT, DOTLINE, DOTCOLOR, DOTSIZE - this._redrawDataDot(); - } + /** + * find if a string contains the string using indexOf + * @method inStr + * @param {String} src + * @param {String} find + * @return {Boolean} found + */ + inStr: function inStr(src, find) { + return src.indexOf(find) > -1; + }, - this._redrawInfo(); - this._redrawLegend(); -}; + /** + * find if a array contains the object using indexOf or a simple polyfill + * @method inArray + * @param {String} src + * @param {String} find + * @return {Boolean|Number} false when not found, or the index + */ + inArray: function inArray(src, find) { + if(src.indexOf) { + var index = src.indexOf(find); + return (index === -1) ? false : index; + } else { + for(var i = 0, len = src.length; i < len; i++) { + if(src[i] === find) { + return i; + } + } + return false; + } + }, -/** - * Clear the canvas before redrawing - */ -Graph3d.prototype._redrawClear = function() { - var canvas = this.frame.canvas; - var ctx = canvas.getContext('2d'); + /** + * convert an array-like object (`arguments`, `touchlist`) to an array + * @method toArray + * @param {Object} obj + * @return {Array} + */ + toArray: function toArray(obj) { + return Array.prototype.slice.call(obj, 0); + }, - ctx.clearRect(0, 0, canvas.width, canvas.height); -}; + /** + * find if a node is in the given parent + * @method hasParent + * @param {HTMLElement} node + * @param {HTMLElement} parent + * @return {Boolean} found + */ + hasParent: function hasParent(node, parent) { + while(node) { + if(node == parent) { + return true; + } + node = node.parentNode; + } + return false; + }, + /** + * get the center of all the touches + * @method getCenter + * @param {Array} touches + * @return {Object} center contains `pageX`, `pageY`, `clientX` and `clientY` properties + */ + getCenter: function getCenter(touches) { + var pageX = [], + pageY = [], + clientX = [], + clientY = [], + min = Math.min, + max = Math.max; + + // no need to loop when only one touch + if(touches.length === 1) { + return { + pageX: touches[0].pageX, + pageY: touches[0].pageY, + clientX: touches[0].clientX, + clientY: touches[0].clientY + }; + } -/** - * Redraw the legend showing the colors - */ -Graph3d.prototype._redrawLegend = function() { - var y; + Utils.each(touches, function(touch) { + pageX.push(touch.pageX); + pageY.push(touch.pageY); + clientX.push(touch.clientX); + clientY.push(touch.clientY); + }); - if (this.style === Graph3d.STYLE.DOTCOLOR || - this.style === Graph3d.STYLE.DOTSIZE) { + return { + pageX: (min.apply(Math, pageX) + max.apply(Math, pageX)) / 2, + pageY: (min.apply(Math, pageY) + max.apply(Math, pageY)) / 2, + clientX: (min.apply(Math, clientX) + max.apply(Math, clientX)) / 2, + clientY: (min.apply(Math, clientY) + max.apply(Math, clientY)) / 2 + }; + }, - var dotSize = this.frame.clientWidth * 0.02; + /** + * calculate the velocity between two points. unit is in px per ms. + * @method getVelocity + * @param {Number} deltaTime + * @param {Number} deltaX + * @param {Number} deltaY + * @return {Object} velocity `x` and `y` + */ + getVelocity: function getVelocity(deltaTime, deltaX, deltaY) { + return { + x: Math.abs(deltaX / deltaTime) || 0, + y: Math.abs(deltaY / deltaTime) || 0 + }; + }, - var widthMin, widthMax; - if (this.style === Graph3d.STYLE.DOTSIZE) { - widthMin = dotSize / 2; // px - widthMax = dotSize / 2 + dotSize * 2; // Todo: put this in one function - } - else { - widthMin = 20; // px - widthMax = 20; // px - } + /** + * calculate the angle between two coordinates + * @method getAngle + * @param {Touch} touch1 + * @param {Touch} touch2 + * @return {Number} angle + */ + getAngle: function getAngle(touch1, touch2) { + var x = touch2.clientX - touch1.clientX, + y = touch2.clientY - touch1.clientY; - var height = Math.max(this.frame.clientHeight * 0.25, 100); - var top = this.margin; - var right = this.frame.clientWidth - this.margin; - var left = right - widthMax; - var bottom = top + height; - } + return Math.atan2(y, x) * 180 / Math.PI; + }, - var canvas = this.frame.canvas; - var ctx = canvas.getContext('2d'); - ctx.lineWidth = 1; - ctx.font = '14px arial'; // TODO: put in options + /** + * do a small comparision to get the direction between two touches. + * @method getDirection + * @param {Touch} touch1 + * @param {Touch} touch2 + * @return {String} direction matches `DIRECTION_LEFT|RIGHT|UP|DOWN` + */ + getDirection: function getDirection(touch1, touch2) { + var x = Math.abs(touch1.clientX - touch2.clientX), + y = Math.abs(touch1.clientY - touch2.clientY); - if (this.style === Graph3d.STYLE.DOTCOLOR) { - // draw the color bar - var ymin = 0; - var ymax = height; // Todo: make height customizable - for (y = ymin; y < ymax; y++) { - var f = (y - ymin) / (ymax - ymin); + if(x >= y) { + return touch1.clientX - touch2.clientX > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + return touch1.clientY - touch2.clientY > 0 ? DIRECTION_UP : DIRECTION_DOWN; + }, - //var width = (dotSize / 2 + (1-f) * dotSize * 2); // Todo: put this in one function - var hue = f * 240; - var color = this._hsv2rgb(hue, 1, 1); + /** + * calculate the distance between two touches + * @method getDistance + * @param {Touch}touch1 + * @param {Touch} touch2 + * @return {Number} distance + */ + getDistance: function getDistance(touch1, touch2) { + var x = touch2.clientX - touch1.clientX, + y = touch2.clientY - touch1.clientY; - ctx.strokeStyle = color; - ctx.beginPath(); - ctx.moveTo(left, top + y); - ctx.lineTo(right, top + y); - ctx.stroke(); - } + return Math.sqrt((x * x) + (y * y)); + }, - ctx.strokeStyle = this.colorAxis; - ctx.strokeRect(left, top, widthMax, height); - } + /** + * calculate the scale factor between two touchLists + * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out + * @method getScale + * @param {Array} start array of touches + * @param {Array} end array of touches + * @return {Number} scale + */ + getScale: function getScale(start, end) { + // need two fingers... + if(start.length >= 2 && end.length >= 2) { + return this.getDistance(end[0], end[1]) / this.getDistance(start[0], start[1]); + } + return 1; + }, - if (this.style === Graph3d.STYLE.DOTSIZE) { - // draw border around color bar - ctx.strokeStyle = this.colorAxis; - ctx.fillStyle = this.colorDot; - ctx.beginPath(); - ctx.moveTo(left, top); - ctx.lineTo(right, top); - ctx.lineTo(right - widthMax + widthMin, bottom); - ctx.lineTo(left, bottom); - ctx.closePath(); - ctx.fill(); - ctx.stroke(); - } + /** + * calculate the rotation degrees between two touchLists + * @method getRotation + * @param {Array} start array of touches + * @param {Array} end array of touches + * @return {Number} rotation + */ + getRotation: function getRotation(start, end) { + // need two fingers + if(start.length >= 2 && end.length >= 2) { + return this.getAngle(end[1], end[0]) - this.getAngle(start[1], start[0]); + } + return 0; + }, - if (this.style === Graph3d.STYLE.DOTCOLOR || - this.style === Graph3d.STYLE.DOTSIZE) { - // print values along the color bar - var gridLineLen = 5; // px - var step = new StepNumber(this.valueMin, this.valueMax, (this.valueMax-this.valueMin)/5, true); - step.start(); - if (step.getCurrent() < this.valueMin) { - step.next(); - } - while (!step.end()) { - y = bottom - (step.getCurrent() - this.valueMin) / (this.valueMax - this.valueMin) * height; + /** + * find out if the direction is vertical * + * @method isVertical + * @param {String} direction matches `DIRECTION_UP|DOWN` + * @return {Boolean} is_vertical + */ + isVertical: function isVertical(direction) { + return direction == DIRECTION_UP || direction == DIRECTION_DOWN; + }, - ctx.beginPath(); - ctx.moveTo(left - gridLineLen, y); - ctx.lineTo(left, y); - ctx.stroke(); + /** + * set css properties with their prefixes + * @param {HTMLElement} element + * @param {String} prop + * @param {String} value + * @param {Boolean} [toggle=true] + * @return {Boolean} + */ + setPrefixedCss: function setPrefixedCss(element, prop, value, toggle) { + var prefixes = ['', 'Webkit', 'Moz', 'O', 'ms']; + prop = Utils.toCamelCase(prop); + + for(var i = 0; i < prefixes.length; i++) { + var p = prop; + // prefixes + if(prefixes[i]) { + p = prefixes[i] + p.slice(0, 1).toUpperCase() + p.slice(1); + } - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - ctx.fillStyle = this.colorAxis; - ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y); + // test the style + if(p in element.style) { + element.style[p] = (toggle == null || toggle) && value || ''; + break; + } + } + }, - step.next(); - } + /** + * toggle browser default behavior by setting css properties. + * `userSelect='none'` also sets `element.onselectstart` to false + * `userDrag='none'` also sets `element.ondragstart` to false + * + * @method toggleBehavior + * @param {HtmlElement} element + * @param {Object} props + * @param {Boolean} [toggle=true] + */ + toggleBehavior: function toggleBehavior(element, props, toggle) { + if(!props || !element || !element.style) { + return; + } - ctx.textAlign = 'right'; - ctx.textBaseline = 'top'; - var label = this.legendLabel; - ctx.fillText(label, right, bottom + this.margin); - } -}; + // set the css properties + Utils.each(props, function(value, prop) { + Utils.setPrefixedCss(element, prop, value, toggle); + }); -/** - * Redraw the filter - */ -Graph3d.prototype._redrawFilter = function() { - this.frame.filter.innerHTML = ''; + var falseFn = toggle && function() { + return false; + }; - if (this.dataFilter) { - var options = { - 'visible': this.showAnimationControls - }; - var slider = new Slider(this.frame.filter, options); - this.frame.filter.slider = slider; + // also the disable onselectstart + if(props.userSelect == 'none') { + element.onselectstart = falseFn; + } + // and disable ondragstart + if(props.userDrag == 'none') { + element.ondragstart = falseFn; + } + }, - // TODO: css here is not nice here... - this.frame.filter.style.padding = '10px'; - //this.frame.filter.style.backgroundColor = '#EFEFEF'; + /** + * convert a string with underscores to camelCase + * so prevent_default becomes preventDefault + * @param {String} str + * @return {String} camelCaseStr + */ + toCamelCase: function toCamelCase(str) { + return str.replace(/[_-]([a-z])/g, function(s) { + return s[1].toUpperCase(); + }); + } + }; - slider.setValues(this.dataFilter.values); - slider.setPlayInterval(this.animationInterval); - // create an event handler - var me = this; - var onchange = function () { - var index = slider.getIndex(); + /** + * @module hammer + */ + /** + * @class Event + * @static + */ + var Event = Hammer.event = { + /** + * when touch events have been fired, this is true + * this is used to stop mouse events + * @property prevent_mouseevents + * @private + * @type {Boolean} + */ + preventMouseEvents: false, - me.dataFilter.selectValue(index); - me.dataPoints = me.dataFilter._getDataPoints(); + /** + * if EVENT_START has been fired + * @property started + * @private + * @type {Boolean} + */ + started: false, - me.redraw(); - }; - slider.setOnChangeCallback(onchange); - } - else { - this.frame.filter.slider = undefined; - } -}; + /** + * when the mouse is hold down, this is true + * @property should_detect + * @private + * @type {Boolean} + */ + shouldDetect: false, -/** - * Redraw the slider - */ -Graph3d.prototype._redrawSlider = function() { - if ( this.frame.filter.slider !== undefined) { - this.frame.filter.slider.redraw(); - } -}; + /** + * simple event binder with a hook and support for multiple types + * @method on + * @param {HTMLElement} element + * @param {String} type + * @param {Function} handler + * @param {Function} [hook] + * @param {Object} hook.type + */ + on: function on(element, type, handler, hook) { + var types = type.split(' '); + Utils.each(types, function(type) { + Utils.on(element, type, handler); + hook && hook(type); + }); + }, + /** + * simple event unbinder with a hook and support for multiple types + * @method off + * @param {HTMLElement} element + * @param {String} type + * @param {Function} handler + * @param {Function} [hook] + * @param {Object} hook.type + */ + off: function off(element, type, handler, hook) { + var types = type.split(' '); + Utils.each(types, function(type) { + Utils.off(element, type, handler); + hook && hook(type); + }); + }, -/** - * Redraw common information - */ -Graph3d.prototype._redrawInfo = function() { - if (this.dataFilter) { - var canvas = this.frame.canvas; - var ctx = canvas.getContext('2d'); + /** + * the core touch event handler. + * this finds out if we should to detect gestures + * @method onTouch + * @param {HTMLElement} element + * @param {String} eventType matches `EVENT_START|MOVE|END` + * @param {Function} handler + * @return onTouchHandler {Function} the core event handler + */ + onTouch: function onTouch(element, eventType, handler) { + var self = this; + + var onTouchHandler = function onTouchHandler(ev) { + var srcType = ev.type.toLowerCase(), + isPointer = Hammer.HAS_POINTEREVENTS, + isMouse = Utils.inStr(srcType, 'mouse'), + triggerType; + + // if we are in a mouseevent, but there has been a touchevent triggered in this session + // we want to do nothing. simply break out of the event. + if(isMouse && self.preventMouseEvents) { + return; + + // mousebutton must be down + } else if(isMouse && eventType == EVENT_START && ev.button === 0) { + self.preventMouseEvents = false; + self.shouldDetect = true; + } else if(isPointer && eventType == EVENT_START) { + self.shouldDetect = (ev.buttons === 1 || PointerEvent.matchType(POINTER_TOUCH, ev)); + // just a valid start event, but no mouse + } else if(!isMouse && eventType == EVENT_START) { + self.preventMouseEvents = true; + self.shouldDetect = true; + } - ctx.font = '14px arial'; // TODO: put in options - ctx.lineStyle = 'gray'; - ctx.fillStyle = 'gray'; - ctx.textAlign = 'left'; - ctx.textBaseline = 'top'; - - var x = this.margin; - var y = this.margin; - ctx.fillText(this.dataFilter.getLabel() + ': ' + this.dataFilter.getSelectedValue(), x, y); - } -}; + // update the pointer event before entering the detection + if(isPointer && eventType != EVENT_END) { + PointerEvent.updatePointer(eventType, ev); + } + // we are in a touch/down state, so allowed detection of gestures + if(self.shouldDetect) { + triggerType = self.doDetect.call(self, ev, eventType, element, handler); + } -/** - * Redraw the axis - */ -Graph3d.prototype._redrawAxis = function() { - var canvas = this.frame.canvas, - ctx = canvas.getContext('2d'), - from, to, step, prettyStep, - text, xText, yText, zText, - offset, xOffset, yOffset, - xMin2d, xMax2d; - - // TODO: get the actual rendered style of the containerElement - //ctx.font = this.containerElement.style.font; - ctx.font = 24 / this.camera.getArmLength() + 'px arial'; - - // calculate the length for the short grid lines - var gridLenX = 0.025 / this.scale.x; - var gridLenY = 0.025 / this.scale.y; - var textMargin = 5 / this.camera.getArmLength(); // px - var armAngle = this.camera.getArmRotation().horizontal; - - // draw x-grid lines - ctx.lineWidth = 1; - prettyStep = (this.defaultXStep === undefined); - step = new StepNumber(this.xMin, this.xMax, this.xStep, prettyStep); - step.start(); - if (step.getCurrent() < this.xMin) { - step.next(); - } - while (!step.end()) { - var x = step.getCurrent(); + // ...and we are done with the detection + // so reset everything to start each detection totally fresh + if(triggerType == EVENT_END) { + self.preventMouseEvents = false; + self.shouldDetect = false; + PointerEvent.reset(); + // update the pointerevent object after the detection + } - if (this.showGrid) { - from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); - to = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); - ctx.strokeStyle = this.colorGrid; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - } - else { - from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); - to = this._convert3Dto2D(new Point3d(x, this.yMin+gridLenX, this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); + if(isPointer && eventType == EVENT_END) { + PointerEvent.updatePointer(eventType, ev); + } + }; - from = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); - to = this._convert3Dto2D(new Point3d(x, this.yMax-gridLenX, this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - } + this.on(element, EVENT_TYPES[eventType], onTouchHandler); + return onTouchHandler; + }, - yText = (Math.cos(armAngle) > 0) ? this.yMin : this.yMax; - text = this._convert3Dto2D(new Point3d(x, yText, this.zMin)); - if (Math.cos(armAngle * 2) > 0) { - ctx.textAlign = 'center'; - ctx.textBaseline = 'top'; - text.y += textMargin; - } - else if (Math.sin(armAngle * 2) < 0){ - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - } - else { - ctx.textAlign = 'left'; - ctx.textBaseline = 'middle'; - } - ctx.fillStyle = this.colorAxis; - ctx.fillText(' ' + step.getCurrent() + ' ', text.x, text.y); + /** + * the core detection method + * this finds out what hammer-touch-events to trigger + * @method doDetect + * @param {Object} ev + * @param {String} eventType matches `EVENT_START|MOVE|END` + * @param {HTMLElement} element + * @param {Function} handler + * @return {String} triggerType matches `EVENT_START|MOVE|END` + */ + doDetect: function doDetect(ev, eventType, element, handler) { + var touchList = this.getTouchList(ev, eventType); + var touchListLength = touchList.length; + var triggerType = eventType; + var triggerChange = touchList.trigger; // used by fakeMultitouch plugin + var changedLength = touchListLength; + + // at each touchstart-like event we want also want to trigger a TOUCH event... + if(eventType == EVENT_START) { + triggerChange = EVENT_TOUCH; + // ...the same for a touchend-like event + } else if(eventType == EVENT_END) { + triggerChange = EVENT_RELEASE; + + // keep track of how many touches have been removed + changedLength = touchList.length - ((ev.changedTouches) ? ev.changedTouches.length : 1); + } - step.next(); - } + // after there are still touches on the screen, + // we just want to trigger a MOVE event. so change the START or END to a MOVE + // but only after detection has been started, the first time we actualy want a START + if(changedLength > 0 && this.started) { + triggerType = EVENT_MOVE; + } - // draw y-grid lines - ctx.lineWidth = 1; - prettyStep = (this.defaultYStep === undefined); - step = new StepNumber(this.yMin, this.yMax, this.yStep, prettyStep); - step.start(); - if (step.getCurrent() < this.yMin) { - step.next(); - } - while (!step.end()) { - if (this.showGrid) { - from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); - to = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); - ctx.strokeStyle = this.colorGrid; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - } - else { - from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); - to = this._convert3Dto2D(new Point3d(this.xMin+gridLenY, step.getCurrent(), this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); + // detection has been started, we keep track of this, see above + this.started = true; - from = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); - to = this._convert3Dto2D(new Point3d(this.xMax-gridLenY, step.getCurrent(), this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - } + // generate some event data, some basic information + var evData = this.collectEventData(element, triggerType, touchList, ev); - xText = (Math.sin(armAngle ) > 0) ? this.xMin : this.xMax; - text = this._convert3Dto2D(new Point3d(xText, step.getCurrent(), this.zMin)); - if (Math.cos(armAngle * 2) < 0) { - ctx.textAlign = 'center'; - ctx.textBaseline = 'top'; - text.y += textMargin; - } - else if (Math.sin(armAngle * 2) > 0){ - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - } - else { - ctx.textAlign = 'left'; - ctx.textBaseline = 'middle'; - } - ctx.fillStyle = this.colorAxis; - ctx.fillText(' ' + step.getCurrent() + ' ', text.x, text.y); + // trigger the triggerType event before the change (TOUCH, RELEASE) events + // but the END event should be at last + if(eventType != EVENT_END) { + handler.call(Detection, evData); + } - step.next(); - } + // trigger a change (TOUCH, RELEASE) event, this means the length of the touches changed + if(triggerChange) { + evData.changedLength = changedLength; + evData.eventType = triggerChange; - // draw z-grid lines and axis - ctx.lineWidth = 1; - prettyStep = (this.defaultZStep === undefined); - step = new StepNumber(this.zMin, this.zMax, this.zStep, prettyStep); - step.start(); - if (step.getCurrent() < this.zMin) { - step.next(); - } - xText = (Math.cos(armAngle ) > 0) ? this.xMin : this.xMax; - yText = (Math.sin(armAngle ) < 0) ? this.yMin : this.yMax; - while (!step.end()) { - // TODO: make z-grid lines really 3d? - from = this._convert3Dto2D(new Point3d(xText, yText, step.getCurrent())); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(from.x - textMargin, from.y); - ctx.stroke(); + handler.call(Detection, evData); - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - ctx.fillStyle = this.colorAxis; - ctx.fillText(step.getCurrent() + ' ', from.x - 5, from.y); + evData.eventType = triggerType; + delete evData.changedLength; + } - step.next(); - } - ctx.lineWidth = 1; - from = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); - to = this._convert3Dto2D(new Point3d(xText, yText, this.zMax)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - - // draw x-axis - ctx.lineWidth = 1; - // line at yMin - xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); - xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(xMin2d.x, xMin2d.y); - ctx.lineTo(xMax2d.x, xMax2d.y); - ctx.stroke(); - // line at ymax - xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); - xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(xMin2d.x, xMin2d.y); - ctx.lineTo(xMax2d.x, xMax2d.y); - ctx.stroke(); - - // draw y-axis - ctx.lineWidth = 1; - // line at xMin - from = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); - to = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - // line at xMax - from = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); - to = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); - ctx.strokeStyle = this.colorAxis; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - - // draw x-label - var xLabel = this.xLabel; - if (xLabel.length > 0) { - yOffset = 0.1 / this.scale.y; - xText = (this.xMin + this.xMax) / 2; - yText = (Math.cos(armAngle) > 0) ? this.yMin - yOffset: this.yMax + yOffset; - text = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); - if (Math.cos(armAngle * 2) > 0) { - ctx.textAlign = 'center'; - ctx.textBaseline = 'top'; - } - else if (Math.sin(armAngle * 2) < 0){ - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - } - else { - ctx.textAlign = 'left'; - ctx.textBaseline = 'middle'; - } - ctx.fillStyle = this.colorAxis; - ctx.fillText(xLabel, text.x, text.y); - } + // trigger the END event + if(triggerType == EVENT_END) { + handler.call(Detection, evData); - // draw y-label - var yLabel = this.yLabel; - if (yLabel.length > 0) { - xOffset = 0.1 / this.scale.x; - xText = (Math.sin(armAngle ) > 0) ? this.xMin - xOffset : this.xMax + xOffset; - yText = (this.yMin + this.yMax) / 2; - text = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); - if (Math.cos(armAngle * 2) < 0) { - ctx.textAlign = 'center'; - ctx.textBaseline = 'top'; - } - else if (Math.sin(armAngle * 2) > 0){ - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - } - else { - ctx.textAlign = 'left'; - ctx.textBaseline = 'middle'; - } - ctx.fillStyle = this.colorAxis; - ctx.fillText(yLabel, text.x, text.y); - } + // ...and we are done with the detection + // so reset everything to start each detection totally fresh + this.started = false; + } - // draw z-label - var zLabel = this.zLabel; - if (zLabel.length > 0) { - offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis? - xText = (Math.cos(armAngle ) > 0) ? this.xMin : this.xMax; - yText = (Math.sin(armAngle ) < 0) ? this.yMin : this.yMax; - zText = (this.zMin + this.zMax) / 2; - text = this._convert3Dto2D(new Point3d(xText, yText, zText)); - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - ctx.fillStyle = this.colorAxis; - ctx.fillText(zLabel, text.x - offset, text.y); - } -}; + return triggerType; + }, -/** - * Calculate the color based on the given value. - * @param {Number} H Hue, a value be between 0 and 360 - * @param {Number} S Saturation, a value between 0 and 1 - * @param {Number} V Value, a value between 0 and 1 - */ -Graph3d.prototype._hsv2rgb = function(H, S, V) { - var R, G, B, C, Hi, X; - - C = V * S; - Hi = Math.floor(H/60); // hi = 0,1,2,3,4,5 - X = C * (1 - Math.abs(((H/60) % 2) - 1)); - - switch (Hi) { - case 0: R = C; G = X; B = 0; break; - case 1: R = X; G = C; B = 0; break; - case 2: R = 0; G = C; B = X; break; - case 3: R = 0; G = X; B = C; break; - case 4: R = X; G = 0; B = C; break; - case 5: R = C; G = 0; B = X; break; - - default: R = 0; G = 0; B = 0; break; - } + /** + * we have different events for each device/browser + * determine what we need and set them in the EVENT_TYPES constant + * the `onTouch` method is bind to these properties. + * @method determineEventTypes + * @return {Object} events + */ + determineEventTypes: function determineEventTypes() { + var types; + if(Hammer.HAS_POINTEREVENTS) { + if(window.PointerEvent) { + types = [ + 'pointerdown', + 'pointermove', + 'pointerup pointercancel lostpointercapture' + ]; + } else { + types = [ + 'MSPointerDown', + 'MSPointerMove', + 'MSPointerUp MSPointerCancel MSLostPointerCapture' + ]; + } + } else if(Hammer.NO_MOUSEEVENTS) { + types = [ + 'touchstart', + 'touchmove', + 'touchend touchcancel' + ]; + } else { + types = [ + 'touchstart mousedown', + 'touchmove mousemove', + 'touchend touchcancel mouseup' + ]; + } - return 'RGB(' + parseInt(R*255) + ',' + parseInt(G*255) + ',' + parseInt(B*255) + ')'; -}; + EVENT_TYPES[EVENT_START] = types[0]; + EVENT_TYPES[EVENT_MOVE] = types[1]; + EVENT_TYPES[EVENT_END] = types[2]; + return EVENT_TYPES; + }, + /** + * create touchList depending on the event + * @method getTouchList + * @param {Object} ev + * @param {String} eventType + * @return {Array} touches + */ + getTouchList: function getTouchList(ev, eventType) { + // get the fake pointerEvent touchlist + if(Hammer.HAS_POINTEREVENTS) { + return PointerEvent.getTouchList(); + } -/** - * Draw all datapoints as a grid - * This function can be used when the style is 'grid' - */ -Graph3d.prototype._redrawDataGrid = function() { - var canvas = this.frame.canvas, - ctx = canvas.getContext('2d'), - point, right, top, cross, - i, - topSideVisible, fillStyle, strokeStyle, lineWidth, - h, s, v, zAvg; + // get the touchlist + if(ev.touches) { + if(eventType == EVENT_MOVE) { + return ev.touches; + } + var identifiers = []; + var concat = [].concat(Utils.toArray(ev.touches), Utils.toArray(ev.changedTouches)); + var touchList = []; - if (this.dataPoints === undefined || this.dataPoints.length <= 0) - return; // TODO: throw exception? + Utils.each(concat, function(touch) { + if(Utils.inArray(identifiers, touch.identifier) === false) { + touchList.push(touch); + } + identifiers.push(touch.identifier); + }); - // calculate the translations and screen position of all points - for (i = 0; i < this.dataPoints.length; i++) { - var trans = this._convertPointToTranslation(this.dataPoints[i].point); - var screen = this._convertTranslationToScreen(trans); + return touchList; + } - this.dataPoints[i].trans = trans; - this.dataPoints[i].screen = screen; + // make fake touchList from mouse position + ev.identifier = 1; + return [ev]; + }, - // calculate the translation of the point at the bottom (needed for sorting) - var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); - this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; - } + /** + * collect basic event data + * @method collectEventData + * @param {HTMLElement} element + * @param {String} eventType matches `EVENT_START|MOVE|END` + * @param {Array} touches + * @param {Object} ev + * @return {Object} ev + */ + collectEventData: function collectEventData(element, eventType, touches, ev) { + // find out pointerType + var pointerType = POINTER_TOUCH; + if(Utils.inStr(ev.type, 'mouse') || PointerEvent.matchType(POINTER_MOUSE, ev)) { + pointerType = POINTER_MOUSE; + } else if(PointerEvent.matchType(POINTER_PEN, ev)) { + pointerType = POINTER_PEN; + } - // sort the points on depth of their (x,y) position (not on z) - var sortDepth = function (a, b) { - return b.dist - a.dist; + return { + center: Utils.getCenter(touches), + timeStamp: Date.now(), + target: ev.target, + touches: touches, + eventType: eventType, + pointerType: pointerType, + srcEvent: ev, + + /** + * prevent the browser default actions + * mostly used to disable scrolling of the browser + */ + preventDefault: function() { + var srcEvent = this.srcEvent; + srcEvent.preventManipulation && srcEvent.preventManipulation(); + srcEvent.preventDefault && srcEvent.preventDefault(); + }, + + /** + * stop bubbling the event up to its parents + */ + stopPropagation: function() { + this.srcEvent.stopPropagation(); + }, + + /** + * immediately stop gesture detection + * might be useful after a swipe was detected + * @return {*} + */ + stopDetect: function() { + return Detection.stopDetect(); + } + }; + } }; - this.dataPoints.sort(sortDepth); - - if (this.style === Graph3d.STYLE.SURFACE) { - for (i = 0; i < this.dataPoints.length; i++) { - point = this.dataPoints[i]; - right = this.dataPoints[i].pointRight; - top = this.dataPoints[i].pointTop; - cross = this.dataPoints[i].pointCross; - - if (point !== undefined && right !== undefined && top !== undefined && cross !== undefined) { - if (this.showGrayBottom || this.showShadow) { - // calculate the cross product of the two vectors from center - // to left and right, in order to know whether we are looking at the - // bottom or at the top side. We can also use the cross product - // for calculating light intensity - var aDiff = Point3d.subtract(cross.trans, point.trans); - var bDiff = Point3d.subtract(top.trans, right.trans); - var crossproduct = Point3d.crossProduct(aDiff, bDiff); - var len = crossproduct.length(); - // FIXME: there is a bug with determining the surface side (shadow or colored) - topSideVisible = (crossproduct.z > 0); - } - else { - topSideVisible = true; - } + /** + * @module hammer + * + * @class PointerEvent + * @static + */ + var PointerEvent = Hammer.PointerEvent = { + /** + * holds all pointers, by `identifier` + * @property pointers + * @type {Object} + */ + pointers: {}, - if (topSideVisible) { - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - zAvg = (point.point.z + right.point.z + top.point.z + cross.point.z) / 4; - h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; - s = 1; // saturation + /** + * get the pointers as an array + * @method getTouchList + * @return {Array} touchlist + */ + getTouchList: function getTouchList() { + var touchlist = []; + // we can use forEach since pointerEvents only is in IE10 + Utils.each(this.pointers, function(pointer) { + touchlist.push(pointer); + }); + return touchlist; + }, - if (this.showShadow) { - v = Math.min(1 + (crossproduct.x / len) / 2, 1); // value. TODO: scale - fillStyle = this._hsv2rgb(h, s, v); - strokeStyle = fillStyle; - } - else { - v = 1; - fillStyle = this._hsv2rgb(h, s, v); - strokeStyle = this.colorAxis; + /** + * update the position of a pointer + * @method updatePointer + * @param {String} eventType matches `EVENT_START|MOVE|END` + * @param {Object} pointerEvent + */ + updatePointer: function updatePointer(eventType, pointerEvent) { + if(eventType == EVENT_END || (eventType != EVENT_END && pointerEvent.buttons !== 1)) { + delete this.pointers[pointerEvent.pointerId]; + } else { + pointerEvent.identifier = pointerEvent.pointerId; + this.pointers[pointerEvent.pointerId] = pointerEvent; } - } - else { - fillStyle = 'gray'; - strokeStyle = this.colorAxis; - } - lineWidth = 0.5; + }, - ctx.lineWidth = lineWidth; - ctx.fillStyle = fillStyle; - ctx.strokeStyle = strokeStyle; - ctx.beginPath(); - ctx.moveTo(point.screen.x, point.screen.y); - ctx.lineTo(right.screen.x, right.screen.y); - ctx.lineTo(cross.screen.x, cross.screen.y); - ctx.lineTo(top.screen.x, top.screen.y); - ctx.closePath(); - ctx.fill(); - ctx.stroke(); - } - } - } - else { // grid style - for (i = 0; i < this.dataPoints.length; i++) { - point = this.dataPoints[i]; - right = this.dataPoints[i].pointRight; - top = this.dataPoints[i].pointTop; + /** + * check if ev matches pointertype + * @method matchType + * @param {String} pointerType matches `POINTER_MOUSE|TOUCH|PEN` + * @param {PointerEvent} ev + */ + matchType: function matchType(pointerType, ev) { + if(!ev.pointerType) { + return false; + } - if (point !== undefined) { - if (this.showPerspective) { - lineWidth = 2 / -point.trans.z; - } - else { - lineWidth = 2 * -(this.eye.z / this.camera.getArmLength()); - } - } + var pt = ev.pointerType, + types = {}; - if (point !== undefined && right !== undefined) { - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - zAvg = (point.point.z + right.point.z) / 2; - h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; + types[POINTER_MOUSE] = (pt === (ev.MSPOINTER_TYPE_MOUSE || POINTER_MOUSE)); + types[POINTER_TOUCH] = (pt === (ev.MSPOINTER_TYPE_TOUCH || POINTER_TOUCH)); + types[POINTER_PEN] = (pt === (ev.MSPOINTER_TYPE_PEN || POINTER_PEN)); + return types[pointerType]; + }, - ctx.lineWidth = lineWidth; - ctx.strokeStyle = this._hsv2rgb(h, 1, 1); - ctx.beginPath(); - ctx.moveTo(point.screen.x, point.screen.y); - ctx.lineTo(right.screen.x, right.screen.y); - ctx.stroke(); + /** + * reset the stored pointers + * @method reset + */ + reset: function resetList() { + this.pointers = {}; } + }; - if (point !== undefined && top !== undefined) { - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - zAvg = (point.point.z + top.point.z) / 2; - h = (1 - (zAvg - this.zMin) * this.scale.z / this.verticalRatio) * 240; - ctx.lineWidth = lineWidth; - ctx.strokeStyle = this._hsv2rgb(h, 1, 1); - ctx.beginPath(); - ctx.moveTo(point.screen.x, point.screen.y); - ctx.lineTo(top.screen.x, top.screen.y); - ctx.stroke(); - } - } - } -}; + /** + * @module hammer + * + * @class Detection + * @static + */ + var Detection = Hammer.detection = { + // contains all registred Hammer.gestures in the correct order + gestures: [], + // data of the current Hammer.gesture detection session + current: null, -/** - * Draw all datapoints as dots. - * This function can be used when the style is 'dot' or 'dot-line' - */ -Graph3d.prototype._redrawDataDot = function() { - var canvas = this.frame.canvas; - var ctx = canvas.getContext('2d'); - var i; - - if (this.dataPoints === undefined || this.dataPoints.length <= 0) - return; // TODO: throw exception? - - // calculate the translations of all points - for (i = 0; i < this.dataPoints.length; i++) { - var trans = this._convertPointToTranslation(this.dataPoints[i].point); - var screen = this._convertTranslationToScreen(trans); - this.dataPoints[i].trans = trans; - this.dataPoints[i].screen = screen; - - // calculate the distance from the point at the bottom to the camera - var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); - this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; - } + // the previous Hammer.gesture session data + // is a full clone of the previous gesture.current object + previous: null, - // order the translated points by depth - var sortDepth = function (a, b) { - return b.dist - a.dist; - }; - this.dataPoints.sort(sortDepth); + // when this becomes true, no gestures are fired + stopped: false, - // draw the datapoints as colored circles - var dotSize = this.frame.clientWidth * 0.02; // px - for (i = 0; i < this.dataPoints.length; i++) { - var point = this.dataPoints[i]; + /** + * start Hammer.gesture detection + * @method startDetect + * @param {Hammer.Instance} inst + * @param {Object} eventData + */ + startDetect: function startDetect(inst, eventData) { + // already busy with a Hammer.gesture detection on an element + if(this.current) { + return; + } - if (this.style === Graph3d.STYLE.DOTLINE) { - // draw a vertical line from the bottom to the graph value - //var from = this._convert3Dto2D(new Point3d(point.point.x, point.point.y, this.zMin)); - var from = this._convert3Dto2D(point.bottom); - ctx.lineWidth = 1; - ctx.strokeStyle = this.colorGrid; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(point.screen.x, point.screen.y); - ctx.stroke(); - } + this.stopped = false; + + // holds current session + this.current = { + inst: inst, // reference to HammerInstance we're working for + startEvent: Utils.extend({}, eventData), // start eventData for distances, timing etc + lastEvent: false, // last eventData + lastCalcEvent: false, // last eventData for calculations. + futureCalcEvent: false, // last eventData for calculations. + lastCalcData: {}, // last lastCalcData + name: '' // current gesture we're in/detected, can be 'tap', 'hold' etc + }; - // calculate radius for the circle - var size; - if (this.style === Graph3d.STYLE.DOTSIZE) { - size = dotSize/2 + 2*dotSize * (point.point.value - this.valueMin) / (this.valueMax - this.valueMin); - } - else { - size = dotSize; - } + this.detect(eventData); + }, - var radius; - if (this.showPerspective) { - radius = size / -point.trans.z; - } - else { - radius = size * -(this.eye.z / this.camera.getArmLength()); - } - if (radius < 0) { - radius = 0; - } + /** + * Hammer.gesture detection + * @method detect + * @param {Object} eventData + * @return {any} + */ + detect: function detect(eventData) { + if(!this.current || this.stopped) { + return; + } - var hue, color, borderColor; - if (this.style === Graph3d.STYLE.DOTCOLOR ) { - // calculate the color based on the value - hue = (1 - (point.point.value - this.valueMin) * this.scale.value) * 240; - color = this._hsv2rgb(hue, 1, 1); - borderColor = this._hsv2rgb(hue, 1, 0.8); - } - else if (this.style === Graph3d.STYLE.DOTSIZE) { - color = this.colorDot; - borderColor = this.colorDotBorder; - } - else { - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - hue = (1 - (point.point.z - this.zMin) * this.scale.z / this.verticalRatio) * 240; - color = this._hsv2rgb(hue, 1, 1); - borderColor = this._hsv2rgb(hue, 1, 0.8); - } + // extend event data with calculations about scale, distance etc + eventData = this.extendEventData(eventData); - // draw the circle - ctx.lineWidth = 1.0; - ctx.strokeStyle = borderColor; - ctx.fillStyle = color; - ctx.beginPath(); - ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI*2, true); - ctx.fill(); - ctx.stroke(); - } -}; + // hammer instance and instance options + var inst = this.current.inst, + instOptions = inst.options; + + // call Hammer.gesture handlers + Utils.each(this.gestures, function triggerGesture(gesture) { + // only when the instance options have enabled this gesture + if(!this.stopped && inst.enabled && instOptions[gesture.name]) { + gesture.handler.call(gesture, eventData, inst); + } + }, this); -/** - * Draw all datapoints as bars. - * This function can be used when the style is 'bar', 'bar-color', or 'bar-size' - */ -Graph3d.prototype._redrawDataBar = function() { - var canvas = this.frame.canvas; - var ctx = canvas.getContext('2d'); - var i, j, surface, corners; - - if (this.dataPoints === undefined || this.dataPoints.length <= 0) - return; // TODO: throw exception? - - // calculate the translations of all points - for (i = 0; i < this.dataPoints.length; i++) { - var trans = this._convertPointToTranslation(this.dataPoints[i].point); - var screen = this._convertTranslationToScreen(trans); - this.dataPoints[i].trans = trans; - this.dataPoints[i].screen = screen; - - // calculate the distance from the point at the bottom to the camera - var transBottom = this._convertPointToTranslation(this.dataPoints[i].bottom); - this.dataPoints[i].dist = this.showPerspective ? transBottom.length() : -transBottom.z; - } + // store as previous event event + if(this.current) { + this.current.lastEvent = eventData; + } - // order the translated points by depth - var sortDepth = function (a, b) { - return b.dist - a.dist; - }; - this.dataPoints.sort(sortDepth); + if(eventData.eventType == EVENT_END) { + this.stopDetect(); + } - // draw the datapoints as bars - var xWidth = this.xBarWidth / 2; - var yWidth = this.yBarWidth / 2; - for (i = 0; i < this.dataPoints.length; i++) { - var point = this.dataPoints[i]; + return eventData; + }, - // determine color - var hue, color, borderColor; - if (this.style === Graph3d.STYLE.BARCOLOR ) { - // calculate the color based on the value - hue = (1 - (point.point.value - this.valueMin) * this.scale.value) * 240; - color = this._hsv2rgb(hue, 1, 1); - borderColor = this._hsv2rgb(hue, 1, 0.8); - } - else if (this.style === Graph3d.STYLE.BARSIZE) { - color = this.colorDot; - borderColor = this.colorDotBorder; - } - else { - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - hue = (1 - (point.point.z - this.zMin) * this.scale.z / this.verticalRatio) * 240; - color = this._hsv2rgb(hue, 1, 1); - borderColor = this._hsv2rgb(hue, 1, 0.8); - } + /** + * clear the Hammer.gesture vars + * this is called on endDetect, but can also be used when a final Hammer.gesture has been detected + * to stop other Hammer.gestures from being fired + * @method stopDetect + */ + stopDetect: function stopDetect() { + // clone current data to the store as the previous gesture + // used for the double tap gesture, since this is an other gesture detect session + this.previous = Utils.extend({}, this.current); + + // reset the current + this.current = null; + this.stopped = true; + }, - // calculate size for the bar - if (this.style === Graph3d.STYLE.BARSIZE) { - xWidth = (this.xBarWidth / 2) * ((point.point.value - this.valueMin) / (this.valueMax - this.valueMin) * 0.8 + 0.2); - yWidth = (this.yBarWidth / 2) * ((point.point.value - this.valueMin) / (this.valueMax - this.valueMin) * 0.8 + 0.2); - } + /** + * calculate velocity, angle and direction + * @method getVelocityData + * @param {Object} ev + * @param {Object} center + * @param {Number} deltaTime + * @param {Number} deltaX + * @param {Number} deltaY + */ + getCalculatedData: function getCalculatedData(ev, center, deltaTime, deltaX, deltaY) { + var cur = this.current, + recalc = false, + calcEv = cur.lastCalcEvent, + calcData = cur.lastCalcData; + + if(calcEv && ev.timeStamp - calcEv.timeStamp > Hammer.CALCULATE_INTERVAL) { + center = calcEv.center; + deltaTime = ev.timeStamp - calcEv.timeStamp; + deltaX = ev.center.clientX - calcEv.center.clientX; + deltaY = ev.center.clientY - calcEv.center.clientY; + recalc = true; + } - // calculate all corner points - var me = this; - var point3d = point.point; - var top = [ - {point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, point3d.z)}, - {point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, point3d.z)}, - {point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, point3d.z)}, - {point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, point3d.z)} - ]; - var bottom = [ - {point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, this.zMin)}, - {point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, this.zMin)}, - {point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, this.zMin)}, - {point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, this.zMin)} - ]; + if(ev.eventType == EVENT_TOUCH || ev.eventType == EVENT_RELEASE) { + cur.futureCalcEvent = ev; + } - // calculate screen location of the points - top.forEach(function (obj) { - obj.screen = me._convert3Dto2D(obj.point); - }); - bottom.forEach(function (obj) { - obj.screen = me._convert3Dto2D(obj.point); - }); + if(!cur.lastCalcEvent || recalc) { + calcData.velocity = Utils.getVelocity(deltaTime, deltaX, deltaY); + calcData.angle = Utils.getAngle(center, ev.center); + calcData.direction = Utils.getDirection(center, ev.center); - // create five sides, calculate both corner points and center points - var surfaces = [ - {corners: top, center: Point3d.avg(bottom[0].point, bottom[2].point)}, - {corners: [top[0], top[1], bottom[1], bottom[0]], center: Point3d.avg(bottom[1].point, bottom[0].point)}, - {corners: [top[1], top[2], bottom[2], bottom[1]], center: Point3d.avg(bottom[2].point, bottom[1].point)}, - {corners: [top[2], top[3], bottom[3], bottom[2]], center: Point3d.avg(bottom[3].point, bottom[2].point)}, - {corners: [top[3], top[0], bottom[0], bottom[3]], center: Point3d.avg(bottom[0].point, bottom[3].point)} - ]; - point.surfaces = surfaces; + cur.lastCalcEvent = cur.futureCalcEvent || ev; + cur.futureCalcEvent = ev; + } - // calculate the distance of each of the surface centers to the camera - for (j = 0; j < surfaces.length; j++) { - surface = surfaces[j]; - var transCenter = this._convertPointToTranslation(surface.center); - surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z; - // TODO: this dept calculation doesn't work 100% of the cases due to perspective, - // but the current solution is fast/simple and works in 99.9% of all cases - // the issue is visible in example 14, with graph.setCameraPosition({horizontal: 2.97, vertical: 0.5, distance: 0.9}) - } + ev.velocityX = calcData.velocity.x; + ev.velocityY = calcData.velocity.y; + ev.interimAngle = calcData.angle; + ev.interimDirection = calcData.direction; + }, - // order the surfaces by their (translated) depth - surfaces.sort(function (a, b) { - var diff = b.dist - a.dist; - if (diff) return diff; + /** + * extend eventData for Hammer.gestures + * @method extendEventData + * @param {Object} ev + * @return {Object} ev + */ + extendEventData: function extendEventData(ev) { + var cur = this.current, + startEv = cur.startEvent, + lastEv = cur.lastEvent || startEv; + + // update the start touchlist to calculate the scale/rotation + if(ev.eventType == EVENT_TOUCH || ev.eventType == EVENT_RELEASE) { + startEv.touches = []; + Utils.each(ev.touches, function(touch) { + startEv.touches.push({ + clientX: touch.clientX, + clientY: touch.clientY + }); + }); + } - // if equal depth, sort the top surface last - if (a.corners === top) return 1; - if (b.corners === top) return -1; + var deltaTime = ev.timeStamp - startEv.timeStamp, + deltaX = ev.center.clientX - startEv.center.clientX, + deltaY = ev.center.clientY - startEv.center.clientY; - // both are equal - return 0; - }); + this.getCalculatedData(ev, lastEv.center, deltaTime, deltaX, deltaY); - // draw the ordered surfaces - ctx.lineWidth = 1; - ctx.strokeStyle = borderColor; - ctx.fillStyle = color; - // NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside - for (j = 2; j < surfaces.length; j++) { - surface = surfaces[j]; - corners = surface.corners; - ctx.beginPath(); - ctx.moveTo(corners[3].screen.x, corners[3].screen.y); - ctx.lineTo(corners[0].screen.x, corners[0].screen.y); - ctx.lineTo(corners[1].screen.x, corners[1].screen.y); - ctx.lineTo(corners[2].screen.x, corners[2].screen.y); - ctx.lineTo(corners[3].screen.x, corners[3].screen.y); - ctx.fill(); - ctx.stroke(); - } - } -}; + Utils.extend(ev, { + startEvent: startEv, + deltaTime: deltaTime, + deltaX: deltaX, + deltaY: deltaY, -/** - * Draw a line through all datapoints. - * This function can be used when the style is 'line' - */ -Graph3d.prototype._redrawDataLine = function() { - var canvas = this.frame.canvas, - ctx = canvas.getContext('2d'), - point, i; + distance: Utils.getDistance(startEv.center, ev.center), + angle: Utils.getAngle(startEv.center, ev.center), + direction: Utils.getDirection(startEv.center, ev.center), + scale: Utils.getScale(startEv.touches, ev.touches), + rotation: Utils.getRotation(startEv.touches, ev.touches) + }); - if (this.dataPoints === undefined || this.dataPoints.length <= 0) - return; // TODO: throw exception? + return ev; + }, - // calculate the translations of all points - for (i = 0; i < this.dataPoints.length; i++) { - var trans = this._convertPointToTranslation(this.dataPoints[i].point); - var screen = this._convertTranslationToScreen(trans); + /** + * register new gesture + * @method register + * @param {Object} gesture object, see `gestures/` for documentation + * @return {Array} gestures + */ + register: function register(gesture) { + // add an enable gesture options if there is no given + var options = gesture.defaults || {}; + if(options[gesture.name] === undefined) { + options[gesture.name] = true; + } - this.dataPoints[i].trans = trans; - this.dataPoints[i].screen = screen; - } + // extend Hammer default options with the Hammer.gesture options + Utils.extend(Hammer.defaults, options, true); - // start the line - if (this.dataPoints.length > 0) { - point = this.dataPoints[0]; + // set its index + gesture.index = gesture.index || 1000; - ctx.lineWidth = 1; // TODO: make customizable - ctx.strokeStyle = 'blue'; // TODO: make customizable - ctx.beginPath(); - ctx.moveTo(point.screen.x, point.screen.y); - } + // add Hammer.gesture to the list + this.gestures.push(gesture); - // draw the datapoints as colored circles - for (i = 1; i < this.dataPoints.length; i++) { - point = this.dataPoints[i]; - ctx.lineTo(point.screen.x, point.screen.y); - } + // sort the list by index + this.gestures.sort(function(a, b) { + if(a.index < b.index) { + return -1; + } + if(a.index > b.index) { + return 1; + } + return 0; + }); - // finish the line - if (this.dataPoints.length > 0) { - ctx.stroke(); - } -}; + return this.gestures; + } + }; -/** - * Start a moving operation inside the provided parent element - * @param {Event} event The event that occurred (required for - * retrieving the mouse position) - */ -Graph3d.prototype._onMouseDown = function(event) { - event = event || window.event; - // check if mouse is still down (may be up when focus is lost for example - // in an iframe) - if (this.leftButtonDown) { - this._onMouseUp(event); - } + /** + * @module hammer + */ - // only react on left mouse button down - this.leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); - if (!this.leftButtonDown && !this.touchDown) return; + /** + * create new hammer instance + * all methods should return the instance itself, so it is chainable. + * + * @class Instance + * @constructor + * @param {HTMLElement} element + * @param {Object} [options={}] options are merged with `Hammer.defaults` + * @return {Hammer.Instance} + */ + Hammer.Instance = function(element, options) { + var self = this; - // get mouse position (different code for IE and all other browsers) - this.startMouseX = getMouseX(event); - this.startMouseY = getMouseY(event); + // setup HammerJS window events and register all gestures + // this also sets up the default options + setup(); - this.startStart = new Date(this.start); - this.startEnd = new Date(this.end); - this.startArmRotation = this.camera.getArmRotation(); + /** + * @property element + * @type {HTMLElement} + */ + this.element = element; - this.frame.style.cursor = 'move'; + /** + * @property enabled + * @type {Boolean} + * @protected + */ + this.enabled = true; - // add event listeners to handle moving the contents - // we store the function onmousemove and onmouseup in the graph, so we can - // remove the eventlisteners lateron in the function mouseUp() - var me = this; - this.onmousemove = function (event) {me._onMouseMove(event);}; - this.onmouseup = function (event) {me._onMouseUp(event);}; - G3DaddEventListener(document, 'mousemove', me.onmousemove); - G3DaddEventListener(document, 'mouseup', me.onmouseup); - G3DpreventDefault(event); -}; + /** + * options, merged with the defaults + * options with an _ are converted to camelCase + * @property options + * @type {Object} + */ + Utils.each(options, function(value, name) { + delete options[name]; + options[Utils.toCamelCase(name)] = value; + }); + this.options = Utils.extend(Utils.extend({}, Hammer.defaults), options || {}); -/** - * Perform moving operating. - * This function activated from within the funcion Graph.mouseDown(). - * @param {Event} event Well, eehh, the event - */ -Graph3d.prototype._onMouseMove = function (event) { - event = event || window.event; + // add some css to the element to prevent the browser from doing its native behavoir + if(this.options.behavior) { + Utils.toggleBehavior(this.element, this.options.behavior, true); + } - // calculate change in mouse position - var diffX = parseFloat(getMouseX(event)) - this.startMouseX; - var diffY = parseFloat(getMouseY(event)) - this.startMouseY; + /** + * event start handler on the element to start the detection + * @property eventStartHandler + * @type {Object} + */ + this.eventStartHandler = Event.onTouch(element, EVENT_START, function(ev) { + if(self.enabled && ev.eventType == EVENT_START) { + Detection.startDetect(self, ev); + } else if(ev.eventType == EVENT_TOUCH) { + Detection.detect(ev); + } + }); - var horizontalNew = this.startArmRotation.horizontal + diffX / 200; - var verticalNew = this.startArmRotation.vertical + diffY / 200; + /** + * keep a list of user event handlers which needs to be removed when calling 'dispose' + * @property eventHandlers + * @type {Array} + */ + this.eventHandlers = []; + }; - var snapAngle = 4; // degrees - var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); + Hammer.Instance.prototype = { + /** + * bind events to the instance + * @method on + * @chainable + * @param {String} gestures multiple gestures by splitting with a space + * @param {Function} handler + * @param {Object} handler.ev event object + */ + on: function onEvent(gestures, handler) { + var self = this; + Event.on(self.element, gestures, handler, function(type) { + self.eventHandlers.push({ gesture: type, handler: handler }); + }); + return self; + }, - // snap horizontally to nice angles at 0pi, 0.5pi, 1pi, 1.5pi, etc... - // the -0.001 is to take care that the vertical axis is always drawn at the left front corner - if (Math.abs(Math.sin(horizontalNew)) < snapValue) { - horizontalNew = Math.round((horizontalNew / Math.PI)) * Math.PI - 0.001; - } - if (Math.abs(Math.cos(horizontalNew)) < snapValue) { - horizontalNew = (Math.round((horizontalNew/ Math.PI - 0.5)) + 0.5) * Math.PI - 0.001; - } + /** + * unbind events to the instance + * @method off + * @chainable + * @param {String} gestures + * @param {Function} handler + */ + off: function offEvent(gestures, handler) { + var self = this; - // snap vertically to nice angles - if (Math.abs(Math.sin(verticalNew)) < snapValue) { - verticalNew = Math.round((verticalNew / Math.PI)) * Math.PI; - } - if (Math.abs(Math.cos(verticalNew)) < snapValue) { - verticalNew = (Math.round((verticalNew/ Math.PI - 0.5)) + 0.5) * Math.PI; - } + Event.off(self.element, gestures, handler, function(type) { + var index = Utils.inArray({ gesture: type, handler: handler }); + if(index !== false) { + self.eventHandlers.splice(index, 1); + } + }); + return self; + }, - this.camera.setArmRotation(horizontalNew, verticalNew); - this.redraw(); + /** + * trigger gesture event + * @method trigger + * @chainable + * @param {String} gesture + * @param {Object} [eventData] + */ + trigger: function triggerEvent(gesture, eventData) { + // optional + if(!eventData) { + eventData = {}; + } - // fire a cameraPositionChange event - var parameters = this.getCameraPosition(); - this.emit('cameraPositionChange', parameters); + // create DOM event + var event = Hammer.DOCUMENT.createEvent('Event'); + event.initEvent(gesture, true, true); + event.gesture = eventData; - G3DpreventDefault(event); -}; + // trigger on the target if it is in the instance element, + // this is for event delegation tricks + var element = this.element; + if(Utils.hasParent(eventData.target, element)) { + element = eventData.target; + } + element.dispatchEvent(event); + return this; + }, -/** - * Stop moving operating. - * This function activated from within the funcion Graph.mouseDown(). - * @param {event} event The event - */ -Graph3d.prototype._onMouseUp = function (event) { - this.frame.style.cursor = 'auto'; - this.leftButtonDown = false; + /** + * enable of disable hammer.js detection + * @method enable + * @chainable + * @param {Boolean} state + */ + enable: function enable(state) { + this.enabled = state; + return this; + }, - // remove event listeners here - G3DremoveEventListener(document, 'mousemove', this.onmousemove); - G3DremoveEventListener(document, 'mouseup', this.onmouseup); - G3DpreventDefault(event); -}; + /** + * dispose this hammer instance + * @method dispose + * @return {Null} + */ + dispose: function dispose() { + var i, eh; -/** - * After having moved the mouse, a tooltip should pop up when the mouse is resting on a data point - * @param {Event} event A mouse move event - */ -Graph3d.prototype._onTooltip = function (event) { - var delay = 300; // ms - var mouseX = getMouseX(event) - getAbsoluteLeft(this.frame); - var mouseY = getMouseY(event) - getAbsoluteTop(this.frame); + // undo all changes made by stop_browser_behavior + Utils.toggleBehavior(this.element, this.options.behavior, false); - if (!this.showTooltip) { - return; - } + // unbind all custom event handlers + for(i = -1; (eh = this.eventHandlers[++i]);) { + Utils.off(this.element, eh.gesture, eh.handler); + } - if (this.tooltipTimeout) { - clearTimeout(this.tooltipTimeout); - } + this.eventHandlers = []; - // (delayed) display of a tooltip only if no mouse button is down - if (this.leftButtonDown) { - this._hideTooltip(); - return; - } + // unbind the start event listener + Event.off(this.element, EVENT_TYPES[EVENT_START], this.eventStartHandler); - if (this.tooltip && this.tooltip.dataPoint) { - // tooltip is currently visible - var dataPoint = this._dataPointFromXY(mouseX, mouseY); - if (dataPoint !== this.tooltip.dataPoint) { - // datapoint changed - if (dataPoint) { - this._showTooltip(dataPoint); - } - else { - this._hideTooltip(); + return null; } - } - } - else { - // tooltip is currently not visible - var me = this; - this.tooltipTimeout = setTimeout(function () { - me.tooltipTimeout = null; + }; - // show a tooltip if we have a data point - var dataPoint = me._dataPointFromXY(mouseX, mouseY); - if (dataPoint) { - me._showTooltip(dataPoint); - } - }, delay); - } -}; -/** - * Event handler for touchstart event on mobile devices - */ -Graph3d.prototype._onTouchStart = function(event) { - this.touchDown = true; + /** + * @module gestures + */ + /** + * Move with x fingers (default 1) around on the page. + * Preventing the default browser behavior is a good way to improve feel and working. + * ```` + * hammertime.on("drag", function(ev) { + * console.log(ev); + * ev.gesture.preventDefault(); + * }); + * ```` + * + * @class Drag + * @static + */ + /** + * @event drag + * @param {Object} ev + */ + /** + * @event dragstart + * @param {Object} ev + */ + /** + * @event dragend + * @param {Object} ev + */ + /** + * @event drapleft + * @param {Object} ev + */ + /** + * @event dragright + * @param {Object} ev + */ + /** + * @event dragup + * @param {Object} ev + */ + /** + * @event dragdown + * @param {Object} ev + */ - var me = this; - this.ontouchmove = function (event) {me._onTouchMove(event);}; - this.ontouchend = function (event) {me._onTouchEnd(event);}; - G3DaddEventListener(document, 'touchmove', me.ontouchmove); - G3DaddEventListener(document, 'touchend', me.ontouchend); + /** + * @param {String} name + */ + (function(name) { + var triggered = false; - this._onMouseDown(event); -}; + function dragGesture(ev, inst) { + var cur = Detection.current; -/** - * Event handler for touchmove event on mobile devices - */ -Graph3d.prototype._onTouchMove = function(event) { - this._onMouseMove(event); -}; + // max touches + if(inst.options.dragMaxTouches > 0 && + ev.touches.length > inst.options.dragMaxTouches) { + return; + } -/** - * Event handler for touchend event on mobile devices - */ -Graph3d.prototype._onTouchEnd = function(event) { - this.touchDown = false; + switch(ev.eventType) { + case EVENT_START: + triggered = false; + break; + + case EVENT_MOVE: + // when the distance we moved is too small we skip this gesture + // or we can be already in dragging + if(ev.distance < inst.options.dragMinDistance && + cur.name != name) { + return; + } + + var startCenter = cur.startEvent.center; + + // we are dragging! + if(cur.name != name) { + cur.name = name; + if(inst.options.dragDistanceCorrection && ev.distance > 0) { + // When a drag is triggered, set the event center to dragMinDistance pixels from the original event center. + // Without this correction, the dragged distance would jumpstart at dragMinDistance pixels instead of at 0. + // It might be useful to save the original start point somewhere + var factor = Math.abs(inst.options.dragMinDistance / ev.distance); + startCenter.pageX += ev.deltaX * factor; + startCenter.pageY += ev.deltaY * factor; + startCenter.clientX += ev.deltaX * factor; + startCenter.clientY += ev.deltaY * factor; + + // recalculate event data using new start point + ev = Detection.extendEventData(ev); + } + } + + // lock drag to axis? + if(cur.lastEvent.dragLockToAxis || + ( inst.options.dragLockToAxis && + inst.options.dragLockMinDistance <= ev.distance + )) { + ev.dragLockToAxis = true; + } + + // keep direction on the axis that the drag gesture started on + var lastDirection = cur.lastEvent.direction; + if(ev.dragLockToAxis && lastDirection !== ev.direction) { + if(Utils.isVertical(lastDirection)) { + ev.direction = (ev.deltaY < 0) ? DIRECTION_UP : DIRECTION_DOWN; + } else { + ev.direction = (ev.deltaX < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + } + + // first time, trigger dragstart event + if(!triggered) { + inst.trigger(name + 'start', ev); + triggered = true; + } + + // trigger events + inst.trigger(name, ev); + inst.trigger(name + ev.direction, ev); + + var isVertical = Utils.isVertical(ev.direction); + + // block the browser events + if((inst.options.dragBlockVertical && isVertical) || + (inst.options.dragBlockHorizontal && !isVertical)) { + ev.preventDefault(); + } + break; + + case EVENT_RELEASE: + if(triggered && ev.changedLength <= inst.options.dragMaxTouches) { + inst.trigger(name + 'end', ev); + triggered = false; + } + break; - G3DremoveEventListener(document, 'touchmove', this.ontouchmove); - G3DremoveEventListener(document, 'touchend', this.ontouchend); + case EVENT_END: + triggered = false; + break; + } + } - this._onMouseUp(event); -}; + Hammer.gestures.Drag = { + name: name, + index: 50, + handler: dragGesture, + defaults: { + /** + * minimal movement that have to be made before the drag event gets triggered + * @property dragMinDistance + * @type {Number} + * @default 10 + */ + dragMinDistance: 10, + + /** + * Set dragDistanceCorrection to true to make the starting point of the drag + * be calculated from where the drag was triggered, not from where the touch started. + * Useful to avoid a jerk-starting drag, which can make fine-adjustments + * through dragging difficult, and be visually unappealing. + * @property dragDistanceCorrection + * @type {Boolean} + * @default true + */ + dragDistanceCorrection: true, + + /** + * set 0 for unlimited, but this can conflict with transform + * @property dragMaxTouches + * @type {Number} + * @default 1 + */ + dragMaxTouches: 1, + + /** + * prevent default browser behavior when dragging occurs + * be careful with it, it makes the element a blocking element + * when you are using the drag gesture, it is a good practice to set this true + * @property dragBlockHorizontal + * @type {Boolean} + * @default false + */ + dragBlockHorizontal: false, + + /** + * same as `dragBlockHorizontal`, but for vertical movement + * @property dragBlockVertical + * @type {Boolean} + * @default false + */ + dragBlockVertical: false, + + /** + * dragLockToAxis keeps the drag gesture on the axis that it started on, + * It disallows vertical directions if the initial direction was horizontal, and vice versa. + * @property dragLockToAxis + * @type {Boolean} + * @default false + */ + dragLockToAxis: false, + + /** + * drag lock only kicks in when distance > dragLockMinDistance + * This way, locking occurs only when the distance has become large enough to reliably determine the direction + * @property dragLockMinDistance + * @type {Number} + * @default 25 + */ + dragLockMinDistance: 25 + } + }; + })('drag'); + /** + * @module gestures + */ + /** + * trigger a simple gesture event, so you can do anything in your handler. + * only usable if you know what your doing... + * + * @class Gesture + * @static + */ + /** + * @event gesture + * @param {Object} ev + */ + Hammer.gestures.Gesture = { + name: 'gesture', + index: 1337, + handler: function releaseGesture(ev, inst) { + inst.trigger(this.name, ev); + } + }; -/** - * Event handler for mouse wheel event, used to zoom the graph - * Code from http://adomas.org/javascript-mouse-wheel/ - * @param {event} event The event - */ -Graph3d.prototype._onWheel = function(event) { - if (!event) /* For IE. */ - event = window.event; - - // retrieve delta - var delta = 0; - if (event.wheelDelta) { /* IE/Opera. */ - delta = event.wheelDelta/120; - } else if (event.detail) { /* Mozilla case. */ - // In Mozilla, sign of delta is different than in IE. - // Also, delta is multiple of 3. - delta = -event.detail/3; - } + /** + * @module gestures + */ + /** + * Touch stays at the same place for x time + * + * @class Hold + * @static + */ + /** + * @event hold + * @param {Object} ev + */ - // If delta is nonzero, handle it. - // Basically, delta is now positive if wheel was scrolled up, - // and negative, if wheel was scrolled down. - if (delta) { - var oldLength = this.camera.getArmLength(); - var newLength = oldLength * (1 - delta / 10); + /** + * @param {String} name + */ + (function(name) { + var timer; + + function holdGesture(ev, inst) { + var options = inst.options, + current = Detection.current; + + switch(ev.eventType) { + case EVENT_START: + clearTimeout(timer); + + // set the gesture so we can check in the timeout if it still is + current.name = name; + + // set timer and if after the timeout it still is hold, + // we trigger the hold event + timer = setTimeout(function() { + if(current && current.name == name) { + inst.trigger(name, ev); + } + }, options.holdTimeout); + break; - this.camera.setArmLength(newLength); - this.redraw(); + case EVENT_MOVE: + if(ev.distance > options.holdThreshold) { + clearTimeout(timer); + } + break; - this._hideTooltip(); - } + case EVENT_RELEASE: + clearTimeout(timer); + break; + } + } - // fire a cameraPositionChange event - var parameters = this.getCameraPosition(); - this.emit('cameraPositionChange', parameters); + Hammer.gestures.Hold = { + name: name, + index: 10, + defaults: { + /** + * @property holdTimeout + * @type {Number} + * @default 500 + */ + holdTimeout: 500, + + /** + * movement allowed while holding + * @property holdThreshold + * @type {Number} + * @default 2 + */ + holdThreshold: 2 + }, + handler: holdGesture + }; + })('hold'); - // Prevent default actions caused by mouse wheel. - // That might be ugly, but we handle scrolls somehow - // anyway, so don't bother here.. - G3DpreventDefault(event); -}; + /** + * @module gestures + */ + /** + * when a touch is being released from the page + * + * @class Release + * @static + */ + /** + * @event release + * @param {Object} ev + */ + Hammer.gestures.Release = { + name: 'release', + index: Infinity, + handler: function releaseGesture(ev, inst) { + if(ev.eventType == EVENT_RELEASE) { + inst.trigger(this.name, ev); + } + } + }; -/** - * Test whether a point lies inside given 2D triangle - * @param {Point2d} point - * @param {Point2d[]} triangle - * @return {boolean} Returns true if given point lies inside or on the edge of the triangle - * @private - */ -Graph3d.prototype._insideTriangle = function (point, triangle) { - var a = triangle[0], - b = triangle[1], - c = triangle[2]; + /** + * @module gestures + */ + /** + * triggers swipe events when the end velocity is above the threshold + * for best usage, set `preventDefault` (on the drag gesture) to `true` + * ```` + * hammertime.on("dragleft swipeleft", function(ev) { + * console.log(ev); + * ev.gesture.preventDefault(); + * }); + * ```` + * + * @class Swipe + * @static + */ + /** + * @event swipe + * @param {Object} ev + */ + /** + * @event swipeleft + * @param {Object} ev + */ + /** + * @event swiperight + * @param {Object} ev + */ + /** + * @event swipeup + * @param {Object} ev + */ + /** + * @event swipedown + * @param {Object} ev + */ + Hammer.gestures.Swipe = { + name: 'swipe', + index: 40, + defaults: { + /** + * @property swipeMinTouches + * @type {Number} + * @default 1 + */ + swipeMinTouches: 1, - function sign (x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; - } + /** + * @property swipeMaxTouches + * @type {Number} + * @default 1 + */ + swipeMaxTouches: 1, + + /** + * horizontal swipe velocity + * @property swipeVelocityX + * @type {Number} + * @default 0.6 + */ + swipeVelocityX: 0.6, - var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x)); - var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x)); - var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x)); + /** + * vertical swipe velocity + * @property swipeVelocityY + * @type {Number} + * @default 0.6 + */ + swipeVelocityY: 0.6 + }, - // each of the three signs must be either equal to each other or zero - return (as == 0 || bs == 0 || as == bs) && - (bs == 0 || cs == 0 || bs == cs) && - (as == 0 || cs == 0 || as == cs); -}; + handler: function swipeGesture(ev, inst) { + if(ev.eventType == EVENT_RELEASE) { + var touches = ev.touches.length, + options = inst.options; -/** - * Find a data point close to given screen position (x, y) - * @param {Number} x - * @param {Number} y - * @return {Object | null} The closest data point or null if not close to any data point - * @private - */ -Graph3d.prototype._dataPointFromXY = function (x, y) { - var i, - distMax = 100, // px - dataPoint = null, - closestDataPoint = null, - closestDist = null, - center = new Point2d(x, y); - - if (this.style === Graph3d.STYLE.BAR || - this.style === Graph3d.STYLE.BARCOLOR || - this.style === Graph3d.STYLE.BARSIZE) { - // the data points are ordered from far away to closest - for (i = this.dataPoints.length - 1; i >= 0; i--) { - dataPoint = this.dataPoints[i]; - var surfaces = dataPoint.surfaces; - if (surfaces) { - for (var s = surfaces.length - 1; s >= 0; s--) { - // split each surface in two triangles, and see if the center point is inside one of these - var surface = surfaces[s]; - var corners = surface.corners; - var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen]; - var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen]; - if (this._insideTriangle(center, triangle1) || - this._insideTriangle(center, triangle2)) { - // return immediately at the first hit - return dataPoint; + // max touches + if(touches < options.swipeMinTouches || + touches > options.swipeMaxTouches) { + return; + } + + // when the distance we moved is too small we skip this gesture + // or we can be already in dragging + if(ev.velocityX > options.swipeVelocityX || + ev.velocityY > options.swipeVelocityY) { + // trigger swipe events + inst.trigger(this.name, ev); + inst.trigger(this.name + ev.direction, ev); + } } - } } - } - } - else { - // find the closest data point, using distance to the center of the point on 2d screen - for (i = 0; i < this.dataPoints.length; i++) { - dataPoint = this.dataPoints[i]; - var point = dataPoint.screen; - if (point) { - var distX = Math.abs(x - point.x); - var distY = Math.abs(y - point.y); - var dist = Math.sqrt(distX * distX + distY * distY); + }; - if ((closestDist === null || dist < closestDist) && dist < distMax) { - closestDist = dist; - closestDataPoint = dataPoint; - } - } - } - } + /** + * @module gestures + */ + /** + * Single tap and a double tap on a place + * + * @class Tap + * @static + */ + /** + * @event tap + * @param {Object} ev + */ + /** + * @event doubletap + * @param {Object} ev + */ + /** + * @param {String} name + */ + (function(name) { + var hasMoved = false; + + function tapGesture(ev, inst) { + var options = inst.options, + current = Detection.current, + prev = Detection.previous, + sincePrev, + didDoubleTap; + + switch(ev.eventType) { + case EVENT_START: + hasMoved = false; + break; - return closestDataPoint; -}; + case EVENT_MOVE: + hasMoved = hasMoved || (ev.distance > options.tapMaxDistance); + break; -/** - * Display a tooltip for given data point - * @param {Object} dataPoint - * @private - */ -Graph3d.prototype._showTooltip = function (dataPoint) { - var content, line, dot; - - if (!this.tooltip) { - content = document.createElement('div'); - content.style.position = 'absolute'; - content.style.padding = '10px'; - content.style.border = '1px solid #4d4d4d'; - content.style.color = '#1a1a1a'; - content.style.background = 'rgba(255,255,255,0.7)'; - content.style.borderRadius = '2px'; - content.style.boxShadow = '5px 5px 10px rgba(128,128,128,0.5)'; - - line = document.createElement('div'); - line.style.position = 'absolute'; - line.style.height = '40px'; - line.style.width = '0'; - line.style.borderLeft = '1px solid #4d4d4d'; - - dot = document.createElement('div'); - dot.style.position = 'absolute'; - dot.style.height = '0'; - dot.style.width = '0'; - dot.style.border = '5px solid #4d4d4d'; - dot.style.borderRadius = '5px'; - - this.tooltip = { - dataPoint: null, - dom: { - content: content, - line: line, - dot: dot + case EVENT_END: + if(!Utils.inStr(ev.srcEvent.type, 'cancel') && ev.deltaTime < options.tapMaxTime && !hasMoved) { + // previous gesture, for the double tap since these are two different gesture detections + sincePrev = prev && prev.lastEvent && ev.timeStamp - prev.lastEvent.timeStamp; + didDoubleTap = false; + + // check if double tap + if(prev && prev.name == name && + (sincePrev && sincePrev < options.doubleTapInterval) && + ev.distance < options.doubleTapDistance) { + inst.trigger('doubletap', ev); + didDoubleTap = true; + } + + // do a single tap + if(!didDoubleTap || options.tapAlways) { + current.name = name; + inst.trigger(current.name, ev); + } + } + break; + } } - }; - } - else { - content = this.tooltip.dom.content; - line = this.tooltip.dom.line; - dot = this.tooltip.dom.dot; - } - this._hideTooltip(); + Hammer.gestures.Tap = { + name: name, + index: 100, + handler: tapGesture, + defaults: { + /** + * max time of a tap, this is for the slow tappers + * @property tapMaxTime + * @type {Number} + * @default 250 + */ + tapMaxTime: 250, + + /** + * max distance of movement of a tap, this is for the slow tappers + * @property tapMaxDistance + * @type {Number} + * @default 10 + */ + tapMaxDistance: 10, + + /** + * always trigger the `tap` event, even while double-tapping + * @property tapAlways + * @type {Boolean} + * @default true + */ + tapAlways: true, + + /** + * max distance between two taps + * @property doubleTapDistance + * @type {Number} + * @default 20 + */ + doubleTapDistance: 20, + + /** + * max time between two taps + * @property doubleTapInterval + * @type {Number} + * @default 300 + */ + doubleTapInterval: 300 + } + }; + })('tap'); - this.tooltip.dataPoint = dataPoint; - if (typeof this.showTooltip === 'function') { - content.innerHTML = this.showTooltip(dataPoint.point); - } - else { - content.innerHTML = '' + - '' + - '' + - '' + - '
x:' + dataPoint.point.x + '
y:' + dataPoint.point.y + '
z:' + dataPoint.point.z + '
'; - } + /** + * @module gestures + */ + /** + * when a touch is being touched at the page + * + * @class Touch + * @static + */ + /** + * @event touch + * @param {Object} ev + */ + Hammer.gestures.Touch = { + name: 'touch', + index: -Infinity, + defaults: { + /** + * call preventDefault at touchstart, and makes the element blocking by disabling the scrolling of the page, + * but it improves gestures like transforming and dragging. + * be careful with using this, it can be very annoying for users to be stuck on the page + * @property preventDefault + * @type {Boolean} + * @default false + */ + preventDefault: false, - content.style.left = '0'; - content.style.top = '0'; - this.frame.appendChild(content); - this.frame.appendChild(line); - this.frame.appendChild(dot); - - // calculate sizes - var contentWidth = content.offsetWidth; - var contentHeight = content.offsetHeight; - var lineHeight = line.offsetHeight; - var dotWidth = dot.offsetWidth; - var dotHeight = dot.offsetHeight; - - var left = dataPoint.screen.x - contentWidth / 2; - left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth); - - line.style.left = dataPoint.screen.x + 'px'; - line.style.top = (dataPoint.screen.y - lineHeight) + 'px'; - content.style.left = left + 'px'; - content.style.top = (dataPoint.screen.y - lineHeight - contentHeight) + 'px'; - dot.style.left = (dataPoint.screen.x - dotWidth / 2) + 'px'; - dot.style.top = (dataPoint.screen.y - dotHeight / 2) + 'px'; -}; + /** + * disable mouse events, so only touch (or pen!) input triggers events + * @property preventMouse + * @type {Boolean} + * @default false + */ + preventMouse: false + }, + handler: function touchGesture(ev, inst) { + if(inst.options.preventMouse && ev.pointerType == POINTER_MOUSE) { + ev.stopDetect(); + return; + } -/** - * Hide the tooltip when displayed - * @private - */ -Graph3d.prototype._hideTooltip = function () { - if (this.tooltip) { - this.tooltip.dataPoint = null; + if(inst.options.preventDefault) { + ev.preventDefault(); + } - for (var prop in this.tooltip.dom) { - if (this.tooltip.dom.hasOwnProperty(prop)) { - var elem = this.tooltip.dom[prop]; - if (elem && elem.parentNode) { - elem.parentNode.removeChild(elem); - } + if(ev.eventType == EVENT_TOUCH) { + inst.trigger('touch', ev); + } } - } - } -}; - - -/** - * Add and event listener. Works for all browsers - * @param {Element} element An html element - * @param {string} action The action, for example 'click', - * without the prefix 'on' - * @param {function} listener The callback function to be executed - * @param {boolean} useCapture - */ -G3DaddEventListener = function(element, action, listener, useCapture) { - if (element.addEventListener) { - if (useCapture === undefined) - useCapture = false; - - if (action === 'mousewheel' && navigator.userAgent.indexOf('Firefox') >= 0) { - action = 'DOMMouseScroll'; // For Firefox - } + }; - element.addEventListener(action, listener, useCapture); - } else { - element.attachEvent('on' + action, listener); // IE browsers - } -}; + /** + * @module gestures + */ + /** + * User want to scale or rotate with 2 fingers + * Preventing the default browser behavior is a good way to improve feel and working. This can be done with the + * `preventDefault` option. + * + * @class Transform + * @static + */ + /** + * @event transform + * @param {Object} ev + */ + /** + * @event transformstart + * @param {Object} ev + */ + /** + * @event transformend + * @param {Object} ev + */ + /** + * @event pinchin + * @param {Object} ev + */ + /** + * @event pinchout + * @param {Object} ev + */ + /** + * @event rotate + * @param {Object} ev + */ -/** - * Remove an event listener from an element - * @param {Element} element An html dom element - * @param {string} action The name of the event, for example 'mousedown' - * @param {function} listener The listener function - * @param {boolean} useCapture - */ -G3DremoveEventListener = function(element, action, listener, useCapture) { - if (element.removeEventListener) { - // non-IE browsers - if (useCapture === undefined) - useCapture = false; + /** + * @param {String} name + */ + (function(name) { + var triggered = false; - if (action === 'mousewheel' && navigator.userAgent.indexOf('Firefox') >= 0) { - action = 'DOMMouseScroll'; // For Firefox - } + function transformGesture(ev, inst) { + switch(ev.eventType) { + case EVENT_START: + triggered = false; + break; - element.removeEventListener(action, listener, useCapture); - } else { - // IE browsers - element.detachEvent('on' + action, listener); - } -}; + case EVENT_MOVE: + // at least multitouch + if(ev.touches.length < 2) { + return; + } + + var scaleThreshold = Math.abs(1 - ev.scale); + var rotationThreshold = Math.abs(ev.rotation); + + // when the distance we moved is too small we skip this gesture + // or we can be already in dragging + if(scaleThreshold < inst.options.transformMinScale && + rotationThreshold < inst.options.transformMinRotation) { + return; + } + + // we are transforming! + Detection.current.name = name; + + // first time, trigger dragstart event + if(!triggered) { + inst.trigger(name + 'start', ev); + triggered = true; + } + + inst.trigger(name, ev); // basic transform event + + // trigger rotate event + if(rotationThreshold > inst.options.transformMinRotation) { + inst.trigger('rotate', ev); + } + + // trigger pinch event + if(scaleThreshold > inst.options.transformMinScale) { + inst.trigger('pinch', ev); + inst.trigger('pinch' + (ev.scale < 1 ? 'in' : 'out'), ev); + } + break; -/** - * Stop event propagation - */ -G3DstopPropagation = function(event) { - if (!event) - event = window.event; + case EVENT_RELEASE: + if(triggered && ev.changedLength < 2) { + inst.trigger(name + 'end', ev); + triggered = false; + } + break; + } + } - if (event.stopPropagation) { - event.stopPropagation(); // non-IE browsers - } - else { - event.cancelBubble = true; // IE browsers - } -}; + Hammer.gestures.Transform = { + name: name, + index: 45, + defaults: { + /** + * minimal scale factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1 + * @property transformMinScale + * @type {Number} + * @default 0.01 + */ + transformMinScale: 0.01, + + /** + * rotation in degrees + * @property transformMinRotation + * @type {Number} + * @default 1 + */ + transformMinRotation: 1 + }, + handler: transformGesture + }; + })('transform'); -/** - * Cancels the event if it is cancelable, without stopping further propagation of the event. - */ -G3DpreventDefault = function (event) { - if (!event) - event = window.event; + /** + * @module hammer + */ - if (event.preventDefault) { - event.preventDefault(); // non-IE browsers - } - else { - event.returnValue = false; // IE browsers + // AMD export + if(true) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { + return Hammer; + }.call(exports, __webpack_require__, exports, module)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + // commonjs export + } else if(typeof module !== 'undefined' && module.exports) { + module.exports = Hammer; + // browser export + } else { + window.Hammer = Hammer; } -}; - - -/** - * @prototype Point3d - * @param {Number} x - * @param {Number} y - * @param {Number} z - */ -function Point3d(x, y, z) { - this.x = x !== undefined ? x : 0; - this.y = y !== undefined ? y : 0; - this.z = z !== undefined ? z : 0; -}; + })(window); -/** - * Subtract the two provided points, returns a-b - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} a-b - */ -Point3d.subtract = function(a, b) { - var sub = new Point3d(); - sub.x = a.x - b.x; - sub.y = a.y - b.y; - sub.z = a.z - b.z; - return sub; -}; +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { -/** - * Add the two provided points, returns a+b - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} a+b - */ -Point3d.add = function(a, b) { - var sum = new Point3d(); - sum.x = a.x + b.x; - sum.y = a.y + b.y; - sum.z = a.z + b.z; - return sum; -}; + /** + * Creation of the ClusterMixin var. + * + * This contains all the functions the Network object can use to employ clustering + */ -/** - * Calculate the average of two 3d points - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} The average, (a+b)/2 - */ -Point3d.avg = function(a, b) { - return new Point3d( - (a.x + b.x) / 2, - (a.y + b.y) / 2, - (a.z + b.z) / 2 - ); -}; + /** + * This is only called in the constructor of the network object + * + */ + exports.startWithClustering = function() { + // cluster if the data set is big + this.clusterToFit(this.constants.clustering.initialMaxNodes, true); -/** - * Calculate the cross product of the two provided points, returns axb - * Documentation: http://en.wikipedia.org/wiki/Cross_product - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} cross product axb - */ -Point3d.crossProduct = function(a, b) { - var crossproduct = new Point3d(); + // updates the lables after clustering + this.updateLabels(); - crossproduct.x = a.y * b.z - a.z * b.y; - crossproduct.y = a.z * b.x - a.x * b.z; - crossproduct.z = a.x * b.y - a.y * b.x; + // this is called here because if clusterin is disabled, the start and stabilize are called in + // the setData function. + if (this.stabilize) { + this._stabilize(); + } + this.start(); + }; - return crossproduct; -}; + /** + * This function clusters until the initialMaxNodes has been reached + * + * @param {Number} maxNumberOfNodes + * @param {Boolean} reposition + */ + exports.clusterToFit = function(maxNumberOfNodes, reposition) { + var numberOfNodes = this.nodeIndices.length; + var maxLevels = 50; + var level = 0; -/** - * Rtrieve the length of the vector (or the distance from this point to the origin - * @return {Number} length - */ -Point3d.prototype.length = function() { - return Math.sqrt( - this.x * this.x + - this.y * this.y + - this.z * this.z - ); -}; + // we first cluster the hubs, then we pull in the outliers, repeat + while (numberOfNodes > maxNumberOfNodes && level < maxLevels) { + if (level % 3 == 0) { + this.forceAggregateHubs(true); + this.normalizeClusterLevels(); + } + else { + this.increaseClusterLevel(); // this also includes a cluster normalization + } -/** - * @prototype Point2d - */ -Point2d = function (x, y) { - this.x = x !== undefined ? x : 0; - this.y = y !== undefined ? y : 0; -}; + numberOfNodes = this.nodeIndices.length; + level += 1; + } + // after the clustering we reposition the nodes to reduce the initial chaos + if (level > 0 && reposition == true) { + this.repositionNodes(); + } + this._updateCalculationNodes(); + }; -/** - * @class Filter - * - * @param {DataSet} data The google data table - * @param {Number} column The index of the column to be filtered - * @param {Graph} graph The graph - */ -function Filter (data, column, graph) { - this.data = data; - this.column = column; - this.graph = graph; // the parent graph + /** + * This function can be called to open up a specific cluster. It is only called by + * It will unpack the cluster back one level. + * + * @param node | Node object: cluster to open. + */ + exports.openCluster = function(node) { + var isMovingBeforeClustering = this.moving; + if (node.clusterSize > this.constants.clustering.sectorThreshold && this._nodeInActiveArea(node) && + !(this._sector() == "default" && this.nodeIndices.length == 1)) { + // this loads a new sector, loads the nodes and edges and nodeIndices of it. + this._addSector(node); + var level = 0; - this.index = undefined; - this.value = undefined; + // we decluster until we reach a decent number of nodes + while ((this.nodeIndices.length < this.constants.clustering.initialMaxNodes) && (level < 10)) { + this.decreaseClusterLevel(); + level += 1; + } - // read all distinct values and select the first one - this.values = graph.getDistinctValues(data.get(), this.column); + } + else { + this._expandClusterNode(node,false,true); - // sort both numeric and string values correctly - this.values.sort(function (a, b) { - return a > b ? 1 : a < b ? -1 : 0; - }); + // update the index list, dynamic edges and labels + this._updateNodeIndexList(); + this._updateDynamicEdges(); + this._updateCalculationNodes(); + this.updateLabels(); + } - if (this.values.length > 0) { - this.selectValue(0); - } + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + }; - // create an array with the filtered datapoints. this will be loaded afterwards - this.dataPoints = []; - this.loaded = false; - this.onLoadCallback = undefined; + /** + * This calls the updateClustes with default arguments + */ + exports.updateClustersDefault = function() { + if (this.constants.clustering.enabled == true) { + this.updateClusters(0,false,false); + } + }; - if (graph.animationPreload) { - this.loaded = false; - this.loadInBackground(); - } - else { - this.loaded = true; - } -}; + /** + * This function can be called to increase the cluster level. This means that the nodes with only one edge connection will + * be clustered with their connected node. This can be repeated as many times as needed. + * This can be called externally (by a keybind for instance) to reduce the complexity of big datasets. + */ + exports.increaseClusterLevel = function() { + this.updateClusters(-1,false,true); + }; -/** - * Return the label - * @return {string} label - */ -Filter.prototype.isLoaded = function() { - return this.loaded; -}; + /** + * This function can be called to decrease the cluster level. This means that the nodes with only one edge connection will + * be unpacked if they are a cluster. This can be repeated as many times as needed. + * This can be called externally (by a key-bind for instance) to look into clusters without zooming. + */ + exports.decreaseClusterLevel = function() { + this.updateClusters(1,false,true); + }; -/** - * Return the loaded progress - * @return {Number} percentage between 0 and 100 - */ -Filter.prototype.getLoadedProgress = function() { - var len = this.values.length; - var i = 0; - while (this.dataPoints[i]) { - i++; - } + /** + * This is the main clustering function. It clusters and declusters on zoom or forced + * This function clusters on zoom, it can be called with a predefined zoom direction + * If out, check if we can form clusters, if in, check if we can open clusters. + * This function is only called from _zoom() + * + * @param {Number} zoomDirection | -1 / 0 / +1 for zoomOut / determineByZoom / zoomIn + * @param {Boolean} recursive | enabled or disable recursive calling of the opening of clusters + * @param {Boolean} force | enabled or disable forcing + * @param {Boolean} doNotStart | if true do not call start + * + */ + exports.updateClusters = function(zoomDirection,recursive,force,doNotStart) { + var isMovingBeforeClustering = this.moving; + var amountOfNodes = this.nodeIndices.length; - return Math.round(i / len * 100); -}; + // on zoom out collapse the sector if the scale is at the level the sector was made + if (this.previousScale > this.scale && zoomDirection == 0) { + this._collapseSector(); + } + // check if we zoom in or out + if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out + // forming clusters when forced pulls outliers in. When not forced, the edge length of the + // outer nodes determines if it is being clustered + this._formClusters(force); + } + else if (this.previousScale < this.scale || zoomDirection == 1) { // zoom in + if (force == true) { + // _openClusters checks for each node if the formationScale of the cluster is smaller than + // the current scale and if so, declusters. When forced, all clusters are reduced by one step + this._openClusters(recursive,force); + } + else { + // if a cluster takes up a set percentage of the active window + this._openClustersBySize(); + } + } + this._updateNodeIndexList(); -/** - * Return the label - * @return {string} label - */ -Filter.prototype.getLabel = function() { - return this.graph.filterLabel; -}; + // if a cluster was NOT formed and the user zoomed out, we try clustering by hubs + if (this.nodeIndices.length == amountOfNodes && (this.previousScale > this.scale || zoomDirection == -1)) { + this._aggregateHubs(force); + this._updateNodeIndexList(); + } + // we now reduce chains. + if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out + this.handleChains(); + this._updateNodeIndexList(); + } -/** - * Return the columnIndex of the filter - * @return {Number} columnIndex - */ -Filter.prototype.getColumn = function() { - return this.column; -}; + this.previousScale = this.scale; -/** - * Return the currently selected value. Returns undefined if there is no selection - * @return {*} value - */ -Filter.prototype.getSelectedValue = function() { - if (this.index === undefined) - return undefined; + // rest of the update the index list, dynamic edges and labels + this._updateDynamicEdges(); + this.updateLabels(); - return this.values[this.index]; -}; + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length < amountOfNodes) { // this means a clustering operation has taken place + this.clusterSession += 1; + // if clusters have been made, we normalize the cluster level + this.normalizeClusterLevels(); + } -/** - * Retrieve all values of the filter - * @return {Array} values - */ -Filter.prototype.getValues = function() { - return this.values; -}; + if (doNotStart == false || doNotStart === undefined) { + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + } -/** - * Retrieve one value of the filter - * @param {Number} index - * @return {*} value - */ -Filter.prototype.getValue = function(index) { - if (index >= this.values.length) - throw 'Error: index out of range'; + this._updateCalculationNodes(); + }; - return this.values[index]; -}; + /** + * This function handles the chains. It is called on every updateClusters(). + */ + exports.handleChains = function() { + // after clustering we check how many chains there are + var chainPercentage = this._getChainFraction(); + if (chainPercentage > this.constants.clustering.chainThreshold) { + this._reduceAmountOfChains(1 - this.constants.clustering.chainThreshold / chainPercentage) + } + }; -/** - * Retrieve the (filtered) dataPoints for the currently selected filter index - * @param {Number} [index] (optional) - * @return {Array} dataPoints - */ -Filter.prototype._getDataPoints = function(index) { - if (index === undefined) - index = this.index; + /** + * this functions starts clustering by hubs + * The minimum hub threshold is set globally + * + * @private + */ + exports._aggregateHubs = function(force) { + this._getHubSize(); + this._formClustersByHub(force,false); + }; - if (index === undefined) - return []; - var dataPoints; - if (this.dataPoints[index]) { - dataPoints = this.dataPoints[index]; - } - else { - var f = {}; - f.column = this.column; - f.value = this.values[index]; + /** + * This function is fired by keypress. It forces hubs to form. + * + */ + exports.forceAggregateHubs = function(doNotStart) { + var isMovingBeforeClustering = this.moving; + var amountOfNodes = this.nodeIndices.length; - var dataView = new DataView(this.data,{filter: function (item) {return (item[f.column] == f.value);}}).get(); - dataPoints = this.graph._getDataPoints(dataView); + this._aggregateHubs(true); - this.dataPoints[index] = dataPoints; - } + // update the index list, dynamic edges and labels + this._updateNodeIndexList(); + this._updateDynamicEdges(); + this.updateLabels(); - return dataPoints; -}; + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length != amountOfNodes) { + this.clusterSession += 1; + } + if (doNotStart == false || doNotStart === undefined) { + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + } + }; + /** + * If a cluster takes up more than a set percentage of the screen, open the cluster + * + * @private + */ + exports._openClustersBySize = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.inView() == true) { + if ((node.width*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || + (node.height*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { + this.openCluster(node); + } + } + } + } + }; -/** - * Set a callback function when the filter is fully loaded. - */ -Filter.prototype.setOnLoadCallback = function(callback) { - this.onLoadCallback = callback; -}; + /** + * This function loops over all nodes in the nodeIndices list. For each node it checks if it is a cluster and if it + * has to be opened based on the current zoom level. + * + * @private + */ + exports._openClusters = function(recursive,force) { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + this._expandClusterNode(node,recursive,force); + this._updateCalculationNodes(); + } + }; -/** - * Add a value to the list with available values for this filter - * No double entries will be created. - * @param {Number} index - */ -Filter.prototype.selectValue = function(index) { - if (index >= this.values.length) - throw 'Error: index out of range'; + /** + * This function checks if a node has to be opened. This is done by checking the zoom level. + * If the node contains child nodes, this function is recursively called on the child nodes as well. + * This recursive behaviour is optional and can be set by the recursive argument. + * + * @param {Node} parentNode | to check for cluster and expand + * @param {Boolean} recursive | enabled or disable recursive calling + * @param {Boolean} force | enabled or disable forcing + * @param {Boolean} [openAll] | This will recursively force all nodes in the parent to be released + * @private + */ + exports._expandClusterNode = function(parentNode, recursive, force, openAll) { + // first check if node is a cluster + if (parentNode.clusterSize > 1) { + // this means that on a double tap event or a zoom event, the cluster fully unpacks if it is smaller than 20 + if (parentNode.clusterSize < this.constants.clustering.sectorThreshold) { + openAll = true; + } + recursive = openAll ? true : recursive; - this.index = index; - this.value = this.values[index]; -}; + // if the last child has been added on a smaller scale than current scale decluster + if (parentNode.formationScale < this.scale || force == true) { + // we will check if any of the contained child nodes should be removed from the cluster + for (var containedNodeId in parentNode.containedNodes) { + if (parentNode.containedNodes.hasOwnProperty(containedNodeId)) { + var childNode = parentNode.containedNodes[containedNodeId]; -/** - * Load all filtered rows in the background one by one - * Start this method without providing an index! - */ -Filter.prototype.loadInBackground = function(index) { - if (index === undefined) - index = 0; + // force expand will expand the largest cluster size clusters. Since we cluster from outside in, we assume that + // the largest cluster is the one that comes from outside + if (force == true) { + if (childNode.clusterSession == parentNode.clusterSessions[parentNode.clusterSessions.length-1] + || openAll) { + this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); + } + } + else { + if (this._nodeInActiveArea(parentNode)) { + this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); + } + } + } + } + } + } + }; - var frame = this.graph.frame; + /** + * ONLY CALLED FROM _expandClusterNode + * + * This function will expel a child_node from a parent_node. This is to de-cluster the node. This function will remove + * the child node from the parent contained_node object and put it back into the global nodes object. + * The same holds for the edge that was connected to the child node. It is moved back into the global edges object. + * + * @param {Node} parentNode | the parent node + * @param {String} containedNodeId | child_node id as it is contained in the containedNodes object of the parent node + * @param {Boolean} recursive | This will also check if the child needs to be expanded. + * With force and recursive both true, the entire cluster is unpacked + * @param {Boolean} force | This will disregard the zoom level and will expel this child from the parent + * @param {Boolean} openAll | This will recursively force all nodes in the parent to be released + * @private + */ + exports._expelChildFromParent = function(parentNode, containedNodeId, recursive, force, openAll) { + var childNode = parentNode.containedNodes[containedNodeId]; - if (index < this.values.length) { - var dataPointsTemp = this._getDataPoints(index); - //this.graph.redrawInfo(); // TODO: not neat + // if child node has been added on smaller scale than current, kick out + if (childNode.formationScale < this.scale || force == true) { + // unselect all selected items + this._unselectAll(); - // create a progress box - if (frame.progress === undefined) { - frame.progress = document.createElement('DIV'); - frame.progress.style.position = 'absolute'; - frame.progress.style.color = 'gray'; - frame.appendChild(frame.progress); - } - var progress = this.getLoadedProgress(); - frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; - // TODO: this is no nice solution... - frame.progress.style.bottom = Graph3d.px(60); // TODO: use height of slider - frame.progress.style.left = Graph3d.px(10); + // put the child node back in the global nodes object + this.nodes[containedNodeId] = childNode; - var me = this; - setTimeout(function() {me.loadInBackground(index+1);}, 10); - this.loaded = false; - } - else { - this.loaded = true; + // release the contained edges from this childNode back into the global edges + this._releaseContainedEdges(parentNode,childNode); - // remove the progress box - if (frame.progress !== undefined) { - frame.removeChild(frame.progress); - frame.progress = undefined; - } + // reconnect rerouted edges to the childNode + this._connectEdgeBackToChild(parentNode,childNode); - if (this.onLoadCallback) - this.onLoadCallback(); - } -}; + // validate all edges in dynamicEdges + this._validateEdges(parentNode); + // undo the changes from the clustering operation on the parent node + parentNode.mass -= childNode.mass; + parentNode.clusterSize -= childNode.clusterSize; + parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); + parentNode.dynamicEdgesLength = parentNode.dynamicEdges.length; + // place the child node near the parent, not at the exact same location to avoid chaos in the system + childNode.x = parentNode.x + parentNode.growthIndicator * (0.5 - Math.random()); + childNode.y = parentNode.y + parentNode.growthIndicator * (0.5 - Math.random()); -/** - * @prototype StepNumber - * The class StepNumber is an iterator for Numbers. You provide a start and end - * value, and a best step size. StepNumber itself rounds to fixed values and - * a finds the step that best fits the provided step. - * - * If prettyStep is true, the step size is chosen as close as possible to the - * provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... - * - * Example usage: - * var step = new StepNumber(0, 10, 2.5, true); - * step.start(); - * while (!step.end()) { - * alert(step.getCurrent()); - * step.next(); - * } - * - * Version: 1.0 - * - * @param {Number} start The start value - * @param {Number} end The end value - * @param {Number} step Optional. Step size. Must be a positive value. - * @param {boolean} prettyStep Optional. If true, the step size is rounded - * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ -StepNumber = function (start, end, step, prettyStep) { - // set default values - this._start = 0; - this._end = 0; - this._step = 1; - this.prettyStep = true; - this.precision = 5; - - this._current = 0; - this.setRange(start, end, step, prettyStep); -}; + // remove node from the list + delete parentNode.containedNodes[containedNodeId]; -/** - * Set a new range: start, end and step. - * - * @param {Number} start The start value - * @param {Number} end The end value - * @param {Number} step Optional. Step size. Must be a positive value. - * @param {boolean} prettyStep Optional. If true, the step size is rounded - * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ -StepNumber.prototype.setRange = function(start, end, step, prettyStep) { - this._start = start ? start : 0; - this._end = end ? end : 0; + // check if there are other childs with this clusterSession in the parent. + var othersPresent = false; + for (var childNodeId in parentNode.containedNodes) { + if (parentNode.containedNodes.hasOwnProperty(childNodeId)) { + if (parentNode.containedNodes[childNodeId].clusterSession == childNode.clusterSession) { + othersPresent = true; + break; + } + } + } + // if there are no others, remove the cluster session from the list + if (othersPresent == false) { + parentNode.clusterSessions.pop(); + } - this.setStep(step, prettyStep); -}; + this._repositionBezierNodes(childNode); + // this._repositionBezierNodes(parentNode); -/** - * Set a new step size - * @param {Number} step New step size. Must be a positive value - * @param {boolean} prettyStep Optional. If true, the provided step is rounded - * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ -StepNumber.prototype.setStep = function(step, prettyStep) { - if (step === undefined || step <= 0) - return; + // remove the clusterSession from the child node + childNode.clusterSession = 0; - if (prettyStep !== undefined) - this.prettyStep = prettyStep; + // recalculate the size of the node on the next time the node is rendered + parentNode.clearSizeCache(); - if (this.prettyStep === true) - this._step = StepNumber.calculatePrettyStep(step); - else - this._step = step; -}; + // restart the simulation to reorganise all nodes + this.moving = true; + } -/** - * Calculate a nice step size, closest to the desired step size. - * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an - * integer Number. For example 1, 2, 5, 10, 20, 50, etc... - * @param {Number} step Desired step size - * @return {Number} Nice step size - */ -StepNumber.calculatePrettyStep = function (step) { - var log10 = function (x) {return Math.log(x) / Math.LN10;}; - - // try three steps (multiple of 1, 2, or 5 - var step1 = Math.pow(10, Math.round(log10(step))), - step2 = 2 * Math.pow(10, Math.round(log10(step / 2))), - step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); - - // choose the best step (closest to minimum step) - var prettyStep = step1; - if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2; - if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; - - // for safety - if (prettyStep <= 0) { - prettyStep = 1; - } + // check if a further expansion step is possible if recursivity is enabled + if (recursive == true) { + this._expandClusterNode(childNode,recursive,force,openAll); + } + }; - return prettyStep; -}; -/** - * returns the current value of the step - * @return {Number} current value - */ -StepNumber.prototype.getCurrent = function () { - return parseFloat(this._current.toPrecision(this.precision)); -}; + /** + * position the bezier nodes at the center of the edges + * + * @param node + * @private + */ + exports._repositionBezierNodes = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + node.dynamicEdges[i].positionBezierNode(); + } + }; -/** - * returns the current step size - * @return {Number} current step size - */ -StepNumber.prototype.getStep = function () { - return this._step; -}; -/** - * Set the current value to the largest value smaller than start, which - * is a multiple of the step size - */ -StepNumber.prototype.start = function() { - this._current = this._start - this._start % this._step; -}; + /** + * This function checks if any nodes at the end of their trees have edges below a threshold length + * This function is called only from updateClusters() + * forceLevelCollapse ignores the length of the edge and collapses one level + * This means that a node with only one edge will be clustered with its connected node + * + * @private + * @param {Boolean} force + */ + exports._formClusters = function(force) { + if (force == false) { + this._formClustersByZoom(); + } + else { + this._forceClustersByZoom(); + } + }; -/** - * Do a step, add the step size to the current value - */ -StepNumber.prototype.next = function () { - this._current += this._step; -}; -/** - * Returns true whether the end is reached - * @return {boolean} True if the current value has passed the end value. - */ -StepNumber.prototype.end = function () { - return (this._current > this._end); -}; + /** + * This function handles the clustering by zooming out, this is based on a minimum edge distance + * + * @private + */ + exports._formClustersByZoom = function() { + var dx,dy,length, + minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; + // check if any edges are shorter than minLength and start the clustering + // the clustering favours the node with the larger mass + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + var edge = this.edges[edgeId]; + if (edge.connected) { + if (edge.toId != edge.fromId) { + dx = (edge.to.x - edge.from.x); + dy = (edge.to.y - edge.from.y); + length = Math.sqrt(dx * dx + dy * dy); -/** - * @constructor Slider - * - * An html slider control with start/stop/prev/next buttons - * @param {Element} container The element where the slider will be created - * @param {Object} options Available options: - * {boolean} visible If true (default) the - * slider is visible. - */ -function Slider(container, options) { - if (container === undefined) { - throw 'Error: No container element defined'; - } - this.container = container; - this.visible = (options && options.visible != undefined) ? options.visible : true; - if (this.visible) { - this.frame = document.createElement('DIV'); - //this.frame.style.backgroundColor = '#E5E5E5'; - this.frame.style.width = '100%'; - this.frame.style.position = 'relative'; - this.container.appendChild(this.frame); + if (length < minLength) { + // first check which node is larger + var parentNode = edge.from; + var childNode = edge.to; + if (edge.to.mass > edge.from.mass) { + parentNode = edge.to; + childNode = edge.from; + } - this.frame.prev = document.createElement('INPUT'); - this.frame.prev.type = 'BUTTON'; - this.frame.prev.value = 'Prev'; - this.frame.appendChild(this.frame.prev); - - this.frame.play = document.createElement('INPUT'); - this.frame.play.type = 'BUTTON'; - this.frame.play.value = 'Play'; - this.frame.appendChild(this.frame.play); - - this.frame.next = document.createElement('INPUT'); - this.frame.next.type = 'BUTTON'; - this.frame.next.value = 'Next'; - this.frame.appendChild(this.frame.next); - - this.frame.bar = document.createElement('INPUT'); - this.frame.bar.type = 'BUTTON'; - this.frame.bar.style.position = 'absolute'; - this.frame.bar.style.border = '1px solid red'; - this.frame.bar.style.width = '100px'; - this.frame.bar.style.height = '6px'; - this.frame.bar.style.borderRadius = '2px'; - this.frame.bar.style.MozBorderRadius = '2px'; - this.frame.bar.style.border = '1px solid #7F7F7F'; - this.frame.bar.style.backgroundColor = '#E5E5E5'; - this.frame.appendChild(this.frame.bar); - - this.frame.slide = document.createElement('INPUT'); - this.frame.slide.type = 'BUTTON'; - this.frame.slide.style.margin = '0px'; - this.frame.slide.value = ' '; - this.frame.slide.style.position = 'relative'; - this.frame.slide.style.left = '-100px'; - this.frame.appendChild(this.frame.slide); - - // create events - var me = this; - this.frame.slide.onmousedown = function (event) {me._onMouseDown(event);}; - this.frame.prev.onclick = function (event) {me.prev(event);}; - this.frame.play.onclick = function (event) {me.togglePlay(event);}; - this.frame.next.onclick = function (event) {me.next(event);}; - } + if (childNode.dynamicEdgesLength == 1) { + this._addToCluster(parentNode,childNode,false); + } + else if (parentNode.dynamicEdgesLength == 1) { + this._addToCluster(childNode,parentNode,false); + } + } + } + } + } + } + }; - this.onChangeCallback = undefined; + /** + * This function forces the network to cluster all nodes with only one connecting edge to their + * connected node. + * + * @private + */ + exports._forceClustersByZoom = function() { + for (var nodeId in this.nodes) { + // another node could have absorbed this child. + if (this.nodes.hasOwnProperty(nodeId)) { + var childNode = this.nodes[nodeId]; - this.values = []; - this.index = undefined; + // the edges can be swallowed by another decrease + if (childNode.dynamicEdgesLength == 1 && childNode.dynamicEdges.length != 0) { + var edge = childNode.dynamicEdges[0]; + var parentNode = (edge.toId == childNode.id) ? this.nodes[edge.fromId] : this.nodes[edge.toId]; - this.playTimeout = undefined; - this.playInterval = 1000; // milliseconds - this.playLoop = true; -}; + // group to the largest node + if (childNode.id != parentNode.id) { + if (parentNode.mass > childNode.mass) { + this._addToCluster(parentNode,childNode,true); + } + else { + this._addToCluster(childNode,parentNode,true); + } + } + } + } + } + }; -/** - * Select the previous index - */ -Slider.prototype.prev = function() { - var index = this.getIndex(); - if (index > 0) { - index--; - this.setIndex(index); - } -}; -/** - * Select the next index - */ -Slider.prototype.next = function() { - var index = this.getIndex(); - if (index < this.values.length - 1) { - index++; - this.setIndex(index); - } -}; + /** + * To keep the nodes of roughly equal size we normalize the cluster levels. + * This function clusters a node to its smallest connected neighbour. + * + * @param node + * @private + */ + exports._clusterToSmallestNeighbour = function(node) { + var smallestNeighbour = -1; + var smallestNeighbourNode = null; + for (var i = 0; i < node.dynamicEdges.length; i++) { + if (node.dynamicEdges[i] !== undefined) { + var neighbour = null; + if (node.dynamicEdges[i].fromId != node.id) { + neighbour = node.dynamicEdges[i].from; + } + else if (node.dynamicEdges[i].toId != node.id) { + neighbour = node.dynamicEdges[i].to; + } -/** - * Select the next index - */ -Slider.prototype.playNext = function() { - var start = new Date(); - var index = this.getIndex(); - if (index < this.values.length - 1) { - index++; - this.setIndex(index); - } - else if (this.playLoop) { - // jump to the start - index = 0; - this.setIndex(index); - } + if (neighbour != null && smallestNeighbour > neighbour.clusterSessions.length) { + smallestNeighbour = neighbour.clusterSessions.length; + smallestNeighbourNode = neighbour; + } + } + } - var end = new Date(); - var diff = (end - start); + if (neighbour != null && this.nodes[neighbour.id] !== undefined) { + this._addToCluster(neighbour, node, true); + } + }; - // calculate how much time it to to set the index and to execute the callback - // function. - var interval = Math.max(this.playInterval - diff, 0); - // document.title = diff // TODO: cleanup - var me = this; - this.playTimeout = setTimeout(function() {me.playNext();}, interval); -}; + /** + * This function forms clusters from hubs, it loops over all nodes + * + * @param {Boolean} force | Disregard zoom level + * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges + * @private + */ + exports._formClustersByHub = function(force, onlyEqual) { + // we loop over all nodes in the list + for (var nodeId in this.nodes) { + // we check if it is still available since it can be used by the clustering in this loop + if (this.nodes.hasOwnProperty(nodeId)) { + this._formClusterFromHub(this.nodes[nodeId],force,onlyEqual); + } + } + }; -/** - * Toggle start or stop playing - */ -Slider.prototype.togglePlay = function() { - if (this.playTimeout === undefined) { - this.play(); - } else { - this.stop(); - } -}; + /** + * This function forms a cluster from a specific preselected hub node + * + * @param {Node} hubNode | the node we will cluster as a hub + * @param {Boolean} force | Disregard zoom level + * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges + * @param {Number} [absorptionSizeOffset] | + * @private + */ + exports._formClusterFromHub = function(hubNode, force, onlyEqual, absorptionSizeOffset) { + if (absorptionSizeOffset === undefined) { + absorptionSizeOffset = 0; + } + // we decide if the node is a hub + if ((hubNode.dynamicEdgesLength >= this.hubThreshold && onlyEqual == false) || + (hubNode.dynamicEdgesLength == this.hubThreshold && onlyEqual == true)) { + // initialize variables + var dx,dy,length; + var minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; + var allowCluster = false; -/** - * Start playing - */ -Slider.prototype.play = function() { - // Test whether already playing - if (this.playTimeout) return; + // we create a list of edges because the dynamicEdges change over the course of this loop + var edgesIdarray = []; + var amountOfInitialEdges = hubNode.dynamicEdges.length; + for (var j = 0; j < amountOfInitialEdges; j++) { + edgesIdarray.push(hubNode.dynamicEdges[j].id); + } - this.playNext(); + // if the hub clustering is not forces, we check if one of the edges connected + // to a cluster is small enough based on the constants.clustering.clusterEdgeThreshold + if (force == false) { + allowCluster = false; + for (j = 0; j < amountOfInitialEdges; j++) { + var edge = this.edges[edgesIdarray[j]]; + if (edge !== undefined) { + if (edge.connected) { + if (edge.toId != edge.fromId) { + dx = (edge.to.x - edge.from.x); + dy = (edge.to.y - edge.from.y); + length = Math.sqrt(dx * dx + dy * dy); - if (this.frame) { - this.frame.play.value = 'Stop'; - } -}; + if (length < minLength) { + allowCluster = true; + break; + } + } + } + } + } + } -/** - * Stop playing - */ -Slider.prototype.stop = function() { - clearInterval(this.playTimeout); - this.playTimeout = undefined; + // start the clustering if allowed + if ((!force && allowCluster) || force) { + // we loop over all edges INITIALLY connected to this hub + for (j = 0; j < amountOfInitialEdges; j++) { + edge = this.edges[edgesIdarray[j]]; + // the edge can be clustered by this function in a previous loop + if (edge !== undefined) { + var childNode = this.nodes[(edge.fromId == hubNode.id) ? edge.toId : edge.fromId]; + // we do not want hubs to merge with other hubs nor do we want to cluster itself. + if ((childNode.dynamicEdges.length <= (this.hubThreshold + absorptionSizeOffset)) && + (childNode.id != hubNode.id)) { + this._addToCluster(hubNode,childNode,force); + } + } + } + } + } + }; - if (this.frame) { - this.frame.play.value = 'Play'; - } -}; -/** - * Set a callback function which will be triggered when the value of the - * slider bar has changed. - */ -Slider.prototype.setOnChangeCallback = function(callback) { - this.onChangeCallback = callback; -}; -/** - * Set the interval for playing the list - * @param {Number} interval The interval in milliseconds - */ -Slider.prototype.setPlayInterval = function(interval) { - this.playInterval = interval; -}; + /** + * This function adds the child node to the parent node, creating a cluster if it is not already. + * + * @param {Node} parentNode | this is the node that will house the child node + * @param {Node} childNode | this node will be deleted from the global this.nodes and stored in the parent node + * @param {Boolean} force | true will only update the remainingEdges at the very end of the clustering, ensuring single level collapse + * @private + */ + exports._addToCluster = function(parentNode, childNode, force) { + // join child node in the parent node + parentNode.containedNodes[childNode.id] = childNode; -/** - * Retrieve the current play interval - * @return {Number} interval The interval in milliseconds - */ -Slider.prototype.getPlayInterval = function(interval) { - return this.playInterval; -}; + // manage all the edges connected to the child and parent nodes + for (var i = 0; i < childNode.dynamicEdges.length; i++) { + var edge = childNode.dynamicEdges[i]; + if (edge.toId == parentNode.id || edge.fromId == parentNode.id) { // edge connected to parentNode + this._addToContainedEdges(parentNode,childNode,edge); + } + else { + this._connectEdgeToCluster(parentNode,childNode,edge); + } + } + // a contained node has no dynamic edges. + childNode.dynamicEdges = []; -/** - * Set looping on or off - * @pararm {boolean} doLoop If true, the slider will jump to the start when - * the end is passed, and will jump to the end - * when the start is passed. - */ -Slider.prototype.setPlayLoop = function(doLoop) { - this.playLoop = doLoop; -}; + // remove circular edges from clusters + this._containCircularEdgesFromNode(parentNode,childNode); -/** - * Execute the onchange callback function - */ -Slider.prototype.onChange = function() { - if (this.onChangeCallback !== undefined) { - this.onChangeCallback(); - } -}; + // remove the childNode from the global nodes object + delete this.nodes[childNode.id]; -/** - * redraw the slider on the correct place - */ -Slider.prototype.redraw = function() { - if (this.frame) { - // resize the bar - this.frame.bar.style.top = (this.frame.clientHeight/2 - - this.frame.bar.offsetHeight/2) + 'px'; - this.frame.bar.style.width = (this.frame.clientWidth - - this.frame.prev.clientWidth - - this.frame.play.clientWidth - - this.frame.next.clientWidth - 30) + 'px'; - - // position the slider button - var left = this.indexToLeft(this.index); - this.frame.slide.style.left = (left) + 'px'; - } -}; + // update the properties of the child and parent + var massBefore = parentNode.mass; + childNode.clusterSession = this.clusterSession; + parentNode.mass += childNode.mass; + parentNode.clusterSize += childNode.clusterSize; + parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); + // keep track of the clustersessions so we can open the cluster up as it has been formed. + if (parentNode.clusterSessions[parentNode.clusterSessions.length - 1] != this.clusterSession) { + parentNode.clusterSessions.push(this.clusterSession); + } -/** - * Set the list with values for the slider - * @param {Array} values A javascript array with values (any type) - */ -Slider.prototype.setValues = function(values) { - this.values = values; + // forced clusters only open from screen size and double tap + if (force == true) { + // parentNode.formationScale = Math.pow(1 - (1.0/11.0),this.clusterSession+3); + parentNode.formationScale = 0; + } + else { + parentNode.formationScale = this.scale; // The latest child has been added on this scale + } - if (this.values.length > 0) - this.setIndex(0); - else - this.index = undefined; -}; + // recalculate the size of the node on the next time the node is rendered + parentNode.clearSizeCache(); -/** - * Select a value by its index - * @param {Number} index - */ -Slider.prototype.setIndex = function(index) { - if (index < this.values.length) { - this.index = index; + // set the pop-out scale for the childnode + parentNode.containedNodes[childNode.id].formationScale = parentNode.formationScale; - this.redraw(); - this.onChange(); - } - else { - throw 'Error: index out of range'; - } -}; + // nullify the movement velocity of the child, this is to avoid hectic behaviour + childNode.clearVelocity(); -/** - * retrieve the index of the currently selected vaue - * @return {Number} index - */ -Slider.prototype.getIndex = function() { - return this.index; -}; + // the mass has altered, preservation of energy dictates the velocity to be updated + parentNode.updateVelocity(massBefore); + // restart the simulation to reorganise all nodes + this.moving = true; + }; -/** - * retrieve the currently selected value - * @return {*} value - */ -Slider.prototype.get = function() { - return this.values[this.index]; -}; + /** + * This function will apply the changes made to the remainingEdges during the formation of the clusters. + * This is a seperate function to allow for level-wise collapsing of the node barnesHutTree. + * It has to be called if a level is collapsed. It is called by _formClusters(). + * @private + */ + exports._updateDynamicEdges = function() { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + node.dynamicEdgesLength = node.dynamicEdges.length; -Slider.prototype._onMouseDown = function(event) { - // only react on left mouse button down - var leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); - if (!leftButtonDown) return; + // this corrects for multiple edges pointing at the same other node + var correction = 0; + if (node.dynamicEdgesLength > 1) { + for (var j = 0; j < node.dynamicEdgesLength - 1; j++) { + var edgeToId = node.dynamicEdges[j].toId; + var edgeFromId = node.dynamicEdges[j].fromId; + for (var k = j+1; k < node.dynamicEdgesLength; k++) { + if ((node.dynamicEdges[k].toId == edgeToId && node.dynamicEdges[k].fromId == edgeFromId) || + (node.dynamicEdges[k].fromId == edgeToId && node.dynamicEdges[k].toId == edgeFromId)) { + correction += 1; + } + } + } + } + node.dynamicEdgesLength -= correction; + } + }; - this.startClientX = event.clientX; - this.startSlideX = parseFloat(this.frame.slide.style.left); - this.frame.style.cursor = 'move'; + /** + * This adds an edge from the childNode to the contained edges of the parent node + * + * @param parentNode | Node object + * @param childNode | Node object + * @param edge | Edge object + * @private + */ + exports._addToContainedEdges = function(parentNode, childNode, edge) { + // create an array object if it does not yet exist for this childNode + if (!(parentNode.containedEdges.hasOwnProperty(childNode.id))) { + parentNode.containedEdges[childNode.id] = [] + } + // add this edge to the list + parentNode.containedEdges[childNode.id].push(edge); - // add event listeners to handle moving the contents - // we store the function onmousemove and onmouseup in the graph, so we can - // remove the eventlisteners lateron in the function mouseUp() - var me = this; - this.onmousemove = function (event) {me._onMouseMove(event);}; - this.onmouseup = function (event) {me._onMouseUp(event);}; - G3DaddEventListener(document, 'mousemove', this.onmousemove); - G3DaddEventListener(document, 'mouseup', this.onmouseup); - G3DpreventDefault(event); -}; + // remove the edge from the global edges object + delete this.edges[edge.id]; + // remove the edge from the parent object + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + if (parentNode.dynamicEdges[i].id == edge.id) { + parentNode.dynamicEdges.splice(i,1); + break; + } + } + }; -Slider.prototype.leftToIndex = function (left) { - var width = parseFloat(this.frame.bar.style.width) - - this.frame.slide.clientWidth - 10; - var x = left - 3; + /** + * This function connects an edge that was connected to a child node to the parent node. + * It keeps track of which nodes it has been connected to with the originalId array. + * + * @param {Node} parentNode | Node object + * @param {Node} childNode | Node object + * @param {Edge} edge | Edge object + * @private + */ + exports._connectEdgeToCluster = function(parentNode, childNode, edge) { + // handle circular edges + if (edge.toId == edge.fromId) { + this._addToContainedEdges(parentNode, childNode, edge); + } + else { + if (edge.toId == childNode.id) { // edge connected to other node on the "to" side + edge.originalToId.push(childNode.id); + edge.to = parentNode; + edge.toId = parentNode.id; + } + else { // edge connected to other node with the "from" side - var index = Math.round(x / width * (this.values.length-1)); - if (index < 0) index = 0; - if (index > this.values.length-1) index = this.values.length-1; + edge.originalFromId.push(childNode.id); + edge.from = parentNode; + edge.fromId = parentNode.id; + } - return index; -}; + this._addToReroutedEdges(parentNode,childNode,edge); + } + }; -Slider.prototype.indexToLeft = function (index) { - var width = parseFloat(this.frame.bar.style.width) - - this.frame.slide.clientWidth - 10; - var x = index / (this.values.length-1) * width; - var left = x + 3; + /** + * If a node is connected to itself, a circular edge is drawn. When clustering we want to contain + * these edges inside of the cluster. + * + * @param parentNode + * @param childNode + * @private + */ + exports._containCircularEdgesFromNode = function(parentNode, childNode) { + // manage all the edges connected to the child and parent nodes + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + var edge = parentNode.dynamicEdges[i]; + // handle circular edges + if (edge.toId == edge.fromId) { + this._addToContainedEdges(parentNode, childNode, edge); + } + } + }; - return left; -}; + /** + * This adds an edge from the childNode to the rerouted edges of the parent node + * + * @param parentNode | Node object + * @param childNode | Node object + * @param edge | Edge object + * @private + */ + exports._addToReroutedEdges = function(parentNode, childNode, edge) { + // create an array object if it does not yet exist for this childNode + // we store the edge in the rerouted edges so we can restore it when the cluster pops open + if (!(parentNode.reroutedEdges.hasOwnProperty(childNode.id))) { + parentNode.reroutedEdges[childNode.id] = []; + } + parentNode.reroutedEdges[childNode.id].push(edge); + // this edge becomes part of the dynamicEdges of the cluster node + parentNode.dynamicEdges.push(edge); + }; -Slider.prototype._onMouseMove = function (event) { - var diff = event.clientX - this.startClientX; - var x = this.startSlideX + diff; - var index = this.leftToIndex(x); - this.setIndex(index); + /** + * This function connects an edge that was connected to a cluster node back to the child node. + * + * @param parentNode | Node object + * @param childNode | Node object + * @private + */ + exports._connectEdgeBackToChild = function(parentNode, childNode) { + if (parentNode.reroutedEdges.hasOwnProperty(childNode.id)) { + for (var i = 0; i < parentNode.reroutedEdges[childNode.id].length; i++) { + var edge = parentNode.reroutedEdges[childNode.id][i]; + if (edge.originalFromId[edge.originalFromId.length-1] == childNode.id) { + edge.originalFromId.pop(); + edge.fromId = childNode.id; + edge.from = childNode; + } + else { + edge.originalToId.pop(); + edge.toId = childNode.id; + edge.to = childNode; + } - G3DpreventDefault(); -}; + // append this edge to the list of edges connecting to the childnode + childNode.dynamicEdges.push(edge); + // remove the edge from the parent object + for (var j = 0; j < parentNode.dynamicEdges.length; j++) { + if (parentNode.dynamicEdges[j].id == edge.id) { + parentNode.dynamicEdges.splice(j,1); + break; + } + } + } + // remove the entry from the rerouted edges + delete parentNode.reroutedEdges[childNode.id]; + } + }; -Slider.prototype._onMouseUp = function (event) { - this.frame.style.cursor = 'auto'; - // remove event listeners - G3DremoveEventListener(document, 'mousemove', this.onmousemove); - G3DremoveEventListener(document, 'mouseup', this.onmouseup); + /** + * When loops are clustered, an edge can be both in the rerouted array and the contained array. + * This function is called last to verify that all edges in dynamicEdges are in fact connected to the + * parentNode + * + * @param parentNode | Node object + * @private + */ + exports._validateEdges = function(parentNode) { + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + var edge = parentNode.dynamicEdges[i]; + if (parentNode.id != edge.toId && parentNode.id != edge.fromId) { + parentNode.dynamicEdges.splice(i,1); + } + } + }; - G3DpreventDefault(); -}; + /** + * This function released the contained edges back into the global domain and puts them back into the + * dynamic edges of both parent and child. + * + * @param {Node} parentNode | + * @param {Node} childNode | + * @private + */ + exports._releaseContainedEdges = function(parentNode, childNode) { + for (var i = 0; i < parentNode.containedEdges[childNode.id].length; i++) { + var edge = parentNode.containedEdges[childNode.id][i]; + // put the edge back in the global edges object + this.edges[edge.id] = edge; -/**--------------------------------------------------------------------------**/ + // put the edge back in the dynamic edges of the child and parent + childNode.dynamicEdges.push(edge); + parentNode.dynamicEdges.push(edge); + } + // remove the entry from the contained edges + delete parentNode.containedEdges[childNode.id]; + }; -/** - * Retrieve the absolute left value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {Number} left The absolute left position of this element - * in the browser page. - */ -getAbsoluteLeft = function(elem) { - var left = 0; - while( elem !== null ) { - left += elem.offsetLeft; - left -= elem.scrollLeft; - elem = elem.offsetParent; - } - return left; -}; -/** - * Retrieve the absolute top value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {Number} top The absolute top position of this element - * in the browser page. - */ -getAbsoluteTop = function(elem) { - var top = 0; - while( elem !== null ) { - top += elem.offsetTop; - top -= elem.scrollTop; - elem = elem.offsetParent; - } - return top; -}; -/** - * Get the horizontal mouse position from a mouse event - * @param {Event} event - * @return {Number} mouse x - */ -getMouseX = function(event) { - if ('clientX' in event) return event.clientX; - return event.targetTouches[0] && event.targetTouches[0].clientX || 0; -}; + // ------------------- UTILITY FUNCTIONS ---------------------------- // -/** - * Get the vertical mouse position from a mouse event - * @param {Event} event - * @return {Number} mouse y - */ -getMouseY = function(event) { - if ('clientY' in event) return event.clientY; - return event.targetTouches[0] && event.targetTouches[0].clientY || 0; -}; + /** + * This updates the node labels for all nodes (for debugging purposes) + */ + exports.updateLabels = function() { + var nodeId; + // update node labels + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.clusterSize > 1) { + node.label = "[".concat(String(node.clusterSize),"]"); + } + } + } -/** - * vis.js module exports - */ -var vis = { - moment: moment, + // update node labels + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.clusterSize == 1) { + if (node.originalLabel !== undefined) { + node.label = node.originalLabel; + } + else { + node.label = String(node.id); + } + } + } + } - util: util, - DOMutil: DOMutil, + // /* Debug Override */ + // for (nodeId in this.nodes) { + // if (this.nodes.hasOwnProperty(nodeId)) { + // node = this.nodes[nodeId]; + // node.label = String(node.level); + // } + // } - DataSet: DataSet, - DataView: DataView, + }; - Timeline: Timeline, - Graph2d: Graph2d, - timeline: { - DataStep: DataStep, - Range: Range, - stack: stack, - TimeStep: TimeStep, - components: { - items: { - Item: Item, - ItemBox: ItemBox, - ItemPoint: ItemPoint, - ItemRange: ItemRange - }, + /** + * We want to keep the cluster level distribution rather small. This means we do not want unclustered nodes + * if the rest of the nodes are already a few cluster levels in. + * To fix this we use this function. It determines the min and max cluster level and sends nodes that have not + * clustered enough to the clusterToSmallestNeighbours function. + */ + exports.normalizeClusterLevels = function() { + var maxLevel = 0; + var minLevel = 1e9; + var clusterLevel = 0; + var nodeId; - Component: Component, - CurrentTime: CurrentTime, - CustomTime: CustomTime, - DataAxis: DataAxis, - GraphGroup: GraphGroup, - Group: Group, - ItemSet: ItemSet, - Legend: Legend, - LineGraph: LineGraph, - TimeAxis: TimeAxis - } - }, - - Network: Network, - network: { - Edge: Edge, - Groups: Groups, - Images: Images, - Node: Node, - Popup: Popup - }, + // we loop over all nodes in the list + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + clusterLevel = this.nodes[nodeId].clusterSessions.length; + if (maxLevel < clusterLevel) {maxLevel = clusterLevel;} + if (minLevel > clusterLevel) {minLevel = clusterLevel;} + } + } - // Deprecated since v3.0.0 - Graph: function () { - throw new Error('Graph is renamed to Network. Please create a graph as new vis.Network(...)'); - }, + if (maxLevel - minLevel > this.constants.clustering.clusterLevelDifference) { + var amountOfNodes = this.nodeIndices.length; + var targetLevel = maxLevel - this.constants.clustering.clusterLevelDifference; + // we loop over all nodes in the list + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].clusterSessions.length < targetLevel) { + this._clusterToSmallestNeighbour(this.nodes[nodeId]); + } + } + } + this._updateNodeIndexList(); + this._updateDynamicEdges(); + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length != amountOfNodes) { + this.clusterSession += 1; + } + } + }; - Graph3d: Graph3d -}; -/** - * CommonJS module exports - */ -if (typeof exports !== 'undefined') { - exports = vis; -} -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = vis; -} -/** - * AMD module exports - */ -if (typeof(define) === 'function') { - define(function () { - return vis; - }); -} + /** + * This function determines if the cluster we want to decluster is in the active area + * this means around the zoom center + * + * @param {Node} node + * @returns {boolean} + * @private + */ + exports._nodeInActiveArea = function(node) { + return ( + Math.abs(node.x - this.areaCenter.x) <= this.constants.clustering.activeAreaBoxSize/this.scale + && + Math.abs(node.y - this.areaCenter.y) <= this.constants.clustering.activeAreaBoxSize/this.scale + ) + }; -/** - * Window exports - */ -if (typeof window !== 'undefined') { - // attach the module to the window, load as a regular javascript file - window['vis'] = vis; -} + /** + * This is an adaptation of the original repositioning function. This is called if the system is clustered initially + * It puts large clusters away from the center and randomizes the order. + * + */ + exports.repositionNodes = function() { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + if ((node.xFixed == false || node.yFixed == false)) { + var radius = 10 * 0.1*this.nodeIndices.length * Math.min(100,node.mass); + var angle = 2 * Math.PI * Math.random(); + if (node.xFixed == false) {node.x = radius * Math.cos(angle);} + if (node.yFixed == false) {node.y = radius * Math.sin(angle);} + this._repositionBezierNodes(node); + } + } + }; -},{"emitter-component":2,"hammerjs":3,"moment":4,"mousetrap":5}],2:[function(require,module,exports){ -/** - * Expose `Emitter`. - */ + /** + * We determine how many connections denote an important hub. + * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) + * + * @private + */ + exports._getHubSize = function() { + var average = 0; + var averageSquared = 0; + var hubCounter = 0; + var largestHub = 0; -module.exports = Emitter; + for (var i = 0; i < this.nodeIndices.length; i++) { -/** - * Initialize a new `Emitter`. - * - * @api public - */ + var node = this.nodes[this.nodeIndices[i]]; + if (node.dynamicEdgesLength > largestHub) { + largestHub = node.dynamicEdgesLength; + } + average += node.dynamicEdgesLength; + averageSquared += Math.pow(node.dynamicEdgesLength,2); + hubCounter += 1; + } + average = average / hubCounter; + averageSquared = averageSquared / hubCounter; -function Emitter(obj) { - if (obj) return mixin(obj); -}; + var variance = averageSquared - Math.pow(average,2); -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ + var standardDeviation = Math.sqrt(variance); -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} + this.hubThreshold = Math.floor(average + 2*standardDeviation); -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ + // always have at least one to cluster + if (this.hubThreshold > largestHub) { + this.hubThreshold = largestHub; + } -Emitter.prototype.on = -Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks[event] = this._callbacks[event] || []) - .push(fn); - return this; -}; + // console.log("average",average,"averageSQ",averageSquared,"var",variance,"std",standardDeviation); + // console.log("hubThreshold:",this.hubThreshold); + }; -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ -Emitter.prototype.once = function(event, fn){ - var self = this; - this._callbacks = this._callbacks || {}; + /** + * We reduce the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods + * with this amount we can cluster specifically on these chains. + * + * @param {Number} fraction | between 0 and 1, the percentage of chains to reduce + * @private + */ + exports._reduceAmountOfChains = function(fraction) { + this.hubThreshold = 2; + var reduceAmount = Math.floor(this.nodeIndices.length * fraction); + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { + if (reduceAmount > 0) { + this._formClusterFromHub(this.nodes[nodeId],true,true,1); + reduceAmount -= 1; + } + } + } + } + }; - function on() { - self.off(event, on); - fn.apply(this, arguments); - } + /** + * We get the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods + * with this amount we can cluster specifically on these chains. + * + * @private + */ + exports._getChainFraction = function() { + var chains = 0; + var total = 0; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { + chains += 1; + } + total += 1; + } + } + return chains/total; + }; - on.fn = fn; - this.on(event, on); - return this; -}; -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ +/***/ }, +/* 50 */ +/***/ function(module, exports, __webpack_require__) { -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = -Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; + var util = __webpack_require__(1); - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } + /** + * Creation of the SectorMixin var. + * + * This contains all the functions the Network object can use to employ the sector system. + * The sector system is always used by Network, though the benefits only apply to the use of clustering. + * If clustering is not used, there is no overhead except for a duplicate object with references to nodes and edges. + */ - // specific event - var callbacks = this._callbacks[event]; - if (!callbacks) return this; + /** + * This function is only called by the setData function of the Network object. + * This loads the global references into the active sector. This initializes the sector. + * + * @private + */ + exports._putDataInSector = function() { + this.sectors["active"][this._sector()].nodes = this.nodes; + this.sectors["active"][this._sector()].edges = this.edges; + this.sectors["active"][this._sector()].nodeIndices = this.nodeIndices; + }; - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks[event]; - return this; - } - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; + /** + * /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied (active) sector. If a type is defined, do the specific type + * + * @param {String} sectorId + * @param {String} [sectorType] | "active" or "frozen" + * @private + */ + exports._switchToSector = function(sectorId, sectorType) { + if (sectorType === undefined || sectorType == "active") { + this._switchToActiveSector(sectorId); } - } - return this; -}; + else { + this._switchToFrozenSector(sectorId); + } + }; -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks[event]; + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied active sector. + * + * @param sectorId + * @private + */ + exports._switchToActiveSector = function(sectorId) { + this.nodeIndices = this.sectors["active"][sectorId]["nodeIndices"]; + this.nodes = this.sectors["active"][sectorId]["nodes"]; + this.edges = this.sectors["active"][sectorId]["edges"]; + }; - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - return this; -}; + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied active sector. + * + * @private + */ + exports._switchToSupportSector = function() { + this.nodeIndices = this.sectors["support"]["nodeIndices"]; + this.nodes = this.sectors["support"]["nodes"]; + this.edges = this.sectors["support"]["edges"]; + }; -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks[event] || []; -}; + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied frozen sector. + * + * @param sectorId + * @private + */ + exports._switchToFrozenSector = function(sectorId) { + this.nodeIndices = this.sectors["frozen"][sectorId]["nodeIndices"]; + this.nodes = this.sectors["frozen"][sectorId]["nodes"]; + this.edges = this.sectors["frozen"][sectorId]["edges"]; + }; -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; + /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the currently active sector. + * + * @private + */ + exports._loadLatestSector = function() { + this._switchToSector(this._sector()); + }; -},{}],3:[function(require,module,exports){ -/*! Hammer.JS - v1.0.5 - 2013-04-07 - * http://eightmedia.github.com/hammer.js - * - * Copyright (c) 2013 Jorik Tangelder ; - * Licensed under the MIT license */ -(function(window, undefined) { - 'use strict'; + /** + * This function returns the currently active sector Id + * + * @returns {String} + * @private + */ + exports._sector = function() { + return this.activeSector[this.activeSector.length-1]; + }; -/** - * Hammer - * use this to create instances - * @param {HTMLElement} element - * @param {Object} options - * @returns {Hammer.Instance} - * @constructor - */ -var Hammer = function(element, options) { - return new Hammer.Instance(element, options || {}); -}; - -// default settings -Hammer.defaults = { - // add styles and attributes to the element to prevent the browser from doing - // its native behavior. this doesnt prevent the scrolling, but cancels - // the contextmenu, tap highlighting etc - // set to false to disable this - stop_browser_behavior: { - // this also triggers onselectstart=false for IE - userSelect: 'none', - // this makes the element blocking in IE10 >, you could experiment with the value - // see for more options this issue; https://github.com/EightMedia/hammer.js/issues/241 - touchAction: 'none', - touchCallout: 'none', - contentZooming: 'none', - userDrag: 'none', - tapHighlightColor: 'rgba(0,0,0,0)' - } - - // more settings are defined per gesture at gestures.js -}; - -// detect touchevents -Hammer.HAS_POINTEREVENTS = navigator.pointerEnabled || navigator.msPointerEnabled; -Hammer.HAS_TOUCHEVENTS = ('ontouchstart' in window); - -// dont use mouseevents on mobile devices -Hammer.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; -Hammer.NO_MOUSEEVENTS = Hammer.HAS_TOUCHEVENTS && navigator.userAgent.match(Hammer.MOBILE_REGEX); - -// eventtypes per touchevent (start, move, end) -// are filled by Hammer.event.determineEventTypes on setup -Hammer.EVENT_TYPES = {}; - -// direction defines -Hammer.DIRECTION_DOWN = 'down'; -Hammer.DIRECTION_LEFT = 'left'; -Hammer.DIRECTION_UP = 'up'; -Hammer.DIRECTION_RIGHT = 'right'; - -// pointer type -Hammer.POINTER_MOUSE = 'mouse'; -Hammer.POINTER_TOUCH = 'touch'; -Hammer.POINTER_PEN = 'pen'; - -// touch event defines -Hammer.EVENT_START = 'start'; -Hammer.EVENT_MOVE = 'move'; -Hammer.EVENT_END = 'end'; - -// hammer document where the base events are added at -Hammer.DOCUMENT = document; - -// plugins namespace -Hammer.plugins = {}; - -// if the window events are set... -Hammer.READY = false; -/** - * setup events to detect gestures on the document - */ -function setup() { - if(Hammer.READY) { - return; + /** + * This function returns the previously active sector Id + * + * @returns {String} + * @private + */ + exports._previousSector = function() { + if (this.activeSector.length > 1) { + return this.activeSector[this.activeSector.length-2]; } - - // find what eventtypes we add listeners to - Hammer.event.determineEventTypes(); - - // Register all gestures inside Hammer.gestures - for(var name in Hammer.gestures) { - if(Hammer.gestures.hasOwnProperty(name)) { - Hammer.detection.register(Hammer.gestures[name]); - } + else { + throw new TypeError('there are not enough sectors in the this.activeSector array.'); } + }; - // Add touch events on the document - Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_MOVE, Hammer.detection.detect); - Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_END, Hammer.detection.detect); - // Hammer is ready...! - Hammer.READY = true; -} + /** + * We add the active sector at the end of the this.activeSector array + * This ensures it is the currently active sector returned by _sector() and it reaches the top + * of the activeSector stack. When we reverse our steps we move from the end to the beginning of this stack. + * + * @param newId + * @private + */ + exports._setActiveSector = function(newId) { + this.activeSector.push(newId); + }; -/** - * create new hammer instance - * all methods should return the instance itself, so it is chainable. - * @param {HTMLElement} element - * @param {Object} [options={}] - * @returns {Hammer.Instance} - * @constructor - */ -Hammer.Instance = function(element, options) { - var self = this; - // setup HammerJS window events and register all gestures - // this also sets up the default options - setup(); + /** + * We remove the currently active sector id from the active sector stack. This happens when + * we reactivate the previously active sector + * + * @private + */ + exports._forgetLastSector = function() { + this.activeSector.pop(); + }; - this.element = element; - // start/stop detection option - this.enabled = true; + /** + * This function creates a new active sector with the supplied newId. This newId + * is the expanding node id. + * + * @param {String} newId | Id of the new active sector + * @private + */ + exports._createNewSector = function(newId) { + // create the new sector + this.sectors["active"][newId] = {"nodes":{}, + "edges":{}, + "nodeIndices":[], + "formationScale": this.scale, + "drawingNode": undefined}; - // merge options - this.options = Hammer.utils.extend( - Hammer.utils.extend({}, Hammer.defaults), - options || {}); + // create the new sector render node. This gives visual feedback that you are in a new sector. + this.sectors["active"][newId]['drawingNode'] = new Node( + {id:newId, + color: { + background: "#eaefef", + border: "495c5e" + } + },{},{},this.constants); + this.sectors["active"][newId]['drawingNode'].clusterSize = 2; + }; - // add some css to the element to prevent the browser from doing its native behavoir - if(this.options.stop_browser_behavior) { - Hammer.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior); - } - // start detection on touchstart - Hammer.event.onTouch(element, Hammer.EVENT_START, function(ev) { - if(self.enabled) { - Hammer.detection.startDetect(self, ev); - } - }); + /** + * This function removes the currently active sector. This is called when we create a new + * active sector. + * + * @param {String} sectorId | Id of the active sector that will be removed + * @private + */ + exports._deleteActiveSector = function(sectorId) { + delete this.sectors["active"][sectorId]; + }; - // return instance - return this; -}; + /** + * This function removes the currently active sector. This is called when we reactivate + * the previously active sector. + * + * @param {String} sectorId | Id of the active sector that will be removed + * @private + */ + exports._deleteFrozenSector = function(sectorId) { + delete this.sectors["frozen"][sectorId]; + }; -Hammer.Instance.prototype = { - /** - * bind events to the instance - * @param {String} gesture - * @param {Function} handler - * @returns {Hammer.Instance} - */ - on: function onEvent(gesture, handler){ - var gestures = gesture.split(' '); - for(var t=0; t 0 && eventType == Hammer.EVENT_END) { - eventType = Hammer.EVENT_MOVE; - } - // no touches, force the end event - else if(!count_touches) { - eventType = Hammer.EVENT_END; - } + // we cannot collapse the default sector + if (sector != "default") { + if ((this.nodeIndices.length == 1) || + (this.sectors["active"][sector]["drawingNode"].width*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || + (this.sectors["active"][sector]["drawingNode"].height*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { + var previousSector = this._previousSector(); - // because touchend has no touches, and we often want to use these in our gestures, - // we send the last move event as our eventData in touchend - if(!count_touches && last_move_event !== null) { - ev = last_move_event; - } - // store the last move event - else { - last_move_event = ev; - } + // we collapse the sector back to a single cluster + this._collapseThisToSingleCluster(); - // trigger the handler - handler.call(Hammer.detection, self.collectEventData(element, eventType, ev)); + // we move the remaining nodes, edges and nodeIndices to the previous sector. + // This previous sector is the one we will reactivate + this._mergeThisWithFrozen(previousSector); - // remove pointerevent from list - if(Hammer.HAS_POINTEREVENTS && eventType == Hammer.EVENT_END) { - count_touches = Hammer.PointerEvent.updatePointer(eventType, ev); - } - } + // the previously active (frozen) sector now has all the data from the currently active sector. + // we can now delete the active sector. + this._deleteActiveSector(sector); + + // we activate the previously active (and currently frozen) sector. + this._activateSector(previousSector); + + // we load the references from the newly active sector into the global references + this._switchToSector(previousSector); + + // we forget the previously active sector because we reverted to the one before + this._forgetLastSector(); - //debug(sourceEventType +" "+ eventType); + // finally, we update the node index list. + this._updateNodeIndexList(); - // on the end we reset everything - if(!count_touches) { - last_move_event = null; - enable_detect = false; - touch_triggered = false; - Hammer.PointerEvent.reset(); - } - }); - }, + // we refresh the list with calulation nodes and calculation node indices. + this._updateCalculationNodes(); + } + } + }; - /** - * we have different events for each device/browser - * determine what we need and set them in the Hammer.EVENT_TYPES constant - */ - determineEventTypes: function determineEventTypes() { - // determine the eventtype we want to set - var types; - - // pointerEvents magic - if(Hammer.HAS_POINTEREVENTS) { - types = Hammer.PointerEvent.getEvents(); - } - // on Android, iOS, blackberry, windows mobile we dont want any mouseevents - else if(Hammer.NO_MOUSEEVENTS) { - types = [ - 'touchstart', - 'touchmove', - 'touchend touchcancel']; - } - // for non pointer events browsers and mixed browsers, - // like chrome on windows8 touch laptop - else { - types = [ - 'touchstart mousedown', - 'touchmove mousemove', - 'touchend touchcancel mouseup']; + /** + * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we dont pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInAllActiveSectors = function(runFunction,argument) { + if (argument === undefined) { + for (var sector in this.sectors["active"]) { + if (this.sectors["active"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToActiveSector(sector); + this[runFunction](); + } + } + } + else { + for (var sector in this.sectors["active"]) { + if (this.sectors["active"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToActiveSector(sector); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } } + } + } + // we revert the global references back to our active sector + this._loadLatestSector(); + }; - Hammer.EVENT_TYPES[Hammer.EVENT_START] = types[0]; - Hammer.EVENT_TYPES[Hammer.EVENT_MOVE] = types[1]; - Hammer.EVENT_TYPES[Hammer.EVENT_END] = types[2]; - }, + + /** + * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we dont pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInSupportSector = function(runFunction,argument) { + if (argument === undefined) { + this._switchToSupportSector(); + this[runFunction](); + } + else { + this._switchToSupportSector(); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } + } + // we revert the global references back to our active sector + this._loadLatestSector(); + }; - /** - * create touchlist depending on the event - * @param {Object} ev - * @param {String} eventType used by the fakemultitouch plugin - */ - getTouchList: function getTouchList(ev/*, eventType*/) { - // get the fake pointerEvent touchlist - if(Hammer.HAS_POINTEREVENTS) { - return Hammer.PointerEvent.getTouchList(); - } - // get the touchlist - else if(ev.touches) { - return ev.touches; + /** + * This runs a function in all frozen sectors. This is used in the _redraw(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we don't pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInAllFrozenSectors = function(runFunction,argument) { + if (argument === undefined) { + for (var sector in this.sectors["frozen"]) { + if (this.sectors["frozen"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToFrozenSector(sector); + this[runFunction](); } - // make fake touchlist from mouse position - else { - return [{ - identifier: 1, - pageX: ev.pageX, - pageY: ev.pageY, - target: ev.target - }]; + } + } + else { + for (var sector in this.sectors["frozen"]) { + if (this.sectors["frozen"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToFrozenSector(sector); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } } - }, + } + } + this._loadLatestSector(); + }; - /** - * collect event data for Hammer js - * @param {HTMLElement} element - * @param {String} eventType like Hammer.EVENT_MOVE - * @param {Object} eventData - */ - collectEventData: function collectEventData(element, eventType, ev) { - var touches = this.getTouchList(ev, eventType); + /** + * This runs a function in all sectors. This is used in the _redraw(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we don't pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ + exports._doInAllSectors = function(runFunction,argument) { + var args = Array.prototype.splice.call(arguments, 1); + if (argument === undefined) { + this._doInAllActiveSectors(runFunction); + this._doInAllFrozenSectors(runFunction); + } + else { + if (args.length > 1) { + this._doInAllActiveSectors(runFunction,args[0],args[1]); + this._doInAllFrozenSectors(runFunction,args[0],args[1]); + } + else { + this._doInAllActiveSectors(runFunction,argument); + this._doInAllFrozenSectors(runFunction,argument); + } + } + }; - // find out pointerType - var pointerType = Hammer.POINTER_TOUCH; - if(ev.type.match(/mouse/) || Hammer.PointerEvent.matchType(Hammer.POINTER_MOUSE, ev)) { - pointerType = Hammer.POINTER_MOUSE; - } - return { - center : Hammer.utils.getCenter(touches), - timeStamp : new Date().getTime(), - target : ev.target, - touches : touches, - eventType : eventType, - pointerType : pointerType, - srcEvent : ev, + /** + * This clears the nodeIndices list. We cannot use this.nodeIndices = [] because we would break the link with the + * active sector. Thus we clear the nodeIndices in the active sector, then reconnect the this.nodeIndices to it. + * + * @private + */ + exports._clearNodeIndexList = function() { + var sector = this._sector(); + this.sectors["active"][sector]["nodeIndices"] = []; + this.nodeIndices = this.sectors["active"][sector]["nodeIndices"]; + }; - /** - * prevent the browser default actions - * mostly used to disable scrolling of the browser - */ - preventDefault: function() { - if(this.srcEvent.preventManipulation) { - this.srcEvent.preventManipulation(); - } - if(this.srcEvent.preventDefault) { - this.srcEvent.preventDefault(); - } - }, + /** + * Draw the encompassing sector node + * + * @param ctx + * @param sectorType + * @private + */ + exports._drawSectorNodes = function(ctx,sectorType) { + var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; + for (var sector in this.sectors[sectorType]) { + if (this.sectors[sectorType].hasOwnProperty(sector)) { + if (this.sectors[sectorType][sector]["drawingNode"] !== undefined) { - /** - * stop bubbling the event up to its parents - */ - stopPropagation: function() { - this.srcEvent.stopPropagation(); - }, + this._switchToSector(sector,sectorType); - /** - * immediately stop gesture detection - * might be useful after a swipe was detected - * @return {*} - */ - stopDetect: function() { - return Hammer.detection.stopDetect(); + minY = 1e9; maxY = -1e9; minX = 1e9; maxX = -1e9; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + node.resize(ctx); + if (minX > node.x - 0.5 * node.width) {minX = node.x - 0.5 * node.width;} + if (maxX < node.x + 0.5 * node.width) {maxX = node.x + 0.5 * node.width;} + if (minY > node.y - 0.5 * node.height) {minY = node.y - 0.5 * node.height;} + if (maxY < node.y + 0.5 * node.height) {maxY = node.y + 0.5 * node.height;} } - }; + } + node = this.sectors[sectorType][sector]["drawingNode"]; + node.x = 0.5 * (maxX + minX); + node.y = 0.5 * (maxY + minY); + node.width = 2 * (node.x - minX); + node.height = 2 * (node.y - minY); + node.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2)); + node.setScale(this.scale); + node._drawCircle(ctx); + } + } } -}; - -Hammer.PointerEvent = { - /** - * holds all pointers - * @type {Object} - */ - pointers: {}, + }; - /** - * get a list of pointers - * @returns {Array} touchlist - */ - getTouchList: function() { - var self = this; - var touchlist = []; + exports._drawAllSectorNodes = function(ctx) { + this._drawSectorNodes(ctx,"frozen"); + this._drawSectorNodes(ctx,"active"); + this._loadLatestSector(); + }; - // we can use forEach since pointerEvents only is in IE10 - Object.keys(self.pointers).sort().forEach(function(id) { - touchlist.push(self.pointers[id]); - }); - return touchlist; - }, - /** - * update the position of a pointer - * @param {String} type Hammer.EVENT_END - * @param {Object} pointerEvent - */ - updatePointer: function(type, pointerEvent) { - if(type == Hammer.EVENT_END) { - this.pointers = {}; - } - else { - pointerEvent.identifier = pointerEvent.pointerId; - this.pointers[pointerEvent.pointerId] = pointerEvent; - } +/***/ }, +/* 51 */ +/***/ function(module, exports, __webpack_require__) { - return Object.keys(this.pointers).length; - }, + var Node = __webpack_require__(36); - /** - * check if ev matches pointertype - * @param {String} pointerType Hammer.POINTER_MOUSE - * @param {PointerEvent} ev - */ - matchType: function(pointerType, ev) { - if(!ev.pointerType) { - return false; + /** + * This function can be called from the _doInAllSectors function + * + * @param object + * @param overlappingNodes + * @private + */ + exports._getNodesOverlappingWith = function(object, overlappingNodes) { + var nodes = this.nodes; + for (var nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + if (nodes[nodeId].isOverlappingWith(object)) { + overlappingNodes.push(nodeId); } + } + } + }; - var types = {}; - types[Hammer.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == Hammer.POINTER_MOUSE); - types[Hammer.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == Hammer.POINTER_TOUCH); - types[Hammer.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == Hammer.POINTER_PEN); - return types[pointerType]; - }, + /** + * retrieve all nodes overlapping with given object + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ + exports._getAllNodesOverlappingWith = function (object) { + var overlappingNodes = []; + this._doInAllActiveSectors("_getNodesOverlappingWith",object,overlappingNodes); + return overlappingNodes; + }; - /** - * get events - */ - getEvents: function() { - return [ - 'pointerdown MSPointerDown', - 'pointermove MSPointerMove', - 'pointerup pointercancel MSPointerUp MSPointerCancel' - ]; - }, + /** + * Return a position object in canvasspace from a single point in screenspace + * + * @param pointer + * @returns {{left: number, top: number, right: number, bottom: number}} + * @private + */ + exports._pointerToPositionObject = function(pointer) { + var x = this._XconvertDOMtoCanvas(pointer.x); + var y = this._YconvertDOMtoCanvas(pointer.y); + + return { + left: x, + top: y, + right: x, + bottom: y + }; + }; - /** - * reset the list - */ - reset: function() { - this.pointers = {}; - } -}; + /** + * Get the top node at the a specific point (like a click) + * + * @param {{x: Number, y: Number}} pointer + * @return {Node | null} node + * @private + */ + exports._getNodeAt = function (pointer) { + // we first check if this is an navigation controls element + var positionObject = this._pointerToPositionObject(pointer); + var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); -Hammer.utils = { - /** - * extend method, - * also used for cloning when dest is an empty object - * @param {Object} dest - * @param {Object} src - * @parm {Boolean} merge do a merge - * @returns {Object} dest - */ - extend: function extend(dest, src, merge) { - for (var key in src) { - if(dest[key] !== undefined && merge) { - continue; - } - dest[key] = src[key]; - } - return dest; - }, + // if there are overlapping nodes, select the last one, this is the + // one which is drawn on top of the others + if (overlappingNodes.length > 0) { + return this.nodes[overlappingNodes[overlappingNodes.length - 1]]; + } + else { + return null; + } + }; - /** - * find if a node is in the given parent - * used for event delegation tricks - * @param {HTMLElement} node - * @param {HTMLElement} parent - * @returns {boolean} has_parent - */ - hasParent: function(node, parent) { - while(node){ - if(node == parent) { - return true; - } - node = node.parentNode; + /** + * retrieve all edges overlapping with given object, selector is around center + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ + exports._getEdgesOverlappingWith = function (object, overlappingEdges) { + var edges = this.edges; + for (var edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + if (edges[edgeId].isOverlappingWith(object)) { + overlappingEdges.push(edgeId); } - return false; - }, - + } + } + }; - /** - * get the center of all the touches - * @param {Array} touches - * @returns {Object} center - */ - getCenter: function getCenter(touches) { - var valuesX = [], valuesY = []; - for(var t= 0,len=touches.length; t 0) { + return this.edges[overlappingEdges[overlappingEdges.length - 1]]; + } + else { + return null; + } + }; - /** - * calculate the velocity between two points - * @param {Number} delta_time - * @param {Number} delta_x - * @param {Number} delta_y - * @returns {Object} velocity - */ - getVelocity: function getVelocity(delta_time, delta_x, delta_y) { - return { - x: Math.abs(delta_x / delta_time) || 0, - y: Math.abs(delta_y / delta_time) || 0 - }; - }, + /** + * Add object to the selection array. + * + * @param obj + * @private + */ + exports._addToSelection = function(obj) { + if (obj instanceof Node) { + this.selectionObj.nodes[obj.id] = obj; + } + else { + this.selectionObj.edges[obj.id] = obj; + } + }; - /** - * calculate the angle between two coordinates - * @param {Touch} touch1 - * @param {Touch} touch2 - * @returns {Number} angle - */ - getAngle: function getAngle(touch1, touch2) { - var y = touch2.pageY - touch1.pageY, - x = touch2.pageX - touch1.pageX; - return Math.atan2(y, x) * 180 / Math.PI; - }, + /** + * Add object to the selection array. + * + * @param obj + * @private + */ + exports._addToHover = function(obj) { + if (obj instanceof Node) { + this.hoverObj.nodes[obj.id] = obj; + } + else { + this.hoverObj.edges[obj.id] = obj; + } + }; - /** - * angle to direction define - * @param {Touch} touch1 - * @param {Touch} touch2 - * @returns {String} direction constant, like Hammer.DIRECTION_LEFT - */ - getDirection: function getDirection(touch1, touch2) { - var x = Math.abs(touch1.pageX - touch2.pageX), - y = Math.abs(touch1.pageY - touch2.pageY); + /** + * Remove a single option from selection. + * + * @param {Object} obj + * @private + */ + exports._removeFromSelection = function(obj) { + if (obj instanceof Node) { + delete this.selectionObj.nodes[obj.id]; + } + else { + delete this.selectionObj.edges[obj.id]; + } + }; - if(x >= y) { - return touch1.pageX - touch2.pageX > 0 ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT; - } - else { - return touch1.pageY - touch2.pageY > 0 ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN; - } - }, + /** + * Unselect all. The selectionObj is useful for this. + * + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ + exports._unselectAll = function(doNotTrigger) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + this.selectionObj.nodes[nodeId].unselect(); + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + this.selectionObj.edges[edgeId].unselect(); + } + } + this.selectionObj = {nodes:{},edges:{}}; - /** - * calculate the distance between two touches - * @param {Touch} touch1 - * @param {Touch} touch2 - * @returns {Number} distance - */ - getDistance: function getDistance(touch1, touch2) { - var x = touch2.pageX - touch1.pageX, - y = touch2.pageY - touch1.pageY; - return Math.sqrt((x*x) + (y*y)); - }, + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } + }; + /** + * Unselect all clusters. The selectionObj is useful for this. + * + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ + exports._unselectClusters = function(doNotTrigger) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } - /** - * calculate the scale factor between two touchLists (fingers) - * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out - * @param {Array} start - * @param {Array} end - * @returns {Number} scale - */ - getScale: function getScale(start, end) { - // need two fingers... - if(start.length >= 2 && end.length >= 2) { - return this.getDistance(end[0], end[1]) / - this.getDistance(start[0], start[1]); + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (this.selectionObj.nodes[nodeId].clusterSize > 1) { + this.selectionObj.nodes[nodeId].unselect(); + this._removeFromSelection(this.selectionObj.nodes[nodeId]); } - return 1; - }, + } + } + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } + }; - /** - * calculate the rotation degrees between two touchLists (fingers) - * @param {Array} start - * @param {Array} end - * @returns {Number} rotation - */ - getRotation: function getRotation(start, end) { - // need two fingers - if(start.length >= 2 && end.length >= 2) { - return this.getAngle(end[1], end[0]) - - this.getAngle(start[1], start[0]); - } - return 0; - }, + /** + * return the number of selected nodes + * + * @returns {number} + * @private + */ + exports._getSelectedNodeCount = function() { + var count = 0; + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + return count; + }; - /** - * boolean if the direction is vertical - * @param {String} direction - * @returns {Boolean} is_vertical - */ - isVertical: function isVertical(direction) { - return (direction == Hammer.DIRECTION_UP || direction == Hammer.DIRECTION_DOWN); - }, + /** + * return the selected node + * + * @returns {number} + * @private + */ + exports._getSelectedNode = function() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return this.selectionObj.nodes[nodeId]; + } + } + return null; + }; + /** + * return the selected edge + * + * @returns {number} + * @private + */ + exports._getSelectedEdge = function() { + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + return this.selectionObj.edges[edgeId]; + } + } + return null; + }; - /** - * stop browser default behavior with css props - * @param {HtmlElement} element - * @param {Object} css_props - */ - stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_props) { - var prop, - vendors = ['webkit','khtml','moz','ms','o','']; - if(!css_props || !element.style) { - return; - } + /** + * return the number of selected edges + * + * @returns {number} + * @private + */ + exports._getSelectedEdgeCount = function() { + var count = 0; + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; + }; + - // with css properties for modern browsers - for(var i = 0; i < vendors.length; i++) { - for(var p in css_props) { - if(css_props.hasOwnProperty(p)) { - prop = p; + /** + * return the number of selected objects. + * + * @returns {number} + * @private + */ + exports._getSelectedObjectCount = function() { + var count = 0; + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; + }; - // vender prefix at the property - if(vendors[i]) { - prop = vendors[i] + prop.substring(0, 1).toUpperCase() + prop.substring(1); - } + /** + * Check if anything is selected + * + * @returns {boolean} + * @private + */ + exports._selectionIsEmpty = function() { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return false; + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + return false; + } + } + return true; + }; - // set the style - element.style[prop] = css_props[p]; - } - } - } - // also the disable onselectstart - if(css_props.userSelect == 'none') { - element.onselectstart = function() { - return false; - }; + /** + * check if one of the selected nodes is a cluster. + * + * @returns {boolean} + * @private + */ + exports._clusterInSelection = function() { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (this.selectionObj.nodes[nodeId].clusterSize > 1) { + return true; } + } } -}; + return false; + }; -Hammer.detection = { - // contains all registred Hammer.gestures in the correct order - gestures: [], + /** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + exports._selectConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.select(); + this._addToSelection(edge); + } + }; - // data of the current Hammer.gesture detection session - current: null, + /** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + exports._hoverConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.hover = true; + this._addToHover(edge); + } + }; - // the previous Hammer.gesture session data - // is a full clone of the previous gesture.current object - previous: null, - // when this becomes true, no gestures are fired - stopped: false, + /** + * unselect the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + exports._unselectConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.unselect(); + this._removeFromSelection(edge); + } + }; - /** - * start Hammer.gesture detection - * @param {Hammer.Instance} inst - * @param {Object} eventData - */ - startDetect: function startDetect(inst, eventData) { - // already busy with a Hammer.gesture detection on an element - if(this.current) { - return; - } - this.stopped = false; - this.current = { - inst : inst, // reference to HammerInstance we're working for - startEvent : Hammer.utils.extend({}, eventData), // start eventData for distances, timing etc - lastEvent : false, // last eventData - name : '' // current gesture we're in/detected, can be 'tap', 'hold' etc - }; + /** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @param {Boolean} append + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ + exports._selectObject = function(object, append, doNotTrigger, highlightEdges) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + if (highlightEdges === undefined) { + highlightEdges = true; + } - this.detect(eventData); - }, + if (this._selectionIsEmpty() == false && append == false && this.forceAppendSelection == false) { + this._unselectAll(true); + } + if (object.selected == false) { + object.select(); + this._addToSelection(object); + if (object instanceof Node && this.blockConnectingEdgeSelection == false && highlightEdges == true) { + this._selectConnectedEdges(object); + } + } + else { + object.unselect(); + this._removeFromSelection(object); + } - /** - * Hammer.gesture detection - * @param {Object} eventData - * @param {Object} eventData - */ - detect: function detect(eventData) { - if(!this.current || this.stopped) { - return; - } + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } + }; - // extend event data with calculations about scale, distance etc - eventData = this.extendEventData(eventData); - // instance options - var inst_options = this.current.inst.options; + /** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @private + */ + exports._blurObject = function(object) { + if (object.hover == true) { + object.hover = false; + this.emit("blurNode",{node:object.id}); + } + }; - // call Hammer.gesture handlers - for(var g=0,len=this.gestures.length; g, edges: Array.}} selection + */ + exports.getSelection = function() { + var nodeIds = this.getSelectedNodes(); + var edgeIds = this.getSelectedEdges(); + return {nodes:nodeIds, edges:edgeIds}; + }; - distance : Hammer.utils.getDistance(startEv.center, ev.center), - angle : Hammer.utils.getAngle(startEv.center, ev.center), - direction : Hammer.utils.getDirection(startEv.center, ev.center), + /** + * + * retrieve the currently selected nodes + * @return {String[]} selection An array with the ids of the + * selected nodes. + */ + exports.getSelectedNodes = function() { + var idArray = []; + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + idArray.push(nodeId); + } + } + return idArray + }; - scale : Hammer.utils.getScale(startEv.touches, ev.touches), - rotation : Hammer.utils.getRotation(startEv.touches, ev.touches), + /** + * + * retrieve the currently selected edges + * @return {Array} selection An array with the ids of the + * selected nodes. + */ + exports.getSelectedEdges = function() { + var idArray = []; + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + idArray.push(edgeId); + } + } + return idArray; + }; - startEvent : startEv - }); - return ev; - }, + /** + * select zero or more nodes + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + */ + exports.setSelection = function(selection) { + var i, iMax, id; + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; - /** - * register new gesture - * @param {Object} gesture object, see gestures.js for documentation - * @returns {Array} gestures - */ - register: function register(gesture) { - // add an enable gesture options if there is no given - var options = gesture.defaults || {}; - if(options[gesture.name] === undefined) { - options[gesture.name] = true; - } + // first unselect any selected node + this._unselectAll(true); - // extend Hammer default options with the Hammer.gesture options - Hammer.utils.extend(Hammer.defaults, options, true); + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; - // set its index - gesture.index = gesture.index || 1000; + var node = this.nodes[id]; + if (!node) { + throw new RangeError('Node with id "' + id + '" not found'); + } + this._selectObject(node,true,true); + } - // add Hammer.gesture to the list - this.gestures.push(gesture); + console.log("setSelection is deprecated. Please use selectNodes instead.") - // sort the list by index - this.gestures.sort(function(a, b) { - if (a.index < b.index) { - return -1; - } - if (a.index > b.index) { - return 1; - } - return 0; - }); + this.redraw(); + }; - return this.gestures; - } -}; + /** + * select zero or more nodes with the option to highlight edges + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + * @param {boolean} [highlightEdges] + */ + exports.selectNodes = function(selection, highlightEdges) { + var i, iMax, id; -Hammer.gestures = Hammer.gestures || {}; + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; -/** - * Custom gestures - * ============================== - * - * Gesture object - * -------------------- - * The object structure of a gesture: - * - * { name: 'mygesture', - * index: 1337, - * defaults: { - * mygesture_option: true - * } - * handler: function(type, ev, inst) { - * // trigger gesture event - * inst.trigger(this.name, ev); - * } - * } - - * @param {String} name - * this should be the name of the gesture, lowercase - * it is also being used to disable/enable the gesture per instance config. - * - * @param {Number} [index=1000] - * the index of the gesture, where it is going to be in the stack of gestures detection - * like when you build an gesture that depends on the drag gesture, it is a good - * idea to place it after the index of the drag gesture. - * - * @param {Object} [defaults={}] - * the default settings of the gesture. these are added to the instance settings, - * and can be overruled per instance. you can also add the name of the gesture, - * but this is also added by default (and set to true). - * - * @param {Function} handler - * this handles the gesture detection of your custom gesture and receives the - * following arguments: - * - * @param {Object} eventData - * event data containing the following properties: - * timeStamp {Number} time the event occurred - * target {HTMLElement} target element - * touches {Array} touches (fingers, pointers, mouse) on the screen - * pointerType {String} kind of pointer that was used. matches Hammer.POINTER_MOUSE|TOUCH - * center {Object} center position of the touches. contains pageX and pageY - * deltaTime {Number} the total time of the touches in the screen - * deltaX {Number} the delta on x axis we haved moved - * deltaY {Number} the delta on y axis we haved moved - * velocityX {Number} the velocity on the x - * velocityY {Number} the velocity on y - * angle {Number} the angle we are moving - * direction {String} the direction we are moving. matches Hammer.DIRECTION_UP|DOWN|LEFT|RIGHT - * distance {Number} the distance we haved moved - * scale {Number} scaling of the touches, needs 2 touches - * rotation {Number} rotation of the touches, needs 2 touches * - * eventType {String} matches Hammer.EVENT_START|MOVE|END - * srcEvent {Object} the source event, like TouchStart or MouseDown * - * startEvent {Object} contains the same properties as above, - * but from the first touch. this is used to calculate - * distances, deltaTime, scaling etc - * - * @param {Hammer.Instance} inst - * the instance we are doing the detection for. you can get the options from - * the inst.options object and trigger the gesture event by calling inst.trigger - * - * - * Handle gestures - * -------------------- - * inside the handler you can get/set Hammer.detection.current. This is the current - * detection session. It has the following properties - * @param {String} name - * contains the name of the gesture we have detected. it has not a real function, - * only to check in other gestures if something is detected. - * like in the drag gesture we set it to 'drag' and in the swipe gesture we can - * check if the current gesture is 'drag' by accessing Hammer.detection.current.name - * - * @readonly - * @param {Hammer.Instance} inst - * the instance we do the detection for - * - * @readonly - * @param {Object} startEvent - * contains the properties of the first gesture detection in this session. - * Used for calculations about timing, distance, etc. - * - * @readonly - * @param {Object} lastEvent - * contains all the properties of the last gesture detect in this session. - * - * after the gesture detection session has been completed (user has released the screen) - * the Hammer.detection.current object is copied into Hammer.detection.previous, - * this is usefull for gestures like doubletap, where you need to know if the - * previous gesture was a tap - * - * options that have been set by the instance can be received by calling inst.options - * - * You can trigger a gesture event by calling inst.trigger("mygesture", event). - * The first param is the name of your gesture, the second the event argument - * - * - * Register gestures - * -------------------- - * When an gesture is added to the Hammer.gestures object, it is auto registered - * at the setup of the first Hammer instance. You can also call Hammer.detection.register - * manually and pass your gesture object as a param - * - */ + // first unselect any selected node + this._unselectAll(true); -/** - * Hold - * Touch stays at the same place for x time - * @events hold - */ -Hammer.gestures.Hold = { - name: 'hold', - index: 10, - defaults: { - hold_timeout : 500, - hold_threshold : 1 - }, - timer: null, - handler: function holdGesture(ev, inst) { - switch(ev.eventType) { - case Hammer.EVENT_START: - // clear any running timers - clearTimeout(this.timer); - - // set the gesture so we can check in the timeout if it still is - Hammer.detection.current.name = this.name; - - // set timer and if after the timeout it still is hold, - // we trigger the hold event - this.timer = setTimeout(function() { - if(Hammer.detection.current.name == 'hold') { - inst.trigger('hold', ev); - } - }, inst.options.hold_timeout); - break; - - // when you move or end we clear the timer - case Hammer.EVENT_MOVE: - if(ev.distance > inst.options.hold_threshold) { - clearTimeout(this.timer); - } - break; + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; - case Hammer.EVENT_END: - clearTimeout(this.timer); - break; - } + var node = this.nodes[id]; + if (!node) { + throw new RangeError('Node with id "' + id + '" not found'); + } + this._selectObject(node,true,true,highlightEdges); } -}; - + this.redraw(); + }; -/** - * Tap/DoubleTap - * Quick touch at a place or double at the same place - * @events tap, doubletap - */ -Hammer.gestures.Tap = { - name: 'tap', - index: 100, - defaults: { - tap_max_touchtime : 250, - tap_max_distance : 10, - tap_always : true, - doubletap_distance : 20, - doubletap_interval : 300 - }, - handler: function tapGesture(ev, inst) { - if(ev.eventType == Hammer.EVENT_END) { - // previous gesture, for the double tap since these are two different gesture detections - var prev = Hammer.detection.previous, - did_doubletap = false; - - // when the touchtime is higher then the max touch time - // or when the moving distance is too much - if(ev.deltaTime > inst.options.tap_max_touchtime || - ev.distance > inst.options.tap_max_distance) { - return; - } - // check if double tap - if(prev && prev.name == 'tap' && - (ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval && - ev.distance < inst.options.doubletap_distance) { - inst.trigger('doubletap', ev); - did_doubletap = true; - } + /** + * select zero or more edges + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + */ + exports.selectEdges = function(selection) { + var i, iMax, id; - // do a single tap - if(!did_doubletap || inst.options.tap_always) { - Hammer.detection.current.name = 'tap'; - inst.trigger(Hammer.detection.current.name, ev); - } - } - } -}; + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; + // first unselect any selected node + this._unselectAll(true); -/** - * Swipe - * triggers swipe events when the end velocity is above the threshold - * @events swipe, swipeleft, swiperight, swipeup, swipedown - */ -Hammer.gestures.Swipe = { - name: 'swipe', - index: 40, - defaults: { - // set 0 for unlimited, but this can conflict with transform - swipe_max_touches : 1, - swipe_velocity : 0.7 - }, - handler: function swipeGesture(ev, inst) { - if(ev.eventType == Hammer.EVENT_END) { - // max touches - if(inst.options.swipe_max_touches > 0 && - ev.touches.length > inst.options.swipe_max_touches) { - return; - } + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; - // when the distance we moved is too small we skip this gesture - // or we can be already in dragging - if(ev.velocityX > inst.options.swipe_velocity || - ev.velocityY > inst.options.swipe_velocity) { - // trigger swipe events - inst.trigger(this.name, ev); - inst.trigger(this.name + ev.direction, ev); - } - } + var edge = this.edges[id]; + if (!edge) { + throw new RangeError('Edge with id "' + id + '" not found'); + } + this._selectObject(edge,true,true,highlightEdges); } -}; - + this.redraw(); + }; -/** - * Drag - * Move with x fingers (default 1) around on the page. Blocking the scrolling when - * moving left and right is a good practice. When all the drag events are blocking - * you disable scrolling on that area. - * @events drag, drapleft, dragright, dragup, dragdown - */ -Hammer.gestures.Drag = { - name: 'drag', - index: 50, - defaults: { - drag_min_distance : 10, - // set 0 for unlimited, but this can conflict with transform - drag_max_touches : 1, - // prevent default browser behavior when dragging occurs - // be careful with it, it makes the element a blocking element - // when you are using the drag gesture, it is a good practice to set this true - drag_block_horizontal : false, - drag_block_vertical : false, - // drag_lock_to_axis keeps the drag gesture on the axis that it started on, - // It disallows vertical directions if the initial direction was horizontal, and vice versa. - drag_lock_to_axis : false, - // drag lock only kicks in when distance > drag_lock_min_distance - // This way, locking occurs only when the distance has become large enough to reliably determine the direction - drag_lock_min_distance : 25 - }, - triggered: false, - handler: function dragGesture(ev, inst) { - // current gesture isnt drag, but dragged is true - // this means an other gesture is busy. now call dragend - if(Hammer.detection.current.name != this.name && this.triggered) { - inst.trigger(this.name +'end', ev); - this.triggered = false; - return; + /** + * Validate the selection: remove ids of nodes which no longer exist + * @private + */ + exports._updateSelection = function () { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (!this.nodes.hasOwnProperty(nodeId)) { + delete this.selectionObj.nodes[nodeId]; } - - // max touches - if(inst.options.drag_max_touches > 0 && - ev.touches.length > inst.options.drag_max_touches) { - return; + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + if (!this.edges.hasOwnProperty(edgeId)) { + delete this.selectionObj.edges[edgeId]; } + } + } + }; - switch(ev.eventType) { - case Hammer.EVENT_START: - this.triggered = false; - break; - - case Hammer.EVENT_MOVE: - // when the distance we moved is too small we skip this gesture - // or we can be already in dragging - if(ev.distance < inst.options.drag_min_distance && - Hammer.detection.current.name != this.name) { - return; - } - - // we are dragging! - Hammer.detection.current.name = this.name; - - // lock drag to axis? - if(Hammer.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance<=ev.distance)) { - ev.drag_locked_to_axis = true; - } - var last_direction = Hammer.detection.current.lastEvent.direction; - if(ev.drag_locked_to_axis && last_direction !== ev.direction) { - // keep direction on the axis that the drag gesture started on - if(Hammer.utils.isVertical(last_direction)) { - ev.direction = (ev.deltaY < 0) ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN; - } - else { - ev.direction = (ev.deltaX < 0) ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT; - } - } - - // first time, trigger dragstart event - if(!this.triggered) { - inst.trigger(this.name +'start', ev); - this.triggered = true; - } - - // trigger normal event - inst.trigger(this.name, ev); - - // direction event, like dragdown - inst.trigger(this.name + ev.direction, ev); - // block the browser events - if( (inst.options.drag_block_vertical && Hammer.utils.isVertical(ev.direction)) || - (inst.options.drag_block_horizontal && !Hammer.utils.isVertical(ev.direction))) { - ev.preventDefault(); - } - break; +/***/ }, +/* 52 */ +/***/ function(module, exports, __webpack_require__) { - case Hammer.EVENT_END: - // trigger dragend - if(this.triggered) { - inst.trigger(this.name +'end', ev); - } + var util = __webpack_require__(1); + var Node = __webpack_require__(36); + var Edge = __webpack_require__(33); - this.triggered = false; - break; - } + /** + * clears the toolbar div element of children + * + * @private + */ + exports._clearManipulatorBar = function() { + while (this.manipulationDiv.hasChildNodes()) { + this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); } -}; + }; + /** + * Manipulation UI temporarily overloads certain functions to extend or replace them. To be able to restore + * these functions to their original functionality, we saved them in this.cachedFunctions. + * This function restores these functions to their original function. + * + * @private + */ + exports._restoreOverloadedFunctions = function() { + for (var functionName in this.cachedFunctions) { + if (this.cachedFunctions.hasOwnProperty(functionName)) { + this[functionName] = this.cachedFunctions[functionName]; + } + } + }; -/** - * Transform - * User want to scale or rotate with 2 fingers - * @events transform, pinch, pinchin, pinchout, rotate - */ -Hammer.gestures.Transform = { - name: 'transform', - index: 45, - defaults: { - // factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1 - transform_min_scale : 0.01, - // rotation in degrees - transform_min_rotation : 1, - // prevent default browser behavior when two touches are on the screen - // but it makes the element a blocking element - // when you are using the transform gesture, it is a good practice to set this true - transform_always_block : false - }, - triggered: false, - handler: function transformGesture(ev, inst) { - // current gesture isnt drag, but dragged is true - // this means an other gesture is busy. now call dragend - if(Hammer.detection.current.name != this.name && this.triggered) { - inst.trigger(this.name +'end', ev); - this.triggered = false; - return; - } + /** + * Enable or disable edit-mode. + * + * @private + */ + exports._toggleEditMode = function() { + this.editMode = !this.editMode; + var toolbar = document.getElementById("network-manipulationDiv"); + var closeDiv = document.getElementById("network-manipulation-closeDiv"); + var editModeDiv = document.getElementById("network-manipulation-editMode"); + if (this.editMode == true) { + toolbar.style.display="block"; + closeDiv.style.display="block"; + editModeDiv.style.display="none"; + closeDiv.onclick = this._toggleEditMode.bind(this); + } + else { + toolbar.style.display="none"; + closeDiv.style.display="none"; + editModeDiv.style.display="block"; + closeDiv.onclick = null; + } + this._createManipulatorBar() + }; - // atleast multitouch - if(ev.touches.length < 2) { - return; - } + /** + * main function, creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. + * + * @private + */ + exports._createManipulatorBar = function() { + // remove bound functions + if (this.boundFunction) { + this.off('select', this.boundFunction); + } - // prevent default when two fingers are on the screen - if(inst.options.transform_always_block) { - ev.preventDefault(); - } + if (this.edgeBeingEdited !== undefined) { + this.edgeBeingEdited._disableControlNodes(); + this.edgeBeingEdited = undefined; + this.selectedControlNode = null; + this.controlNodesActive = false; + } - switch(ev.eventType) { - case Hammer.EVENT_START: - this.triggered = false; - break; + // restore overloaded functions + this._restoreOverloadedFunctions(); - case Hammer.EVENT_MOVE: - var scale_threshold = Math.abs(1-ev.scale); - var rotation_threshold = Math.abs(ev.rotation); + // resume calculation + this.freezeSimulation = false; - // when the distance we moved is too small we skip this gesture - // or we can be already in dragging - if(scale_threshold < inst.options.transform_min_scale && - rotation_threshold < inst.options.transform_min_rotation) { - return; - } + // reset global variables + this.blockConnectingEdgeSelection = false; + this.forceAppendSelection = false; - // we are transforming! - Hammer.detection.current.name = this.name; + if (this.editMode == true) { + while (this.manipulationDiv.hasChildNodes()) { + this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); + } + // add the icons to the manipulator div + this.manipulationDiv.innerHTML = "" + + "" + + ""+this.constants.labels['add'] +"" + + "
" + + "" + + ""+this.constants.labels['link'] +""; + if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { + this.manipulationDiv.innerHTML += "" + + "
" + + "" + + ""+this.constants.labels['editNode'] +""; + } + else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { + this.manipulationDiv.innerHTML += "" + + "
" + + "" + + ""+this.constants.labels['editEdge'] +""; + } + if (this._selectionIsEmpty() == false) { + this.manipulationDiv.innerHTML += "" + + "
" + + "" + + ""+this.constants.labels['del'] +""; + } - // first time, trigger dragstart event - if(!this.triggered) { - inst.trigger(this.name +'start', ev); - this.triggered = true; - } - inst.trigger(this.name, ev); // basic transform event + // bind the icons + var addNodeButton = document.getElementById("network-manipulate-addNode"); + addNodeButton.onclick = this._createAddNodeToolbar.bind(this); + var addEdgeButton = document.getElementById("network-manipulate-connectNode"); + addEdgeButton.onclick = this._createAddEdgeToolbar.bind(this); + if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { + var editButton = document.getElementById("network-manipulate-editNode"); + editButton.onclick = this._editNode.bind(this); + } + else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { + var editButton = document.getElementById("network-manipulate-editEdge"); + editButton.onclick = this._createEditEdgeToolbar.bind(this); + } + if (this._selectionIsEmpty() == false) { + var deleteButton = document.getElementById("network-manipulate-delete"); + deleteButton.onclick = this._deleteSelected.bind(this); + } + var closeDiv = document.getElementById("network-manipulation-closeDiv"); + closeDiv.onclick = this._toggleEditMode.bind(this); - // trigger rotate event - if(rotation_threshold > inst.options.transform_min_rotation) { - inst.trigger('rotate', ev); - } + this.boundFunction = this._createManipulatorBar.bind(this); + this.on('select', this.boundFunction); + } + else { + this.editModeDiv.innerHTML = "" + + "" + + "" + this.constants.labels['edit'] + ""; + var editModeButton = document.getElementById("network-manipulate-editModeButton"); + editModeButton.onclick = this._toggleEditMode.bind(this); + } + }; - // trigger pinch event - if(scale_threshold > inst.options.transform_min_scale) { - inst.trigger('pinch', ev); - inst.trigger('pinch'+ ((ev.scale < 1) ? 'in' : 'out'), ev); - } - break; - case Hammer.EVENT_END: - // trigger dragend - if(this.triggered) { - inst.trigger(this.name +'end', ev); - } - this.triggered = false; - break; - } + /** + * Create the toolbar for adding Nodes + * + * @private + */ + exports._createAddNodeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + if (this.boundFunction) { + this.off('select', this.boundFunction); } -}; + // create the toolbar contents + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
" + + "" + + "" + this.constants.labels['addDescription'] + ""; -/** - * Touch - * Called as first, tells the user has touched the screen - * @events touch - */ -Hammer.gestures.Touch = { - name: 'touch', - index: -Infinity, - defaults: { - // call preventDefault at touchstart, and makes the element blocking by - // disabling the scrolling of the page, but it improves gestures like - // transforming and dragging. - // be careful with using this, it can be very annoying for users to be stuck - // on the page - prevent_default: false, - - // disable mouse events, so only touch (or pen!) input triggers events - prevent_mouseevents: false - }, - handler: function touchGesture(ev, inst) { - if(inst.options.prevent_mouseevents && ev.pointerType == Hammer.POINTER_MOUSE) { - ev.stopDetect(); - return; - } + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); - if(inst.options.prevent_default) { - ev.preventDefault(); - } + // we use the boundFunction so we can reference it when we unbind it from the "select" event. + this.boundFunction = this._addNode.bind(this); + this.on('select', this.boundFunction); + }; - if(ev.eventType == Hammer.EVENT_START) { - inst.trigger(this.name, ev); - } - } -}; + /** + * create the toolbar to connect nodes + * + * @private + */ + exports._createAddEdgeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + this._unselectAll(true); + this.freezeSimulation = true; -/** - * Release - * Called as last, tells the user has released the screen - * @events release - */ -Hammer.gestures.Release = { - name: 'release', - index: Infinity, - handler: function releaseGesture(ev, inst) { - if(ev.eventType == Hammer.EVENT_END) { - inst.trigger(this.name, ev); - } - } -}; - -// node export -if(typeof module === 'object' && typeof module.exports === 'object'){ - module.exports = Hammer; -} -// just window export -else { - window.Hammer = Hammer; - - // requireJS module definition - if(typeof window.define === 'function' && window.define.amd) { - window.define('hammer', [], function() { - return Hammer; - }); + if (this.boundFunction) { + this.off('select', this.boundFunction); } -} -})(this); -},{}],4:[function(require,module,exports){ -var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};//! moment.js -//! version : 2.7.0 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com - -(function (undefined) { - - /************************************ - Constants - ************************************/ - - var moment, - VERSION = "2.7.0", - // the global-scope this is NOT the global object in Node.js - globalScope = typeof global !== 'undefined' ? global : this, - oldGlobalMoment, - round = Math.round, - i, - - YEAR = 0, - MONTH = 1, - DATE = 2, - HOUR = 3, - MINUTE = 4, - SECOND = 5, - MILLISECOND = 6, - - // internal storage for language config files - languages = {}, - - // moment internal properties - momentProperties = { - _isAMomentObject: null, - _i : null, - _f : null, - _l : null, - _strict : null, - _tzm : null, - _isUTC : null, - _offset : null, // optional. Combine with _isUTC - _pf : null, - _lang : null // optional - }, - - // check for nodeJS - hasModule = (typeof module !== 'undefined' && module.exports), - - // ASP.NET json date format regex - aspNetJsonRegex = /^\/?Date\((\-?\d+)/i, - aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/, - - // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, - - // format tokens - formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g, - localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g, - - // parsing token regexes - parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99 - parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999 - parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999 - parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999 - parseTokenDigits = /\d+/, // nonzero number of digits - parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic. - parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z - parseTokenT = /T/i, // T (ISO separator) - parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 - parseTokenOrdinal = /\d{1,2}/, - - //strict parsing regexes - parseTokenOneDigit = /\d/, // 0 - 9 - parseTokenTwoDigits = /\d\d/, // 00 - 99 - parseTokenThreeDigits = /\d{3}/, // 000 - 999 - parseTokenFourDigits = /\d{4}/, // 0000 - 9999 - parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999 - parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf - - // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, - - isoFormat = 'YYYY-MM-DDTHH:mm:ssZ', - - isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/], - ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/], - ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/], - ['GGGG-[W]WW', /\d{4}-W\d{2}/], - ['YYYY-DDD', /\d{4}-\d{3}/] - ], - - // iso time formats and regexes - isoTimes = [ - ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/], - ['HH:mm', /(T| )\d\d:\d\d/], - ['HH', /(T| )\d\d/] - ], - - // timezone chunker "+10:00" > ["10", "00"] or "-1530" > ["-15", "30"] - parseTimezoneChunker = /([\+\-]|\d\d)/gi, - - // getter and setter names - proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'), - unitMillisecondFactors = { - 'Milliseconds' : 1, - 'Seconds' : 1e3, - 'Minutes' : 6e4, - 'Hours' : 36e5, - 'Days' : 864e5, - 'Months' : 2592e6, - 'Years' : 31536e6 - }, - unitAliases = { - ms : 'millisecond', - s : 'second', - m : 'minute', - h : 'hour', - d : 'day', - D : 'date', - w : 'week', - W : 'isoWeek', - M : 'month', - Q : 'quarter', - y : 'year', - DDD : 'dayOfYear', - e : 'weekday', - E : 'isoWeekday', - gg: 'weekYear', - GG: 'isoWeekYear' - }, + this._unselectAll(); + this.forceAppendSelection = false; + this.blockConnectingEdgeSelection = true; - camelFunctions = { - dayofyear : 'dayOfYear', - isoweekday : 'isoWeekday', - isoweek : 'isoWeek', - weekyear : 'weekYear', - isoweekyear : 'isoWeekYear' - }, + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
" + + "" + + "" + this.constants.labels['linkDescription'] + ""; - // format function strings - formatFunctions = {}, - - // default relative time thresholds - relativeTimeThresholds = { - s: 45, //seconds to minutes - m: 45, //minutes to hours - h: 22, //hours to days - dd: 25, //days to month (month == 1) - dm: 45, //days to months (months > 1) - dy: 345 //days to year - }, + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); - // tokens to ordinalize and pad - ordinalizeTokens = 'DDD w W M D d'.split(' '), - paddedTokens = 'M D H h m s w W'.split(' '), + // we use the boundFunction so we can reference it when we unbind it from the "select" event. + this.boundFunction = this._handleConnect.bind(this); + this.on('select', this.boundFunction); - formatTokenFunctions = { - M : function () { - return this.month() + 1; - }, - MMM : function (format) { - return this.lang().monthsShort(this, format); - }, - MMMM : function (format) { - return this.lang().months(this, format); - }, - D : function () { - return this.date(); - }, - DDD : function () { - return this.dayOfYear(); - }, - d : function () { - return this.day(); - }, - dd : function (format) { - return this.lang().weekdaysMin(this, format); - }, - ddd : function (format) { - return this.lang().weekdaysShort(this, format); - }, - dddd : function (format) { - return this.lang().weekdays(this, format); - }, - w : function () { - return this.week(); - }, - W : function () { - return this.isoWeek(); - }, - YY : function () { - return leftZeroFill(this.year() % 100, 2); - }, - YYYY : function () { - return leftZeroFill(this.year(), 4); - }, - YYYYY : function () { - return leftZeroFill(this.year(), 5); - }, - YYYYYY : function () { - var y = this.year(), sign = y >= 0 ? '+' : '-'; - return sign + leftZeroFill(Math.abs(y), 6); - }, - gg : function () { - return leftZeroFill(this.weekYear() % 100, 2); - }, - gggg : function () { - return leftZeroFill(this.weekYear(), 4); - }, - ggggg : function () { - return leftZeroFill(this.weekYear(), 5); - }, - GG : function () { - return leftZeroFill(this.isoWeekYear() % 100, 2); - }, - GGGG : function () { - return leftZeroFill(this.isoWeekYear(), 4); - }, - GGGGG : function () { - return leftZeroFill(this.isoWeekYear(), 5); - }, - e : function () { - return this.weekday(); - }, - E : function () { - return this.isoWeekday(); - }, - a : function () { - return this.lang().meridiem(this.hours(), this.minutes(), true); - }, - A : function () { - return this.lang().meridiem(this.hours(), this.minutes(), false); - }, - H : function () { - return this.hours(); - }, - h : function () { - return this.hours() % 12 || 12; - }, - m : function () { - return this.minutes(); - }, - s : function () { - return this.seconds(); - }, - S : function () { - return toInt(this.milliseconds() / 100); - }, - SS : function () { - return leftZeroFill(toInt(this.milliseconds() / 10), 2); - }, - SSS : function () { - return leftZeroFill(this.milliseconds(), 3); - }, - SSSS : function () { - return leftZeroFill(this.milliseconds(), 3); - }, - Z : function () { - var a = -this.zone(), - b = "+"; - if (a < 0) { - a = -a; - b = "-"; - } - return b + leftZeroFill(toInt(a / 60), 2) + ":" + leftZeroFill(toInt(a) % 60, 2); - }, - ZZ : function () { - var a = -this.zone(), - b = "+"; - if (a < 0) { - a = -a; - b = "-"; - } - return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2); - }, - z : function () { - return this.zoneAbbr(); - }, - zz : function () { - return this.zoneName(); - }, - X : function () { - return this.unix(); - }, - Q : function () { - return this.quarter(); - } - }, + // temporarily overload functions + this.cachedFunctions["_handleTouch"] = this._handleTouch; + this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; + this._handleTouch = this._handleConnect; + this._handleOnRelease = this._finishConnect; - lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin']; - - // Pick the first defined of two or three arguments. dfl comes from - // default. - function dfl(a, b, c) { - switch (arguments.length) { - case 2: return a != null ? a : b; - case 3: return a != null ? a : b != null ? b : c; - default: throw new Error("Implement me"); - } - } - - function defaultParsingFlags() { - // We need to deep clone this object, and es5 standard is not very - // helpful. - return { - empty : false, - unusedTokens : [], - unusedInput : [], - overflow : -2, - charsLeftOver : 0, - nullInput : false, - invalidMonth : null, - invalidFormat : false, - userInvalidated : false, - iso: false - }; - } + // redraw to show the unselect + this._redraw(); + }; - function deprecate(msg, fn) { - var firstTime = true; - function printMsg() { - if (moment.suppressDeprecationWarnings === false && - typeof console !== 'undefined' && console.warn) { - console.warn("Deprecation warning: " + msg); - } - } - return extend(function () { - if (firstTime) { - printMsg(); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } + /** + * create the toolbar to edit edges + * + * @private + */ + exports._createEditEdgeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + this.controlNodesActive = true; - function padToken(func, count) { - return function (a) { - return leftZeroFill(func.call(this, a), count); - }; - } - function ordinalizeToken(func, period) { - return function (a) { - return this.lang().ordinal(func.call(this, a), period); - }; + if (this.boundFunction) { + this.off('select', this.boundFunction); } - while (ordinalizeTokens.length) { - i = ordinalizeTokens.pop(); - formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i); - } - while (paddedTokens.length) { - i = paddedTokens.pop(); - formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2); - } - formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3); + this.edgeBeingEdited = this._getSelectedEdge(); + this.edgeBeingEdited._enableControlNodes(); + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
" + + "" + + "" + this.constants.labels['editEdgeDescription'] + ""; - /************************************ - Constructors - ************************************/ + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); - function Language() { + // temporarily overload functions + this.cachedFunctions["_handleTouch"] = this._handleTouch; + this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; + this.cachedFunctions["_handleTap"] = this._handleTap; + this.cachedFunctions["_handleDragStart"] = this._handleDragStart; + this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + this._handleTouch = this._selectControlNode; + this._handleTap = function () {}; + this._handleOnDrag = this._controlNodeDrag; + this._handleDragStart = function () {} + this._handleOnRelease = this._releaseControlNode; - } + // redraw to show the unselect + this._redraw(); + }; - // Moment prototype object - function Moment(config) { - checkOverflow(config); - extend(this, config); - } - // Duration Constructor - function Duration(duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 36e5; // 1000 * 60 * 60 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + - quarters * 3 + - years * 12; - this._data = {}; - this._bubble(); + /** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ + exports._selectControlNode = function(pointer) { + this.edgeBeingEdited.controlNodes.from.unselect(); + this.edgeBeingEdited.controlNodes.to.unselect(); + this.selectedControlNode = this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(pointer.x),this._YconvertDOMtoCanvas(pointer.y)); + if (this.selectedControlNode !== null) { + this.selectedControlNode.select(); + this.freezeSimulation = true; } + this._redraw(); + }; - /************************************ - Helpers - ************************************/ - - - function extend(a, b) { - for (var i in b) { - if (b.hasOwnProperty(i)) { - a[i] = b[i]; - } - } - - if (b.hasOwnProperty("toString")) { - a.toString = b.toString; - } - - if (b.hasOwnProperty("valueOf")) { - a.valueOf = b.valueOf; - } + /** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ + exports._controlNodeDrag = function(event) { + var pointer = this._getPointer(event.gesture.center); + if (this.selectedControlNode !== null && this.selectedControlNode !== undefined) { + this.selectedControlNode.x = this._XconvertDOMtoCanvas(pointer.x); + this.selectedControlNode.y = this._YconvertDOMtoCanvas(pointer.y); + } + this._redraw(); + }; - return a; + exports._releaseControlNode = function(pointer) { + var newNode = this._getNodeAt(pointer); + if (newNode != null) { + if (this.edgeBeingEdited.controlNodes.from.selected == true) { + this._editEdge(newNode.id, this.edgeBeingEdited.to.id); + this.edgeBeingEdited.controlNodes.from.unselect(); + } + if (this.edgeBeingEdited.controlNodes.to.selected == true) { + this._editEdge(this.edgeBeingEdited.from.id, newNode.id); + this.edgeBeingEdited.controlNodes.to.unselect(); + } + } + else { + this.edgeBeingEdited._restoreControlNodes(); } + this.freezeSimulation = false; + this._redraw(); + }; - function cloneMoment(m) { - var result = {}, i; - for (i in m) { - if (m.hasOwnProperty(i) && momentProperties.hasOwnProperty(i)) { - result[i] = m[i]; - } + /** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ + exports._handleConnect = function(pointer) { + if (this._getSelectedNodeCount() == 0) { + var node = this._getNodeAt(pointer); + if (node != null) { + if (node.clusterSize > 1) { + alert("Cannot create edges to a cluster.") } + else { + this._selectObject(node,false); + // create a node the temporary line can look at + this.sectors['support']['nodes']['targetNode'] = new Node({id:'targetNode'},{},{},this.constants); + this.sectors['support']['nodes']['targetNode'].x = node.x; + this.sectors['support']['nodes']['targetNode'].y = node.y; + this.sectors['support']['nodes']['targetViaNode'] = new Node({id:'targetViaNode'},{},{},this.constants); + this.sectors['support']['nodes']['targetViaNode'].x = node.x; + this.sectors['support']['nodes']['targetViaNode'].y = node.y; + this.sectors['support']['nodes']['targetViaNode'].parentEdgeId = "connectionEdge"; - return result; - } - - function absRound(number) { - if (number < 0) { - return Math.ceil(number); - } else { - return Math.floor(number); - } - } + // create a temporary edge + this.edges['connectionEdge'] = new Edge({id:"connectionEdge",from:node.id,to:this.sectors['support']['nodes']['targetNode'].id}, this, this.constants); + this.edges['connectionEdge'].from = node; + this.edges['connectionEdge'].connected = true; + this.edges['connectionEdge'].smooth = true; + this.edges['connectionEdge'].selected = true; + this.edges['connectionEdge'].to = this.sectors['support']['nodes']['targetNode']; + this.edges['connectionEdge'].via = this.sectors['support']['nodes']['targetViaNode']; - // left zero fill a number - // see http://jsperf.com/left-zero-filling for performance comparison - function leftZeroFill(number, targetLength, forceSign) { - var output = '' + Math.abs(number), - sign = number >= 0; + this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + this._handleOnDrag = function(event) { + var pointer = this._getPointer(event.gesture.center); + this.sectors['support']['nodes']['targetNode'].x = this._XconvertDOMtoCanvas(pointer.x); + this.sectors['support']['nodes']['targetNode'].y = this._YconvertDOMtoCanvas(pointer.y); + this.sectors['support']['nodes']['targetViaNode'].x = 0.5 * (this._XconvertDOMtoCanvas(pointer.x) + this.edges['connectionEdge'].from.x); + this.sectors['support']['nodes']['targetViaNode'].y = this._YconvertDOMtoCanvas(pointer.y); + }; - while (output.length < targetLength) { - output = '0' + output; + this.moving = true; + this.start(); } - return (sign ? (forceSign ? '+' : '') : '-') + output; + } } + }; - // helper function for _.addTime and _.subtractTime - function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = duration._days, - months = duration._months; - updateOffset = updateOffset == null ? true : updateOffset; - - if (milliseconds) { - mom._d.setTime(+mom._d + milliseconds * isAdding); - } - if (days) { - rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding); - } - if (months) { - rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding); - } - if (updateOffset) { - moment.updateOffset(mom, days || months); - } - } + exports._finishConnect = function(pointer) { + if (this._getSelectedNodeCount() == 1) { - // check if is an array - function isArray(input) { - return Object.prototype.toString.call(input) === '[object Array]'; - } + // restore the drag function + this._handleOnDrag = this.cachedFunctions["_handleOnDrag"]; + delete this.cachedFunctions["_handleOnDrag"]; - function isDate(input) { - return Object.prototype.toString.call(input) === '[object Date]' || - input instanceof Date; - } + // remember the edge id + var connectFromId = this.edges['connectionEdge'].fromId; - // compare two arrays, return the number of differences - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ((dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { - diffs++; - } - } - return diffs + lengthDiff; - } + // remove the temporary nodes and edge + delete this.edges['connectionEdge']; + delete this.sectors['support']['nodes']['targetNode']; + delete this.sectors['support']['nodes']['targetViaNode']; - function normalizeUnits(units) { - if (units) { - var lowered = units.toLowerCase().replace(/(.)s$/, '$1'); - units = unitAliases[units] || camelFunctions[lowered] || lowered; + var node = this._getNodeAt(pointer); + if (node != null) { + if (node.clusterSize > 1) { + alert("Cannot create edges to a cluster.") } - return units; - } - - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (inputObject.hasOwnProperty(prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } + else { + this._createEdge(connectFromId,node.id); + this._createManipulatorBar(); } - - return normalizedInput; + } + this._unselectAll(); } + }; - function makeList(field) { - var count, setter; - if (field.indexOf('week') === 0) { - count = 7; - setter = 'day'; - } - else if (field.indexOf('month') === 0) { - count = 12; - setter = 'month'; + /** + * Adds a node on the specified location + */ + exports._addNode = function() { + if (this._selectionIsEmpty() && this.editMode == true) { + var positionObject = this._pointerToPositionObject(this.pointerPosition); + var defaultData = {id:util.randomUUID(),x:positionObject.left,y:positionObject.top,label:"new",allowedToMoveX:true,allowedToMoveY:true}; + if (this.triggerFunctions.add) { + if (this.triggerFunctions.add.length == 2) { + var me = this; + this.triggerFunctions.add(defaultData, function(finalizedData) { + me.nodesData.add(finalizedData); + me._createManipulatorBar(); + me.moving = true; + me.start(); + }); } else { - return; + alert(this.constants.labels['addError']); + this._createManipulatorBar(); + this.moving = true; + this.start(); } - - moment[field] = function (format, index) { - var i, getter, - method = moment.fn._lang[field], - results = []; - - if (typeof format === 'number') { - index = format; - format = undefined; - } - - getter = function (i) { - var m = moment().utc().set(setter, i); - return method.call(moment.fn._lang, m, format || ''); - }; - - if (index != null) { - return getter(index); - } - else { - for (i = 0; i < count; i++) { - results.push(getter(i)); - } - return results; - } - }; + } + else { + this.nodesData.add(defaultData); + this._createManipulatorBar(); + this.moving = true; + this.start(); + } } + }; - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - if (coercedNumber >= 0) { - value = Math.floor(coercedNumber); - } else { - value = Math.ceil(coercedNumber); - } + /** + * connect two nodes with a new edge. + * + * @private + */ + exports._createEdge = function(sourceNodeId,targetNodeId) { + if (this.editMode == true) { + var defaultData = {from:sourceNodeId, to:targetNodeId}; + if (this.triggerFunctions.connect) { + if (this.triggerFunctions.connect.length == 2) { + var me = this; + this.triggerFunctions.connect(defaultData, function(finalizedData) { + me.edgesData.add(finalizedData); + me.moving = true; + me.start(); + }); } - - return value; - } - - function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); - } - - function weeksInYear(year, dow, doy) { - return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week; - } - - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } - - function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } - - function checkOverflow(m) { - var overflow; - if (m._a && m._pf.overflow === -2) { - overflow = - m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH : - m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE : - m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR : - m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE : - m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND : - m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND : - -1; - - if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } - - m._pf.overflow = overflow; + else { + alert(this.constants.labels["linkError"]); + this.moving = true; + this.start(); } + } + else { + this.edgesData.add(defaultData); + this.moving = true; + this.start(); + } } + }; - function isValid(m) { - if (m._isValid == null) { - m._isValid = !isNaN(m._d.getTime()) && - m._pf.overflow < 0 && - !m._pf.empty && - !m._pf.invalidMonth && - !m._pf.nullInput && - !m._pf.invalidFormat && - !m._pf.userInvalidated; - - if (m._strict) { - m._isValid = m._isValid && - m._pf.charsLeftOver === 0 && - m._pf.unusedTokens.length === 0; - } + /** + * connect two nodes with a new edge. + * + * @private + */ + exports._editEdge = function(sourceNodeId,targetNodeId) { + if (this.editMode == true) { + var defaultData = {id: this.edgeBeingEdited.id, from:sourceNodeId, to:targetNodeId}; + if (this.triggerFunctions.editEdge) { + if (this.triggerFunctions.editEdge.length == 2) { + var me = this; + this.triggerFunctions.editEdge(defaultData, function(finalizedData) { + me.edgesData.update(finalizedData); + me.moving = true; + me.start(); + }); } - return m._isValid; - } - - function normalizeLanguage(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } - - // Return a moment from input, that is local/utc/zone equivalent to model. - function makeAs(input, model) { - return model._isUTC ? moment(input).zone(model._offset || 0) : - moment(input).local(); + else { + alert(this.constants.labels["linkError"]); + this.moving = true; + this.start(); + } + } + else { + this.edgesData.update(defaultData); + this.moving = true; + this.start(); + } } + }; - /************************************ - Languages - ************************************/ - - - extend(Language.prototype, { - - set : function (config) { - var prop, i; - for (i in config) { - prop = config[i]; - if (typeof prop === 'function') { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - }, - - _months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), - months : function (m) { - return this._months[m.month()]; - }, - - _monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), - monthsShort : function (m) { - return this._monthsShort[m.month()]; - }, - - monthsParse : function (monthName) { - var i, mom, regex; - - if (!this._monthsParse) { - this._monthsParse = []; - } - - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - if (!this._monthsParse[i]) { - mom = moment.utc([2000, i]); - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (this._monthsParse[i].test(monthName)) { - return i; - } - } - }, - - _weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), - weekdays : function (m) { - return this._weekdays[m.day()]; - }, - - _weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), - weekdaysShort : function (m) { - return this._weekdaysShort[m.day()]; - }, - - _weekdaysMin : "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), - weekdaysMin : function (m) { - return this._weekdaysMin[m.day()]; - }, - - weekdaysParse : function (weekdayName) { - var i, mom, regex; - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - } - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - if (!this._weekdaysParse[i]) { - mom = moment([2000, 1]).day(i); - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } - }, - - _longDateFormat : { - LT : "h:mm A", - L : "MM/DD/YYYY", - LL : "MMMM D YYYY", - LLL : "MMMM D YYYY LT", - LLLL : "dddd, MMMM D YYYY LT" - }, - longDateFormat : function (key) { - var output = this._longDateFormat[key]; - if (!output && this._longDateFormat[key.toUpperCase()]) { - output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - this._longDateFormat[key] = output; - } - return output; - }, - - isPM : function (input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return ((input + '').toLowerCase().charAt(0) === 'p'); - }, - - _meridiemParse : /[ap]\.?m?\.?/i, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } - }, - - _calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendar[key]; - return typeof output === 'function' ? output.apply(mom) : output; - }, - - _relativeTime : { - future : "in %s", - past : "%s ago", - s : "a few seconds", - m : "a minute", - mm : "%d minutes", - h : "an hour", - hh : "%d hours", - d : "a day", - dd : "%d days", - M : "a month", - MM : "%d months", - y : "a year", - yy : "%d years" - }, - relativeTime : function (number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return (typeof output === 'function') ? - output(number, withoutSuffix, string, isFuture) : - output.replace(/%d/i, number); - }, - pastFuture : function (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return typeof format === 'function' ? format(output) : format.replace(/%s/i, output); - }, - - ordinal : function (number) { - return this._ordinal.replace("%d", number); - }, - _ordinal : "%d", - - preparse : function (string) { - return string; - }, + /** + * Create the toolbar to edit the selected node. The label and the color can be changed. Other colors are derived from the chosen color. + * + * @private + */ + exports._editNode = function() { + if (this.triggerFunctions.edit && this.editMode == true) { + var node = this._getSelectedNode(); + var data = {id:node.id, + label: node.label, + group: node.group, + shape: node.shape, + color: { + background:node.color.background, + border:node.color.border, + highlight: { + background:node.color.highlight.background, + border:node.color.highlight.border + } + }}; + if (this.triggerFunctions.edit.length == 2) { + var me = this; + this.triggerFunctions.edit(data, function (finalizedData) { + me.nodesData.update(finalizedData); + me._createManipulatorBar(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["editError"]); + } + } + else { + alert(this.constants.labels["editBoundError"]); + } + }; - postformat : function (string) { - return string; - }, - week : function (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - }, - _week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - }, - _invalidDate: 'Invalid date', - invalidDate: function () { - return this._invalidDate; + /** + * delete everything in the selection + * + * @private + */ + exports._deleteSelected = function() { + if (!this._selectionIsEmpty() && this.editMode == true) { + if (!this._clusterInSelection()) { + var selectedNodes = this.getSelectedNodes(); + var selectedEdges = this.getSelectedEdges(); + if (this.triggerFunctions.del) { + var me = this; + var data = {nodes: selectedNodes, edges: selectedEdges}; + if (this.triggerFunctions.del.length = 2) { + this.triggerFunctions.del(data, function (finalizedData) { + me.edgesData.remove(finalizedData.edges); + me.nodesData.remove(finalizedData.nodes); + me._unselectAll(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["deleteError"]) + } } - }); + else { + this.edgesData.remove(selectedEdges); + this.nodesData.remove(selectedNodes); + this._unselectAll(); + this.moving = true; + this.start(); + } + } + else { + alert(this.constants.labels["deleteClusterError"]); + } + } + }; - // Loads a language definition into the `languages` cache. The function - // takes a key and optionally values. If not in the browser and no values - // are provided, it will load the language file module. As a convenience, - // this function also returns the language values. - function loadLang(key, values) { - values.abbr = key; - if (!languages[key]) { - languages[key] = new Language(); - } - languages[key].set(values); - return languages[key]; - } - - // Remove a language from the `languages` cache. Mostly useful in tests. - function unloadLang(key) { - delete languages[key]; - } - - // Determines which language definition to use and returns it. - // - // With no parameters, it will return the global language. If you - // pass in a language key, such as 'en', it will return the - // definition for 'en', so long as 'en' has already been loaded using - // moment.lang. - function getLangDefinition(key) { - var i = 0, j, lang, next, split, - get = function (k) { - if (!languages[k] && hasModule) { - try { - require('./lang/' + k); - } catch (e) { } - } - return languages[k]; - }; - if (!key) { - return moment.fn._lang; - } +/***/ }, +/* 53 */ +/***/ function(module, exports, __webpack_require__) { - if (!isArray(key)) { - //short-circuit everything else - lang = get(key); - if (lang) { - return lang; - } - key = [key]; - } - - //pick the language from the array - //try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - //substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - while (i < key.length) { - split = normalizeLanguage(key[i]).split('-'); - j = split.length; - next = normalizeLanguage(key[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - lang = get(split.slice(0, j).join('-')); - if (lang) { - return lang; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return moment.fn._lang; + var util = __webpack_require__(1); + + exports._cleanNavigation = function() { + // clean up previous navigation items + var wrapper = document.getElementById('network-navigation_wrapper'); + if (wrapper != null) { + this.containerElement.removeChild(wrapper); } + document.onmouseup = null; + }; + + /** + * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation + * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent + * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. + * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. + * + * @private + */ + exports._loadNavigationElements = function() { + this._cleanNavigation(); - /************************************ - Formatting - ************************************/ + this.navigationDivs = {}; + var navigationDivs = ['up','down','left','right','zoomIn','zoomOut','zoomExtends']; + var navigationDivActions = ['_moveUp','_moveDown','_moveLeft','_moveRight','_zoomIn','_zoomOut','zoomExtent']; + this.navigationDivs['wrapper'] = document.createElement('div'); + this.navigationDivs['wrapper'].id = "network-navigation_wrapper"; + this.navigationDivs['wrapper'].style.position = "absolute"; + this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; + this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; + this.containerElement.insertBefore(this.navigationDivs['wrapper'],this.frame); - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ""); - } - return input.replace(/\\/g, ""); + for (var i = 0; i < navigationDivs.length; i++) { + this.navigationDivs[navigationDivs[i]] = document.createElement('div'); + this.navigationDivs[navigationDivs[i]].id = "network-navigation_" + navigationDivs[i]; + this.navigationDivs[navigationDivs[i]].className = "network-navigation " + navigationDivs[i]; + this.navigationDivs['wrapper'].appendChild(this.navigationDivs[navigationDivs[i]]); + this.navigationDivs[navigationDivs[i]].onmousedown = this[navigationDivActions[i]].bind(this); } - function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; + document.onmouseup = this._stopMovement.bind(this); + }; - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } + /** + * this stops all movement induced by the navigation buttons + * + * @private + */ + exports._stopMovement = function() { + this._xStopMoving(); + this._yStopMoving(); + this._stopZoom(); + }; - return function (mom) { - var output = ""; - for (i = 0; i < length; i++) { - output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; - } - return output; - }; + + /** + * move the screen up + * By using the increments, instead of adding a fixed number to the translation, we keep fluent and + * instant movement. The onKeypress event triggers immediately, then pauses, then triggers frequently + * To avoid this behaviour, we do the translation in the start loop. + * + * @private + */ + exports._moveUp = function(event) { + this.yIncrement = this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['up'].className += " active"; } + }; - // format date using native date object - function formatMoment(m, format) { - - if (!m.isValid()) { - return m.lang().invalidDate(); - } - - format = expandFormat(format, m.lang()); - - if (!formatFunctions[format]) { - formatFunctions[format] = makeFormatFunction(format); - } - - return formatFunctions[format](m); - } - - function expandFormat(format, lang) { - var i = 5; - - function replaceLongDateFormatTokens(input) { - return lang.longDateFormat(input) || input; - } - - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } - - return format; - } - - - /************************************ - Parsing - ************************************/ - - - // get the regex to find the next token - function getParseRegexForToken(token, config) { - var a, strict = config._strict; - switch (token) { - case 'Q': - return parseTokenOneDigit; - case 'DDDD': - return parseTokenThreeDigits; - case 'YYYY': - case 'GGGG': - case 'gggg': - return strict ? parseTokenFourDigits : parseTokenOneToFourDigits; - case 'Y': - case 'G': - case 'g': - return parseTokenSignedNumber; - case 'YYYYYY': - case 'YYYYY': - case 'GGGGG': - case 'ggggg': - return strict ? parseTokenSixDigits : parseTokenOneToSixDigits; - case 'S': - if (strict) { return parseTokenOneDigit; } - /* falls through */ - case 'SS': - if (strict) { return parseTokenTwoDigits; } - /* falls through */ - case 'SSS': - if (strict) { return parseTokenThreeDigits; } - /* falls through */ - case 'DDD': - return parseTokenOneToThreeDigits; - case 'MMM': - case 'MMMM': - case 'dd': - case 'ddd': - case 'dddd': - return parseTokenWord; - case 'a': - case 'A': - return getLangDefinition(config._l)._meridiemParse; - case 'X': - return parseTokenTimestampMs; - case 'Z': - case 'ZZ': - return parseTokenTimezone; - case 'T': - return parseTokenT; - case 'SSSS': - return parseTokenDigits; - case 'MM': - case 'DD': - case 'YY': - case 'GG': - case 'gg': - case 'HH': - case 'hh': - case 'mm': - case 'ss': - case 'ww': - case 'WW': - return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits; - case 'M': - case 'D': - case 'd': - case 'H': - case 'h': - case 'm': - case 's': - case 'w': - case 'W': - case 'e': - case 'E': - return parseTokenOneOrTwoDigits; - case 'Do': - return parseTokenOrdinal; - default : - a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i")); - return a; - } - } - - function timezoneMinutesFromString(string) { - string = string || ""; - var possibleTzMatches = (string.match(parseTokenTimezone) || []), - tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [], - parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0], - minutes = +(parts[1] * 60) + toInt(parts[2]); - - return parts[0] === '+' ? -minutes : minutes; - } - - // function to convert string input to date - function addTimeToArrayFromToken(token, input, config) { - var a, datePartArray = config._a; - - switch (token) { - // QUARTER - case 'Q': - if (input != null) { - datePartArray[MONTH] = (toInt(input) - 1) * 3; - } - break; - // MONTH - case 'M' : // fall through to MM - case 'MM' : - if (input != null) { - datePartArray[MONTH] = toInt(input) - 1; - } - break; - case 'MMM' : // fall through to MMMM - case 'MMMM' : - a = getLangDefinition(config._l).monthsParse(input); - // if we didn't find a month name, mark the date as invalid. - if (a != null) { - datePartArray[MONTH] = a; - } else { - config._pf.invalidMonth = input; - } - break; - // DAY OF MONTH - case 'D' : // fall through to DD - case 'DD' : - if (input != null) { - datePartArray[DATE] = toInt(input); - } - break; - case 'Do' : - if (input != null) { - datePartArray[DATE] = toInt(parseInt(input, 10)); - } - break; - // DAY OF YEAR - case 'DDD' : // fall through to DDDD - case 'DDDD' : - if (input != null) { - config._dayOfYear = toInt(input); - } - break; - // YEAR - case 'YY' : - datePartArray[YEAR] = moment.parseTwoDigitYear(input); - break; - case 'YYYY' : - case 'YYYYY' : - case 'YYYYYY' : - datePartArray[YEAR] = toInt(input); - break; - // AM / PM - case 'a' : // fall through to A - case 'A' : - config._isPm = getLangDefinition(config._l).isPM(input); - break; - // 24 HOUR - case 'H' : // fall through to hh - case 'HH' : // fall through to hh - case 'h' : // fall through to hh - case 'hh' : - datePartArray[HOUR] = toInt(input); - break; - // MINUTE - case 'm' : // fall through to mm - case 'mm' : - datePartArray[MINUTE] = toInt(input); - break; - // SECOND - case 's' : // fall through to ss - case 'ss' : - datePartArray[SECOND] = toInt(input); - break; - // MILLISECOND - case 'S' : - case 'SS' : - case 'SSS' : - case 'SSSS' : - datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000); - break; - // UNIX TIMESTAMP WITH MS - case 'X': - config._d = new Date(parseFloat(input) * 1000); - break; - // TIMEZONE - case 'Z' : // fall through to ZZ - case 'ZZ' : - config._useUTC = true; - config._tzm = timezoneMinutesFromString(input); - break; - // WEEKDAY - human - case 'dd': - case 'ddd': - case 'dddd': - a = getLangDefinition(config._l).weekdaysParse(input); - // if we didn't get a weekday name, mark the date as invalid - if (a != null) { - config._w = config._w || {}; - config._w['d'] = a; - } else { - config._pf.invalidWeekday = input; - } - break; - // WEEK, WEEK DAY - numeric - case 'w': - case 'ww': - case 'W': - case 'WW': - case 'd': - case 'e': - case 'E': - token = token.substr(0, 1); - /* falls through */ - case 'gggg': - case 'GGGG': - case 'GGGGG': - token = token.substr(0, 2); - if (input) { - config._w = config._w || {}; - config._w[token] = toInt(input); - } - break; - case 'gg': - case 'GG': - config._w = config._w || {}; - config._w[token] = moment.parseTwoDigitYear(input); - } + /** + * move the screen down + * @private + */ + exports._moveDown = function(event) { + this.yIncrement = -this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['down'].className += " active"; } + }; - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, lang; - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; + /** + * move the screen left + * @private + */ + exports._moveLeft = function(event) { + this.xIncrement = this.constants.keyboard.speed.x; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['left'].className += " active"; + } + }; - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = dfl(w.GG, config._a[YEAR], weekOfYear(moment(), 1, 4).year); - week = dfl(w.W, 1); - weekday = dfl(w.E, 1); - } else { - lang = getLangDefinition(config._l); - dow = lang._week.dow; - doy = lang._week.doy; - - weekYear = dfl(w.gg, config._a[YEAR], weekOfYear(moment(), dow, doy).year); - week = dfl(w.w, 1); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < dow) { - ++week; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - } else { - // default to begining of week - weekday = dow; - } - } - temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; + /** + * move the screen right + * @private + */ + exports._moveRight = function(event) { + this.xIncrement = -this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['right'].className += " active"; } + }; - // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] - function dateFromConfig(config) { - var i, date, input = [], currentDate, yearToUse; - if (config._d) { - return; - } + /** + * Zoom in, using the same method as the movement. + * @private + */ + exports._zoomIn = function(event) { + this.zoomIncrement = this.constants.keyboard.speed.zoom; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['zoomIn'].className += " active"; + } + }; - currentDate = currentDateArray(config); - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } + /** + * Zoom out + * @private + */ + exports._zoomOut = function() { + this.zoomIncrement = -this.constants.keyboard.speed.zoom; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['zoomOut'].className += " active"; + } + }; - //if the day of the year is set, figure out what it is - if (config._dayOfYear) { - yearToUse = dfl(config._a[YEAR], currentDate[YEAR]); - if (config._dayOfYear > daysInYear(yearToUse)) { - config._pf._overflowDayOfYear = true; - } + /** + * Stop zooming and unhighlight the zoom controls + * @private + */ + exports._stopZoom = function() { + this.zoomIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['zoomIn'].className = this.navigationDivs['zoomIn'].className.replace(" active",""); + this.navigationDivs['zoomOut'].className = this.navigationDivs['zoomOut'].className.replace(" active",""); + } + }; - date = makeUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } + /** + * Stop moving in the Y direction and unHighlight the up and down + * @private + */ + exports._yStopMoving = function() { + this.yIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['up'].className = this.navigationDivs['up'].className.replace(" active",""); + this.navigationDivs['down'].className = this.navigationDivs['down'].className.replace(" active",""); + } + }; - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input); - // Apply timezone offset from input. The actual zone can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm); - } + /** + * Stop moving in the X direction and unHighlight left and right. + * @private + */ + exports._xStopMoving = function() { + this.xIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['left'].className = this.navigationDivs['left'].className.replace(" active",""); + this.navigationDivs['right'].className = this.navigationDivs['right'].className.replace(" active",""); } + }; - function dateFromObject(config) { - var normalizedInput; - if (config._d) { - return; - } +/***/ }, +/* 54 */ +/***/ function(module, exports, __webpack_require__) { - normalizedInput = normalizeObjectUnits(config._i); - config._a = [ - normalizedInput.year, - normalizedInput.month, - normalizedInput.day, - normalizedInput.hour, - normalizedInput.minute, - normalizedInput.second, - normalizedInput.millisecond - ]; - - dateFromConfig(config); - } - - function currentDateArray(config) { - var now = new Date(); - if (config._useUTC) { - return [ - now.getUTCFullYear(), - now.getUTCMonth(), - now.getUTCDate() - ]; - } else { - return [now.getFullYear(), now.getMonth(), now.getDate()]; + exports._resetLevels = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.preassignedLevel == false) { + node.level = -1; } + } } + }; - // date from string and format string - function makeDateFromStringAndFormat(config) { + /** + * This is the main function to layout the nodes in a hierarchical way. + * It checks if the node details are supplied correctly + * + * @private + */ + exports._setupHierarchicalLayout = function() { + if (this.constants.hierarchicalLayout.enabled == true && this.nodeIndices.length > 0) { + if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "DU") { + this.constants.hierarchicalLayout.levelSeparation *= -1; + } + else { + this.constants.hierarchicalLayout.levelSeparation = Math.abs(this.constants.hierarchicalLayout.levelSeparation); + } - if (config._f === moment.ISO_8601) { - parseISO(config); - return; + if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "LR") { + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.type = "vertical"; } - - config._a = []; - config._pf.empty = true; - - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var lang = getLangDefinition(config._l), - string = '' + config._i, - i, parsedInput, tokens, token, skipped, - stringLength = string.length, - totalParsedInputLength = 0; - - tokens = expandFormat(config._f, lang).match(formattingTokens) || []; - - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - config._pf.unusedInput.push(skipped); - } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - config._pf.empty = false; - } - else { - config._pf.unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } - else if (config._strict && !parsedInput) { - config._pf.unusedTokens.push(token); - } + } + else { + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.type = "horizontal"; } + } + // get the size of the largest hubs and check if the user has defined a level for a node. + var hubsize = 0; + var node, nodeId; + var definedLevel = false; + var undefinedLevel = false; - // add remaining unparsed input length to the string - config._pf.charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - config._pf.unusedInput.push(string); + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.level != -1) { + definedLevel = true; + } + else { + undefinedLevel = true; + } + if (hubsize < node.edges.length) { + hubsize = node.edges.length; + } } + } - // handle am pm - if (config._isPm && config._a[HOUR] < 12) { - config._a[HOUR] += 12; - } - // if is 12 am, change hours to 0 - if (config._isPm === false && config._a[HOUR] === 12) { - config._a[HOUR] = 0; + // if the user defined some levels but not all, alert and run without hierarchical layout + if (undefinedLevel == true && definedLevel == true) { + alert("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes."); + this.zoomExtent(true,this.constants.clustering.enabled); + if (!this.constants.clustering.enabled) { + this.start(); } + } + else { + // setup the system to use hierarchical method. + this._changeConstants(); - dateFromConfig(config); - checkOverflow(config); - } + // define levels if undefined by the users. Based on hubsize + if (undefinedLevel == true) { + this._determineLevels(hubsize); + } + // check the distribution of the nodes per level. + var distribution = this._getDistribution(); - function unescapeFormat(s) { - return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - }); - } + // place the nodes on the canvas. This also stablilizes the system. + this._placeNodesByHierarchy(distribution); - // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function regexpEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + // start the simulation. + this.start(); + } } + }; - // date from string and array of format strings - function makeDateFromStringAndArray(config) { - var tempConfig, - bestMoment, - scoreToBeat, - i, - currentScore; + /** + * This function places the nodes on the canvas based on the hierarchial distribution. + * + * @param {Object} distribution | obtained by the function this._getDistribution() + * @private + */ + exports._placeNodesByHierarchy = function(distribution) { + var nodeId, node; - if (config._f.length === 0) { - config._pf.invalidFormat = true; - config._d = new Date(NaN); - return; - } + // start placing all the level 0 nodes first. Then recursively position their branches. + for (var level in distribution) { + if (distribution.hasOwnProperty(level)) { - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = extend({}, config); - tempConfig._pf = defaultParsingFlags(); - tempConfig._f = config._f[i]; - makeDateFromStringAndFormat(tempConfig); + for (nodeId in distribution[level].nodes) { + if (distribution[level].nodes.hasOwnProperty(nodeId)) { + node = distribution[level].nodes[nodeId]; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + if (node.xFixed) { + node.x = distribution[level].minPos; + node.xFixed = false; - if (!isValid(tempConfig)) { - continue; + distribution[level].minPos += distribution[level].nodeSpacing; + } } + else { + if (node.yFixed) { + node.y = distribution[level].minPos; + node.yFixed = false; - // if there is any input that was not parsed add a penalty for that format - currentScore += tempConfig._pf.charsLeftOver; - - //or tokens - currentScore += tempConfig._pf.unusedTokens.length * 10; - - tempConfig._pf.score = currentScore; - - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; + distribution[level].minPos += distribution[level].nodeSpacing; + } } + this._placeBranchNodes(node.edges,node.id,distribution,node.level); + } } - - extend(config, bestMoment || tempConfig); + } } - // date from iso format - function parseISO(config) { - var i, l, - string = config._i, - match = isoRegex.exec(string); + // stabilize the system after positioning. This function calls zoomExtent. + this._stabilize(); + }; - if (match) { - config._pf.iso = true; - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(string)) { - // match[5] should be "T" or undefined - config._f = isoDates[i][0] + (match[6] || " "); - break; - } - } - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(string)) { - config._f += isoTimes[i][0]; - break; - } - } - if (string.match(parseTokenTimezone)) { - config._f += "Z"; - } - makeDateFromStringAndFormat(config); - } else { - config._isValid = false; - } - } - - // date from iso format or fallback - function makeDateFromString(config) { - parseISO(config); - if (config._isValid === false) { - delete config._isValid; - moment.createFromInputFallback(config); - } - } - - function makeDateFromInput(config) { - var input = config._i, - matched = aspNetJsonRegex.exec(input); - - if (input === undefined) { - config._d = new Date(); - } else if (matched) { - config._d = new Date(+matched[1]); - } else if (typeof input === 'string') { - makeDateFromString(config); - } else if (isArray(input)) { - config._a = input.slice(0); - dateFromConfig(config); - } else if (isDate(input)) { - config._d = new Date(+input); - } else if (typeof(input) === 'object') { - dateFromObject(config); - } else if (typeof(input) === 'number') { - // from milliseconds - config._d = new Date(input); - } else { - moment.createFromInputFallback(config); - } - } - function makeDate(y, m, d, h, M, s, ms) { - //can't just apply() to create a date: - //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply - var date = new Date(y, m, d, h, M, s, ms); + /** + * This function get the distribution of levels based on hubsize + * + * @returns {Object} + * @private + */ + exports._getDistribution = function() { + var distribution = {}; + var nodeId, node, level; - //the date constructor doesn't accept years < 1970 - if (y < 1970) { - date.setFullYear(y); + // we fix Y because the hierarchy is vertical, we fix X so we do not give a node an x position for a second time. + // the fix of X is removed after the x value has been set. + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + node.xFixed = true; + node.yFixed = true; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + node.y = this.constants.hierarchicalLayout.levelSeparation*node.level; } - return date; - } - - function makeUTCDate(y) { - var date = new Date(Date.UTC.apply(null, arguments)); - if (y < 1970) { - date.setUTCFullYear(y); + else { + node.x = this.constants.hierarchicalLayout.levelSeparation*node.level; } - return date; - } - - function parseWeekday(input, language) { - if (typeof input === 'string') { - if (!isNaN(input)) { - input = parseInt(input, 10); - } - else { - input = language.weekdaysParse(input); - if (typeof input !== 'number') { - return null; - } - } + if (distribution[node.level] === undefined) { + distribution[node.level] = {amount: 0, nodes: {}, minPos:0, nodeSpacing:0}; } - return input; + distribution[node.level].amount += 1; + distribution[node.level].nodes[nodeId] = node; + } } - /************************************ - Relative Time - ************************************/ - - - // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) { - return lang.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + // determine the largest amount of nodes of all levels + var maxCount = 0; + for (level in distribution) { + if (distribution.hasOwnProperty(level)) { + if (maxCount < distribution[level].amount) { + maxCount = distribution[level].amount; + } + } } - function relativeTime(milliseconds, withoutSuffix, lang) { - var seconds = round(Math.abs(milliseconds) / 1000), - minutes = round(seconds / 60), - hours = round(minutes / 60), - days = round(hours / 24), - years = round(days / 365), - args = seconds < relativeTimeThresholds.s && ['s', seconds] || - minutes === 1 && ['m'] || - minutes < relativeTimeThresholds.m && ['mm', minutes] || - hours === 1 && ['h'] || - hours < relativeTimeThresholds.h && ['hh', hours] || - days === 1 && ['d'] || - days <= relativeTimeThresholds.dd && ['dd', days] || - days <= relativeTimeThresholds.dm && ['M'] || - days < relativeTimeThresholds.dy && ['MM', round(days / 30)] || - years === 1 && ['y'] || ['yy', years]; - args[2] = withoutSuffix; - args[3] = milliseconds > 0; - args[4] = lang; - return substituteTimeAgo.apply({}, args); + // set the initial position and spacing of each nodes accordingly + for (level in distribution) { + if (distribution.hasOwnProperty(level)) { + distribution[level].nodeSpacing = (maxCount + 1) * this.constants.hierarchicalLayout.nodeSpacing; + distribution[level].nodeSpacing /= (distribution[level].amount + 1); + distribution[level].minPos = distribution[level].nodeSpacing - (0.5 * (distribution[level].amount + 1) * distribution[level].nodeSpacing); + } } + return distribution; + }; - /************************************ - Week of Year - ************************************/ - - - // firstDayOfWeek 0 = sun, 6 = sat - // the day of the week that starts the week - // (usually sunday or monday) - // firstDayOfWeekOfYear 0 = sun, 6 = sat - // the first week is the week that contains the first - // of this day of the week - // (eg. ISO weeks use thursday (4)) - function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) { - var end = firstDayOfWeekOfYear - firstDayOfWeek, - daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(), - adjustedMoment; + /** + * this function allocates nodes in levels based on the recursive branching from the largest hubs. + * + * @param hubsize + * @private + */ + exports._determineLevels = function(hubsize) { + var nodeId, node; - if (daysToDayOfWeek > end) { - daysToDayOfWeek -= 7; + // determine hubs + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.edges.length == hubsize) { + node.level = 0; } + } + } - if (daysToDayOfWeek < end - 7) { - daysToDayOfWeek += 7; + // branch from hubs + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.level == 0) { + this._setLevel(1,node.edges,node.id); } - - adjustedMoment = moment(mom).add('d', daysToDayOfWeek); - return { - week: Math.ceil(adjustedMoment.dayOfYear() / 7), - year: adjustedMoment.year() - }; + } } + }; - //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) { - var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear; - - d = d === 0 ? 7 : d; - weekday = weekday != null ? weekday : firstDayOfWeek; - daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0); - dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1; - return { - year: dayOfYear > 0 ? year : year - 1, - dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear - }; + /** + * Since hierarchical layout does not support: + * - smooth curves (based on the physics), + * - clustering (based on dynamic node counts) + * + * We disable both features so there will be no problems. + * + * @private + */ + exports._changeConstants = function() { + this.constants.clustering.enabled = false; + this.constants.physics.barnesHut.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this._loadSelectedForceSolver(); + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.dynamic = false; } + this._configureSmoothCurves(); + }; - /************************************ - Top Level Functions - ************************************/ - function makeMoment(config) { - var input = config._i, - format = config._f; + /** + * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes + * on a X position that ensures there will be no overlap. + * + * @param edges + * @param parentId + * @param distribution + * @param parentLevel + * @private + */ + exports._placeBranchNodes = function(edges, parentId, distribution, parentLevel) { + for (var i = 0; i < edges.length; i++) { + var childNode = null; + if (edges[i].toId == parentId) { + childNode = edges[i].from; + } + else { + childNode = edges[i].to; + } - if (input === null || (format === undefined && input === '')) { - return moment.invalid({nullInput: true}); + // if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here. + var nodeMoved = false; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + if (childNode.xFixed && childNode.level > parentLevel) { + childNode.xFixed = false; + childNode.x = distribution[childNode.level].minPos; + nodeMoved = true; } - - if (typeof input === 'string') { - config._i = input = getLangDefinition().preparse(input); + } + else { + if (childNode.yFixed && childNode.level > parentLevel) { + childNode.yFixed = false; + childNode.y = distribution[childNode.level].minPos; + nodeMoved = true; } + } - if (moment.isMoment(input)) { - config = cloneMoment(input); - - config._d = new Date(+input._d); - } else if (format) { - if (isArray(format)) { - makeDateFromStringAndArray(config); - } else { - makeDateFromStringAndFormat(config); - } - } else { - makeDateFromInput(config); + if (nodeMoved == true) { + distribution[childNode.level].minPos += distribution[childNode.level].nodeSpacing; + if (childNode.edges.length > 1) { + this._placeBranchNodes(childNode.edges,childNode.id,distribution,childNode.level); } - - return new Moment(config); + } } + }; - moment = function (input, format, lang, strict) { - var c; - - if (typeof(lang) === "boolean") { - strict = lang; - lang = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c = {}; - c._isAMomentObject = true; - c._i = input; - c._f = format; - c._l = lang; - c._strict = strict; - c._isUTC = false; - c._pf = defaultParsingFlags(); - - return makeMoment(c); - }; - - moment.suppressDeprecationWarnings = false; - - moment.createFromInputFallback = deprecate( - "moment construction falls back to js Date. This is " + - "discouraged and will be removed in upcoming major " + - "release. Please refer to " + - "https://github.com/moment/moment/issues/1407 for more info.", - function (config) { - config._d = new Date(config._i); - }); - // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return moment(); - } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (moments[i][fn](res)) { - res = moments[i]; - } + /** + * this function is called recursively to enumerate the barnches of the largest hubs and give each node a level. + * + * @param level + * @param edges + * @param parentId + * @private + */ + exports._setLevel = function(level, edges, parentId) { + for (var i = 0; i < edges.length; i++) { + var childNode = null; + if (edges[i].toId == parentId) { + childNode = edges[i].from; + } + else { + childNode = edges[i].to; + } + if (childNode.level == -1 || childNode.level > level) { + childNode.level = level; + if (edges.length > 1) { + this._setLevel(level+1, childNode.edges, childNode.id); } - return res; + } } + }; - moment.min = function () { - var args = [].slice.call(arguments, 0); - return pickBy('isBefore', args); - }; + /** + * Unfix nodes + * + * @private + */ + exports._restoreNodes = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.nodes[nodeId].xFixed = false; + this.nodes[nodeId].yFixed = false; + } + } + }; - moment.max = function () { - var args = [].slice.call(arguments, 0); - return pickBy('isAfter', args); - }; +/***/ }, +/* 55 */ +/***/ function(module, exports, __webpack_require__) { - // creating with utc - moment.utc = function (input, format, lang, strict) { - var c; - - if (typeof(lang) === "boolean") { - strict = lang; - lang = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c = {}; - c._isAMomentObject = true; - c._useUTC = true; - c._isUTC = true; - c._l = lang; - c._i = input; - c._f = format; - c._strict = strict; - c._pf = defaultParsingFlags(); - - return makeMoment(c).utc(); - }; + var util = __webpack_require__(1); + var RepulsionMixin = __webpack_require__(57); + var HierarchialRepulsionMixin = __webpack_require__(58); + var BarnesHutMixin = __webpack_require__(59); - // creating with unix timestamp (in seconds) - moment.unix = function (input) { - return moment(input * 1000); - }; + /** + * Toggling barnes Hut calculation on and off. + * + * @private + */ + exports._toggleBarnesHut = function () { + this.constants.physics.barnesHut.enabled = !this.constants.physics.barnesHut.enabled; + this._loadSelectedForceSolver(); + this.moving = true; + this.start(); + }; - // duration - moment.duration = function (input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - parseIso; - - if (moment.isDuration(input)) { - duration = { - ms: input._milliseconds, - d: input._days, - M: input._months - }; - } else if (typeof input === 'number') { - duration = {}; - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) { - sign = (match[1] === "-") ? -1 : 1; - duration = { - y: 0, - d: toInt(match[DATE]) * sign, - h: toInt(match[HOUR]) * sign, - m: toInt(match[MINUTE]) * sign, - s: toInt(match[SECOND]) * sign, - ms: toInt(match[MILLISECOND]) * sign - }; - } else if (!!(match = isoDurationRegex.exec(input))) { - sign = (match[1] === "-") ? -1 : 1; - parseIso = function (inp) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; - }; - duration = { - y: parseIso(match[2]), - M: parseIso(match[3]), - d: parseIso(match[4]), - h: parseIso(match[5]), - m: parseIso(match[6]), - s: parseIso(match[7]), - w: parseIso(match[8]) - }; - } - - ret = new Duration(duration); - - if (moment.isDuration(input) && input.hasOwnProperty('_lang')) { - ret._lang = input._lang; - } - - return ret; - }; - // version number - moment.version = VERSION; + /** + * This loads the node force solver based on the barnes hut or repulsion algorithm + * + * @private + */ + exports._loadSelectedForceSolver = function () { + // this overloads the this._calculateNodeForces + if (this.constants.physics.barnesHut.enabled == true) { + this._clearMixin(RepulsionMixin); + this._clearMixin(HierarchialRepulsionMixin); - // default format - moment.defaultFormat = isoFormat; + this.constants.physics.centralGravity = this.constants.physics.barnesHut.centralGravity; + this.constants.physics.springLength = this.constants.physics.barnesHut.springLength; + this.constants.physics.springConstant = this.constants.physics.barnesHut.springConstant; + this.constants.physics.damping = this.constants.physics.barnesHut.damping; - // constant that refers to the ISO standard - moment.ISO_8601 = function () {}; + this._loadMixin(BarnesHutMixin); + } + else if (this.constants.physics.hierarchicalRepulsion.enabled == true) { + this._clearMixin(BarnesHutMixin); + this._clearMixin(RepulsionMixin); - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - moment.momentProperties = momentProperties; + this.constants.physics.centralGravity = this.constants.physics.hierarchicalRepulsion.centralGravity; + this.constants.physics.springLength = this.constants.physics.hierarchicalRepulsion.springLength; + this.constants.physics.springConstant = this.constants.physics.hierarchicalRepulsion.springConstant; + this.constants.physics.damping = this.constants.physics.hierarchicalRepulsion.damping; - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - moment.updateOffset = function () {}; + this._loadMixin(HierarchialRepulsionMixin); + } + else { + this._clearMixin(BarnesHutMixin); + this._clearMixin(HierarchialRepulsionMixin); + this.barnesHutTree = undefined; - // This function allows you to set a threshold for relative time strings - moment.relativeTimeThreshold = function(threshold, limit) { - if (relativeTimeThresholds[threshold] === undefined) { - return false; - } - relativeTimeThresholds[threshold] = limit; - return true; - }; + this.constants.physics.centralGravity = this.constants.physics.repulsion.centralGravity; + this.constants.physics.springLength = this.constants.physics.repulsion.springLength; + this.constants.physics.springConstant = this.constants.physics.repulsion.springConstant; + this.constants.physics.damping = this.constants.physics.repulsion.damping; - // This function will load languages and then set the global language. If - // no arguments are passed in, it will simply return the current global - // language key. - moment.lang = function (key, values) { - var r; - if (!key) { - return moment.fn._lang._abbr; - } - if (values) { - loadLang(normalizeLanguage(key), values); - } else if (values === null) { - unloadLang(key); - key = 'en'; - } else if (!languages[key]) { - getLangDefinition(key); - } - r = moment.duration.fn._lang = moment.fn._lang = getLangDefinition(key); - return r._abbr; - }; + this._loadMixin(RepulsionMixin); + } + }; - // returns language data - moment.langData = function (key) { - if (key && key._lang && key._lang._abbr) { - key = key._lang._abbr; - } - return getLangDefinition(key); - }; + /** + * Before calculating the forces, we check if we need to cluster to keep up performance and we check + * if there is more than one node. If it is just one node, we dont calculate anything. + * + * @private + */ + exports._initializeForceCalculation = function () { + // stop calculation if there is only one node + if (this.nodeIndices.length == 1) { + this.nodes[this.nodeIndices[0]]._setForce(0, 0); + } + else { + // if there are too many nodes on screen, we cluster without repositioning + if (this.nodeIndices.length > this.constants.clustering.clusterThreshold && this.constants.clustering.enabled == true) { + this.clusterToFit(this.constants.clustering.reduceToNodes, false); + } - // compare moment object - moment.isMoment = function (obj) { - return obj instanceof Moment || - (obj != null && obj.hasOwnProperty('_isAMomentObject')); - }; + // we now start the force calculation + this._calculateForces(); + } + }; - // for typechecking Duration objects - moment.isDuration = function (obj) { - return obj instanceof Duration; - }; - for (i = lists.length - 1; i >= 0; --i) { - makeList(lists[i]); - } + /** + * Calculate the external forces acting on the nodes + * Forces are caused by: edges, repulsing forces between nodes, gravity + * @private + */ + exports._calculateForces = function () { + // Gravity is required to keep separated groups from floating off + // the forces are reset to zero in this loop by using _setForce instead + // of _addForce - moment.normalizeUnits = function (units) { - return normalizeUnits(units); - }; + this._calculateGravitationalForces(); + this._calculateNodeForces(); - moment.invalid = function (flags) { - var m = moment.utc(NaN); - if (flags != null) { - extend(m._pf, flags); + if (this.constants.physics.springConstant > 0) { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this._calculateSpringForcesWithSupport(); + } + else { + if (this.constants.physics.hierarchicalRepulsion.enabled == true) { + this._calculateHierarchicalSpringForces(); } else { - m._pf.userInvalidated = true; + this._calculateSpringForces(); } + } + } + }; - return m; - }; - - moment.parseZone = function () { - return moment.apply(null, arguments).parseZone(); - }; - - moment.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; - - /************************************ - Moment Prototype - ************************************/ - - - extend(moment.fn = Moment.prototype, { - - clone : function () { - return moment(this); - }, - - valueOf : function () { - return +this._d + ((this._offset || 0) * 60000); - }, - - unix : function () { - return Math.floor(+this / 1000); - }, - - toString : function () { - return this.clone().lang('en').format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ"); - }, - - toDate : function () { - return this._offset ? new Date(+this) : this._d; - }, - toISOString : function () { - var m = moment(this).utc(); - if (0 < m.year() && m.year() <= 9999) { - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } else { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - }, + /** + * Smooth curves are created by adding invisible nodes in the center of the edges. These nodes are also + * handled in the calculateForces function. We then use a quadratic curve with the center node as control. + * This function joins the datanodes and invisible (called support) nodes into one object. + * We do this so we do not contaminate this.nodes with the support nodes. + * + * @private + */ + exports._updateCalculationNodes = function () { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this.calculationNodes = {}; + this.calculationNodeIndices = []; - toArray : function () { - var m = this; - return [ - m.year(), - m.month(), - m.date(), - m.hours(), - m.minutes(), - m.seconds(), - m.milliseconds() - ]; - }, + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.calculationNodes[nodeId] = this.nodes[nodeId]; + } + } + var supportNodes = this.sectors['support']['nodes']; + for (var supportNodeId in supportNodes) { + if (supportNodes.hasOwnProperty(supportNodeId)) { + if (this.edges.hasOwnProperty(supportNodes[supportNodeId].parentEdgeId)) { + this.calculationNodes[supportNodeId] = supportNodes[supportNodeId]; + } + else { + supportNodes[supportNodeId]._setForce(0, 0); + } + } + } - isValid : function () { - return isValid(this); - }, + for (var idx in this.calculationNodes) { + if (this.calculationNodes.hasOwnProperty(idx)) { + this.calculationNodeIndices.push(idx); + } + } + } + else { + this.calculationNodes = this.nodes; + this.calculationNodeIndices = this.nodeIndices; + } + }; - isDSTShifted : function () { - if (this._a) { - return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0; - } + /** + * this function applies the central gravity effect to keep groups from floating off + * + * @private + */ + exports._calculateGravitationalForces = function () { + var dx, dy, distance, node, i; + var nodes = this.calculationNodes; + var gravity = this.constants.physics.centralGravity; + var gravityForce = 0; - return false; - }, + for (i = 0; i < this.calculationNodeIndices.length; i++) { + node = nodes[this.calculationNodeIndices[i]]; + node.damping = this.constants.physics.damping; // possibly add function to alter damping properties of clusters. + // gravity does not apply when we are in a pocket sector + if (this._sector() == "default" && gravity != 0) { + dx = -node.x; + dy = -node.y; + distance = Math.sqrt(dx * dx + dy * dy); - parsingFlags : function () { - return extend({}, this._pf); - }, + gravityForce = (distance == 0) ? 0 : (gravity / distance); + node.fx = dx * gravityForce; + node.fy = dy * gravityForce; + } + else { + node.fx = 0; + node.fy = 0; + } + } + }; - invalidAt: function () { - return this._pf.overflow; - }, - utc : function () { - return this.zone(0); - }, - local : function () { - this.zone(0); - this._isUTC = false; - return this; - }, - format : function (inputString) { - var output = formatMoment(this, inputString || moment.defaultFormat); - return this.lang().postformat(output); - }, + /** + * this function calculates the effects of the springs in the case of unsmooth curves. + * + * @private + */ + exports._calculateSpringForces = function () { + var edgeLength, edge, edgeId; + var dx, dy, fx, fy, springForce, distance; + var edges = this.edges; - add : function (input, val) { - var dur; - // switch args to support add('s', 1) and add(1, 's') - if (typeof input === 'string' && typeof val === 'string') { - dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input); - } else if (typeof input === 'string') { - dur = moment.duration(+val, input); - } else { - dur = moment.duration(input, val); - } - addOrSubtractDurationFromMoment(this, dur, 1); - return this; - }, + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + // this implies that the edges between big clusters are longer + edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; - subtract : function (input, val) { - var dur; - // switch args to support subtract('s', 1) and subtract(1, 's') - if (typeof input === 'string' && typeof val === 'string') { - dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input); - } else if (typeof input === 'string') { - dur = moment.duration(+val, input); - } else { - dur = moment.duration(input, val); - } - addOrSubtractDurationFromMoment(this, dur, -1); - return this; - }, + dx = (edge.from.x - edge.to.x); + dy = (edge.from.y - edge.to.y); + distance = Math.sqrt(dx * dx + dy * dy); - diff : function (input, units, asFloat) { - var that = makeAs(input, this), - zoneDiff = (this.zone() - that.zone()) * 6e4, - diff, output; - - units = normalizeUnits(units); - - if (units === 'year' || units === 'month') { - // average number of days in the months in the given dates - diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2 - // difference in months - output = ((this.year() - that.year()) * 12) + (this.month() - that.month()); - // adjust by taking difference in days, average number of days - // and dst in the given months. - output += ((this - moment(this).startOf('month')) - - (that - moment(that).startOf('month'))) / diff; - // same as above but with zones, to negate all dst - output -= ((this.zone() - moment(this).startOf('month').zone()) - - (that.zone() - moment(that).startOf('month').zone())) * 6e4 / diff; - if (units === 'year') { - output = output / 12; - } - } else { - diff = (this - that); - output = units === 'second' ? diff / 1e3 : // 1000 - units === 'minute' ? diff / 6e4 : // 1000 * 60 - units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - diff; + if (distance == 0) { + distance = 0.01; } - return asFloat ? output : absRound(output); - }, - - from : function (time, withoutSuffix) { - return moment.duration(this.diff(time)).lang(this.lang()._abbr).humanize(!withoutSuffix); - }, - - fromNow : function (withoutSuffix) { - return this.from(moment(), withoutSuffix); - }, - calendar : function (time) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're zone'd or not. - var now = time || moment(), - sod = makeAs(now, this).startOf('day'), - diff = this.diff(sod, 'days', true), - format = diff < -6 ? 'sameElse' : - diff < -1 ? 'lastWeek' : - diff < 0 ? 'lastDay' : - diff < 1 ? 'sameDay' : - diff < 2 ? 'nextDay' : - diff < 7 ? 'nextWeek' : 'sameElse'; - return this.format(this.lang().calendar(format, this)); - }, - - isLeapYear : function () { - return isLeapYear(this.year()); - }, - - isDST : function () { - return (this.zone() < this.clone().month(0).zone() || - this.zone() < this.clone().month(5).zone()); - }, - - day : function (input) { - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.lang()); - return this.add({ d : input - day }); - } else { - return day; - } - }, + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; - month : makeAccessor('Month', true), - - startOf: function (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); - /* falls through */ - } + fx = dx * springForce; + fy = dy * springForce; - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } else if (units === 'isoWeek') { - this.isoWeekday(1); - } + edge.from.fx += fx; + edge.from.fy += fy; + edge.to.fx -= fx; + edge.to.fy -= fy; + } + } + } + } + }; - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - return this; - }, - endOf: function (units) { - units = normalizeUnits(units); - return this.startOf(units).add((units === 'isoWeek' ? 'week' : units), 1).subtract('ms', 1); - }, - isAfter: function (input, units) { - units = typeof units !== 'undefined' ? units : 'millisecond'; - return +this.clone().startOf(units) > +moment(input).startOf(units); - }, + /** + * This function calculates the springforces on the nodes, accounting for the support nodes. + * + * @private + */ + exports._calculateSpringForcesWithSupport = function () { + var edgeLength, edge, edgeId, combinedClusterSize; + var edges = this.edges; - isBefore: function (input, units) { - units = typeof units !== 'undefined' ? units : 'millisecond'; - return +this.clone().startOf(units) < +moment(input).startOf(units); - }, + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + if (edge.via != null) { + var node1 = edge.to; + var node2 = edge.via; + var node3 = edge.from; - isSame: function (input, units) { - units = units || 'ms'; - return +this.clone().startOf(units) === +makeAs(input, this).startOf(units); - }, + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; - min: deprecate( - "moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548", - function (other) { - other = moment.apply(null, arguments); - return other < this ? this : other; - } - ), - - max: deprecate( - "moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548", - function (other) { - other = moment.apply(null, arguments); - return other > this ? this : other; - } - ), + combinedClusterSize = node1.clusterSize + node3.clusterSize - 2; - // keepTime = true means only change the timezone, without affecting - // the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200 - // It is possible that 5:31:26 doesn't exist int zone +0200, so we - // adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - zone : function (input, keepTime) { - var offset = this._offset || 0; - if (input != null) { - if (typeof input === "string") { - input = timezoneMinutesFromString(input); - } - if (Math.abs(input) < 16) { - input = input * 60; - } - this._offset = input; - this._isUTC = true; - if (offset !== input) { - if (!keepTime || this._changeInProgress) { - addOrSubtractDurationFromMoment(this, - moment.duration(offset - input, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - moment.updateOffset(this, true); - this._changeInProgress = null; - } - } - } else { - return this._isUTC ? offset : this._d.getTimezoneOffset(); + // this implies that the edges between big clusters are longer + edgeLength += combinedClusterSize * this.constants.clustering.edgeGrowth; + this._calculateSpringForce(node1, node2, 0.5 * edgeLength); + this._calculateSpringForce(node2, node3, 0.5 * edgeLength); } - return this; - }, + } + } + } + } + }; - zoneAbbr : function () { - return this._isUTC ? "UTC" : ""; - }, - zoneName : function () { - return this._isUTC ? "Coordinated Universal Time" : ""; - }, + /** + * This is the code actually performing the calculation for the function above. It is split out to avoid repetition. + * + * @param node1 + * @param node2 + * @param edgeLength + * @private + */ + exports._calculateSpringForce = function (node1, node2, edgeLength) { + var dx, dy, fx, fy, springForce, distance; - parseZone : function () { - if (this._tzm) { - this.zone(this._tzm); - } else if (typeof this._i === 'string') { - this.zone(this._i); - } - return this; - }, + dx = (node1.x - node2.x); + dy = (node1.y - node2.y); + distance = Math.sqrt(dx * dx + dy * dy); - hasAlignedHourOffset : function (input) { - if (!input) { - input = 0; - } - else { - input = moment(input).zone(); - } + if (distance == 0) { + distance = 0.01; + } - return (this.zone() - input) % 60 === 0; - }, + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; - daysInMonth : function () { - return daysInMonth(this.year(), this.month()); - }, + fx = dx * springForce; + fy = dy * springForce; - dayOfYear : function (input) { - var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add("d", (input - dayOfYear)); - }, + node1.fx += fx; + node1.fy += fy; + node2.fx -= fx; + node2.fy -= fy; + }; - quarter : function (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); - }, - weekYear : function (input) { - var year = weekOfYear(this, this.lang()._week.dow, this.lang()._week.doy).year; - return input == null ? year : this.add("y", (input - year)); - }, + /** + * Load the HTML for the physics config and bind it + * @private + */ + exports._loadPhysicsConfiguration = function () { + if (this.physicsConfiguration === undefined) { + this.backupConstants = {}; + util.deepExtend(this.backupConstants,this.constants); - isoWeekYear : function (input) { - var year = weekOfYear(this, 1, 4).year; - return input == null ? year : this.add("y", (input - year)); - }, + var hierarchicalLayoutDirections = ["LR", "RL", "UD", "DU"]; + this.physicsConfiguration = document.createElement('div'); + this.physicsConfiguration.className = "PhysicsConfiguration"; + this.physicsConfiguration.innerHTML = '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
Simulation Mode:
Barnes HutRepulsionHierarchical
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
Options:
' + this.containerElement.parentElement.insertBefore(this.physicsConfiguration, this.containerElement); + this.optionsDiv = document.createElement("div"); + this.optionsDiv.style.fontSize = "14px"; + this.optionsDiv.style.fontFamily = "verdana"; + this.containerElement.parentElement.insertBefore(this.optionsDiv, this.containerElement); - week : function (input) { - var week = this.lang().week(this); - return input == null ? week : this.add("d", (input - week) * 7); - }, + var rangeElement; + rangeElement = document.getElementById('graph_BH_gc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_gc', -1, "physics_barnesHut_gravitationalConstant"); + rangeElement = document.getElementById('graph_BH_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_BH_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_BH_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_BH_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_damp', 1, "physics_damping"); - isoWeek : function (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add("d", (input - week) * 7); - }, + rangeElement = document.getElementById('graph_R_nd'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_nd', 1, "physics_repulsion_nodeDistance"); + rangeElement = document.getElementById('graph_R_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_R_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_R_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_R_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_damp', 1, "physics_damping"); - weekday : function (input) { - var weekday = (this.day() + 7 - this.lang()._week.dow) % 7; - return input == null ? weekday : this.add("d", input - weekday); - }, + rangeElement = document.getElementById('graph_H_nd'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); + rangeElement = document.getElementById('graph_H_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_H_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_H_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_H_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_damp', 1, "physics_damping"); + rangeElement = document.getElementById('graph_H_direction'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_direction', hierarchicalLayoutDirections, "hierarchicalLayout_direction"); + rangeElement = document.getElementById('graph_H_levsep'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_levsep', 1, "hierarchicalLayout_levelSeparation"); + rangeElement = document.getElementById('graph_H_nspac'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nspac', 1, "hierarchicalLayout_nodeSpacing"); - isoWeekday : function (input) { - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. - return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); - }, + var radioButton1 = document.getElementById("graph_physicsMethod1"); + var radioButton2 = document.getElementById("graph_physicsMethod2"); + var radioButton3 = document.getElementById("graph_physicsMethod3"); + radioButton2.checked = true; + if (this.constants.physics.barnesHut.enabled) { + radioButton1.checked = true; + } + if (this.constants.hierarchicalLayout.enabled) { + radioButton3.checked = true; + } - isoWeeksInYear : function () { - return weeksInYear(this.year(), 1, 4); - }, + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + var graph_repositionNodes = document.getElementById("graph_repositionNodes"); + var graph_generateOptions = document.getElementById("graph_generateOptions"); - weeksInYear : function () { - var weekInfo = this._lang._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - }, + graph_toggleSmooth.onclick = graphToggleSmoothCurves.bind(this); + graph_repositionNodes.onclick = graphRepositionNodes.bind(this); + graph_generateOptions.onclick = graphGenerateOptions.bind(this); + if (this.constants.smoothCurves == true && this.constants.dynamicSmoothCurves == false) { + graph_toggleSmooth.style.background = "#A4FF56"; + } + else { + graph_toggleSmooth.style.background = "#FF8532"; + } - get : function (units) { - units = normalizeUnits(units); - return this[units](); - }, - set : function (units, value) { - units = normalizeUnits(units); - if (typeof this[units] === 'function') { - this[units](value); - } - return this; - }, + switchConfigurations.apply(this); + + radioButton1.onchange = switchConfigurations.bind(this); + radioButton2.onchange = switchConfigurations.bind(this); + radioButton3.onchange = switchConfigurations.bind(this); + } + }; + + /** + * This overwrites the this.constants. + * + * @param constantsVariableName + * @param value + * @private + */ + exports._overWriteGraphConstants = function (constantsVariableName, value) { + var nameArray = constantsVariableName.split("_"); + if (nameArray.length == 1) { + this.constants[nameArray[0]] = value; + } + else if (nameArray.length == 2) { + this.constants[nameArray[0]][nameArray[1]] = value; + } + else if (nameArray.length == 3) { + this.constants[nameArray[0]][nameArray[1]][nameArray[2]] = value; + } + }; - // If passed a language key, it will set the language for this - // instance. Otherwise, it will return the language configuration - // variables for this instance. - lang : function (key) { - if (key === undefined) { - return this._lang; - } else { - this._lang = getLangDefinition(key); - return this; - } - } - }); - function rawMonthSetter(mom, value) { - var dayOfMonth; + /** + * this function is bound to the toggle smooth curves button. That is also why it is not in the prototype. + */ + function graphToggleSmoothCurves () { + this.constants.smoothCurves.enabled = !this.constants.smoothCurves.enabled; + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + if (this.constants.smoothCurves.enabled == true) {graph_toggleSmooth.style.background = "#A4FF56";} + else {graph_toggleSmooth.style.background = "#FF8532";} - // TODO: Move this out of here! - if (typeof value === 'string') { - value = mom.lang().monthsParse(value); - // TODO: Another silent failure? - if (typeof value !== 'number') { - return mom; - } - } + this._configureSmoothCurves(false); + } - dayOfMonth = Math.min(mom.date(), - daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; + /** + * this function is used to scramble the nodes + * + */ + function graphRepositionNodes () { + for (var nodeId in this.calculationNodes) { + if (this.calculationNodes.hasOwnProperty(nodeId)) { + this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0; + this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0; + } } - - function rawGetter(mom, unit) { - return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit](); + if (this.constants.hierarchicalLayout.enabled == true) { + this._setupHierarchicalLayout(); + showValueOfRange.call(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); + showValueOfRange.call(this, 'graph_H_cg', 1, "physics_centralGravity"); + showValueOfRange.call(this, 'graph_H_sc', 1, "physics_springConstant"); + showValueOfRange.call(this, 'graph_H_sl', 1, "physics_springLength"); + showValueOfRange.call(this, 'graph_H_damp', 1, "physics_damping"); + } + else { + this.repositionNodes(); } + this.moving = true; + this.start(); + } - function rawSetter(mom, unit, value) { - if (unit === 'Month') { - return rawMonthSetter(mom, value); - } else { - return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + /** + * this is used to generate an options file from the playing with physics system. + */ + function graphGenerateOptions () { + var options = "No options are required, default values used."; + var optionsSpecific = []; + var radioButton1 = document.getElementById("graph_physicsMethod1"); + var radioButton2 = document.getElementById("graph_physicsMethod2"); + if (radioButton1.checked == true) { + if (this.constants.physics.barnesHut.gravitationalConstant != this.backupConstants.physics.barnesHut.gravitationalConstant) {optionsSpecific.push("gravitationalConstant: " + this.constants.physics.barnesHut.gravitationalConstant);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.barnesHut.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.barnesHut.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.barnesHut.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.barnesHut.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options = "var options = {"; + options += "physics: {barnesHut: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } } + options += '}}' + } + if (this.constants.smoothCurves.enabled != this.backupConstants.smoothCurves.enabled) { + if (optionsSpecific.length == 0) {options = "var options = {";} + else {options += ", "} + options += "smoothCurves: " + this.constants.smoothCurves.enabled; + } + if (options != "No options are required, default values used.") { + options += '};' + } } - - function makeAccessor(unit, keepTime) { - return function (value) { - if (value != null) { - rawSetter(this, unit, value); - moment.updateOffset(this, keepTime); - return this; - } else { - return rawGetter(this, unit); - } - }; + else if (radioButton2.checked == true) { + options = "var options = {"; + options += "physics: {barnesHut: {enabled: false}"; + if (this.constants.physics.repulsion.nodeDistance != this.backupConstants.physics.repulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.repulsion.nodeDistance);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.repulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.repulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.repulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.repulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options += ", repulsion: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}}' + } + if (optionsSpecific.length == 0) {options += "}"} + if (this.constants.smoothCurves != this.backupConstants.smoothCurves) { + options += ", smoothCurves: " + this.constants.smoothCurves; + } + options += '};' + } + else { + options = "var options = {"; + if (this.constants.physics.hierarchicalRepulsion.nodeDistance != this.backupConstants.physics.hierarchicalRepulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.hierarchicalRepulsion.nodeDistance);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.hierarchicalRepulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.hierarchicalRepulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.hierarchicalRepulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.hierarchicalRepulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options += "physics: {hierarchicalRepulsion: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", "; + } + } + options += '}},'; + } + options += 'hierarchicalLayout: {'; + optionsSpecific = []; + if (this.constants.hierarchicalLayout.direction != this.backupConstants.hierarchicalLayout.direction) {optionsSpecific.push("direction: " + this.constants.hierarchicalLayout.direction);} + if (Math.abs(this.constants.hierarchicalLayout.levelSeparation) != this.backupConstants.hierarchicalLayout.levelSeparation) {optionsSpecific.push("levelSeparation: " + this.constants.hierarchicalLayout.levelSeparation);} + if (this.constants.hierarchicalLayout.nodeSpacing != this.backupConstants.hierarchicalLayout.nodeSpacing) {optionsSpecific.push("nodeSpacing: " + this.constants.hierarchicalLayout.nodeSpacing);} + if (optionsSpecific.length != 0) { + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}' + } + else { + options += "enabled:true}"; + } + options += '};' } - moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false); - moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false); - moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false); - // Setting the hour should keep the time, because the user explicitly - // specified which hour he wants. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true); - // moment.fn.month is defined separately - moment.fn.date = makeAccessor('Date', true); - moment.fn.dates = deprecate("dates accessor is deprecated. Use date instead.", makeAccessor('Date', true)); - moment.fn.year = makeAccessor('FullYear', true); - moment.fn.years = deprecate("years accessor is deprecated. Use year instead.", makeAccessor('FullYear', true)); - - // add plural methods - moment.fn.days = moment.fn.day; - moment.fn.months = moment.fn.month; - moment.fn.weeks = moment.fn.week; - moment.fn.isoWeeks = moment.fn.isoWeek; - moment.fn.quarters = moment.fn.quarter; - - // add aliased format methods - moment.fn.toJSON = moment.fn.toISOString; - - /************************************ - Duration Prototype - ************************************/ - - - extend(moment.duration.fn = Duration.prototype, { - - _bubble : function () { - var milliseconds = this._milliseconds, - days = this._days, - months = this._months, - data = this._data, - seconds, minutes, hours, years; - - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; - - seconds = absRound(milliseconds / 1000); - data.seconds = seconds % 60; - - minutes = absRound(seconds / 60); - data.minutes = minutes % 60; - hours = absRound(minutes / 60); - data.hours = hours % 24; + this.optionsDiv.innerHTML = options; + } - days += absRound(hours / 24); - data.days = days % 30; + /** + * this is used to switch between barnesHut, repulsion and hierarchical. + * + */ + function switchConfigurations () { + var ids = ["graph_BH_table", "graph_R_table", "graph_H_table"]; + var radioButton = document.querySelector('input[name="graph_physicsMethod"]:checked').value; + var tableId = "graph_" + radioButton + "_table"; + var table = document.getElementById(tableId); + table.style.display = "block"; + for (var i = 0; i < ids.length; i++) { + if (ids[i] != tableId) { + table = document.getElementById(ids[i]); + table.style.display = "none"; + } + } + this._restoreNodes(); + if (radioButton == "R") { + this.constants.hierarchicalLayout.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = false; + this.constants.physics.barnesHut.enabled = false; + } + else if (radioButton == "H") { + if (this.constants.hierarchicalLayout.enabled == false) { + this.constants.hierarchicalLayout.enabled = true; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this.constants.physics.barnesHut.enabled = false; + this.constants.smoothCurves.enabled = false; + this._setupHierarchicalLayout(); + } + } + else { + this.constants.hierarchicalLayout.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = false; + this.constants.physics.barnesHut.enabled = true; + } + this._loadSelectedForceSolver(); + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + if (this.constants.smoothCurves.enabled == true) {graph_toggleSmooth.style.background = "#A4FF56";} + else {graph_toggleSmooth.style.background = "#FF8532";} + this.moving = true; + this.start(); + } - months += absRound(days / 30); - data.months = months % 12; - years = absRound(months / 12); - data.years = years; - }, + /** + * this generates the ranges depending on the iniital values. + * + * @param id + * @param map + * @param constantsVariableName + */ + function showValueOfRange (id,map,constantsVariableName) { + var valueId = id + "_value"; + var rangeValue = document.getElementById(id).value; - weeks : function () { - return absRound(this.days() / 7); - }, + if (map instanceof Array) { + document.getElementById(valueId).value = map[parseInt(rangeValue)]; + this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]); + } + else { + document.getElementById(valueId).value = parseInt(map) * parseFloat(rangeValue); + this._overWriteGraphConstants(constantsVariableName, parseInt(map) * parseFloat(rangeValue)); + } - valueOf : function () { - return this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6; - }, + if (constantsVariableName == "hierarchicalLayout_direction" || + constantsVariableName == "hierarchicalLayout_levelSeparation" || + constantsVariableName == "hierarchicalLayout_nodeSpacing") { + this._setupHierarchicalLayout(); + } + this.moving = true; + this.start(); + } - humanize : function (withSuffix) { - var difference = +this, - output = relativeTime(difference, !withSuffix, this.lang()); - if (withSuffix) { - output = this.lang().pastFuture(difference, output); - } +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { - return this.lang().postformat(output); - }, + var map = {}; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; - add : function (input, val) { - // supports only 2.0-style add(1, 's') or add(moment) - var dur = moment.duration(input, val); - this._milliseconds += dur._milliseconds; - this._days += dur._days; - this._months += dur._months; +/***/ }, +/* 57 */ +/***/ function(module, exports, __webpack_require__) { - this._bubble(); + /** + * Calculate the forces the nodes apply on each other based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ + exports._calculateNodeForces = function () { + var dx, dy, angle, distance, fx, fy, combinedClusterSize, + repulsingForce, node1, node2, i, j; - return this; - }, + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; - subtract : function (input, val) { - var dur = moment.duration(input, val); + // approximation constants + var a_base = -2 / 3; + var b = 4 / 3; - this._milliseconds -= dur._milliseconds; - this._days -= dur._days; - this._months -= dur._months; + // repulsing forces between nodes + var nodeDistance = this.constants.physics.repulsion.nodeDistance; + var minimumDistance = nodeDistance; - this._bubble(); + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j + for (i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; + combinedClusterSize = node1.clusterSize + node2.clusterSize - 2; - return this; - }, + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); - get : function (units) { - units = normalizeUnits(units); - return this[units.toLowerCase() + 's'](); - }, + minimumDistance = (combinedClusterSize == 0) ? nodeDistance : (nodeDistance * (1 + combinedClusterSize * this.constants.clustering.distanceAmplification)); + var a = a_base / minimumDistance; + if (distance < 2 * minimumDistance) { + if (distance < 0.5 * minimumDistance) { + repulsingForce = 1.0; + } + else { + repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / minimumDistance - 1) * steepness)) + } - as : function (units) { - units = normalizeUnits(units); - return this['as' + units.charAt(0).toUpperCase() + units.slice(1) + 's'](); - }, + // amplify the repulsion for clusters. + repulsingForce *= (combinedClusterSize == 0) ? 1 : 1 + combinedClusterSize * this.constants.clustering.forceAmplification; + repulsingForce = repulsingForce / distance; - lang : moment.fn.lang, - - toIsoString : function () { - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var years = Math.abs(this.years()), - months = Math.abs(this.months()), - days = Math.abs(this.days()), - hours = Math.abs(this.hours()), - minutes = Math.abs(this.minutes()), - seconds = Math.abs(this.seconds() + this.milliseconds() / 1000); - - if (!this.asSeconds()) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } + fx = dx * repulsingForce; + fy = dy * repulsingForce; - return (this.asSeconds() < 0 ? '-' : '') + - 'P' + - (years ? years + 'Y' : '') + - (months ? months + 'M' : '') + - (days ? days + 'D' : '') + - ((hours || minutes || seconds) ? 'T' : '') + - (hours ? hours + 'H' : '') + - (minutes ? minutes + 'M' : '') + - (seconds ? seconds + 'S' : ''); + node1.fx -= fx; + node1.fy -= fy; + node2.fx += fx; + node2.fy += fy; } - }); - - function makeDurationGetter(name) { - moment.duration.fn[name] = function () { - return this._data[name]; - }; - } - - function makeDurationAsGetter(name, factor) { - moment.duration.fn['as' + name] = function () { - return +this / factor; - }; + } } + }; - for (i in unitMillisecondFactors) { - if (unitMillisecondFactors.hasOwnProperty(i)) { - makeDurationAsGetter(i, unitMillisecondFactors[i]); - makeDurationGetter(i.toLowerCase()); - } - } - makeDurationAsGetter('Weeks', 6048e5); - moment.duration.fn.asMonths = function () { - return (+this - this.years() * 31536e6) / 2592e6 + this.years() * 12; - }; +/***/ }, +/* 58 */ +/***/ function(module, exports, __webpack_require__) { + /** + * Calculate the forces the nodes apply on eachother based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ + exports._calculateNodeForces = function () { + var dx, dy, distance, fx, fy, + repulsingForce, node1, node2, i, j; - /************************************ - Default Lang - ************************************/ + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + // repulsing forces between nodes + var nodeDistance = this.constants.physics.hierarchicalRepulsion.nodeDistance; - // Set default language, other languages will inherit from English. - moment.lang('en', { - ordinal : function (number) { - var b = number % 10, - output = (toInt(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j + for (i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; - /* EMBED_LANGUAGES */ + // nodes only affect nodes on their level + if (node1.level == node2.level) { - /************************************ - Exposing Moment - ************************************/ + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); - function makeGlobal(shouldDeprecate) { - /*global ender:false */ - if (typeof ender !== 'undefined') { - return; - } - oldGlobalMoment = globalScope.moment; - if (shouldDeprecate) { - globalScope.moment = deprecate( - "Accessing Moment through the global scope is " + - "deprecated, and will be removed in an upcoming " + - "release.", - moment); - } else { - globalScope.moment = moment; - } - } - // CommonJS module is defined - if (hasModule) { - module.exports = moment; - } else if (typeof define === "function" && define.amd) { - define("moment", function (require, exports, module) { - if (module.config && module.config() && module.config().noGlobal === true) { - // release the global variable - globalScope.moment = oldGlobalMoment; + var steepness = 0.05; + if (distance < nodeDistance) { + repulsingForce = -Math.pow(steepness*distance,2) + Math.pow(steepness*nodeDistance,2); + } + else { + repulsingForce = 0; + } + // normalize force with + if (distance == 0) { + distance = 0.01; + } + else { + repulsingForce = repulsingForce / distance; } + fx = dx * repulsingForce; + fy = dy * repulsingForce; - return moment; - }); - makeGlobal(true); - } else { - makeGlobal(); + node1.fx -= fx; + node1.fy -= fy; + node2.fx += fx; + node2.fy += fy; + } + } } -}).call(this); + }; -},{}],5:[function(require,module,exports){ -/** - * Copyright 2012 Craig Campbell - * - * 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. - * - * Mousetrap is a simple keyboard shortcut library for Javascript with - * no external dependencies - * - * @version 1.1.2 - * @url craig.is/killing/mice - */ /** - * mapping of special keycodes to their corresponding keys - * - * everything in this dictionary cannot use keypress events - * so it has to be here to map to the correct keycodes for - * keyup/keydown events + * this function calculates the effects of the springs in the case of unsmooth curves. * - * @type {Object} + * @private */ - var _MAP = { - 8: 'backspace', - 9: 'tab', - 13: 'enter', - 16: 'shift', - 17: 'ctrl', - 18: 'alt', - 20: 'capslock', - 27: 'esc', - 32: 'space', - 33: 'pageup', - 34: 'pagedown', - 35: 'end', - 36: 'home', - 37: 'left', - 38: 'up', - 39: 'right', - 40: 'down', - 45: 'ins', - 46: 'del', - 91: 'meta', - 93: 'meta', - 224: 'meta' - }, - - /** - * mapping for special characters so they can support - * - * this dictionary is only used incase you want to bind a - * keyup or keydown event to one of these keys - * - * @type {Object} - */ - _KEYCODE_MAP = { - 106: '*', - 107: '+', - 109: '-', - 110: '.', - 111 : '/', - 186: ';', - 187: '=', - 188: ',', - 189: '-', - 190: '.', - 191: '/', - 192: '`', - 219: '[', - 220: '\\', - 221: ']', - 222: '\'' - }, - - /** - * this is a mapping of keys that require shift on a US keypad - * back to the non shift equivelents - * - * this is so you can use keyup events with these keys - * - * note that this will only work reliably on US keyboards - * - * @type {Object} - */ - _SHIFT_MAP = { - '~': '`', - '!': '1', - '@': '2', - '#': '3', - '$': '4', - '%': '5', - '^': '6', - '&': '7', - '*': '8', - '(': '9', - ')': '0', - '_': '-', - '+': '=', - ':': ';', - '\"': '\'', - '<': ',', - '>': '.', - '?': '/', - '|': '\\' - }, - - /** - * this is a list of special strings you can use to map - * to modifier keys when you specify your keyboard shortcuts - * - * @type {Object} - */ - _SPECIAL_ALIASES = { - 'option': 'alt', - 'command': 'meta', - 'return': 'enter', - 'escape': 'esc' - }, - - /** - * variable to store the flipped version of _MAP from above - * needed to check if we should use keypress or not when no action - * is specified - * - * @type {Object|undefined} - */ - _REVERSE_MAP, + exports._calculateHierarchicalSpringForces = function () { + var edgeLength, edge, edgeId; + var dx, dy, fx, fy, springForce, distance; + var edges = this.edges; - /** - * a list of all the callbacks setup via Mousetrap.bind() - * - * @type {Object} - */ - _callbacks = {}, + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; - /** - * direct map of string combinations to callbacks used for trigger() - * - * @type {Object} - */ - _direct_map = {}, - /** - * keeps track of what level each sequence is at since multiple - * sequences can start out with the same sequence - * - * @type {Object} - */ - _sequence_levels = {}, + for (var i = 0; i < nodeIndices.length; i++) { + var node1 = nodes[nodeIndices[i]]; + node1.springFx = 0; + node1.springFy = 0; + } - /** - * variable to store the setTimeout call - * - * @type {null|number} - */ - _reset_timer, - /** - * temporary state where we will ignore the next keyup - * - * @type {boolean|string} - */ - _ignore_next_keyup = false, + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + // this implies that the edges between big clusters are longer + edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; - /** - * are we currently inside of a sequence? - * type of action ("keyup" or "keydown" or "keypress") or false - * - * @type {boolean|string} - */ - _inside_sequence = false; + dx = (edge.from.x - edge.to.x); + dy = (edge.from.y - edge.to.y); + distance = Math.sqrt(dx * dx + dy * dy); - /** - * loop through the f keys, f1 to f19 and add them to the map - * programatically - */ - for (var i = 1; i < 20; ++i) { - _MAP[111 + i] = 'f' + i; - } + if (distance == 0) { + distance = 0.01; + } - /** - * loop through to map numbers on the numeric keypad - */ - for (i = 0; i <= 9; ++i) { - _MAP[i + 96] = i; - } + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; - /** - * cross browser add event method - * - * @param {Element|HTMLDocument} object - * @param {string} type - * @param {Function} callback - * @returns void - */ - function _addEvent(object, type, callback) { - if (object.addEventListener) { - return object.addEventListener(type, callback, false); - } + fx = dx * springForce; + fy = dy * springForce; - object.attachEvent('on' + type, callback); - } - /** - * takes the event and returns the key character - * - * @param {Event} e - * @return {string} - */ - function _characterFromEvent(e) { - // for keypress events we should return the character as is - if (e.type == 'keypress') { - return String.fromCharCode(e.which); + if (edge.to.level != edge.from.level) { + edge.to.springFx -= fx; + edge.to.springFy -= fy; + edge.from.springFx += fx; + edge.from.springFy += fy; + } + else { + var factor = 0.5; + edge.to.fx -= factor*fx; + edge.to.fy -= factor*fy; + edge.from.fx += factor*fx; + edge.from.fy += factor*fy; + } + } + } } + } - // for non keypress events the special maps are needed - if (_MAP[e.which]) { - return _MAP[e.which]; - } + // normalize spring forces + var springForce = 1; + var springFx, springFy; + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + springFx = Math.min(springForce,Math.max(-springForce,node.springFx)); + springFy = Math.min(springForce,Math.max(-springForce,node.springFy)); - if (_KEYCODE_MAP[e.which]) { - return _KEYCODE_MAP[e.which]; - } + node.fx += springFx; + node.fy += springFy; + } - // if it is not in the special map - return String.fromCharCode(e.which).toLowerCase(); - } + // retain energy balance + var totalFx = 0; + var totalFy = 0; + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + totalFx += node.fx; + totalFy += node.fy; + } + var correctionFx = totalFx / nodeIndices.length; + var correctionFy = totalFy / nodeIndices.length; - /** - * should we stop this event before firing off callbacks - * - * @param {Event} e - * @return {boolean} - */ - function _stop(e) { - var element = e.target || e.srcElement, - tag_name = element.tagName; + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + node.fx -= correctionFx; + node.fy -= correctionFy; + } - // if the element has the class "mousetrap" then no need to stop - if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) { - return false; - } + }; - // stop for input, select, and textarea - return tag_name == 'INPUT' || tag_name == 'SELECT' || tag_name == 'TEXTAREA' || (element.contentEditable && element.contentEditable == 'true'); - } +/***/ }, +/* 59 */ +/***/ function(module, exports, __webpack_require__) { /** - * checks if two arrays are equal + * This function calculates the forces the nodes apply on eachother based on a gravitational model. + * The Barnes Hut method is used to speed up this N-body simulation. * - * @param {Array} modifiers1 - * @param {Array} modifiers2 - * @returns {boolean} + * @private */ - function _modifiersMatch(modifiers1, modifiers2) { - return modifiers1.sort().join(',') === modifiers2.sort().join(','); - } + exports._calculateNodeForces = function() { + if (this.constants.physics.barnesHut.gravitationalConstant != 0) { + var node; + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + var nodeCount = nodeIndices.length; - /** - * resets all sequence counters except for the ones passed in - * - * @param {Object} do_not_reset - * @returns void - */ - function _resetSequences(do_not_reset) { - do_not_reset = do_not_reset || {}; + this._formBarnesHutTree(nodes,nodeIndices); - var active_sequences = false, - key; + var barnesHutTree = this.barnesHutTree; - for (key in _sequence_levels) { - if (do_not_reset[key]) { - active_sequences = true; - continue; - } - _sequence_levels[key] = 0; + // place the nodes one by one recursively + for (var i = 0; i < nodeCount; i++) { + node = nodes[nodeIndices[i]]; + // starting with root is irrelevant, it never passes the BarnesHut condition + this._getForceContribution(barnesHutTree.root.children.NW,node); + this._getForceContribution(barnesHutTree.root.children.NE,node); + this._getForceContribution(barnesHutTree.root.children.SW,node); + this._getForceContribution(barnesHutTree.root.children.SE,node); } + } + }; - if (!active_sequences) { - _inside_sequence = false; - } - } /** - * finds all callbacks that match based on the keycode, modifiers, - * and action + * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. + * If a region contains a single node, we check if it is not itself, then we apply the force. * - * @param {string} character - * @param {Array} modifiers - * @param {string} action - * @param {boolean=} remove - should we remove any matches - * @param {string=} combination - * @returns {Array} + * @param parentBranch + * @param node + * @private */ - function _getMatches(character, modifiers, action, remove, combination) { - var i, - callback, - matches = []; + exports._getForceContribution = function(parentBranch,node) { + // we get no force contribution from an empty region + if (parentBranch.childrenCount > 0) { + var dx,dy,distance; - // if there are no events related to this keycode - if (!_callbacks[character]) { - return []; - } + // get the distance from the center of mass to the node. + dx = parentBranch.centerOfMass.x - node.x; + dy = parentBranch.centerOfMass.y - node.y; + distance = Math.sqrt(dx * dx + dy * dy); - // if a modifier key is coming up on its own we should allow it - if (action == 'keyup' && _isModifier(character)) { - modifiers = [character]; + // BarnesHut condition + // original condition : s/d < theta = passed === d/s > 1/theta = passed + // calcSize = 1/s --> d * 1/s > 1/theta = passed + if (distance * parentBranch.calcSize > this.constants.physics.barnesHut.theta) { + // duplicate code to reduce function calls to speed up program + if (distance == 0) { + distance = 0.1*Math.random(); + dx = distance; + } + var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); + var fx = dx * gravityForce; + var fy = dy * gravityForce; + node.fx += fx; + node.fy += fy; } - - // loop through all callbacks for the key that was pressed - // and see if any of them match - for (i = 0; i < _callbacks[character].length; ++i) { - callback = _callbacks[character][i]; - - // if this is a sequence but it is not at the right level - // then move onto the next match - if (callback.seq && _sequence_levels[callback.seq] != callback.level) { - continue; - } - - // if the action we are looking for doesn't match the action we got - // then we should keep going - if (action != callback.action) { - continue; - } - - // if this is a keypress event that means that we need to only - // look at the character, otherwise check the modifiers as - // well - if (action == 'keypress' || _modifiersMatch(modifiers, callback.modifiers)) { - - // remove is used so if you change your mind and call bind a - // second time with a new function the first one is overwritten - if (remove && callback.combo == combination) { - _callbacks[character].splice(i, 1); - } - - matches.push(callback); + else { + // Did not pass the condition, go into children if available + if (parentBranch.childrenCount == 4) { + this._getForceContribution(parentBranch.children.NW,node); + this._getForceContribution(parentBranch.children.NE,node); + this._getForceContribution(parentBranch.children.SW,node); + this._getForceContribution(parentBranch.children.SE,node); + } + else { // parentBranch must have only one node, if it was empty we wouldnt be here + if (parentBranch.children.data.id != node.id) { // if it is not self + // duplicate code to reduce function calls to speed up program + if (distance == 0) { + distance = 0.5*Math.random(); + dx = distance; + } + var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); + var fx = dx * gravityForce; + var fy = dy * gravityForce; + node.fx += fx; + node.fy += fy; } + } } - - return matches; - } + } + }; /** - * takes a key event and figures out what the modifiers are + * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. * - * @param {Event} e - * @returns {Array} + * @param nodes + * @param nodeIndices + * @private */ - function _eventModifiers(e) { - var modifiers = []; + exports._formBarnesHutTree = function(nodes,nodeIndices) { + var node; + var nodeCount = nodeIndices.length; - if (e.shiftKey) { - modifiers.push('shift'); - } + var minX = Number.MAX_VALUE, + minY = Number.MAX_VALUE, + maxX =-Number.MAX_VALUE, + maxY =-Number.MAX_VALUE; - if (e.altKey) { - modifiers.push('alt'); - } + // get the range of the nodes + for (var i = 0; i < nodeCount; i++) { + var x = nodes[nodeIndices[i]].x; + var y = nodes[nodeIndices[i]].y; + if (x < minX) { minX = x; } + if (x > maxX) { maxX = x; } + if (y < minY) { minY = y; } + if (y > maxY) { maxY = y; } + } + // make the range a square + var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y + if (sizeDiff > 0) {minY -= 0.5 * sizeDiff; maxY += 0.5 * sizeDiff;} // xSize > ySize + else {minX += 0.5 * sizeDiff; maxX -= 0.5 * sizeDiff;} // xSize < ySize - if (e.ctrlKey) { - modifiers.push('ctrl'); - } - if (e.metaKey) { - modifiers.push('meta'); - } + var minimumTreeSize = 1e-5; + var rootSize = Math.max(minimumTreeSize,Math.abs(maxX - minX)); + var halfRootSize = 0.5 * rootSize; + var centerX = 0.5 * (minX + maxX), centerY = 0.5 * (minY + maxY); - return modifiers; - } + // construct the barnesHutTree + var barnesHutTree = { + root:{ + centerOfMass: {x:0, y:0}, + mass:0, + range: { + minX: centerX-halfRootSize,maxX:centerX+halfRootSize, + minY: centerY-halfRootSize,maxY:centerY+halfRootSize + }, + size: rootSize, + calcSize: 1 / rootSize, + children: { data:null}, + maxWidth: 0, + level: 0, + childrenCount: 4 + } + }; + this._splitBranch(barnesHutTree.root); - /** - * actually calls the callback function - * - * if your callback function returns false this will use the jquery - * convention - prevent default and stop propogation on the event - * - * @param {Function} callback - * @param {Event} e - * @returns void - */ - function _fireCallback(callback, e) { - if (callback(e) === false) { - if (e.preventDefault) { - e.preventDefault(); - } + // place the nodes one by one recursively + for (i = 0; i < nodeCount; i++) { + node = nodes[nodeIndices[i]]; + this._placeInTree(barnesHutTree.root,node); + } - if (e.stopPropagation) { - e.stopPropagation(); - } + // make global + this.barnesHutTree = barnesHutTree + }; - e.returnValue = false; - e.cancelBubble = true; - } - } /** - * handles a character key event + * this updates the mass of a branch. this is increased by adding a node. * - * @param {string} character - * @param {Event} e - * @returns void + * @param parentBranch + * @param node + * @private */ - function _handleCharacter(character, e) { + exports._updateBranchMass = function(parentBranch, node) { + var totalMass = parentBranch.mass + node.mass; + var totalMassInv = 1/totalMass; - // if this event should not happen stop here - if (_stop(e)) { - return; - } + parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.mass; + parentBranch.centerOfMass.x *= totalMassInv; - var callbacks = _getMatches(character, _eventModifiers(e), e.type), - i, - do_not_reset = {}, - processed_sequence_callback = false; + parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.mass; + parentBranch.centerOfMass.y *= totalMassInv; + + parentBranch.mass = totalMass; + var biggestSize = Math.max(Math.max(node.height,node.radius),node.width); + parentBranch.maxWidth = (parentBranch.maxWidth < biggestSize) ? biggestSize : parentBranch.maxWidth; - // loop through matching callbacks for this key event - for (i = 0; i < callbacks.length; ++i) { + }; - // fire for all sequence callbacks - // this is because if for example you have multiple sequences - // bound such as "g i" and "g t" they both need to fire the - // callback for matching g cause otherwise you can only ever - // match the first one - if (callbacks[i].seq) { - processed_sequence_callback = true; - // keep a list of which sequences were matches for later - do_not_reset[callbacks[i].seq] = 1; - _fireCallback(callbacks[i].callback, e); - continue; - } + /** + * determine in which branch the node will be placed. + * + * @param parentBranch + * @param node + * @param skipMassUpdate + * @private + */ + exports._placeInTree = function(parentBranch,node,skipMassUpdate) { + if (skipMassUpdate != true || skipMassUpdate === undefined) { + // update the mass of the branch. + this._updateBranchMass(parentBranch,node); + } - // if there were no sequence matches but we are still here - // that means this is a regular match so we should fire that - if (!processed_sequence_callback && !_inside_sequence) { - _fireCallback(callbacks[i].callback, e); - } + if (parentBranch.children.NW.range.maxX > node.x) { // in NW or SW + if (parentBranch.children.NW.range.maxY > node.y) { // in NW + this._placeInRegion(parentBranch,node,"NW"); } - - // if you are inside of a sequence and the key you are pressing - // is not a modifier key then we should reset all sequences - // that were not matched by this key event - if (e.type == _inside_sequence && !_isModifier(character)) { - _resetSequences(do_not_reset); + else { // in SW + this._placeInRegion(parentBranch,node,"SW"); } - } - - /** - * handles a keydown event - * - * @param {Event} e - * @returns void - */ - function _handleKey(e) { - - // normalize e.which for key events - // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion - e.which = typeof e.which == "number" ? e.which : e.keyCode; - - var character = _characterFromEvent(e); - - // no character found then stop - if (!character) { - return; + } + else { // in NE or SE + if (parentBranch.children.NW.range.maxY > node.y) { // in NE + this._placeInRegion(parentBranch,node,"NE"); } - - if (e.type == 'keyup' && _ignore_next_keyup == character) { - _ignore_next_keyup = false; - return; + else { // in SE + this._placeInRegion(parentBranch,node,"SE"); } + } + }; - _handleCharacter(character, e); - } /** - * determines if the keycode specified is a modifier key or not + * actually place the node in a region (or branch) * - * @param {string} key - * @returns {boolean} + * @param parentBranch + * @param node + * @param region + * @private */ - function _isModifier(key) { - return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta'; - } + exports._placeInRegion = function(parentBranch,node,region) { + switch (parentBranch.children[region].childrenCount) { + case 0: // place node here + parentBranch.children[region].children.data = node; + parentBranch.children[region].childrenCount = 1; + this._updateBranchMass(parentBranch.children[region],node); + break; + case 1: // convert into children + // if there are two nodes exactly overlapping (on init, on opening of cluster etc.) + // we move one node a pixel and we do not put it in the tree. + if (parentBranch.children[region].children.data.x == node.x && + parentBranch.children[region].children.data.y == node.y) { + node.x += Math.random(); + node.y += Math.random(); + } + else { + this._splitBranch(parentBranch.children[region]); + this._placeInTree(parentBranch.children[region],node); + } + break; + case 4: // place in branch + this._placeInTree(parentBranch.children[region],node); + break; + } + }; - /** - * called to set a 1 second timeout on the specified sequence - * - * this is so after each key press in the sequence you have 1 second - * to press the next key before you have to start over - * - * @returns void - */ - function _resetSequenceTimer() { - clearTimeout(_reset_timer); - _reset_timer = setTimeout(_resetSequences, 1000); - } /** - * reverses the map lookup so that we can look for specific keys - * to see what can and can't use keypress + * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch + * after the split is complete. * - * @return {Object} + * @param parentBranch + * @private */ - function _getReverseMap() { - if (!_REVERSE_MAP) { - _REVERSE_MAP = {}; - for (var key in _MAP) { + exports._splitBranch = function(parentBranch) { + // if the branch is shaded with a node, replace the node in the new subset. + var containedNode = null; + if (parentBranch.childrenCount == 1) { + containedNode = parentBranch.children.data; + parentBranch.mass = 0; parentBranch.centerOfMass.x = 0; parentBranch.centerOfMass.y = 0; + } + parentBranch.childrenCount = 4; + parentBranch.children.data = null; + this._insertRegion(parentBranch,"NW"); + this._insertRegion(parentBranch,"NE"); + this._insertRegion(parentBranch,"SW"); + this._insertRegion(parentBranch,"SE"); - // pull out the numeric keypad from here cause keypress should - // be able to detect the keys from the character - if (key > 95 && key < 112) { - continue; - } + if (containedNode != null) { + this._placeInTree(parentBranch,containedNode); + } + }; - if (_MAP.hasOwnProperty(key)) { - _REVERSE_MAP[_MAP[key]] = key; - } - } - } - return _REVERSE_MAP; - } /** - * picks the best action based on the key combination + * This function subdivides the region into four new segments. + * Specifically, this inserts a single new segment. + * It fills the children section of the parentBranch * - * @param {string} key - character for key - * @param {Array} modifiers - * @param {string=} action passed in + * @param parentBranch + * @param region + * @param parentRange + * @private */ - function _pickBestAction(key, modifiers, action) { + exports._insertRegion = function(parentBranch, region) { + var minX,maxX,minY,maxY; + var childSize = 0.5 * parentBranch.size; + switch (region) { + case "NW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "NE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "SW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; + case "SE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; + } - // if no action was picked in we should try to pick the one - // that we think would work best for this key - if (!action) { - action = _getReverseMap()[key] ? 'keydown' : 'keypress'; - } - // modifier keys don't work as expected with keypress, - // switch to keydown - if (action == 'keypress' && modifiers.length) { - action = 'keydown'; - } + parentBranch.children[region] = { + centerOfMass:{x:0,y:0}, + mass:0, + range:{minX:minX,maxX:maxX,minY:minY,maxY:maxY}, + size: 0.5 * parentBranch.size, + calcSize: 2 * parentBranch.calcSize, + children: {data:null}, + maxWidth: 0, + level: parentBranch.level+1, + childrenCount: 0 + }; + }; - return action; - } /** - * binds a key sequence to an event + * This function is for debugging purposed, it draws the tree. * - * @param {string} combo - combo specified in bind call - * @param {Array} keys - * @param {Function} callback - * @param {string=} action - * @returns void + * @param ctx + * @param color + * @private */ - function _bindSequence(combo, keys, callback, action) { - - // start off by adding a sequence level record for this combination - // and setting the level to 0 - _sequence_levels[combo] = 0; - - // if there is no action pick the best one for the first key - // in the sequence - if (!action) { - action = _pickBestAction(keys[0], []); - } - - /** - * callback to increase the sequence level for this sequence and reset - * all other sequences that were active - * - * @param {Event} e - * @returns void - */ - var _increaseSequence = function(e) { - _inside_sequence = action; - ++_sequence_levels[combo]; - _resetSequenceTimer(); - }, + exports._drawTree = function(ctx,color) { + if (this.barnesHutTree !== undefined) { - /** - * wraps the specified callback inside of another function in order - * to reset all sequence counters as soon as this sequence is done - * - * @param {Event} e - * @returns void - */ - _callbackAndReset = function(e) { - _fireCallback(callback, e); - - // we should ignore the next key up if the action is key down - // or keypress. this is so if you finish a sequence and - // release the key the final key will not trigger a keyup - if (action !== 'keyup') { - _ignore_next_keyup = _characterFromEvent(e); - } + ctx.lineWidth = 1; - // weird race condition if a sequence ends with the key - // another sequence begins with - setTimeout(_resetSequences, 10); - }, - i; + this._drawBranch(this.barnesHutTree.root,ctx,color); + } + }; - // loop through keys one at a time and bind the appropriate callback - // function. for any key leading up to the final one it should - // increase the sequence. after the final, it should reset all sequences - for (i = 0; i < keys.length; ++i) { - _bindSingle(keys[i], i < keys.length - 1 ? _increaseSequence : _callbackAndReset, action, combo, i); - } - } /** - * binds a single keyboard combination + * This function is for debugging purposes. It draws the branches recursively. * - * @param {string} combination - * @param {Function} callback - * @param {string=} action - * @param {string=} sequence_name - name of sequence if part of sequence - * @param {number=} level - what part of the sequence the command is - * @returns void + * @param branch + * @param ctx + * @param color + * @private */ - function _bindSingle(combination, callback, action, sequence_name, level) { - - // make sure multiple spaces in a row become a single space - combination = combination.replace(/\s+/g, ' '); - - var sequence = combination.split(' '), - i, - key, - keys, - modifiers = []; - - // if this pattern is a sequence of keys then run through this method - // to reprocess each pattern one key at a time - if (sequence.length > 1) { - return _bindSequence(combination, sequence, callback, action); - } - - // take the keys from this pattern and figure out what the actual - // pattern is all about - keys = combination === '+' ? ['+'] : combination.split('+'); - - for (i = 0; i < keys.length; ++i) { - key = keys[i]; + exports._drawBranch = function(branch,ctx,color) { + if (color === undefined) { + color = "#FF0000"; + } - // normalize key names - if (_SPECIAL_ALIASES[key]) { - key = _SPECIAL_ALIASES[key]; - } + if (branch.childrenCount == 4) { + this._drawBranch(branch.children.NW,ctx); + this._drawBranch(branch.children.NE,ctx); + this._drawBranch(branch.children.SE,ctx); + this._drawBranch(branch.children.SW,ctx); + } + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(branch.range.minX,branch.range.minY); + ctx.lineTo(branch.range.maxX,branch.range.minY); + ctx.stroke(); - // if this is not a keypress event then we should - // be smart about using shift keys - // this will only work for US keyboards however - if (action && action != 'keypress' && _SHIFT_MAP[key]) { - key = _SHIFT_MAP[key]; - modifiers.push('shift'); - } + ctx.beginPath(); + ctx.moveTo(branch.range.maxX,branch.range.minY); + ctx.lineTo(branch.range.maxX,branch.range.maxY); + ctx.stroke(); - // if this key is a modifier then add it to the list of modifiers - if (_isModifier(key)) { - modifiers.push(key); - } - } + ctx.beginPath(); + ctx.moveTo(branch.range.maxX,branch.range.maxY); + ctx.lineTo(branch.range.minX,branch.range.maxY); + ctx.stroke(); - // depending on what the key combination is - // we will try to pick the best event for it - action = _pickBestAction(key, modifiers, action); + ctx.beginPath(); + ctx.moveTo(branch.range.minX,branch.range.maxY); + ctx.lineTo(branch.range.minX,branch.range.minY); + ctx.stroke(); - // make sure to initialize array if this is the first time - // a callback is added for this key - if (!_callbacks[key]) { - _callbacks[key] = []; - } + /* + if (branch.mass > 0) { + ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass); + ctx.stroke(); + } + */ + }; - // remove an existing match if there is one - _getMatches(key, modifiers, action, !sequence_name, combination); - // add this call back to the array - // if it is a sequence put it at the beginning - // if not put it at the end - // - // this is important because the way these are processed expects - // the sequence ones to come first - _callbacks[key][sequence_name ? 'unshift' : 'push']({ - callback: callback, - modifiers: modifiers, - action: action, - seq: sequence_name, - level: level, - combo: combination - }); - } +/***/ }, +/* 60 */ +/***/ function(module, exports, __webpack_require__) { - /** - * binds multiple combinations to the same callback - * - * @param {Array} combinations - * @param {Function} callback - * @param {string|undefined} action - * @returns void - */ - function _bindMultiple(combinations, callback, action) { - for (var i = 0; i < combinations.length; ++i) { - _bindSingle(combinations[i], callback, action); - } + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; } - // start! - _addEvent(document, 'keypress', _handleKey); - _addEvent(document, 'keydown', _handleKey); - _addEvent(document, 'keyup', _handleKey); - - var mousetrap = { - - /** - * binds an event to mousetrap - * - * can be a single key, a combination of keys separated with +, - * a comma separated list of keys, an array of keys, or - * a sequence of keys separated by spaces - * - * be sure to list the modifier keys first to make sure that the - * correct key ends up getting bound (the last key in the pattern) - * - * @param {string|Array} keys - * @param {Function} callback - * @param {string=} action - 'keypress', 'keydown', or 'keyup' - * @returns void - */ - bind: function(keys, callback, action) { - _bindMultiple(keys instanceof Array ? keys : [keys], callback, action); - _direct_map[keys + ':' + action] = callback; - return this; - }, - - /** - * unbinds an event to mousetrap - * - * the unbinding sets the callback function of the specified key combo - * to an empty function and deletes the corresponding key in the - * _direct_map dict. - * - * the keycombo+action has to be exactly the same as - * it was defined in the bind method - * - * TODO: actually remove this from the _callbacks dictionary instead - * of binding an empty function - * - * @param {string|Array} keys - * @param {string} action - * @returns void - */ - unbind: function(keys, action) { - if (_direct_map[keys + ':' + action]) { - delete _direct_map[keys + ':' + action]; - this.bind(keys, function() {}, action); - } - return this; - }, - - /** - * triggers an event that has already been bound - * - * @param {string} keys - * @param {string=} action - * @returns void - */ - trigger: function(keys, action) { - _direct_map[keys + ':' + action](); - return this; - }, - - /** - * resets the library back to its initial state. this is useful - * if you want to clear out the current keyboard shortcuts and bind - * new ones - for example if you switch to another page - * - * @returns void - */ - reset: function() { - _callbacks = {}; - _direct_map = {}; - return this; - } - }; - -module.exports = mousetrap; - -},{}]},{},[1]) -(1) -}); \ No newline at end of file +/***/ } +/******/ ]) +}) diff --git a/dist/vis.map b/dist/vis.map new file mode 100644 index 00000000..87c2c38c --- /dev/null +++ b/dist/vis.map @@ -0,0 +1 @@ +{"version":3,"file":"vis.map","sources":["./dist/vis.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","util","DOMutil","DataSet","DataView","Graph3d","graph3d","Camera","Filter","Point2d","Point3d","Slider","StepNumber","Timeline","Graph2d","timeline","DataStep","Range","stack","TimeStep","components","items","Item","ItemBox","ItemPoint","ItemRange","Component","CurrentTime","CustomTime","DataAxis","GraphGroup","Group","ItemSet","Legend","LineGraph","TimeAxis","Network","network","Edge","Groups","Images","Node","Popup","dotparser","gephiParser","Graph","Error","moment","hammer","isNumber","object","Number","isString","String","isDate","Date","match","ASPDateRegex","exec","isNaN","parse","isDataTable","google","visualization","DataTable","randomUUID","S4","Math","floor","random","toString","extend","a","i","len","arguments","length","other","prop","hasOwnProperty","selectiveExtend","props","Array","isArray","selectiveDeepExtend","b","TypeError","constructor","Object","undefined","deepExtend","equalArray","convert","type","Boolean","valueOf","isMoment","toDate","getType","toISOString","value","getAbsoluteLeft","elem","getBoundingClientRect","left","window","pageXOffset","getAbsoluteTop","top","pageYOffset","addClassName","className","classes","split","indexOf","push","join","removeClassName","index","splice","forEach","callback","toArray","array","updateProperty","key","addEventListener","element","action","listener","useCapture","navigator","userAgent","attachEvent","removeEventListener","detachEvent","preventDefault","event","returnValue","getTarget","target","srcElement","nodeType","parentNode","option","asBoolean","defaultValue","asNumber","asString","asSize","asElement","GiveDec","Hex","Value","eval","GiveHex","Dec","parseColor","color","isValidRGB","rgb","substr","RGBToHex","isValidHex","hsv","hexToHSV","lighterColorHSV","h","s","v","min","darkerColorHSV","darkerColorHex","HSVToHex","lighterColorHex","background","border","highlight","hover","hexToRGB","hex","replace","toUpperCase","substring","d","e","f","r","g","red","green","blue","RGBToHSV","minRGB","maxRGB","max","hue","saturation","HSVToRGB","q","t","isOk","test","selectiveBridgeObject","fields","referenceObject","objectTo","create","bridgeObject","mergeOptions","mergeTarget","options","enabled","binarySearch","orderedItems","range","field","field2","maxIterations","iteration","found","low","high","newLow","newHigh","guess","isVisible","start","console","log","binarySearchGeneric","sidePreference","newGuess","prevValue","nextValue","prepareElements","JSONcontainer","elementType","redundant","used","cleanupElements","removeChild","getSVGElement","svgContainer","shift","document","createElementNS","appendChild","getDOMElement","DOMContainer","createElement","drawPoint","x","y","group","point","drawPoints","style","setAttributeNS","size","drawBar","width","height","rect","data","_options","_data","_fieldId","fieldId","_type","_subscribers","add","prototype","on","subscribers","subscribe","off","filter","unsubscribe","_trigger","params","senderId","concat","subscriber","addedIds","me","_addItem","columns","_getColumnNames","row","rows","getNumberOfRows","item","col","cols","getValue","update","updatedIds","addOrUpdate","_updateItem","get","ids","firstType","returnType","allowedValues","itemId","_getItem","order","_sort","_filterFields","_appendRow","result","getIds","getDataSet","map","mappedItems","filteredItem","name","sort","av","bv","remove","removedId","removedIds","_remove","clear","keys","maxField","itemField","minField","distinct","values","fieldType","count","exists","types","raw","converted","JSON","stringify","dataTable","getNumberOfColumns","getColumnId","getColumnLabel","addRow","setValue","_ids","_onEvent","apply","setData","viewOptions","getArguments","defaultFilter","dataSet","added","updated","removed","container","SyntaxError","containerElement","margin","defaultXCenter","defaultYCenter","xLabel","yLabel","zLabel","filterLabel","legendLabel","STYLE","DOT","showPerspective","showGrid","keepAspectRatio","showShadow","showGrayBottom","showTooltip","verticalRatio","animationInterval","animationPreload","camera","eye","dataPoints","colX","colY","colZ","colValue","colFilter","xMin","xStep","xMax","yMin","yStep","yMax","zMin","zStep","zMax","valueMin","valueMax","xBarWidth","yBarWidth","colorAxis","colorGrid","colorDot","colorDotBorder","setOptions","Emitter","_setScale","scale","z","xCenter","yCenter","zCenter","setArmLocation","_convert3Dto2D","point3d","translation","_convertPointToTranslation","_convertTranslationToScreen","ax","ay","az","cx","getCameraLocation","cy","cz","sinTx","sin","getCameraRotation","cosTx","cos","sinTy","cosTy","sinTz","cosTz","dx","dy","dz","bx","by","ex","ey","ez","getArmLength","xcenter","frame","canvas","clientWidth","ycenter","_setBackgroundColor","backgroundColor","fill","stroke","strokeWidth","borderColor","borderWidth","borderStyle","BAR","BARCOLOR","BARSIZE","DOTLINE","DOTCOLOR","DOTSIZE","GRID","LINE","SURFACE","_getStyleNumber","styleName","_determineColumnIndexes","counter","column","getDistinctValues","distinctValues","getColumnRange","minMax","_dataInitialize","rawData","_onChange","dataFilter","setOnLoadCallback","redraw","withBars","defaultXBarWidth","dataX","defaultYBarWidth","dataY","xRange","defaultXMin","defaultXMax","defaultXStep","yRange","defaultYMin","defaultYMax","defaultYStep","zRange","defaultZMin","defaultZMax","defaultZStep","valueRange","defaultValueMin","defaultValueMax","_getDataPoints","sortNumber","obj","dataMatrix","xIndex","yIndex","trans","screen","bottom","pointRight","pointTop","pointCross","hasChildNodes","firstChild","position","overflow","noCanvas","fontWeight","padding","innerHTML","onmousedown","_onMouseDown","ontouchstart","_onTouchStart","onmousewheel","_onWheel","ontooltip","_onTooltip","onkeydown","setSize","_resizeCanvas","clientHeight","animationStart","slider","play","animationStop","stop","_resizeCenter","charAt","parseFloat","setCameraPosition","pos","horizontal","vertical","setArmRotation","distance","setArmLength","getCameraPosition","getArmRotation","_readData","_redrawFilter","animationAutoStart","cameraPosition","styleNumber","tooltip","showAnimationControls","_redrawSlider","_redrawClear","_redrawAxis","_redrawDataGrid","_redrawDataLine","_redrawDataBar","_redrawDataDot","_redrawInfo","_redrawLegend","ctx","getContext","clearRect","widthMin","widthMax","dotSize","right","lineWidth","font","ymin","ymax","_hsv2rgb","strokeStyle","beginPath","moveTo","lineTo","strokeRect","fillStyle","closePath","gridLineLen","step","getCurrent","next","end","textAlign","textBaseline","fillText","label","visible","setValues","setPlayInterval","onchange","getIndex","selectValue","setOnChangeCallback","lineStyle","getLabel","getSelectedValue","from","to","prettyStep","text","xText","yText","zText","offset","xOffset","yOffset","xMin2d","xMax2d","gridLenX","gridLenY","textMargin","armAngle","H","S","V","R","G","B","C","Hi","X","abs","parseInt","cross","topSideVisible","zAvg","transBottom","dist","sortDepth","aDiff","subtract","bDiff","crossproduct","crossProduct","radius","arc","PI","j","surface","corners","xWidth","yWidth","surfaces","center","avg","transCenter","diff","leftButtonDown","_onMouseUp","which","button","touchDown","startMouseX","getMouseX","startMouseY","getMouseY","startStart","startEnd","startArmRotation","cursor","onmousemove","_onMouseMove","onmouseup","diffX","diffY","horizontalNew","verticalNew","snapAngle","snapValue","round","parameters","emit","delay","mouseX","mouseY","tooltipTimeout","clearTimeout","_hideTooltip","dataPoint","_dataPointFromXY","_showTooltip","setTimeout","ontouchmove","_onTouchMove","ontouchend","_onTouchEnd","delta","wheelDelta","detail","oldLength","newLength","_insideTriangle","triangle","sign","as","bs","cs","distMax","closestDataPoint","closestDist","triangle1","triangle2","distX","distY","sqrt","content","line","dot","dom","borderRadius","boxShadow","borderLeft","contentWidth","offsetWidth","contentHeight","offsetHeight","lineHeight","dotWidth","dotHeight","clientX","targetTouches","clientY","armLocation","armRotation","armLength","cameraLocation","cameraRotation","calculateCameraOrientation","rot","graph","onLoadCallback","loadInBackground","isLoaded","getLoadedProgress","getColumn","getValues","dataView","progress","sub","sum","prev","bar","MozBorderRadius","slide","onclick","togglePlay","onChangeCallback","playTimeout","playInterval","playLoop","setIndex","playNext","interval","clearInterval","getPlayInterval","setPlayLoop","doLoop","onChange","indexToLeft","startClientX","startSlideX","leftToIndex","_start","_end","_step","precision","_current","setRange","setStep","calculatePrettyStep","log10","LN10","step1","pow","step2","step5","toPrecision","getStep","defaultOptions","autoResize","orientation","maxHeight","minHeight","_create","body","domProps","emitter","bind","snap","toScreen","_toScreen","toGlobalScreen","_toGlobalScreen","toTime","_toTime","toGlobalTime","_toGlobalTime","timeAxis","currentTime","customTime","itemSet","itemsData","groupsData","setItems","Hammer","backgroundVertical","backgroundHorizontal","centerContainer","leftContainer","rightContainer","shadowTop","shadowBottom","shadowTopLeft","shadowBottomLeft","shadowTopRight","shadowBottomRight","_onTouch","_onPinch","_onDragStart","_onDrag","prevent_default","listeners","events","args","slice","scrollTop","scrollTopMin","touch","destroy","_stopAutoResize","component","_initAutoResize","setCustomTime","time","getCustomTime","newDataSet","initialLoad","fit","setWindow","getVisibleItems","setGroups","groups","what","dataRange","getItemRange","dataset","minItem","maxStartItem","maxEndItem","setSelection","getSelection","getWindow","getRange","resized","borderRootHeight","borderRootWidth","autoHeight","containerHeight","centerWidth","_updateScrollTop","visibilityTop","visibilityBottom","visibility","repaint","conversion","_startAutoResize","_onResize","lastWidth","lastHeight","watchTimer","setInterval","allowDragging","initialScrollTop","gesture","deltaY","oldScrollTop","_getScrollTop","newScrollTop","_setScrollTop","linegraph","backgroundHorizontalContainer","minimumStep","forcedStepSize","current","autoScale","stepIndex","marginStart","marginEnd","majorSteps","minorSteps","setMinimumStep","setFirst","safeSize","minimumStepValue","orderOfMagnitude","minorStepIdx","magnitudefactor","solutionFound","stepSize","first","niceStart","niceEnd","roundToMinor","marginRange","rounded","hasNext","previous","isMajor","now","hours","minutes","seconds","milliseconds","clone","direction","moveable","zoomable","zoomMin","zoomMax","_onDragEnd","_onHold","_onMouseWheel","validateDirection","getPointer","pageX","pageY","hammerUtil","changed","_applyRange","newStart","newEnd","deltaX","diffRange","fakeGesture","pointer","pointerDate","_pointerToDate","zoom","touches","initDate","move","EPSILON","orderByStart","orderByEnd","aTime","bTime","force","iMax","axis","collidingItem","jj","collision","nostack","SCALE","DAY","MILLISECOND","SECOND","MINUTE","HOUR","WEEKDAY","MONTH","YEAR","setFullYear","getFullYear","setMonth","setDate","setHours","setMinutes","setSeconds","setMilliseconds","getMilliseconds","getSeconds","getMinutes","getHours","getDate","getMonth","setScale","newScale","newStep","setAutoScale","enable","stepYear","stepMonth","stepDay","stepHour","stepMinute","stepSecond","stepMillisecond","date","year","getLabelMinor","format","getLabelMajor","_isResized","_previousWidth","_previousHeight","showCurrentTime","parent","title","currentTimeTimer","showCustomTime","eventParams","drag","dragging","stopPropagation","svg","showMinorLabels","showMajorLabels","icons","majorLinesOffset","minorLinesOffset","labelOffsetX","labelOffsetY","iconWidth","linegraphSVG","DOMelements","lines","labels","conversionFactor","minWidth","stepPixels","stepPixelsForced","lineOffset","master","svgElements","amountOfGroups","addGroup","graphOptions","updateGroup","removeGroup","hide","show","lineContainer","display","_redrawGroupIcons","iconHeight","iconOffset","groupId","drawIcon","changeCalled","_calculateCharSize","minorLabelHeight","minorCharHeight","majorLabelHeight","majorCharHeight","minorLineWidth","minorLineHeight","majorLineWidth","majorLineHeight","_redrawLabels","amountOfSteps","stepDifference","valueAtZero","marginStartPos","maxLabelSize","_redrawLabel","_redrawLine","characterHeight","largestWidth","majorCharWidth","minorCharWidth","convertValue","invertedValue","convertedValue","textMinor","createTextNode","measureCharMinor","textMajor","measureCharMajor","groupsUsingDefaultStyles","usingDefaultStyle","zeroPosition","setZeroPosition","catmullRom","parametrization","alpha","SVGcontainer","path","fillPath","fillHeight","outline","shaded","barWidth","bar1Height","bar2Height","visibleItems","byStart","byEnd","inner","foreground","marker","Element","getLabelWidth","restack","_updateVisibleItems","markerHeight","lastMarkerHeight","dirty","displayed","offsetTop","offsetLeft","ii","repositionY","labelSet","setParent","_checkIfVisible","removeFromDataSet","removeItem","_constructByEndArray","endArray","initialPosByStart","newVisibleItems","initialPosByEnd","_checkIfInvisible","repositionX","align","groupOrder","selectable","editable","updateTime","onAdd","onUpdate","onMove","onRemove","itemOptions","itemListeners","_onAdd","_onUpdate","_onRemove","groupListeners","_onAddGroups","_onUpdateGroups","_onRemoveGroups","groupIds","selection","stackDirty","touchParams","UNGROUPED","box","_updateUngrouped","_onSelectItem","_onMultiSelectItem","_onAddItem","addCallback","fn","Function","markDirty","unselect","select","rawVisibleItems","_deselect","_orderGroups","visibleInterval","zoomed","lastVisibleInterval","firstGroup","_firstGroup","firstMargin","nonFirstMargin","groupMargin","groupResized","firstGroupIndex","firstGroupId","ungrouped","getLabelSet","oldItemsData","getItems","_order","getGroups","itemData","_removeItem","groupData","groupOptions","oldGroupId","oldGroup","itemFromTarget","selected","dragLeftItem","dragRightItem","itemProps","groupFromTarget","changes","ctrlKey","srcEvent","shiftKey","oldSelection","newSelection","xAbs","newItem","itemSetFromTarget","side","iconSize","iconSpacing","textArea","drawLegendIcons","getComputedStyle","paddingTop","yAxisOrientation","defaultGroup","sampling","graphHeight","barChart","dataAxis","legend","lastStart","rangePerPixelInv","_updateGraph","yAxisLeft","yAxisRight","legendLeft","legendRight","_updateAllGroupData","_updateGroup","groupsContent","ungroupedCounter","preprocessedGroup","preprocessedGroupData","processedGroupData","groupRanges","minDate","maxDate","_preprocessData","_updateYAxis","_convertYvalues","_drawLineGraph","_drawBarGraph","minVal","maxVal","yAxisLeftUsed","yAxisRightUsed","minLeft","minRight","maxLeft","maxRight","_toggleAxisVisiblity","drawIcons","axisUsed","coreDistance","_drawPoints","svgHeight","_catmullRom","_linear","dFill","datapoints","xValue","yValue","extractedData","increment","amountOfPoints","xDistance","pointsPerPixel","ceil","_catmullRomUniform","p0","p1","p2","p3","bp1","bp2","normalization","d1","d2","d3","A","N","M","d3powA","d2powA","d3pow2A","d2pow2A","d1pow2A","d1powA","majorLines","majorTexts","minorLines","minorTexts","lineTop","parentChanged","foregroundNextSibling","nextSibling","backgroundNextSibling","_repaintLabels","insertBefore","xFirstMajorLabel","cur","_repaintMinorText","_repaintMajorText","_repaintMajorLine","_repaintMinorLine","leftTime","leftText","widthText","arr","pop","childNodes","nodeValue","_repaintDeleteButton","anchor","deleteButton","itemSetHeight","marginLeft","baseClassName","_repaintDragLeft","_repaintDragRight","contentLeft","parentWidth","boxWidth","dragLeft","dragRight","_initializeMixinLoaders","renderRefreshRate","renderTimestep","renderTime","maxPhysicsTicksPerRender","physicsDiscreteStepsize","stabilize","initializing","triggerFunctions","edit","editEdge","connect","del","constants","nodes","radiusMin","radiusMax","shape","image","fixed","fontColor","fontSize","fontFace","level","highlightColor","edges","widthSelectionMultiplier","hoverWidth","fontFill","arrowScaleFactor","dash","gap","altLength","inheritColor","configurePhysics","physics","barnesHut","theta","gravitationalConstant","centralGravity","springLength","springConstant","damping","repulsion","nodeDistance","hierarchicalRepulsion","clustering","initialMaxNodes","clusterThreshold","reduceToNodes","chainThreshold","clusterEdgeThreshold","sectorThreshold","screenSizeThreshold","fontSizeMultiplier","maxFontSize","forceAmplification","distanceAmplification","edgeGrowth","nodeScaling","maxNodeSizeIncrements","activeAreaBoxSize","clusterLevelDifference","navigation","keyboard","speed","dataManipulation","initiallyVisible","hierarchicalLayout","levelSeparation","nodeSpacing","freezeForStabilization","smoothCurves","dynamic","roundness","dynamicSmoothCurves","maxVelocity","minVelocity","stabilizationIterations","link","editNode","back","addDescription","linkDescription","editEdgeDescription","addError","linkError","editError","editBoundError","deleteError","deleteClusterError","dragNetwork","dragNodes","hideEdgesOnDrag","hideNodesOnDrag","hoverObj","controlNodesActive","images","setOnloadCallback","_redraw","xIncrement","yIncrement","zoomIncrement","_loadPhysicsSystem","_loadSectorSystem","_loadClusterSystem","_loadSelectionSystem","_loadHierarchySystem","_setTranslation","freezeSimulation","cachedFunctions","calculationNodes","calculationNodeIndices","nodeIndices","canvasTopLeft","canvasBottomRight","pointerPosition","areaCenter","previousScale","nodesData","edgesData","nodesListeners","_addNodes","_updateNodes","_removeNodes","edgesListeners","_addEdges","_updateEdges","_removeEdges","moving","timer","_setupHierarchicalLayout","zoomExtent","startWithClustering","mousetrap","MixinLoader","_getScriptPath","scripts","getElementsByTagName","src","_getRange","node","minY","maxY","minX","maxX","nodeId","_findCenter","_centerNetwork","initialZoom","disableStart","zoomLevel","numberOfNodes","factor","yDistance","xZoomLevel","yZoomLevel","_updateNodeIndexList","_clearNodeIndexList","idx","dotData","DOTToGraph","gephi","gephiData","parseGephi","_setNodes","_setEdges","_putDataInSector","_stabilize","dragGraph","onEdit","onEditEdge","onConnect","onDelete","editMode","groupname","_loadNavigationControls","_loadManipulationSystem","_configureSmoothCurves","_createKeyBinds","pinch","_onTap","_onDoubleTap","_onRelease","_onMouseMoveTitle","reset","_moveUp","_yStopMoving","_moveDown","_moveLeft","_xStopMoving","_moveRight","_zoomIn","_stopZoom","_zoomOut","_createManipulatorBar","_deleteSelected","_getPointer","pinched","_getScale","_handleTouch","_handleDragStart","_getNodeAt","_getTranslation","isSelected","_selectObject","objectId","selectionObj","xFixed","yFixed","_handleOnDrag","_XconvertDOMtoCanvas","_XconvertCanvasToDOM","_YconvertDOMtoCanvas","_YconvertCanvasToDOM","_handleTap","_handleDoubleTap","_handleOnHold","_handleOnRelease","_zoom","scaleOld","preScaleDragPointer","DOMtoCanvas","scaleFrac","tx","ty","updateClustersDefault","postScaleDragPointer","canvasToDOM","popupObj","_checkHidePopup","checkShow","_checkShowPopup","popupTimer","edgeId","_getEdgeAt","_hoverObject","_blurObject","lastPopupNode","getTitle","isOverlappingWith","edge","connected","popup","setPosition","setText","manipulationDiv","navigationDivs","oldNodesData","_updateSelection","angle","_resetLevels","_updateCalculationNodes","_reconnectEdges","_updateValueRange","updateLabels","setProperties","properties","oldEdgesData","oldEdge","disconnect","showInternalIds","_createBezierNodes","via","sectors","setValueRange","w","save","translate","_doInAllSectors","restore","offsetX","offsetY","_drawNodes","alwaysShow","setScaleAndPos","inArea","draw","sMax","_drawEdges","_drawControlNodes","_freezeDefinedNodes","_physicsTick","_restoreFrozenNodes","iterations","fixedData","_isMoving","vmin","isMoving","_discreteStepNodes","nodesPresent","discreteStepLimited","discreteStep","vminCorrected","_doInAllActiveSectors","_doInSupportSector","_animationStep","_handleNavigation","calculationTime","maxSteps","timeRequired","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","ua","toLowerCase","requiresTimeout","toggleFreeze","smooth","mass","internalMultiplier","parentEdgeId","positionBezierNode","mixin","storePosition","dataArray","allowedToMoveX","allowedToMoveY","focusOnNode","nodePosition","requiredScale","canvasCenter","distanceFromCenter","fromId","toId","widthSelected","customLength","originalFromId","originalToId","widthFixed","lengthFixed","controlNodesEnabled","controlNodes","positions","connectedNode","_drawLine","_drawArrow","_drawArrowCenter","_drawDashLine","attachEdge","detachEdge","xFrom","yFrom","xTo","yTo","xObj","yObj","_getDistanceToEdge","_getColor","colorObj","_getLineWidth","_line","midpointX","midpointY","_pointOnLine","_label","resize","_circle","_pointOnCircle","networkScaleInv","_getViaCoordinates","xVia","yVia","quadraticCurveTo","measureText","fillRect","mozDash","setLineDash","pattern","lineDashOffset","mozDashOffset","lineCap","dashedLine","percentage","atan2","arrow","edgeSegmentLength","fromBorderDist","distanceToBorder","fromBorderPoint","toBorderDist","toBorderPoint","x1","y1","x2","y2","x3","y3","lastX","lastY","minDistance","_getDistanceToLine","px","py","something","u","nodeIdFrom","nodeIdTo","getControlNodePositions","_enableControlNodes","_disableControlNodes","_getSelectedControlNode","fromDistance","toDistance","_restoreControlNodes","defaultIndex","DEFAULT","load","url","img","Image","onload","imagelist","grouplist","dynamicEdges","reroutedEdges","fontDrawThreshold","horizontalAlignLeft","verticalAlignTop","baseRadiusValue","radiusFixed","preassignedLevel","borderWidthSelected","fx","fy","vx","vy","minForce","resetCluster","dynamicEdgesLength","clusterSession","clusterSizeWidthFactor","clusterSizeHeightFactor","clusterSizeRadiusFactor","growthIndicator","networkScale","formationScale","clusterSize","containedNodes","containedEdges","clusterSessions","originalLabel","triggerFunction","groupObj","imageObj","_drawDatabase","_resizeDatabase","_drawBox","_resizeBox","_drawCircle","_resizeCircle","_drawEllipse","_resizeEllipse","_drawImage","_resizeImage","_drawText","_resizeText","_drawDot","_resizeShape","_drawSquare","_drawTriangle","_drawTriangleDown","_drawStar","_reset","clearSizeCache","_setForce","_addForce","isFixed","getDistance","globalAlpha","drawImage","textSize","getTextSize","clusterLineWidth","selectionLineWidth","roundRect","database","diameter","circle","defaultSize","ellipse","_drawShape","radiusMultiplier","baseline","labelUnderNode","lineCount","yLine","inView","clearVelocity","updateVelocity","massBeforeClustering","energyBefore","styleAttr","fontFamily","WebkitBorderRadius","whiteSpace","maxWidth","parseDOT","parseGraph","nextPreview","isAlphaNumeric","regexAlphaNumeric","merge","o","addNode","graphs","attr","addEdge","createEdge","getToken","tokenType","TOKENTYPE","NULL","token","isComment","DELIMITER","c2","DELIMITERS","IDENTIFIER","newSyntaxError","UNKNOWN","chop","strict","parseStatements","parseStatement","subgraph","parseSubgraph","parseEdge","parseAttributeStatement","parseNodeStatement","subgraphs","parseAttributeList","message","maxLength","forEach2","array1","array2","elem1","elem2","convertEdge","dotEdge","graphEdge","graphData","dotNode","graphNode","subEdge","{","}","[","]",";","=",",","->","--","gephiJSON","allowedToMove","gEdges","gNodes","gEdge","source","attributes","gNode","eventType","getTouchList","collectEventData","CanvasRenderingContext2D","square","s2","ir","triangleDown","star","n","r2d","kappa","ox","oy","xe","ye","xm","ym","bezierCurveTo","wEllipse","hEllipse","ymb","yeb","xt","yt","xi","yi","xl","yl","xr","yr","dashArray","dashLength","dashCount","slope","distRemaining","dashIndex","PhysicsMixin","ClusterMixin","SectorsMixin","SelectionMixin","ManipulationMixin","NavigationMixin","HierarchicalLayoutMixin","_loadMixin","sourceVariable","mixinFunction","_clearMixin","_loadSelectedForceSolver","_loadPhysicsConfiguration","hubThreshold","activeSector","drawingNode","blockConnectingEdgeSelection","forceAppendSelection","editModeDiv","closeDiv","_cleanNavigation","_loadNavigationElements","_callbacks","once","self","removeListener","removeAllListeners","callbacks","cb","hasListeners","_addEvent","_characterFromEvent","fromCharCode","_MAP","_KEYCODE_MAP","_stop","tag_name","tagName","contentEditable","_modifiersMatch","modifiers1","modifiers2","_resetSequences","do_not_reset","active_sequences","_sequence_levels","_inside_sequence","_getMatches","character","modifiers","combination","matches","_isModifier","seq","combo","_eventModifiers","altKey","metaKey","_fireCallback","cancelBubble","_handleCharacter","processed_sequence_callback","_handleKey","keyCode","_ignore_next_keyup","_resetSequenceTimer","_reset_timer","_getReverseMap","_REVERSE_MAP","_pickBestAction","_bindSequence","_increaseSequence","_callbackAndReset","_bindSingle","sequence_name","sequence","_SPECIAL_ALIASES","_SHIFT_MAP","_bindMultiple","combinations",8,9,13,16,17,18,20,27,32,33,34,35,36,37,38,39,40,45,46,91,93,224,106,107,109,110,111,186,187,188,189,190,191,192,219,220,221,222,"~","!","@","#","$","%","^","&","*","(",")","_","+",":","\"","<",">","?","|","command","return","escape","_direct_map","unbind","trigger","__WEBPACK_AMD_DEFINE_RESULT__","global","dfl","defaultParsingFlags","empty","unusedTokens","unusedInput","charsLeftOver","nullInput","invalidMonth","invalidFormat","userInvalidated","iso","deprecate","msg","printMsg","suppressDeprecationWarnings","warn","firstTime","padToken","func","leftZeroFill","ordinalizeToken","period","lang","ordinal","Language","Moment","config","checkOverflow","Duration","duration","normalizedInput","normalizeObjectUnits","years","quarters","quarter","months","month","weeks","week","days","day","hour","minute","second","millisecond","_milliseconds","_days","_months","_bubble","cloneMoment","momentProperties","absRound","number","targetLength","forceSign","output","addOrSubtractDurationFromMoment","mom","isAdding","updateOffset","_d","setTime","rawSetter","rawGetter","rawMonthSetter","input","compareArrays","dontConvert","lengthDiff","diffs","toInt","normalizeUnits","units","lowered","unitAliases","camelFunctions","inputObject","normalizedProp","makeList","setter","getter","method","_lang","results","utc","set","argumentForCoercion","coercedNumber","isFinite","daysInMonth","UTC","getUTCDate","weeksInYear","dow","doy","weekOfYear","daysInYear","isLeapYear","_a","_pf","DATE","_overflowDayOfYear","isValid","_isValid","getTime","_strict","normalizeLanguage","makeAs","model","_isUTC","zone","_offset","local","loadLang","abbr","languages","unloadLang","getLangDefinition","k","hasModule","removeFormattingTokens","makeFormatFunction","formattingTokens","formatTokenFunctions","formatMoment","expandFormat","formatFunctions","invalidDate","replaceLongDateFormatTokens","longDateFormat","localFormattingTokens","lastIndex","getParseRegexForToken","parseTokenOneDigit","parseTokenThreeDigits","parseTokenFourDigits","parseTokenOneToFourDigits","parseTokenSignedNumber","parseTokenSixDigits","parseTokenOneToSixDigits","parseTokenTwoDigits","parseTokenOneToThreeDigits","parseTokenWord","_l","_meridiemParse","parseTokenTimestampMs","parseTokenTimezone","parseTokenT","parseTokenDigits","parseTokenOneOrTwoDigits","parseTokenOrdinal","RegExp","regexpEscape","unescapeFormat","timezoneMinutesFromString","string","possibleTzMatches","tzChunk","parts","parseTimezoneChunker","addTimeToArrayFromToken","datePartArray","monthsParse","_dayOfYear","parseTwoDigitYear","_isPm","isPM","_useUTC","_tzm","weekdaysParse","_w","invalidWeekday","dayOfYearFromWeekInfo","weekYear","weekday","temp","GG","W","E","_week","gg","dayOfYearFromWeeks","dayOfYear","dateFromConfig","currentDate","yearToUse","currentDateArray","makeUTCDate","getUTCMonth","makeDate","setUTCMinutes","getUTCMinutes","dateFromObject","_i","getUTCFullYear","makeDateFromStringAndFormat","_f","ISO_8601","parseISO","parsedInput","tokens","skipped","stringLength","totalParsedInputLength","matched","p4","makeDateFromStringAndArray","tempConfig","bestMoment","scoreToBeat","currentScore","NaN","score","l","isoRegex","isoDates","isoTimes","makeDateFromString","createFromInputFallback","makeDateFromInput","aspNetJsonRegex","ms","setUTCFullYear","parseWeekday","language","substituteTimeAgo","withoutSuffix","isFuture","relativeTime","relativeTimeThresholds","dd","dm","firstDayOfWeek","firstDayOfWeekOfYear","adjustedMoment","daysToDayOfWeek","daysToAdd","getUTCDay","makeMoment","invalid","preparse","pickBy","moments","res","dayOfMonth","unit","makeAccessor","keepTime","makeDurationGetter","makeDurationAsGetter","makeGlobal","shouldDeprecate","ender","oldGlobalMoment","globalScope","VERSION","_isAMomentObject","aspNetTimeSpanJsonRegex","isoDurationRegex","isoFormat","unitMillisecondFactors","Milliseconds","Seconds","Minutes","Hours","Days","Months","Years","D","Q","DDD","dayofyear","isoweekday","isoweek","weekyear","isoweekyear","ordinalizeTokens","paddedTokens","MMM","monthsShort","MMMM","weekdaysMin","ddd","weekdaysShort","dddd","weekdays","isoWeek","YY","YYYY","YYYYY","YYYYYY","gggg","ggggg","isoWeekYear","GGGG","GGGGG","isoWeekday","meridiem","SS","SSS","SSSS","Z","ZZ","zoneAbbr","zz","zoneName","unix","lists","DDDD","_monthsShort","monthName","regex","_monthsParse","_weekdays","_weekdaysShort","_weekdaysMin","weekdayName","_weekdaysParse","_longDateFormat","LT","L","LL","LLL","LLLL","val","isLower","_calendar","sameDay","nextDay","nextWeek","lastDay","lastWeek","sameElse","calendar","_relativeTime","future","past","mm","hh","MM","yy","pastFuture","_ordinal","postformat","_invalidDate","ret","parseIso","isDuration","inp","version","defaultFormat","relativeTimeThreshold","threshold","limit","_abbr","langData","flags","parseZone","isDSTShifted","parsingFlags","invalidAt","inputString","dur","asFloat","that","zoneDiff","startOf","humanize","fromNow","sod","isDST","getDay","endOf","isAfter","isBefore","isSame","getTimezoneOffset","_changeInProgress","hasAlignedHourOffset","isoWeeksInYear","weekInfo","dates","isoWeeks","toJSON","withSuffix","difference","toIsoString","asSeconds","asMonths","require","noGlobal","setup","READY","Event","determineEventTypes","Utils","each","gestures","Detection","register","onTouch","DOCUMENT","EVENT_MOVE","detect","EVENT_END","Instance","defaults","behavior","userSelect","touchAction","touchCallout","contentZooming","userDrag","tapHighlightColor","HAS_POINTEREVENTS","pointerEnabled","msPointerEnabled","HAS_TOUCHEVENTS","IS_MOBILE","NO_MOUSEEVENTS","CALCULATE_INTERVAL","EVENT_TYPES","DIRECTION_DOWN","DIRECTION_LEFT","DIRECTION_UP","DIRECTION_RIGHT","POINTER_MOUSE","POINTER_TOUCH","POINTER_PEN","EVENT_START","EVENT_RELEASE","EVENT_TOUCH","plugins","utils","dest","handler","iterator","context","inStr","find","inArray","hasParent","getCenter","getVelocity","deltaTime","getAngle","touch1","touch2","getDirection","getScale","getRotation","isVertical","setPrefixedCss","toggle","prefixes","toCamelCase","toggleBehavior","falseFn","onselectstart","ondragstart","str","preventMouseEvents","started","shouldDetect","hook","onTouchHandler","ev","triggerType","srcType","isPointer","isMouse","buttons","PointerEvent","matchType","updatePointer","doDetect","touchList","touchListLength","triggerChange","changedLength","changedTouches","evData","identifiers","identifier","pointerType","timeStamp","preventManipulation","stopDetect","pointers","touchlist","pointerEvent","pointerId","pt","MSPOINTER_TYPE_MOUSE","MSPOINTER_TYPE_TOUCH","MSPOINTER_TYPE_PEN","detection","stopped","startDetect","inst","eventData","startEvent","lastEvent","lastCalcEvent","futureCalcEvent","lastCalcData","extendEventData","instOptions","getCalculatedData","recalc","calcEv","calcData","velocity","velocityX","velocityY","interimAngle","interimDirection","startEv","lastEv","rotation","eventStartHandler","eventHandlers","createEvent","initEvent","dispatchEvent","state","dispose","eh","dragGesture","dragMaxTouches","triggered","dragMinDistance","startCenter","dragDistanceCorrection","dragLockToAxis","dragLockMinDistance","lastDirection","dragBlockVertical","dragBlockHorizontal","Drag","Gesture","holdGesture","holdTimeout","holdThreshold","Hold","Release","Infinity","Swipe","swipeMinTouches","swipeMaxTouches","swipeVelocityX","swipeVelocityY","tapGesture","sincePrev","didDoubleTap","hasMoved","tapMaxDistance","tapMaxTime","doubleTapInterval","doubleTapDistance","tapAlways","Tap","Touch","preventMouse","transformGesture","scaleThreshold","rotationThreshold","transformMinScale","transformMinRotation","Transform","clusterToFit","maxNumberOfNodes","reposition","maxLevels","forceAggregateHubs","normalizeClusterLevels","increaseClusterLevel","repositionNodes","openCluster","isMovingBeforeClustering","_nodeInActiveArea","_sector","_addSector","decreaseClusterLevel","_expandClusterNode","_updateDynamicEdges","updateClusters","zoomDirection","recursive","doNotStart","amountOfNodes","_collapseSector","_formClusters","_openClusters","_openClustersBySize","_aggregateHubs","handleChains","chainPercentage","_getChainFraction","_reduceAmountOfChains","_getHubSize","_formClustersByHub","openAll","containedNodeId","childNode","_expelChildFromParent","_unselectAll","_releaseContainedEdges","_connectEdgeBackToChild","_validateEdges","othersPresent","childNodeId","_repositionBezierNodes","_formClustersByZoom","_forceClustersByZoom","minLength","_addToCluster","_clusterToSmallestNeighbour","smallestNeighbour","smallestNeighbourNode","neighbour","onlyEqual","_formClusterFromHub","hubNode","absorptionSizeOffset","allowCluster","edgesIdarray","amountOfInitialEdges","_addToContainedEdges","_connectEdgeToCluster","_containCircularEdgesFromNode","massBefore","correction","edgeToId","edgeFromId","_addToReroutedEdges","maxLevel","minLevel","clusterLevel","targetLevel","average","averageSquared","hubCounter","largestHub","variance","standardDeviation","fraction","reduceAmount","chains","total","_switchToSector","sectorId","sectorType","_switchToActiveSector","_switchToFrozenSector","_switchToSupportSector","_loadLatestSector","_previousSector","_setActiveSector","newId","_forgetLastSector","_createNewSector","_deleteActiveSector","_deleteFrozenSector","_freezeSector","_activateSector","_mergeThisWithFrozen","_collapseThisToSingleCluster","sector","unqiueIdentifier","previousSector","runFunction","argument","_doInAllFrozenSectors","_drawSectorNodes","_drawAllSectorNodes","_getNodesOverlappingWith","overlappingNodes","_getAllNodesOverlappingWith","_pointerToPositionObject","positionObject","_getEdgesOverlappingWith","overlappingEdges","_getAllEdgesOverlappingWith","_addToSelection","_addToHover","_removeFromSelection","doNotTrigger","_unselectClusters","_getSelectedNodeCount","_getSelectedNode","_getSelectedEdge","_getSelectedEdgeCount","_getSelectedObjectCount","_selectionIsEmpty","_clusterInSelection","_selectConnectedEdges","_hoverConnectedEdges","_unselectConnectedEdges","append","highlightEdges","nodeIds","getSelectedNodes","edgeIds","getSelectedEdges","idArray","RangeError","selectNodes","selectEdges","_clearManipulatorBar","_restoreOverloadedFunctions","functionName","_toggleEditMode","toolbar","getElementById","boundFunction","edgeBeingEdited","selectedControlNode","addNodeButton","_createAddNodeToolbar","addEdgeButton","_createAddEdgeToolbar","editButton","_editNode","_createEditEdgeToolbar","editModeButton","backButton","_addNode","_handleConnect","_finishConnect","_selectControlNode","_controlNodeDrag","_releaseControlNode","newNode","_editEdge","alert","connectFromId","_createEdge","defaultData","finalizedData","sourceNodeId","targetNodeId","selectedNodes","selectedEdges","wrapper","navigationDivActions","_stopMovement","hubsize","definedLevel","undefinedLevel","_changeConstants","_determineLevels","distribution","_getDistribution","_placeNodesByHierarchy","minPos","_placeBranchNodes","amount","maxCount","_setLevel","parentId","parentLevel","nodeMoved","_restoreNodes","graphToggleSmoothCurves","graph_toggleSmooth","graphRepositionNodes","showValueOfRange","graphGenerateOptions","optionsSpecific","radioButton1","radioButton2","checked","backupConstants","optionsDiv","switchConfigurations","radioButton","querySelector","tableId","table","constantsVariableName","valueId","rangeValue","_overWriteGraphConstants","RepulsionMixin","HierarchialRepulsionMixin","BarnesHutMixin","_toggleBarnesHut","barnesHutTree","_initializeForceCalculation","_calculateForces","_calculateGravitationalForces","_calculateNodeForces","_calculateSpringForcesWithSupport","_calculateHierarchicalSpringForces","_calculateSpringForces","supportNodes","supportNodeId","gravity","gravityForce","edgeLength","springForce","combinedClusterSize","node1","node2","node3","_calculateSpringForce","physicsConfiguration","hierarchicalLayoutDirections","parentElement","rangeElement","radioButton3","graph_repositionNodes","graph_generateOptions","nameArray","webpackContext","req","webpackContextResolve","resolve","repulsingForce","a_base","minimumDistance","steepness","springFx","springFy","totalFx","totalFy","correctionFx","correctionFy","nodeCount","_formBarnesHutTree","_getForceContribution","children","NW","NE","SW","SE","parentBranch","childrenCount","centerOfMass","calcSize","MAX_VALUE","sizeDiff","minimumTreeSize","rootSize","halfRootSize","centerX","centerY","_splitBranch","_placeInTree","_updateBranchMass","totalMass","totalMassInv","biggestSize","skipMassUpdate","_placeInRegion","region","containedNode","_insertRegion","childSize","_drawTree","_drawBranch","branch","webpackPolyfill","paths"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAyBA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,QACxCA,OAAOD,QAAUD,IACQ,kBAAXG,SAAyBA,OAAOC,IAC9CD,OAAOH,GACmB,gBAAZC,SACdA,QAAa,IAAID,IAEjBD,EAAU,IAAIC,KACbK,KAAM,WACT,MAAgB,UAAUC,GAKhB,QAASC,GAAoBC,GAG5B,GAAGC,EAAiBD,GACnB,MAAOC,GAAiBD,GAAUP,OAGnC,IAAIC,GAASO,EAAiBD,IAC7BP,WACAS,GAAIF,EACJG,QAAQ,EAUT,OANAL,GAAQE,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOS,QAAS,EAGTT,EAAOD,QAvBf,GAAIQ,KAqCJ,OATAF,GAAoBM,EAAIP,EAGxBC,EAAoBO,EAAIL,EAGxBF,EAAoBQ,EAAI,GAGjBR,EAAoB,KAK/B,SAASL,EAAQD,EAASM,GAG9BN,EAAQe,KAAOT,EAAoB,GACnCN,EAAQgB,QAAUV,EAAoB,GAGtCN,EAAQiB,QAAUX,EAAoB,GACtCN,EAAQkB,SAAWZ,EAAoB,GAGvCN,EAAQmB,QAAUb,EAAoB,GACtCN,EAAQoB,SACNC,OAAQf,EAAoB,GAC5BgB,OAAQhB,EAAoB,GAC5BiB,QAASjB,EAAoB,GAC7BkB,QAASlB,EAAoB,GAC7BmB,OAAQnB,EAAoB,IAC5BoB,WAAYpB,EAAoB,KAIlCN,EAAQ2B,SAAWrB,EAAoB,IACvCN,EAAQ4B,QAAUtB,EA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rpF,MAAM6tC,KAAKw7C,EAAOrpF,MAAM4tC,MAC1C93B,EAAIe,OAAOwyE,EAAOrpF,MAAM6tC,KAAKw7C,EAAOrpF,MAAM2tC,MAC1C73B,EAAIlH,WAaF,SAAShd,GAEbA,EAAOD,QAAU,SAASC,GAQzB,MAPIA,GAAO03F,kBACV13F,EAAOsiE,UAAY,aACnBtiE,EAAO23F,SAEP33F,EAAO21F,YACP31F,EAAO03F,gBAAkB,GAEnB13F"} \ No newline at end of file diff --git a/dist/vis.min.css b/dist/vis.min.css old mode 100644 new mode 100755 diff --git a/dist/vis.min.js b/dist/vis.min.js index d1a39d5c..592c0fe7 100644 --- a/dist/vis.min.js +++ b/dist/vis.min.js @@ -4,8 +4,8 @@ * * A dynamic, browser-based visualization library. * - * @version 3.0.0 - * @date 2014-07-07 + * @version 3.1.0 + * @date 2014-07-22 * * @license * Copyright (C) 2011-2014 Almende B.V, http://almende.com @@ -22,15 +22,16 @@ * License for the specific language governing permissions and limitations under * the License. */ -!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.vis=t()}}(function(){var define,module,exports;return function t(e,i,s){function o(r,a){if(!i[r]){if(!e[r]){var h="function"==typeof require&&require;if(!a&&h)return h(r,!0);if(n)return n(r,!0);throw new Error("Cannot find module '"+r+"'")}var d=i[r]={exports:{}};e[r][0].call(d.exports,function(t){var i=e[r][1][t];return o(i?i:t)},d,d.exports,t,e,i,s)}return i[r].exports}for(var n="function"==typeof require&&require,r=0;re?1:e>t?-1:0}),this.values.length>0&&this.selectValue(0),this.dataPoints=[],this.loaded=!1,this.onLoadCallback=void 0,i.animationPreload?(this.loaded=!1,this.loadInBackground()):this.loaded=!0}function Slider(t,e){if(void 0===t)throw"Error: No container element defined";if(this.container=t,this.visible=e&&void 0!=e.visible?e.visible:!0,this.visible){this.frame=document.createElement("DIV"),this.frame.style.width="100%",this.frame.style.position="relative",this.container.appendChild(this.frame),this.frame.prev=document.createElement("INPUT"),this.frame.prev.type="BUTTON",this.frame.prev.value="Prev",this.frame.appendChild(this.frame.prev),this.frame.play=document.createElement("INPUT"),this.frame.play.type="BUTTON",this.frame.play.value="Play",this.frame.appendChild(this.frame.play),this.frame.next=document.createElement("INPUT"),this.frame.next.type="BUTTON",this.frame.next.value="Next",this.frame.appendChild(this.frame.next),this.frame.bar=document.createElement("INPUT"),this.frame.bar.type="BUTTON",this.frame.bar.style.position="absolute",this.frame.bar.style.border="1px solid red",this.frame.bar.style.width="100px",this.frame.bar.style.height="6px",this.frame.bar.style.borderRadius="2px",this.frame.bar.style.MozBorderRadius="2px",this.frame.bar.style.border="1px solid #7F7F7F",this.frame.bar.style.backgroundColor="#E5E5E5",this.frame.appendChild(this.frame.bar),this.frame.slide=document.createElement("INPUT"),this.frame.slide.type="BUTTON",this.frame.slide.style.margin="0px",this.frame.slide.value=" ",this.frame.slide.style.position="relative",this.frame.slide.style.left="-100px",this.frame.appendChild(this.frame.slide);var i=this;this.frame.slide.onmousedown=function(t){i._onMouseDown(t)},this.frame.prev.onclick=function(t){i.prev(t)},this.frame.play.onclick=function(t){i.togglePlay(t)},this.frame.next.onclick=function(t){i.next(t)}}this.onChangeCallback=void 0,this.values=[],this.index=void 0,this.playTimeout=void 0,this.playInterval=1e3,this.playLoop=!0}var moment="undefined"!=typeof window&&window.moment||require("moment"),Emitter=require("emitter-component"),Hammer;Hammer="undefined"!=typeof window?window.Hammer||require("hammerjs"):function(){throw Error("hammer.js is only available in a browser, not in node.js.")};var mousetrap;if(mousetrap="undefined"!=typeof window?window.mousetrap||require("mousetrap"):function(){throw Error("mouseTrap is only available in a browser, not in node.js.")},!Array.prototype.indexOf){Array.prototype.indexOf=function(t){for(var e=0;ei;++i)t.call(e||this,this[i],i,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){var i,s,o;if(null==this)throw new TypeError(" this is null or not defined");var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(e&&(i=e),s=new Array(r),o=0;r>o;){var a,h;o in n&&(a=n[o],h=t.call(i,a,o,n),s[o]=h),o++}return s}),Array.prototype.filter||(Array.prototype.filter=function(t){"use strict";if(null==this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var s=[],o=arguments[1],n=0;i>n;n++)if(n in e){var r=e[n];t.call(o,r,n,e)&&s.push(r)}return s}),Object.keys||(Object.keys=function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],s=i.length;return function(o){if("object"!=typeof o&&"function"!=typeof o||null===o)throw new TypeError("Object.keys called on non-object");var n=[];for(var r in o)t.call(o,r)&&n.push(r);if(e)for(var a=0;s>a;a++)t.call(o,i[a])&&n.push(i[a]);return n}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),i=this,s=function(){},o=function(){return i.apply(this instanceof s&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return s.prototype=this.prototype,o.prototype=new s,o}),Object.create||(Object.create=function(t){function e(){}if(arguments.length>1)throw new Error("Object.create implementation only accepts the first parameter.");return e.prototype=t,new e}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),i=this,s=function(){},o=function(){return i.apply(this instanceof s&&t?this:t,e.concat(Array.prototype.slice.call(arguments))) -};return s.prototype=this.prototype,o.prototype=new s,o});var util={};util.isNumber=function(t){return t instanceof Number||"number"==typeof t},util.isString=function(t){return t instanceof String||"string"==typeof t},util.isDate=function(t){if(t instanceof Date)return!0;if(util.isString(t)){var e=ASPDateRegex.exec(t);if(e)return!0;if(!isNaN(Date.parse(t)))return!0}return!1},util.isDataTable=function(t){return"undefined"!=typeof google&&google.visualization&&google.visualization.DataTable&&t instanceof google.visualization.DataTable},util.randomUUID=function(){var t=function(){return Math.floor(65536*Math.random()).toString(16)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},util.extend=function(t){for(var e=1,i=arguments.length;i>e;e++){var s=arguments[e];for(var o in s)s.hasOwnProperty(o)&&(t[o]=s[o])}return t},util.selectiveExtend=function(t,e){if(!Array.isArray(t))throw new Error("Array with property names expected as first argument");for(var i=2;ii;i++)if(t[i]!=e[i])return!1;return!0},util.convert=function(t,e){var i;if(void 0===t)return void 0;if(null===t)return null;if(!e)return t;if("string"!=typeof e&&!(e instanceof String))throw new Error("Type must be a string");switch(e){case"boolean":case"Boolean":return Boolean(t);case"number":case"Number":return Number(t.valueOf());case"string":case"String":return String(t);case"Date":if(util.isNumber(t))return new Date(t);if(t instanceof Date)return new Date(t.valueOf());if(moment.isMoment(t))return new Date(t.valueOf());if(util.isString(t))return i=ASPDateRegex.exec(t),i?new Date(Number(i[1])):moment(t).toDate();throw new Error("Cannot convert object of type "+util.getType(t)+" to type Date");case"Moment":if(util.isNumber(t))return moment(t);if(t instanceof Date)return moment(t.valueOf());if(moment.isMoment(t))return moment(t);if(util.isString(t))return i=ASPDateRegex.exec(t),moment(i?Number(i[1]):t);throw new Error("Cannot convert object of type "+util.getType(t)+" to type Date");case"ISODate":if(util.isNumber(t))return new Date(t);if(t instanceof Date)return t.toISOString();if(moment.isMoment(t))return t.toDate().toISOString();if(util.isString(t))return i=ASPDateRegex.exec(t),i?new Date(Number(i[1])).toISOString():new Date(t).toISOString();throw new Error("Cannot convert object of type "+util.getType(t)+" to type ISODate");case"ASPDate":if(util.isNumber(t))return"/Date("+t+")/";if(t instanceof Date)return"/Date("+t.valueOf()+")/";if(util.isString(t)){i=ASPDateRegex.exec(t);var s;return s=i?new Date(Number(i[1])).valueOf():new Date(t).valueOf(),"/Date("+s+")/"}throw new Error("Cannot convert object of type "+util.getType(t)+" to type ASPDate");default:throw new Error('Unknown type "'+e+'"')}};var ASPDateRegex=/^\/?Date\((\-?\d+)/i;util.getType=function(t){var e=typeof t;return"object"==e?null==t?"null":t instanceof Boolean?"Boolean":t instanceof Number?"Number":t instanceof String?"String":t instanceof Array?"Array":t instanceof Date?"Date":"Object":"number"==e?"Number":"boolean"==e?"Boolean":"string"==e?"String":e},util.getAbsoluteLeft=function(t){for(var e=document.documentElement,i=document.body,s=t.offsetLeft,o=t.offsetParent;null!=o&&o!=i&&o!=e;)s+=o.offsetLeft,s-=o.scrollLeft,o=o.offsetParent;return s},util.getAbsoluteTop=function(t){for(var e=document.documentElement,i=document.body,s=t.offsetTop,o=t.offsetParent;null!=o&&o!=i&&o!=e;)s+=o.offsetTop,s-=o.scrollTop,o=o.offsetParent;return s},util.getPageY=function(t){if("pageY"in t)return t.pageY;var e;e="targetTouches"in t&&t.targetTouches.length?t.targetTouches[0].clientY:t.clientY;var i=document.documentElement,s=document.body;return e+(i&&i.scrollTop||s&&s.scrollTop||0)-(i&&i.clientTop||s&&s.clientTop||0)},util.getPageX=function(t){if("pageY"in t)return t.pageX;var e;e="targetTouches"in t&&t.targetTouches.length?t.targetTouches[0].clientX:t.clientX;var i=document.documentElement,s=document.body;return e+(i&&i.scrollLeft||s&&s.scrollLeft||0)-(i&&i.clientLeft||s&&s.clientLeft||0)},util.addClassName=function(t,e){var i=t.className.split(" ");-1==i.indexOf(e)&&(i.push(e),t.className=i.join(" "))},util.removeClassName=function(t,e){var i=t.className.split(" "),s=i.indexOf(e);-1!=s&&(i.splice(s,1),t.className=i.join(" "))},util.forEach=function(t,e){var i,s;if(t instanceof Array)for(i=0,s=t.length;s>i;i++)e(t[i],i,t);else for(i in t)t.hasOwnProperty(i)&&e(t[i],i,t)},util.toArray=function(t){var e=[];for(var i in t)t.hasOwnProperty(i)&&e.push(t[i]);return e},util.updateProperty=function(t,e,i){return t[e]!==i?(t[e]=i,!0):!1},util.addEventListener=function(t,e,i,s){t.addEventListener?(void 0===s&&(s=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,s)):t.attachEvent("on"+e,i)},util.removeEventListener=function(t,e,i,s){t.removeEventListener?(void 0===s&&(s=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,s)):t.detachEvent("on"+e,i)},util.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},util.fakeGesture=function(t,e){var i=null,s=Hammer.event.collectEventData(this,i,e);return isNaN(s.center.pageX)&&(s.center.pageX=e.pageX),isNaN(s.center.pageY)&&(s.center.pageY=e.pageY),s},util.option={},util.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},util.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},util.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},util.option.asSize=function(t,e){return"function"==typeof t&&(t=t()),util.isString(t)?t:util.isNumber(t)?t+"px":e||null},util.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},util.GiveDec=function(Hex){var Value;return Value="A"==Hex?10:"B"==Hex?11:"C"==Hex?12:"D"==Hex?13:"E"==Hex?14:"F"==Hex?15:eval(Hex)},util.GiveHex=function(t){var e;return e=10==t?"A":11==t?"B":12==t?"C":13==t?"D":14==t?"E":15==t?"F":""+t},util.parseColor=function(t){var e;if(util.isString(t))if(util.isValidHex(t)){var i=util.hexToHSV(t),s={h:i.h,s:.45*i.s,v:Math.min(1,1.05*i.v)},o={h:i.h,s:Math.min(1,1.25*i.v),v:.6*i.v},n=util.HSVToHex(o.h,o.h,o.v),r=util.HSVToHex(s.h,s.s,s.v);e={background:t,border:n,highlight:{background:r,border:n},hover:{background:r,border:n}}}else e={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}};else e={},e.background=t.background||"white",e.border=t.border||e.background,util.isString(t.highlight)?e.highlight={border:t.highlight,background:t.highlight}:(e.highlight={},e.highlight.background=t.highlight&&t.highlight.background||e.background,e.highlight.border=t.highlight&&t.highlight.border||e.border),util.isString(t.hover)?e.hover={border:t.hover,background:t.hover}:(e.hover={},e.hover.background=t.hover&&t.hover.background||e.background,e.hover.border=t.hover&&t.hover.border||e.border);return e},util.hexToRGB=function(t){t=t.replace("#","").toUpperCase();var e=util.GiveDec(t.substring(0,1)),i=util.GiveDec(t.substring(1,2)),s=util.GiveDec(t.substring(2,3)),o=util.GiveDec(t.substring(3,4)),n=util.GiveDec(t.substring(4,5)),r=util.GiveDec(t.substring(5,6)),a=16*e+i,h=16*s+o,i=16*n+r;return{r:a,g:h,b:i}},util.RGBToHex=function(t,e,i){var s=util.GiveHex(Math.floor(t/16)),o=util.GiveHex(t%16),n=util.GiveHex(Math.floor(e/16)),r=util.GiveHex(e%16),a=util.GiveHex(Math.floor(i/16)),h=util.GiveHex(i%16),d=s+o+n+r+a+h;return"#"+d},util.RGBToHSV=function(t,e,i){t/=255,e/=255,i/=255;var s=Math.min(t,Math.min(e,i)),o=Math.max(t,Math.max(e,i));if(s==o)return{h:0,s:0,v:s};var n=t==s?e-i:i==s?t-e:i-t,r=t==s?3:i==s?1:5,a=60*(r-n/(o-s))/360,h=(o-s)/o,d=o;return{h:a,s:h,v:d}},util.HSVToRGB=function(t,e,i){var s,o,n,r=Math.floor(6*t),a=6*t-r,h=i*(1-e),d=i*(1-a*e),l=i*(1-(1-a)*e);switch(r%6){case 0:s=i,o=l,n=h;break;case 1:s=d,o=i,n=h;break;case 2:s=h,o=i,n=l;break;case 3:s=h,o=d,n=i;break;case 4:s=l,o=h,n=i;break;case 5:s=i,o=h,n=d}return{r:Math.floor(255*s),g:Math.floor(255*o),b:Math.floor(255*n)}},util.HSVToHex=function(t,e,i){var s=util.HSVToRGB(t,e,i);return util.RGBToHex(s.r,s.g,s.b)},util.hexToHSV=function(t){var e=util.hexToRGB(t);return util.RGBToHSV(e.r,e.g,e.b)},util.isValidHex=function(t){var e=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t);return e},util.selectiveBridgeObject=function(t,e){if("object"==typeof e){for(var i=Object.create(e),s=0;se.start-a&&ne.start-a&&nn&&r>e||e>r&&a>e?(d=!0,r!=e&&("before"==s?e>n&&r>e&&(p=Math.max(0,p-1)):e>r&&a>e&&(p=Math.min(h.length-1,p+1)))):(e>r?l=Math.floor(.5*(c+l)):c=Math.floor(.5*(c+l)),o=Math.floor(.5*(c+l)),p==o?(p=-2,d=!0):p=o);return p};var DOMutil={};DOMutil.prepareElements=function(t){for(var e in t)t.hasOwnProperty(e)&&(t[e].redundant=t[e].used,t[e].used=[])},DOMutil.cleanupElements=function(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e].redundant){for(var i=0;i0?(s=e[t].redundant[0],e[t].redundant.shift()):(s=document.createElementNS("http://www.w3.org/2000/svg",t),i.appendChild(s)):(s=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},i.appendChild(s)),e[t].used.push(s),s},DOMutil.getDOMElement=function(t,e,i){var s;return e.hasOwnProperty(t)?e[t].redundant.length>0?(s=e[t].redundant[0],e[t].redundant.shift()):(s=document.createElement(t),i.appendChild(s)):(s=document.createElement(t),e[t]={used:[],redundant:[]},i.appendChild(s)),e[t].used.push(s),s},DOMutil.drawPoint=function(t,e,i,s,o){var n;return"circle"==i.options.drawPoints.style?(n=DOMutil.getSVGElement("circle",s,o),n.setAttributeNS(null,"cx",t),n.setAttributeNS(null,"cy",e),n.setAttributeNS(null,"r",.5*i.options.drawPoints.size),n.setAttributeNS(null,"class",i.className+" point")):(n=DOMutil.getSVGElement("rect",s,o),n.setAttributeNS(null,"x",t-.5*i.options.drawPoints.size),n.setAttributeNS(null,"y",e-.5*i.options.drawPoints.size),n.setAttributeNS(null,"width",i.options.drawPoints.size),n.setAttributeNS(null,"height",i.options.drawPoints.size),n.setAttributeNS(null,"class",i.className+" point")),n},DOMutil.drawBar=function(t,e,i,s,o,n,r){var a=DOMutil.getSVGElement("rect",n,r);a.setAttributeNS(null,"x",t-.5*i),a.setAttributeNS(null,"y",e),a.setAttributeNS(null,"width",i),a.setAttributeNS(null,"height",s),a.setAttributeNS(null,"class",o)},DataSet.prototype.on=function(t,e){var i=this._subscribers[t];i||(i=[],this._subscribers[t]=i),i.push({callback:e})},DataSet.prototype.subscribe=DataSet.prototype.on,DataSet.prototype.off=function(t,e){var i=this._subscribers[t];i&&(this._subscribers[t]=i.filter(function(t){return t.callback!=e}))},DataSet.prototype.unsubscribe=DataSet.prototype.off,DataSet.prototype._trigger=function(t,e,i){if("*"==t)throw new Error("Cannot trigger event *");var s=[];t in this._subscribers&&(s=s.concat(this._subscribers[t])),"*"in this._subscribers&&(s=s.concat(this._subscribers["*"]));for(var o=0;on;n++)i=o._addItem(t[n]),s.push(i);else if(util.isDataTable(t))for(var a=this._getColumnNames(t),h=0,d=t.getNumberOfRows();d>h;h++){for(var l={},c=0,p=a.length;p>c;c++){var u=a[c];l[u]=t.getValue(h,c)}i=o._addItem(l),s.push(i)}else{if(!(t instanceof Object))throw new Error("Unknown dataType");i=o._addItem(t),s.push(i)}return s.length&&this._trigger("add",{items:s},e),s},DataSet.prototype.update=function(t,e){var i=[],s=[],o=this,n=o._fieldId,r=function(t){var e=t[n];o._data[e]?(e=o._updateItem(t),s.push(e)):(e=o._addItem(t),i.push(e))};if(Array.isArray(t))for(var a=0,h=t.length;h>a;a++)r(t[a]);else if(util.isDataTable(t))for(var d=this._getColumnNames(t),l=0,c=t.getNumberOfRows();c>l;l++){for(var p={},u=0,m=d.length;m>u;u++){var g=d[u];p[g]=t.getValue(l,u)}r(p)}else{if(!(t instanceof Object))throw new Error("Unknown dataType");r(t)}return i.length&&this._trigger("add",{items:i},e),s.length&&this._trigger("update",{items:s},e),i.concat(s)},DataSet.prototype.get=function(){var t,e,i,s,o=this,n=util.getType(arguments[0]);"String"==n||"Number"==n?(t=arguments[0],i=arguments[1],s=arguments[2]):"Array"==n?(e=arguments[0],i=arguments[1],s=arguments[2]):(i=arguments[0],s=arguments[1]);var r;if(i&&i.returnType){if(r="DataTable"==i.returnType?"DataTable":"Array",s&&r!=util.getType(s))throw new Error('Type of parameter "data" ('+util.getType(s)+") does not correspond with specified options.type ("+i.type+")");if("DataTable"==r&&!util.isDataTable(s))throw new Error('Parameter "data" must be a DataTable when options.type is "DataTable"')}else r=s&&"DataTable"==util.getType(s)?"DataTable":"Array";var a,h,d,l,c=i&&i.type||this._options.type,p=i&&i.filter,u=[];if(void 0!=t)a=o._getItem(t,c),p&&!p(a)&&(a=null);else if(void 0!=e)for(d=0,l=e.length;l>d;d++)a=o._getItem(e[d],c),(!p||p(a))&&u.push(a);else for(h in this._data)this._data.hasOwnProperty(h)&&(a=o._getItem(h,c),(!p||p(a))&&u.push(a));if(i&&i.order&&void 0==t&&this._sort(u,i.order),i&&i.fields){var m=i.fields;if(void 0!=t)a=this._filterFields(a,m);else for(d=0,l=u.length;l>d;d++)u[d]=this._filterFields(u[d],m)}if("DataTable"==r){var g=this._getColumnNames(s);if(void 0!=t)o._appendRow(s,g,a);else for(d=0,l=u.length;l>d;d++)o._appendRow(s,g,u[d]);return s}if(void 0!=t)return a;if(s){for(d=0,l=u.length;l>d;d++)s.push(u[d]);return s}return u},DataSet.prototype.getIds=function(t){var e,i,s,o,n,r=this._data,a=t&&t.filter,h=t&&t.order,d=t&&t.type||this._options.type,l=[];if(a)if(h){n=[];for(s in r)r.hasOwnProperty(s)&&(o=this._getItem(s,d),a(o)&&n.push(o));for(this._sort(n,h),e=0,i=n.length;i>e;e++)l[e]=n[e][this._fieldId]}else for(s in r)r.hasOwnProperty(s)&&(o=this._getItem(s,d),a(o)&&l.push(o[this._fieldId]));else if(h){n=[];for(s in r)r.hasOwnProperty(s)&&n.push(r[s]);for(this._sort(n,h),e=0,i=n.length;i>e;e++)l[e]=n[e][this._fieldId]}else for(s in r)r.hasOwnProperty(s)&&(o=r[s],l.push(o[this._fieldId]));return l},DataSet.prototype.getDataSet=function(){return this},DataSet.prototype.forEach=function(t,e){var i,s,o=e&&e.filter,n=e&&e.type||this._options.type,r=this._data;if(e&&e.order)for(var a=this.get(e),h=0,d=a.length;d>h;h++)i=a[h],s=i[this._fieldId],t(i,s);else for(s in r)r.hasOwnProperty(s)&&(i=this._getItem(s,n),(!o||o(i))&&t(i,s))},DataSet.prototype.map=function(t,e){var i,s=e&&e.filter,o=e&&e.type||this._options.type,n=[],r=this._data;for(var a in r)r.hasOwnProperty(a)&&(i=this._getItem(a,o),(!s||s(i))&&n.push(t(i,a)));return e&&e.order&&this._sort(n,e.order),n},DataSet.prototype._filterFields=function(t,e){var i={};for(var s in t)t.hasOwnProperty(s)&&-1!=e.indexOf(s)&&(i[s]=t[s]);return i},DataSet.prototype._sort=function(t,e){if(util.isString(e)){var i=e;t.sort(function(t,e){var s=t[i],o=e[i];return s>o?1:o>s?-1:0})}else{if("function"!=typeof e)throw new TypeError("Order must be a function or a string");t.sort(e)}},DataSet.prototype.remove=function(t,e){var i,s,o,n=[];if(Array.isArray(t))for(i=0,s=t.length;s>i;i++)o=this._remove(t[i]),null!=o&&n.push(o);else o=this._remove(t),null!=o&&n.push(o);return n.length&&this._trigger("remove",{items:n},e),n},DataSet.prototype._remove=function(t){if(util.isNumber(t)||util.isString(t)){if(this._data[t])return delete this._data[t],t}else if(t instanceof Object){var e=t[this._fieldId];if(e&&this._data[e])return delete this._data[e],e}return null},DataSet.prototype.clear=function(t){var e=Object.keys(this._data);return this._data={},this._trigger("remove",{items:e},t),e},DataSet.prototype.max=function(t){var e=this._data,i=null,s=null;for(var o in e)if(e.hasOwnProperty(o)){var n=e[o],r=n[t];null!=r&&(!i||r>s)&&(i=n,s=r)}return i},DataSet.prototype.min=function(t){var e=this._data,i=null,s=null;for(var o in e)if(e.hasOwnProperty(o)){var n=e[o],r=n[t];null!=r&&(!i||s>r)&&(i=n,s=r)}return i},DataSet.prototype.distinct=function(t){var e,i=this._data,s=[],o=this._options.type&&this._options.type[t]||null,n=0;for(var r in i)if(i.hasOwnProperty(r)){var a=i[r],h=a[t],d=!1;for(e=0;n>e;e++)if(s[e]==h){d=!0;break}d||void 0===h||(s[n]=h,n++)}if(o)for(e=0;ei;i++)e[i]=t.getColumnId(i)||t.getColumnLabel(i);return e},DataSet.prototype._appendRow=function(t,e,i){for(var s=t.addRow(),o=0,n=e.length;n>o;o++){var r=e[o];t.setValue(s,o,i[r])}},DataView.prototype.setData=function(t){var e,i,s;if(this._data){this._data.unsubscribe&&this._data.unsubscribe("*",this.listener),e=[];for(var o in this._ids)this._ids.hasOwnProperty(o)&&e.push(o);this._ids={},this._trigger("remove",{items:e})}if(this._data=t,this._data){for(this._fieldId=this._options.fieldId||this._data&&this._data.options&&this._data.options.fieldId||"id",e=this._data.getIds({filter:this._options&&this._options.filter}),i=0,s=e.length;s>i;i++)o=e[i],this._ids[o]=!0;this._trigger("add",{items:e}),this._data.on&&this._data.on("*",this.listener)}},DataView.prototype.get=function(){var t,e,i,s=this,o=util.getType(arguments[0]);"String"==o||"Number"==o||"Array"==o?(t=arguments[0],e=arguments[1],i=arguments[2]):(e=arguments[0],i=arguments[1]);var n=util.extend({},this._options,e);this._options.filter&&e&&e.filter&&(n.filter=function(t){return s._options.filter(t)&&e.filter(t)});var r=[];return void 0!=t&&r.push(t),r.push(n),r.push(i),this._data&&this._data.get.apply(this._data,r)},DataView.prototype.getIds=function(t){var e;if(this._data){var i,s=this._options.filter;i=t&&t.filter?s?function(e){return s(e)&&t.filter(e)}:t.filter:s,e=this._data.getIds({filter:i,order:t&&t.order})}else e=[];return e},DataView.prototype.getDataSet=function(){for(var t=this;t instanceof DataView;)t=t._data;return t||null},DataView.prototype._onEvent=function(t,e,i){var s,o,n,r,a=e&&e.items,h=this._data,d=[],l=[],c=[];if(a&&h){switch(t){case"add":for(s=0,o=a.length;o>s;s++)n=a[s],r=this.get(n),r&&(this._ids[n]=!0,d.push(n));break;case"update":for(s=0,o=a.length;o>s;s++)n=a[s],r=this.get(n),r?this._ids[n]?l.push(n):(this._ids[n]=!0,d.push(n)):this._ids[n]&&(delete this._ids[n],c.push(n));break;case"remove":for(s=0,o=a.length;o>s;s++)n=a[s],this._ids[n]&&(delete this._ids[n],c.push(n))}d.length&&this._trigger("add",{items:d},i),l.length&&this._trigger("update",{items:l},i),c.length&&this._trigger("remove",{items:c},i)}},DataView.prototype.on=DataSet.prototype.on,DataView.prototype.off=DataSet.prototype.off,DataView.prototype._trigger=DataSet.prototype._trigger,DataView.prototype.subscribe=DataView.prototype.on,DataView.prototype.unsubscribe=DataView.prototype.off,GraphGroup.prototype.setItems=function(t){null!=t?(this.itemsData=t,1==this.options.sort&&this.itemsData.sort(function(t,e){return t.x-e.x})):this.itemsData=[]},GraphGroup.prototype.setZeroPosition=function(t){this.zeroPosition=t},GraphGroup.prototype.setOptions=function(t){if(void 0!==t){var e=["sampling","style","sort","yAxisOrientation","barChart"];util.selectiveDeepExtend(e,this.options,t),util.mergeOptions(this.options,t,"catmullRom"),util.mergeOptions(this.options,t,"drawPoints"),util.mergeOptions(this.options,t,"shaded"),t.catmullRom&&"object"==typeof t.catmullRom&&t.catmullRom.parametrization&&("uniform"==t.catmullRom.parametrization?this.options.catmullRom.alpha=0:"chordal"==t.catmullRom.parametrization?this.options.catmullRom.alpha=1:(this.options.catmullRom.parametrization="centripetal",this.options.catmullRom.alpha=.5))}},GraphGroup.prototype.update=function(t){this.group=t,this.content=t.content||"graph",this.className=t.className||this.className||"graphGroup"+this.groupsUsingDefaultStyles[0]%10,this.setOptions(t.options)},GraphGroup.prototype.drawIcon=function(t,e,i,s,o,n){var r,a,h=.5*n,d=DOMutil.getSVGElement("rect",i,s);if(d.setAttributeNS(null,"x",t),d.setAttributeNS(null,"y",e-h),d.setAttributeNS(null,"width",o),d.setAttributeNS(null,"height",2*h),d.setAttributeNS(null,"class","outline"),"line"==this.options.style)r=DOMutil.getSVGElement("path",i,s),r.setAttributeNS(null,"class",this.className),r.setAttributeNS(null,"d","M"+t+","+e+" L"+(t+o)+","+e),1==this.options.shaded.enabled&&(a=DOMutil.getSVGElement("path",i,s),"top"==this.options.shaded.orientation?a.setAttributeNS(null,"d","M"+t+", "+(e-h)+"L"+t+","+e+" L"+(t+o)+","+e+" L"+(t+o)+","+(e-h)):a.setAttributeNS(null,"d","M"+t+","+e+" L"+t+","+(e+h)+" L"+(t+o)+","+(e+h)+"L"+(t+o)+","+e),a.setAttributeNS(null,"class",this.className+" iconFill")),1==this.options.drawPoints.enabled&&DOMutil.drawPoint(t+.5*o,e,this,i,s);else{var l=Math.round(.3*o),c=Math.round(.4*n),p=Math.round(.75*n),u=Math.round((o-2*l)/3);DOMutil.drawBar(t+.5*l+u,e+h-c-1,l,c,this.className+" bar",i,s),DOMutil.drawBar(t+1.5*l+u+2,e+h-p-1,l,p,this.className+" bar",i,s)}},Legend.prototype=new Component,Legend.prototype.addGroup=function(t,e){this.groups.hasOwnProperty(t)||(this.groups[t]=e),this.amountOfGroups+=1},Legend.prototype.updateGroup=function(t,e){this.groups[t]=e},Legend.prototype.removeGroup=function(t){this.groups.hasOwnProperty(t)&&(delete this.groups[t],this.amountOfGroups-=1)},Legend.prototype._create=function(){this.dom.frame=document.createElement("div"),this.dom.frame.className="legend",this.dom.frame.style.position="absolute",this.dom.frame.style.top="10px",this.dom.frame.style.display="block",this.dom.textArea=document.createElement("div"),this.dom.textArea.className="legendText",this.dom.textArea.style.position="relative",this.dom.textArea.style.top="0px",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0px",this.svg.style.width=this.options.iconSize+5+"px",this.dom.frame.appendChild(this.svg),this.dom.frame.appendChild(this.dom.textArea)},Legend.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame)},Legend.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame)},Legend.prototype.setOptions=function(t){var e=["enabled","orientation","icons","left","right"];util.selectiveDeepExtend(e,this.options,t)},Legend.prototype.redraw=function(){if(0==this.options[this.side].visible||0==this.amountOfGroups||0==this.options.enabled)this.hide();else{this.show(),"top-left"==this.options[this.side].position||"bottom-left"==this.options[this.side].position?(this.dom.frame.style.left="4px",this.dom.frame.style.textAlign="left",this.dom.textArea.style.textAlign="left",this.dom.textArea.style.left=this.options.iconSize+15+"px",this.dom.textArea.style.right="",this.svg.style.left="0px",this.svg.style.right=""):(this.dom.frame.style.right="4px",this.dom.frame.style.textAlign="right",this.dom.textArea.style.textAlign="right",this.dom.textArea.style.right=this.options.iconSize+15+"px",this.dom.textArea.style.left="",this.svg.style.right="0px",this.svg.style.left=""),"top-left"==this.options[this.side].position||"top-right"==this.options[this.side].position?(this.dom.frame.style.top=4-Number(this.body.dom.center.style.top.replace("px",""))+"px",this.dom.frame.style.bottom=""):(this.dom.frame.style.bottom=4-Number(this.body.dom.center.style.top.replace("px",""))+"px",this.dom.frame.style.top=""),0==this.options.icons?(this.dom.frame.style.width=this.dom.textArea.offsetWidth+10+"px",this.dom.textArea.style.right="",this.dom.textArea.style.left="",this.svg.style.width="0px"):(this.dom.frame.style.width=this.options.iconSize+15+this.dom.textArea.offsetWidth+10+"px",this.drawLegendIcons());var t="";for(var e in this.groups)this.groups.hasOwnProperty(e)&&(t+=this.groups[e].content+"
");this.dom.textArea.innerHTML=t,this.dom.textArea.style.lineHeight=.75*this.options.iconSize+this.options.iconSpacing+"px"}},Legend.prototype.drawLegendIcons=function(){if(this.dom.frame.parentNode){DOMutil.prepareElements(this.svgElements);var t=window.getComputedStyle(this.dom.frame).paddingTop,e=Number(t.replace("px","")),i=e,s=this.options.iconSize,o=.75*this.options.iconSize,n=e+.5*o+3;this.svg.style.width=s+5+e+"px";for(var r in this.groups)this.groups.hasOwnProperty(r)&&(this.groups[r].drawIcon(i,n,this.svgElements,this.svg,s,o),n+=o+this.options.iconSpacing);DOMutil.cleanupElements(this.svgElements)}},DataAxis.prototype=new Component,DataAxis.prototype.addGroup=function(t,e){this.groups.hasOwnProperty(t)||(this.groups[t]=e),this.amountOfGroups+=1},DataAxis.prototype.updateGroup=function(t,e){this.groups[t]=e},DataAxis.prototype.removeGroup=function(t){this.groups.hasOwnProperty(t)&&(delete this.groups[t],this.amountOfGroups-=1)},DataAxis.prototype.setOptions=function(t){if(t){var e=!1;this.options.orientation!=t.orientation&&void 0!==t.orientation&&(e=!0);var i=["orientation","showMinorLabels","showMajorLabels","icons","majorLinesOffset","minorLinesOffset","labelOffsetX","labelOffsetY","iconWidth","width","visible"];util.selectiveExtend(i,this.options,t),this.minWidth=Number((""+this.options.width).replace("px","")),1==e&&this.dom.frame&&(this.hide(),this.show())}},DataAxis.prototype._create=function(){this.dom.frame=document.createElement("div"),this.dom.frame.style.width=this.options.width,this.dom.frame.style.height=this.height,this.dom.lineContainer=document.createElement("div"),this.dom.lineContainer.style.width="100%",this.dom.lineContainer.style.height=this.height,this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0px",this.svg.style.height="100%",this.svg.style.width="100%",this.svg.style.display="block",this.dom.frame.appendChild(this.svg)},DataAxis.prototype._redrawGroupIcons=function(){DOMutil.prepareElements(this.svgElements);var t,e=this.options.iconWidth,i=15,s=4,o=s+.5*i;t="left"==this.options.orientation?s:this.width-e-s;for(var n in this.groups)this.groups.hasOwnProperty(n)&&(this.groups[n].drawIcon(t,o,this.svgElements,this.svg,e,i),o+=i+s);DOMutil.cleanupElements(this.svgElements)},DataAxis.prototype.show=function(){this.dom.frame.parentNode||("left"==this.options.orientation?this.body.dom.left.appendChild(this.dom.frame):this.body.dom.right.appendChild(this.dom.frame)),this.dom.lineContainer.parentNode||this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer)},DataAxis.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom.lineContainer.parentNode&&this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer)},DataAxis.prototype.setRange=function(t,e){this.range.start=t,this.range.end=e},DataAxis.prototype.redraw=function(){var t=!1;if(0==this.amountOfGroups)this.hide();else{this.show(),this.height=Number(this.linegraphSVG.style.height.replace("px","")),this.dom.lineContainer.style.height=this.height+"px",this.width=1==this.options.visible?Number((""+this.options.width).replace("px","")):0;var e=this.props,i=this.dom.frame;i.className="dataaxis",this._calculateCharSize();var s=this.options.orientation,o=this.options.showMinorLabels,n=this.options.showMajorLabels;e.minorLabelHeight=o?e.minorCharHeight:0,e.majorLabelHeight=n?e.majorCharHeight:0,e.minorLineWidth=this.body.dom.backgroundHorizontal.offsetWidth-this.lineOffset-this.width+2*this.options.minorLinesOffset,e.minorLineHeight=1,e.majorLineWidth=this.body.dom.backgroundHorizontal.offsetWidth-this.lineOffset-this.width+2*this.options.majorLinesOffset,e.majorLineHeight=1,"left"==s?(i.style.top="0",i.style.left="0",i.style.bottom="",i.style.width=this.width+"px",i.style.height=this.height+"px"):(i.style.top="",i.style.bottom="0",i.style.left="0",i.style.width=this.width+"px",i.style.height=this.height+"px"),t=this._redrawLabels(),1==this.options.icons&&this._redrawGroupIcons()}return t},DataAxis.prototype._redrawLabels=function(){DOMutil.prepareElements(this.DOMelements);var t=this.options.orientation,e=this.master?this.props.majorCharHeight||10:this.stepPixelsForced,i=new DataStep(this.range.start,this.range.end,e,this.dom.frame.offsetHeight);this.step=i,i.first();var s=this.dom.frame.offsetHeight/(i.marginRange/i.step+1);this.stepPixels=s;var o=this.height/s,n=0;if(0==this.master){s=this.stepPixelsForced,n=Math.round(this.height/s-o);for(var r=0;.5*n>r;r++)i.previous();o=this.height/s}this.valueAtZero=i.marginEnd;var a=0,h=1;i.next(),this.maxLabelSize=0;for(var d=0;h=0&&this._redrawLabel(d-2,i.getCurrent(),t,"yAxis major",this.props.majorCharHeight),this._redrawLine(d,t,"grid horizontal major",this.options.majorLinesOffset,this.props.majorLineWidth)):this._redrawLine(d,t,"grid horizontal minor",this.options.minorLinesOffset,this.props.minorLineWidth),i.next(),h++ -}this.conversionFactor=a/((o-1)*i.step);var c=1==this.options.icons?this.options.iconWidth+this.options.labelOffsetX+15:this.options.labelOffsetX+15;return this.maxLabelSize>this.width-c&&1==this.options.visible?(this.width=this.maxLabelSize+c,this.options.width=this.width+"px",DOMutil.cleanupElements(this.DOMelements),this.redraw(),!0):this.maxLabelSizethis.minWidth?(this.width=Math.max(this.minWidth,this.maxLabelSize+c),this.options.width=this.width+"px",DOMutil.cleanupElements(this.DOMelements),this.redraw(),!0):(DOMutil.cleanupElements(this.DOMelements),!1)},DataAxis.prototype._redrawLabel=function(t,e,i,s,o){var n=DOMutil.getDOMElement("div",this.DOMelements,this.dom.frame);n.className=s,n.innerHTML=e,"left"==i?(n.style.left="-"+this.options.labelOffsetX+"px",n.style.textAlign="right"):(n.style.right="-"+this.options.labelOffsetX+"px",n.style.textAlign="left"),n.style.top=t-.5*o+this.options.labelOffsetY+"px",e+="";var r=Math.max(this.props.majorCharWidth,this.props.minorCharWidth);this.maxLabelSize0){for(s=0;sc){e.push(m);break}e.push(m)}}else for(var u=0;ul&&m.x0){for(var p=0;pi?i:a,d=s>d?s:d):(r=!0,h=h>i?i:h,l=s>l?s:l)}1==n&&this.yAxisLeft.setRange(a,d),1==r&&this.yAxisRight.setRange(h,l)}return o=this._toggleAxisVisiblity(n,this.yAxisLeft)||o,o=this._toggleAxisVisiblity(r,this.yAxisRight)||o,1==r&&1==n?(this.yAxisLeft.drawIcons=!0,this.yAxisRight.drawIcons=!0):(this.yAxisLeft.drawIcons=!1,this.yAxisRight.drawIcons=!1),this.yAxisRight.master=!n,0==this.yAxisRight.master?(1==r&&(this.yAxisLeft.lineOffset=this.yAxisRight.width),o=this.yAxisLeft.redraw()||o,this.yAxisRight.stepPixelsForced=this.yAxisLeft.stepPixels,o=this.yAxisRight.redraw()||o):o=this.yAxisRight.redraw()||o,o},LineGraph.prototype._toggleAxisVisiblity=function(t,e){var i=!1;return 0==t?e.dom.frame.parentNode&&(e.hide(),i=!0):e.dom.frame.parentNode||(e.show(),i=!0),i},LineGraph.prototype._drawBarGraph=function(t,e){if(null!=t&&t.length>0){var i,s=.1*e.options.barChart.width,o=0,n=e.options.barChart.width;"left"==e.options.barChart.align?o-=.5*n:"right"==e.options.barChart.align&&(o+=.5*n);for(var r=0;r0&&(i=Math.min(i,Math.abs(t[r-1].x-t[r].x))),n>i&&(n=s>i?s:i),DOMutil.drawBar(t[r].x+o,t[r].y,n,e.zeroPosition-t[r].y,e.className+" bar",this.svgElements,this.svg);1==e.options.drawPoints.enabled&&this._drawPoints(t,e,this.svgElements,this.svg,o)}},LineGraph.prototype._drawLineGraph=function(t,e){if(null!=t&&t.length>0){var i,s,o=Number(this.svg.style.height.replace("px",""));if(i=DOMutil.getSVGElement("path",this.svgElements,this.svg),i.setAttributeNS(null,"class",e.className),s=1==e.options.catmullRom.enabled?this._catmullRom(t,e):this._linear(t),1==e.options.shaded.enabled){var n,r=DOMutil.getSVGElement("path",this.svgElements,this.svg);n="top"==e.options.shaded.orientation?"M"+t[0].x+",0 "+s+"L"+t[t.length-1].x+",0":"M"+t[0].x+","+o+" "+s+"L"+t[t.length-1].x+","+o,r.setAttributeNS(null,"class",e.className+" fill"),r.setAttributeNS(null,"d",n)}i.setAttributeNS(null,"d","M"+s),1==e.options.drawPoints.enabled&&this._drawPoints(t,e,this.svgElements,this.svg)}},LineGraph.prototype._drawPoints=function(t,e,i,s,o){void 0===o&&(o=0);for(var n=0;np;p+=r)i=n(t[p].x)+this.width-1,s=t[p].y,o.push({x:i,y:s}),h=h>s?s:h,d=s>d?s:d;return{min:h,max:d,data:o}},LineGraph.prototype._convertYvalues=function(t,e){var i,s,o=[],n=this.yAxisLeft,r=Number(this.svg.style.height.replace("px",""));"right"==e.options.yAxisOrientation&&(n=this.yAxisRight);for(var a=0;al;l++)e=0==l?t[0]:t[l-1],i=t[l],s=t[l+1],o=d>l+2?t[l+2]:s,n={x:(-e.x+6*i.x+s.x)*h,y:(-e.y+6*i.y+s.y)*h},r={x:(i.x+6*s.x-o.x)*h,y:(i.y+6*s.y-o.y)*h},a+="C"+n.x+","+n.y+" "+r.x+","+r.y+" "+s.x+","+s.y+" ";return a},LineGraph.prototype._catmullRom=function(t,e){var i=e.options.catmullRom.alpha;if(0==i||void 0===i)return this._catmullRomUniform(t);for(var s,o,n,r,a,h,d,l,c,p,u,m,g,f,v,y,b,_,w,x=Math.round(t[0].x)+","+Math.round(t[0].y)+" ",S=t.length,D=0;S-1>D;D++)s=0==D?t[0]:t[D-1],o=t[D],n=t[D+1],r=S>D+2?t[D+2]:n,d=Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2)),l=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),c=Math.sqrt(Math.pow(n.x-r.x,2)+Math.pow(n.y-r.y,2)),f=Math.pow(c,i),y=Math.pow(c,2*i),v=Math.pow(l,i),b=Math.pow(l,2*i),w=Math.pow(d,i),_=Math.pow(d,2*i),p=2*_+3*w*v+b,u=2*y+3*f*v+b,m=3*w*(w+v),m>0&&(m=1/m),g=3*f*(f+v),g>0&&(g=1/g),a={x:(-b*s.x+p*o.x+_*n.x)*m,y:(-b*s.y+p*o.y+_*n.y)*m},h={x:(y*o.x+u*n.x-b*r.x)*g,y:(y*o.y+u*n.y-b*r.y)*g},0==a.x&&0==a.y&&(a=o),0==h.x&&0==h.y&&(h=n),x+="C"+a.x+","+a.y+" "+h.x+","+h.y+" "+n.x+","+n.y+" ";return x},LineGraph.prototype._linear=function(t){for(var e="",i=0;in&&(h=n);for(var d=!1,l=h;Math.abs(l)<=Math.abs(n);l++){a=Math.pow(10,l);for(var c=0;c=o){d=!0,r=c;break}}if(1==d)break}this.stepIndex=r,this.scale=a,this.step=a*this.minorSteps[r]},DataStep.prototype.first=function(){this.setFirst()},DataStep.prototype.setFirst=function(){var t=this._start-this.scale*this.minorSteps[this.stepIndex],e=this._end+this.scale*this.minorSteps[this.stepIndex];this.marginEnd=this.roundToMinor(e),this.marginStart=this.roundToMinor(t),this.marginRange=this.marginEnd-this.marginStart,this.current=this.marginEnd},DataStep.prototype.roundToMinor=function(t){var e=t-t%(this.scale*this.minorSteps[this.stepIndex]);return t%(this.scale*this.minorSteps[this.stepIndex])>.5*this.scale*this.minorSteps[this.stepIndex]?e+this.scale*this.minorSteps[this.stepIndex]:e},DataStep.prototype.hasNext=function(){return this.current>=this.marginStart},DataStep.prototype.next=function(){var t=this.current;this.current-=this.step,this.current==t&&(this.current=this._end)},DataStep.prototype.previous=function(){this.current+=this.step,this.marginEnd+=this.step,this.marginRange=this.marginEnd-this.marginStart},DataStep.prototype.getCurrent=function(){for(var t=""+Number(this.current).toPrecision(5),e=t.length-1;e>0;e--){if("0"!=t[e]){if("."==t[e]||","==t[e]){t=t.slice(0,e);break}break}t=t.slice(0,e)}return t},DataStep.prototype.snap=function(){},DataStep.prototype.isMajor=function(){return this.current%(this.scale*this.majorSteps[this.stepIndex])==0};var stack={};stack.orderByStart=function(t){t.sort(function(t,e){return t.data.start-e.data.start})},stack.orderByEnd=function(t){t.sort(function(t,e){var i="end"in t.data?t.data.end:t.data.start,s="end"in e.data?e.data.end:e.data.start;return i-s})},stack.stack=function(t,e,i){var s,o;if(i)for(s=0,o=t.length;o>s;s++)t[s].top=null;for(s=0,o=t.length;o>s;s++){var n=t[s];if(null===n.top){n.top=e.axis;do{for(var r=null,a=0,h=t.length;h>a;a++){var d=t[a];if(null!==d.top&&d!==n&&stack.collision(n,d,e.item)){r=d;break}}null!=r&&(n.top=r.top+r.height+e.item)}while(r)}}},stack.nostack=function(t,e){var i,s;for(i=0,s=t.length;s>i;i++)t[i].top=e.axis},stack.collision=function(t,e,i){return t.left-ie.left&&t.top-ie.top},TimeStep.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,WEEKDAY:6,MONTH:7,YEAR:8},TimeStep.prototype.setRange=function(t,e,i){if(!(t instanceof Date&&e instanceof Date))throw"No legal start or end date in method setRange";this._start=void 0!=t?new Date(t.valueOf()):new Date,this._end=void 0!=e?new Date(e.valueOf()):new Date,this.autoScale&&this.setMinimumStep(i)},TimeStep.prototype.first=function(){this.current=new Date(this._start.valueOf()),this.roundToMinor()},TimeStep.prototype.roundToMinor=function(){switch(this.scale){case TimeStep.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step)),this.current.setMonth(0);case TimeStep.SCALE.MONTH:this.current.setDate(1);case TimeStep.SCALE.DAY:case TimeStep.SCALE.WEEKDAY:this.current.setHours(0);case TimeStep.SCALE.HOUR:this.current.setMinutes(0);case TimeStep.SCALE.MINUTE:this.current.setSeconds(0);case TimeStep.SCALE.SECOND:this.current.setMilliseconds(0)}if(1!=this.step)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case TimeStep.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case TimeStep.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()-1-(this.current.getDate()-1)%this.step+1);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step)}},TimeStep.prototype.hasNext=function(){return this.current.valueOf()<=this._end.valueOf()},TimeStep.prototype.next=function(){var t=this.current.valueOf();if(this.current.getMonth()<6)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current=new Date(this.current.valueOf()+1e3*this.step);break;case TimeStep.SCALE.MINUTE:this.current=new Date(this.current.valueOf()+1e3*this.step*60);break;case TimeStep.SCALE.HOUR:this.current=new Date(this.current.valueOf()+1e3*this.step*60*60);var e=this.current.getHours();this.current.setHours(e-e%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}else switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case TimeStep.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case TimeStep.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}if(1!=this.step)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current.getMilliseconds()0&&(this.step=e),this.autoScale=!1},TimeStep.prototype.setAutoScale=function(t){this.autoScale=t},TimeStep.prototype.setMinimumStep=function(t){if(void 0!=t){var e=31104e6,i=2592e6,s=864e5,o=36e5,n=6e4,r=1e3,a=1;1e3*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=1e3),500*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=500),100*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=100),50*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=50),10*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=10),5*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=5),e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=1),3*i>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=3),i>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=1),5*s>t&&(this.scale=TimeStep.SCALE.DAY,this.step=5),2*s>t&&(this.scale=TimeStep.SCALE.DAY,this.step=2),s>t&&(this.scale=TimeStep.SCALE.DAY,this.step=1),s/2>t&&(this.scale=TimeStep.SCALE.WEEKDAY,this.step=1),4*o>t&&(this.scale=TimeStep.SCALE.HOUR,this.step=4),o>t&&(this.scale=TimeStep.SCALE.HOUR,this.step=1),15*n>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=15),10*n>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=10),5*n>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=5),n>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=1),15*r>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=15),10*r>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=10),5*r>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=5),r>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=1),200*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=200),100*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=100),50*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=50),10*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=10),5*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=5),a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=1)}},TimeStep.prototype.snap=function(t){var e=new Date(t.valueOf());if(this.scale==TimeStep.SCALE.YEAR){var i=e.getFullYear()+Math.round(e.getMonth()/12);e.setFullYear(Math.round(i/this.step)*this.step),e.setMonth(0),e.setDate(0),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.MONTH)e.getDate()>15?(e.setDate(1),e.setMonth(e.getMonth()+1)):e.setDate(1),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);else if(this.scale==TimeStep.SCALE.DAY){switch(this.step){case 5:case 2:e.setHours(24*Math.round(e.getHours()/24));break;default:e.setHours(12*Math.round(e.getHours()/12))}e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.WEEKDAY){switch(this.step){case 5:case 2:e.setHours(12*Math.round(e.getHours()/12));break;default:e.setHours(6*Math.round(e.getHours()/6))}e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.HOUR){switch(this.step){case 4:e.setMinutes(60*Math.round(e.getMinutes()/60));break;default:e.setMinutes(30*Math.round(e.getMinutes()/30))}e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.MINUTE){switch(this.step){case 15:case 10:e.setMinutes(5*Math.round(e.getMinutes()/5)),e.setSeconds(0);break;case 5:e.setSeconds(60*Math.round(e.getSeconds()/60));break;default:e.setSeconds(30*Math.round(e.getSeconds()/30))}e.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.SECOND)switch(this.step){case 15:case 10:e.setSeconds(5*Math.round(e.getSeconds()/5)),e.setMilliseconds(0);break;case 5:e.setMilliseconds(1e3*Math.round(e.getMilliseconds()/1e3));break;default:e.setMilliseconds(500*Math.round(e.getMilliseconds()/500))}else if(this.scale==TimeStep.SCALE.MILLISECOND){var s=this.step>5?this.step/2:1;e.setMilliseconds(Math.round(e.getMilliseconds()/s)*s)}return e},TimeStep.prototype.isMajor=function(){switch(this.scale){case TimeStep.SCALE.MILLISECOND:return 0==this.current.getMilliseconds();case TimeStep.SCALE.SECOND:return 0==this.current.getSeconds();case TimeStep.SCALE.MINUTE:return 0==this.current.getHours()&&0==this.current.getMinutes();case TimeStep.SCALE.HOUR:return 0==this.current.getHours();case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:return 1==this.current.getDate();case TimeStep.SCALE.MONTH:return 0==this.current.getMonth();case TimeStep.SCALE.YEAR:return!1;default:return!1}},TimeStep.prototype.getLabelMinor=function(t){switch(void 0==t&&(t=this.current),this.scale){case TimeStep.SCALE.MILLISECOND:return moment(t).format("SSS");case TimeStep.SCALE.SECOND:return moment(t).format("s");case TimeStep.SCALE.MINUTE:return moment(t).format("HH:mm");case TimeStep.SCALE.HOUR:return moment(t).format("HH:mm");case TimeStep.SCALE.WEEKDAY:return moment(t).format("ddd D");case TimeStep.SCALE.DAY:return moment(t).format("D");case TimeStep.SCALE.MONTH:return moment(t).format("MMM");case TimeStep.SCALE.YEAR:return moment(t).format("YYYY");default:return""}},TimeStep.prototype.getLabelMajor=function(t){switch(void 0==t&&(t=this.current),this.scale){case TimeStep.SCALE.MILLISECOND:return moment(t).format("HH:mm:ss");case TimeStep.SCALE.SECOND:return moment(t).format("D MMMM HH:mm");case TimeStep.SCALE.MINUTE:case TimeStep.SCALE.HOUR:return moment(t).format("ddd D MMMM");case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:return moment(t).format("MMMM YYYY");case TimeStep.SCALE.MONTH:return moment(t).format("YYYY");case TimeStep.SCALE.YEAR:return"";default:return""}},Range.prototype=new Component,Range.prototype.setOptions=function(t){if(t){var e=["direction","min","max","zoomMin","zoomMax","moveable","zoomable"];util.selectiveExtend(e,this.options,t),("start"in t||"end"in t)&&this.setRange(t.start,t.end)}},Range.prototype.setRange=function(t,e){var i=this._applyRange(t,e);if(i){var s={start:new Date(this.start),end:new Date(this.end)};this.body.emitter.emit("rangechange",s),this.body.emitter.emit("rangechanged",s)}},Range.prototype._applyRange=function(t,e){var i,s=null!=t?util.convert(t,"Date").valueOf():this.start,o=null!=e?util.convert(e,"Date").valueOf():this.end,n=null!=this.options.max?util.convert(this.options.max,"Date").valueOf():null,r=null!=this.options.min?util.convert(this.options.min,"Date").valueOf():null;if(isNaN(s)||null===s)throw new Error('Invalid start "'+t+'"');if(isNaN(o)||null===o)throw new Error('Invalid end "'+e+'"');if(s>o&&(o=s),null!==r&&r>s&&(i=r-s,s+=i,o+=i,null!=n&&o>n&&(o=n)),null!==n&&o>n&&(i=o-n,s-=i,o-=i,null!=r&&r>s&&(s=r)),null!==this.options.zoomMin){var a=parseFloat(this.options.zoomMin);0>a&&(a=0),a>o-s&&(this.end-this.start===a?(s=this.start,o=this.end):(i=a-(o-s),s-=i/2,o+=i/2))}if(null!==this.options.zoomMax){var h=parseFloat(this.options.zoomMax);0>h&&(h=0),o-s>h&&(this.end-this.start===h?(s=this.start,o=this.end):(i=o-s-h,s+=i/2,o-=i/2))}var d=this.start!=s||this.end!=o;return this.start=s,this.end=o,d},Range.prototype.getRange=function(){return{start:this.start,end:this.end}},Range.prototype.conversion=function(t){return Range.conversion(this.start,this.end,t)},Range.conversion=function(t,e,i){return 0!=i&&e-t!=0?{offset:t,scale:i/(e-t)}:{offset:0,scale:1}},Range.prototype._onDragStart=function(){this.options.moveable&&this.props.touch.allowDragging&&(this.props.touch.start=this.start,this.props.touch.end=this.end,this.body.dom.root&&(this.body.dom.root.style.cursor="move"))},Range.prototype._onDrag=function(t){if(this.options.moveable){var e=this.options.direction;if(validateDirection(e),this.props.touch.allowDragging){var i="horizontal"==e?t.gesture.deltaX:t.gesture.deltaY,s=this.props.touch.end-this.props.touch.start,o="horizontal"==e?this.body.domProps.center.width:this.body.domProps.center.height,n=-i/o*s;this._applyRange(this.props.touch.start+n,this.props.touch.end+n),this.body.emitter.emit("rangechange",{start:new Date(this.start),end:new Date(this.end)})}}},Range.prototype._onDragEnd=function(){this.options.moveable&&this.props.touch.allowDragging&&(this.body.dom.root&&(this.body.dom.root.style.cursor="auto"),this.body.emitter.emit("rangechanged",{start:new Date(this.start),end:new Date(this.end)}))},Range.prototype._onMouseWheel=function(t){if(this.options.zoomable&&this.options.moveable){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),e){var i;i=0>e?1-e/5:1/(1+e/5);var s=util.fakeGesture(this,t),o=getPointer(s.center,this.body.dom.center),n=this._pointerToDate(o);this.zoom(i,n)}t.preventDefault()}},Range.prototype._onTouch=function(){this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.allowDragging=!0,this.props.touch.center=null},Range.prototype._onHold=function(){this.props.touch.allowDragging=!1},Range.prototype._onPinch=function(t){if(this.options.zoomable&&this.options.moveable&&(this.props.touch.allowDragging=!1,t.gesture.touches.length>1)){this.props.touch.center||(this.props.touch.center=getPointer(t.gesture.center,this.body.dom.center));var e=1/t.gesture.scale,i=this._pointerToDate(this.props.touch.center),s=parseInt(i+(this.props.touch.start-i)*e),o=parseInt(i+(this.props.touch.end-i)*e);this.setRange(s,o)}},Range.prototype._pointerToDate=function(t){var e,i=this.options.direction;if(validateDirection(i),"horizontal"==i){var s=this.body.domProps.center.width;return e=this.conversion(s),t.x/e.scale+e.offset}var o=this.body.domProps.center.height;return e=this.conversion(o),t.y/e.scale+e.offset},Range.prototype.zoom=function(t,e){null==e&&(e=(this.start+this.end)/2);var i=e+(this.start-e)*t,s=e+(this.end-e)*t;this.setRange(i,s)},Range.prototype.move=function(t){var e=this.end-this.start,i=this.start+e*t,s=this.end+e*t;this.start=i,this.end=s},Range.prototype.moveTo=function(t){var e=(this.start+this.end)/2,i=e-t,s=this.start-i,o=this.end-i;this.setRange(s,o)},Component.prototype.setOptions=function(t){t&&util.extend(this.options,t)},Component.prototype.redraw=function(){return!1},Component.prototype.destroy=function(){},Component.prototype._isResized=function(){var t=this.props._previousWidth!==this.props.width||this.props._previousHeight!==this.props.height;return this.props._previousWidth=this.props.width,this.props._previousHeight=this.props.height,t},TimeAxis.prototype=new Component,TimeAxis.prototype.setOptions=function(t){t&&util.selectiveExtend(["orientation","showMinorLabels","showMajorLabels"],this.options,t)},TimeAxis.prototype._create=function(){this.dom.foreground=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.foreground.className="timeaxis foreground",this.dom.background.className="timeaxis background"},TimeAxis.prototype.destroy=function(){this.dom.foreground.parentNode&&this.dom.foreground.parentNode.removeChild(this.dom.foreground),this.dom.background.parentNode&&this.dom.background.parentNode.removeChild(this.dom.background),this.body=null -},TimeAxis.prototype.redraw=function(){var t=this.options,e=this.props,i=this.dom.foreground,s=this.dom.background,o="top"==t.orientation?this.body.dom.top:this.body.dom.bottom,n=i.parentNode!==o;this._calculateCharSize();var r=(this.options.orientation,this.options.showMinorLabels),a=this.options.showMajorLabels;e.minorLabelHeight=r?e.minorCharHeight:0,e.majorLabelHeight=a?e.majorCharHeight:0,e.height=e.minorLabelHeight+e.majorLabelHeight,e.width=i.offsetWidth,e.minorLineHeight=this.body.domProps.root.height-e.majorLabelHeight-("top"==t.orientation?this.body.domProps.bottom.height:this.body.domProps.top.height),e.minorLineWidth=1,e.majorLineHeight=e.minorLineHeight+e.majorLabelHeight,e.majorLineWidth=1;var h=i.nextSibling,d=s.nextSibling;return i.parentNode&&i.parentNode.removeChild(i),s.parentNode&&s.parentNode.removeChild(s),i.style.height=this.props.height+"px",this._repaintLabels(),h?o.insertBefore(i,h):o.appendChild(i),d?this.body.dom.backgroundVertical.insertBefore(s,d):this.body.dom.backgroundVertical.appendChild(s),this._isResized()||n},TimeAxis.prototype._repaintLabels=function(){var t=this.options.orientation,e=util.convert(this.body.range.start,"Number"),i=util.convert(this.body.range.end,"Number"),s=this.body.util.toTime(7*(this.props.minorCharWidth||10)).valueOf()-this.body.util.toTime(0).valueOf(),o=new TimeStep(new Date(e),new Date(i),s);this.step=o;var n=this.dom;n.redundant.majorLines=n.majorLines,n.redundant.majorTexts=n.majorTexts,n.redundant.minorLines=n.minorLines,n.redundant.minorTexts=n.minorTexts,n.majorLines=[],n.majorTexts=[],n.minorLines=[],n.minorTexts=[],o.first();for(var r=void 0,a=0;o.hasNext()&&1e3>a;){a++;var h=o.getCurrent(),d=this.body.util.toScreen(h),l=o.isMajor();this.options.showMinorLabels&&this._repaintMinorText(d,o.getLabelMinor(),t),l&&this.options.showMajorLabels?(d>0&&(void 0==r&&(r=d),this._repaintMajorText(d,o.getLabelMajor(),t)),this._repaintMajorLine(d,t)):this._repaintMinorLine(d,t),o.next()}if(this.options.showMajorLabels){var c=this.body.util.toTime(0),p=o.getLabelMajor(c),u=p.length*(this.props.majorCharWidth||10)+10;(void 0==r||r>u)&&this._repaintMajorText(0,p,t)}util.forEach(this.dom.redundant,function(t){for(;t.length;){var e=t.pop();e&&e.parentNode&&e.parentNode.removeChild(e)}})},TimeAxis.prototype._repaintMinorText=function(t,e,i){var s=this.dom.redundant.minorTexts.shift();if(!s){var o=document.createTextNode("");s=document.createElement("div"),s.appendChild(o),s.className="text minor",this.dom.foreground.appendChild(s)}this.dom.minorTexts.push(s),s.childNodes[0].nodeValue=e,s.style.top="top"==i?this.props.majorLabelHeight+"px":"0",s.style.left=t+"px"},TimeAxis.prototype._repaintMajorText=function(t,e,i){var s=this.dom.redundant.majorTexts.shift();if(!s){var o=document.createTextNode(e);s=document.createElement("div"),s.className="text major",s.appendChild(o),this.dom.foreground.appendChild(s)}this.dom.majorTexts.push(s),s.childNodes[0].nodeValue=e,s.style.top="top"==i?"0":this.props.minorLabelHeight+"px",s.style.left=t+"px"},TimeAxis.prototype._repaintMinorLine=function(t,e){var i=this.dom.redundant.minorLines.shift();i||(i=document.createElement("div"),i.className="grid vertical minor",this.dom.background.appendChild(i)),this.dom.minorLines.push(i);var s=this.props;i.style.top="top"==e?s.majorLabelHeight+"px":this.body.domProps.top.height+"px",i.style.height=s.minorLineHeight+"px",i.style.left=t-s.minorLineWidth/2+"px"},TimeAxis.prototype._repaintMajorLine=function(t,e){var i=this.dom.redundant.majorLines.shift();i||(i=document.createElement("DIV"),i.className="grid vertical major",this.dom.background.appendChild(i)),this.dom.majorLines.push(i);var s=this.props;i.style.top="top"==e?"0":this.body.domProps.top.height+"px",i.style.left=t-s.majorLineWidth/2+"px",i.style.height=s.majorLineHeight+"px"},TimeAxis.prototype._calculateCharSize=function(){this.dom.measureCharMinor||(this.dom.measureCharMinor=document.createElement("DIV"),this.dom.measureCharMinor.className="text minor measure",this.dom.measureCharMinor.style.position="absolute",this.dom.measureCharMinor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMinor)),this.props.minorCharHeight=this.dom.measureCharMinor.clientHeight,this.props.minorCharWidth=this.dom.measureCharMinor.clientWidth,this.dom.measureCharMajor||(this.dom.measureCharMajor=document.createElement("DIV"),this.dom.measureCharMajor.className="text minor measure",this.dom.measureCharMajor.style.position="absolute",this.dom.measureCharMajor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMajor)),this.props.majorCharHeight=this.dom.measureCharMajor.clientHeight,this.props.majorCharWidth=this.dom.measureCharMajor.clientWidth},TimeAxis.prototype.snap=function(t){return this.step.snap(t)},CurrentTime.prototype=new Component,CurrentTime.prototype._create=function(){var t=document.createElement("div");t.className="currenttime",t.style.position="absolute",t.style.top="0px",t.style.height="100%",this.bar=t},CurrentTime.prototype.destroy=function(){this.options.showCurrentTime=!1,this.redraw(),this.body=null},CurrentTime.prototype.setOptions=function(t){t&&util.selectiveExtend(["showCurrentTime"],this.options,t)},CurrentTime.prototype.redraw=function(){if(this.options.showCurrentTime){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar),this.start());var e=new Date,i=this.body.util.toScreen(e);this.bar.style.left=i+"px",this.bar.title="Current time: "+e}else this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),this.stop();return!1},CurrentTime.prototype.start=function(){function t(){e.stop();var i=e.body.range.conversion(e.body.domProps.center.width).scale,s=1/i/10;30>s&&(s=30),s>1e3&&(s=1e3),e.redraw(),e.currentTimeTimer=setTimeout(t,s)}var e=this;t()},CurrentTime.prototype.stop=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer)},CustomTime.prototype=new Component,CustomTime.prototype.setOptions=function(t){t&&util.selectiveExtend(["showCustomTime"],this.options,t)},CustomTime.prototype._create=function(){var t=document.createElement("div");t.className="customtime",t.style.position="absolute",t.style.top="0px",t.style.height="100%",this.bar=t;var e=document.createElement("div");e.style.position="relative",e.style.top="0px",e.style.left="-10px",e.style.height="100%",e.style.width="20px",t.appendChild(e),this.hammer=Hammer(t,{prevent_default:!0}),this.hammer.on("dragstart",this._onDragStart.bind(this)),this.hammer.on("drag",this._onDrag.bind(this)),this.hammer.on("dragend",this._onDragEnd.bind(this))},CustomTime.prototype.destroy=function(){this.options.showCustomTime=!1,this.redraw(),this.hammer.enable(!1),this.hammer=null,this.body=null},CustomTime.prototype.redraw=function(){if(this.options.showCustomTime){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar));var e=this.body.util.toScreen(this.customTime);this.bar.style.left=e+"px",this.bar.title="Time: "+this.customTime}else this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar);return!1},CustomTime.prototype.setCustomTime=function(t){this.customTime=new Date(t.valueOf()),this.redraw()},CustomTime.prototype.getCustomTime=function(){return new Date(this.customTime.valueOf())},CustomTime.prototype._onDragStart=function(t){this.eventParams.dragging=!0,this.eventParams.customTime=this.customTime,t.stopPropagation(),t.preventDefault()},CustomTime.prototype._onDrag=function(t){if(this.eventParams.dragging){var e=t.gesture.deltaX,i=this.body.util.toScreen(this.eventParams.customTime)+e,s=this.body.util.toTime(i);this.setCustomTime(s),this.body.emitter.emit("timechange",{time:new Date(this.customTime.valueOf())}),t.stopPropagation(),t.preventDefault()}},CustomTime.prototype._onDragEnd=function(t){this.eventParams.dragging&&(this.body.emitter.emit("timechanged",{time:new Date(this.customTime.valueOf())}),t.stopPropagation(),t.preventDefault())};var UNGROUPED="__ungrouped__";ItemSet.prototype=new Component,ItemSet.types={box:ItemBox,range:ItemRange,point:ItemPoint},ItemSet.prototype._create=function(){var t=document.createElement("div");t.className="itemset",t["timeline-itemset"]=this,this.dom.frame=t;var e=document.createElement("div");e.className="background",t.appendChild(e),this.dom.background=e;var i=document.createElement("div");i.className="foreground",t.appendChild(i),this.dom.foreground=i;var s=document.createElement("div");s.className="axis",this.dom.axis=s;var o=document.createElement("div");o.className="labelset",this.dom.labelSet=o,this._updateUngrouped(),this.hammer=Hammer(this.body.dom.centerContainer,{prevent_default:!0}),this.hammer.on("touch",this._onTouch.bind(this)),this.hammer.on("dragstart",this._onDragStart.bind(this)),this.hammer.on("drag",this._onDrag.bind(this)),this.hammer.on("dragend",this._onDragEnd.bind(this)),this.hammer.on("tap",this._onSelectItem.bind(this)),this.hammer.on("hold",this._onMultiSelectItem.bind(this)),this.hammer.on("doubletap",this._onAddItem.bind(this)),this.show()},ItemSet.prototype.setOptions=function(t){if(t){var e=["type","align","orientation","padding","stack","selectable","groupOrder"];util.selectiveExtend(e,this.options,t),"margin"in t&&("number"==typeof t.margin?(this.options.margin.axis=t.margin,this.options.margin.item=t.margin):"object"==typeof t.margin&&util.selectiveExtend(["axis","item"],this.options.margin,t.margin)),"editable"in t&&("boolean"==typeof t.editable?(this.options.editable.updateTime=t.editable,this.options.editable.updateGroup=t.editable,this.options.editable.add=t.editable,this.options.editable.remove=t.editable):"object"==typeof t.editable&&util.selectiveExtend(["updateTime","updateGroup","add","remove"],this.options.editable,t.editable));var i=function(e){if(e in t){var i=t[e];if(!(i instanceof Function)||2!=i.length)throw new Error("option "+e+" must be a function "+e+"(item, callback)");this.options[e]=i}}.bind(this);["onAdd","onUpdate","onRemove","onMove"].forEach(i),this.markDirty()}},ItemSet.prototype.markDirty=function(){this.groupIds=[],this.stackDirty=!0},ItemSet.prototype.destroy=function(){this.hide(),this.setItems(null),this.setGroups(null),this.hammer=null,this.body=null,this.conversion=null},ItemSet.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom.axis.parentNode&&this.dom.axis.parentNode.removeChild(this.dom.axis),this.dom.labelSet.parentNode&&this.dom.labelSet.parentNode.removeChild(this.dom.labelSet)},ItemSet.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame),this.dom.axis.parentNode||this.body.dom.backgroundVertical.appendChild(this.dom.axis),this.dom.labelSet.parentNode||this.body.dom.left.appendChild(this.dom.labelSet)},ItemSet.prototype.setSelection=function(t){var e,i,s,o;if(t){if(!Array.isArray(t))throw new TypeError("Array expected");for(e=0,i=this.selection.length;i>e;e++)s=this.selection[e],o=this.items[s],o&&o.unselect();for(this.selection=[],e=0,i=t.length;i>e;e++)s=t[e],o=this.items[s],o&&(this.selection.push(s),o.select())}},ItemSet.prototype.getSelection=function(){return this.selection.concat([])},ItemSet.prototype._deselect=function(t){for(var e=this.selection,i=0,s=e.length;s>i;i++)if(e[i]==t){e.splice(i,1);break}},ItemSet.prototype.redraw=function(){var t=this.options.margin,e=this.body.range,i=util.option.asSize,s=this.options,o=s.orientation,n=!1,r=this.dom.frame,a=s.editable.updateTime||s.editable.updateGroup;r.className="itemset"+(a?" editable":""),n=this._orderGroups()||n;var h=e.end-e.start,d=h!=this.lastVisibleInterval||this.props.width!=this.props.lastWidth;d&&(this.stackDirty=!0),this.lastVisibleInterval=h,this.props.lastWidth=this.props.width;var l=this.stackDirty,c=this._firstGroup(),p={item:t.item,axis:t.axis},u={item:t.item,axis:t.item/2},m=0,g=t.axis+t.item;return util.forEach(this.groups,function(t){var i=t==c?p:u,s=t.redraw(e,i,l);n=s||n,m+=t.height}),m=Math.max(m,g),this.stackDirty=!1,r.style.height=i(m),this.props.top=r.offsetTop,this.props.left=r.offsetLeft,this.props.width=r.offsetWidth,this.props.height=m,this.dom.axis.style.top=i("top"==o?this.body.domProps.top.height+this.body.domProps.border.top:this.body.domProps.top.height+this.body.domProps.centerContainer.height),this.dom.axis.style.left=this.body.domProps.border.left+"px",n=this._isResized()||n},ItemSet.prototype._firstGroup=function(){var t="top"==this.options.orientation?0:this.groupIds.length-1,e=this.groupIds[t],i=this.groups[e]||this.groups[UNGROUPED];return i||null},ItemSet.prototype._updateUngrouped=function(){var t=this.groups[UNGROUPED];if(this.groupsData)t&&(t.hide(),delete this.groups[UNGROUPED]);else if(!t){var e=null,i=null;t=new Group(e,i,this),this.groups[UNGROUPED]=t;for(var s in this.items)this.items.hasOwnProperty(s)&&t.add(this.items[s]);t.show()}},ItemSet.prototype.getLabelSet=function(){return this.dom.labelSet},ItemSet.prototype.setItems=function(t){var e,i=this,s=this.itemsData;if(t){if(!(t instanceof DataSet||t instanceof DataView))throw new TypeError("Data must be an instance of DataSet or DataView");this.itemsData=t}else this.itemsData=null;if(s&&(util.forEach(this.itemListeners,function(t,e){s.off(e,t)}),e=s.getIds(),this._onRemove(e)),this.itemsData){var o=this.id;util.forEach(this.itemListeners,function(t,e){i.itemsData.on(e,t,o)}),e=this.itemsData.getIds(),this._onAdd(e),this._updateUngrouped()}},ItemSet.prototype.getItems=function(){return this.itemsData},ItemSet.prototype.setGroups=function(t){var e,i=this;if(this.groupsData&&(util.forEach(this.groupListeners,function(t,e){i.groupsData.unsubscribe(e,t)}),e=this.groupsData.getIds(),this.groupsData=null,this._onRemoveGroups(e)),t){if(!(t instanceof DataSet||t instanceof DataView))throw new TypeError("Data must be an instance of DataSet or DataView");this.groupsData=t}else this.groupsData=null;if(this.groupsData){var s=this.id;util.forEach(this.groupListeners,function(t,e){i.groupsData.on(e,t,s)}),e=this.groupsData.getIds(),this._onAddGroups(e)}this._updateUngrouped(),this._order(),this.body.emitter.emit("change")},ItemSet.prototype.getGroups=function(){return this.groupsData},ItemSet.prototype.removeItem=function(t){var e=this.itemsData.get(t),i=this.itemsData.getDataSet();e&&this.options.onRemove(e,function(e){e&&i.remove(t)})},ItemSet.prototype._onUpdate=function(t){var e=this;t.forEach(function(t){var i=e.itemsData.get(t,e.itemOptions),s=e.items[t],o=i.type||e.options.type||(i.end?"range":"box"),n=ItemSet.types[o];if(s&&(n&&s instanceof n?e._updateItem(s,i):(e._removeItem(s),s=null)),!s){if(!n)throw new TypeError("rangeoverflow"==o?'Item type "rangeoverflow" is deprecated. Use css styling instead: .vis.timeline .item.range .content {overflow: visible;}':'Unknown item type "'+o+'"');s=new n(i,e.conversion,e.options),s.id=t,e._addItem(s)}}),this._order(),this.stackDirty=!0,this.body.emitter.emit("change")},ItemSet.prototype._onAdd=ItemSet.prototype._onUpdate,ItemSet.prototype._onRemove=function(t){var e=0,i=this;t.forEach(function(t){var s=i.items[t];s&&(e++,i._removeItem(s))}),e&&(this._order(),this.stackDirty=!0,this.body.emitter.emit("change"))},ItemSet.prototype._order=function(){util.forEach(this.groups,function(t){t.order()})},ItemSet.prototype._onUpdateGroups=function(t){this._onAddGroups(t)},ItemSet.prototype._onAddGroups=function(t){var e=this;t.forEach(function(t){var i=e.groupsData.get(t),s=e.groups[t];if(s)s.setData(i);else{if(t==UNGROUPED)throw new Error("Illegal group id. "+t+" is a reserved id.");var o=Object.create(e.options);util.extend(o,{height:null}),s=new Group(t,i,e),e.groups[t]=s;for(var n in e.items)if(e.items.hasOwnProperty(n)){var r=e.items[n];r.data.group==t&&s.add(r)}s.order(),s.show()}}),this.body.emitter.emit("change")},ItemSet.prototype._onRemoveGroups=function(t){var e=this.groups;t.forEach(function(t){var i=e[t];i&&(i.hide(),delete e[t])}),this.markDirty(),this.body.emitter.emit("change")},ItemSet.prototype._orderGroups=function(){if(this.groupsData){var t=this.groupsData.getIds({order:this.options.groupOrder}),e=!util.equalArray(t,this.groupIds);if(e){var i=this.groups;t.forEach(function(t){i[t].hide()}),t.forEach(function(t){i[t].show()}),this.groupIds=t}return e}return!1},ItemSet.prototype._addItem=function(t){this.items[t.id]=t;var e=this.groupsData?t.data.group:UNGROUPED,i=this.groups[e];i&&i.add(t)},ItemSet.prototype._updateItem=function(t,e){var i=t.data.group;if(t.data=e,t.displayed&&t.redraw(),i!=t.data.group){var s=this.groups[i];s&&s.remove(t);var o=this.groupsData?t.data.group:UNGROUPED,n=this.groups[o];n&&n.add(t)}},ItemSet.prototype._removeItem=function(t){t.hide(),delete this.items[t.id];var e=this.selection.indexOf(t.id);-1!=e&&this.selection.splice(e,1);var i=this.groupsData?t.data.group:UNGROUPED,s=this.groups[i];s&&s.remove(t)},ItemSet.prototype._constructByEndArray=function(t){for(var e=[],i=0;i0||s.length>0)&&this.body.emitter.emit("select",{items:this.getSelection()}),t.stopPropagation()}},ItemSet.prototype._onAddItem=function(t){if(this.options.selectable&&this.options.editable.add){var e=this,i=this.body.util.snap||null,s=ItemSet.itemFromTarget(t);if(s){var o=e.itemsData.get(s.id);this.options.onUpdate(o,function(t){t&&e.itemsData.update(t)})}else{var n=vis.util.getAbsoluteLeft(this.dom.frame),r=t.gesture.center.pageX-n,a=this.body.util.toTime(r),h={start:i?i(a):a,content:"new item"};if("range"===this.options.type){var d=this.body.util.toTime(r+this.props.width/5);h.end=i?i(d):d}h[this.itemsData.fieldId]=util.randomUUID();var l=ItemSet.groupFromTarget(t);l&&(h.group=l.groupId),this.options.onAdd(h,function(t){t&&e.itemsData.add(h)})}}},ItemSet.prototype._onMultiSelectItem=function(t){if(this.options.selectable){var e,i=ItemSet.itemFromTarget(t);if(i){e=this.getSelection();var s=e.indexOf(i.id);-1==s?e.push(i.id):e.splice(s,1),this.setSelection(e),this.body.emitter.emit("select",{items:this.getSelection()}),t.stopPropagation()}}},ItemSet.itemFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("timeline-item"))return e["timeline-item"];e=e.parentNode}return null},ItemSet.groupFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("timeline-group"))return e["timeline-group"];e=e.parentNode}return null},ItemSet.itemSetFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("timeline-itemset"))return e["timeline-itemset"];e=e.parentNode}return null},Item.prototype.select=function(){this.selected=!0,this.displayed&&this.redraw()},Item.prototype.unselect=function(){this.selected=!1,this.displayed&&this.redraw()},Item.prototype.setParent=function(t){this.displayed?(this.hide(),this.parent=t,this.parent&&this.show()):this.parent=t},Item.prototype.isVisible=function(){return!1},Item.prototype.show=function(){return!1},Item.prototype.hide=function(){return!1},Item.prototype.redraw=function(){},Item.prototype.repositionX=function(){},Item.prototype.repositionY=function(){},Item.prototype._repaintDeleteButton=function(t){if(this.selected&&this.options.editable.remove&&!this.dom.deleteButton){var e=this,i=document.createElement("div");i.className="delete",i.title="Delete this item",Hammer(i,{preventDefault:!0}).on("tap",function(t){e.parent.removeFromDataSet(e),t.stopPropagation()}),t.appendChild(i),this.dom.deleteButton=i}else!this.selected&&this.dom.deleteButton&&(this.dom.deleteButton.parentNode&&this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton),this.dom.deleteButton=null)},ItemBox.prototype=new Item(null,null,null),ItemBox.prototype.isVisible=function(t){var e=(t.end-t.start)/4;return this.data.start>t.start-e&&this.data.startt.start-e&&this.data.startt.start},ItemRange.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.box=document.createElement("div"),t.content=document.createElement("div"),t.content.className="content",t.box.appendChild(t.content),t.box["timeline-item"]=this),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.box.parentNode){var e=this.parent.dom.foreground;if(!e)throw new Error("Cannot redraw time axis: parent has no foreground container element");e.appendChild(t.box)}if(this.displayed=!0,this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)t.content.innerHTML="",t.content.appendChild(this.content);else{if(void 0==this.data.content)throw new Error('Property "content" missing in item '+this.data.id);t.content.innerHTML=this.content}this.dirty=!0}this.data.title!=this.title&&(t.box.title=this.data.title,this.title=this.data.title);var i=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=i&&(this.className=i,t.box.className=this.baseClassName+i,this.dirty=!0),this.dirty&&(this.overflow="hidden"!==window.getComputedStyle(t.content).overflow,this.props.content.width=this.dom.content.offsetWidth,this.height=this.dom.box.offsetHeight,this.dirty=!1),this._repaintDeleteButton(t.box),this._repaintDragLeft(),this._repaintDragRight()},ItemRange.prototype.show=function(){this.displayed||this.redraw()},ItemRange.prototype.hide=function(){if(this.displayed){var t=this.dom.box;t.parentNode&&t.parentNode.removeChild(t),this.top=null,this.left=null,this.displayed=!1}},ItemRange.prototype.repositionX=function(){var t,e=this.props,i=this.parent.width,s=this.conversion.toScreen(this.data.start),o=this.conversion.toScreen(this.data.end),n=this.options.padding;-i>s&&(s=-i),o>2*i&&(o=2*i);var r=Math.max(o-s,1);this.overflow?(t=Math.max(-s,0),this.left=s,this.width=r+this.props.content.width):(t=0>s?Math.min(-s,o-s-e.content.width-2*n):0,this.left=s,this.width=r),this.dom.box.style.left=this.left+"px",this.dom.box.style.width=r+"px",this.dom.content.style.left=t+"px"},ItemRange.prototype.repositionY=function(){var t=this.options.orientation,e=this.dom.box;e.style.top="top"==t?this.top+"px":this.parent.height-this.top-this.height+"px"},ItemRange.prototype._repaintDragLeft=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragLeft){var t=document.createElement("div");t.className="drag-left",t.dragLeftItem=this,Hammer(t,{preventDefault:!0}).on("drag",function(){}),this.dom.box.appendChild(t),this.dom.dragLeft=t}else!this.selected&&this.dom.dragLeft&&(this.dom.dragLeft.parentNode&&this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft),this.dom.dragLeft=null)},ItemRange.prototype._repaintDragRight=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragRight){var t=document.createElement("div");t.className="drag-right",t.dragRightItem=this,Hammer(t,{preventDefault:!0}).on("drag",function(){}),this.dom.box.appendChild(t),this.dom.dragRight=t}else!this.selected&&this.dom.dragRight&&(this.dom.dragRight.parentNode&&this.dom.dragRight.parentNode.removeChild(this.dom.dragRight),this.dom.dragRight=null)},Group.prototype._create=function(){var t=document.createElement("div");t.className="vlabel",this.dom.label=t;var e=document.createElement("div");e.className="inner",t.appendChild(e),this.dom.inner=e;var i=document.createElement("div");i.className="group",i["timeline-group"]=this,this.dom.foreground=i,this.dom.background=document.createElement("div"),this.dom.background.className="group",this.dom.axis=document.createElement("div"),this.dom.axis.className="group",this.dom.marker=document.createElement("div"),this.dom.marker.style.visibility="hidden",this.dom.marker.innerHTML="?",this.dom.background.appendChild(this.dom.marker) -},Group.prototype.setData=function(t){var e=t&&t.content;e instanceof Element?this.dom.inner.appendChild(e):this.dom.inner.innerHTML=void 0!=e?e:this.groupId,this.dom.label.title=t&&t.title||"",this.dom.inner.firstChild?util.removeClassName(this.dom.inner,"hidden"):util.addClassName(this.dom.inner,"hidden");var i=t&&t.className||null;i!=this.className&&(this.className&&(util.removeClassName(this.dom.label,i),util.removeClassName(this.dom.foreground,i),util.removeClassName(this.dom.background,i),util.removeClassName(this.dom.axis,i)),util.addClassName(this.dom.label,i),util.addClassName(this.dom.foreground,i),util.addClassName(this.dom.background,i),util.addClassName(this.dom.axis,i))},Group.prototype.getLabelWidth=function(){return this.props.label.width},Group.prototype.redraw=function(t,e,i){var s=!1;this.visibleItems=this._updateVisibleItems(this.orderedItems,this.visibleItems,t);var o=this.dom.marker.clientHeight;o!=this.lastMarkerHeight&&(this.lastMarkerHeight=o,util.forEach(this.items,function(t){t.dirty=!0,t.displayed&&t.redraw()}),i=!0),this.itemSet.options.stack?stack.stack(this.visibleItems,e,i):stack.nostack(this.visibleItems,e);var n,r=this.visibleItems;if(r.length){var a=r[0].top,h=r[0].top+r[0].height;if(util.forEach(r,function(t){a=Math.min(a,t.top),h=Math.max(h,t.top+t.height)}),a>e.axis){var d=a-e.axis;h-=d,util.forEach(r,function(t){t.top-=d})}n=h+e.item/2}else n=e.axis+e.item;n=Math.max(n,this.props.label.height);var l=this.dom.foreground;this.top=l.offsetTop,this.left=l.offsetLeft,this.width=l.offsetWidth,s=util.updateProperty(this,"height",n)||s,s=util.updateProperty(this.props.label,"width",this.dom.inner.clientWidth)||s,s=util.updateProperty(this.props.label,"height",this.dom.inner.clientHeight)||s,this.dom.background.style.height=n+"px",this.dom.foreground.style.height=n+"px",this.dom.label.style.height=n+"px";for(var c=0,p=this.visibleItems.length;p>c;c++){var u=this.visibleItems[c];u.repositionY()}return s},Group.prototype.show=function(){this.dom.label.parentNode||this.itemSet.dom.labelSet.appendChild(this.dom.label),this.dom.foreground.parentNode||this.itemSet.dom.foreground.appendChild(this.dom.foreground),this.dom.background.parentNode||this.itemSet.dom.background.appendChild(this.dom.background),this.dom.axis.parentNode||this.itemSet.dom.axis.appendChild(this.dom.axis)},Group.prototype.hide=function(){var t=this.dom.label;t.parentNode&&t.parentNode.removeChild(t);var e=this.dom.foreground;e.parentNode&&e.parentNode.removeChild(e);var i=this.dom.background;i.parentNode&&i.parentNode.removeChild(i);var s=this.dom.axis;s.parentNode&&s.parentNode.removeChild(s)},Group.prototype.add=function(t){if(this.items[t.id]=t,t.setParent(this),t instanceof ItemRange&&-1==this.visibleItems.indexOf(t)){var e=this.itemSet.body.range;this._checkIfVisible(t,this.visibleItems,e)}},Group.prototype.remove=function(t){delete this.items[t.id],t.setParent(this.itemSet);var e=this.visibleItems.indexOf(t);-1!=e&&this.visibleItems.splice(e,1)},Group.prototype.removeFromDataSet=function(t){this.itemSet.removeItem(t.id)},Group.prototype.order=function(){var t=util.toArray(this.items);this.orderedItems.byStart=t,this.orderedItems.byEnd=this._constructByEndArray(t),stack.orderByStart(this.orderedItems.byStart),stack.orderByEnd(this.orderedItems.byEnd)},Group.prototype._constructByEndArray=function(t){for(var e=[],i=0;i0)for(o=0;o=0&&!this._checkIfInvisible(t.byStart[o],n,i);o--);for(o=s+1;o=0&&!this._checkIfInvisible(t.byEnd[o],n,i);o--);for(o=r+1;o=s&&(s=864e5),e=new Date(e.valueOf()-.05*s),i=new Date(i.valueOf()+.05*s)}(null!==e||null!==i)&&this.range.setRange(e,i)},Timeline.prototype.getItemRange=function(){var t=this.itemsData.getDataSet(),e=null,i=null;if(t){var s=t.min("start");e=s?util.convert(s.start,"Date").valueOf():null;var o=t.max("start");o&&(i=util.convert(o.start,"Date").valueOf());var n=t.max("end");n&&(i=null==i?util.convert(n.end,"Date").valueOf():Math.max(i,util.convert(n.end,"Date").valueOf()))}return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}},Timeline.prototype.setSelection=function(t){this.itemSet&&this.itemSet.setSelection(t)},Timeline.prototype.getSelection=function(){return this.itemSet&&this.itemSet.getSelection()||[]},Timeline.prototype.setWindow=function(t,e){if(1==arguments.length){var i=arguments[0];this.range.setRange(i.start,i.end)}else this.range.setRange(t,e)},Timeline.prototype.getWindow=function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}},Timeline.prototype.redraw=function(){var t=!1,e=this.options,i=this.props,s=this.dom;if(s){s.root.className="vis timeline root "+e.orientation,s.root.style.maxHeight=util.option.asSize(e.maxHeight,""),s.root.style.minHeight=util.option.asSize(e.minHeight,""),s.root.style.width=util.option.asSize(e.width,""),i.border.left=(s.centerContainer.offsetWidth-s.centerContainer.clientWidth)/2,i.border.right=i.border.left,i.border.top=(s.centerContainer.offsetHeight-s.centerContainer.clientHeight)/2,i.border.bottom=i.border.top;var o=s.root.offsetHeight-s.root.clientHeight,n=s.root.offsetWidth-s.root.clientWidth;i.center.height=s.center.offsetHeight,i.left.height=s.left.offsetHeight,i.right.height=s.right.offsetHeight,i.top.height=s.top.clientHeight||-i.border.top,i.bottom.height=s.bottom.clientHeight||-i.border.bottom;var r=Math.max(i.left.height,i.center.height,i.right.height),a=i.top.height+r+i.bottom.height+o+i.border.top+i.border.bottom;s.root.style.height=util.option.asSize(e.height,a+"px"),i.root.height=s.root.offsetHeight,i.background.height=i.root.height-o;var h=i.root.height-i.top.height-i.bottom.height-o;i.centerContainer.height=h,i.leftContainer.height=h,i.rightContainer.height=i.leftContainer.height,i.root.width=s.root.offsetWidth,i.background.width=i.root.width-n,i.left.width=s.leftContainer.clientWidth||-i.border.left,i.leftContainer.width=i.left.width,i.right.width=s.rightContainer.clientWidth||-i.border.right,i.rightContainer.width=i.right.width;var d=i.root.width-i.left.width-i.right.width-n;i.center.width=d,i.centerContainer.width=d,i.top.width=d,i.bottom.width=d,s.background.style.height=i.background.height+"px",s.backgroundVertical.style.height=i.background.height+"px",s.backgroundHorizontal.style.height=i.centerContainer.height+"px",s.centerContainer.style.height=i.centerContainer.height+"px",s.leftContainer.style.height=i.leftContainer.height+"px",s.rightContainer.style.height=i.rightContainer.height+"px",s.background.style.width=i.background.width+"px",s.backgroundVertical.style.width=i.centerContainer.width+"px",s.backgroundHorizontal.style.width=i.background.width+"px",s.centerContainer.style.width=i.center.width+"px",s.top.style.width=i.top.width+"px",s.bottom.style.width=i.bottom.width+"px",s.background.style.left="0",s.background.style.top="0",s.backgroundVertical.style.left=i.left.width+"px",s.backgroundVertical.style.top="0",s.backgroundHorizontal.style.left="0",s.backgroundHorizontal.style.top=i.top.height+"px",s.centerContainer.style.left=i.left.width+"px",s.centerContainer.style.top=i.top.height+"px",s.leftContainer.style.left="0",s.leftContainer.style.top=i.top.height+"px",s.rightContainer.style.left=i.left.width+i.center.width+"px",s.rightContainer.style.top=i.top.height+"px",s.top.style.left=i.left.width+"px",s.top.style.top="0",s.bottom.style.left=i.left.width+"px",s.bottom.style.top=i.top.height+i.centerContainer.height+"px",this._updateScrollTop();var l=this.props.scrollTop;"bottom"==e.orientation&&(l+=Math.max(this.props.centerContainer.height-this.props.center.height-this.props.border.top-this.props.border.bottom,0)),s.center.style.left="0",s.center.style.top=l+"px",s.left.style.left="0",s.left.style.top=l+"px",s.right.style.left="0",s.right.style.top=l+"px";var c=0==this.props.scrollTop?"hidden":"",p=this.props.scrollTop==this.props.scrollTopMin?"hidden":"";s.shadowTop.style.visibility=c,s.shadowBottom.style.visibility=p,s.shadowTopLeft.style.visibility=c,s.shadowBottomLeft.style.visibility=p,s.shadowTopRight.style.visibility=c,s.shadowBottomRight.style.visibility=p,this.components.forEach(function(e){t=e.redraw()||t}),t&&this.redraw()}},Timeline.prototype.repaint=function(){throw new Error("Function repaint is deprecated. Use redraw instead.")},Timeline.prototype._toTime=function(t){var e=this.range.conversion(this.props.center.width);return new Date(t/e.scale+e.offset)},Timeline.prototype._toGlobalTime=function(t){var e=this.range.conversion(this.props.root.width);return new Date(t/e.scale+e.offset)},Timeline.prototype._toScreen=function(t){var e=this.range.conversion(this.props.center.width);return(t.valueOf()-e.offset)*e.scale},Timeline.prototype._toGlobalScreen=function(t){var e=this.range.conversion(this.props.root.width);return(t.valueOf()-e.offset)*e.scale},Timeline.prototype._initAutoResize=function(){1==this.options.autoResize?this._startAutoResize():this._stopAutoResize()},Timeline.prototype._startAutoResize=function(){var t=this;this._stopAutoResize(),this._onResize=function(){return 1!=t.options.autoResize?void t._stopAutoResize():void(t.dom.root&&(t.dom.root.clientWidth!=t.props.lastWidth||t.dom.root.clientHeight!=t.props.lastHeight)&&(t.props.lastWidth=t.dom.root.clientWidth,t.props.lastHeight=t.dom.root.clientHeight,t.emit("change")))},util.addEventListener(window,"resize",this._onResize),this.watchTimer=setInterval(this._onResize,1e3)},Timeline.prototype._stopAutoResize=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0),util.removeEventListener(window,"resize",this._onResize),this._onResize=null},Timeline.prototype._onTouch=function(){this.touch.allowDragging=!0},Timeline.prototype._onPinch=function(){this.touch.allowDragging=!1},Timeline.prototype._onDragStart=function(){this.touch.initialScrollTop=this.props.scrollTop},Timeline.prototype._onDrag=function(t){if(this.touch.allowDragging){var e=t.gesture.deltaY,i=this._getScrollTop(),s=this._setScrollTop(this.touch.initialScrollTop+e);s!=i&&this.redraw()}},Timeline.prototype._setScrollTop=function(t){return this.props.scrollTop=t,this._updateScrollTop(),this.props.scrollTop},Timeline.prototype._updateScrollTop=function(){var t=Math.min(this.props.centerContainer.height-this.props.center.height,0);return t!=this.props.scrollTopMin&&("bottom"==this.options.orientation&&(this.props.scrollTop+=t-this.props.scrollTopMin),this.props.scrollTopMin=t),this.props.scrollTop>0&&(this.props.scrollTop=0),this.props.scrollTop=s&&(s=864e5),e=new Date(e.valueOf()-.05*s),i=new Date(i.valueOf()+.05*s)}(null!==e||null!==i)&&this.range.setRange(e,i)},Graph2d.prototype.getItemRange=function(){var t=this.itemsData,e=null,i=null;if(t){var s=t.min("start");e=s?util.convert(s.start,"Date").valueOf():null;var o=t.max("start");o&&(i=util.convert(o.start,"Date").valueOf());var n=t.max("end");n&&(i=null==i?util.convert(n.end,"Date").valueOf():Math.max(i,util.convert(n.end,"Date").valueOf()))}return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}},Graph2d.prototype.setWindow=function(t,e){if(1==arguments.length){var i=arguments[0];this.range.setRange(i.start,i.end)}else this.range.setRange(t,e)},Graph2d.prototype.getWindow=function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}},Graph2d.prototype.redraw=function(){var t=!1,e=this.options,i=this.props,s=this.dom;if(s){s.root.className="vis timeline root "+e.orientation,s.root.style.maxHeight=util.option.asSize(e.maxHeight,""),s.root.style.minHeight=util.option.asSize(e.minHeight,""),s.root.style.width=util.option.asSize(e.width,""),i.border.left=(s.centerContainer.offsetWidth-s.centerContainer.clientWidth)/2,i.border.right=i.border.left,i.border.top=(s.centerContainer.offsetHeight-s.centerContainer.clientHeight)/2,i.border.bottom=i.border.top;var o=s.root.offsetHeight-s.root.clientHeight,n=s.root.offsetWidth-s.root.clientWidth;i.center.height=s.center.offsetHeight,i.left.height=s.left.offsetHeight,i.right.height=s.right.offsetHeight,i.top.height=s.top.clientHeight||-i.border.top,i.bottom.height=s.bottom.clientHeight||-i.border.bottom;var r=Math.max(i.left.height,i.center.height,i.right.height),a=i.top.height+r+i.bottom.height+o+i.border.top+i.border.bottom;s.root.style.height=util.option.asSize(e.height,a+"px"),i.root.height=s.root.offsetHeight,i.background.height=i.root.height-o;var h=i.root.height-i.top.height-i.bottom.height-o;i.centerContainer.height=h,i.leftContainer.height=h,i.rightContainer.height=i.leftContainer.height,i.root.width=s.root.offsetWidth,i.background.width=i.root.width-n,i.left.width=s.leftContainer.clientWidth||-i.border.left,i.leftContainer.width=i.left.width,i.right.width=s.rightContainer.clientWidth||-i.border.right,i.rightContainer.width=i.right.width;var d=i.root.width-i.left.width-i.right.width-n;i.center.width=d,i.centerContainer.width=d,i.top.width=d,i.bottom.width=d,s.background.style.height=i.background.height+"px",s.backgroundVertical.style.height=i.background.height+"px",s.backgroundHorizontalContainer.style.height=i.centerContainer.height+"px",s.centerContainer.style.height=i.centerContainer.height+"px",s.leftContainer.style.height=i.leftContainer.height+"px",s.rightContainer.style.height=i.rightContainer.height+"px",s.background.style.width=i.background.width+"px",s.backgroundVertical.style.width=i.centerContainer.width+"px",s.backgroundHorizontalContainer.style.width=i.background.width+"px",s.backgroundHorizontal.style.width=i.background.width+"px",s.centerContainer.style.width=i.center.width+"px",s.top.style.width=i.top.width+"px",s.bottom.style.width=i.bottom.width+"px",s.background.style.left="0",s.background.style.top="0",s.backgroundVertical.style.left=i.left.width+"px",s.backgroundVertical.style.top="0",s.backgroundHorizontalContainer.style.left="0",s.backgroundHorizontalContainer.style.top=i.top.height+"px",s.centerContainer.style.left=i.left.width+"px",s.centerContainer.style.top=i.top.height+"px",s.leftContainer.style.left="0",s.leftContainer.style.top=i.top.height+"px",s.rightContainer.style.left=i.left.width+i.center.width+"px",s.rightContainer.style.top=i.top.height+"px",s.top.style.left=i.left.width+"px",s.top.style.top="0",s.bottom.style.left=i.left.width+"px",s.bottom.style.top=i.top.height+i.centerContainer.height+"px",this._updateScrollTop();var l=this.props.scrollTop;"bottom"==e.orientation&&(l+=Math.max(this.props.centerContainer.height-this.props.center.height-this.props.border.top-this.props.border.bottom,0)),s.center.style.left="0",s.center.style.top=l+"px",s.backgroundHorizontal.style.left="0",s.backgroundHorizontal.style.top=l+"px",s.left.style.left="0",s.left.style.top=l+"px",s.right.style.left="0",s.right.style.top=l+"px";var c=0==this.props.scrollTop?"hidden":"",p=this.props.scrollTop==this.props.scrollTopMin?"hidden":"";s.shadowTop.style.visibility=c,s.shadowBottom.style.visibility=p,s.shadowTopLeft.style.visibility=c,s.shadowBottomLeft.style.visibility=p,s.shadowTopRight.style.visibility=c,s.shadowBottomRight.style.visibility=p,this.components.forEach(function(e){t=e.redraw()||t}),t&&this.redraw()}},Graph2d.prototype._toTime=function(t){var e=this.range.conversion(this.props.center.width);return new Date(t/e.scale+e.offset)},Graph2d.prototype._toGlobalTime=function(t){var e=this.range.conversion(this.props.root.width);return new Date(t/e.scale+e.offset)},Graph2d.prototype._toScreen=function(t){var e=this.range.conversion(this.props.center.width);return(t.valueOf()-e.offset)*e.scale},Graph2d.prototype._toGlobalScreen=function(t){var e=this.range.conversion(this.props.root.width);return(t.valueOf()-e.offset)*e.scale},Graph2d.prototype._initAutoResize=function(){1==this.options.autoResize?this._startAutoResize():this._stopAutoResize()},Graph2d.prototype._startAutoResize=function(){var t=this;this._stopAutoResize(),this._onResize=function(){return 1!=t.options.autoResize?void t._stopAutoResize():void(t.dom.root&&(t.dom.root.clientWidth!=t.props.lastWidth||t.dom.root.clientHeight!=t.props.lastHeight)&&(t.props.lastWidth=t.dom.root.clientWidth,t.props.lastHeight=t.dom.root.clientHeight,t.emit("change")))},util.addEventListener(window,"resize",this._onResize),this.watchTimer=setInterval(this._onResize,1e3)},Graph2d.prototype._stopAutoResize=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0),util.removeEventListener(window,"resize",this._onResize),this._onResize=null},Graph2d.prototype._onTouch=function(){this.touch.allowDragging=!0},Graph2d.prototype._onPinch=function(){this.touch.allowDragging=!1},Graph2d.prototype._onDragStart=function(){this.touch.initialScrollTop=this.props.scrollTop},Graph2d.prototype._onDrag=function(t){if(this.touch.allowDragging){var e=t.gesture.deltaY,i=this._getScrollTop(),s=this._setScrollTop(this.touch.initialScrollTop+e);s!=i&&this.redraw()}},Graph2d.prototype._setScrollTop=function(t){return this.props.scrollTop=t,this._updateScrollTop(),this.props.scrollTop},Graph2d.prototype._updateScrollTop=function(){var t=Math.min(this.props.centerContainer.height-this.props.center.height,0);return t!=this.props.scrollTopMin&&("bottom"==this.options.orientation&&(this.props.scrollTop+=t-this.props.scrollTopMin),this.props.scrollTopMin=t),this.props.scrollTop>0&&(this.props.scrollTop=0),this.props.scrollTopi;i++)if(e.id===a.nodes[i].id){o=a.nodes[i];break}for(o||(o={id:e.id},t.node&&(o.attr=r(o.attr,t.node))),i=n.length-1;i>=0;i--){var h=n[i];h.nodes||(h.nodes=[]),-1==h.nodes.indexOf(o)&&h.nodes.push(o)}e.attr&&(o.attr=r(o.attr,e.attr))}function d(t,e){if(t.edges||(t.edges=[]),t.edges.push(e),t.edge){var i=r({},t.edge);e.attr=r(i,e.attr)}}function l(t,e,i,s,o){var n={from:e,to:i,type:s};return t.edge&&(n.attr=r({},t.edge)),n.attr=r(n.attr||{},o),n}function c(){for(O=D.NULL,N="";" "==C||" "==C||"\n"==C||"\r"==C;)s();do{var t=!1;if("#"==C){for(var e=M-1;" "==T.charAt(e)||" "==T.charAt(e);)e--;if("\n"==T.charAt(e)||""==T.charAt(e)){for(;""!=C&&"\n"!=C;)s();t=!0}}if("/"==C&&"/"==o()){for(;""!=C&&"\n"!=C;)s();t=!0}if("/"==C&&"*"==o()){for(;""!=C;){if("*"==C&&"/"==o()){s(),s();break}s()}t=!0}for(;" "==C||" "==C||"\n"==C||"\r"==C;)s()}while(t);if(""==C)return void(O=D.DELIMITER);var i=C+o();if(E[i])return O=D.DELIMITER,N=i,s(),void s();if(E[C])return O=D.DELIMITER,N=C,void s();if(n(C)||"-"==C){for(N+=C,s();n(C);)N+=C,s();return"false"==N?N=!1:"true"==N?N=!0:isNaN(Number(N))||(N=Number(N)),void(O=D.IDENTIFIER)}if('"'==C){for(s();""!=C&&('"'!=C||'"'==C&&'"'==o());)N+=C,'"'==C&&s(),s();if('"'!=C)throw _('End of string " expected');return s(),void(O=D.IDENTIFIER)}for(O=D.UNKNOWN;""!=C;)N+=C,s();throw new SyntaxError('Syntax error in part "'+w(N,30)+'"')}function p(){var t={};if(i(),c(),"strict"==N&&(t.strict=!0,c()),("graph"==N||"digraph"==N)&&(t.type=N,c()),O==D.IDENTIFIER&&(t.id=N,c()),"{"!=N)throw _("Angle bracket { expected");if(c(),u(t),"}"!=N)throw _("Angle bracket } expected");if(c(),""!==N)throw _("End of file expected");return c(),delete t.node,delete t.edge,delete t.graph,t -}function u(t){for(;""!==N&&"}"!=N;)m(t),";"==N&&c()}function m(t){var e=g(t);if(e)return void y(t,e);var i=f(t);if(!i){if(O!=D.IDENTIFIER)throw _("Identifier expected");var s=N;if(c(),"="==N){if(c(),O!=D.IDENTIFIER)throw _("Identifier expected");t[s]=N,c()}else v(t,s)}}function g(t){var e=null;if("subgraph"==N&&(e={},e.type="subgraph",c(),O==D.IDENTIFIER&&(e.id=N,c())),"{"==N){if(c(),e||(e={}),e.parent=t,e.node=t.node,e.edge=t.edge,e.graph=t.graph,u(e),"}"!=N)throw _("Angle bracket } expected");c(),delete e.node,delete e.edge,delete e.graph,delete e.parent,t.subgraphs||(t.subgraphs=[]),t.subgraphs.push(e)}return e}function f(t){return"node"==N?(c(),t.node=b(),"node"):"edge"==N?(c(),t.edge=b(),"edge"):"graph"==N?(c(),t.graph=b(),"graph"):null}function v(t,e){var i={id:e},s=b();s&&(i.attr=s),h(t,i),y(t,e)}function y(t,e){for(;"->"==N||"--"==N;){var i,s=N;c();var o=g(t);if(o)i=o;else{if(O!=D.IDENTIFIER)throw _("Identifier or subgraph expected");i=N,h(t,{id:i}),c()}var n=b(),r=l(t,e,i,s,n);d(t,r),e=i}}function b(){for(var t=null;"["==N;){for(c(),t={};""!==N&&"]"!=N;){if(O!=D.IDENTIFIER)throw _("Attribute name expected");var e=N;if(c(),"="!=N)throw _("Equal sign = expected");if(c(),O!=D.IDENTIFIER)throw _("Attribute value expected");var i=N;a(t,e,i),c(),","==N&&c()}if("]"!=N)throw _("Bracket ] expected");c()}return t}function _(t){return new SyntaxError(t+', got "'+w(N,30)+'" (char '+M+")")}function w(t,e){return t.length<=e?t:t.substr(0,27)+"..."}function x(t,e,i){t instanceof Array?t.forEach(function(t){e instanceof Array?e.forEach(function(e){i(t,e)}):i(t,e)}):e instanceof Array?e.forEach(function(e){i(t,e)}):i(t,e)}function S(t){function i(t){var e={from:t.from,to:t.to};return r(e,t.attr),e.style="->"==t.type?"arrow":"line",e}var s=e(t),o={nodes:[],edges:[],options:{}};return s.nodes&&s.nodes.forEach(function(t){var e={id:t.id,label:String(t.label||t.id)};r(e,t.attr),e.image&&(e.shape="image"),o.nodes.push(e)}),s.edges&&s.edges.forEach(function(t){var e,s;e=t.from instanceof Object?t.from.nodes:{id:t.from},s=t.to instanceof Object?t.to.nodes:{id:t.to},t.from instanceof Object&&t.from.edges&&t.from.edges.forEach(function(t){var e=i(t);o.edges.push(e)}),x(e,s,function(e,s){var n=l(o,e.id,s.id,t.type,t.attr),r=i(n);o.edges.push(r)}),t.to instanceof Object&&t.to.edges&&t.to.edges.forEach(function(t){var e=i(t);o.edges.push(e)})}),s.attr&&(o.options=s.attr),o}var D={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},E={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},T="",M=0,C="",N="",O=D.NULL,k=/[a-zA-Z_0-9.:#]/;t.parseDOT=e,t.DOTToGraph=S}("undefined"!=typeof util?util:exports),"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.circle=function(t,e,i){this.beginPath(),this.arc(t,e,i,0,2*Math.PI,!1)},CanvasRenderingContext2D.prototype.square=function(t,e,i){this.beginPath(),this.rect(t-i,e-i,2*i,2*i)},CanvasRenderingContext2D.prototype.triangle=function(t,e,i){this.beginPath();var s=2*i,o=s/2,n=Math.sqrt(3)/6*s,r=Math.sqrt(s*s-o*o);this.moveTo(t,e-(r-n)),this.lineTo(t+o,e+n),this.lineTo(t-o,e+n),this.lineTo(t,e-(r-n)),this.closePath()},CanvasRenderingContext2D.prototype.triangleDown=function(t,e,i){this.beginPath();var s=2*i,o=s/2,n=Math.sqrt(3)/6*s,r=Math.sqrt(s*s-o*o);this.moveTo(t,e+(r-n)),this.lineTo(t+o,e-n),this.lineTo(t-o,e-n),this.lineTo(t,e+(r-n)),this.closePath()},CanvasRenderingContext2D.prototype.star=function(t,e,i){this.beginPath();for(var s=0;10>s;s++){var o=s%2===0?1.3*i:.5*i;this.lineTo(t+o*Math.sin(2*s*Math.PI/10),e-o*Math.cos(2*s*Math.PI/10))}this.closePath()},CanvasRenderingContext2D.prototype.roundRect=function(t,e,i,s,o){var n=Math.PI/180;0>i-2*o&&(o=i/2),0>s-2*o&&(o=s/2),this.beginPath(),this.moveTo(t+o,e),this.lineTo(t+i-o,e),this.arc(t+i-o,e+o,o,270*n,360*n,!1),this.lineTo(t+i,e+s-o),this.arc(t+i-o,e+s-o,o,0,90*n,!1),this.lineTo(t+o,e+s),this.arc(t+o,e+s-o,o,90*n,180*n,!1),this.lineTo(t,e+o),this.arc(t+o,e+o,o,180*n,270*n,!1)},CanvasRenderingContext2D.prototype.ellipse=function(t,e,i,s){var o=.5522848,n=i/2*o,r=s/2*o,a=t+i,h=e+s,d=t+i/2,l=e+s/2;this.beginPath(),this.moveTo(t,l),this.bezierCurveTo(t,l-r,d-n,e,d,e),this.bezierCurveTo(d+n,e,a,l-r,a,l),this.bezierCurveTo(a,l+r,d+n,h,d,h),this.bezierCurveTo(d-n,h,t,l+r,t,l)},CanvasRenderingContext2D.prototype.database=function(t,e,i,s){var o=1/3,n=i,r=s*o,a=.5522848,h=n/2*a,d=r/2*a,l=t+n,c=e+r,p=t+n/2,u=e+r/2,m=e+(s-r/2),g=e+s;this.beginPath(),this.moveTo(l,u),this.bezierCurveTo(l,u+d,p+h,c,p,c),this.bezierCurveTo(p-h,c,t,u+d,t,u),this.bezierCurveTo(t,u-d,p-h,e,p,e),this.bezierCurveTo(p+h,e,l,u-d,l,u),this.lineTo(l,m),this.bezierCurveTo(l,m+d,p+h,g,p,g),this.bezierCurveTo(p-h,g,t,m+d,t,m),this.lineTo(t,u)},CanvasRenderingContext2D.prototype.arrow=function(t,e,i,s){var o=t-s*Math.cos(i),n=e-s*Math.sin(i),r=t-.9*s*Math.cos(i),a=e-.9*s*Math.sin(i),h=o+s/3*Math.cos(i+.5*Math.PI),d=n+s/3*Math.sin(i+.5*Math.PI),l=o+s/3*Math.cos(i-.5*Math.PI),c=n+s/3*Math.sin(i-.5*Math.PI);this.beginPath(),this.moveTo(t,e),this.lineTo(h,d),this.lineTo(r,a),this.lineTo(l,c),this.closePath()},CanvasRenderingContext2D.prototype.dashedLine=function(t,e,i,s,o){o||(o=[10,5]),0==p&&(p=.001);var n=o.length;this.moveTo(t,e);for(var r=i-t,a=s-e,h=a/r,d=Math.sqrt(r*r+a*a),l=0,c=!0;d>=.1;){var p=o[l++%n];p>d&&(p=d);var u=Math.sqrt(p*p/(1+h*h));0>r&&(u=-u),t+=u,e+=h*u,this[c?"lineTo":"moveTo"](t,e),d-=p,c=!c}}),Node.prototype.resetCluster=function(){this.formationScale=void 0,this.clusterSize=1,this.containedNodes={},this.containedEdges={},this.clusterSessions=[]},Node.prototype.attachEdge=function(t){-1==this.edges.indexOf(t)&&this.edges.push(t),-1==this.dynamicEdges.indexOf(t)&&this.dynamicEdges.push(t),this.dynamicEdgesLength=this.dynamicEdges.length},Node.prototype.detachEdge=function(t){var e=this.edges.indexOf(t);-1!=e&&(this.edges.splice(e,1),this.dynamicEdges.splice(e,1)),this.dynamicEdgesLength=this.dynamicEdges.length},Node.prototype.setProperties=function(t,e){if(t){if(this.originalLabel=void 0,void 0!==t.id&&(this.id=t.id),void 0!==t.label&&(this.label=t.label,this.originalLabel=t.label),void 0!==t.title&&(this.title=t.title),void 0!==t.group&&(this.group=t.group),void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y),void 0!==t.value&&(this.value=t.value),void 0!==t.level&&(this.level=t.level,this.preassignedLevel=!0),void 0!==t.mass&&(this.mass=t.mass),void 0!==t.horizontalAlignLeft&&(this.horizontalAlignLeft=t.horizontalAlignLeft),void 0!==t.verticalAlignTop&&(this.verticalAlignTop=t.verticalAlignTop),void 0!==t.triggerFunction&&(this.triggerFunction=t.triggerFunction),void 0===this.id)throw"Node must have an id";if(this.group){var i=this.grouplist.get(this.group);for(var s in i)i.hasOwnProperty(s)&&(this[s]=i[s])}if(void 0!==t.shape&&(this.shape=t.shape),void 0!==t.image&&(this.image=t.image),void 0!==t.radius&&(this.radius=t.radius),void 0!==t.color&&(this.color=util.parseColor(t.color)),void 0!==t.fontColor&&(this.fontColor=t.fontColor),void 0!==t.fontSize&&(this.fontSize=t.fontSize),void 0!==t.fontFace&&(this.fontFace=t.fontFace),void 0!==this.image&&""!=this.image){if(!this.imagelist)throw"No imagelist provided";this.imageObj=this.imagelist.load(this.image)}switch(this.xFixed=this.xFixed||void 0!==t.x&&!t.allowedToMoveX,this.yFixed=this.yFixed||void 0!==t.y&&!t.allowedToMoveY,this.radiusFixed=this.radiusFixed||void 0!==t.radius,"image"==this.shape&&(this.radiusMin=e.nodes.widthMin,this.radiusMax=e.nodes.widthMax),this.shape){case"database":this.draw=this._drawDatabase,this.resize=this._resizeDatabase;break;case"box":this.draw=this._drawBox,this.resize=this._resizeBox;break;case"circle":this.draw=this._drawCircle,this.resize=this._resizeCircle;break;case"ellipse":this.draw=this._drawEllipse,this.resize=this._resizeEllipse;break;case"image":this.draw=this._drawImage,this.resize=this._resizeImage;break;case"text":this.draw=this._drawText,this.resize=this._resizeText;break;case"dot":this.draw=this._drawDot,this.resize=this._resizeShape;break;case"square":this.draw=this._drawSquare,this.resize=this._resizeShape;break;case"triangle":this.draw=this._drawTriangle,this.resize=this._resizeShape;break;case"triangleDown":this.draw=this._drawTriangleDown,this.resize=this._resizeShape;break;case"star":this.draw=this._drawStar,this.resize=this._resizeShape;break;default:this.draw=this._drawEllipse,this.resize=this._resizeEllipse}this._reset()}},Node.prototype.select=function(){this.selected=!0,this._reset()},Node.prototype.unselect=function(){this.selected=!1,this._reset()},Node.prototype.clearSizeCache=function(){this._reset()},Node.prototype._reset=function(){this.width=void 0,this.height=void 0},Node.prototype.getTitle=function(){return"function"==typeof this.title?this.title():this.title},Node.prototype.distanceToBorder=function(t,e){var i=1;switch(this.width||this.resize(t),this.shape){case"circle":case"dot":return this.radius+i;case"ellipse":var s=this.width/2,o=this.height/2,n=Math.sin(e)*s,r=Math.cos(e)*o;return s*o/Math.sqrt(n*n+r*r);case"box":case"image":case"text":default:return this.width?Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+i:0}},Node.prototype._setForce=function(t,e){this.fx=t,this.fy=e},Node.prototype._addForce=function(t,e){this.fx+=t,this.fy+=e},Node.prototype.discreteStep=function(t){if(!this.xFixed){var e=this.damping*this.vx,i=(this.fx-e)/this.mass;this.vx+=i*t,this.x+=this.vx*t}if(!this.yFixed){var s=this.damping*this.vy,o=(this.fy-s)/this.mass;this.vy+=o*t,this.y+=this.vy*t}},Node.prototype.discreteStepLimited=function(t,e){if(this.xFixed)this.fx=0;else{var i=this.damping*this.vx,s=(this.fx-i)/this.mass;this.vx+=s*t,this.vx=Math.abs(this.vx)>e?this.vx>0?e:-e:this.vx,this.x+=this.vx*t}if(this.yFixed)this.fy=0;else{var o=this.damping*this.vy,n=(this.fy-o)/this.mass;this.vy+=n*t,this.vy=Math.abs(this.vy)>e?this.vy>0?e:-e:this.vy,this.y+=this.vy*t}},Node.prototype.isFixed=function(){return this.xFixed&&this.yFixed},Node.prototype.isMoving=function(t){return Math.abs(this.vx)>t||Math.abs(this.vy)>t},Node.prototype.isSelected=function(){return this.selected},Node.prototype.getValue=function(){return this.value},Node.prototype.getDistance=function(t,e){var i=this.x-t,s=this.y-e;return Math.sqrt(i*i+s*s)},Node.prototype.setValueRange=function(t,e){if(!this.radiusFixed&&void 0!==this.value)if(e==t)this.radius=(this.radiusMin+this.radiusMax)/2;else{var i=(this.radiusMax-this.radiusMin)/(e-t);this.radius=(this.value-t)*i+this.radiusMin}this.baseRadiusValue=this.radius},Node.prototype.draw=function(){throw"Draw method not initialized for node"},Node.prototype.resize=function(){throw"Resize method not initialized for node"},Node.prototype.isOverlappingWith=function(t){return this.leftt.left&&this.topt.top},Node.prototype._resizeImage=function(){if(!this.width||!this.height){var t,e;if(this.value){this.radius=this.baseRadiusValue;var i=this.imageObj.height/this.imageObj.width;void 0!==i?(t=this.radius||this.imageObj.width,e=this.radius*i||this.imageObj.height):(t=0,e=0)}else t=this.imageObj.width,e=this.imageObj.height;this.width=t,this.height=e,this.growthIndicator=0,this.width>0&&this.height>0&&(this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-t)}},Node.prototype._drawImage=function(t){this._resizeImage(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e;if(0!=this.imageObj.width){if(this.clusterSize>1){var i=this.clusterSize>1?10:0;i*=this.networkScaleInv,i=Math.min(.2*this.width,i),t.globalAlpha=.5,t.drawImage(this.imageObj,this.left-i,this.top-i,this.width+2*i,this.height+2*i)}t.globalAlpha=1,t.drawImage(this.imageObj,this.left,this.top,this.width,this.height),e=this.y+this.height/2}else e=this.y;this._label(t,this.label,this.x,e,void 0,"top")},Node.prototype._resizeBox=function(t){if(!this.width){var e=5,i=this.getTextSize(t);this.width=i.width+2*e,this.height=i.height+2*e,this.width+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.growthIndicator=this.width-(i.width+2*e)}},Node.prototype._drawBox=function(t){this._resizeBox(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e=2.5,i=2;t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.roundRect(this.left-2*t.lineWidth,this.top-2*t.lineWidth,this.width+4*t.lineWidth,this.height+4*t.lineWidth,this.radius),t.stroke()),t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.color.background,t.roundRect(this.left,this.top,this.width,this.height,this.radius),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},Node.prototype._resizeDatabase=function(t){if(!this.width){var e=5,i=this.getTextSize(t),s=i.width+2*e;this.width=s,this.height=s,this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-s}},Node.prototype._drawDatabase=function(t){this._resizeDatabase(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e=2.5,i=2;t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.database(this.x-this.width/2-2*t.lineWidth,this.y-.5*this.height-2*t.lineWidth,this.width+4*t.lineWidth,this.height+4*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t.database(this.x-this.width/2,this.y-.5*this.height,this.width,this.height),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},Node.prototype._resizeCircle=function(t){if(!this.width){var e=5,i=this.getTextSize(t),s=Math.max(i.width,i.height)+2*e;this.radius=s/2,this.width=s,this.height=s,this.radius+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.radius-.5*s}},Node.prototype._drawCircle=function(t){this._resizeCircle(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e=2.5,i=2;t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.circle(this.x,this.y,this.radius+2*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t.circle(this.x,this.y,this.radius),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},Node.prototype._resizeEllipse=function(t){if(!this.width){var e=this.getTextSize(t);this.width=1.5*e.width,this.height=2*e.height,this.width1&&(t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.ellipse(this.left-2*t.lineWidth,this.top-2*t.lineWidth,this.width+4*t.lineWidth,this.height+4*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?i:1)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t.ellipse(this.left,this.top,this.width,this.height),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},Node.prototype._drawDot=function(t){this._drawShape(t,"circle")},Node.prototype._drawTriangle=function(t){this._drawShape(t,"triangle")},Node.prototype._drawTriangleDown=function(t){this._drawShape(t,"triangleDown")},Node.prototype._drawSquare=function(t){this._drawShape(t,"square")},Node.prototype._drawStar=function(t){this._drawShape(t,"star")},Node.prototype._resizeShape=function(){if(!this.width){this.radius=this.baseRadiusValue;var t=2*this.radius;this.width=t,this.height=t,this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-t}},Node.prototype._drawShape=function(t,e){this._resizeShape(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var i=2.5,s=2,o=2;switch(e){case"dot":o=2;break;case"square":o=2;break;case"triangle":o=3;break;case"triangleDown":o=3;break;case"star":o=4}t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?s:1)+(this.clusterSize>1?i:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t[e](this.x,this.y,this.radius+o*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?s:1)+(this.clusterSize>1?i:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(.1*this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t[e](this.x,this.y,this.radius),t.fill(),t.stroke(),this.label&&this._label(t,this.label,this.x,this.y+this.height/2,void 0,"top",!0)},Node.prototype._resizeText=function(t){if(!this.width){var e=5,i=this.getTextSize(t);this.width=i.width+2*e,this.height=i.height+2*e,this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-(i.width+2*e)}},Node.prototype._drawText=function(t){this._resizeText(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2,this._label(t,this.label,this.x,this.y)},Node.prototype._label=function(t,e,i,s,o,n,r){if(e&&this.fontSize*this.networkScale>this.fontDrawThreshold){t.font=(this.selected?"bold ":"")+this.fontSize+"px "+this.fontFace,t.fillStyle=this.fontColor||"black",t.textAlign=o||"center",t.textBaseline=n||"middle";var a=e.split("\n"),h=a.length,d=this.fontSize+4,l=s+(1-h)/2*d;1==r&&(l=s+(1-h)/(2*d));for(var c=0;h>c;c++)t.fillText(a[c],i,l),l+=d}},Node.prototype.getTextSize=function(t){if(void 0!==this.label){t.font=(this.selected?"bold ":"")+this.fontSize+"px "+this.fontFace;for(var e=this.label.split("\n"),i=(this.fontSize+4)*e.length,s=0,o=0,n=e.length;n>o;o++)s=Math.max(s,t.measureText(e[o]).width);return{width:s,height:i}}return{width:0,height:0}},Node.prototype.inArea=function(){return void 0!==this.width?this.x+this.width*this.networkScaleInv>=this.canvasTopLeft.x&&this.x-this.width*this.networkScaleInv=this.canvasTopLeft.y&&this.y-this.height*this.networkScaleInv=this.canvasTopLeft.x&&this.x=this.canvasTopLeft.y&&this.yh}return!1},Edge.prototype._drawLine=function(t){if(t.strokeStyle=1==this.selected?this.color.highlight:1==this.hover?this.color.hover:this.color.color,t.lineWidth=this._getLineWidth(),this.from!=this.to){this._line(t);var e;if(this.label){if(1==this.smooth){var i=.5*(.5*(this.from.x+this.via.x)+.5*(this.to.x+this.via.x)),s=.5*(.5*(this.from.y+this.via.y)+.5*(this.to.y+this.via.y));e={x:i,y:s}}else e=this._pointOnLine(.5);this._label(t,this.label,e.x,e.y)}}else{var o,n,r=this.length/4,a=this.from;a.width||a.resize(t),a.width>a.height?(o=a.x+a.width/2,n=a.y-r):(o=a.x+r,n=a.y-a.height/2),this._circle(t,o,n,r),e=this._pointOnCircle(o,n,r,.5),this._label(t,this.label,e.x,e.y)}},Edge.prototype._getLineWidth=function(){return 1==this.selected?Math.min(this.widthSelected,this.widthMax)*this.networkScaleInv:1==this.hover?Math.min(this.hoverWidth,this.widthMax)*this.networkScaleInv:this.width*this.networkScaleInv},Edge.prototype._line=function(t){t.beginPath(),t.moveTo(this.from.x,this.from.y),1==this.smooth?t.quadraticCurveTo(this.via.x,this.via.y,this.to.x,this.to.y):t.lineTo(this.to.x,this.to.y),t.stroke()},Edge.prototype._circle=function(t,e,i,s){t.beginPath(),t.arc(e,i,s,0,2*Math.PI,!1),t.stroke()},Edge.prototype._label=function(t,e,i,s){if(e){t.font=(this.from.selected||this.to.selected?"bold ":"")+this.fontSize+"px "+this.fontFace,t.fillStyle=this.fontFill;var o=t.measureText(e).width,n=this.fontSize,r=i-o/2,a=s-n/2;t.fillRect(r,a,o,n),t.fillStyle=this.fontColor||"black",t.textAlign="left",t.textBaseline="top",t.fillText(e,r,a)}},Edge.prototype._drawDashLine=function(t){if(t.strokeStyle=1==this.selected?this.color.highlight:1==this.hover?this.color.hover:this.color.color,t.lineWidth=this._getLineWidth(),void 0!==t.mozDash||void 0!==t.setLineDash){t.beginPath(),t.moveTo(this.from.x,this.from.y);var e=[0];e=void 0!==this.dash.length&&void 0!==this.dash.gap?[this.dash.length,this.dash.gap]:[5,5],"undefined"!=typeof t.setLineDash?(t.setLineDash(e),t.lineDashOffset=0):(t.mozDash=e,t.mozDashOffset=0),1==this.smooth?t.quadraticCurveTo(this.via.x,this.via.y,this.to.x,this.to.y):t.lineTo(this.to.x,this.to.y),t.stroke(),"undefined"!=typeof t.setLineDash?(t.setLineDash([0]),t.lineDashOffset=0):(t.mozDash=[0],t.mozDashOffset=0)}else t.beginPath(),t.lineCap="round",void 0!==this.dash.altLength?t.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y,[this.dash.length,this.dash.gap,this.dash.altLength,this.dash.gap]):void 0!==this.dash.length&&void 0!==this.dash.gap?t.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y,[this.dash.length,this.dash.gap]):(t.moveTo(this.from.x,this.from.y),t.lineTo(this.to.x,this.to.y)),t.stroke();if(this.label){var i;if(1==this.smooth){var s=.5*(.5*(this.from.x+this.via.x)+.5*(this.to.x+this.via.x)),o=.5*(.5*(this.from.y+this.via.y)+.5*(this.to.y+this.via.y));i={x:s,y:o}}else i=this._pointOnLine(.5);this._label(t,this.label,i.x,i.y)}},Edge.prototype._pointOnLine=function(t){return{x:(1-t)*this.from.x+t*this.to.x,y:(1-t)*this.from.y+t*this.to.y}},Edge.prototype._pointOnCircle=function(t,e,i,s){var o=2*(s-3/8)*Math.PI;return{x:t+i*Math.cos(o),y:e-i*Math.sin(o)}},Edge.prototype._drawArrowCenter=function(t){var e;if(1==this.selected?(t.strokeStyle=this.color.highlight,t.fillStyle=this.color.highlight):1==this.hover?(t.strokeStyle=this.color.hover,t.fillStyle=this.color.hover):(t.strokeStyle=this.color.color,t.fillStyle=this.color.color),t.lineWidth=this._getLineWidth(),this.from!=this.to){this._line(t);var i=Math.atan2(this.to.y-this.from.y,this.to.x-this.from.x),s=(10+5*this.width)*this.arrowScaleFactor;if(1==this.smooth){var o=.5*(.5*(this.from.x+this.via.x)+.5*(this.to.x+this.via.x)),n=.5*(.5*(this.from.y+this.via.y)+.5*(this.to.y+this.via.y));e={x:o,y:n}}else e=this._pointOnLine(.5);t.arrow(e.x,e.y,i,s),t.fill(),t.stroke(),this.label&&this._label(t,this.label,e.x,e.y)}else{var r,a,h=.25*Math.max(100,this.length),d=this.from;d.width||d.resize(t),d.width>d.height?(r=d.x+.5*d.width,a=d.y-h):(r=d.x+h,a=d.y-.5*d.height),this._circle(t,r,a,h);var i=.2*Math.PI,s=(10+5*this.width)*this.arrowScaleFactor;e=this._pointOnCircle(r,a,h,.5),t.arrow(e.x,e.y,i,s),t.fill(),t.stroke(),this.label&&(e=this._pointOnCircle(r,a,h,.5),this._label(t,this.label,e.x,e.y))}},Edge.prototype._drawArrow=function(t){1==this.selected?(t.strokeStyle=this.color.highlight,t.fillStyle=this.color.highlight):1==this.hover?(t.strokeStyle=this.color.hover,t.fillStyle=this.color.hover):(t.strokeStyle=this.color.color,t.fillStyle=this.color.color),t.lineWidth=this._getLineWidth();var e,i;if(this.from!=this.to){e=Math.atan2(this.to.y-this.from.y,this.to.x-this.from.x);var s=this.to.x-this.from.x,o=this.to.y-this.from.y,n=Math.sqrt(s*s+o*o),r=this.from.distanceToBorder(t,e+Math.PI),a=(n-r)/n,h=a*this.from.x+(1-a)*this.to.x,d=a*this.from.y+(1-a)*this.to.y;1==this.smooth&&(e=Math.atan2(this.to.y-this.via.y,this.to.x-this.via.x),s=this.to.x-this.via.x,o=this.to.y-this.via.y,n=Math.sqrt(s*s+o*o));var l,c,p=this.to.distanceToBorder(t,e),u=(n-p)/n;if(1==this.smooth?(l=(1-u)*this.via.x+u*this.to.x,c=(1-u)*this.via.y+u*this.to.y):(l=(1-u)*this.from.x+u*this.to.x,c=(1-u)*this.from.y+u*this.to.y),t.beginPath(),t.moveTo(h,d),1==this.smooth?t.quadraticCurveTo(this.via.x,this.via.y,l,c):t.lineTo(l,c),t.stroke(),i=(10+5*this.width)*this.arrowScaleFactor,t.arrow(l,c,e,i),t.fill(),t.stroke(),this.label){var m;if(1==this.smooth){var g=.5*(.5*(this.from.x+this.via.x)+.5*(this.to.x+this.via.x)),f=.5*(.5*(this.from.y+this.via.y)+.5*(this.to.y+this.via.y));m={x:g,y:f}}else m=this._pointOnLine(.5);this._label(t,this.label,m.x,m.y)}}else{var v,y,b,_=this.from,w=.25*Math.max(100,this.length);_.width||_.resize(t),_.width>_.height?(v=_.x+.5*_.width,y=_.y-w,b={x:v,y:_.y,angle:.9*Math.PI}):(v=_.x+w,y=_.y-.5*_.height,b={x:_.x,y:y,angle:.6*Math.PI}),t.beginPath(),t.arc(v,y,w,0,2*Math.PI,!1),t.stroke();var i=(10+5*this.width)*this.arrowScaleFactor;t.arrow(b.x,b.y,b.angle,i),t.fill(),t.stroke(),this.label&&(m=this._pointOnCircle(v,y,w,.5),this._label(t,this.label,m.x,m.y))}},Edge.prototype._getDistanceToEdge=function(t,e,i,s,o,n){if(this.from!=this.to){if(1==this.smooth){var r,a,h,d,l,c,p=1e9;for(r=0;10>r;r++)a=.1*r,h=Math.pow(1-a,2)*t+2*a*(1-a)*this.via.x+Math.pow(a,2)*i,d=Math.pow(1-a,2)*e+2*a*(1-a)*this.via.y+Math.pow(a,2)*s,l=Math.abs(o-h),c=Math.abs(n-d),p=Math.min(p,Math.sqrt(l*l+c*c));return p}var u=i-t,m=s-e,g=u*u+m*m,f=((o-t)*u+(n-e)*m)/g;f>1?f=1:0>f&&(f=0);var h=t+f*u,d=e+f*m,l=h-o,c=d-n;return Math.sqrt(l*l+c*c)}var h,d,l,c,v=this.length/4,y=this.from;return y.width||y.resize(ctx),y.width>y.height?(h=y.x+y.width/2,d=y.y-v):(h=y.x+v,d=y.y-y.height/2),l=h-o,c=d-n,Math.abs(Math.sqrt(l*l+c*c)-v)},Edge.prototype.setScale=function(t){this.networkScaleInv=1/t},Edge.prototype.select=function(){this.selected=!0},Edge.prototype.unselect=function(){this.selected=!1},Edge.prototype.positionBezierNode=function(){null!==this.via&&(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y))},Edge.prototype._drawControlNodes=function(t){if(1==this.controlNodesEnabled){if(null===this.controlNodes.from&&null===this.controlNodes.to){var e="edgeIdFrom:".concat(this.id),i="edgeIdTo:".concat(this.id),s={nodes:{group:"",radius:8},physics:{damping:0},clustering:{maxNodeSizeIncrements:0,nodeScaling:{width:0,height:0,radius:0}}};this.controlNodes.from=new Node({id:e,shape:"dot",color:{background:"#ff4e00",border:"#3c3c3c",highlight:{background:"#07f968"}}},{},{},s),this.controlNodes.to=new Node({id:i,shape:"dot",color:{background:"#ff4e00",border:"#3c3c3c",highlight:{background:"#07f968"}}},{},{},s)}0==this.controlNodes.from.selected&&0==this.controlNodes.to.selected&&(this.controlNodes.positions=this.getControlNodePositions(t),this.controlNodes.from.x=this.controlNodes.positions.from.x,this.controlNodes.from.y=this.controlNodes.positions.from.y,this.controlNodes.to.x=this.controlNodes.positions.to.x,this.controlNodes.to.y=this.controlNodes.positions.to.y),this.controlNodes.from.draw(t),this.controlNodes.to.draw(t) -}else this.controlNodes={from:null,to:null,positions:{}}},Edge.prototype._enableControlNodes=function(){this.controlNodesEnabled=!0},Edge.prototype._disableControlNodes=function(){this.controlNodesEnabled=!1},Edge.prototype._getSelectedControlNode=function(t,e){var i=this.controlNodes.positions,s=Math.sqrt(Math.pow(t-i.from.x,2)+Math.pow(e-i.from.y,2)),o=Math.sqrt(Math.pow(t-i.to.x,2)+Math.pow(e-i.to.y,2));return 15>s?(this.connectedNode=this.from,this.from=this.controlNodes.from,this.controlNodes.from):15>o?(this.connectedNode=this.to,this.to=this.controlNodes.to,this.controlNodes.to):null},Edge.prototype._restoreControlNodes=function(){1==this.controlNodes.from.selected&&(this.from=this.connectedNode,this.connectedNode=null,this.controlNodes.from.unselect()),1==this.controlNodes.to.selected&&(this.to=this.connectedNode,this.connectedNode=null,this.controlNodes.to.unselect())},Edge.prototype.getControlNodePositions=function(t){var e=Math.atan2(this.to.y-this.from.y,this.to.x-this.from.x),i=this.to.x-this.from.x,s=this.to.y-this.from.y,o=Math.sqrt(i*i+s*s),n=this.from.distanceToBorder(t,e+Math.PI),r=(o-n)/o,a=r*this.from.x+(1-r)*this.to.x,h=r*this.from.y+(1-r)*this.to.y;1==this.smooth&&(e=Math.atan2(this.to.y-this.via.y,this.to.x-this.via.x),i=this.to.x-this.via.x,s=this.to.y-this.via.y,o=Math.sqrt(i*i+s*s));var d,l,c=this.to.distanceToBorder(t,e),p=(o-c)/o;return 1==this.smooth?(d=(1-p)*this.via.x+p*this.to.x,l=(1-p)*this.via.y+p*this.to.y):(d=(1-p)*this.from.x+p*this.to.x,l=(1-p)*this.from.y+p*this.to.y),{from:{x:a,y:h},to:{x:d,y:l}}},Popup.prototype.setPosition=function(t,e){this.x=parseInt(t),this.y=parseInt(e)},Popup.prototype.setText=function(t){this.frame.innerHTML=t},Popup.prototype.show=function(t){if(void 0===t&&(t=!0),t){var e=this.frame.clientHeight,i=this.frame.clientWidth,s=this.frame.parentNode.clientHeight,o=this.frame.parentNode.clientWidth,n=this.y-e;n+e+this.padding>s&&(n=s-e-this.padding),no&&(r=o-i-this.padding),rthis.constants.clustering.clusterThreshold&&1==this.constants.clustering.enabled&&this.clusterToFit(this.constants.clustering.reduceToNodes,!1),this._calculateForces())},_calculateForces:function(){this._calculateGravitationalForces(),this._calculateNodeForces(),1==this.constants.smoothCurves?this._calculateSpringForcesWithSupport():1==this.constants.physics.hierarchicalRepulsion.enabled?this._calculateHierarchicalSpringForces():this._calculateSpringForces()},_updateCalculationNodes:function(){if(1==this.constants.smoothCurves){this.calculationNodes={},this.calculationNodeIndices=[];for(var t in this.nodes)this.nodes.hasOwnProperty(t)&&(this.calculationNodes[t]=this.nodes[t]);var e=this.sectors.support.nodes;for(var i in e)e.hasOwnProperty(i)&&(this.edges.hasOwnProperty(e[i].parentEdgeId)?this.calculationNodes[i]=e[i]:e[i]._setForce(0,0));for(var s in this.calculationNodes)this.calculationNodes.hasOwnProperty(s)&&this.calculationNodeIndices.push(s)}else this.calculationNodes=this.nodes,this.calculationNodeIndices=this.nodeIndices},_calculateGravitationalForces:function(){var t,e,i,s,o,n=this.calculationNodes,r=this.constants.physics.centralGravity,a=0;for(o=0;oSimulation Mode:Barnes HutRepulsionHierarchical
Options:
',this.containerElement.parentElement.insertBefore(this.physicsConfiguration,this.containerElement),this.optionsDiv=document.createElement("div"),this.optionsDiv.style.fontSize="14px",this.optionsDiv.style.fontFamily="verdana",this.containerElement.parentElement.insertBefore(this.optionsDiv,this.containerElement);var e;e=document.getElementById("graph_BH_gc"),e.onchange=showValueOfRange.bind(this,"graph_BH_gc",-1,"physics_barnesHut_gravitationalConstant"),e=document.getElementById("graph_BH_cg"),e.onchange=showValueOfRange.bind(this,"graph_BH_cg",1,"physics_centralGravity"),e=document.getElementById("graph_BH_sc"),e.onchange=showValueOfRange.bind(this,"graph_BH_sc",1,"physics_springConstant"),e=document.getElementById("graph_BH_sl"),e.onchange=showValueOfRange.bind(this,"graph_BH_sl",1,"physics_springLength"),e=document.getElementById("graph_BH_damp"),e.onchange=showValueOfRange.bind(this,"graph_BH_damp",1,"physics_damping"),e=document.getElementById("graph_R_nd"),e.onchange=showValueOfRange.bind(this,"graph_R_nd",1,"physics_repulsion_nodeDistance"),e=document.getElementById("graph_R_cg"),e.onchange=showValueOfRange.bind(this,"graph_R_cg",1,"physics_centralGravity"),e=document.getElementById("graph_R_sc"),e.onchange=showValueOfRange.bind(this,"graph_R_sc",1,"physics_springConstant"),e=document.getElementById("graph_R_sl"),e.onchange=showValueOfRange.bind(this,"graph_R_sl",1,"physics_springLength"),e=document.getElementById("graph_R_damp"),e.onchange=showValueOfRange.bind(this,"graph_R_damp",1,"physics_damping"),e=document.getElementById("graph_H_nd"),e.onchange=showValueOfRange.bind(this,"graph_H_nd",1,"physics_hierarchicalRepulsion_nodeDistance"),e=document.getElementById("graph_H_cg"),e.onchange=showValueOfRange.bind(this,"graph_H_cg",1,"physics_centralGravity"),e=document.getElementById("graph_H_sc"),e.onchange=showValueOfRange.bind(this,"graph_H_sc",1,"physics_springConstant"),e=document.getElementById("graph_H_sl"),e.onchange=showValueOfRange.bind(this,"graph_H_sl",1,"physics_springLength"),e=document.getElementById("graph_H_damp"),e.onchange=showValueOfRange.bind(this,"graph_H_damp",1,"physics_damping"),e=document.getElementById("graph_H_direction"),e.onchange=showValueOfRange.bind(this,"graph_H_direction",t,"hierarchicalLayout_direction"),e=document.getElementById("graph_H_levsep"),e.onchange=showValueOfRange.bind(this,"graph_H_levsep",1,"hierarchicalLayout_levelSeparation"),e=document.getElementById("graph_H_nspac"),e.onchange=showValueOfRange.bind(this,"graph_H_nspac",1,"hierarchicalLayout_nodeSpacing");var i=document.getElementById("graph_physicsMethod1"),s=document.getElementById("graph_physicsMethod2"),o=document.getElementById("graph_physicsMethod3");s.checked=!0,this.constants.physics.barnesHut.enabled&&(i.checked=!0),this.constants.hierarchicalLayout.enabled&&(o.checked=!0);var n=document.getElementById("graph_toggleSmooth"),r=document.getElementById("graph_repositionNodes"),a=document.getElementById("graph_generateOptions");n.onclick=graphToggleSmoothCurves.bind(this),r.onclick=graphRepositionNodes.bind(this),a.onclick=graphGenerateOptions.bind(this),n.style.background=1==this.constants.smoothCurves?"#A4FF56":"#FF8532",switchConfigurations.apply(this),i.onchange=switchConfigurations.bind(this),s.onchange=switchConfigurations.bind(this),o.onchange=switchConfigurations.bind(this)}},_overWriteGraphConstants:function(t,e){var i=t.split("_");1==i.length?this.constants[i[0]]=e:2==i.length?this.constants[i[0]][i[1]]=e:3==i.length&&(this.constants[i[0]][i[1]][i[2]]=e)}},hierarchalRepulsionMixin={_calculateNodeForces:function(){var t,e,i,s,o,n,r,a,h,d,l=this.calculationNodes,c=this.calculationNodeIndices,p=5,u=.5*-p,m=this.constants.physics.hierarchicalRepulsion.nodeDistance,g=m,f=u/g;for(h=0;hi)){n=f*i+p;var v=.05,y=2*g*2*v;n=v*Math.pow(i,2)-y*i+y*y/(4*v),0==i?i=.01:n/=i,s=t*n,o=e*n,r.fx-=s,r.fy-=o,a.fx+=s,a.fy+=o}},_calculateHierarchicalSpringForces:function(){var t,e,i,s,o,n,r,a,h,d=this.edges;for(i in d)if(d.hasOwnProperty(i)&&(e=d[i],e.connected&&this.nodes.hasOwnProperty(e.toId)&&this.nodes.hasOwnProperty(e.fromId))){t=e.customLength?e.length:this.constants.physics.springLength,t+=(e.to.clusterSize+e.from.clusterSize-2)*this.constants.clustering.edgeGrowth,s=e.from.x-e.to.x,o=e.from.y-e.to.y,h=Math.sqrt(s*s+o*o),0==h&&(h=.01),h=Math.max(.8*t,Math.min(5*t,h)),a=this.constants.physics.springConstant*(t-h)/h,n=s*a,r=o*a,e.to.fx-=n,e.to.fy-=r,e.from.fx+=n,e.from.fy+=r;var l=5;h>t&&(l=25),e.from.level>e.to.level?(e.to.fx-=l*n,e.to.fy-=l*r):e.from.leveln;n++)t=e[i[n]],this._getForceContribution(o.root.children.NW,t),this._getForceContribution(o.root.children.NE,t),this._getForceContribution(o.root.children.SW,t),this._getForceContribution(o.root.children.SE,t)}},_getForceContribution:function(t,e){if(t.childrenCount>0){var i,s,o;if(i=t.centerOfMass.x-e.x,s=t.centerOfMass.y-e.y,o=Math.sqrt(i*i+s*s),o*t.calcSize>this.constants.physics.barnesHut.theta){0==o&&(o=.1*Math.random(),i=o);var n=this.constants.physics.barnesHut.gravitationalConstant*t.mass*e.mass/(o*o*o),r=i*n,a=s*n;e.fx+=r,e.fy+=a}else if(4==t.childrenCount)this._getForceContribution(t.children.NW,e),this._getForceContribution(t.children.NE,e),this._getForceContribution(t.children.SW,e),this._getForceContribution(t.children.SE,e);else if(t.children.data.id!=e.id){0==o&&(o=.5*Math.random(),i=o);var n=this.constants.physics.barnesHut.gravitationalConstant*t.mass*e.mass/(o*o*o),r=i*n,a=s*n;e.fx+=r,e.fy+=a}}},_formBarnesHutTree:function(t,e){for(var i,s=e.length,o=Number.MAX_VALUE,n=Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE,h=0;s>h;h++){var d=t[e[h]].x,l=t[e[h]].y;o>d&&(o=d),d>r&&(r=d),n>l&&(n=l),l>a&&(a=l)}var c=Math.abs(r-o)-Math.abs(a-n);c>0?(n-=.5*c,a+=.5*c):(o+=.5*c,r-=.5*c);var p=1e-5,u=Math.max(p,Math.abs(r-o)),m=.5*u,g=.5*(o+r),f=.5*(n+a),v={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:g-m,maxX:g+m,minY:f-m,maxY:f+m},size:u,calcSize:1/u,children:{data:null},maxWidth:0,level:0,childrenCount:4}};for(this._splitBranch(v.root),h=0;s>h;h++)i=t[e[h]],this._placeInTree(v.root,i);this.barnesHutTree=v},_updateBranchMass:function(t,e){var i=t.mass+e.mass,s=1/i;t.centerOfMass.x=t.centerOfMass.x*t.mass+e.x*e.mass,t.centerOfMass.x*=s,t.centerOfMass.y=t.centerOfMass.y*t.mass+e.y*e.mass,t.centerOfMass.y*=s,t.mass=i;var o=Math.max(Math.max(e.height,e.radius),e.width);t.maxWidth=t.maxWidthe.x?t.children.NW.range.maxY>e.y?this._placeInRegion(t,e,"NW"):this._placeInRegion(t,e,"SW"):t.children.NW.range.maxY>e.y?this._placeInRegion(t,e,"NE"):this._placeInRegion(t,e,"SE")},_placeInRegion:function(t,e,i){switch(t.children[i].childrenCount){case 0:t.children[i].children.data=e,t.children[i].childrenCount=1,this._updateBranchMass(t.children[i],e);break;case 1:t.children[i].children.data.x==e.x&&t.children[i].children.data.y==e.y?(e.x+=Math.random(),e.y+=Math.random()):(this._splitBranch(t.children[i]),this._placeInTree(t.children[i],e));break;case 4:this._placeInTree(t.children[i],e)}},_splitBranch:function(t){var e=null;1==t.childrenCount&&(e=t.children.data,t.mass=0,t.centerOfMass.x=0,t.centerOfMass.y=0),t.childrenCount=4,t.children.data=null,this._insertRegion(t,"NW"),this._insertRegion(t,"NE"),this._insertRegion(t,"SW"),this._insertRegion(t,"SE"),null!=e&&this._placeInTree(t,e)},_insertRegion:function(t,e){var i,s,o,n,r=.5*t.size;switch(e){case"NW":i=t.range.minX,s=t.range.minX+r,o=t.range.minY,n=t.range.minY+r;break;case"NE":i=t.range.minX+r,s=t.range.maxX,o=t.range.minY,n=t.range.minY+r;break;case"SW":i=t.range.minX,s=t.range.minX+r,o=t.range.minY+r,n=t.range.maxY;break;case"SE":i=t.range.minX+r,s=t.range.maxX,o=t.range.minY+r,n=t.range.maxY}t.children[e]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:s,minY:o,maxY:n},size:.5*t.size,calcSize:2*t.calcSize,children:{data:null},maxWidth:0,level:t.level+1,childrenCount:0}},_drawTree:function(t,e){void 0!==this.barnesHutTree&&(t.lineWidth=1,this._drawBranch(this.barnesHutTree.root,t,e))},_drawBranch:function(t,e,i){void 0===i&&(i="#FF0000"),4==t.childrenCount&&(this._drawBranch(t.children.NW,e),this._drawBranch(t.children.NE,e),this._drawBranch(t.children.SE,e),this._drawBranch(t.children.SW,e)),e.strokeStyle=i,e.beginPath(),e.moveTo(t.range.minX,t.range.minY),e.lineTo(t.range.maxX,t.range.minY),e.stroke(),e.beginPath(),e.moveTo(t.range.maxX,t.range.minY),e.lineTo(t.range.maxX,t.range.maxY),e.stroke(),e.beginPath(),e.moveTo(t.range.maxX,t.range.maxY),e.lineTo(t.range.minX,t.range.maxY),e.stroke(),e.beginPath(),e.moveTo(t.range.minX,t.range.maxY),e.lineTo(t.range.minX,t.range.minY),e.stroke()}},repulsionMixin={_calculateNodeForces:function(){var t,e,i,s,o,n,r,a,h,d,l,c=this.calculationNodes,p=this.calculationNodeIndices,u=-2/3,m=4/3,g=this.constants.physics.repulsion.nodeDistance,f=g;for(d=0;di&&(r=.5*f>i?1:v*i+m,r*=0==n?1:1+n*this.constants.clustering.forceAmplification,r/=i,s=t*r,o=e*r,a.fx-=s,a.fy-=o,h.fx+=s,h.fy+=o)}}},HierarchicalLayoutMixin={_resetLevels:function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t)){var e=this.nodes[t];0==e.preassignedLevel&&(e.level=-1)}},_setupHierarchicalLayout:function(){if(1==this.constants.hierarchicalLayout.enabled&&this.nodeIndices.length>0){"RL"==this.constants.hierarchicalLayout.direction||"DU"==this.constants.hierarchicalLayout.direction?this.constants.hierarchicalLayout.levelSeparation*=-1:this.constants.hierarchicalLayout.levelSeparation=Math.abs(this.constants.hierarchicalLayout.levelSeparation);var t,e,i=0,s=!1,o=!1;for(e in this.nodes)this.nodes.hasOwnProperty(e)&&(t=this.nodes[e],-1!=t.level?s=!0:o=!0,is&&(n.xFixed=!1,n.x=i[n.level].minPos,r=!0):n.yFixed&&n.level>s&&(n.yFixed=!1,n.y=i[n.level].minPos,r=!0),1==r&&(i[n.level].minPos+=i[n.level].nodeSpacing,n.edges.length>1&&this._placeBranchNodes(n.edges,n.id,i,n.level))}},_setLevel:function(t,e,i){for(var s=0;st)&&(o.level=t,e.length>1&&this._setLevel(t+1,o.edges,o.id))}},_restoreNodes:function(){for(nodeId in this.nodes)this.nodes.hasOwnProperty(nodeId)&&(this.nodes[nodeId].xFixed=!1,this.nodes[nodeId].yFixed=!1)}},manipulationMixin={_clearManipulatorBar:function(){for(;this.manipulationDiv.hasChildNodes();)this.manipulationDiv.removeChild(this.manipulationDiv.firstChild)},_restoreOverloadedFunctions:function(){for(var t in this.cachedFunctions)this.cachedFunctions.hasOwnProperty(t)&&(this[t]=this.cachedFunctions[t])},_toggleEditMode:function(){this.editMode=!this.editMode;var t=document.getElementById("network-manipulationDiv"),e=document.getElementById("network-manipulation-closeDiv"),i=document.getElementById("network-manipulation-editMode");1==this.editMode?(t.style.display="block",e.style.display="block",i.style.display="none",e.onclick=this._toggleEditMode.bind(this)):(t.style.display="none",e.style.display="none",i.style.display="block",e.onclick=null),this._createManipulatorBar()},_createManipulatorBar:function(){if(this.boundFunction&&this.off("select",this.boundFunction),void 0!==this.edgeBeingEdited&&(this.edgeBeingEdited._disableControlNodes(),this.edgeBeingEdited=void 0,this.selectedControlNode=null),this._restoreOverloadedFunctions(),this.freezeSimulation=!1,this.blockConnectingEdgeSelection=!1,this.forceAppendSelection=!1,1==this.editMode){for(;this.manipulationDiv.hasChildNodes();)this.manipulationDiv.removeChild(this.manipulationDiv.firstChild);this.manipulationDiv.innerHTML=""+this.constants.labels.add+"
"+this.constants.labels.link+"",1==this._getSelectedNodeCount()&&this.triggerFunctions.edit?this.manipulationDiv.innerHTML+="
"+this.constants.labels.editNode+"":1==this._getSelectedEdgeCount()&&0==this._getSelectedNodeCount()&&(this.manipulationDiv.innerHTML+="
"+this.constants.labels.editEdge+""),0==this._selectionIsEmpty()&&(this.manipulationDiv.innerHTML+="
"+this.constants.labels.del+"");var t=document.getElementById("network-manipulate-addNode");t.onclick=this._createAddNodeToolbar.bind(this);var e=document.getElementById("network-manipulate-connectNode");if(e.onclick=this._createAddEdgeToolbar.bind(this),1==this._getSelectedNodeCount()&&this.triggerFunctions.edit){var i=document.getElementById("network-manipulate-editNode"); -i.onclick=this._editNode.bind(this)}else if(1==this._getSelectedEdgeCount()&&0==this._getSelectedNodeCount()){var i=document.getElementById("network-manipulate-editEdge");i.onclick=this._createEditEdgeToolbar.bind(this)}if(0==this._selectionIsEmpty()){var s=document.getElementById("network-manipulate-delete");s.onclick=this._deleteSelected.bind(this)}var o=document.getElementById("network-manipulation-closeDiv");o.onclick=this._toggleEditMode.bind(this),this.boundFunction=this._createManipulatorBar.bind(this),this.on("select",this.boundFunction)}else{this.editModeDiv.innerHTML=""+this.constants.labels.edit+"";var n=document.getElementById("network-manipulate-editModeButton");n.onclick=this._toggleEditMode.bind(this)}},_createAddNodeToolbar:function(){this._clearManipulatorBar(),this.boundFunction&&this.off("select",this.boundFunction),this.manipulationDiv.innerHTML=""+this.constants.labels.back+"
"+this.constants.labels.addDescription+"";var t=document.getElementById("network-manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.boundFunction=this._addNode.bind(this),this.on("select",this.boundFunction)},_createAddEdgeToolbar:function(){this._clearManipulatorBar(),this._unselectAll(!0),this.freezeSimulation=!0,this.boundFunction&&this.off("select",this.boundFunction),this._unselectAll(),this.forceAppendSelection=!1,this.blockConnectingEdgeSelection=!0,this.manipulationDiv.innerHTML=""+this.constants.labels.back+"
"+this.constants.labels.linkDescription+"";var t=document.getElementById("network-manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.boundFunction=this._handleConnect.bind(this),this.on("select",this.boundFunction),this.cachedFunctions._handleTouch=this._handleTouch,this.cachedFunctions._handleOnRelease=this._handleOnRelease,this._handleTouch=this._handleConnect,this._handleOnRelease=this._finishConnect,this._redraw()},_createEditEdgeToolbar:function(){this._clearManipulatorBar(),this.boundFunction&&this.off("select",this.boundFunction),this.edgeBeingEdited=this._getSelectedEdge(),this.edgeBeingEdited._enableControlNodes(),this.manipulationDiv.innerHTML=""+this.constants.labels.back+"
"+this.constants.labels.editEdgeDescription+"";var t=document.getElementById("network-manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.cachedFunctions._handleTouch=this._handleTouch,this.cachedFunctions._handleOnRelease=this._handleOnRelease,this.cachedFunctions._handleTap=this._handleTap,this.cachedFunctions._handleDragStart=this._handleDragStart,this.cachedFunctions._handleOnDrag=this._handleOnDrag,this._handleTouch=this._selectControlNode,this._handleTap=function(){},this._handleOnDrag=this._controlNodeDrag,this._handleDragStart=function(){},this._handleOnRelease=this._releaseControlNode,this._redraw()},_selectControlNode:function(t){this.edgeBeingEdited.controlNodes.from.unselect(),this.edgeBeingEdited.controlNodes.to.unselect(),this.selectedControlNode=this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(t.x),this._YconvertDOMtoCanvas(t.y)),null!==this.selectedControlNode&&(this.selectedControlNode.select(),this.freezeSimulation=!0),this._redraw()},_controlNodeDrag:function(t){var e=this._getPointer(t.gesture.center);null!==this.selectedControlNode&&void 0!==this.selectedControlNode&&(this.selectedControlNode.x=this._XconvertDOMtoCanvas(e.x),this.selectedControlNode.y=this._YconvertDOMtoCanvas(e.y)),this._redraw()},_releaseControlNode:function(t){var e=this._getNodeAt(t);null!=e?(1==this.edgeBeingEdited.controlNodes.from.selected&&(this._editEdge(e.id,this.edgeBeingEdited.to.id),this.edgeBeingEdited.controlNodes.from.unselect()),1==this.edgeBeingEdited.controlNodes.to.selected&&(this._editEdge(this.edgeBeingEdited.from.id,e.id),this.edgeBeingEdited.controlNodes.to.unselect())):this.edgeBeingEdited._restoreControlNodes(),this.freezeSimulation=!1,this._redraw()},_handleConnect:function(t){if(0==this._getSelectedNodeCount()){var e=this._getNodeAt(t);null!=e&&(e.clusterSize>1?alert("Cannot create edges to a cluster."):(this._selectObject(e,!1),this.sectors.support.nodes.targetNode=new Node({id:"targetNode"},{},{},this.constants),this.sectors.support.nodes.targetNode.x=e.x,this.sectors.support.nodes.targetNode.y=e.y,this.sectors.support.nodes.targetViaNode=new Node({id:"targetViaNode"},{},{},this.constants),this.sectors.support.nodes.targetViaNode.x=e.x,this.sectors.support.nodes.targetViaNode.y=e.y,this.sectors.support.nodes.targetViaNode.parentEdgeId="connectionEdge",this.edges.connectionEdge=new Edge({id:"connectionEdge",from:e.id,to:this.sectors.support.nodes.targetNode.id},this,this.constants),this.edges.connectionEdge.from=e,this.edges.connectionEdge.connected=!0,this.edges.connectionEdge.smooth=!0,this.edges.connectionEdge.selected=!0,this.edges.connectionEdge.to=this.sectors.support.nodes.targetNode,this.edges.connectionEdge.via=this.sectors.support.nodes.targetViaNode,this.cachedFunctions._handleOnDrag=this._handleOnDrag,this._handleOnDrag=function(t){var e=this._getPointer(t.gesture.center);this.sectors.support.nodes.targetNode.x=this._XconvertDOMtoCanvas(e.x),this.sectors.support.nodes.targetNode.y=this._YconvertDOMtoCanvas(e.y),this.sectors.support.nodes.targetViaNode.x=.5*(this._XconvertDOMtoCanvas(e.x)+this.edges.connectionEdge.from.x),this.sectors.support.nodes.targetViaNode.y=this._YconvertDOMtoCanvas(e.y)},this.moving=!0,this.start()))}},_finishConnect:function(t){if(1==this._getSelectedNodeCount()){this._handleOnDrag=this.cachedFunctions._handleOnDrag,delete this.cachedFunctions._handleOnDrag;var e=this.edges.connectionEdge.fromId;delete this.edges.connectionEdge,delete this.sectors.support.nodes.targetNode,delete this.sectors.support.nodes.targetViaNode;var i=this._getNodeAt(t);null!=i&&(i.clusterSize>1?alert("Cannot create edges to a cluster."):(this._createEdge(e,i.id),this._createManipulatorBar())),this._unselectAll()}},_addNode:function(){if(this._selectionIsEmpty()&&1==this.editMode){var t=this._pointerToPositionObject(this.pointerPosition),e={id:util.randomUUID(),x:t.left,y:t.top,label:"new",allowedToMoveX:!0,allowedToMoveY:!0};if(this.triggerFunctions.add)if(2==this.triggerFunctions.add.length){var i=this;this.triggerFunctions.add(e,function(t){i.nodesData.add(t),i._createManipulatorBar(),i.moving=!0,i.start()})}else alert(this.constants.labels.addError),this._createManipulatorBar(),this.moving=!0,this.start();else this.nodesData.add(e),this._createManipulatorBar(),this.moving=!0,this.start()}},_createEdge:function(t,e){if(1==this.editMode){var i={from:t,to:e};if(this.triggerFunctions.connect)if(2==this.triggerFunctions.connect.length){var s=this;this.triggerFunctions.connect(i,function(t){s.edgesData.add(t),s.moving=!0,s.start()})}else alert(this.constants.labels.linkError),this.moving=!0,this.start();else this.edgesData.add(i),this.moving=!0,this.start()}},_editEdge:function(t,e){if(1==this.editMode){var i={id:this.edgeBeingEdited.id,from:t,to:e};if(this.triggerFunctions.editEdge)if(2==this.triggerFunctions.editEdge.length){var s=this;this.triggerFunctions.editEdge(i,function(t){s.edgesData.update(t),s.moving=!0,s.start()})}else alert(this.constants.labels.linkError),this.moving=!0,this.start();else this.edgesData.update(i),this.moving=!0,this.start()}},_editNode:function(){if(this.triggerFunctions.edit&&1==this.editMode){var t=this._getSelectedNode(),e={id:t.id,label:t.label,group:t.group,shape:t.shape,color:{background:t.color.background,border:t.color.border,highlight:{background:t.color.highlight.background,border:t.color.highlight.border}}};if(2==this.triggerFunctions.edit.length){var i=this;this.triggerFunctions.edit(e,function(t){i.nodesData.update(t),i._createManipulatorBar(),i.moving=!0,i.start()})}else alert(this.constants.labels.editError)}else alert(this.constants.labels.editBoundError)},_deleteSelected:function(){if(!this._selectionIsEmpty()&&1==this.editMode)if(this._clusterInSelection())alert(this.constants.labels.deleteClusterError);else{var t=this.getSelectedNodes(),e=this.getSelectedEdges();if(this.triggerFunctions.del){var i=this,s={nodes:t,edges:e};(this.triggerFunctions.del.length=2)?this.triggerFunctions.del(s,function(t){i.edgesData.remove(t.edges),i.nodesData.remove(t.nodes),i._unselectAll(),i.moving=!0,i.start()}):alert(this.constants.labels.deleteError)}else this.edgesData.remove(e),this.nodesData.remove(t),this._unselectAll(),this.moving=!0,this.start()}}},SectorMixin={_putDataInSector:function(){this.sectors.active[this._sector()].nodes=this.nodes,this.sectors.active[this._sector()].edges=this.edges,this.sectors.active[this._sector()].nodeIndices=this.nodeIndices},_switchToSector:function(t,e){void 0===e||"active"==e?this._switchToActiveSector(t):this._switchToFrozenSector(t)},_switchToActiveSector:function(t){this.nodeIndices=this.sectors.active[t].nodeIndices,this.nodes=this.sectors.active[t].nodes,this.edges=this.sectors.active[t].edges},_switchToSupportSector:function(){this.nodeIndices=this.sectors.support.nodeIndices,this.nodes=this.sectors.support.nodes,this.edges=this.sectors.support.edges},_switchToFrozenSector:function(t){this.nodeIndices=this.sectors.frozen[t].nodeIndices,this.nodes=this.sectors.frozen[t].nodes,this.edges=this.sectors.frozen[t].edges},_loadLatestSector:function(){this._switchToSector(this._sector())},_sector:function(){return this.activeSector[this.activeSector.length-1]},_previousSector:function(){if(this.activeSector.length>1)return this.activeSector[this.activeSector.length-2];throw new TypeError("there are not enough sectors in the this.activeSector array.")},_setActiveSector:function(t){this.activeSector.push(t)},_forgetLastSector:function(){this.activeSector.pop()},_createNewSector:function(t){this.sectors.active[t]={nodes:{},edges:{},nodeIndices:[],formationScale:this.scale,drawingNode:void 0},this.sectors.active[t].drawingNode=new Node({id:t,color:{background:"#eaefef",border:"495c5e"}},{},{},this.constants),this.sectors.active[t].drawingNode.clusterSize=2},_deleteActiveSector:function(t){delete this.sectors.active[t]},_deleteFrozenSector:function(t){delete this.sectors.frozen[t]},_freezeSector:function(t){this.sectors.frozen[t]=this.sectors.active[t],this._deleteActiveSector(t)},_activateSector:function(t){this.sectors.active[t]=this.sectors.frozen[t],this._deleteFrozenSector(t)},_mergeThisWithFrozen:function(t){for(var e in this.nodes)this.nodes.hasOwnProperty(e)&&(this.sectors.frozen[t].nodes[e]=this.nodes[e]);for(var i in this.edges)this.edges.hasOwnProperty(i)&&(this.sectors.frozen[t].edges[i]=this.edges[i]);for(var s=0;s1?this[t](s[0],s[1]):this[t](e)}this._loadLatestSector()},_doInSupportSector:function(t,e){if(void 0===e)this._switchToSupportSector(),this[t]();else{this._switchToSupportSector();var i=Array.prototype.splice.call(arguments,1);i.length>1?this[t](i[0],i[1]):this[t](e)}this._loadLatestSector()},_doInAllFrozenSectors:function(t,e){if(void 0===e)for(var i in this.sectors.frozen)this.sectors.frozen.hasOwnProperty(i)&&(this._switchToFrozenSector(i),this[t]());else for(var i in this.sectors.frozen)if(this.sectors.frozen.hasOwnProperty(i)){this._switchToFrozenSector(i);var s=Array.prototype.splice.call(arguments,1);s.length>1?this[t](s[0],s[1]):this[t](e)}this._loadLatestSector()},_doInAllSectors:function(t,e){var i=Array.prototype.splice.call(arguments,1);void 0===e?(this._doInAllActiveSectors(t),this._doInAllFrozenSectors(t)):i.length>1?(this._doInAllActiveSectors(t,i[0],i[1]),this._doInAllFrozenSectors(t,i[0],i[1])):(this._doInAllActiveSectors(t,e),this._doInAllFrozenSectors(t,e))},_clearNodeIndexList:function(){var t=this._sector();this.sectors.active[t].nodeIndices=[],this.nodeIndices=this.sectors.active[t].nodeIndices},_drawSectorNodes:function(t,e){var i,s=1e9,o=-1e9,n=1e9,r=-1e9;for(var a in this.sectors[e])if(this.sectors[e].hasOwnProperty(a)&&void 0!==this.sectors[e][a].drawingNode){this._switchToSector(a,e),s=1e9,o=-1e9,n=1e9,r=-1e9;for(var h in this.nodes)this.nodes.hasOwnProperty(h)&&(i=this.nodes[h],i.resize(t),n>i.x-.5*i.width&&(n=i.x-.5*i.width),ri.y-.5*i.height&&(s=i.y-.5*i.height),ot&&s>o;)o%3==0?(this.forceAggregateHubs(!0),this.normalizeClusterLevels()):this.increaseClusterLevel(),i=this.nodeIndices.length,o+=1;o>0&&1==e&&this.repositionNodes(),this._updateCalculationNodes()},openCluster:function(t){var e=this.moving;if(t.clusterSize>this.constants.clustering.sectorThreshold&&this._nodeInActiveArea(t)&&("default"!=this._sector()||1!=this.nodeIndices.length)){this._addSector(t);for(var i=0;this.nodeIndices.lengthi;)this.decreaseClusterLevel(),i+=1}else this._expandClusterNode(t,!1,!0),this._updateNodeIndexList(),this._updateDynamicEdges(),this._updateCalculationNodes(),this.updateLabels();this.moving!=e&&this.start()},updateClustersDefault:function(){1==this.constants.clustering.enabled&&this.updateClusters(0,!1,!1)},increaseClusterLevel:function(){this.updateClusters(-1,!1,!0)},decreaseClusterLevel:function(){this.updateClusters(1,!1,!0)},updateClusters:function(t,e,i,s){var o=this.moving,n=this.nodeIndices.length;this.previousScale>this.scale&&0==t&&this._collapseSector(),this.previousScale>this.scale||-1==t?this._formClusters(i):(this.previousScalethis.scale||-1==t)&&(this._aggregateHubs(i),this._updateNodeIndexList()),(this.previousScale>this.scale||-1==t)&&(this.handleChains(),this._updateNodeIndexList()),this.previousScale=this.scale,this._updateDynamicEdges(),this.updateLabels(),this.nodeIndices.lengththis.constants.clustering.chainThreshold&&this._reduceAmountOfChains(1-this.constants.clustering.chainThreshold/t)},_aggregateHubs:function(t){this._getHubSize(),this._formClustersByHub(t,!1)},forceAggregateHubs:function(t){var e=this.moving,i=this.nodeIndices.length;this._aggregateHubs(!0),this._updateNodeIndexList(),this._updateDynamicEdges(),this.updateLabels(),this.nodeIndices.length!=i&&(this.clusterSession+=1),(0==t||void 0===t)&&this.moving!=e&&this.start()},_openClustersBySize:function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t)){var e=this.nodes[t];1==e.inView()&&(e.width*this.scale>this.constants.clustering.screenSizeThreshold*this.frame.canvas.clientWidth||e.height*this.scale>this.constants.clustering.screenSizeThreshold*this.frame.canvas.clientHeight)&&this.openCluster(e)}},_openClusters:function(t,e){for(var i=0;i1&&(t.clusterSizei)){var r=n.from,a=n.to;n.to.mass>n.from.mass&&(r=n.to,a=n.from),1==a.dynamicEdgesLength?this._addToCluster(r,a,!1):1==r.dynamicEdgesLength&&this._addToCluster(a,r,!1)}}},_forceClustersByZoom:function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t)){var e=this.nodes[t];if(1==e.dynamicEdgesLength&&0!=e.dynamicEdges.length){var i=e.dynamicEdges[0],s=i.toId==e.id?this.nodes[i.fromId]:this.nodes[i.toId];e.id!=s.id&&(s.mass>e.mass?this._addToCluster(s,e,!0):this._addToCluster(e,s,!0))}}},_clusterToSmallestNeighbour:function(t){for(var e=-1,i=null,s=0;so.clusterSessions.length&&(e=o.clusterSessions.length,i=o)}null!=o&&void 0!==this.nodes[o.id]&&this._addToCluster(o,t,!0)},_formClustersByHub:function(t,e){for(var i in this.nodes)this.nodes.hasOwnProperty(i)&&this._formClusterFromHub(this.nodes[i],t,e)},_formClusterFromHub:function(t,e,i,s){if(void 0===s&&(s=0),t.dynamicEdgesLength>=this.hubThreshold&&0==i||t.dynamicEdgesLength==this.hubThreshold&&1==i){for(var o,n,r,a=this.constants.clustering.clusterEdgeThreshold/this.scale,h=!1,d=[],l=t.dynamicEdges.length,c=0;l>c;c++)d.push(t.dynamicEdges[c].id);if(0==e)for(h=!1,c=0;l>c;c++){var p=this.edges[d[c]];if(void 0!==p&&p.connected&&p.toId!=p.fromId&&(o=p.to.x-p.from.x,n=p.to.y-p.from.y,r=Math.sqrt(o*o+n*n),a>r)){h=!0;break}}if(!e&&h||e)for(c=0;l>c;c++)if(p=this.edges[d[c]],void 0!==p){var u=this.nodes[p.fromId==t.id?p.toId:p.fromId];u.dynamicEdges.length<=this.hubThreshold+s&&u.id!=t.id&&this._addToCluster(t,u,e)}}},_addToCluster:function(t,e,i){t.containedNodes[e.id]=e;for(var s=0;s1)for(var s=0;s1&&(e.label="[".concat(String(e.clusterSize),"]"))}for(t in this.nodes)this.nodes.hasOwnProperty(t)&&(e=this.nodes[t],1==e.clusterSize&&(e.label=void 0!==e.originalLabel?e.originalLabel:String(e.id)))},normalizeClusterLevels:function(){var t,e=0,i=1e9,s=0;for(t in this.nodes)this.nodes.hasOwnProperty(t)&&(s=this.nodes[t].clusterSessions.length,s>e&&(e=s),i>s&&(i=s));if(e-i>this.constants.clustering.clusterLevelDifference){var o=this.nodeIndices.length,n=e-this.constants.clustering.clusterLevelDifference;for(t in this.nodes)this.nodes.hasOwnProperty(t)&&this.nodes[t].clusterSessions.lengths&&(s=n.dynamicEdgesLength),t+=n.dynamicEdgesLength,e+=Math.pow(n.dynamicEdgesLength,2),i+=1}t/=i,e/=i;var r=e-Math.pow(t,2),a=Math.sqrt(r);this.hubThreshold=Math.floor(t+2*a),this.hubThreshold>s&&(this.hubThreshold=s)},_reduceAmountOfChains:function(t){this.hubThreshold=2;var e=Math.floor(this.nodeIndices.length*t);for(var i in this.nodes)this.nodes.hasOwnProperty(i)&&2==this.nodes[i].dynamicEdgesLength&&this.nodes[i].dynamicEdges.length>=2&&e>0&&(this._formClusterFromHub(this.nodes[i],!0,!0,1),e-=1)},_getChainFraction:function(){var t=0,e=0;for(var i in this.nodes)this.nodes.hasOwnProperty(i)&&(2==this.nodes[i].dynamicEdgesLength&&this.nodes[i].dynamicEdges.length>=2&&(t+=1),e+=1);return t/e}},SelectionMixin={_getNodesOverlappingWith:function(t,e){var i=this.nodes;for(var s in i)i.hasOwnProperty(s)&&i[s].isOverlappingWith(t)&&e.push(s)},_getAllNodesOverlappingWith:function(t){var e=[];return this._doInAllActiveSectors("_getNodesOverlappingWith",t,e),e},_pointerToPositionObject:function(t){var e=this._XconvertDOMtoCanvas(t.x),i=this._YconvertDOMtoCanvas(t.y);return{left:e,top:i,right:e,bottom:i}},_getNodeAt:function(t){var e=this._pointerToPositionObject(t),i=this._getAllNodesOverlappingWith(e);return i.length>0?this.nodes[i[i.length-1]]:null},_getEdgesOverlappingWith:function(t,e){var i=this.edges;for(var s in i)i.hasOwnProperty(s)&&i[s].isOverlappingWith(t)&&e.push(s)},_getAllEdgesOverlappingWith:function(t){var e=[];return this._doInAllActiveSectors("_getEdgesOverlappingWith",t,e),e},_getEdgeAt:function(t){var e=this._pointerToPositionObject(t),i=this._getAllEdgesOverlappingWith(e);return i.length>0?this.edges[i[i.length-1]]:null},_addToSelection:function(t){t instanceof Node?this.selectionObj.nodes[t.id]=t:this.selectionObj.edges[t.id]=t},_addToHover:function(t){t instanceof Node?this.hoverObj.nodes[t.id]=t:this.hoverObj.edges[t.id]=t},_removeFromSelection:function(t){t instanceof Node?delete this.selectionObj.nodes[t.id]:delete this.selectionObj.edges[t.id]},_unselectAll:function(t){void 0===t&&(t=!1);for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&this.selectionObj.nodes[e].unselect();for(var i in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(i)&&this.selectionObj.edges[i].unselect();this.selectionObj={nodes:{},edges:{}},0==t&&this.emit("select",this.getSelection())},_unselectClusters:function(t){void 0===t&&(t=!1);for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&this.selectionObj.nodes[e].clusterSize>1&&(this.selectionObj.nodes[e].unselect(),this._removeFromSelection(this.selectionObj.nodes[e]));0==t&&this.emit("select",this.getSelection())},_getSelectedNodeCount:function(){var t=0;for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(t+=1);return t},_getSelectedNode:function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t))return this.selectionObj.nodes[t];return null},_getSelectedEdge:function(){for(var t in this.selectionObj.edges)if(this.selectionObj.edges.hasOwnProperty(t))return this.selectionObj.edges[t];return null},_getSelectedEdgeCount:function(){var t=0;for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&(t+=1);return t},_getSelectedObjectCount:function(){var t=0;for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(t+=1);for(var i in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(i)&&(t+=1);return t},_selectionIsEmpty:function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t))return!1;for(var e in this.selectionObj.edges)if(this.selectionObj.edges.hasOwnProperty(e))return!1;return!0},_clusterInSelection:function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t)&&this.selectionObj.nodes[t].clusterSize>1)return!0;return!1},_selectConnectedEdges:function(t){for(var e=0;ee;e++){s=t[e]; -var o=this.nodes[s];if(!o)throw new RangeError('Node with id "'+s+'" not found');this._selectObject(o,!0,!0)}console.log("setSelection is deprecated. Please use selectNodes instead."),this.redraw()},selectNodes:function(t,e){var i,s,o;if(!t||void 0==t.length)throw"Selection must be an array with ids";for(this._unselectAll(!0),i=0,s=t.length;s>i;i++){o=t[i];var n=this.nodes[o];if(!n)throw new RangeError('Node with id "'+o+'" not found');this._selectObject(n,!0,!0,e)}this.redraw()},selectEdges:function(t){var e,i,s;if(!t||void 0==t.length)throw"Selection must be an array with ids";for(this._unselectAll(!0),e=0,i=t.length;i>e;e++){s=t[e];var o=this.edges[s];if(!o)throw new RangeError('Edge with id "'+s+'" not found');this._selectObject(o,!0,!0,highlightEdges)}this.redraw()},_updateSelection:function(){for(var t in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(t)&&(this.nodes.hasOwnProperty(t)||delete this.selectionObj.nodes[t]);for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&(this.edges.hasOwnProperty(e)||delete this.selectionObj.edges[e])}},NavigationMixin={_cleanNavigation:function(){var t=document.getElementById("network-navigation_wrapper");null!=t&&this.containerElement.removeChild(t),document.onmouseup=null},_loadNavigationElements:function(){this._cleanNavigation(),this.navigationDivs={};var t=["up","down","left","right","zoomIn","zoomOut","zoomExtends"],e=["_moveUp","_moveDown","_moveLeft","_moveRight","_zoomIn","_zoomOut","zoomExtent"];this.navigationDivs.wrapper=document.createElement("div"),this.navigationDivs.wrapper.id="network-navigation_wrapper",this.navigationDivs.wrapper.style.position="absolute",this.navigationDivs.wrapper.style.width=this.frame.canvas.clientWidth+"px",this.navigationDivs.wrapper.style.height=this.frame.canvas.clientHeight+"px",this.containerElement.insertBefore(this.navigationDivs.wrapper,this.frame);for(var i=0;it.x&&(s=t.x),ot.y&&(e=t.y),i=this.constants.clustering.initialMaxNodes?49.07548/(o+142.05338)+91444e-8:12.662/(o+7.4147)+.0964822:1==this.constants.clustering.enabled&&o>=this.constants.clustering.initialMaxNodes?77.5271985/(o+187.266146)+476710517e-13:30.5062972/(o+19.93597763)+.08413486;var n=Math.min(this.frame.canvas.clientWidth/600,this.frame.canvas.clientHeight/600);i*=n}else{var r=1.1*(Math.abs(s.minX)+Math.abs(s.maxX)),a=1.1*(Math.abs(s.minY)+Math.abs(s.maxY)),h=this.frame.canvas.clientWidth/r,d=this.frame.canvas.clientHeight/a;i=d>=h?h:d}i>1&&(i=1),this._setScale(i),this._centerNetwork(s),0==e&&(this.moving=!0,this.start())},Network.prototype._updateNodeIndexList=function(){this._clearNodeIndexList();for(var t in this.nodes)this.nodes.hasOwnProperty(t)&&this.nodeIndices.push(t)},Network.prototype.setData=function(t,e){if(void 0===e&&(e=!1),t&&t.dot&&(t.nodes||t.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(t&&t.options),t&&t.dot){if(t&&t.dot){var i=vis.util.DOTToGraph(t.dot);return void this.setData(i)}}else this._setNodes(t&&t.nodes),this._setEdges(t&&t.edges);if(this._putDataInSector(),!e)if(this.stabilize){var s=this;setTimeout(function(){s._stabilize(),s.start()},0)}else this.start()},Network.prototype.setOptions=function(t){if(t){var e;if(void 0!==t.width&&(this.width=t.width),void 0!==t.height&&(this.height=t.height),void 0!==t.stabilize&&(this.stabilize=t.stabilize),void 0!==t.selectable&&(this.selectable=t.selectable),void 0!==t.smoothCurves&&(this.constants.smoothCurves=t.smoothCurves),void 0!==t.freezeForStabilization&&(this.constants.freezeForStabilization=t.freezeForStabilization),void 0!==t.configurePhysics&&(this.constants.configurePhysics=t.configurePhysics),void 0!==t.stabilizationIterations&&(this.constants.stabilizationIterations=t.stabilizationIterations),void 0!==t.dragNetwork&&(this.constants.dragNetwork=t.dragNetwork),void 0!==t.dragNodes&&(this.constants.dragNodes=t.dragNodes),void 0!==t.zoomable&&(this.constants.zoomable=t.zoomable),void 0!==t.hover&&(this.constants.hover=t.hover),void 0!==t.dragGraph)throw new Error("Option dragGraph is renamed to dragNetwork");if(void 0!==t.labels)for(e in t.labels)t.labels.hasOwnProperty(e)&&(this.constants.labels[e]=t.labels[e]);if(t.onAdd&&(this.triggerFunctions.add=t.onAdd),t.onEdit&&(this.triggerFunctions.edit=t.onEdit),t.onEditEdge&&(this.triggerFunctions.editEdge=t.onEditEdge),t.onConnect&&(this.triggerFunctions.connect=t.onConnect),t.onDelete&&(this.triggerFunctions.del=t.onDelete),t.physics){if(t.physics.barnesHut){this.constants.physics.barnesHut.enabled=!0;for(e in t.physics.barnesHut)t.physics.barnesHut.hasOwnProperty(e)&&(this.constants.physics.barnesHut[e]=t.physics.barnesHut[e])}if(t.physics.repulsion){this.constants.physics.barnesHut.enabled=!1;for(e in t.physics.repulsion)t.physics.repulsion.hasOwnProperty(e)&&(this.constants.physics.repulsion[e]=t.physics.repulsion[e])}if(t.physics.hierarchicalRepulsion){this.constants.hierarchicalLayout.enabled=!0,this.constants.physics.hierarchicalRepulsion.enabled=!0,this.constants.physics.barnesHut.enabled=!1;for(e in t.physics.hierarchicalRepulsion)t.physics.hierarchicalRepulsion.hasOwnProperty(e)&&(this.constants.physics.hierarchicalRepulsion[e]=t.physics.hierarchicalRepulsion[e])}}if(t.hierarchicalLayout){this.constants.hierarchicalLayout.enabled=!0;for(e in t.hierarchicalLayout)t.hierarchicalLayout.hasOwnProperty(e)&&(this.constants.hierarchicalLayout[e]=t.hierarchicalLayout[e])}else void 0!==t.hierarchicalLayout&&(this.constants.hierarchicalLayout.enabled=!1);if(t.clustering){this.constants.clustering.enabled=!0;for(e in t.clustering)t.clustering.hasOwnProperty(e)&&(this.constants.clustering[e]=t.clustering[e])}else void 0!==t.clustering&&(this.constants.clustering.enabled=!1);if(t.navigation){this.constants.navigation.enabled=!0;for(e in t.navigation)t.navigation.hasOwnProperty(e)&&(this.constants.navigation[e]=t.navigation[e])}else void 0!==t.navigation&&(this.constants.navigation.enabled=!1);if(t.keyboard){this.constants.keyboard.enabled=!0;for(e in t.keyboard)t.keyboard.hasOwnProperty(e)&&(this.constants.keyboard[e]=t.keyboard[e])}else void 0!==t.keyboard&&(this.constants.keyboard.enabled=!1);if(t.dataManipulation){this.constants.dataManipulation.enabled=!0;for(e in t.dataManipulation)t.dataManipulation.hasOwnProperty(e)&&(this.constants.dataManipulation[e]=t.dataManipulation[e]);this.editMode=this.constants.dataManipulation.initiallyVisible}else void 0!==t.dataManipulation&&(this.constants.dataManipulation.enabled=!1);if(t.edges){for(e in t.edges)t.edges.hasOwnProperty(e)&&"object"!=typeof t.edges[e]&&(this.constants.edges[e]=t.edges[e]);void 0!==t.edges.color&&(util.isString(t.edges.color)?(this.constants.edges.color={},this.constants.edges.color.color=t.edges.color,this.constants.edges.color.highlight=t.edges.color,this.constants.edges.color.hover=t.edges.color):(void 0!==t.edges.color.color&&(this.constants.edges.color.color=t.edges.color.color),void 0!==t.edges.color.highlight&&(this.constants.edges.color.highlight=t.edges.color.highlight),void 0!==t.edges.color.hover&&(this.constants.edges.color.hover=t.edges.color.hover))),t.edges.fontColor||void 0!==t.edges.color&&(util.isString(t.edges.color)?this.constants.edges.fontColor=t.edges.color:void 0!==t.edges.color.color&&(this.constants.edges.fontColor=t.edges.color.color)),t.edges.dash&&(void 0!==t.edges.dash.length&&(this.constants.edges.dash.length=t.edges.dash.length),void 0!==t.edges.dash.gap&&(this.constants.edges.dash.gap=t.edges.dash.gap),void 0!==t.edges.dash.altLength&&(this.constants.edges.dash.altLength=t.edges.dash.altLength))}if(t.nodes){for(e in t.nodes)t.nodes.hasOwnProperty(e)&&(this.constants.nodes[e]=t.nodes[e]);t.nodes.color&&(this.constants.nodes.color=util.parseColor(t.nodes.color))}if(t.groups)for(var i in t.groups)if(t.groups.hasOwnProperty(i)){var s=t.groups[i];this.groups.add(i,s)}if(t.tooltip){for(e in t.tooltip)t.tooltip.hasOwnProperty(e)&&(this.constants.tooltip[e]=t.tooltip[e]);t.tooltip.color&&(this.constants.tooltip.color=util.parseColor(t.tooltip.color))}}this._loadPhysicsSystem(),this._loadNavigationControls(),this._loadManipulationSystem(),this._configureSmoothCurves(),this._createKeyBinds(),this.setSize(this.width,this.height),this.moving=!0,this.start()},Network.prototype._create=function(){for(;this.containerElement.hasChildNodes();)this.containerElement.removeChild(this.containerElement.firstChild);if(this.frame=document.createElement("div"),this.frame.className="network-frame",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),!this.frame.canvas.getContext){var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(t)}var e=this;this.drag={},this.pinch={},this.hammer=Hammer(this.frame.canvas,{prevent_default:!0}),this.hammer.on("tap",e._onTap.bind(e)),this.hammer.on("doubletap",e._onDoubleTap.bind(e)),this.hammer.on("hold",e._onHold.bind(e)),this.hammer.on("pinch",e._onPinch.bind(e)),this.hammer.on("touch",e._onTouch.bind(e)),this.hammer.on("dragstart",e._onDragStart.bind(e)),this.hammer.on("drag",e._onDrag.bind(e)),this.hammer.on("dragend",e._onDragEnd.bind(e)),this.hammer.on("release",e._onRelease.bind(e)),this.hammer.on("mousewheel",e._onMouseWheel.bind(e)),this.hammer.on("DOMMouseScroll",e._onMouseWheel.bind(e)),this.hammer.on("mousemove",e._onMouseMoveTitle.bind(e)),this.containerElement.appendChild(this.frame)},Network.prototype._createKeyBinds=function(){var t=this;this.mousetrap=mousetrap,this.mousetrap.reset(),1==this.constants.keyboard.enabled&&(this.mousetrap.bind("up",this._moveUp.bind(t),"keydown"),this.mousetrap.bind("up",this._yStopMoving.bind(t),"keyup"),this.mousetrap.bind("down",this._moveDown.bind(t),"keydown"),this.mousetrap.bind("down",this._yStopMoving.bind(t),"keyup"),this.mousetrap.bind("left",this._moveLeft.bind(t),"keydown"),this.mousetrap.bind("left",this._xStopMoving.bind(t),"keyup"),this.mousetrap.bind("right",this._moveRight.bind(t),"keydown"),this.mousetrap.bind("right",this._xStopMoving.bind(t),"keyup"),this.mousetrap.bind("=",this._zoomIn.bind(t),"keydown"),this.mousetrap.bind("=",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("-",this._zoomOut.bind(t),"keydown"),this.mousetrap.bind("-",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("[",this._zoomIn.bind(t),"keydown"),this.mousetrap.bind("[",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("]",this._zoomOut.bind(t),"keydown"),this.mousetrap.bind("]",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("pageup",this._zoomIn.bind(t),"keydown"),this.mousetrap.bind("pageup",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("pagedown",this._zoomOut.bind(t),"keydown"),this.mousetrap.bind("pagedown",this._stopZoom.bind(t),"keyup")),1==this.constants.dataManipulation.enabled&&(this.mousetrap.bind("escape",this._createManipulatorBar.bind(t)),this.mousetrap.bind("del",this._deleteSelected.bind(t)))},Network.prototype._getPointer=function(t){return{x:t.pageX-vis.util.getAbsoluteLeft(this.frame.canvas),y:t.pageY-vis.util.getAbsoluteTop(this.frame.canvas)}},Network.prototype._onTouch=function(t){this.drag.pointer=this._getPointer(t.gesture.center),this.drag.pinched=!1,this.pinch.scale=this._getScale(),this._handleTouch(this.drag.pointer)},Network.prototype._onDragStart=function(){this._handleDragStart()},Network.prototype._handleDragStart=function(){var t=this.drag,e=this._getNodeAt(t.pointer);if(t.dragging=!0,t.selection=[],t.translation=this._getTranslation(),t.nodeId=null,null!=e){t.nodeId=e.id,e.isSelected()||this._selectObject(e,!1);for(var i in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(i)){var s=this.selectionObj.nodes[i],o={id:s.id,node:s,x:s.x,y:s.y,xFixed:s.xFixed,yFixed:s.yFixed};s.xFixed=!0,s.yFixed=!0,t.selection.push(o)}}},Network.prototype._onDrag=function(t){this._handleOnDrag(t)},Network.prototype._handleOnDrag=function(t){if(!this.drag.pinched){var e=this._getPointer(t.gesture.center),i=this,s=this.drag,o=s.selection;if(o&&o.length&&1==this.constants.dragNodes){var n=e.x-s.pointer.x,r=e.y-s.pointer.y;o.forEach(function(t){var e=t.node;t.xFixed||(e.x=i._XconvertDOMtoCanvas(i._XconvertCanvasToDOM(t.x)+n)),t.yFixed||(e.y=i._YconvertDOMtoCanvas(i._YconvertCanvasToDOM(t.y)+r))}),this.moving||(this.moving=!0,this.start())}else if(1==this.constants.dragNetwork){var a=e.x-this.drag.pointer.x,h=e.y-this.drag.pointer.y;this._setTranslation(this.drag.translation.x+a,this.drag.translation.y+h),this._redraw(),this.moving=!0,this.start()}}},Network.prototype._onDragEnd=function(){this.drag.dragging=!1;var t=this.drag.selection;t&&t.forEach(function(t){t.node.xFixed=t.xFixed,t.node.yFixed=t.yFixed})},Network.prototype._onTap=function(t){var e=this._getPointer(t.gesture.center);this.pointerPosition=e,this._handleTap(e)},Network.prototype._onDoubleTap=function(t){var e=this._getPointer(t.gesture.center);this._handleDoubleTap(e)},Network.prototype._onHold=function(t){var e=this._getPointer(t.gesture.center);this.pointerPosition=e,this._handleOnHold(e)},Network.prototype._onRelease=function(t){var e=this._getPointer(t.gesture.center);this._handleOnRelease(e)},Network.prototype._onPinch=function(t){var e=this._getPointer(t.gesture.center);this.drag.pinched=!0,"scale"in this.pinch||(this.pinch.scale=1);var i=this.pinch.scale*t.gesture.scale;this._zoom(i,e)},Network.prototype._zoom=function(t,e){if(1==this.constants.zoomable){var i=this._getScale();1e-5>t&&(t=1e-5),t>10&&(t=10);var s=this._getTranslation(),o=t/i,n=(1-o)*e.x+s.x*o,r=(1-o)*e.y+s.y*o;return this.areaCenter={x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)},this._setScale(t),this._setTranslation(n,r),this.updateClustersDefault(),this._redraw(),t>i?this.emit("zoom",{direction:"+"}):this.emit("zoom",{direction:"-"}),t}},Network.prototype._onMouseWheel=function(t){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),e){var i=this._getScale(),s=e/10;0>e&&(s/=1-s),i*=1+s;var o=util.fakeGesture(this,t),n=this._getPointer(o.center);this._zoom(i,n)}t.preventDefault()},Network.prototype._onMouseMoveTitle=function(t){var e=util.fakeGesture(this,t),i=this._getPointer(e.center);this.popupObj&&this._checkHidePopup(i);var s=this,o=function(){s._checkShowPopup(i)};if(this.popupTimer&&clearInterval(this.popupTimer),this.drag.dragging||(this.popupTimer=setTimeout(o,this.constants.tooltip.delay)),1==this.constants.hover){for(var n in this.hoverObj.edges)this.hoverObj.edges.hasOwnProperty(n)&&(this.hoverObj.edges[n].hover=!1,delete this.hoverObj.edges[n]);var r=this._getNodeAt(i);null==r&&(r=this._getEdgeAt(i)),null!=r&&this._hoverObject(r);for(var a in this.hoverObj.nodes)this.hoverObj.nodes.hasOwnProperty(a)&&(r instanceof Node&&r.id!=a||r instanceof Edge||null==r)&&(this._blurObject(this.hoverObj.nodes[a]),delete this.hoverObj.nodes[a]);this.redraw()}},Network.prototype._checkShowPopup=function(t){var e,i={left:this._XconvertDOMtoCanvas(t.x),top:this._YconvertDOMtoCanvas(t.y),right:this._XconvertDOMtoCanvas(t.x),bottom:this._YconvertDOMtoCanvas(t.y)},s=this.popupObj;if(void 0==this.popupObj){var o=this.nodes;for(e in o)if(o.hasOwnProperty(e)){var n=o[e];if(void 0!==n.getTitle()&&n.isOverlappingWith(i)){this.popupObj=n;break}}}if(void 0===this.popupObj){var r=this.edges;for(e in r)if(r.hasOwnProperty(e)){var a=r[e];if(a.connected&&void 0!==a.getTitle()&&a.isOverlappingWith(i)){this.popupObj=a;break}}}if(this.popupObj){if(this.popupObj!=s){var h=this;h.popup||(h.popup=new Popup(h.frame,h.constants.tooltip)),h.popup.setPosition(t.x-3,t.y-3),h.popup.setText(h.popupObj.getTitle()),h.popup.show()}}else this.popup&&this.popup.hide()},Network.prototype._checkHidePopup=function(t){this.popupObj&&this._getNodeAt(t)||(this.popupObj=void 0,this.popup&&this.popup.hide())},Network.prototype.setSize=function(t,e){this.frame.style.width=t,this.frame.style.height=e,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=this.frame.canvas.clientWidth,this.frame.canvas.height=this.frame.canvas.clientHeight,void 0!==this.manipulationDiv&&(this.manipulationDiv.style.width=this.frame.canvas.clientWidth+"px"),void 0!==this.navigationDivs&&void 0!==this.navigationDivs.wrapper&&(this.navigationDivs.wrapper.style.width=this.frame.canvas.clientWidth+"px",this.navigationDivs.wrapper.style.height=this.frame.canvas.clientHeight+"px"),this.emit("resize",{width:this.frame.canvas.width,height:this.frame.canvas.height})},Network.prototype._setNodes=function(t){var e=this.nodesData;if(t instanceof DataSet||t instanceof DataView)this.nodesData=t;else if(t instanceof Array)this.nodesData=new DataSet,this.nodesData.add(t);else{if(t)throw new TypeError("Array or DataSet expected");this.nodesData=new DataSet}if(e&&util.forEach(this.nodesListeners,function(t,i){e.off(i,t)}),this.nodes={},this.nodesData){var i=this;util.forEach(this.nodesListeners,function(t,e){i.nodesData.on(e,t)});var s=this.nodesData.getIds();this._addNodes(s)}this._updateSelection()},Network.prototype._addNodes=function(t){for(var e,i=0,s=t.length;s>i;i++){e=t[i];var o=this.nodesData.get(e),n=new Node(o,this.images,this.groups,this.constants);if(this.nodes[e]=n,!(0!=n.xFixed&&0!=n.yFixed||null!==n.x&&null!==n.y)){var r=1*t.length,a=2*Math.PI*Math.random();0==n.xFixed&&(n.x=r*Math.cos(a)),0==n.yFixed&&(n.y=r*Math.sin(a))}this.moving=!0}this._updateNodeIndexList(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes(),this._reconnectEdges(),this._updateValueRange(this.nodes),this.updateLabels()},Network.prototype._updateNodes=function(t){for(var e=this.nodes,i=this.nodesData,s=0,o=t.length;o>s;s++){var n=t[s],r=e[n],a=i.get(n);r?r.setProperties(a,this.constants):(r=new Node(properties,this.images,this.groups,this.constants),e[n]=r)}this.moving=!0,1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateNodeIndexList(),this._reconnectEdges(),this._updateValueRange(e)},Network.prototype._removeNodes=function(t){for(var e=this.nodes,i=0,s=t.length;s>i;i++){var o=t[i];delete e[o]}this._updateNodeIndexList(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes(),this._reconnectEdges(),this._updateSelection(),this._updateValueRange(e)},Network.prototype._setEdges=function(t){var e=this.edgesData;if(t instanceof DataSet||t instanceof DataView)this.edgesData=t;else if(t instanceof Array)this.edgesData=new DataSet,this.edgesData.add(t);else{if(t)throw new TypeError("Array or DataSet expected");this.edgesData=new DataSet}if(e&&util.forEach(this.edgesListeners,function(t,i){e.off(i,t)}),this.edges={},this.edgesData){var i=this;util.forEach(this.edgesListeners,function(t,e){i.edgesData.on(e,t)});var s=this.edgesData.getIds();this._addEdges(s)}this._reconnectEdges()},Network.prototype._addEdges=function(t){for(var e=this.edges,i=this.edgesData,s=0,o=t.length;o>s;s++){var n=t[s],r=e[n];r&&r.disconnect();var a=i.get(n,{showInternalIds:!0});e[n]=new Edge(a,this,this.constants)}this.moving=!0,this._updateValueRange(e),this._createBezierNodes(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes()},Network.prototype._updateEdges=function(t){for(var e=this.edges,i=this.edgesData,s=0,o=t.length;o>s;s++){var n=t[s],r=i.get(n),a=e[n];a?(a.disconnect(),a.setProperties(r,this.constants),a.connect()):(a=new Edge(r,this,this.constants),this.edges[n]=a)}this._createBezierNodes(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this.moving=!0,this._updateValueRange(e)},Network.prototype._removeEdges=function(t){for(var e=this.edges,i=0,s=t.length;s>i;i++){var o=t[i],n=e[o];n&&(null!=n.via&&delete this.sectors.support.nodes[n.via.id],n.disconnect(),delete e[o])}this.moving=!0,this._updateValueRange(e),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes()},Network.prototype._reconnectEdges=function(){var t,e=this.nodes,i=this.edges;for(t in e)e.hasOwnProperty(t)&&(e[t].edges=[]);for(t in i)if(i.hasOwnProperty(t)){var s=i[t];s.from=null,s.to=null,s.connect()}},Network.prototype._updateValueRange=function(t){var e,i=void 0,s=void 0;for(e in t)if(t.hasOwnProperty(e)){var o=t[e].getValue();void 0!==o&&(i=void 0===i?o:Math.min(o,i),s=void 0===s?o:Math.max(o,s))}if(void 0!==i&&void 0!==s)for(e in t)t.hasOwnProperty(e)&&t[e].setValueRange(i,s)},Network.prototype.redraw=function(){this.setSize(this.width,this.height),this._redraw()},Network.prototype._redraw=function(){var t=this.frame.canvas.getContext("2d"),e=this.frame.canvas.width,i=this.frame.canvas.height;t.clearRect(0,0,e,i),t.save(),t.translate(this.translation.x,this.translation.y),t.scale(this.scale,this.scale),this.canvasTopLeft={x:this._XconvertDOMtoCanvas(0),y:this._YconvertDOMtoCanvas(0)},this.canvasBottomRight={x:this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),y:this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)},this._doInAllSectors("_drawAllSectorNodes",t),this._doInAllSectors("_drawEdges",t),this._doInAllSectors("_drawNodes",t,!1),this._doInAllSectors("_drawControlNodes",t),t.restore()},Network.prototype._setTranslation=function(t,e){void 0===this.translation&&(this.translation={x:0,y:0}),void 0!==t&&(this.translation.x=t),void 0!==e&&(this.translation.y=e),this.emit("viewChanged")},Network.prototype._getTranslation=function(){return{x:this.translation.x,y:this.translation.y}},Network.prototype._setScale=function(t){this.scale=t},Network.prototype._getScale=function(){return this.scale},Network.prototype._XconvertDOMtoCanvas=function(t){return(t-this.translation.x)/this.scale},Network.prototype._XconvertCanvasToDOM=function(t){return t*this.scale+this.translation.x},Network.prototype._YconvertDOMtoCanvas=function(t){return(t-this.translation.y)/this.scale},Network.prototype._YconvertCanvasToDOM=function(t){return t*this.scale+this.translation.y},Network.prototype.canvasToDOM=function(t){return{x:this._XconvertCanvasToDOM(t.x),y:this._YconvertCanvasToDOM(t.y)}},Network.prototype.DOMtoCanvas=function(t){return{x:this._XconvertDOMtoCanvas(t.x),y:this._YconvertDOMtoCanvas(t.y)}},Network.prototype._drawNodes=function(t,e){void 0===e&&(e=!1);var i=this.nodes,s=[];for(var o in i)i.hasOwnProperty(o)&&(i[o].setScaleAndPos(this.scale,this.canvasTopLeft,this.canvasBottomRight),i[o].isSelected()?s.push(o):(i[o].inArea()||e)&&i[o].draw(t));for(var n=0,r=s.length;r>n;n++)(i[s[n]].inArea()||e)&&i[s[n]].draw(t)},Network.prototype._drawEdges=function(t){var e=this.edges;for(var i in e)if(e.hasOwnProperty(i)){var s=e[i];s.setScale(this.scale),s.connected&&e[i].draw(t)}},Network.prototype._drawControlNodes=function(t){var e=this.edges;for(var i in e)e.hasOwnProperty(i)&&e[i]._drawControlNodes(t)},Network.prototype._stabilize=function(){1==this.constants.freezeForStabilization&&this._freezeDefinedNodes();for(var t=0;this.moving&&t0)for(t in i)i.hasOwnProperty(t)&&(i[t].discreteStepLimited(e,this.constants.maxVelocity),s=!0);else for(t in i)i.hasOwnProperty(t)&&(i[t].discreteStep(e),s=!0);if(1==s){var o=this.constants.minVelocity/Math.max(this.scale,.05);this.moving=o>.5*this.constants.maxVelocity?!0:this._isMoving(o)}},Network.prototype._physicsTick=function(){this.freezeSimulation||this.moving&&(this._doInAllActiveSectors("_initializeForceCalculation"),this._doInAllActiveSectors("_discreteStepNodes"),this.constants.smoothCurves&&this._doInSupportSector("_discreteStepNodes"),this._findCenter(this._getRange()))},Network.prototype._animationStep=function(){this.timer=void 0,this._handleNavigation(),this.start();var t=Date.now(),e=1;this._physicsTick();for(var i=Date.now()-t;i<.9*(this.renderTimestep-this.renderTime)&&e.5*Math.PI&&(this.armRotation.vertical=.5*Math.PI)),(void 0!==t||void 0!==e)&&this.calculateCameraOrientation()},Graph3d.Camera.prototype.getArmRotation=function(){var t={};return t.horizontal=this.armRotation.horizontal,t.vertical=this.armRotation.vertical,t},Graph3d.Camera.prototype.setArmLength=function(t){void 0!==t&&(this.armLength=t,this.armLength<.71&&(this.armLength=.71),this.armLength>5&&(this.armLength=5),this.calculateCameraOrientation())},Graph3d.Camera.prototype.getArmLength=function(){return this.armLength},Graph3d.Camera.prototype.getCameraLocation=function(){return this.cameraLocation},Graph3d.Camera.prototype.getCameraRotation=function(){return this.cameraRotation},Graph3d.Camera.prototype.calculateCameraOrientation=function(){this.cameraLocation.x=this.armLocation.x-this.armLength*Math.sin(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.y=this.armLocation.y-this.armLength*Math.cos(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.z=this.armLocation.z+this.armLength*Math.sin(this.armRotation.vertical),this.cameraRotation.x=Math.PI/2-this.armRotation.vertical,this.cameraRotation.y=0,this.cameraRotation.z=-this.armRotation.horizontal},Graph3d.prototype._setScale=function(){this.scale=new Point3d(1/(this.xMax-this.xMin),1/(this.yMax-this.yMin),1/(this.zMax-this.zMin)),this.keepAspectRatio&&(this.scale.x3&&(this.colFilter=3);else{if(this.style!==Graph3d.STYLE.DOTCOLOR&&this.style!==Graph3d.STYLE.DOTSIZE&&this.style!==Graph3d.STYLE.BARCOLOR&&this.style!==Graph3d.STYLE.BARSIZE)throw'Unknown style "'+this.style+'"';this.colX=0,this.colY=1,this.colZ=2,this.colValue=3,t.getNumberOfColumns()>4&&(this.colFilter=4)}},Graph3d.prototype.getNumberOfRows=function(t){return t.length},Graph3d.prototype.getNumberOfColumns=function(t){var e=0;for(var i in t[0])t[0].hasOwnProperty(i)&&e++;return e},Graph3d.prototype.getDistinctValues=function(t,e){for(var i=[],s=0;st[s][e]&&(i.min=t[s][e]),i.maxt;t++){var u=(t-c)/(p-c),m=240*u,g=this._hsv2rgb(m,1,1);l.strokeStyle=g,l.beginPath(),l.moveTo(a,n+t),l.lineTo(r,n+t),l.stroke()}l.strokeStyle=this.colorAxis,l.strokeRect(a,n,i,o)}if(this.style===Graph3d.STYLE.DOTSIZE&&(l.strokeStyle=this.colorAxis,l.fillStyle=this.colorDot,l.beginPath(),l.moveTo(a,n),l.lineTo(r,n),l.lineTo(r-i+e,h),l.lineTo(a,h),l.closePath(),l.fill(),l.stroke()),this.style===Graph3d.STYLE.DOTCOLOR||this.style===Graph3d.STYLE.DOTSIZE){var f=5,v=new StepNumber(this.valueMin,this.valueMax,(this.valueMax-this.valueMin)/5,!0);for(v.start(),v.getCurrent()0?this.yMin:this.yMax,o=this._convert3Dto2D(new Point3d(b,r,this.zMin)),Math.cos(2*y)>0?(m.textAlign="center",m.textBaseline="top",o.y+=v):Math.sin(2*y)<0?(m.textAlign="right",m.textBaseline="middle"):(m.textAlign="left",m.textBaseline="middle"),m.fillStyle=this.colorAxis,m.fillText(" "+i.getCurrent()+" ",o.x,o.y),i.next()}for(m.lineWidth=1,s=void 0===this.defaultYStep,i=new StepNumber(this.yMin,this.yMax,this.yStep,s),i.start(),i.getCurrent()0?this.xMin:this.xMax,o=this._convert3Dto2D(new Point3d(n,i.getCurrent(),this.zMin)),Math.cos(2*y)<0?(m.textAlign="center",m.textBaseline="top",o.y+=v):Math.sin(2*y)>0?(m.textAlign="right",m.textBaseline="middle"):(m.textAlign="left",m.textBaseline="middle"),m.fillStyle=this.colorAxis,m.fillText(" "+i.getCurrent()+" ",o.x,o.y),i.next();for(m.lineWidth=1,s=void 0===this.defaultZStep,i=new StepNumber(this.zMin,this.zMax,this.zStep,s),i.start(),i.getCurrent()0?this.xMin:this.xMax,r=Math.sin(y)<0?this.yMin:this.yMax;!i.end();)t=this._convert3Dto2D(new Point3d(n,r,i.getCurrent())),m.strokeStyle=this.colorAxis,m.beginPath(),m.moveTo(t.x,t.y),m.lineTo(t.x-v,t.y),m.stroke(),m.textAlign="right",m.textBaseline="middle",m.fillStyle=this.colorAxis,m.fillText(i.getCurrent()+" ",t.x-5,t.y),i.next();m.lineWidth=1,t=this._convert3Dto2D(new Point3d(n,r,this.zMin)),e=this._convert3Dto2D(new Point3d(n,r,this.zMax)),m.strokeStyle=this.colorAxis,m.beginPath(),m.moveTo(t.x,t.y),m.lineTo(e.x,e.y),m.stroke(),m.lineWidth=1,c=this._convert3Dto2D(new Point3d(this.xMin,this.yMin,this.zMin)),p=this._convert3Dto2D(new Point3d(this.xMax,this.yMin,this.zMin)),m.strokeStyle=this.colorAxis,m.beginPath(),m.moveTo(c.x,c.y),m.lineTo(p.x,p.y),m.stroke(),c=this._convert3Dto2D(new Point3d(this.xMin,this.yMax,this.zMin)),p=this._convert3Dto2D(new Point3d(this.xMax,this.yMax,this.zMin)),m.strokeStyle=this.colorAxis,m.beginPath(),m.moveTo(c.x,c.y),m.lineTo(p.x,p.y),m.stroke(),m.lineWidth=1,t=this._convert3Dto2D(new Point3d(this.xMin,this.yMin,this.zMin)),e=this._convert3Dto2D(new Point3d(this.xMin,this.yMax,this.zMin)),m.strokeStyle=this.colorAxis,m.beginPath(),m.moveTo(t.x,t.y),m.lineTo(e.x,e.y),m.stroke(),t=this._convert3Dto2D(new Point3d(this.xMax,this.yMin,this.zMin)),e=this._convert3Dto2D(new Point3d(this.xMax,this.yMax,this.zMin)),m.strokeStyle=this.colorAxis,m.beginPath(),m.moveTo(t.x,t.y),m.lineTo(e.x,e.y),m.stroke();var _=this.xLabel;_.length>0&&(l=.1/this.scale.y,n=(this.xMin+this.xMax)/2,r=Math.cos(y)>0?this.yMin-l:this.yMax+l,o=this._convert3Dto2D(new Point3d(n,r,this.zMin)),Math.cos(2*y)>0?(m.textAlign="center",m.textBaseline="top"):Math.sin(2*y)<0?(m.textAlign="right",m.textBaseline="middle"):(m.textAlign="left",m.textBaseline="middle"),m.fillStyle=this.colorAxis,m.fillText(_,o.x,o.y));var w=this.yLabel;w.length>0&&(d=.1/this.scale.x,n=Math.sin(y)>0?this.xMin-d:this.xMax+d,r=(this.yMin+this.yMax)/2,o=this._convert3Dto2D(new Point3d(n,r,this.zMin)),Math.cos(2*y)<0?(m.textAlign="center",m.textBaseline="top"):Math.sin(2*y)>0?(m.textAlign="right",m.textBaseline="middle"):(m.textAlign="left",m.textBaseline="middle"),m.fillStyle=this.colorAxis,m.fillText(w,o.x,o.y));var x=this.zLabel;x.length>0&&(h=30,n=Math.cos(y)>0?this.xMin:this.xMax,r=Math.sin(y)<0?this.yMin:this.yMax,a=(this.zMin+this.zMax)/2,o=this._convert3Dto2D(new Point3d(n,r,a)),m.textAlign="right",m.textBaseline="middle",m.fillStyle=this.colorAxis,m.fillText(x,o.x-h,o.y))},Graph3d.prototype._hsv2rgb=function(t,e,i){var s,o,n,r,a,h;switch(r=i*e,a=Math.floor(t/60),h=r*(1-Math.abs(t/60%2-1)),a){case 0:s=r,o=h,n=0;break;case 1:s=h,o=r,n=0;break;case 2:s=0,o=r,n=h;break;case 3:s=0,o=h,n=r;break;case 4:s=h,o=0,n=r;break;case 5:s=r,o=0,n=h;break;default:s=0,o=0,n=0}return"RGB("+parseInt(255*s)+","+parseInt(255*o)+","+parseInt(255*n)+")"},Graph3d.prototype._redrawDataGrid=function(){var t,e,i,s,o,n,r,a,h,d,l,c,p,u=this.frame.canvas,m=u.getContext("2d");if(!(void 0===this.dataPoints||this.dataPoints.length<=0)){for(o=0;o0}else n=!0;n?(p=(t.point.z+e.point.z+i.point.z+s.point.z)/4,d=240*(1-(p-this.zMin)*this.scale.z/this.verticalRatio),l=1,this.showShadow?(c=Math.min(1+w.x/x/2,1),r=this._hsv2rgb(d,l,c),a=r):(c=1,r=this._hsv2rgb(d,l,c),a=this.colorAxis)):(r="gray",a=this.colorAxis),h=.5,m.lineWidth=h,m.fillStyle=r,m.strokeStyle=a,m.beginPath(),m.moveTo(t.screen.x,t.screen.y),m.lineTo(e.screen.x,e.screen.y),m.lineTo(s.screen.x,s.screen.y),m.lineTo(i.screen.x,i.screen.y),m.closePath(),m.fill(),m.stroke()}}else for(o=0;oc&&(c=0);var p,u,m;this.style===Graph3d.STYLE.DOTCOLOR?(p=240*(1-(h.point.value-this.valueMin)*this.scale.value),u=this._hsv2rgb(p,1,1),m=this._hsv2rgb(p,1,.8)):this.style===Graph3d.STYLE.DOTSIZE?(u=this.colorDot,m=this.colorDotBorder):(p=240*(1-(h.point.z-this.zMin)*this.scale.z/this.verticalRatio),u=this._hsv2rgb(p,1,1),m=this._hsv2rgb(p,1,.8)),i.lineWidth=1,i.strokeStyle=m,i.fillStyle=u,i.beginPath(),i.arc(h.screen.x,h.screen.y,c,0,2*Math.PI,!0),i.fill(),i.stroke()}}},Graph3d.prototype._redrawDataBar=function(){var t,e,i,s,o=this.frame.canvas,n=o.getContext("2d");if(!(void 0===this.dataPoints||this.dataPoints.length<=0)){for(t=0;t0&&(t=this.dataPoints[0],s.lineWidth=1,s.strokeStyle="blue",s.beginPath(),s.moveTo(t.screen.x,t.screen.y)),e=1;e0&&s.stroke()}},Graph3d.prototype._onMouseDown=function(t){if(t=t||window.event,this.leftButtonDown&&this._onMouseUp(t),this.leftButtonDown=t.which?1===t.which:1===t.button,this.leftButtonDown||this.touchDown){this.startMouseX=getMouseX(t),this.startMouseY=getMouseY(t),this.startStart=new Date(this.start),this.startEnd=new Date(this.end),this.startArmRotation=this.camera.getArmRotation(),this.frame.style.cursor="move";var e=this;this.onmousemove=function(t){e._onMouseMove(t)},this.onmouseup=function(t){e._onMouseUp(t)},G3DaddEventListener(document,"mousemove",e.onmousemove),G3DaddEventListener(document,"mouseup",e.onmouseup),G3DpreventDefault(t)}},Graph3d.prototype._onMouseMove=function(t){t=t||window.event;var e=parseFloat(getMouseX(t))-this.startMouseX,i=parseFloat(getMouseY(t))-this.startMouseY,s=this.startArmRotation.horizontal+e/200,o=this.startArmRotation.vertical+i/200,n=4,r=Math.sin(n/360*2*Math.PI);Math.abs(Math.sin(s))0?1:0>t?-1:0}var s=e[0],o=e[1],n=e[2],r=i((o.x-s.x)*(t.y-s.y)-(o.y-s.y)*(t.x-s.x)),a=i((n.x-o.x)*(t.y-o.y)-(n.y-o.y)*(t.x-o.x)),h=i((s.x-n.x)*(t.y-n.y)-(s.y-n.y)*(t.x-n.x));return!(0!=r&&0!=a&&r!=a||0!=a&&0!=h&&a!=h||0!=r&&0!=h&&r!=h)},Graph3d.prototype._dataPointFromXY=function(t,e){var i,s=100,o=null,n=null,r=null,a=new Point2d(t,e);if(this.style===Graph3d.STYLE.BAR||this.style===Graph3d.STYLE.BARCOLOR||this.style===Graph3d.STYLE.BARSIZE)for(i=this.dataPoints.length-1;i>=0;i--){o=this.dataPoints[i];var h=o.surfaces;if(h)for(var d=h.length-1;d>=0;d--){var l=h[d],c=l.corners,p=[c[0].screen,c[1].screen,c[2].screen],u=[c[2].screen,c[3].screen,c[0].screen];if(this._insideTriangle(a,p)||this._insideTriangle(a,u))return o}}else for(i=0;iv)&&s>v&&(r=v,n=o)}}return n},Graph3d.prototype._showTooltip=function(t){var e,i,s;this.tooltip?(e=this.tooltip.dom.content,i=this.tooltip.dom.line,s=this.tooltip.dom.dot):(e=document.createElement("div"),e.style.position="absolute",e.style.padding="10px",e.style.border="1px solid #4d4d4d",e.style.color="#1a1a1a",e.style.background="rgba(255,255,255,0.7)",e.style.borderRadius="2px",e.style.boxShadow="5px 5px 10px rgba(128,128,128,0.5)",i=document.createElement("div"),i.style.position="absolute",i.style.height="40px",i.style.width="0",i.style.borderLeft="1px solid #4d4d4d",s=document.createElement("div"),s.style.position="absolute",s.style.height="0",s.style.width="0",s.style.border="5px solid #4d4d4d",s.style.borderRadius="5px",this.tooltip={dataPoint:null,dom:{content:e,line:i,dot:s}}),this._hideTooltip(),this.tooltip.dataPoint=t,e.innerHTML="function"==typeof this.showTooltip?this.showTooltip(t.point):"
x:"+t.point.x+"
y:"+t.point.y+"
z:"+t.point.z+"
",e.style.left="0",e.style.top="0",this.frame.appendChild(e),this.frame.appendChild(i),this.frame.appendChild(s);var o=e.offsetWidth,n=e.offsetHeight,r=i.offsetHeight,a=s.offsetWidth,h=s.offsetHeight,d=t.screen.x-o/2;d=Math.min(Math.max(d,10),this.frame.clientWidth-10-o),i.style.left=t.screen.x+"px",i.style.top=t.screen.y-r+"px",e.style.left=d+"px",e.style.top=t.screen.y-r-n+"px",s.style.left=t.screen.x-a/2+"px",s.style.top=t.screen.y-h/2+"px"},Graph3d.prototype._hideTooltip=function(){if(this.tooltip){this.tooltip.dataPoint=null;for(var t in this.tooltip.dom)if(this.tooltip.dom.hasOwnProperty(t)){var e=this.tooltip.dom[t];e&&e.parentNode&&e.parentNode.removeChild(e)}}},G3DaddEventListener=function(t,e,i,s){t.addEventListener?(void 0===s&&(s=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,s)):t.attachEvent("on"+e,i)},G3DremoveEventListener=function(t,e,i,s){t.removeEventListener?(void 0===s&&(s=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,s)):t.detachEvent("on"+e,i)},G3DstopPropagation=function(t){t||(t=window.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},G3DpreventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},Point3d.subtract=function(t,e){var i=new Point3d;return i.x=t.x-e.x,i.y=t.y-e.y,i.z=t.z-e.z,i},Point3d.add=function(t,e){var i=new Point3d;return i.x=t.x+e.x,i.y=t.y+e.y,i.z=t.z+e.z,i},Point3d.avg=function(t,e){return new Point3d((t.x+e.x)/2,(t.y+e.y)/2,(t.z+e.z)/2)},Point3d.crossProduct=function(t,e){var i=new Point3d;return i.x=t.y*e.z-t.z*e.y,i.y=t.z*e.x-t.x*e.z,i.z=t.x*e.y-t.y*e.x,i},Point3d.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},Point2d=function(t,e){this.x=void 0!==t?t:0,this.y=void 0!==e?e:0},Filter.prototype.isLoaded=function(){return this.loaded},Filter.prototype.getLoadedProgress=function(){for(var t=this.values.length,e=0;this.dataPoints[e];)e++;return Math.round(e/t*100)},Filter.prototype.getLabel=function(){return this.graph.filterLabel},Filter.prototype.getColumn=function(){return this.column},Filter.prototype.getSelectedValue=function(){return void 0===this.index?void 0:this.values[this.index]},Filter.prototype.getValues=function(){return this.values},Filter.prototype.getValue=function(t){if(t>=this.values.length)throw"Error: index out of range";return this.values[t]},Filter.prototype._getDataPoints=function(t){if(void 0===t&&(t=this.index),void 0===t)return[];var e;if(this.dataPoints[t])e=this.dataPoints[t];else{var i={};i.column=this.column,i.value=this.values[t];var s=new DataView(this.data,{filter:function(t){return t[i.column]==i.value}}).get();e=this.graph._getDataPoints(s),this.dataPoints[t]=e}return e},Filter.prototype.setOnLoadCallback=function(t){this.onLoadCallback=t},Filter.prototype.selectValue=function(t){if(t>=this.values.length)throw"Error: index out of range";this.index=t,this.value=this.values[t]},Filter.prototype.loadInBackground=function(t){void 0===t&&(t=0);var e=this.graph.frame;if(t=t||(void 0!==e&&(this.prettyStep=e),this._step=this.prettyStep===!0?StepNumber.calculatePrettyStep(t):t)},StepNumber.calculatePrettyStep=function(t){var e=function(t){return Math.log(t)/Math.LN10},i=Math.pow(10,Math.round(e(t))),s=2*Math.pow(10,Math.round(e(t/2))),o=5*Math.pow(10,Math.round(e(t/5))),n=i;return Math.abs(s-t)<=Math.abs(n-t)&&(n=s),Math.abs(o-t)<=Math.abs(n-t)&&(n=o),0>=n&&(n=1),n},StepNumber.prototype.getCurrent=function(){return parseFloat(this._current.toPrecision(this.precision))},StepNumber.prototype.getStep=function(){return this._step},StepNumber.prototype.start=function(){this._current=this._start-this._start%this._step},StepNumber.prototype.next=function(){this._current+=this._step},StepNumber.prototype.end=function(){return this._current>this._end},Slider.prototype.prev=function(){var t=this.getIndex();t>0&&(t--,this.setIndex(t))},Slider.prototype.next=function(){var t=this.getIndex();t0?this.setIndex(0):this.index=void 0},Slider.prototype.setIndex=function(t){if(!(ts&&(s=0),s>this.values.length-1&&(s=this.values.length-1),s},Slider.prototype.indexToLeft=function(t){var e=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10,i=t/(this.values.length-1)*e,s=i+3;return s},Slider.prototype._onMouseMove=function(t){var e=t.clientX-this.startClientX,i=this.startSlideX+e,s=this.leftToIndex(i);this.setIndex(s),G3DpreventDefault()},Slider.prototype._onMouseUp=function(){this.frame.style.cursor="auto",G3DremoveEventListener(document,"mousemove",this.onmousemove),G3DremoveEventListener(document,"mouseup",this.onmouseup),G3DpreventDefault()},getAbsoluteLeft=function(t){for(var e=0;null!==t;)e+=t.offsetLeft,e-=t.scrollLeft,t=t.offsetParent;return e},getAbsoluteTop=function(t){for(var e=0;null!==t;)e+=t.offsetTop,e-=t.scrollTop,t=t.offsetParent;return e},getMouseX=function(t){return"clientX"in t?t.clientX:t.targetTouches[0]&&t.targetTouches[0].clientX||0},getMouseY=function(t){return"clientY"in t?t.clientY:t.targetTouches[0]&&t.targetTouches[0].clientY||0};var vis={moment:moment,util:util,DOMutil:DOMutil,DataSet:DataSet,DataView:DataView,Timeline:Timeline,Graph2d:Graph2d,timeline:{DataStep:DataStep,Range:Range,stack:stack,TimeStep:TimeStep,components:{items:{Item:Item,ItemBox:ItemBox,ItemPoint:ItemPoint,ItemRange:ItemRange},Component:Component,CurrentTime:CurrentTime,CustomTime:CustomTime,DataAxis:DataAxis,GraphGroup:GraphGroup,Group:Group,ItemSet:ItemSet,Legend:Legend,LineGraph:LineGraph,TimeAxis:TimeAxis}},Network:Network,network:{Edge:Edge,Groups:Groups,Images:Images,Node:Node,Popup:Popup},Graph:function(){throw new Error("Graph is renamed to Network. Please create a graph as new vis.Network(...)")},Graph3d:Graph3d};"undefined"!=typeof exports&&(exports=vis),"undefined"!=typeof module&&"undefined"!=typeof module.exports&&(module.exports=vis),"function"==typeof define&&define(function(){return vis}),"undefined"!=typeof window&&(window.vis=vis)},{"emitter-component":2,hammerjs:3,moment:4,mousetrap:5}],2:[function(t,e){function i(t){return t?s(t):void 0}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}e.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},i.prototype.once=function(t,e){function i(){s.off(t,i),e.apply(this,arguments)}var s=this;return this._callbacks=this._callbacks||{},i.fn=e,this.on(t,i),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks[t];if(!i)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var s,o=0;os;++s)i[s].apply(this,e)}return this},i.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},i.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],3:[function(t,e){!function(t,i){"use strict";function s(){if(!o.READY){o.event.determineEventTypes();for(var t in o.gestures)o.gestures.hasOwnProperty(t)&&o.detection.register(o.gestures[t]);o.event.onTouch(o.DOCUMENT,o.EVENT_MOVE,o.detection.detect),o.event.onTouch(o.DOCUMENT,o.EVENT_END,o.detection.detect),o.READY=!0}}var o=function(t,e){return new o.Instance(t,e||{})};o.defaults={stop_browser_behavior:{userSelect:"none",touchAction:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},o.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,o.HAS_TOUCHEVENTS="ontouchstart"in t,o.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android/i,o.NO_MOUSEEVENTS=o.HAS_TOUCHEVENTS&&navigator.userAgent.match(o.MOBILE_REGEX),o.EVENT_TYPES={},o.DIRECTION_DOWN="down",o.DIRECTION_LEFT="left",o.DIRECTION_UP="up",o.DIRECTION_RIGHT="right",o.POINTER_MOUSE="mouse",o.POINTER_TOUCH="touch",o.POINTER_PEN="pen",o.EVENT_START="start",o.EVENT_MOVE="move",o.EVENT_END="end",o.DOCUMENT=document,o.plugins={},o.READY=!1,o.Instance=function(t,e){var i=this;return s(),this.element=t,this.enabled=!0,this.options=o.utils.extend(o.utils.extend({},o.defaults),e||{}),this.options.stop_browser_behavior&&o.utils.stopDefaultBrowserBehavior(this.element,this.options.stop_browser_behavior),o.event.onTouch(t,o.EVENT_START,function(t){i.enabled&&o.detection.startDetect(i,t)}),this},o.Instance.prototype={on:function(t,e){for(var i=t.split(" "),s=0;s0&&e==o.EVENT_END?e=o.EVENT_MOVE:l||(e=o.EVENT_END),l||null===n?n=h:h=n,i.call(o.detection,s.collectEventData(t,e,h)),o.HAS_POINTEREVENTS&&e==o.EVENT_END&&(l=o.PointerEvent.updatePointer(e,h))),l||(n=null,r=!1,a=!1,o.PointerEvent.reset())}})},determineEventTypes:function(){var t;t=o.HAS_POINTEREVENTS?o.PointerEvent.getEvents():o.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],o.EVENT_TYPES[o.EVENT_START]=t[0],o.EVENT_TYPES[o.EVENT_MOVE]=t[1],o.EVENT_TYPES[o.EVENT_END]=t[2]},getTouchList:function(t){return o.HAS_POINTEREVENTS?o.PointerEvent.getTouchList():t.touches?t.touches:[{identifier:1,pageX:t.pageX,pageY:t.pageY,target:t.target}]},collectEventData:function(t,e,i){var s=this.getTouchList(i,e),n=o.POINTER_TOUCH;return(i.type.match(/mouse/)||o.PointerEvent.matchType(o.POINTER_MOUSE,i))&&(n=o.POINTER_MOUSE),{center:o.utils.getCenter(s),timeStamp:(new Date).getTime(),target:i.target,touches:s,eventType:e,pointerType:n,srcEvent:i,preventDefault:function(){this.srcEvent.preventManipulation&&this.srcEvent.preventManipulation(),this.srcEvent.preventDefault&&this.srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return o.detection.stopDetect()}}}},o.PointerEvent={pointers:{},getTouchList:function(){var t=this,e=[];return Object.keys(t.pointers).sort().forEach(function(i){e.push(t.pointers[i])}),e},updatePointer:function(t,e){return t==o.EVENT_END?this.pointers={}:(e.identifier=e.pointerId,this.pointers[e.pointerId]=e),Object.keys(this.pointers).length},matchType:function(t,e){if(!e.pointerType)return!1;var i={};return i[o.POINTER_MOUSE]=e.pointerType==e.MSPOINTER_TYPE_MOUSE||e.pointerType==o.POINTER_MOUSE,i[o.POINTER_TOUCH]=e.pointerType==e.MSPOINTER_TYPE_TOUCH||e.pointerType==o.POINTER_TOUCH,i[o.POINTER_PEN]=e.pointerType==e.MSPOINTER_TYPE_PEN||e.pointerType==o.POINTER_PEN,i[t]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},o.utils={extend:function(t,e,s){for(var o in e)t[o]!==i&&s||(t[o]=e[o]);return t},hasParent:function(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1},getCenter:function(t){for(var e=[],i=[],s=0,o=t.length;o>s;s++)e.push(t[s].pageX),i.push(t[s].pageY);return{pageX:(Math.min.apply(Math,e)+Math.max.apply(Math,e))/2,pageY:(Math.min.apply(Math,i)+Math.max.apply(Math,i))/2}},getVelocity:function(t,e,i){return{x:Math.abs(e/t)||0,y:Math.abs(i/t)||0}},getAngle:function(t,e){var i=e.pageY-t.pageY,s=e.pageX-t.pageX;return 180*Math.atan2(i,s)/Math.PI},getDirection:function(t,e){var i=Math.abs(t.pageX-e.pageX),s=Math.abs(t.pageY-e.pageY);return i>=s?t.pageX-e.pageX>0?o.DIRECTION_LEFT:o.DIRECTION_RIGHT:t.pageY-e.pageY>0?o.DIRECTION_UP:o.DIRECTION_DOWN},getDistance:function(t,e){var i=e.pageX-t.pageX,s=e.pageY-t.pageY;return Math.sqrt(i*i+s*s)},getScale:function(t,e){return t.length>=2&&e.length>=2?this.getDistance(e[0],e[1])/this.getDistance(t[0],t[1]):1},getRotation:function(t,e){return t.length>=2&&e.length>=2?this.getAngle(e[1],e[0])-this.getAngle(t[1],t[0]):0},isVertical:function(t){return t==o.DIRECTION_UP||t==o.DIRECTION_DOWN},stopDefaultBrowserBehavior:function(t,e){var i,s=["webkit","khtml","moz","ms","o",""];if(e&&t.style){for(var o=0;oi;i++){var n=this.gestures[i];if(!this.stopped&&e[n.name]!==!1&&n.handler.call(n,t,this.current.inst)===!1){this.stopDetect();break}}return this.current&&(this.current.lastEvent=t),t.eventType==o.EVENT_END&&!t.touches.length-1&&this.stopDetect(),t}},stopDetect:function(){this.previous=o.utils.extend({},this.current),this.current=null,this.stopped=!0},extendEventData:function(t){var e=this.current.startEvent;if(e&&(t.touches.length!=e.touches.length||t.touches===e.touches)){e.touches=[];for(var i=0,s=t.touches.length;s>i;i++)e.touches.push(o.utils.extend({},t.touches[i]))}var n=t.timeStamp-e.timeStamp,r=t.center.pageX-e.center.pageX,a=t.center.pageY-e.center.pageY,h=o.utils.getVelocity(n,r,a);return o.utils.extend(t,{deltaTime:n,deltaX:r,deltaY:a,velocityX:h.x,velocityY:h.y,distance:o.utils.getDistance(e.center,t.center),angle:o.utils.getAngle(e.center,t.center),direction:o.utils.getDirection(e.center,t.center),scale:o.utils.getScale(e.touches,t.touches),rotation:o.utils.getRotation(e.touches,t.touches),startEvent:e}),t},register:function(t){var e=t.defaults||{};return e[t.name]===i&&(e[t.name]=!0),o.utils.extend(o.defaults,e,!0),t.index=t.index||1e3,this.gestures.push(t),this.gestures.sort(function(t,e){return t.indexe.index?1:0}),this.gestures}},o.gestures=o.gestures||{},o.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:1},timer:null,handler:function(t,e){switch(t.eventType){case o.EVENT_START:clearTimeout(this.timer),o.detection.current.name=this.name,this.timer=setTimeout(function(){"hold"==o.detection.current.name&&e.trigger("hold",t)},e.options.hold_timeout);break;case o.EVENT_MOVE:t.distance>e.options.hold_threshold&&clearTimeout(this.timer);break;case o.EVENT_END:clearTimeout(this.timer)}}},o.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},handler:function(t,e){if(t.eventType==o.EVENT_END){var i=o.detection.previous,s=!1;if(t.deltaTime>e.options.tap_max_touchtime||t.distance>e.options.tap_max_distance)return;i&&"tap"==i.name&&t.timeStamp-i.lastEvent.timeStamp0&&t.touches.length>e.options.swipe_max_touches)return;(t.velocityX>e.options.swipe_velocity||t.velocityY>e.options.swipe_velocity)&&(e.trigger(this.name,t),e.trigger(this.name+t.direction,t))}}},o.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1,drag_lock_min_distance:25},triggered:!1,handler:function(t,e){if(o.detection.current.name!=this.name&&this.triggered)return e.trigger(this.name+"end",t),void(this.triggered=!1);if(!(e.options.drag_max_touches>0&&t.touches.length>e.options.drag_max_touches))switch(t.eventType){case o.EVENT_START:this.triggered=!1;break;case o.EVENT_MOVE:if(t.distancee.options.transform_min_rotation&&e.trigger("rotate",t),i>e.options.transform_min_scale&&(e.trigger("pinch",t),e.trigger("pinch"+(t.scale<1?"in":"out"),t));break;case o.EVENT_END:this.triggered&&e.trigger(this.name+"end",t),this.triggered=!1}}},o.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(t,e){return e.options.prevent_mouseevents&&t.pointerType==o.POINTER_MOUSE?void t.stopDetect():(e.options.prevent_default&&t.preventDefault(),void(t.eventType==o.EVENT_START&&e.trigger(this.name,t)))}},o.gestures.Release={name:"release",index:1/0,handler:function(t,e){t.eventType==o.EVENT_END&&e.trigger(this.name,t)}},"object"==typeof e&&"object"==typeof e.exports?e.exports=o:(t.Hammer=o,"function"==typeof t.define&&t.define.amd&&t.define("hammer",[],function(){return o}))}(this)},{}],4:[function(t,e){var i="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};(function(s){function o(t,e,i){switch(arguments.length){case 2:return null!=t?t:e;case 3:return null!=t?t:null!=e?e:i;default:throw new Error("Implement me")}}function n(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function r(t,e){function i(){ge.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}var s=!0;return p(function(){return s&&(i(),s=!1),e.apply(this,arguments)},e)}function a(t,e){return function(i){return g(t.call(this,i),e)}}function h(t,e){return function(i){return this.lang().ordinal(t.call(this,i),e)}}function d(){}function l(t){C(t),p(this,t)}function c(t){var e=w(t),i=e.year||0,s=e.quarter||0,o=e.month||0,n=e.week||0,r=e.day||0,a=e.hour||0,h=e.minute||0,d=e.second||0,l=e.millisecond||0;this._milliseconds=+l+1e3*d+6e4*h+36e5*a,this._days=+r+7*n,this._months=+o+3*s+12*i,this._data={},this._bubble()}function p(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return e.hasOwnProperty("toString")&&(t.toString=e.toString),e.hasOwnProperty("valueOf")&&(t.valueOf=e.valueOf),t}function u(t){var e,i={};for(e in t)t.hasOwnProperty(e)&&Ne.hasOwnProperty(e)&&(i[e]=t[e]);return i}function m(t){return 0>t?Math.ceil(t):Math.floor(t)}function g(t,e,i){for(var s=""+Math.abs(t),o=t>=0;s.lengths;s++)(i&&t[s]!==e[s]||!i&&S(t[s])!==S(e[s]))&&r++;return r+n}function _(t){if(t){var e=t.toLowerCase().replace(/(.)s$/,"$1");t=oi[t]||ni[e]||e}return t}function w(t){var e,i,s={};for(i in t)t.hasOwnProperty(i)&&(e=_(i),e&&(s[e]=t[i]));return s}function x(t){var e,i;if(0===t.indexOf("week"))e=7,i="day";else{if(0!==t.indexOf("month"))return;e=12,i="month"}ge[t]=function(o,n){var r,a,h=ge.fn._lang[t],d=[];if("number"==typeof o&&(n=o,o=s),a=function(t){var e=ge().utc().set(i,t);return h.call(ge.fn._lang,e,o||"")},null!=n)return a(n);for(r=0;e>r;r++)d.push(a(r));return d}}function S(t){var e=+t,i=0;return 0!==e&&isFinite(e)&&(i=e>=0?Math.floor(e):Math.ceil(e)),i}function D(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function E(t,e,i){return oe(ge([t,11,31+e-i]),e,i).week}function T(t){return M(t)?366:365}function M(t){return t%4===0&&t%100!==0||t%400===0}function C(t){var e;t._a&&-2===t._pf.overflow&&(e=t._a[xe]<0||t._a[xe]>11?xe:t._a[Se]<1||t._a[Se]>D(t._a[we],t._a[xe])?Se:t._a[De]<0||t._a[De]>23?De:t._a[Ee]<0||t._a[Ee]>59?Ee:t._a[Te]<0||t._a[Te]>59?Te:t._a[Me]<0||t._a[Me]>999?Me:-1,t._pf._overflowDayOfYear&&(we>e||e>Se)&&(e=Se),t._pf.overflow=e)}function N(t){return null==t._isValid&&(t._isValid=!isNaN(t._d.getTime())&&t._pf.overflow<0&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&0===t._pf.charsLeftOver&&0===t._pf.unusedTokens.length)),t._isValid}function O(t){return t?t.toLowerCase().replace("_","-"):t}function k(t,e){return e._isUTC?ge(t).zone(e._offset||0):ge(t).local()}function L(t,e){return e.abbr=t,Ce[t]||(Ce[t]=new d),Ce[t].set(e),Ce[t]}function I(t){delete Ce[t]}function P(e){var i,s,o,n,r=0,a=function(e){if(!Ce[e]&&Oe)try{t("./lang/"+e)}catch(i){}return Ce[e]};if(!e)return ge.fn._lang;if(!v(e)){if(s=a(e))return s;e=[e]}for(;r0;){if(s=a(n.slice(0,i).join("-")))return s;if(o&&o.length>=i&&b(n,o,!0)>=i-1)break;i--}r++}return ge.fn._lang}function A(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function z(t){var e,i,s=t.match(Pe);for(e=0,i=s.length;i>e;e++)s[e]=li[s[e]]?li[s[e]]:A(s[e]);return function(o){var n=""; -for(e=0;i>e;e++)n+=s[e]instanceof Function?s[e].call(o,t):s[e];return n}}function R(t,e){return t.isValid()?(e=G(e,t.lang()),ri[e]||(ri[e]=z(e)),ri[e](t)):t.lang().invalidDate()}function G(t,e){function i(t){return e.longDateFormat(t)||t}var s=5;for(Ae.lastIndex=0;s>=0&&Ae.test(t);)t=t.replace(Ae,i),Ae.lastIndex=0,s-=1;return t}function F(t,e){var i,s=e._strict;switch(t){case"Q":return je;case"DDDD":return qe;case"YYYY":case"GGGG":case"gggg":return s?Ze:Ge;case"Y":case"G":case"g":return $e;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return s?Ke:Fe;case"S":if(s)return je;case"SS":if(s)return Xe;case"SSS":if(s)return qe;case"DDD":return Re;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ye;case"a":case"A":return P(e._l)._meridiemParse;case"X":return Ve;case"Z":case"ZZ":return Be;case"T":return We;case"SSSS":return He;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return s?Xe:ze;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return ze;case"Do":return Ue;default:return i=new RegExp(q(X(t.replace("\\","")),"i"))}}function H(t){t=t||"";var e=t.match(Be)||[],i=e[e.length-1]||[],s=(i+"").match(ii)||["-",0,0],o=+(60*s[1])+S(s[2]);return"+"===s[0]?-o:o}function Y(t,e,i){var s,o=i._a;switch(t){case"Q":null!=e&&(o[xe]=3*(S(e)-1));break;case"M":case"MM":null!=e&&(o[xe]=S(e)-1);break;case"MMM":case"MMMM":s=P(i._l).monthsParse(e),null!=s?o[xe]=s:i._pf.invalidMonth=e;break;case"D":case"DD":null!=e&&(o[Se]=S(e));break;case"Do":null!=e&&(o[Se]=S(parseInt(e,10)));break;case"DDD":case"DDDD":null!=e&&(i._dayOfYear=S(e));break;case"YY":o[we]=ge.parseTwoDigitYear(e);break;case"YYYY":case"YYYYY":case"YYYYYY":o[we]=S(e);break;case"a":case"A":i._isPm=P(i._l).isPM(e);break;case"H":case"HH":case"h":case"hh":o[De]=S(e);break;case"m":case"mm":o[Ee]=S(e);break;case"s":case"ss":o[Te]=S(e);break;case"S":case"SS":case"SSS":case"SSSS":o[Me]=S(1e3*("0."+e));break;case"X":i._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":i._useUTC=!0,i._tzm=H(e);break;case"dd":case"ddd":case"dddd":s=P(i._l).weekdaysParse(e),null!=s?(i._w=i._w||{},i._w.d=s):i._pf.invalidWeekday=e;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":t=t.substr(0,1);case"gggg":case"GGGG":case"GGGGG":t=t.substr(0,2),e&&(i._w=i._w||{},i._w[t]=S(e));break;case"gg":case"GG":i._w=i._w||{},i._w[t]=ge.parseTwoDigitYear(e)}}function B(t){var e,i,s,n,r,a,h,d;e=t._w,null!=e.GG||null!=e.W||null!=e.E?(r=1,a=4,i=o(e.GG,t._a[we],oe(ge(),1,4).year),s=o(e.W,1),n=o(e.E,1)):(d=P(t._l),r=d._week.dow,a=d._week.doy,i=o(e.gg,t._a[we],oe(ge(),r,a).year),s=o(e.w,1),null!=e.d?(n=e.d,r>n&&++s):n=null!=e.e?e.e+r:r),h=ne(i,s,n,a,r),t._a[we]=h.year,t._dayOfYear=h.dayOfYear}function W(t){var e,i,s,n,r=[];if(!t._d){for(s=U(t),t._w&&null==t._a[Se]&&null==t._a[xe]&&B(t),t._dayOfYear&&(n=o(t._a[we],s[we]),t._dayOfYear>T(n)&&(t._pf._overflowDayOfYear=!0),i=te(n,0,t._dayOfYear),t._a[xe]=i.getUTCMonth(),t._a[Se]=i.getUTCDate()),e=0;3>e&&null==t._a[e];++e)t._a[e]=r[e]=s[e];for(;7>e;e++)t._a[e]=r[e]=null==t._a[e]?2===e?1:0:t._a[e];t._d=(t._useUTC?te:Q).apply(null,r),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()+t._tzm)}}function V(t){var e;t._d||(e=w(t._i),t._a=[e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond],W(t))}function U(t){var e=new Date;return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function j(t){if(t._f===ge.ISO_8601)return void K(t);t._a=[],t._pf.empty=!0;var e,i,s,o,n,r=P(t._l),a=""+t._i,h=a.length,d=0;for(s=G(t._f,r).match(Pe)||[],e=0;e0&&t._pf.unusedInput.push(n),a=a.slice(a.indexOf(i)+i.length),d+=i.length),li[o]?(i?t._pf.empty=!1:t._pf.unusedTokens.push(o),Y(o,i,t)):t._strict&&!i&&t._pf.unusedTokens.push(o);t._pf.charsLeftOver=h-d,a.length>0&&t._pf.unusedInput.push(a),t._isPm&&t._a[De]<12&&(t._a[De]+=12),t._isPm===!1&&12===t._a[De]&&(t._a[De]=0),W(t),C(t)}function X(t){return t.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,i,s,o){return e||i||s||o})}function q(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(t){var e,i,s,o,r;if(0===t._f.length)return t._pf.invalidFormat=!0,void(t._d=new Date(0/0));for(o=0;or)&&(s=r,i=e));p(t,i||e)}function K(t){var e,i,s=t._i,o=Je.exec(s);if(o){for(t._pf.iso=!0,e=0,i=ti.length;i>e;e++)if(ti[e][1].exec(s)){t._f=ti[e][0]+(o[6]||" ");break}for(e=0,i=ei.length;i>e;e++)if(ei[e][1].exec(s)){t._f+=ei[e][0];break}s.match(Be)&&(t._f+="Z"),j(t)}else t._isValid=!1}function $(t){K(t),t._isValid===!1&&(delete t._isValid,ge.createFromInputFallback(t))}function J(t){var e=t._i,i=ke.exec(e);e===s?t._d=new Date:i?t._d=new Date(+i[1]):"string"==typeof e?$(t):v(e)?(t._a=e.slice(0),W(t)):y(e)?t._d=new Date(+e):"object"==typeof e?V(t):"number"==typeof e?t._d=new Date(e):ge.createFromInputFallback(t)}function Q(t,e,i,s,o,n,r){var a=new Date(t,e,i,s,o,n,r);return 1970>t&&a.setFullYear(t),a}function te(t){var e=new Date(Date.UTC.apply(null,arguments));return 1970>t&&e.setUTCFullYear(t),e}function ee(t,e){if("string"==typeof t)if(isNaN(t)){if(t=e.weekdaysParse(t),"number"!=typeof t)return null}else t=parseInt(t,10);return t}function ie(t,e,i,s,o){return o.relativeTime(e||1,!!i,t,s)}function se(t,e,i){var s=_e(Math.abs(t)/1e3),o=_e(s/60),n=_e(o/60),r=_e(n/24),a=_e(r/365),h=s0,h[4]=i,ie.apply({},h)}function oe(t,e,i){var s,o=i-e,n=i-t.day();return n>o&&(n-=7),o-7>n&&(n+=7),s=ge(t).add("d",n),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function ne(t,e,i,s,o){var n,r,a=te(t,0,1).getUTCDay();return a=0===a?7:a,i=null!=i?i:o,n=o-a+(a>s?7:0)-(o>a?7:0),r=7*(e-1)+(i-o)+n+1,{year:r>0?t:t-1,dayOfYear:r>0?r:T(t-1)+r}}function re(t){var e=t._i,i=t._f;return null===e||i===s&&""===e?ge.invalid({nullInput:!0}):("string"==typeof e&&(t._i=e=P().preparse(e)),ge.isMoment(e)?(t=u(e),t._d=new Date(+e._d)):i?v(i)?Z(t):j(t):J(t),new l(t))}function ae(t,e){var i,s;if(1===e.length&&v(e[0])&&(e=e[0]),!e.length)return ge();for(i=e[0],s=1;s=0?"+":"-";return e+g(Math.abs(t),6)},gg:function(){return g(this.weekYear()%100,2)},gggg:function(){return g(this.weekYear(),4)},ggggg:function(){return g(this.weekYear(),5)},GG:function(){return g(this.isoWeekYear()%100,2)},GGGG:function(){return g(this.isoWeekYear(),4)},GGGGG:function(){return g(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return S(this.milliseconds()/100)},SS:function(){return g(S(this.milliseconds()/10),2)},SSS:function(){return g(this.milliseconds(),3)},SSSS:function(){return g(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+g(S(t/60),2)+":"+g(S(t)%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+g(S(t/60),2)+g(S(t)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},ci=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];hi.length;)ve=hi.pop(),li[ve+"o"]=h(li[ve],ve);for(;di.length;)ve=di.pop(),li[ve+ve]=a(li[ve],2);for(li.DDDD=a(li.DDD,3),p(d.prototype,{set:function(t){var e,i;for(i in t)e=t[i],"function"==typeof e?this[i]=e:this["_"+i]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,i,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(i=ge.utc([2e3,e]),s="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,i,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(i=ge([2e3,1]).day(e),s="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,i){return t>11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var i=this._calendar[t];return"function"==typeof i?i.apply(e):i},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,i,s){var o=this._relativeTime[i];return"function"==typeof o?o(t,e,i,s):o.replace(/%d/i,t)},pastFuture:function(t,e){var i=this._relativeTime[t>0?"future":"past"];return"function"==typeof i?i(e):i.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return oe(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),ge=function(t,e,i,o){var r;return"boolean"==typeof i&&(o=i,i=s),r={},r._isAMomentObject=!0,r._i=t,r._f=e,r._l=i,r._strict=o,r._isUTC=!1,r._pf=n(),re(r)},ge.suppressDeprecationWarnings=!1,ge.createFromInputFallback=r("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i)}),ge.min=function(){var t=[].slice.call(arguments,0);return ae("isBefore",t)},ge.max=function(){var t=[].slice.call(arguments,0);return ae("isAfter",t)},ge.utc=function(t,e,i,o){var r;return"boolean"==typeof i&&(o=i,i=s),r={},r._isAMomentObject=!0,r._useUTC=!0,r._isUTC=!0,r._l=i,r._i=t,r._f=e,r._strict=o,r._pf=n(),re(r).utc()},ge.unix=function(t){return ge(1e3*t)},ge.duration=function(t,e){var i,s,o,n=t,r=null;return ge.isDuration(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(n={},e?n[e]=t:n.milliseconds=t):(r=Le.exec(t))?(i="-"===r[1]?-1:1,n={y:0,d:S(r[Se])*i,h:S(r[De])*i,m:S(r[Ee])*i,s:S(r[Te])*i,ms:S(r[Me])*i}):(r=Ie.exec(t))&&(i="-"===r[1]?-1:1,o=function(t){var e=t&&parseFloat(t.replace(",","."));return(isNaN(e)?0:e)*i},n={y:o(r[2]),M:o(r[3]),d:o(r[4]),h:o(r[5]),m:o(r[6]),s:o(r[7]),w:o(r[8])}),s=new c(n),ge.isDuration(t)&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},ge.version=ye,ge.defaultFormat=Qe,ge.ISO_8601=function(){},ge.momentProperties=Ne,ge.updateOffset=function(){},ge.relativeTimeThreshold=function(t,e){return ai[t]===s?!1:(ai[t]=e,!0)},ge.lang=function(t,e){var i;return t?(e?L(O(t),e):null===e?(I(t),t="en"):Ce[t]||P(t),i=ge.duration.fn._lang=ge.fn._lang=P(t),i._abbr):ge.fn._lang._abbr},ge.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),P(t)},ge.isMoment=function(t){return t instanceof l||null!=t&&t.hasOwnProperty("_isAMomentObject")},ge.isDuration=function(t){return t instanceof c},ve=ci.length-1;ve>=0;--ve)x(ci[ve]);ge.normalizeUnits=function(t){return _(t)},ge.invalid=function(t){var e=ge.utc(0/0);return null!=t?p(e._pf,t):e._pf.userInvalidated=!0,e},ge.parseZone=function(){return ge.apply(null,arguments).parseZone()},ge.parseTwoDigitYear=function(t){return S(t)+(S(t)>68?1900:2e3)},p(ge.fn=l.prototype,{clone:function(){return ge(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var t=ge(this).utc();return 00:!1},parsingFlags:function(){return p({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=R(this,t||ge.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var i;return i="string"==typeof t&&"string"==typeof e?ge.duration(isNaN(+e)?+t:+e,isNaN(+e)?e:t):"string"==typeof t?ge.duration(+e,t):ge.duration(t,e),f(this,i,1),this},subtract:function(t,e){var i;return i="string"==typeof t&&"string"==typeof e?ge.duration(isNaN(+e)?+t:+e,isNaN(+e)?e:t):"string"==typeof t?ge.duration(+e,t):ge.duration(t,e),f(this,i,-1),this},diff:function(t,e,i){var s,o,n=k(t,this),r=6e4*(this.zone()-n.zone());return e=_(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+n.daysInMonth()),o=12*(this.year()-n.year())+(this.month()-n.month()),o+=(this-ge(this).startOf("month")-(n-ge(n).startOf("month")))/s,o-=6e4*(this.zone()-ge(this).startOf("month").zone()-(n.zone()-ge(n).startOf("month").zone()))/s,"year"===e&&(o/=12)):(s=this-n,o="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-r)/864e5:"week"===e?(s-r)/6048e5:s),i?o:m(o)},from:function(t,e){return ge.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(ge(),t)},calendar:function(t){var e=t||ge(),i=k(e,this).startOf("day"),s=this.diff(i,"days",!0),o=-6>s?"sameElse":-1>s?"lastWeek":0>s?"lastDay":1>s?"sameDay":2>s?"nextDay":7>s?"nextWeek":"sameElse";return this.format(this.lang().calendar(o,this))},isLeapYear:function(){return M(this.year())},isDST:function(){return this.zone()+ge(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+ge(t).startOf(e)},isSame:function(t,e){return e=e||"ms",+this.clone().startOf(e)===+k(t,this).startOf(e)},min:r("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(t){return t=ge.apply(null,arguments),this>t?this:t}),max:r("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(t){return t=ge.apply(null,arguments),t>this?this:t}),zone:function(t,e){var i=this._offset||0;return null==t?this._isUTC?i:this._d.getTimezoneOffset():("string"==typeof t&&(t=H(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,i!==t&&(!e||this._changeInProgress?f(this,ge.duration(i-t,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ge.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(t){return t=t?ge(t).zone():0,(this.zone()-t)%60===0},daysInMonth:function(){return D(this.year(),this.month())},dayOfYear:function(t){var e=_e((ge(this).startOf("day")-ge(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},quarter:function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},weekYear:function(t){var e=oe(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=oe(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=oe(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this.day()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},isoWeeksInYear:function(){return E(this.year(),1,4)},weeksInYear:function(){var t=this._lang._week;return E(this.year(),t.dow,t.doy)},get:function(t){return t=_(t),this[t]()},set:function(t,e){return t=_(t),"function"==typeof this[t]&&this[t](e),this},lang:function(t){return t===s?this._lang:(this._lang=P(t),this)}}),ge.fn.millisecond=ge.fn.milliseconds=ce("Milliseconds",!1),ge.fn.second=ge.fn.seconds=ce("Seconds",!1),ge.fn.minute=ge.fn.minutes=ce("Minutes",!1),ge.fn.hour=ge.fn.hours=ce("Hours",!0),ge.fn.date=ce("Date",!0),ge.fn.dates=r("dates accessor is deprecated. Use date instead.",ce("Date",!0)),ge.fn.year=ce("FullYear",!0),ge.fn.years=r("years accessor is deprecated. Use year instead.",ce("FullYear",!0)),ge.fn.days=ge.fn.day,ge.fn.months=ge.fn.month,ge.fn.weeks=ge.fn.week,ge.fn.isoWeeks=ge.fn.isoWeek,ge.fn.quarters=ge.fn.quarter,ge.fn.toJSON=ge.fn.toISOString,p(ge.duration.fn=c.prototype,{_bubble:function(){var t,e,i,s,o=this._milliseconds,n=this._days,r=this._months,a=this._data;a.milliseconds=o%1e3,t=m(o/1e3),a.seconds=t%60,e=m(t/60),a.minutes=e%60,i=m(e/60),a.hours=i%24,n+=m(i/24),a.days=n%30,r+=m(n/30),a.months=r%12,s=m(r/12),a.years=s},weeks:function(){return m(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12)},humanize:function(t){var e=+this,i=se(e,!t,this.lang());return t&&(i=this.lang().pastFuture(e,i)),this.lang().postformat(i)},add:function(t,e){var i=ge.duration(t,e);return this._milliseconds+=i._milliseconds,this._days+=i._days,this._months+=i._months,this._bubble(),this},subtract:function(t,e){var i=ge.duration(t,e);return this._milliseconds-=i._milliseconds,this._days-=i._days,this._months-=i._months,this._bubble(),this},get:function(t){return t=_(t),this[t.toLowerCase()+"s"]()},as:function(t){return t=_(t),this["as"+t.charAt(0).toUpperCase()+t.slice(1)+"s"]()},lang:ge.fn.lang,toIsoString:function(){var t=Math.abs(this.years()),e=Math.abs(this.months()),i=Math.abs(this.days()),s=Math.abs(this.hours()),o=Math.abs(this.minutes()),n=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(t?t+"Y":"")+(e?e+"M":"")+(i?i+"D":"")+(s||o||n?"T":"")+(s?s+"H":"")+(o?o+"M":"")+(n?n+"S":""):"P0D"}});for(ve in si)si.hasOwnProperty(ve)&&(ue(ve,si[ve]),pe(ve.toLowerCase()));ue("Weeks",6048e5),ge.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},ge.lang("en",{ordinal:function(t){var e=t%10,i=1===S(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+i}}),Oe?e.exports=ge:"function"==typeof define&&define.amd?(define("moment",function(t,e,i){return i.config&&i.config()&&i.config().noGlobal===!0&&(be.moment=fe),ge}),me(!0)):me()}).call(this)},{}],5:[function(t,e){function i(t,e,i){return t.addEventListener?t.addEventListener(e,i,!1):void t.attachEvent("on"+e,i)}function s(t){return"keypress"==t.type?String.fromCharCode(t.which):w[t.which]?w[t.which]:x[t.which]?x[t.which]:String.fromCharCode(t.which).toLowerCase()}function o(t){var e=t.target||t.srcElement,i=e.tagName;return(" "+e.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"==i||"SELECT"==i||"TEXTAREA"==i||e.contentEditable&&"true"==e.contentEditable}function n(t,e){return t.sort().join(",")===e.sort().join(",")}function r(t){t=t||{};var e,i=!1;for(e in M)t[e]?i=!0:M[e]=0;i||(N=!1)}function a(t,e,i,s,o){var r,a,h=[];if(!E[t])return[];for("keyup"==i&&p(t)&&(e=[t]),r=0;r95&&112>t||w.hasOwnProperty(t)&&(b[w[t]]=t)}return b}function g(t,e,i){return i||(i=m()[t]?"keydown":"keypress"),"keypress"==i&&e.length&&(i="keydown"),i}function f(t,e,i,o){M[t]=0,o||(o=g(e[0],[]));var n,a=function(){N=o,++M[t],u()},h=function(t){d(i,t),"keyup"!==o&&(C=s(t)),setTimeout(r,10)};for(n=0;n1)return f(t,d,e,i);for(h="+"===t?["+"]:t.split("+"),n=0;n":".","?":"/","|":"\\"},D={option:"alt",command:"meta","return":"enter",escape:"esc"},E={},T={},M={},C=!1,N=!1,O=1;20>O;++O)w[111+O]="f"+O;for(O=0;9>=O;++O)w[O+96]=O;i(document,"keypress",c),i(document,"keydown",c),i(document,"keyup",c);var k={bind:function(t,e,i){return y(t instanceof Array?t:[t],e,i),T[t+":"+i]=e,this},unbind:function(t,e){return T[t+":"+e]&&(delete T[t+":"+e],this.bind(t,function(){},e)),this},trigger:function(t,e){return T[t+":"+e](),this},reset:function(){return E={},T={},this}};e.exports=k},{}]},{},[1])(1)}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.vis=e():t.vis=e()}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var o=i[s]={exports:{},id:s,loaded:!1};return t[s].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){e.util=i(1),e.DOMutil=i(2),e.DataSet=i(3),e.DataView=i(4),e.Graph3d=i(5),e.graph3d={Camera:i(6),Filter:i(7),Point2d:i(8),Point3d:i(9),Slider:i(10),StepNumber:i(11)},e.Timeline=i(12),e.Graph2d=i(13),e.timeline={DataStep:i(14),Range:i(15),stack:i(16),TimeStep:i(17),components:{items:{Item:i(28),ItemBox:i(29),ItemPoint:i(30),ItemRange:i(31)},Component:i(18),CurrentTime:i(19),CustomTime:i(20),DataAxis:i(21),GraphGroup:i(22),Group:i(23),ItemSet:i(24),Legend:i(25),LineGraph:i(26),TimeAxis:i(27)}},e.Network=i(32),e.network={Edge:i(33),Groups:i(34),Images:i(35),Node:i(36),Popup:i(37),dotparser:i(38),gephiParser:i(39)},e.Graph=function(){throw new Error("Graph is renamed to Network. Please create a graph as new vis.Network(...)")},e.moment=i(40),e.hammer=i(41)},function(module,exports,__webpack_require__){var moment=__webpack_require__(40);exports.isNumber=function(t){return t instanceof Number||"number"==typeof t},exports.isString=function(t){return t instanceof String||"string"==typeof t},exports.isDate=function(t){if(t instanceof Date)return!0;if(exports.isString(t)){var e=ASPDateRegex.exec(t);if(e)return!0;if(!isNaN(Date.parse(t)))return!0}return!1},exports.isDataTable=function(t){return"undefined"!=typeof google&&google.visualization&&google.visualization.DataTable&&t instanceof google.visualization.DataTable},exports.randomUUID=function(){var t=function(){return Math.floor(65536*Math.random()).toString(16)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},exports.extend=function(t){for(var e=1,i=arguments.length;i>e;e++){var s=arguments[e];for(var o in s)s.hasOwnProperty(o)&&(t[o]=s[o])}return t},exports.selectiveExtend=function(t,e){if(!Array.isArray(t))throw new Error("Array with property names expected as first argument");for(var i=2;ii;i++)if(t[i]!=e[i])return!1;return!0},exports.convert=function(t,e){var i;if(void 0===t)return void 0;if(null===t)return null;if(!e)return t;if("string"!=typeof e&&!(e instanceof String))throw new Error("Type must be a string");switch(e){case"boolean":case"Boolean":return Boolean(t);case"number":case"Number":return Number(t.valueOf());case"string":case"String":return String(t);case"Date":if(exports.isNumber(t))return new Date(t);if(t instanceof Date)return new Date(t.valueOf());if(moment.isMoment(t))return new Date(t.valueOf());if(exports.isString(t))return i=ASPDateRegex.exec(t),i?new Date(Number(i[1])):moment(t).toDate();throw new Error("Cannot convert object of type "+exports.getType(t)+" to type Date");case"Moment":if(exports.isNumber(t))return moment(t);if(t instanceof Date)return moment(t.valueOf());if(moment.isMoment(t))return moment(t);if(exports.isString(t))return i=ASPDateRegex.exec(t),moment(i?Number(i[1]):t);throw new Error("Cannot convert object of type "+exports.getType(t)+" to type Date");case"ISODate":if(exports.isNumber(t))return new Date(t);if(t instanceof Date)return t.toISOString();if(moment.isMoment(t))return t.toDate().toISOString();if(exports.isString(t))return i=ASPDateRegex.exec(t),i?new Date(Number(i[1])).toISOString():new Date(t).toISOString();throw new Error("Cannot convert object of type "+exports.getType(t)+" to type ISODate");case"ASPDate":if(exports.isNumber(t))return"/Date("+t+")/";if(t instanceof Date)return"/Date("+t.valueOf()+")/";if(exports.isString(t)){i=ASPDateRegex.exec(t);var s;return s=i?new Date(Number(i[1])).valueOf():new Date(t).valueOf(),"/Date("+s+")/"}throw new Error("Cannot convert object of type "+exports.getType(t)+" to type ASPDate");default:throw new Error('Unknown type "'+e+'"')}};var ASPDateRegex=/^\/?Date\((\-?\d+)/i;exports.getType=function(t){var e=typeof t;return"object"==e?null==t?"null":t instanceof Boolean?"Boolean":t instanceof Number?"Number":t instanceof String?"String":t instanceof Array?"Array":t instanceof Date?"Date":"Object":"number"==e?"Number":"boolean"==e?"Boolean":"string"==e?"String":e},exports.getAbsoluteLeft=function(t){return t.getBoundingClientRect().left+window.pageXOffset},exports.getAbsoluteTop=function(t){return t.getBoundingClientRect().top+window.pageYOffset},exports.addClassName=function(t,e){var i=t.className.split(" ");-1==i.indexOf(e)&&(i.push(e),t.className=i.join(" "))},exports.removeClassName=function(t,e){var i=t.className.split(" "),s=i.indexOf(e);-1!=s&&(i.splice(s,1),t.className=i.join(" "))},exports.forEach=function(t,e){var i,s;if(t instanceof Array)for(i=0,s=t.length;s>i;i++)e(t[i],i,t);else for(i in t)t.hasOwnProperty(i)&&e(t[i],i,t)},exports.toArray=function(t){var e=[];for(var i in t)t.hasOwnProperty(i)&&e.push(t[i]);return e},exports.updateProperty=function(t,e,i){return t[e]!==i?(t[e]=i,!0):!1},exports.addEventListener=function(t,e,i,s){t.addEventListener?(void 0===s&&(s=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,s)):t.attachEvent("on"+e,i)},exports.removeEventListener=function(t,e,i,s){t.removeEventListener?(void 0===s&&(s=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,s)):t.detachEvent("on"+e,i)},exports.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},exports.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},exports.option={},exports.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},exports.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},exports.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},exports.option.asSize=function(t,e){return"function"==typeof t&&(t=t()),exports.isString(t)?t:exports.isNumber(t)?t+"px":e||null},exports.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},exports.GiveDec=function(Hex){var Value;return Value="A"==Hex?10:"B"==Hex?11:"C"==Hex?12:"D"==Hex?13:"E"==Hex?14:"F"==Hex?15:eval(Hex)},exports.GiveHex=function(t){var e;return e=10==t?"A":11==t?"B":12==t?"C":13==t?"D":14==t?"E":15==t?"F":""+t},exports.parseColor=function(t){var e;if(exports.isString(t)){if(exports.isValidRGB(t)){var i=t.substr(4).substr(0,t.length-5).split(",");t=exports.RGBToHex(i[0],i[1],i[2])}if(exports.isValidHex(t)){var s=exports.hexToHSV(t),o={h:s.h,s:.45*s.s,v:Math.min(1,1.05*s.v)},n={h:s.h,s:Math.min(1,1.25*s.v),v:.6*s.v},r=exports.HSVToHex(n.h,n.h,n.v),a=exports.HSVToHex(o.h,o.s,o.v);e={background:t,border:r,highlight:{background:a,border:r},hover:{background:a,border:r}}}else e={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}else e={},e.background=t.background||"white",e.border=t.border||e.background,exports.isString(t.highlight)?e.highlight={border:t.highlight,background:t.highlight}:(e.highlight={},e.highlight.background=t.highlight&&t.highlight.background||e.background,e.highlight.border=t.highlight&&t.highlight.border||e.border),exports.isString(t.hover)?e.hover={border:t.hover,background:t.hover}:(e.hover={},e.hover.background=t.hover&&t.hover.background||e.background,e.hover.border=t.hover&&t.hover.border||e.border);return e},exports.hexToRGB=function(t){t=t.replace("#","").toUpperCase();var e=exports.GiveDec(t.substring(0,1)),i=exports.GiveDec(t.substring(1,2)),s=exports.GiveDec(t.substring(2,3)),o=exports.GiveDec(t.substring(3,4)),n=exports.GiveDec(t.substring(4,5)),r=exports.GiveDec(t.substring(5,6)),a=16*e+i,h=16*s+o,i=16*n+r;return{r:a,g:h,b:i}},exports.RGBToHex=function(t,e,i){var s=exports.GiveHex(Math.floor(t/16)),o=exports.GiveHex(t%16),n=exports.GiveHex(Math.floor(e/16)),r=exports.GiveHex(e%16),a=exports.GiveHex(Math.floor(i/16)),h=exports.GiveHex(i%16),d=s+o+n+r+a+h;return"#"+d},exports.RGBToHSV=function(t,e,i){t/=255,e/=255,i/=255;var s=Math.min(t,Math.min(e,i)),o=Math.max(t,Math.max(e,i));if(s==o)return{h:0,s:0,v:s};var n=t==s?e-i:i==s?t-e:i-t,r=t==s?3:i==s?1:5,a=60*(r-n/(o-s))/360,h=(o-s)/o,d=o;return{h:a,s:h,v:d}},exports.HSVToRGB=function(t,e,i){var s,o,n,r=Math.floor(6*t),a=6*t-r,h=i*(1-e),d=i*(1-a*e),l=i*(1-(1-a)*e);switch(r%6){case 0:s=i,o=l,n=h;break;case 1:s=d,o=i,n=h;break;case 2:s=h,o=i,n=l;break;case 3:s=h,o=d,n=i;break;case 4:s=l,o=h,n=i;break;case 5:s=i,o=h,n=d}return{r:Math.floor(255*s),g:Math.floor(255*o),b:Math.floor(255*n)}},exports.HSVToHex=function(t,e,i){var s=exports.HSVToRGB(t,e,i);return exports.RGBToHex(s.r,s.g,s.b)},exports.hexToHSV=function(t){var e=exports.hexToRGB(t);return exports.RGBToHSV(e.r,e.g,e.b)},exports.isValidHex=function(t){var e=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t);return e},exports.isValidRGB=function(t){t=t.replace(" ","");var e=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(t);return e},exports.selectiveBridgeObject=function(t,e){if("object"==typeof e){for(var i=Object.create(e),s=0;sa;)o=void 0===s?n[u][i]:n[u][i][s],n[u].isVisible(e)?h=!0:(o=r&&console.log("BinarySearch too many iterations. Aborting.")}return u},exports.binarySearchGeneric=function(t,e,i,s){var o,n,r,a,h=1e4,d=0,l=t,c=!1,p=0,u=l.length,m=p,g=u,f=Math.floor(.5*(u+p));if(0==u)f=-1;else if(1==u)r=l[f][i],f=r==e?0:-1;else{for(u-=1;0==c&&h>d;)n=l[Math.max(0,f-1)][i],r=l[f][i],a=l[Math.min(l.length-1,f+1)][i],r==e||e>n&&r>e||e>r&&a>e?(c=!0,r!=e&&("before"==s?e>n&&r>e&&(f=Math.max(0,f-1)):e>r&&a>e&&(f=Math.min(l.length-1,f+1)))):(e>r?m=Math.floor(.5*(u+p)):g=Math.floor(.5*(u+p)),o=Math.floor(.5*(u+p)),p==m&&u==g?(f=-1,c=!0):(u=g,p=m,f=Math.floor(.5*(u+p)))),d++;d>=h&&console.log("BinarySearch too many iterations. Aborting.")}return f}},function(t,e){e.prepareElements=function(t){for(var e in t)t.hasOwnProperty(e)&&(t[e].redundant=t[e].used,t[e].used=[])},e.cleanupElements=function(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e].redundant){for(var i=0;i0?(s=e[t].redundant[0],e[t].redundant.shift()):(s=document.createElementNS("http://www.w3.org/2000/svg",t),i.appendChild(s)):(s=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},i.appendChild(s)),e[t].used.push(s),s},e.getDOMElement=function(t,e,i){var s;return e.hasOwnProperty(t)?e[t].redundant.length>0?(s=e[t].redundant[0],e[t].redundant.shift()):(s=document.createElement(t),i.appendChild(s)):(s=document.createElement(t),e[t]={used:[],redundant:[]},i.appendChild(s)),e[t].used.push(s),s},e.drawPoint=function(t,i,s,o,n){var r;return"circle"==s.options.drawPoints.style?(r=e.getSVGElement("circle",o,n),r.setAttributeNS(null,"cx",t),r.setAttributeNS(null,"cy",i),r.setAttributeNS(null,"r",.5*s.options.drawPoints.size),r.setAttributeNS(null,"class",s.className+" point")):(r=e.getSVGElement("rect",o,n),r.setAttributeNS(null,"x",t-.5*s.options.drawPoints.size),r.setAttributeNS(null,"y",i-.5*s.options.drawPoints.size),r.setAttributeNS(null,"width",s.options.drawPoints.size),r.setAttributeNS(null,"height",s.options.drawPoints.size),r.setAttributeNS(null,"class",s.className+" point")),r},e.drawBar=function(t,i,s,o,n,r,a){var h=e.getSVGElement("rect",r,a);h.setAttributeNS(null,"x",t-.5*s),h.setAttributeNS(null,"y",i),h.setAttributeNS(null,"width",s),h.setAttributeNS(null,"height",o),h.setAttributeNS(null,"class",n)}},function(t,e,i){function s(t,e){if(!t||Array.isArray(t)||o.isDataTable(t)||(e=t,t=null),this._options=e||{},this._data={},this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i in this._options.type)if(this._options.type.hasOwnProperty(i)){var s=this._options.type[i];this._type[i]="Date"==s||"ISODate"==s||"ASPDate"==s?"Date":s}if(this._options.convert)throw new Error('Option "convert" is deprecated. Use "type" instead.');this._subscribers={},t&&this.add(t)}var o=i(1);s.prototype.on=function(t,e){var i=this._subscribers[t];i||(i=[],this._subscribers[t]=i),i.push({callback:e})},s.prototype.subscribe=s.prototype.on,s.prototype.off=function(t,e){var i=this._subscribers[t];i&&(this._subscribers[t]=i.filter(function(t){return t.callback!=e}))},s.prototype.unsubscribe=s.prototype.off,s.prototype._trigger=function(t,e,i){if("*"==t)throw new Error("Cannot trigger event *");var s=[];t in this._subscribers&&(s=s.concat(this._subscribers[t])),"*"in this._subscribers&&(s=s.concat(this._subscribers["*"]));for(var o=0;or;r++)i=n._addItem(t[r]),s.push(i);else if(o.isDataTable(t))for(var h=this._getColumnNames(t),d=0,l=t.getNumberOfRows();l>d;d++){for(var c={},p=0,u=h.length;u>p;p++){var m=h[p];c[m]=t.getValue(d,p)}i=n._addItem(c),s.push(i)}else{if(!(t instanceof Object))throw new Error("Unknown dataType");i=n._addItem(t),s.push(i)}return s.length&&this._trigger("add",{items:s},e),s},s.prototype.update=function(t,e){var i=[],s=[],n=this,r=n._fieldId,a=function(t){var e=t[r];n._data[e]?(e=n._updateItem(t),s.push(e)):(e=n._addItem(t),i.push(e))};if(Array.isArray(t))for(var h=0,d=t.length;d>h;h++)a(t[h]);else if(o.isDataTable(t))for(var l=this._getColumnNames(t),c=0,p=t.getNumberOfRows();p>c;c++){for(var u={},m=0,g=l.length;g>m;m++){var f=l[m];u[f]=t.getValue(c,m)}a(u)}else{if(!(t instanceof Object))throw new Error("Unknown dataType");a(t)}return i.length&&this._trigger("add",{items:i},e),s.length&&this._trigger("update",{items:s},e),i.concat(s)},s.prototype.get=function(){var t,e,i,s,n=this,r=o.getType(arguments[0]);"String"==r||"Number"==r?(t=arguments[0],i=arguments[1],s=arguments[2]):"Array"==r?(e=arguments[0],i=arguments[1],s=arguments[2]):(i=arguments[0],s=arguments[1]);var a;if(i&&i.returnType){var h=["DataTable","Array","Object"];if(a=-1==h.indexOf(i.returnType)?"Array":i.returnType,s&&a!=o.getType(s))throw new Error('Type of parameter "data" ('+o.getType(s)+") does not correspond with specified options.type ("+i.type+")");if("DataTable"==a&&!o.isDataTable(s))throw new Error('Parameter "data" must be a DataTable when options.type is "DataTable"')}else a=s&&"DataTable"==o.getType(s)?"DataTable":"Array";var d,l,c,p,u=i&&i.type||this._options.type,m=i&&i.filter,g=[];if(void 0!=t)d=n._getItem(t,u),m&&!m(d)&&(d=null);else if(void 0!=e)for(c=0,p=e.length;p>c;c++)d=n._getItem(e[c],u),(!m||m(d))&&g.push(d);else for(l in this._data)this._data.hasOwnProperty(l)&&(d=n._getItem(l,u),(!m||m(d))&&g.push(d));if(i&&i.order&&void 0==t&&this._sort(g,i.order),i&&i.fields){var f=i.fields;if(void 0!=t)d=this._filterFields(d,f);else for(c=0,p=g.length;p>c;c++)g[c]=this._filterFields(g[c],f)}if("DataTable"==a){var v=this._getColumnNames(s);if(void 0!=t)n._appendRow(s,v,d);else for(c=0;cc;c++)s.push(g[c]);return s}return g},s.prototype.getIds=function(t){var e,i,s,o,n,r=this._data,a=t&&t.filter,h=t&&t.order,d=t&&t.type||this._options.type,l=[];if(a)if(h){n=[];for(s in r)r.hasOwnProperty(s)&&(o=this._getItem(s,d),a(o)&&n.push(o));for(this._sort(n,h),e=0,i=n.length;i>e;e++)l[e]=n[e][this._fieldId]}else for(s in r)r.hasOwnProperty(s)&&(o=this._getItem(s,d),a(o)&&l.push(o[this._fieldId]));else if(h){n=[];for(s in r)r.hasOwnProperty(s)&&n.push(r[s]);for(this._sort(n,h),e=0,i=n.length;i>e;e++)l[e]=n[e][this._fieldId]}else for(s in r)r.hasOwnProperty(s)&&(o=r[s],l.push(o[this._fieldId]));return l},s.prototype.getDataSet=function(){return this},s.prototype.forEach=function(t,e){var i,s,o=e&&e.filter,n=e&&e.type||this._options.type,r=this._data;if(e&&e.order)for(var a=this.get(e),h=0,d=a.length;d>h;h++)i=a[h],s=i[this._fieldId],t(i,s);else for(s in r)r.hasOwnProperty(s)&&(i=this._getItem(s,n),(!o||o(i))&&t(i,s))},s.prototype.map=function(t,e){var i,s=e&&e.filter,o=e&&e.type||this._options.type,n=[],r=this._data;for(var a in r)r.hasOwnProperty(a)&&(i=this._getItem(a,o),(!s||s(i))&&n.push(t(i,a)));return e&&e.order&&this._sort(n,e.order),n},s.prototype._filterFields=function(t,e){var i={};for(var s in t)t.hasOwnProperty(s)&&-1!=e.indexOf(s)&&(i[s]=t[s]);return i},s.prototype._sort=function(t,e){if(o.isString(e)){var i=e;t.sort(function(t,e){var s=t[i],o=e[i];return s>o?1:o>s?-1:0})}else{if("function"!=typeof e)throw new TypeError("Order must be a function or a string");t.sort(e)}},s.prototype.remove=function(t,e){var i,s,o,n=[];if(Array.isArray(t))for(i=0,s=t.length;s>i;i++)o=this._remove(t[i]),null!=o&&n.push(o);else o=this._remove(t),null!=o&&n.push(o);return n.length&&this._trigger("remove",{items:n},e),n},s.prototype._remove=function(t){if(o.isNumber(t)||o.isString(t)){if(this._data[t])return delete this._data[t],t}else if(t instanceof Object){var e=t[this._fieldId];if(e&&this._data[e])return delete this._data[e],e}return null},s.prototype.clear=function(t){var e=Object.keys(this._data);return this._data={},this._trigger("remove",{items:e},t),e},s.prototype.max=function(t){var e=this._data,i=null,s=null;for(var o in e)if(e.hasOwnProperty(o)){var n=e[o],r=n[t];null!=r&&(!i||r>s)&&(i=n,s=r)}return i},s.prototype.min=function(t){var e=this._data,i=null,s=null;for(var o in e)if(e.hasOwnProperty(o)){var n=e[o],r=n[t];null!=r&&(!i||s>r)&&(i=n,s=r)}return i},s.prototype.distinct=function(t){var e,i=this._data,s=[],n=this._options.type&&this._options.type[t]||null,r=0;for(var a in i)if(i.hasOwnProperty(a)){var h=i[a],d=h[t],l=!1;for(e=0;r>e;e++)if(s[e]==d){l=!0;break}l||void 0===d||(s[r]=d,r++)}if(n)for(e=0;ei;i++)e[i]=t.getColumnId(i)||t.getColumnLabel(i);return e},s.prototype._appendRow=function(t,e,i){for(var s=t.addRow(),o=0,n=e.length;n>o;o++){var r=e[o];t.setValue(s,o,i[r])}},t.exports=s},function(t,e,i){function s(t,e){this._data=null,this._ids={},this._options=e||{},this._fieldId="id",this._subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(t)}var o=i(1),n=i(3);s.prototype.setData=function(t){var e,i,s;if(this._data){this._data.unsubscribe&&this._data.unsubscribe("*",this.listener),e=[];for(var o in this._ids)this._ids.hasOwnProperty(o)&&e.push(o);this._ids={},this._trigger("remove",{items:e})}if(this._data=t,this._data){for(this._fieldId=this._options.fieldId||this._data&&this._data.options&&this._data.options.fieldId||"id",e=this._data.getIds({filter:this._options&&this._options.filter}),i=0,s=e.length;s>i;i++)o=e[i],this._ids[o]=!0;this._trigger("add",{items:e}),this._data.on&&this._data.on("*",this.listener)}},s.prototype.get=function(){var t,e,i,s=this,n=o.getType(arguments[0]);"String"==n||"Number"==n||"Array"==n?(t=arguments[0],e=arguments[1],i=arguments[2]):(e=arguments[0],i=arguments[1]);var r=o.extend({},this._options,e);this._options.filter&&e&&e.filter&&(r.filter=function(t){return s._options.filter(t)&&e.filter(t)});var a=[];return void 0!=t&&a.push(t),a.push(r),a.push(i),this._data&&this._data.get.apply(this._data,a)},s.prototype.getIds=function(t){var e;if(this._data){var i,s=this._options.filter;i=t&&t.filter?s?function(e){return s(e)&&t.filter(e)}:t.filter:s,e=this._data.getIds({filter:i,order:t&&t.order})}else e=[];return e},s.prototype.getDataSet=function(){for(var t=this;t instanceof s;)t=t._data;return t||null},s.prototype._onEvent=function(t,e,i){var s,o,n,r,a=e&&e.items,h=this._data,d=[],l=[],c=[];if(a&&h){switch(t){case"add":for(s=0,o=a.length;o>s;s++)n=a[s],r=this.get(n),r&&(this._ids[n]=!0,d.push(n));break;case"update":for(s=0,o=a.length;o>s;s++)n=a[s],r=this.get(n),r?this._ids[n]?l.push(n):(this._ids[n]=!0,d.push(n)):this._ids[n]&&(delete this._ids[n],c.push(n));break;case"remove":for(s=0,o=a.length;o>s;s++)n=a[s],this._ids[n]&&(delete this._ids[n],c.push(n))}d.length&&this._trigger("add",{items:d},i),l.length&&this._trigger("update",{items:l},i),c.length&&this._trigger("remove",{items:c},i)}},s.prototype.on=n.prototype.on,s.prototype.off=n.prototype.off,s.prototype._trigger=n.prototype._trigger,s.prototype.subscribe=s.prototype.on,s.prototype.unsubscribe=s.prototype.off,t.exports=s},function(t,e,i){function s(t,e,i){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");this.containerElement=t,this.width="400px",this.height="400px",this.margin=10,this.defaultXCenter="55%",this.defaultYCenter="50%",this.xLabel="x",this.yLabel="y",this.zLabel="z",this.filterLabel="time",this.legendLabel="value",this.style=s.STYLE.DOT,this.showPerspective=!0,this.showGrid=!0,this.keepAspectRatio=!0,this.showShadow=!1,this.showGrayBottom=!1,this.showTooltip=!1,this.verticalRatio=.5,this.animationInterval=1e3,this.animationPreload=!1,this.camera=new l,this.eye=new h(0,0,-1),this.dataTable=null,this.dataPoints=null,this.colX=void 0,this.colY=void 0,this.colZ=void 0,this.colValue=void 0,this.colFilter=void 0,this.xMin=0,this.xStep=void 0,this.xMax=1,this.yMin=0,this.yStep=void 0,this.yMax=1,this.zMin=0,this.zStep=void 0,this.zMax=1,this.valueMin=0,this.valueMax=1,this.xBarWidth=1,this.yBarWidth=1,this.colorAxis="#4D4D4D",this.colorGrid="#D3D3D3",this.colorDot="#7DC1FF",this.colorDotBorder="#3267D2",this.create(),this.setOptions(i),e&&this.setData(e)}var o=i(45),n=i(3),r=i(4),a=i(1),h=i(9),d=i(8),l=i(6),c=i(7),p=i(10),u=i(11);o(s.prototype),s.prototype._setScale=function(){this.scale=new h(1/(this.xMax-this.xMin),1/(this.yMax-this.yMin),1/(this.zMax-this.zMin)),this.keepAspectRatio&&(this.scale.x3&&(this.colFilter=3);else{if(this.style!==s.STYLE.DOTCOLOR&&this.style!==s.STYLE.DOTSIZE&&this.style!==s.STYLE.BARCOLOR&&this.style!==s.STYLE.BARSIZE)throw'Unknown style "'+this.style+'"';this.colX=0,this.colY=1,this.colZ=2,this.colValue=3,t.getNumberOfColumns()>4&&(this.colFilter=4)}},s.prototype.getNumberOfRows=function(t){return t.length},s.prototype.getNumberOfColumns=function(t){var e=0;for(var i in t[0])t[0].hasOwnProperty(i)&&e++;return e},s.prototype.getDistinctValues=function(t,e){for(var i=[],s=0;st[s][e]&&(i.min=t[s][e]),i.maxt;t++){var g=(t-p)/(m-p),f=240*g,v=this._hsv2rgb(f,1,1);c.strokeStyle=v,c.beginPath(),c.moveTo(h,r+t),c.lineTo(a,r+t),c.stroke()}c.strokeStyle=this.colorAxis,c.strokeRect(h,r,i,n)}if(this.style===s.STYLE.DOTSIZE&&(c.strokeStyle=this.colorAxis,c.fillStyle=this.colorDot,c.beginPath(),c.moveTo(h,r),c.lineTo(a,r),c.lineTo(a-i+e,d),c.lineTo(h,d),c.closePath(),c.fill(),c.stroke()),this.style===s.STYLE.DOTCOLOR||this.style===s.STYLE.DOTSIZE){var y=5,b=new u(this.valueMin,this.valueMax,(this.valueMax-this.valueMin)/5,!0);for(b.start(),b.getCurrent()0?this.yMin:this.yMax,o=this._convert3Dto2D(new h(x,r,this.zMin)),Math.cos(2*_)>0?(f.textAlign="center",f.textBaseline="top",o.y+=b):Math.sin(2*_)<0?(f.textAlign="right",f.textBaseline="middle"):(f.textAlign="left",f.textBaseline="middle"),f.fillStyle=this.colorAxis,f.fillText(" "+i.getCurrent()+" ",o.x,o.y),i.next()}for(f.lineWidth=1,s=void 0===this.defaultYStep,i=new u(this.yMin,this.yMax,this.yStep,s),i.start(),i.getCurrent()0?this.xMin:this.xMax,o=this._convert3Dto2D(new h(n,i.getCurrent(),this.zMin)),Math.cos(2*_)<0?(f.textAlign="center",f.textBaseline="top",o.y+=b):Math.sin(2*_)>0?(f.textAlign="right",f.textBaseline="middle"):(f.textAlign="left",f.textBaseline="middle"),f.fillStyle=this.colorAxis,f.fillText(" "+i.getCurrent()+" ",o.x,o.y),i.next();for(f.lineWidth=1,s=void 0===this.defaultZStep,i=new u(this.zMin,this.zMax,this.zStep,s),i.start(),i.getCurrent()0?this.xMin:this.xMax,r=Math.sin(_)<0?this.yMin:this.yMax;!i.end();)t=this._convert3Dto2D(new h(n,r,i.getCurrent())),f.strokeStyle=this.colorAxis,f.beginPath(),f.moveTo(t.x,t.y),f.lineTo(t.x-b,t.y),f.stroke(),f.textAlign="right",f.textBaseline="middle",f.fillStyle=this.colorAxis,f.fillText(i.getCurrent()+" ",t.x-5,t.y),i.next();f.lineWidth=1,t=this._convert3Dto2D(new h(n,r,this.zMin)),e=this._convert3Dto2D(new h(n,r,this.zMax)),f.strokeStyle=this.colorAxis,f.beginPath(),f.moveTo(t.x,t.y),f.lineTo(e.x,e.y),f.stroke(),f.lineWidth=1,p=this._convert3Dto2D(new h(this.xMin,this.yMin,this.zMin)),m=this._convert3Dto2D(new h(this.xMax,this.yMin,this.zMin)),f.strokeStyle=this.colorAxis,f.beginPath(),f.moveTo(p.x,p.y),f.lineTo(m.x,m.y),f.stroke(),p=this._convert3Dto2D(new h(this.xMin,this.yMax,this.zMin)),m=this._convert3Dto2D(new h(this.xMax,this.yMax,this.zMin)),f.strokeStyle=this.colorAxis,f.beginPath(),f.moveTo(p.x,p.y),f.lineTo(m.x,m.y),f.stroke(),f.lineWidth=1,t=this._convert3Dto2D(new h(this.xMin,this.yMin,this.zMin)),e=this._convert3Dto2D(new h(this.xMin,this.yMax,this.zMin)),f.strokeStyle=this.colorAxis,f.beginPath(),f.moveTo(t.x,t.y),f.lineTo(e.x,e.y),f.stroke(),t=this._convert3Dto2D(new h(this.xMax,this.yMin,this.zMin)),e=this._convert3Dto2D(new h(this.xMax,this.yMax,this.zMin)),f.strokeStyle=this.colorAxis,f.beginPath(),f.moveTo(t.x,t.y),f.lineTo(e.x,e.y),f.stroke();var w=this.xLabel;w.length>0&&(c=.1/this.scale.y,n=(this.xMin+this.xMax)/2,r=Math.cos(_)>0?this.yMin-c:this.yMax+c,o=this._convert3Dto2D(new h(n,r,this.zMin)),Math.cos(2*_)>0?(f.textAlign="center",f.textBaseline="top"):Math.sin(2*_)<0?(f.textAlign="right",f.textBaseline="middle"):(f.textAlign="left",f.textBaseline="middle"),f.fillStyle=this.colorAxis,f.fillText(w,o.x,o.y));var S=this.yLabel;S.length>0&&(l=.1/this.scale.x,n=Math.sin(_)>0?this.xMin-l:this.xMax+l,r=(this.yMin+this.yMax)/2,o=this._convert3Dto2D(new h(n,r,this.zMin)),Math.cos(2*_)<0?(f.textAlign="center",f.textBaseline="top"):Math.sin(2*_)>0?(f.textAlign="right",f.textBaseline="middle"):(f.textAlign="left",f.textBaseline="middle"),f.fillStyle=this.colorAxis,f.fillText(S,o.x,o.y));var M=this.zLabel;M.length>0&&(d=30,n=Math.cos(_)>0?this.xMin:this.xMax,r=Math.sin(_)<0?this.yMin:this.yMax,a=(this.zMin+this.zMax)/2,o=this._convert3Dto2D(new h(n,r,a)),f.textAlign="right",f.textBaseline="middle",f.fillStyle=this.colorAxis,f.fillText(M,o.x-d,o.y))},s.prototype._hsv2rgb=function(t,e,i){var s,o,n,r,a,h;switch(r=i*e,a=Math.floor(t/60),h=r*(1-Math.abs(t/60%2-1)),a){case 0:s=r,o=h,n=0;break;case 1:s=h,o=r,n=0;break;case 2:s=0,o=r,n=h;break;case 3:s=0,o=h,n=r;break;case 4:s=h,o=0,n=r;break;case 5:s=r,o=0,n=h;break;default:s=0,o=0,n=0}return"RGB("+parseInt(255*s)+","+parseInt(255*o)+","+parseInt(255*n)+")"},s.prototype._redrawDataGrid=function(){var t,e,i,o,n,r,a,d,l,c,p,u,m,g=this.frame.canvas,f=g.getContext("2d");if(!(void 0===this.dataPoints||this.dataPoints.length<=0)){for(n=0;n0}else r=!0;r?(m=(t.point.z+e.point.z+i.point.z+o.point.z)/4,c=240*(1-(m-this.zMin)*this.scale.z/this.verticalRatio),p=1,this.showShadow?(u=Math.min(1+S.x/M/2,1),a=this._hsv2rgb(c,p,u),d=a):(u=1,a=this._hsv2rgb(c,p,u),d=this.colorAxis)):(a="gray",d=this.colorAxis),l=.5,f.lineWidth=l,f.fillStyle=a,f.strokeStyle=d,f.beginPath(),f.moveTo(t.screen.x,t.screen.y),f.lineTo(e.screen.x,e.screen.y),f.lineTo(o.screen.x,o.screen.y),f.lineTo(i.screen.x,i.screen.y),f.closePath(),f.fill(),f.stroke()}}else for(n=0;np&&(p=0);var u,m,g;this.style===s.STYLE.DOTCOLOR?(u=240*(1-(d.point.value-this.valueMin)*this.scale.value),m=this._hsv2rgb(u,1,1),g=this._hsv2rgb(u,1,.8)):this.style===s.STYLE.DOTSIZE?(m=this.colorDot,g=this.colorDotBorder):(u=240*(1-(d.point.z-this.zMin)*this.scale.z/this.verticalRatio),m=this._hsv2rgb(u,1,1),g=this._hsv2rgb(u,1,.8)),i.lineWidth=1,i.strokeStyle=g,i.fillStyle=m,i.beginPath(),i.arc(d.screen.x,d.screen.y,p,0,2*Math.PI,!0),i.fill(),i.stroke()}}},s.prototype._redrawDataBar=function(){var t,e,i,o,n=this.frame.canvas,r=n.getContext("2d");if(!(void 0===this.dataPoints||this.dataPoints.length<=0)){for(t=0;t0&&(t=this.dataPoints[0],s.lineWidth=1,s.strokeStyle="blue",s.beginPath(),s.moveTo(t.screen.x,t.screen.y)),e=1;e0&&s.stroke()}},s.prototype._onMouseDown=function(t){if(t=t||window.event,this.leftButtonDown&&this._onMouseUp(t),this.leftButtonDown=t.which?1===t.which:1===t.button,this.leftButtonDown||this.touchDown){this.startMouseX=getMouseX(t),this.startMouseY=getMouseY(t),this.startStart=new Date(this.start),this.startEnd=new Date(this.end),this.startArmRotation=this.camera.getArmRotation(),this.frame.style.cursor="move";var e=this;this.onmousemove=function(t){e._onMouseMove(t)},this.onmouseup=function(t){e._onMouseUp(t)},a.addEventListener(document,"mousemove",e.onmousemove),a.addEventListener(document,"mouseup",e.onmouseup),a.preventDefault(t)}},s.prototype._onMouseMove=function(t){t=t||window.event;var e=parseFloat(getMouseX(t))-this.startMouseX,i=parseFloat(getMouseY(t))-this.startMouseY,s=this.startArmRotation.horizontal+e/200,o=this.startArmRotation.vertical+i/200,n=4,r=Math.sin(n/360*2*Math.PI);Math.abs(Math.sin(s))0?1:0>t?-1:0}var s=e[0],o=e[1],n=e[2],r=i((o.x-s.x)*(t.y-s.y)-(o.y-s.y)*(t.x-s.x)),a=i((n.x-o.x)*(t.y-o.y)-(n.y-o.y)*(t.x-o.x)),h=i((s.x-n.x)*(t.y-n.y)-(s.y-n.y)*(t.x-n.x));return!(0!=r&&0!=a&&r!=a||0!=a&&0!=h&&a!=h||0!=r&&0!=h&&r!=h)},s.prototype._dataPointFromXY=function(t,e){var i,o=100,n=null,r=null,a=null,h=new d(t,e);if(this.style===s.STYLE.BAR||this.style===s.STYLE.BARCOLOR||this.style===s.STYLE.BARSIZE)for(i=this.dataPoints.length-1;i>=0;i--){n=this.dataPoints[i];var l=n.surfaces;if(l)for(var c=l.length-1;c>=0;c--){var p=l[c],u=p.corners,m=[u[0].screen,u[1].screen,u[2].screen],g=[u[2].screen,u[3].screen,u[0].screen];if(this._insideTriangle(h,m)||this._insideTriangle(h,g))return n}}else for(i=0;ib)&&o>b&&(a=b,r=n)}}return r},s.prototype._showTooltip=function(t){var e,i,s;this.tooltip?(e=this.tooltip.dom.content,i=this.tooltip.dom.line,s=this.tooltip.dom.dot):(e=document.createElement("div"),e.style.position="absolute",e.style.padding="10px",e.style.border="1px solid #4d4d4d",e.style.color="#1a1a1a",e.style.background="rgba(255,255,255,0.7)",e.style.borderRadius="2px",e.style.boxShadow="5px 5px 10px rgba(128,128,128,0.5)",i=document.createElement("div"),i.style.position="absolute",i.style.height="40px",i.style.width="0",i.style.borderLeft="1px solid #4d4d4d",s=document.createElement("div"),s.style.position="absolute",s.style.height="0",s.style.width="0",s.style.border="5px solid #4d4d4d",s.style.borderRadius="5px",this.tooltip={dataPoint:null,dom:{content:e,line:i,dot:s}}),this._hideTooltip(),this.tooltip.dataPoint=t,e.innerHTML="function"==typeof this.showTooltip?this.showTooltip(t.point):"
x:"+t.point.x+"
y:"+t.point.y+"
z:"+t.point.z+"
",e.style.left="0",e.style.top="0",this.frame.appendChild(e),this.frame.appendChild(i),this.frame.appendChild(s);var o=e.offsetWidth,n=e.offsetHeight,r=i.offsetHeight,a=s.offsetWidth,h=s.offsetHeight,d=t.screen.x-o/2;d=Math.min(Math.max(d,10),this.frame.clientWidth-10-o),i.style.left=t.screen.x+"px",i.style.top=t.screen.y-r+"px",e.style.left=d+"px",e.style.top=t.screen.y-r-n+"px",s.style.left=t.screen.x-a/2+"px",s.style.top=t.screen.y-h/2+"px"},s.prototype._hideTooltip=function(){if(this.tooltip){this.tooltip.dataPoint=null;for(var t in this.tooltip.dom)if(this.tooltip.dom.hasOwnProperty(t)){var e=this.tooltip.dom[t];e&&e.parentNode&&e.parentNode.removeChild(e)}}},getMouseX=function(t){return"clientX"in t?t.clientX:t.targetTouches[0]&&t.targetTouches[0].clientX||0},getMouseY=function(t){return"clientY"in t?t.clientY:t.targetTouches[0]&&t.targetTouches[0].clientY||0},t.exports=s},function(t,e,i){var s=i(9);Camera=function(){this.armLocation=new s,this.armRotation={},this.armRotation.horizontal=0,this.armRotation.vertical=0,this.armLength=1.7,this.cameraLocation=new s,this.cameraRotation=new s(.5*Math.PI,0,0),this.calculateCameraOrientation()},Camera.prototype.setArmLocation=function(t,e,i){this.armLocation.x=t,this.armLocation.y=e,this.armLocation.z=i,this.calculateCameraOrientation()},Camera.prototype.setArmRotation=function(t,e){void 0!==t&&(this.armRotation.horizontal=t),void 0!==e&&(this.armRotation.vertical=e,this.armRotation.vertical<0&&(this.armRotation.vertical=0),this.armRotation.vertical>.5*Math.PI&&(this.armRotation.vertical=.5*Math.PI)),(void 0!==t||void 0!==e)&&this.calculateCameraOrientation()},Camera.prototype.getArmRotation=function(){var t={};return t.horizontal=this.armRotation.horizontal,t.vertical=this.armRotation.vertical,t},Camera.prototype.setArmLength=function(t){void 0!==t&&(this.armLength=t,this.armLength<.71&&(this.armLength=.71),this.armLength>5&&(this.armLength=5),this.calculateCameraOrientation())},Camera.prototype.getArmLength=function(){return this.armLength},Camera.prototype.getCameraLocation=function(){return this.cameraLocation},Camera.prototype.getCameraRotation=function(){return this.cameraRotation},Camera.prototype.calculateCameraOrientation=function(){this.cameraLocation.x=this.armLocation.x-this.armLength*Math.sin(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.y=this.armLocation.y-this.armLength*Math.cos(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.z=this.armLocation.z+this.armLength*Math.sin(this.armRotation.vertical),this.cameraRotation.x=Math.PI/2-this.armRotation.vertical,this.cameraRotation.y=0,this.cameraRotation.z=-this.armRotation.horizontal},t.exports=Camera},function(t,e,i){function s(t,e,i){this.data=t,this.column=e,this.graph=i,this.index=void 0,this.value=void 0,this.values=i.getDistinctValues(t.get(),this.column),this.values.sort(function(t,e){return t>e?1:e>t?-1:0}),this.values.length>0&&this.selectValue(0),this.dataPoints=[],this.loaded=!1,this.onLoadCallback=void 0,i.animationPreload?(this.loaded=!1,this.loadInBackground()):this.loaded=!0}var o=i(4);s.prototype.isLoaded=function(){return this.loaded},s.prototype.getLoadedProgress=function(){for(var t=this.values.length,e=0;this.dataPoints[e];)e++;return Math.round(e/t*100)},s.prototype.getLabel=function(){return this.graph.filterLabel},s.prototype.getColumn=function(){return this.column},s.prototype.getSelectedValue=function(){return void 0===this.index?void 0:this.values[this.index]},s.prototype.getValues=function(){return this.values},s.prototype.getValue=function(t){if(t>=this.values.length)throw"Error: index out of range";return this.values[t]},s.prototype._getDataPoints=function(t){if(void 0===t&&(t=this.index),void 0===t)return[];var e;if(this.dataPoints[t])e=this.dataPoints[t];else{var i={};i.column=this.column,i.value=this.values[t];var s=new o(this.data,{filter:function(t){return t[i.column]==i.value}}).get();e=this.graph._getDataPoints(s),this.dataPoints[t]=e}return e},s.prototype.setOnLoadCallback=function(t){this.onLoadCallback=t},s.prototype.selectValue=function(t){if(t>=this.values.length)throw"Error: index out of range";this.index=t,this.value=this.values[t]},s.prototype.loadInBackground=function(t){void 0===t&&(t=0);var e=this.graph.frame;if(t0&&(t--,this.setIndex(t))},s.prototype.next=function(){var t=this.getIndex();t0?this.setIndex(0):this.index=void 0},s.prototype.setIndex=function(t){if(!(ts&&(s=0),s>this.values.length-1&&(s=this.values.length-1),s},s.prototype.indexToLeft=function(t){var e=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10,i=t/(this.values.length-1)*e,s=i+3;return s},s.prototype._onMouseMove=function(t){var e=t.clientX-this.startClientX,i=this.startSlideX+e,s=this.leftToIndex(i);this.setIndex(s),o.preventDefault()},s.prototype._onMouseUp=function(){this.frame.style.cursor="auto",o.removeEventListener(document,"mousemove",this.onmousemove),o.removeEventListener(document,"mouseup",this.onmouseup),o.preventDefault()},t.exports=s},function(t){function e(t,e,i,s){this._start=0,this._end=0,this._step=1,this.prettyStep=!0,this.precision=5,this._current=0,this.setRange(t,e,i,s)}e.prototype.setRange=function(t,e,i,s){this._start=t?t:0,this._end=e?e:0,this.setStep(i,s)},e.prototype.setStep=function(t,i){void 0===t||0>=t||(void 0!==i&&(this.prettyStep=i),this._step=this.prettyStep===!0?e.calculatePrettyStep(t):t)},e.calculatePrettyStep=function(t){var e=function(t){return Math.log(t)/Math.LN10},i=Math.pow(10,Math.round(e(t))),s=2*Math.pow(10,Math.round(e(t/2))),o=5*Math.pow(10,Math.round(e(t/5))),n=i;return Math.abs(s-t)<=Math.abs(n-t)&&(n=s),Math.abs(o-t)<=Math.abs(n-t)&&(n=o),0>=n&&(n=1),n},e.prototype.getCurrent=function(){return parseFloat(this._current.toPrecision(this.precision))},e.prototype.getStep=function(){return this._step},e.prototype.start=function(){this._current=this._start-this._start%this._step},e.prototype.next=function(){this._current+=this._step},e.prototype.end=function(){return this._current>this._end},t.exports=e},function(t,e,i){function s(t,e,i){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");var o=this;this.defaultOptions={start:null,end:null,autoResize:!0,orientation:"bottom",width:null,height:null,maxHeight:null,minHeight:null},this.options=r.deepExtend({},this.defaultOptions),this._create(t),this.components=[],this.body={dom:this.dom,domProps:this.props,emitter:{on:this.on.bind(this),off:this.off.bind(this),emit:this.emit.bind(this)},util:{snap:null,toScreen:o._toScreen.bind(o),toGlobalScreen:o._toGlobalScreen.bind(o),toTime:o._toTime.bind(o),toGlobalTime:o._toGlobalTime.bind(o)}},this.range=new d(this.body),this.components.push(this.range),this.body.range=this.range,this.timeAxis=new l(this.body),this.components.push(this.timeAxis),this.body.util.snap=this.timeAxis.snap.bind(this.timeAxis),this.currentTime=new c(this.body),this.components.push(this.currentTime),this.customTime=new p(this.body),this.components.push(this.customTime),this.itemSet=new u(this.body),this.components.push(this.itemSet),this.itemsData=null,this.groupsData=null,i&&this.setOptions(i),e?this.setItems(e):this.redraw()}var o=i(45),n=i(41),r=i(1),a=i(3),h=i(4),d=i(15),l=i(27),c=i(19),p=i(20),u=i(24);o(s.prototype),s.prototype._create=function(t){this.dom={},this.dom.root=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.backgroundVertical=document.createElement("div"),this.dom.backgroundHorizontal=document.createElement("div"),this.dom.centerContainer=document.createElement("div"),this.dom.leftContainer=document.createElement("div"),this.dom.rightContainer=document.createElement("div"),this.dom.center=document.createElement("div"),this.dom.left=document.createElement("div"),this.dom.right=document.createElement("div"),this.dom.top=document.createElement("div"),this.dom.bottom=document.createElement("div"),this.dom.shadowTop=document.createElement("div"),this.dom.shadowBottom=document.createElement("div"),this.dom.shadowTopLeft=document.createElement("div"),this.dom.shadowBottomLeft=document.createElement("div"),this.dom.shadowTopRight=document.createElement("div"),this.dom.shadowBottomRight=document.createElement("div"),this.dom.background.className="vispanel background",this.dom.backgroundVertical.className="vispanel background vertical",this.dom.backgroundHorizontal.className="vispanel background horizontal",this.dom.centerContainer.className="vispanel center",this.dom.leftContainer.className="vispanel left",this.dom.rightContainer.className="vispanel right",this.dom.top.className="vispanel top",this.dom.bottom.className="vispanel bottom",this.dom.left.className="content",this.dom.center.className="content",this.dom.right.className="content",this.dom.shadowTop.className="shadow top",this.dom.shadowBottom.className="shadow bottom",this.dom.shadowTopLeft.className="shadow top",this.dom.shadowBottomLeft.className="shadow bottom",this.dom.shadowTopRight.className="shadow top",this.dom.shadowBottomRight.className="shadow bottom",this.dom.root.appendChild(this.dom.background),this.dom.root.appendChild(this.dom.backgroundVertical),this.dom.root.appendChild(this.dom.backgroundHorizontal),this.dom.root.appendChild(this.dom.centerContainer),this.dom.root.appendChild(this.dom.leftContainer),this.dom.root.appendChild(this.dom.rightContainer),this.dom.root.appendChild(this.dom.top),this.dom.root.appendChild(this.dom.bottom),this.dom.centerContainer.appendChild(this.dom.center),this.dom.leftContainer.appendChild(this.dom.left),this.dom.rightContainer.appendChild(this.dom.right),this.dom.centerContainer.appendChild(this.dom.shadowTop),this.dom.centerContainer.appendChild(this.dom.shadowBottom),this.dom.leftContainer.appendChild(this.dom.shadowTopLeft),this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft),this.dom.rightContainer.appendChild(this.dom.shadowTopRight),this.dom.rightContainer.appendChild(this.dom.shadowBottomRight),this.on("rangechange",this.redraw.bind(this)),this.on("change",this.redraw.bind(this)),this.on("touch",this._onTouch.bind(this)),this.on("pinch",this._onPinch.bind(this)),this.on("dragstart",this._onDragStart.bind(this)),this.on("drag",this._onDrag.bind(this)),this.hammer=n(this.dom.root,{prevent_default:!0}),this.listeners={};var e=this,i=["touch","pinch","tap","doubletap","hold","dragstart","drag","dragend","mousewheel","DOMMouseScroll"];if(i.forEach(function(t){var i=function(){var i=[t].concat(Array.prototype.slice.call(arguments,0));e.emit.apply(e,i)};e.hammer.on(t,i),e.listeners[t]=i}),this.props={root:{},background:{},centerContainer:{},leftContainer:{},rightContainer:{},center:{},left:{},right:{},top:{},bottom:{},border:{},scrollTop:0,scrollTopMin:0},this.touch={},!t)throw new Error("No container provided");t.appendChild(this.dom.root)},s.prototype.destroy=function(){this.clear(),this.off(),this._stopAutoResize(),this.dom.root.parentNode&&this.dom.root.parentNode.removeChild(this.dom.root),this.dom=null;for(var t in this.listeners)this.listeners.hasOwnProperty(t)&&delete this.listeners[t];this.listeners=null,this.hammer=null,this.components.forEach(function(t){t.destroy()}),this.body=null},s.prototype.setOptions=function(t){if(t){var e=["width","height","minHeight","maxHeight","autoResize","start","end","orientation"];r.selectiveExtend(e,this.options,t),this._initAutoResize()}if(this.components.forEach(function(e){e.setOptions(t)}),t&&t.order)throw new Error("Option order is deprecated. There is no replacement for this feature.");this.redraw()},s.prototype.setCustomTime=function(t){if(!this.customTime)throw new Error("Cannot get custom time: Custom time bar is not enabled");this.customTime.setCustomTime(t)},s.prototype.getCustomTime=function(){if(!this.customTime)throw new Error("Cannot get custom time: Custom time bar is not enabled");return this.customTime.getCustomTime()},s.prototype.setItems=function(t){var e,i=null==this.itemsData;if(e=t?t instanceof a||t instanceof h?t:new a(t,{type:{start:"Date",end:"Date"}}):null,this.itemsData=e,this.itemSet&&this.itemSet.setItems(e),i&&("start"in this.options||"end"in this.options)){this.fit();var s="start"in this.options?r.convert(this.options.start,"Date"):null,o="end"in this.options?r.convert(this.options.end,"Date"):null;this.setWindow(s,o)}},s.prototype.getVisibleItems=function(){return this.itemSet&&this.itemSet.getVisibleItems()||[]},s.prototype.setGroups=function(t){var e;e=t?t instanceof a||t instanceof h?t:new a(t):null,this.groupsData=e,this.itemSet.setGroups(e)},s.prototype.clear=function(t){(!t||t.items)&&this.setItems(null),(!t||t.groups)&&this.setGroups(null),(!t||t.options)&&(this.components.forEach(function(t){t.setOptions(t.defaultOptions)}),this.setOptions(this.defaultOptions))},s.prototype.fit=function(){var t=this.getItemRange(),e=t.min,i=t.max;if(null!=e&&null!=i){var s=i.valueOf()-e.valueOf();0>=s&&(s=864e5),e=new Date(e.valueOf()-.05*s),i=new Date(i.valueOf()+.05*s)}(null!==e||null!==i)&&this.range.setRange(e,i)},s.prototype.getItemRange=function(){var t=this.itemsData.getDataSet(),e=null,i=null;if(t){var s=t.min("start");e=s?r.convert(s.start,"Date").valueOf():null;var o=t.max("start");o&&(i=r.convert(o.start,"Date").valueOf());var n=t.max("end");n&&(i=null==i?r.convert(n.end,"Date").valueOf():Math.max(i,r.convert(n.end,"Date").valueOf()))}return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}},s.prototype.setSelection=function(t){this.itemSet&&this.itemSet.setSelection(t)},s.prototype.getSelection=function(){return this.itemSet&&this.itemSet.getSelection()||[]},s.prototype.setWindow=function(t,e){if(1==arguments.length){var i=arguments[0];this.range.setRange(i.start,i.end)}else this.range.setRange(t,e)},s.prototype.getWindow=function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}},s.prototype.redraw=function(){var t=!1,e=this.options,i=this.props,s=this.dom;if(s){s.root.className="vis timeline root "+e.orientation,s.root.style.maxHeight=r.option.asSize(e.maxHeight,""),s.root.style.minHeight=r.option.asSize(e.minHeight,""),s.root.style.width=r.option.asSize(e.width,""),i.border.left=(s.centerContainer.offsetWidth-s.centerContainer.clientWidth)/2,i.border.right=i.border.left,i.border.top=(s.centerContainer.offsetHeight-s.centerContainer.clientHeight)/2,i.border.bottom=i.border.top;var o=s.root.offsetHeight-s.root.clientHeight,n=s.root.offsetWidth-s.root.clientWidth;i.center.height=s.center.offsetHeight,i.left.height=s.left.offsetHeight,i.right.height=s.right.offsetHeight,i.top.height=s.top.clientHeight||-i.border.top,i.bottom.height=s.bottom.clientHeight||-i.border.bottom;var a=Math.max(i.left.height,i.center.height,i.right.height),h=i.top.height+a+i.bottom.height+o+i.border.top+i.border.bottom;s.root.style.height=r.option.asSize(e.height,h+"px"),i.root.height=s.root.offsetHeight,i.background.height=i.root.height-o;var d=i.root.height-i.top.height-i.bottom.height-o;i.centerContainer.height=d,i.leftContainer.height=d,i.rightContainer.height=i.leftContainer.height,i.root.width=s.root.offsetWidth,i.background.width=i.root.width-n,i.left.width=s.leftContainer.clientWidth||-i.border.left,i.leftContainer.width=i.left.width,i.right.width=s.rightContainer.clientWidth||-i.border.right,i.rightContainer.width=i.right.width;var l=i.root.width-i.left.width-i.right.width-n;i.center.width=l,i.centerContainer.width=l,i.top.width=l,i.bottom.width=l,s.background.style.height=i.background.height+"px",s.backgroundVertical.style.height=i.background.height+"px",s.backgroundHorizontal.style.height=i.centerContainer.height+"px",s.centerContainer.style.height=i.centerContainer.height+"px",s.leftContainer.style.height=i.leftContainer.height+"px",s.rightContainer.style.height=i.rightContainer.height+"px",s.background.style.width=i.background.width+"px",s.backgroundVertical.style.width=i.centerContainer.width+"px",s.backgroundHorizontal.style.width=i.background.width+"px",s.centerContainer.style.width=i.center.width+"px",s.top.style.width=i.top.width+"px",s.bottom.style.width=i.bottom.width+"px",s.background.style.left="0",s.background.style.top="0",s.backgroundVertical.style.left=i.left.width+"px",s.backgroundVertical.style.top="0",s.backgroundHorizontal.style.left="0",s.backgroundHorizontal.style.top=i.top.height+"px",s.centerContainer.style.left=i.left.width+"px",s.centerContainer.style.top=i.top.height+"px",s.leftContainer.style.left="0",s.leftContainer.style.top=i.top.height+"px",s.rightContainer.style.left=i.left.width+i.center.width+"px",s.rightContainer.style.top=i.top.height+"px",s.top.style.left=i.left.width+"px",s.top.style.top="0",s.bottom.style.left=i.left.width+"px",s.bottom.style.top=i.top.height+i.centerContainer.height+"px",this._updateScrollTop();var c=this.props.scrollTop;"bottom"==e.orientation&&(c+=Math.max(this.props.centerContainer.height-this.props.center.height-this.props.border.top-this.props.border.bottom,0)),s.center.style.left="0",s.center.style.top=c+"px",s.left.style.left="0",s.left.style.top=c+"px",s.right.style.left="0",s.right.style.top=c+"px";var p=0==this.props.scrollTop?"hidden":"",u=this.props.scrollTop==this.props.scrollTopMin?"hidden":"";s.shadowTop.style.visibility=p,s.shadowBottom.style.visibility=u,s.shadowTopLeft.style.visibility=p,s.shadowBottomLeft.style.visibility=u,s.shadowTopRight.style.visibility=p,s.shadowBottomRight.style.visibility=u,this.components.forEach(function(e){t=e.redraw()||t}),t&&this.redraw()}},s.prototype.repaint=function(){throw new Error("Function repaint is deprecated. Use redraw instead.")},s.prototype._toTime=function(t){var e=this.range.conversion(this.props.center.width);return new Date(t/e.scale+e.offset)},s.prototype._toGlobalTime=function(t){var e=this.range.conversion(this.props.root.width);return new Date(t/e.scale+e.offset)},s.prototype._toScreen=function(t){var e=this.range.conversion(this.props.center.width);return(t.valueOf()-e.offset)*e.scale},s.prototype._toGlobalScreen=function(t){var e=this.range.conversion(this.props.root.width);return(t.valueOf()-e.offset)*e.scale},s.prototype._initAutoResize=function(){1==this.options.autoResize?this._startAutoResize():this._stopAutoResize()},s.prototype._startAutoResize=function(){var t=this;this._stopAutoResize(),this._onResize=function(){return 1!=t.options.autoResize?void t._stopAutoResize():void(t.dom.root&&(t.dom.root.clientWidth!=t.props.lastWidth||t.dom.root.clientHeight!=t.props.lastHeight)&&(t.props.lastWidth=t.dom.root.clientWidth,t.props.lastHeight=t.dom.root.clientHeight,t.emit("change")))},r.addEventListener(window,"resize",this._onResize),this.watchTimer=setInterval(this._onResize,1e3)},s.prototype._stopAutoResize=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0),r.removeEventListener(window,"resize",this._onResize),this._onResize=null},s.prototype._onTouch=function(){this.touch.allowDragging=!0},s.prototype._onPinch=function(){this.touch.allowDragging=!1},s.prototype._onDragStart=function(){this.touch.initialScrollTop=this.props.scrollTop},s.prototype._onDrag=function(t){if(this.touch.allowDragging){var e=t.gesture.deltaY,i=this._getScrollTop(),s=this._setScrollTop(this.touch.initialScrollTop+e);s!=i&&this.redraw()}},s.prototype._setScrollTop=function(t){return this.props.scrollTop=t,this._updateScrollTop(),this.props.scrollTop},s.prototype._updateScrollTop=function(){var t=Math.min(this.props.centerContainer.height-this.props.center.height,0);return t!=this.props.scrollTopMin&&("bottom"==this.options.orientation&&(this.props.scrollTop+=t-this.props.scrollTopMin),this.props.scrollTopMin=t),this.props.scrollTop>0&&(this.props.scrollTop=0),this.props.scrollTop=s&&(s=864e5),e=new Date(e.valueOf()-.05*s),i=new Date(i.valueOf()+.05*s)}(null!==e||null!==i)&&this.range.setRange(e,i)},s.prototype.getItemRange=function(){var t=this.itemsData,e=null,i=null;if(t){var s=t.min("start");e=s?r.convert(s.start,"Date").valueOf():null;var o=t.max("start");o&&(i=r.convert(o.start,"Date").valueOf());var n=t.max("end");n&&(i=null==i?r.convert(n.end,"Date").valueOf():Math.max(i,r.convert(n.end,"Date").valueOf()))}return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}},s.prototype.setWindow=function(t,e){if(1==arguments.length){var i=arguments[0];this.range.setRange(i.start,i.end)}else this.range.setRange(t,e)},s.prototype.getWindow=function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}},s.prototype.redraw=function(){var t=!1,e=this.options,i=this.props,s=this.dom;if(s){s.root.className="vis timeline root "+e.orientation,s.root.style.maxHeight=r.option.asSize(e.maxHeight,""),s.root.style.minHeight=r.option.asSize(e.minHeight,""),s.root.style.width=r.option.asSize(e.width,""),i.border.left=(s.centerContainer.offsetWidth-s.centerContainer.clientWidth)/2,i.border.right=i.border.left,i.border.top=(s.centerContainer.offsetHeight-s.centerContainer.clientHeight)/2,i.border.bottom=i.border.top;var o=s.root.offsetHeight-s.root.clientHeight,n=s.root.offsetWidth-s.root.clientWidth;i.center.height=s.center.offsetHeight,i.left.height=s.left.offsetHeight,i.right.height=s.right.offsetHeight,i.top.height=s.top.clientHeight||-i.border.top,i.bottom.height=s.bottom.clientHeight||-i.border.bottom;var a=Math.max(i.left.height,i.center.height,i.right.height),h=i.top.height+a+i.bottom.height+o+i.border.top+i.border.bottom;s.root.style.height=r.option.asSize(e.height,h+"px"),i.root.height=s.root.offsetHeight,i.background.height=i.root.height-o;var d=i.root.height-i.top.height-i.bottom.height-o;i.centerContainer.height=d,i.leftContainer.height=d,i.rightContainer.height=i.leftContainer.height,i.root.width=s.root.offsetWidth,i.background.width=i.root.width-n,i.left.width=s.leftContainer.clientWidth||-i.border.left,i.leftContainer.width=i.left.width,i.right.width=s.rightContainer.clientWidth||-i.border.right,i.rightContainer.width=i.right.width;var l=i.root.width-i.left.width-i.right.width-n;i.center.width=l,i.centerContainer.width=l,i.top.width=l,i.bottom.width=l,s.background.style.height=i.background.height+"px",s.backgroundVertical.style.height=i.background.height+"px",s.backgroundHorizontalContainer.style.height=i.centerContainer.height+"px",s.centerContainer.style.height=i.centerContainer.height+"px",s.leftContainer.style.height=i.leftContainer.height+"px",s.rightContainer.style.height=i.rightContainer.height+"px",s.background.style.width=i.background.width+"px",s.backgroundVertical.style.width=i.centerContainer.width+"px",s.backgroundHorizontalContainer.style.width=i.background.width+"px",s.backgroundHorizontal.style.width=i.background.width+"px",s.centerContainer.style.width=i.center.width+"px",s.top.style.width=i.top.width+"px",s.bottom.style.width=i.bottom.width+"px",s.background.style.left="0",s.background.style.top="0",s.backgroundVertical.style.left=i.left.width+"px",s.backgroundVertical.style.top="0",s.backgroundHorizontalContainer.style.left="0",s.backgroundHorizontalContainer.style.top=i.top.height+"px",s.centerContainer.style.left=i.left.width+"px",s.centerContainer.style.top=i.top.height+"px",s.leftContainer.style.left="0",s.leftContainer.style.top=i.top.height+"px",s.rightContainer.style.left=i.left.width+i.center.width+"px",s.rightContainer.style.top=i.top.height+"px",s.top.style.left=i.left.width+"px",s.top.style.top="0",s.bottom.style.left=i.left.width+"px",s.bottom.style.top=i.top.height+i.centerContainer.height+"px",this._updateScrollTop();var c=this.props.scrollTop;"bottom"==e.orientation&&(c+=Math.max(this.props.centerContainer.height-this.props.center.height-this.props.border.top-this.props.border.bottom,0)),s.center.style.left="0",s.center.style.top=c+"px",s.backgroundHorizontal.style.left="0",s.backgroundHorizontal.style.top=c+"px",s.left.style.left="0",s.left.style.top=c+"px",s.right.style.left="0",s.right.style.top=c+"px";var p=0==this.props.scrollTop?"hidden":"",u=this.props.scrollTop==this.props.scrollTopMin?"hidden":"";s.shadowTop.style.visibility=p,s.shadowBottom.style.visibility=u,s.shadowTopLeft.style.visibility=p,s.shadowBottomLeft.style.visibility=u,s.shadowTopRight.style.visibility=p,s.shadowBottomRight.style.visibility=u,this.components.forEach(function(e){t=e.redraw()||t}),t&&this.redraw()}},s.prototype._toTime=function(t){var e=this.range.conversion(this.props.center.width);return new Date(t/e.scale+e.offset)},s.prototype._toGlobalTime=function(t){var e=this.range.conversion(this.props.root.width);return new Date(t/e.scale+e.offset)},s.prototype._toScreen=function(t){var e=this.range.conversion(this.props.center.width);return(t.valueOf()-e.offset)*e.scale},s.prototype._toGlobalScreen=function(t){var e=this.range.conversion(this.props.root.width);return(t.valueOf()-e.offset)*e.scale},s.prototype._initAutoResize=function(){1==this.options.autoResize?this._startAutoResize():this._stopAutoResize()},s.prototype._startAutoResize=function(){var t=this;this._stopAutoResize(),this._onResize=function(){return 1!=t.options.autoResize?void t._stopAutoResize():void(t.dom.root&&(t.dom.root.clientWidth!=t.props.lastWidth||t.dom.root.clientHeight!=t.props.lastHeight)&&(t.props.lastWidth=t.dom.root.clientWidth,t.props.lastHeight=t.dom.root.clientHeight,t.emit("change")))},r.addEventListener(window,"resize",this._onResize),this.watchTimer=setInterval(this._onResize,1e3)},s.prototype._stopAutoResize=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0),r.removeEventListener(window,"resize",this._onResize),this._onResize=null},s.prototype._onTouch=function(){this.touch.allowDragging=!0},s.prototype._onPinch=function(){this.touch.allowDragging=!1},s.prototype._onDragStart=function(){this.touch.initialScrollTop=this.props.scrollTop},s.prototype._onDrag=function(t){if(this.touch.allowDragging){var e=t.gesture.deltaY,i=this._getScrollTop(),s=this._setScrollTop(this.touch.initialScrollTop+e);s!=i&&this.redraw()}},s.prototype._setScrollTop=function(t){return this.props.scrollTop=t,this._updateScrollTop(),this.props.scrollTop},s.prototype._updateScrollTop=function(){var t=Math.min(this.props.centerContainer.height-this.props.center.height,0);return t!=this.props.scrollTopMin&&("bottom"==this.options.orientation&&(this.props.scrollTop+=t-this.props.scrollTopMin),this.props.scrollTopMin=t),this.props.scrollTop>0&&(this.props.scrollTop=0),this.props.scrollTopn&&(h=n);for(var d=!1,l=h;Math.abs(l)<=Math.abs(n);l++){a=Math.pow(10,l);for(var c=0;c=o){d=!0,r=c;break}}if(1==d)break}this.stepIndex=r,this.scale=a,this.step=a*this.minorSteps[r]},e.prototype.first=function(){this.setFirst()},e.prototype.setFirst=function(){var t=this._start-this.scale*this.minorSteps[this.stepIndex],e=this._end+this.scale*this.minorSteps[this.stepIndex];this.marginEnd=this.roundToMinor(e),this.marginStart=this.roundToMinor(t),this.marginRange=this.marginEnd-this.marginStart,this.current=this.marginEnd},e.prototype.roundToMinor=function(t){var e=t-t%(this.scale*this.minorSteps[this.stepIndex]);return t%(this.scale*this.minorSteps[this.stepIndex])>.5*this.scale*this.minorSteps[this.stepIndex]?e+this.scale*this.minorSteps[this.stepIndex]:e},e.prototype.hasNext=function(){return this.current>=this.marginStart},e.prototype.next=function(){var t=this.current;this.current-=this.step,this.current==t&&(this.current=this._end)},e.prototype.previous=function(){this.current+=this.step,this.marginEnd+=this.step,this.marginRange=this.marginEnd-this.marginStart},e.prototype.getCurrent=function(){for(var t=""+Number(this.current).toPrecision(5),e=t.length-1;e>0;e--){if("0"!=t[e]){if("."==t[e]||","==t[e]){t=t.slice(0,e);break}break}t=t.slice(0,e)}return t},e.prototype.snap=function(){},e.prototype.isMajor=function(){return this.current%(this.scale*this.majorSteps[this.stepIndex])==0},t.exports=e},function(t,e,i){function s(t,e){var i=h().hours(0).minutes(0).seconds(0).milliseconds(0);this.start=i.clone().add("days",-3).valueOf(),this.end=i.clone().add("days",4).valueOf(),this.body=t,this.defaultOptions={start:null,end:null,direction:"horizontal",moveable:!0,zoomable:!0,min:null,max:null,zoomMin:10,zoomMax:31536e10},this.options=r.extend({},this.defaultOptions),this.props={touch:{}},this.body.emitter.on("dragstart",this._onDragStart.bind(this)),this.body.emitter.on("drag",this._onDrag.bind(this)),this.body.emitter.on("dragend",this._onDragEnd.bind(this)),this.body.emitter.on("hold",this._onHold.bind(this)),this.body.emitter.on("mousewheel",this._onMouseWheel.bind(this)),this.body.emitter.on("DOMMouseScroll",this._onMouseWheel.bind(this)),this.body.emitter.on("touch",this._onTouch.bind(this)),this.body.emitter.on("pinch",this._onPinch.bind(this)),this.setOptions(e)}function o(t){if("horizontal"!=t&&"vertical"!=t)throw new TypeError('Unknown direction "'+t+'". Choose "horizontal" or "vertical".')}function n(t,e){return{x:t.pageX-r.getAbsoluteLeft(e),y:t.pageY-r.getAbsoluteTop(e)}}var r=i(1),a=i(42),h=i(40),d=i(18);s.prototype=new d,s.prototype.setOptions=function(t){if(t){var e=["direction","min","max","zoomMin","zoomMax","moveable","zoomable"];r.selectiveExtend(e,this.options,t),("start"in t||"end"in t)&&this.setRange(t.start,t.end)}},s.prototype.setRange=function(t,e){var i=this._applyRange(t,e);if(i){var s={start:new Date(this.start),end:new Date(this.end)};this.body.emitter.emit("rangechange",s),this.body.emitter.emit("rangechanged",s)}},s.prototype._applyRange=function(t,e){var i,s=null!=t?r.convert(t,"Date").valueOf():this.start,o=null!=e?r.convert(e,"Date").valueOf():this.end,n=null!=this.options.max?r.convert(this.options.max,"Date").valueOf():null,a=null!=this.options.min?r.convert(this.options.min,"Date").valueOf():null;if(isNaN(s)||null===s)throw new Error('Invalid start "'+t+'"');if(isNaN(o)||null===o)throw new Error('Invalid end "'+e+'"');if(s>o&&(o=s),null!==a&&a>s&&(i=a-s,s+=i,o+=i,null!=n&&o>n&&(o=n)),null!==n&&o>n&&(i=o-n,s-=i,o-=i,null!=a&&a>s&&(s=a)),null!==this.options.zoomMin){var h=parseFloat(this.options.zoomMin);0>h&&(h=0),h>o-s&&(this.end-this.start===h?(s=this.start,o=this.end):(i=h-(o-s),s-=i/2,o+=i/2))}if(null!==this.options.zoomMax){var d=parseFloat(this.options.zoomMax);0>d&&(d=0),o-s>d&&(this.end-this.start===d?(s=this.start,o=this.end):(i=o-s-d,s+=i/2,o-=i/2))}var l=this.start!=s||this.end!=o;return this.start=s,this.end=o,l},s.prototype.getRange=function(){return{start:this.start,end:this.end}},s.prototype.conversion=function(t){return s.conversion(this.start,this.end,t)},s.conversion=function(t,e,i){return 0!=i&&e-t!=0?{offset:t,scale:i/(e-t)}:{offset:0,scale:1}},s.prototype._onDragStart=function(){this.options.moveable&&this.props.touch.allowDragging&&(this.props.touch.start=this.start,this.props.touch.end=this.end,this.body.dom.root&&(this.body.dom.root.style.cursor="move"))},s.prototype._onDrag=function(t){if(this.options.moveable){var e=this.options.direction;if(o(e),this.props.touch.allowDragging){var i="horizontal"==e?t.gesture.deltaX:t.gesture.deltaY,s=this.props.touch.end-this.props.touch.start,n="horizontal"==e?this.body.domProps.center.width:this.body.domProps.center.height,r=-i/n*s;this._applyRange(this.props.touch.start+r,this.props.touch.end+r),this.body.emitter.emit("rangechange",{start:new Date(this.start),end:new Date(this.end)})}}},s.prototype._onDragEnd=function(){this.options.moveable&&this.props.touch.allowDragging&&(this.body.dom.root&&(this.body.dom.root.style.cursor="auto"),this.body.emitter.emit("rangechanged",{start:new Date(this.start),end:new Date(this.end)}))},s.prototype._onMouseWheel=function(t){if(this.options.zoomable&&this.options.moveable){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),e){var i;i=0>e?1-e/5:1/(1+e/5);var s=a.fakeGesture(this,t),o=n(s.center,this.body.dom.center),r=this._pointerToDate(o);this.zoom(i,r)}t.preventDefault()}},s.prototype._onTouch=function(){this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.allowDragging=!0,this.props.touch.center=null},s.prototype._onHold=function(){this.props.touch.allowDragging=!1},s.prototype._onPinch=function(t){if(this.options.zoomable&&this.options.moveable&&(this.props.touch.allowDragging=!1,t.gesture.touches.length>1)){this.props.touch.center||(this.props.touch.center=n(t.gesture.center,this.body.dom.center));var e=1/t.gesture.scale,i=this._pointerToDate(this.props.touch.center),s=parseInt(i+(this.props.touch.start-i)*e),o=parseInt(i+(this.props.touch.end-i)*e);this.setRange(s,o)}},s.prototype._pointerToDate=function(t){var e,i=this.options.direction;if(o(i),"horizontal"==i){var s=this.body.domProps.center.width;return e=this.conversion(s),t.x/e.scale+e.offset}var n=this.body.domProps.center.height;return e=this.conversion(n),t.y/e.scale+e.offset},s.prototype.zoom=function(t,e){null==e&&(e=(this.start+this.end)/2);var i=e+(this.start-e)*t,s=e+(this.end-e)*t;this.setRange(i,s)},s.prototype.move=function(t){var e=this.end-this.start,i=this.start+e*t,s=this.end+e*t;this.start=i,this.end=s},s.prototype.moveTo=function(t){var e=(this.start+this.end)/2,i=e-t,s=this.start-i,o=this.end-i;this.setRange(s,o)},t.exports=s},function(t,e){var i=.001;e.orderByStart=function(t){t.sort(function(t,e){return t.data.start-e.data.start})},e.orderByEnd=function(t){t.sort(function(t,e){var i="end"in t.data?t.data.end:t.data.start,s="end"in e.data?e.data.end:e.data.start;return i-s})},e.stack=function(t,i,s){var o,n;if(s)for(o=0,n=t.length;n>o;o++)t[o].top=null;for(o=0,n=t.length;n>o;o++){var r=t[o];if(null===r.top){r.top=i.axis;do{for(var a=null,h=0,d=t.length;d>h;h++){var l=t[h];if(null!==l.top&&l!==r&&e.collision(r,l,i.item)){a=l;break}}null!=a&&(r.top=a.top+a.height+i.item.vertical)}while(a)}}},e.nostack=function(t,e){var i,s;for(i=0,s=t.length;s>i;i++)t[i].top=e.axis},e.collision=function(t,e,s){return t.left-s.horizontal+ie.left&&t.top-s.vertical+ie.top}},function(t,e,i){function s(t,e,i){this.current=new Date,this._start=new Date,this._end=new Date,this.autoScale=!0,this.scale=s.SCALE.DAY,this.step=1,this.setRange(t,e,i)}var o=i(40);s.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,WEEKDAY:6,MONTH:7,YEAR:8},s.prototype.setRange=function(t,e,i){if(!(t instanceof Date&&e instanceof Date))throw"No legal start or end date in method setRange";this._start=void 0!=t?new Date(t.valueOf()):new Date,this._end=void 0!=e?new Date(e.valueOf()):new Date,this.autoScale&&this.setMinimumStep(i)},s.prototype.first=function(){this.current=new Date(this._start.valueOf()),this.roundToMinor()},s.prototype.roundToMinor=function(){switch(this.scale){case s.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step)),this.current.setMonth(0);case s.SCALE.MONTH:this.current.setDate(1);case s.SCALE.DAY:case s.SCALE.WEEKDAY:this.current.setHours(0);case s.SCALE.HOUR:this.current.setMinutes(0);case s.SCALE.MINUTE:this.current.setSeconds(0);case s.SCALE.SECOND:this.current.setMilliseconds(0)}if(1!=this.step)switch(this.scale){case s.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case s.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case s.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case s.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case s.SCALE.WEEKDAY:case s.SCALE.DAY:this.current.setDate(this.current.getDate()-1-(this.current.getDate()-1)%this.step+1);break;case s.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case s.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step)}},s.prototype.hasNext=function(){return this.current.valueOf()<=this._end.valueOf()},s.prototype.next=function(){var t=this.current.valueOf();if(this.current.getMonth()<6)switch(this.scale){case s.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case s.SCALE.SECOND:this.current=new Date(this.current.valueOf()+1e3*this.step);break;case s.SCALE.MINUTE:this.current=new Date(this.current.valueOf()+1e3*this.step*60);break;case s.SCALE.HOUR:this.current=new Date(this.current.valueOf()+1e3*this.step*60*60);var e=this.current.getHours();this.current.setHours(e-e%this.step);break;case s.SCALE.WEEKDAY:case s.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case s.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case s.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}else switch(this.scale){case s.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case s.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case s.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case s.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case s.SCALE.WEEKDAY:case s.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case s.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case s.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}if(1!=this.step)switch(this.scale){case s.SCALE.MILLISECOND:this.current.getMilliseconds()0&&(this.step=e),this.autoScale=!1},s.prototype.setAutoScale=function(t){this.autoScale=t},s.prototype.setMinimumStep=function(t){if(void 0!=t){var e=31104e6,i=2592e6,o=864e5,n=36e5,r=6e4,a=1e3,h=1;1e3*e>t&&(this.scale=s.SCALE.YEAR,this.step=1e3),500*e>t&&(this.scale=s.SCALE.YEAR,this.step=500),100*e>t&&(this.scale=s.SCALE.YEAR,this.step=100),50*e>t&&(this.scale=s.SCALE.YEAR,this.step=50),10*e>t&&(this.scale=s.SCALE.YEAR,this.step=10),5*e>t&&(this.scale=s.SCALE.YEAR,this.step=5),e>t&&(this.scale=s.SCALE.YEAR,this.step=1),3*i>t&&(this.scale=s.SCALE.MONTH,this.step=3),i>t&&(this.scale=s.SCALE.MONTH,this.step=1),5*o>t&&(this.scale=s.SCALE.DAY,this.step=5),2*o>t&&(this.scale=s.SCALE.DAY,this.step=2),o>t&&(this.scale=s.SCALE.DAY,this.step=1),o/2>t&&(this.scale=s.SCALE.WEEKDAY,this.step=1),4*n>t&&(this.scale=s.SCALE.HOUR,this.step=4),n>t&&(this.scale=s.SCALE.HOUR,this.step=1),15*r>t&&(this.scale=s.SCALE.MINUTE,this.step=15),10*r>t&&(this.scale=s.SCALE.MINUTE,this.step=10),5*r>t&&(this.scale=s.SCALE.MINUTE,this.step=5),r>t&&(this.scale=s.SCALE.MINUTE,this.step=1),15*a>t&&(this.scale=s.SCALE.SECOND,this.step=15),10*a>t&&(this.scale=s.SCALE.SECOND,this.step=10),5*a>t&&(this.scale=s.SCALE.SECOND,this.step=5),a>t&&(this.scale=s.SCALE.SECOND,this.step=1),200*h>t&&(this.scale=s.SCALE.MILLISECOND,this.step=200),100*h>t&&(this.scale=s.SCALE.MILLISECOND,this.step=100),50*h>t&&(this.scale=s.SCALE.MILLISECOND,this.step=50),10*h>t&&(this.scale=s.SCALE.MILLISECOND,this.step=10),5*h>t&&(this.scale=s.SCALE.MILLISECOND,this.step=5),h>t&&(this.scale=s.SCALE.MILLISECOND,this.step=1)}},s.prototype.snap=function(t){var e=new Date(t.valueOf());if(this.scale==s.SCALE.YEAR){var i=e.getFullYear()+Math.round(e.getMonth()/12);e.setFullYear(Math.round(i/this.step)*this.step),e.setMonth(0),e.setDate(0),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==s.SCALE.MONTH)e.getDate()>15?(e.setDate(1),e.setMonth(e.getMonth()+1)):e.setDate(1),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);else if(this.scale==s.SCALE.DAY){switch(this.step){case 5:case 2:e.setHours(24*Math.round(e.getHours()/24));break;default:e.setHours(12*Math.round(e.getHours()/12))}e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==s.SCALE.WEEKDAY){switch(this.step){case 5:case 2:e.setHours(12*Math.round(e.getHours()/12));break;default:e.setHours(6*Math.round(e.getHours()/6))}e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==s.SCALE.HOUR){switch(this.step){case 4:e.setMinutes(60*Math.round(e.getMinutes()/60));break;default:e.setMinutes(30*Math.round(e.getMinutes()/30))}e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==s.SCALE.MINUTE){switch(this.step){case 15:case 10:e.setMinutes(5*Math.round(e.getMinutes()/5)),e.setSeconds(0);break;case 5:e.setSeconds(60*Math.round(e.getSeconds()/60));break;default:e.setSeconds(30*Math.round(e.getSeconds()/30))}e.setMilliseconds(0)}else if(this.scale==s.SCALE.SECOND)switch(this.step){case 15:case 10:e.setSeconds(5*Math.round(e.getSeconds()/5)),e.setMilliseconds(0);break;case 5:e.setMilliseconds(1e3*Math.round(e.getMilliseconds()/1e3));break;default:e.setMilliseconds(500*Math.round(e.getMilliseconds()/500))}else if(this.scale==s.SCALE.MILLISECOND){var o=this.step>5?this.step/2:1;e.setMilliseconds(Math.round(e.getMilliseconds()/o)*o)}return e},s.prototype.isMajor=function(){switch(this.scale){case s.SCALE.MILLISECOND:return 0==this.current.getMilliseconds();case s.SCALE.SECOND:return 0==this.current.getSeconds();case s.SCALE.MINUTE:return 0==this.current.getHours()&&0==this.current.getMinutes();case s.SCALE.HOUR:return 0==this.current.getHours();case s.SCALE.WEEKDAY:case s.SCALE.DAY:return 1==this.current.getDate();case s.SCALE.MONTH:return 0==this.current.getMonth();case s.SCALE.YEAR:return!1;default:return!1}},s.prototype.getLabelMinor=function(t){switch(void 0==t&&(t=this.current),this.scale){case s.SCALE.MILLISECOND:return o(t).format("SSS");case s.SCALE.SECOND:return o(t).format("s");case s.SCALE.MINUTE:return o(t).format("HH:mm");case s.SCALE.HOUR:return o(t).format("HH:mm");case s.SCALE.WEEKDAY:return o(t).format("ddd D");case s.SCALE.DAY:return o(t).format("D");case s.SCALE.MONTH:return o(t).format("MMM");case s.SCALE.YEAR:return o(t).format("YYYY");default:return""}},s.prototype.getLabelMajor=function(t){switch(void 0==t&&(t=this.current),this.scale){case s.SCALE.MILLISECOND:return o(t).format("HH:mm:ss");case s.SCALE.SECOND:return o(t).format("D MMMM HH:mm");case s.SCALE.MINUTE:case s.SCALE.HOUR:return o(t).format("ddd D MMMM");case s.SCALE.WEEKDAY:case s.SCALE.DAY:return o(t).format("MMMM YYYY");case s.SCALE.MONTH:return o(t).format("YYYY");case s.SCALE.YEAR:return"";default:return""}},t.exports=s},function(t){function e(){this.options=null,this.props=null}e.prototype.setOptions=function(t){t&&util.extend(this.options,t)},e.prototype.redraw=function(){return!1},e.prototype.destroy=function(){},e.prototype._isResized=function(){var t=this.props._previousWidth!==this.props.width||this.props._previousHeight!==this.props.height;return this.props._previousWidth=this.props.width,this.props._previousHeight=this.props.height,t},t.exports=e},function(t,e,i){function s(t,e){this.body=t,this.defaultOptions={showCurrentTime:!0},this.options=o.extend({},this.defaultOptions),this._create(),this.setOptions(e)}var o=i(1),n=i(18);s.prototype=new n,s.prototype._create=function(){var t=document.createElement("div");t.className="currenttime",t.style.position="absolute",t.style.top="0px",t.style.height="100%",this.bar=t},s.prototype.destroy=function(){this.options.showCurrentTime=!1,this.redraw(),this.body=null},s.prototype.setOptions=function(t){t&&o.selectiveExtend(["showCurrentTime"],this.options,t)},s.prototype.redraw=function(){if(this.options.showCurrentTime){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar),this.start());var e=new Date,i=this.body.util.toScreen(e);this.bar.style.left=i+"px",this.bar.title="Current time: "+e}else this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),this.stop();return!1},s.prototype.start=function(){function t(){e.stop();var i=e.body.range.conversion(e.body.domProps.center.width).scale,s=1/i/10;30>s&&(s=30),s>1e3&&(s=1e3),e.redraw(),e.currentTimeTimer=setTimeout(t,s)}var e=this;t()},s.prototype.stop=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer)},t.exports=s},function(t,e,i){function s(t,e){this.body=t,this.defaultOptions={showCustomTime:!1},this.options=n.extend({},this.defaultOptions),this.customTime=new Date,this.eventParams={},this._create(),this.setOptions(e)}var o=i(41),n=i(1),r=i(18);s.prototype=new r,s.prototype.setOptions=function(t){t&&n.selectiveExtend(["showCustomTime"],this.options,t)},s.prototype._create=function(){var t=document.createElement("div");t.className="customtime",t.style.position="absolute",t.style.top="0px",t.style.height="100%",this.bar=t;var e=document.createElement("div");e.style.position="relative",e.style.top="0px",e.style.left="-10px",e.style.height="100%",e.style.width="20px",t.appendChild(e),this.hammer=o(t,{prevent_default:!0}),this.hammer.on("dragstart",this._onDragStart.bind(this)),this.hammer.on("drag",this._onDrag.bind(this)),this.hammer.on("dragend",this._onDragEnd.bind(this))},s.prototype.destroy=function(){this.options.showCustomTime=!1,this.redraw(),this.hammer.enable(!1),this.hammer=null,this.body=null},s.prototype.redraw=function(){if(this.options.showCustomTime){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar));var e=this.body.util.toScreen(this.customTime);this.bar.style.left=e+"px",this.bar.title="Time: "+this.customTime}else this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar);return!1},s.prototype.setCustomTime=function(t){this.customTime=new Date(t.valueOf()),this.redraw()},s.prototype.getCustomTime=function(){return new Date(this.customTime.valueOf())},s.prototype._onDragStart=function(t){this.eventParams.dragging=!0,this.eventParams.customTime=this.customTime,t.stopPropagation(),t.preventDefault()},s.prototype._onDrag=function(t){if(this.eventParams.dragging){var e=t.gesture.deltaX,i=this.body.util.toScreen(this.eventParams.customTime)+e,s=this.body.util.toTime(i);this.setCustomTime(s),this.body.emitter.emit("timechange",{time:new Date(this.customTime.valueOf())}),t.stopPropagation(),t.preventDefault()}},s.prototype._onDragEnd=function(t){this.eventParams.dragging&&(this.body.emitter.emit("timechanged",{time:new Date(this.customTime.valueOf())}),t.stopPropagation(),t.preventDefault())},t.exports=s},function(t,e,i){function s(t,e,i){this.id=o.randomUUID(),this.body=t,this.defaultOptions={orientation:"left",showMinorLabels:!0,showMajorLabels:!0,icons:!0,majorLinesOffset:7,minorLinesOffset:4,labelOffsetX:10,labelOffsetY:2,iconWidth:20,width:"40px",visible:!0},this.linegraphSVG=i,this.props={},this.DOMelements={lines:{},labels:{}},this.dom={},this.range={start:0,end:0},this.options=o.extend({},this.defaultOptions),this.conversionFactor=1,this.setOptions(e),this.width=Number((""+this.options.width).replace("px","")),this.minWidth=this.width,this.height=this.linegraphSVG.offsetHeight,this.stepPixels=25,this.stepPixelsForced=25,this.lineOffset=0,this.master=!0,this.svgElements={},this.groups={},this.amountOfGroups=0,this._create()}var o=i(1),n=i(2),r=i(18),a=i(14);s.prototype=new r,s.prototype.addGroup=function(t,e){this.groups.hasOwnProperty(t)||(this.groups[t]=e),this.amountOfGroups+=1},s.prototype.updateGroup=function(t,e){this.groups[t]=e},s.prototype.removeGroup=function(t){this.groups.hasOwnProperty(t)&&(delete this.groups[t],this.amountOfGroups-=1)},s.prototype.setOptions=function(t){if(t){var e=!1;this.options.orientation!=t.orientation&&void 0!==t.orientation&&(e=!0);var i=["orientation","showMinorLabels","showMajorLabels","icons","majorLinesOffset","minorLinesOffset","labelOffsetX","labelOffsetY","iconWidth","width","visible"];o.selectiveExtend(i,this.options,t),this.minWidth=Number((""+this.options.width).replace("px","")),1==e&&this.dom.frame&&(this.hide(),this.show())}},s.prototype._create=function(){this.dom.frame=document.createElement("div"),this.dom.frame.style.width=this.options.width,this.dom.frame.style.height=this.height,this.dom.lineContainer=document.createElement("div"),this.dom.lineContainer.style.width="100%",this.dom.lineContainer.style.height=this.height,this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0px",this.svg.style.height="100%",this.svg.style.width="100%",this.svg.style.display="block",this.dom.frame.appendChild(this.svg)},s.prototype._redrawGroupIcons=function(){n.prepareElements(this.svgElements);var t,e=this.options.iconWidth,i=15,s=4,o=s+.5*i;t="left"==this.options.orientation?s:this.width-e-s;for(var r in this.groups)this.groups.hasOwnProperty(r)&&(this.groups[r].drawIcon(t,o,this.svgElements,this.svg,e,i),o+=i+s);n.cleanupElements(this.svgElements)},s.prototype.show=function(){this.dom.frame.parentNode||("left"==this.options.orientation?this.body.dom.left.appendChild(this.dom.frame):this.body.dom.right.appendChild(this.dom.frame)),this.dom.lineContainer.parentNode||this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer)},s.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom.lineContainer.parentNode&&this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer)},s.prototype.setRange=function(t,e){this.range.start=t,this.range.end=e},s.prototype.redraw=function(){var t=!1;if(0==this.amountOfGroups)this.hide();else{this.show(),this.height=Number(this.linegraphSVG.style.height.replace("px","")),this.dom.lineContainer.style.height=this.height+"px",this.width=1==this.options.visible?Number((""+this.options.width).replace("px","")):0;var e=this.props,i=this.dom.frame;i.className="dataaxis",this._calculateCharSize();var s=this.options.orientation,o=this.options.showMinorLabels,n=this.options.showMajorLabels;e.minorLabelHeight=o?e.minorCharHeight:0,e.majorLabelHeight=n?e.majorCharHeight:0,e.minorLineWidth=this.body.dom.backgroundHorizontal.offsetWidth-this.lineOffset-this.width+2*this.options.minorLinesOffset,e.minorLineHeight=1,e.majorLineWidth=this.body.dom.backgroundHorizontal.offsetWidth-this.lineOffset-this.width+2*this.options.majorLinesOffset,e.majorLineHeight=1,"left"==s?(i.style.top="0",i.style.left="0",i.style.bottom="",i.style.width=this.width+"px",i.style.height=this.height+"px"):(i.style.top="",i.style.bottom="0",i.style.left="0",i.style.width=this.width+"px",i.style.height=this.height+"px"),t=this._redrawLabels(),1==this.options.icons&&this._redrawGroupIcons()}return t},s.prototype._redrawLabels=function(){n.prepareElements(this.DOMelements);var t=this.options.orientation,e=this.master?this.props.majorCharHeight||10:this.stepPixelsForced,i=new a(this.range.start,this.range.end,e,this.dom.frame.offsetHeight);this.step=i,i.first();var s=this.dom.frame.offsetHeight/(i.marginRange/i.step+1);this.stepPixels=s;var o=this.height/s,r=0;if(0==this.master){s=this.stepPixelsForced,r=Math.round(this.height/s-o);for(var h=0;.5*r>h;h++)i.previous();o=this.height/s}this.valueAtZero=i.marginEnd;var d=0,l=1;i.next(),this.maxLabelSize=0;for(var c=0;l=0&&this._redrawLabel(c-2,i.getCurrent(),t,"yAxis major",this.props.majorCharHeight),this._redrawLine(c,t,"grid horizontal major",this.options.majorLinesOffset,this.props.majorLineWidth)):this._redrawLine(c,t,"grid horizontal minor",this.options.minorLinesOffset,this.props.minorLineWidth),i.next(),l++}this.conversionFactor=d/((o-1)*i.step);var u=1==this.options.icons?this.options.iconWidth+this.options.labelOffsetX+15:this.options.labelOffsetX+15;return this.maxLabelSize>this.width-u&&1==this.options.visible?(this.width=this.maxLabelSize+u,this.options.width=this.width+"px",n.cleanupElements(this.DOMelements),this.redraw(),!0):this.maxLabelSizethis.minWidth?(this.width=Math.max(this.minWidth,this.maxLabelSize+u),this.options.width=this.width+"px",n.cleanupElements(this.DOMelements),this.redraw(),!0):(n.cleanupElements(this.DOMelements),!1)},s.prototype._redrawLabel=function(t,e,i,s,o){var r=n.getDOMElement("div",this.DOMelements,this.dom.frame);r.className=s,r.innerHTML=e,"left"==i?(r.style.left="-"+this.options.labelOffsetX+"px",r.style.textAlign="right"):(r.style.right="-"+this.options.labelOffsetX+"px",r.style.textAlign="left"),r.style.top=t-.5*o+this.options.labelOffsetY+"px",e+="";var a=Math.max(this.props.majorCharWidth,this.props.minorCharWidth);this.maxLabelSizee.axis){var c=d-e.axis;l-=c,o.forEach(h,function(t){t.top-=c})}a=l+e.item.vertical/2}else a=e.axis+e.item.vertical;a=Math.max(a,this.props.label.height);var p=this.dom.foreground;this.top=p.offsetTop,this.left=p.offsetLeft,this.width=p.offsetWidth,s=o.updateProperty(this,"height",a)||s,s=o.updateProperty(this.props.label,"width",this.dom.inner.clientWidth)||s,s=o.updateProperty(this.props.label,"height",this.dom.inner.clientHeight)||s,this.dom.background.style.height=a+"px",this.dom.foreground.style.height=a+"px",this.dom.label.style.height=a+"px";for(var u=0,m=this.visibleItems.length;m>u;u++){var g=this.visibleItems[u];g.repositionY()}return s},s.prototype.show=function(){this.dom.label.parentNode||this.itemSet.dom.labelSet.appendChild(this.dom.label),this.dom.foreground.parentNode||this.itemSet.dom.foreground.appendChild(this.dom.foreground),this.dom.background.parentNode||this.itemSet.dom.background.appendChild(this.dom.background),this.dom.axis.parentNode||this.itemSet.dom.axis.appendChild(this.dom.axis)},s.prototype.hide=function(){var t=this.dom.label;t.parentNode&&t.parentNode.removeChild(t);var e=this.dom.foreground;e.parentNode&&e.parentNode.removeChild(e);var i=this.dom.background;i.parentNode&&i.parentNode.removeChild(i);var s=this.dom.axis;s.parentNode&&s.parentNode.removeChild(s)},s.prototype.add=function(t){if(this.items[t.id]=t,t.setParent(this),t instanceof r&&-1==this.visibleItems.indexOf(t)){var e=this.itemSet.body.range;this._checkIfVisible(t,this.visibleItems,e)}},s.prototype.remove=function(t){delete this.items[t.id],t.setParent(this.itemSet);var e=this.visibleItems.indexOf(t);-1!=e&&this.visibleItems.splice(e,1)},s.prototype.removeFromDataSet=function(t){this.itemSet.removeItem(t.id)},s.prototype.order=function(){var t=o.toArray(this.items);this.orderedItems.byStart=t,this.orderedItems.byEnd=this._constructByEndArray(t),n.orderByStart(this.orderedItems.byStart),n.orderByEnd(this.orderedItems.byEnd)},s.prototype._constructByEndArray=function(t){for(var e=[],i=0;i0)for(n=0;n=0&&!this._checkIfInvisible(t.byStart[n],r,i);n--);for(n=s+1;n=0&&!this._checkIfInvisible(t.byEnd[n],r,i);n--);for(n=a+1;ne;e++)s=this.selection[e],o=this.items[s],o&&o.unselect();for(this.selection=[],e=0,i=t.length;i>e;e++)s=t[e],o=this.items[s],o&&(this.selection.push(s),o.select())}},s.prototype.getSelection=function(){return this.selection.concat([])},s.prototype.getVisibleItems=function(){var t=this.body.range.getRange(),e=this.body.util.toScreen(t.start),i=this.body.util.toScreen(t.end),s=[];for(var o in this.groups)if(this.groups.hasOwnProperty(o))for(var n=this.groups[o],r=n.visibleItems,a=0;ae&&s.push(h.id)}return s},s.prototype._deselect=function(t){for(var e=this.selection,i=0,s=e.length;s>i;i++)if(e[i]==t){e.splice(i,1);break}},s.prototype.redraw=function(){var t=this.options.margin,e=this.body.range,i=n.option.asSize,s=this.options,o=s.orientation,r=!1,a=this.dom.frame,h=s.editable.updateTime||s.editable.updateGroup;a.className="itemset"+(h?" editable":""),r=this._orderGroups()||r;var d=e.end-e.start,l=d!=this.lastVisibleInterval||this.props.width!=this.props.lastWidth;l&&(this.stackDirty=!0),this.lastVisibleInterval=d,this.props.lastWidth=this.props.width;var c=this.stackDirty,p=this._firstGroup(),u={item:t.item,axis:t.axis},m={item:t.item,axis:t.item.vertical/2},g=0,f=t.axis+t.item.vertical;return n.forEach(this.groups,function(t){var i=t==p?u:m,s=t.redraw(e,i,c);r=s||r,g+=t.height}),g=Math.max(g,f),this.stackDirty=!1,a.style.height=i(g),this.props.top=a.offsetTop,this.props.left=a.offsetLeft,this.props.width=a.offsetWidth,this.props.height=g,this.dom.axis.style.top=i("top"==o?this.body.domProps.top.height+this.body.domProps.border.top:this.body.domProps.top.height+this.body.domProps.centerContainer.height),this.dom.axis.style.left=this.body.domProps.border.left+"px",r=this._isResized()||r},s.prototype._firstGroup=function(){var t="top"==this.options.orientation?0:this.groupIds.length-1,e=this.groupIds[t],i=this.groups[e]||this.groups[u];return i||null},s.prototype._updateUngrouped=function(){var t=this.groups[u];if(this.groupsData)t&&(t.hide(),delete this.groups[u]);else if(!t){var e=null,i=null;t=new d(e,i,this),this.groups[u]=t;for(var s in this.items)this.items.hasOwnProperty(s)&&t.add(this.items[s]);t.show()}},s.prototype.getLabelSet=function(){return this.dom.labelSet},s.prototype.setItems=function(t){var e,i=this,s=this.itemsData;if(t){if(!(t instanceof r||t instanceof a))throw new TypeError("Data must be an instance of DataSet or DataView");this.itemsData=t}else this.itemsData=null;if(s&&(n.forEach(this.itemListeners,function(t,e){s.off(e,t)}),e=s.getIds(),this._onRemove(e)),this.itemsData){var o=this.id;n.forEach(this.itemListeners,function(t,e){i.itemsData.on(e,t,o)}),e=this.itemsData.getIds(),this._onAdd(e),this._updateUngrouped()}},s.prototype.getItems=function(){return this.itemsData},s.prototype.setGroups=function(t){var e,i=this;if(this.groupsData&&(n.forEach(this.groupListeners,function(t,e){i.groupsData.unsubscribe(e,t)}),e=this.groupsData.getIds(),this.groupsData=null,this._onRemoveGroups(e)),t){if(!(t instanceof r||t instanceof a))throw new TypeError("Data must be an instance of DataSet or DataView");this.groupsData=t}else this.groupsData=null;if(this.groupsData){var s=this.id;n.forEach(this.groupListeners,function(t,e){i.groupsData.on(e,t,s)}),e=this.groupsData.getIds(),this._onAddGroups(e)}this._updateUngrouped(),this._order(),this.body.emitter.emit("change")},s.prototype.getGroups=function(){return this.groupsData},s.prototype.removeItem=function(t){var e=this.itemsData.get(t),i=this.itemsData.getDataSet();e&&this.options.onRemove(e,function(e){e&&i.remove(t)})},s.prototype._onUpdate=function(t){var e=this;t.forEach(function(t){var i=e.itemsData.get(t,e.itemOptions),o=e.items[t],n=i.type||e.options.type||(i.end?"range":"box"),r=s.types[n];if(o&&(r&&o instanceof r?e._updateItem(o,i):(e._removeItem(o),o=null)),!o){if(!r)throw new TypeError("rangeoverflow"==n?'Item type "rangeoverflow" is deprecated. Use css styling instead: .vis.timeline .item.range .content {overflow: visible;}':'Unknown item type "'+n+'"');o=new r(i,e.conversion,e.options),o.id=t,e._addItem(o)}}),this._order(),this.stackDirty=!0,this.body.emitter.emit("change")},s.prototype._onAdd=s.prototype._onUpdate,s.prototype._onRemove=function(t){var e=0,i=this;t.forEach(function(t){var s=i.items[t];s&&(e++,i._removeItem(s))}),e&&(this._order(),this.stackDirty=!0,this.body.emitter.emit("change"))},s.prototype._order=function(){n.forEach(this.groups,function(t){t.order()})},s.prototype._onUpdateGroups=function(t){this._onAddGroups(t)},s.prototype._onAddGroups=function(t){var e=this;t.forEach(function(t){var i=e.groupsData.get(t),s=e.groups[t];if(s)s.setData(i);else{if(t==u)throw new Error("Illegal group id. "+t+" is a reserved id.");var o=Object.create(e.options);n.extend(o,{height:null}),s=new d(t,i,e),e.groups[t]=s;for(var r in e.items)if(e.items.hasOwnProperty(r)){var a=e.items[r];a.data.group==t&&s.add(a)}s.order(),s.show()}}),this.body.emitter.emit("change")},s.prototype._onRemoveGroups=function(t){var e=this.groups;t.forEach(function(t){var i=e[t];i&&(i.hide(),delete e[t])}),this.markDirty(),this.body.emitter.emit("change")},s.prototype._orderGroups=function(){if(this.groupsData){var t=this.groupsData.getIds({order:this.options.groupOrder}),e=!n.equalArray(t,this.groupIds);if(e){var i=this.groups;t.forEach(function(t){i[t].hide()}),t.forEach(function(t){i[t].show()}),this.groupIds=t}return e}return!1},s.prototype._addItem=function(t){this.items[t.id]=t;var e=this.groupsData?t.data.group:u,i=this.groups[e];i&&i.add(t)},s.prototype._updateItem=function(t,e){var i=t.data.group;if(t.data=e,t.displayed&&t.redraw(),i!=t.data.group){var s=this.groups[i];s&&s.remove(t);var o=this.groupsData?t.data.group:u,n=this.groups[o];n&&n.add(t)}},s.prototype._removeItem=function(t){t.hide(),delete this.items[t.id];var e=this.selection.indexOf(t.id);-1!=e&&this.selection.splice(e,1);var i=this.groupsData?t.data.group:u,s=this.groups[i];s&&s.remove(t)},s.prototype._constructByEndArray=function(t){for(var e=[],i=0;i0||o.length>0)&&this.body.emitter.emit("select",{items:this.getSelection()}),t.stopPropagation()}},s.prototype._onAddItem=function(t){if(this.options.selectable&&this.options.editable.add){var e=this,i=this.body.util.snap||null,o=s.itemFromTarget(t);if(o){var r=e.itemsData.get(o.id);this.options.onUpdate(r,function(t){t&&e.itemsData.update(t)})}else{var a=n.getAbsoluteLeft(this.dom.frame),h=t.gesture.center.pageX-a,d=this.body.util.toTime(h),l={start:i?i(d):d,content:"new item"};if("range"===this.options.type){var c=this.body.util.toTime(h+this.props.width/5);l.end=i?i(c):c}l[this.itemsData.fieldId]=n.randomUUID();var p=s.groupFromTarget(t);p&&(l.group=p.groupId),this.options.onAdd(l,function(t){t&&e.itemsData.add(l)})}}},s.prototype._onMultiSelectItem=function(t){if(this.options.selectable){var e,i=s.itemFromTarget(t);if(i){e=this.getSelection();var o=e.indexOf(i.id);-1==o?e.push(i.id):e.splice(o,1),this.setSelection(e),this.body.emitter.emit("select",{items:this.getSelection()}),t.stopPropagation()}}},s.itemFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("timeline-item"))return e["timeline-item"];e=e.parentNode}return null},s.groupFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("timeline-group"))return e["timeline-group"];e=e.parentNode}return null},s.itemSetFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("timeline-itemset"))return e["timeline-itemset"];e=e.parentNode}return null},t.exports=s},function(t,e,i){function s(t,e,i){this.body=t,this.defaultOptions={enabled:!0,icons:!0,iconSize:20,iconSpacing:6,left:{visible:!0,position:"top-left"},right:{visible:!0,position:"top-left"}},this.side=i,this.options=o.extend({},this.defaultOptions),this.svgElements={},this.dom={},this.groups={},this.amountOfGroups=0,this._create(),this.setOptions(e)}var o=i(1),n=i(2),r=i(18);s.prototype=new r,s.prototype.addGroup=function(t,e){this.groups.hasOwnProperty(t)||(this.groups[t]=e),this.amountOfGroups+=1},s.prototype.updateGroup=function(t,e){this.groups[t]=e},s.prototype.removeGroup=function(t){this.groups.hasOwnProperty(t)&&(delete this.groups[t],this.amountOfGroups-=1)},s.prototype._create=function(){this.dom.frame=document.createElement("div"),this.dom.frame.className="legend",this.dom.frame.style.position="absolute",this.dom.frame.style.top="10px",this.dom.frame.style.display="block",this.dom.textArea=document.createElement("div"),this.dom.textArea.className="legendText",this.dom.textArea.style.position="relative",this.dom.textArea.style.top="0px",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0px",this.svg.style.width=this.options.iconSize+5+"px",this.dom.frame.appendChild(this.svg),this.dom.frame.appendChild(this.dom.textArea)},s.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame)},s.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame)},s.prototype.setOptions=function(t){var e=["enabled","orientation","icons","left","right"];o.selectiveDeepExtend(e,this.options,t)},s.prototype.redraw=function(){if(0==this.options[this.side].visible||0==this.amountOfGroups||0==this.options.enabled)this.hide();else{this.show(),"top-left"==this.options[this.side].position||"bottom-left"==this.options[this.side].position?(this.dom.frame.style.left="4px",this.dom.frame.style.textAlign="left",this.dom.textArea.style.textAlign="left",this.dom.textArea.style.left=this.options.iconSize+15+"px",this.dom.textArea.style.right="",this.svg.style.left="0px",this.svg.style.right=""):(this.dom.frame.style.right="4px",this.dom.frame.style.textAlign="right",this.dom.textArea.style.textAlign="right",this.dom.textArea.style.right=this.options.iconSize+15+"px",this.dom.textArea.style.left="",this.svg.style.right="0px",this.svg.style.left=""),"top-left"==this.options[this.side].position||"top-right"==this.options[this.side].position?(this.dom.frame.style.top=4-Number(this.body.dom.center.style.top.replace("px",""))+"px",this.dom.frame.style.bottom=""):(this.dom.frame.style.bottom=4-Number(this.body.dom.center.style.top.replace("px",""))+"px",this.dom.frame.style.top=""),0==this.options.icons?(this.dom.frame.style.width=this.dom.textArea.offsetWidth+10+"px",this.dom.textArea.style.right="",this.dom.textArea.style.left="",this.svg.style.width="0px"):(this.dom.frame.style.width=this.options.iconSize+15+this.dom.textArea.offsetWidth+10+"px",this.drawLegendIcons());var t="";for(var e in this.groups)this.groups.hasOwnProperty(e)&&(t+=this.groups[e].content+"
");this.dom.textArea.innerHTML=t,this.dom.textArea.style.lineHeight=.75*this.options.iconSize+this.options.iconSpacing+"px"}},s.prototype.drawLegendIcons=function(){if(this.dom.frame.parentNode){n.prepareElements(this.svgElements);var t=window.getComputedStyle(this.dom.frame).paddingTop,e=Number(t.replace("px","")),i=e,s=this.options.iconSize,o=.75*this.options.iconSize,r=e+.5*o+3;this.svg.style.width=s+5+e+"px";for(var a in this.groups)this.groups.hasOwnProperty(a)&&(this.groups[a].drawIcon(i,r,this.svgElements,this.svg,s,o),r+=o+this.options.iconSpacing);n.cleanupElements(this.svgElements)}},t.exports=s},function(t,e,i){function s(t,e){this.id=o.randomUUID(),this.body=t,this.defaultOptions={yAxisOrientation:"left",defaultGroup:"default",sort:!0,sampling:!0,graphHeight:"400px",shaded:{enabled:!1,orientation:"bottom"},style:"line",barChart:{width:50,align:"center"},catmullRom:{enabled:!0,parametrization:"centripetal",alpha:.5},drawPoints:{enabled:!0,size:6,style:"square"},dataAxis:{showMinorLabels:!0,showMajorLabels:!0,icons:!1,width:"40px",visible:!0},legend:{enabled:!1,icons:!0,left:{visible:!0,position:"top-left"},right:{visible:!0,position:"top-right"}}},this.options=o.extend({},this.defaultOptions),this.dom={},this.props={},this.hammer=null,this.groups={};var i=this;this.itemsData=null,this.groupsData=null,this.itemListeners={add:function(t,e){i._onAdd(e.items)},update:function(t,e){i._onUpdate(e.items)},remove:function(t,e){i._onRemove(e.items)}},this.groupListeners={add:function(t,e){i._onAddGroups(e.items)},update:function(t,e){i._onUpdateGroups(e.items)},remove:function(t,e){i._onRemoveGroups(e.items)}},this.items={},this.selection=[],this.lastStart=this.body.range.start,this.touchParams={},this.svgElements={},this.setOptions(e),this.groupsUsingDefaultStyles=[0],this.body.emitter.on("rangechange",function(){if(0!=i.lastStart){var t=i.body.range.start-i.lastStart,e=i.body.range.end-i.body.range.start;if(0!=i.width){var s=i.width/e,o=t*s;i.svg.style.left=-i.width-o+"px"}}}),this.body.emitter.on("rangechanged",function(){i.lastStart=i.body.range.start,i.svg.style.left=o.option.asSize(-i.width),i._updateGraph.apply(i)}),this._create(),this.body.emitter.emit("change")}var o=i(1),n=i(2),r=i(3),a=i(4),h=i(18),d=i(21),l=i(22),c=i(25),p="__ungrouped__";s.prototype=new h,s.prototype._create=function(){var t=document.createElement("div");t.className="LineGraph",this.dom.frame=t,this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="relative",this.svg.style.height=(""+this.options.graphHeight).replace("px","")+"px",this.svg.style.display="block",t.appendChild(this.svg),this.options.dataAxis.orientation="left",this.yAxisLeft=new d(this.body,this.options.dataAxis,this.svg),this.options.dataAxis.orientation="right",this.yAxisRight=new d(this.body,this.options.dataAxis,this.svg),delete this.options.dataAxis.orientation,this.legendLeft=new c(this.body,this.options.legend,"left"),this.legendRight=new c(this.body,this.options.legend,"right"),this.show()},s.prototype.setOptions=function(t){if(t){var e=["sampling","defaultGroup","graphHeight","yAxisOrientation","style","barChart","dataAxis","sort"];o.selectiveDeepExtend(e,this.options,t),o.mergeOptions(this.options,t,"catmullRom"),o.mergeOptions(this.options,t,"drawPoints"),o.mergeOptions(this.options,t,"shaded"),o.mergeOptions(this.options,t,"legend"),t.catmullRom&&"object"==typeof t.catmullRom&&t.catmullRom.parametrization&&("uniform"==t.catmullRom.parametrization?this.options.catmullRom.alpha=0:"chordal"==t.catmullRom.parametrization?this.options.catmullRom.alpha=1:(this.options.catmullRom.parametrization="centripetal",this.options.catmullRom.alpha=.5)),this.yAxisLeft&&void 0!==t.dataAxis&&(this.yAxisLeft.setOptions(this.options.dataAxis),this.yAxisRight.setOptions(this.options.dataAxis)),this.legendLeft&&void 0!==t.legend&&(this.legendLeft.setOptions(this.options.legend),this.legendRight.setOptions(this.options.legend)),this.groups.hasOwnProperty(p)&&this.groups[p].setOptions(t)}this.dom.frame&&this._updateGraph()},s.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame)},s.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame)},s.prototype.setItems=function(t){var e,i=this,s=this.itemsData;if(t){if(!(t instanceof r||t instanceof a))throw new TypeError("Data must be an instance of DataSet or DataView");this.itemsData=t}else this.itemsData=null;if(s&&(o.forEach(this.itemListeners,function(t,e){s.off(e,t)}),e=s.getIds(),this._onRemove(e)),this.itemsData){var n=this.id;o.forEach(this.itemListeners,function(t,e){i.itemsData.on(e,t,n)}),e=this.itemsData.getIds(),this._onAdd(e)}this._updateUngrouped(),this._updateGraph(),this.redraw()},s.prototype.setGroups=function(t){var e,i=this;if(this.groupsData&&(o.forEach(this.groupListeners,function(t,e){i.groupsData.unsubscribe(e,t)}),e=this.groupsData.getIds(),this.groupsData=null,this._onRemoveGroups(e)),t){if(!(t instanceof r||t instanceof a))throw new TypeError("Data must be an instance of DataSet or DataView");this.groupsData=t}else this.groupsData=null;if(this.groupsData){var s=this.id;o.forEach(this.groupListeners,function(t,e){i.groupsData.on(e,t,s)}),e=this.groupsData.getIds(),this._onAddGroups(e)}this._onUpdate()},s.prototype._onUpdate=function(){this._updateUngrouped(),this._updateAllGroupData(),this._updateGraph(),this.redraw()},s.prototype._onAdd=function(t){this._onUpdate(t)},s.prototype._onRemove=function(t){this._onUpdate(t)},s.prototype._onUpdateGroups=function(t){for(var e=0;e0){for(s=0;su){e.push(f);break}e.push(f)}}else for(var g=0;gp&&f.x0){for(var p=0;pi?i:a,d=s>d?s:d):(r=!0,h=h>i?i:h,l=s>l?s:l)}1==n&&this.yAxisLeft.setRange(a,d),1==r&&this.yAxisRight.setRange(h,l)}return o=this._toggleAxisVisiblity(n,this.yAxisLeft)||o,o=this._toggleAxisVisiblity(r,this.yAxisRight)||o,1==r&&1==n?(this.yAxisLeft.drawIcons=!0,this.yAxisRight.drawIcons=!0):(this.yAxisLeft.drawIcons=!1,this.yAxisRight.drawIcons=!1),this.yAxisRight.master=!n,0==this.yAxisRight.master?(1==r&&(this.yAxisLeft.lineOffset=this.yAxisRight.width),o=this.yAxisLeft.redraw()||o,this.yAxisRight.stepPixelsForced=this.yAxisLeft.stepPixels,o=this.yAxisRight.redraw()||o):o=this.yAxisRight.redraw()||o,o},s.prototype._toggleAxisVisiblity=function(t,e){var i=!1; +return 0==t?e.dom.frame.parentNode&&(e.hide(),i=!0):e.dom.frame.parentNode||(e.show(),i=!0),i},s.prototype._drawBarGraph=function(t,e){if(null!=t&&t.length>0){var i,s=.1*e.options.barChart.width,o=0,r=e.options.barChart.width;"left"==e.options.barChart.align?o-=.5*r:"right"==e.options.barChart.align&&(o+=.5*r);for(var a=0;a0&&(i=Math.min(i,Math.abs(t[a-1].x-t[a].x))),r>i&&(r=s>i?s:i),n.drawBar(t[a].x+o,t[a].y,r,e.zeroPosition-t[a].y,e.className+" bar",this.svgElements,this.svg);1==e.options.drawPoints.enabled&&this._drawPoints(t,e,this.svgElements,this.svg,o)}},s.prototype._drawLineGraph=function(t,e){if(null!=t&&t.length>0){var i,s,o=Number(this.svg.style.height.replace("px",""));if(i=n.getSVGElement("path",this.svgElements,this.svg),i.setAttributeNS(null,"class",e.className),s=1==e.options.catmullRom.enabled?this._catmullRom(t,e):this._linear(t),1==e.options.shaded.enabled){var r,a=n.getSVGElement("path",this.svgElements,this.svg);r="top"==e.options.shaded.orientation?"M"+t[0].x+",0 "+s+"L"+t[t.length-1].x+",0":"M"+t[0].x+","+o+" "+s+"L"+t[t.length-1].x+","+o,a.setAttributeNS(null,"class",e.className+" fill"),a.setAttributeNS(null,"d",r)}i.setAttributeNS(null,"d","M"+s),1==e.options.drawPoints.enabled&&this._drawPoints(t,e,this.svgElements,this.svg)}},s.prototype._drawPoints=function(t,e,i,s,o){void 0===o&&(o=0);for(var r=0;rp;p+=r)i=n(t[p].x)+this.width-1,s=t[p].y,o.push({x:i,y:s}),h=h>s?s:h,d=s>d?s:d;return{min:h,max:d,data:o}},s.prototype._convertYvalues=function(t,e){var i,s,o=[],n=this.yAxisLeft,r=Number(this.svg.style.height.replace("px",""));"right"==e.options.yAxisOrientation&&(n=this.yAxisRight);for(var a=0;al;l++)e=0==l?t[0]:t[l-1],i=t[l],s=t[l+1],o=d>l+2?t[l+2]:s,n={x:(-e.x+6*i.x+s.x)*h,y:(-e.y+6*i.y+s.y)*h},r={x:(i.x+6*s.x-o.x)*h,y:(i.y+6*s.y-o.y)*h},a+="C"+n.x+","+n.y+" "+r.x+","+r.y+" "+s.x+","+s.y+" ";return a},s.prototype._catmullRom=function(t,e){var i=e.options.catmullRom.alpha;if(0==i||void 0===i)return this._catmullRomUniform(t);for(var s,o,n,r,a,h,d,l,c,p,u,m,g,f,v,y,b,_,x,w=Math.round(t[0].x)+","+Math.round(t[0].y)+" ",S=t.length,M=0;S-1>M;M++)s=0==M?t[0]:t[M-1],o=t[M],n=t[M+1],r=S>M+2?t[M+2]:n,d=Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2)),l=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),c=Math.sqrt(Math.pow(n.x-r.x,2)+Math.pow(n.y-r.y,2)),f=Math.pow(c,i),y=Math.pow(c,2*i),v=Math.pow(l,i),b=Math.pow(l,2*i),x=Math.pow(d,i),_=Math.pow(d,2*i),p=2*_+3*x*v+b,u=2*y+3*f*v+b,m=3*x*(x+v),m>0&&(m=1/m),g=3*f*(f+v),g>0&&(g=1/g),a={x:(-b*s.x+p*o.x+_*n.x)*m,y:(-b*s.y+p*o.y+_*n.y)*m},h={x:(y*o.x+u*n.x-b*r.x)*g,y:(y*o.y+u*n.y-b*r.y)*g},0==a.x&&0==a.y&&(a=o),0==h.x&&0==h.y&&(h=n),w+="C"+a.x+","+a.y+" "+h.x+","+h.y+" "+n.x+","+n.y+" ";return w},s.prototype._linear=function(t){for(var e="",i=0;id;){d++;var l=n.getCurrent(),c=this.body.util.toScreen(l),p=n.isMajor();this.options.showMinorLabels&&this._repaintMinorText(c,n.getLabelMinor(),t),p&&this.options.showMajorLabels?(c>0&&(void 0==h&&(h=c),this._repaintMajorText(c,n.getLabelMajor(),t)),this._repaintMajorLine(c,t)):this._repaintMinorLine(c,t),n.next()}if(this.options.showMajorLabels){var u=this.body.util.toTime(0),m=n.getLabelMajor(u),g=m.length*(this.props.majorCharWidth||10)+10;(void 0==h||h>g)&&this._repaintMajorText(0,m,t)}o.forEach(this.dom.redundant,function(t){for(;t.length;){var e=t.pop();e&&e.parentNode&&e.parentNode.removeChild(e)}})},s.prototype._repaintMinorText=function(t,e,i){var s=this.dom.redundant.minorTexts.shift();if(!s){var o=document.createTextNode("");s=document.createElement("div"),s.appendChild(o),s.className="text minor",this.dom.foreground.appendChild(s)}this.dom.minorTexts.push(s),s.childNodes[0].nodeValue=e,s.style.top="top"==i?this.props.majorLabelHeight+"px":"0",s.style.left=t+"px"},s.prototype._repaintMajorText=function(t,e,i){var s=this.dom.redundant.majorTexts.shift();if(!s){var o=document.createTextNode(e);s=document.createElement("div"),s.className="text major",s.appendChild(o),this.dom.foreground.appendChild(s)}this.dom.majorTexts.push(s),s.childNodes[0].nodeValue=e,s.style.top="top"==i?"0":this.props.minorLabelHeight+"px",s.style.left=t+"px"},s.prototype._repaintMinorLine=function(t,e){var i=this.dom.redundant.minorLines.shift();i||(i=document.createElement("div"),i.className="grid vertical minor",this.dom.background.appendChild(i)),this.dom.minorLines.push(i);var s=this.props;i.style.top="top"==e?s.majorLabelHeight+"px":this.body.domProps.top.height+"px",i.style.height=s.minorLineHeight+"px",i.style.left=t-s.minorLineWidth/2+"px"},s.prototype._repaintMajorLine=function(t,e){var i=this.dom.redundant.majorLines.shift();i||(i=document.createElement("DIV"),i.className="grid vertical major",this.dom.background.appendChild(i)),this.dom.majorLines.push(i);var s=this.props;i.style.top="top"==e?"0":this.body.domProps.top.height+"px",i.style.left=t-s.majorLineWidth/2+"px",i.style.height=s.majorLineHeight+"px"},s.prototype._calculateCharSize=function(){this.dom.measureCharMinor||(this.dom.measureCharMinor=document.createElement("DIV"),this.dom.measureCharMinor.className="text minor measure",this.dom.measureCharMinor.style.position="absolute",this.dom.measureCharMinor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMinor)),this.props.minorCharHeight=this.dom.measureCharMinor.clientHeight,this.props.minorCharWidth=this.dom.measureCharMinor.clientWidth,this.dom.measureCharMajor||(this.dom.measureCharMajor=document.createElement("DIV"),this.dom.measureCharMajor.className="text minor measure",this.dom.measureCharMajor.style.position="absolute",this.dom.measureCharMajor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMajor)),this.props.majorCharHeight=this.dom.measureCharMajor.clientHeight,this.props.majorCharWidth=this.dom.measureCharMajor.clientWidth},s.prototype.snap=function(t){return this.step.snap(t)},t.exports=s},function(t,e,i){function s(t,e,i){this.id=null,this.parent=null,this.data=t,this.dom=null,this.conversion=e||{},this.options=i||{},this.selected=!1,this.displayed=!1,this.dirty=!0,this.top=null,this.left=null,this.width=null,this.height=null}var o=i(41);s.prototype.select=function(){this.selected=!0,this.displayed&&this.redraw()},s.prototype.unselect=function(){this.selected=!1,this.displayed&&this.redraw()},s.prototype.setParent=function(t){this.displayed?(this.hide(),this.parent=t,this.parent&&this.show()):this.parent=t},s.prototype.isVisible=function(){return!1},s.prototype.show=function(){return!1},s.prototype.hide=function(){return!1},s.prototype.redraw=function(){},s.prototype.repositionX=function(){},s.prototype.repositionY=function(){},s.prototype._repaintDeleteButton=function(t){if(this.selected&&this.options.editable.remove&&!this.dom.deleteButton){var e=this,i=document.createElement("div");i.className="delete",i.title="Delete this item",o(i,{preventDefault:!0}).on("tap",function(t){e.parent.removeFromDataSet(e),t.stopPropagation()}),t.appendChild(i),this.dom.deleteButton=i}else!this.selected&&this.dom.deleteButton&&(this.dom.deleteButton.parentNode&&this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton),this.dom.deleteButton=null)},t.exports=s},function(t,e,i){function s(t,e,i){if(this.props={dot:{width:0,height:0},line:{width:0,height:0}},t&&void 0==t.start)throw new Error('Property "start" missing in item '+t);o.call(this,t,e,i)}var o=i(28);s.prototype=new o(null,null,null),s.prototype.isVisible=function(t){var e=(t.end-t.start)/4;return this.data.start>t.start-e&&this.data.startt.start-e&&this.data.startt.start},s.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.box=document.createElement("div"),t.content=document.createElement("div"),t.content.className="content",t.box.appendChild(t.content),t.box["timeline-item"]=this),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.box.parentNode){var e=this.parent.dom.foreground;if(!e)throw new Error("Cannot redraw time axis: parent has no foreground container element");e.appendChild(t.box)}if(this.displayed=!0,this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)t.content.innerHTML="",t.content.appendChild(this.content);else{if(void 0==this.data.content)throw new Error('Property "content" missing in item '+this.data.id);t.content.innerHTML=this.content}this.dirty=!0}this.data.title!=this.title&&(t.box.title=this.data.title,this.title=this.data.title);var i=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=i&&(this.className=i,t.box.className=this.baseClassName+i,this.dirty=!0),this.dirty&&(this.overflow="hidden"!==window.getComputedStyle(t.content).overflow,this.props.content.width=this.dom.content.offsetWidth,this.height=this.dom.box.offsetHeight,this.dirty=!1),this._repaintDeleteButton(t.box),this._repaintDragLeft(),this._repaintDragRight()},s.prototype.show=function(){this.displayed||this.redraw()},s.prototype.hide=function(){if(this.displayed){var t=this.dom.box;t.parentNode&&t.parentNode.removeChild(t),this.top=null,this.left=null,this.displayed=!1}},s.prototype.repositionX=function(){var t,e=this.props,i=this.parent.width,s=this.conversion.toScreen(this.data.start),o=this.conversion.toScreen(this.data.end),n=this.options.padding;-i>s&&(s=-i),o>2*i&&(o=2*i);var r=Math.max(o-s,1);this.overflow?(t=Math.max(-s,0),this.left=s,this.width=r+this.props.content.width):(t=0>s?Math.min(-s,o-s-e.content.width-2*n):0,this.left=s,this.width=r),this.dom.box.style.left=this.left+"px",this.dom.box.style.width=r+"px",this.dom.content.style.left=t+"px"},s.prototype.repositionY=function(){var t=this.options.orientation,e=this.dom.box;e.style.top="top"==t?this.top+"px":this.parent.height-this.top-this.height+"px"},s.prototype._repaintDragLeft=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragLeft){var t=document.createElement("div");t.className="drag-left",t.dragLeftItem=this,o(t,{preventDefault:!0}).on("drag",function(){}),this.dom.box.appendChild(t),this.dom.dragLeft=t}else!this.selected&&this.dom.dragLeft&&(this.dom.dragLeft.parentNode&&this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft),this.dom.dragLeft=null)},s.prototype._repaintDragRight=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragRight){var t=document.createElement("div");t.className="drag-right",t.dragRightItem=this,o(t,{preventDefault:!0}).on("drag",function(){}),this.dom.box.appendChild(t),this.dom.dragRight=t}else!this.selected&&this.dom.dragRight&&(this.dom.dragRight.parentNode&&this.dom.dragRight.parentNode.removeChild(this.dom.dragRight),this.dom.dragRight=null)},t.exports=s},function(t,e,i){function s(t,e,i){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");this._initializeMixinLoaders(),this.containerElement=t,this.width="100%",this.height="100%",this.renderRefreshRate=60,this.renderTimestep=1e3/this.renderRefreshRate,this.renderTime=.5*this.renderTimestep,this.maxPhysicsTicksPerRender=3,this.physicsDiscreteStepsize=.5,this.stabilize=!0,this.selectable=!0,this.initializing=!0,this.triggerFunctions={add:null,edit:null,editEdge:null,connect:null,del:null},this.constants={nodes:{radiusMin:10,radiusMax:30,radius:10,shape:"ellipse",image:void 0,widthMin:16,widthMax:64,fixed:!1,fontColor:"black",fontSize:14,fontFace:"verdana",level:-1,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},borderColor:"#2B7CE9",backgroundColor:"#97C2FC",highlightColor:"#D2E5FF",group:void 0,borderWidth:1},edges:{widthMin:1,widthMax:15,width:1,widthSelectionMultiplier:2,hoverWidth:1.5,style:"line",color:{color:"#848484",highlight:"#848484",hover:"#848484"},fontColor:"#343434",fontSize:14,fontFace:"arial",fontFill:"white",arrowScaleFactor:1,dash:{length:10,gap:5,altLength:void 0},inheritColor:"from"},configurePhysics:!1,physics:{barnesHut:{enabled:!0,theta:1/.6,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09},repulsion:{centralGravity:0,springLength:200,springConstant:.05,nodeDistance:100,damping:.09},hierarchicalRepulsion:{enabled:!1,centralGravity:0,springLength:100,springConstant:.01,nodeDistance:150,damping:.09},damping:null,centralGravity:null,springLength:null,springConstant:null},clustering:{enabled:!1,initialMaxNodes:100,clusterThreshold:500,reduceToNodes:300,chainThreshold:.4,clusterEdgeThreshold:20,sectorThreshold:100,screenSizeThreshold:.2,fontSizeMultiplier:4,maxFontSize:1e3,forceAmplification:.1,distanceAmplification:.1,edgeGrowth:20,nodeScaling:{width:1,height:1,radius:1},maxNodeSizeIncrements:600,activeAreaBoxSize:80,clusterLevelDifference:2},navigation:{enabled:!1},keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02}},dataManipulation:{enabled:!1,initiallyVisible:!1},hierarchicalLayout:{enabled:!1,levelSeparation:150,nodeSpacing:100,direction:"UD"},freezeForStabilization:!1,smoothCurves:{enabled:!0,dynamic:!0,type:"continuous",roundness:.5},dynamicSmoothCurves:!0,maxVelocity:30,minVelocity:.1,stabilizationIterations:1e3,labels:{add:"Add Node",edit:"Edit",link:"Add Link",del:"Delete selected",editNode:"Edit Node",editEdge:"Edit Edge",back:"Back",addDescription:"Click in an empty space to place a new node.",linkDescription:"Click on a node and drag the edge to another node to connect them.",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",addError:"The function for add does not support two arguments (data,callback).",linkError:"The function for connect does not support two arguments (data,callback).",editError:"The function for edit does not support two arguments (data, callback).",editBoundError:"No edit function has been bound to this button.",deleteError:"The function for delete does not support two arguments (data, callback).",deleteClusterError:"Clusters cannot be deleted."},tooltip:{delay:300,fontColor:"black",fontSize:14,fontFace:"verdana",color:{border:"#666",background:"#FFFFC6"}},dragNetwork:!0,dragNodes:!0,zoomable:!0,hover:!1,hideEdgesOnDrag:!1,hideNodesOnDrag:!1},this.hoverObj={nodes:{},edges:{}},this.controlNodesActive=!1;var o=this;this.groups=new u,this.images=new m,this.images.setOnloadCallback(function(){o._redraw()}),this.xIncrement=0,this.yIncrement=0,this.zoomIncrement=0,this._loadPhysicsSystem(),this._create(),this._loadSectorSystem(),this._loadClusterSystem(),this._loadSelectionSystem(),this._loadHierarchySystem(),this._setTranslation(this.frame.clientWidth/2,this.frame.clientHeight/2),this._setScale(1),this.setOptions(i),this.freezeSimulation=!1,this.cachedFunctions={},this.calculationNodes={},this.calculationNodeIndices=[],this.nodeIndices=[],this.nodes={},this.edges={},this.canvasTopLeft={x:0,y:0},this.canvasBottomRight={x:0,y:0},this.pointerPosition={x:0,y:0},this.areaCenter={},this.scale=1,this.previousScale=this.scale,this.nodesData=null,this.edgesData=null,this.nodesListeners={add:function(t,e){o._addNodes(e.items),o.start()},update:function(t,e){o._updateNodes(e.items),o.start()},remove:function(t,e){o._removeNodes(e.items),o.start()}},this.edgesListeners={add:function(t,e){o._addEdges(e.items),o.start()},update:function(t,e){o._updateEdges(e.items),o.start()},remove:function(t,e){o._removeEdges(e.items),o.start()}},this.moving=!0,this.timer=void 0,this.setData(e,this.constants.clustering.enabled||this.constants.hierarchicalLayout.enabled),this.initializing=!1,1==this.constants.hierarchicalLayout.enabled?this._setupHierarchicalLayout():0==this.stabilize&&this.zoomExtent(!0,this.constants.clustering.enabled),this.constants.clustering.enabled&&this.startWithClustering()}var o=i(45),n=i(41),r=i(46),a=i(1),h=i(42),d=i(3),l=i(4),c=i(38),p=i(39),u=i(34),m=i(35),g=i(36),f=i(33),v=i(37),y=i(44);i(43),o(s.prototype),s.prototype._getScriptPath=function(){for(var t=document.getElementsByTagName("script"),e=0;et.x&&(s=t.x),ot.y&&(e=t.y),i=this.constants.clustering.initialMaxNodes?49.07548/(o+142.05338)+91444e-8:12.662/(o+7.4147)+.0964822:1==this.constants.clustering.enabled&&o>=this.constants.clustering.initialMaxNodes?77.5271985/(o+187.266146)+476710517e-13:30.5062972/(o+19.93597763)+.08413486;var n=Math.min(this.frame.canvas.clientWidth/600,this.frame.canvas.clientHeight/600);i*=n}else{var r=1.1*(Math.abs(s.minX)+Math.abs(s.maxX)),a=1.1*(Math.abs(s.minY)+Math.abs(s.maxY)),h=this.frame.canvas.clientWidth/r,d=this.frame.canvas.clientHeight/a;i=d>=h?h:d}i>1&&(i=1),this._setScale(i),this._centerNetwork(s),0==e&&(this.moving=!0,this.start())},s.prototype._updateNodeIndexList=function(){this._clearNodeIndexList();for(var t in this.nodes)this.nodes.hasOwnProperty(t)&&this.nodeIndices.push(t)},s.prototype.setData=function(t,e){if(void 0===e&&(e=!1),t&&t.dot&&(t.nodes||t.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(t&&t.options),t&&t.dot){if(t&&t.dot){var i=c.DOTToGraph(t.dot);return void this.setData(i)}}else if(t&&t.gephi){if(t&&t.gephi){var s=p.parseGephi(t.gephi);return void this.setData(s)}}else this._setNodes(t&&t.nodes),this._setEdges(t&&t.edges);if(this._putDataInSector(),!e)if(this.stabilize){var o=this;setTimeout(function(){o._stabilize(),o.start()},0)}else this.start()},s.prototype.setOptions=function(t){if(t){var e;if(void 0!==t.width&&(this.width=t.width),void 0!==t.height&&(this.height=t.height),void 0!==t.stabilize&&(this.stabilize=t.stabilize),void 0!==t.selectable&&(this.selectable=t.selectable),void 0!==t.freezeForStabilization&&(this.constants.freezeForStabilization=t.freezeForStabilization),void 0!==t.configurePhysics&&(this.constants.configurePhysics=t.configurePhysics),void 0!==t.stabilizationIterations&&(this.constants.stabilizationIterations=t.stabilizationIterations),void 0!==t.dragNetwork&&(this.constants.dragNetwork=t.dragNetwork),void 0!==t.dragNodes&&(this.constants.dragNodes=t.dragNodes),void 0!==t.zoomable&&(this.constants.zoomable=t.zoomable),void 0!==t.hover&&(this.constants.hover=t.hover),void 0!==t.hideEdgesOnDrag&&(this.constants.hideEdgesOnDrag=t.hideEdgesOnDrag),void 0!==t.hideNodesOnDrag&&(this.constants.hideNodesOnDrag=t.hideNodesOnDrag),void 0!==t.dragGraph)throw new Error("Option dragGraph is renamed to dragNetwork");if(void 0!==t.labels)for(e in t.labels)t.labels.hasOwnProperty(e)&&(this.constants.labels[e]=t.labels[e]);if(t.onAdd&&(this.triggerFunctions.add=t.onAdd),t.onEdit&&(this.triggerFunctions.edit=t.onEdit),t.onEditEdge&&(this.triggerFunctions.editEdge=t.onEditEdge),t.onConnect&&(this.triggerFunctions.connect=t.onConnect),t.onDelete&&(this.triggerFunctions.del=t.onDelete),t.physics){if(t.physics.barnesHut){this.constants.physics.barnesHut.enabled=!0;for(e in t.physics.barnesHut)t.physics.barnesHut.hasOwnProperty(e)&&(this.constants.physics.barnesHut[e]=t.physics.barnesHut[e])}if(t.physics.repulsion){this.constants.physics.barnesHut.enabled=!1;for(e in t.physics.repulsion)t.physics.repulsion.hasOwnProperty(e)&&(this.constants.physics.repulsion[e]=t.physics.repulsion[e])}if(t.physics.hierarchicalRepulsion){this.constants.hierarchicalLayout.enabled=!0,this.constants.physics.hierarchicalRepulsion.enabled=!0,this.constants.physics.barnesHut.enabled=!1;for(e in t.physics.hierarchicalRepulsion)t.physics.hierarchicalRepulsion.hasOwnProperty(e)&&(this.constants.physics.hierarchicalRepulsion[e]=t.physics.hierarchicalRepulsion[e])}}if(void 0!==t.smoothCurves)if("boolean"==typeof t.smoothCurves)this.constants.smoothCurves.enabled=t.smoothCurves;else{this.constants.smoothCurves.enabled=!0;for(e in t.smoothCurves)t.smoothCurves.hasOwnProperty(e)&&(this.constants.smoothCurves[e]=t.smoothCurves[e])}if(t.hierarchicalLayout){this.constants.hierarchicalLayout.enabled=!0;for(e in t.hierarchicalLayout)t.hierarchicalLayout.hasOwnProperty(e)&&(this.constants.hierarchicalLayout[e]=t.hierarchicalLayout[e])}else void 0!==t.hierarchicalLayout&&(this.constants.hierarchicalLayout.enabled=!1);if(t.clustering){this.constants.clustering.enabled=!0;for(e in t.clustering)t.clustering.hasOwnProperty(e)&&(this.constants.clustering[e]=t.clustering[e])}else void 0!==t.clustering&&(this.constants.clustering.enabled=!1);if(t.navigation){this.constants.navigation.enabled=!0;for(e in t.navigation)t.navigation.hasOwnProperty(e)&&(this.constants.navigation[e]=t.navigation[e])}else void 0!==t.navigation&&(this.constants.navigation.enabled=!1);if(t.keyboard){this.constants.keyboard.enabled=!0;for(e in t.keyboard)t.keyboard.hasOwnProperty(e)&&(this.constants.keyboard[e]=t.keyboard[e])}else void 0!==t.keyboard&&(this.constants.keyboard.enabled=!1);if(t.dataManipulation){this.constants.dataManipulation.enabled=!0;for(e in t.dataManipulation)t.dataManipulation.hasOwnProperty(e)&&(this.constants.dataManipulation[e]=t.dataManipulation[e]);this.editMode=this.constants.dataManipulation.initiallyVisible}else void 0!==t.dataManipulation&&(this.constants.dataManipulation.enabled=!1);if(t.edges){for(e in t.edges)t.edges.hasOwnProperty(e)&&"object"!=typeof t.edges[e]&&(this.constants.edges[e]=t.edges[e]);void 0!==t.edges.color&&(a.isString(t.edges.color)?(this.constants.edges.color={},this.constants.edges.color.color=t.edges.color,this.constants.edges.color.highlight=t.edges.color,this.constants.edges.color.hover=t.edges.color):(void 0!==t.edges.color.color&&(this.constants.edges.color.color=t.edges.color.color),void 0!==t.edges.color.highlight&&(this.constants.edges.color.highlight=t.edges.color.highlight),void 0!==t.edges.color.hover&&(this.constants.edges.color.hover=t.edges.color.hover))),t.edges.fontColor||void 0!==t.edges.color&&(a.isString(t.edges.color)?this.constants.edges.fontColor=t.edges.color:void 0!==t.edges.color.color&&(this.constants.edges.fontColor=t.edges.color.color)),t.edges.dash&&(void 0!==t.edges.dash.length&&(this.constants.edges.dash.length=t.edges.dash.length),void 0!==t.edges.dash.gap&&(this.constants.edges.dash.gap=t.edges.dash.gap),void 0!==t.edges.dash.altLength&&(this.constants.edges.dash.altLength=t.edges.dash.altLength)) +}if(t.nodes){for(e in t.nodes)t.nodes.hasOwnProperty(e)&&(this.constants.nodes[e]=t.nodes[e]);t.nodes.color&&(this.constants.nodes.color=a.parseColor(t.nodes.color))}if(t.groups)for(var i in t.groups)if(t.groups.hasOwnProperty(i)){var s=t.groups[i];this.groups.add(i,s)}if(t.tooltip){for(e in t.tooltip)t.tooltip.hasOwnProperty(e)&&(this.constants.tooltip[e]=t.tooltip[e]);t.tooltip.color&&(this.constants.tooltip.color=a.parseColor(t.tooltip.color))}}this._loadPhysicsSystem(),this._loadNavigationControls(),this._loadManipulationSystem(),this._configureSmoothCurves(),this._createKeyBinds(),this.setSize(this.width,this.height),this.moving=!0,this.start()},s.prototype._create=function(){for(;this.containerElement.hasChildNodes();)this.containerElement.removeChild(this.containerElement.firstChild);if(this.frame=document.createElement("div"),this.frame.className="network-frame",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),!this.frame.canvas.getContext){var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(t)}var e=this;this.drag={},this.pinch={},this.hammer=n(this.frame.canvas,{prevent_default:!0}),this.hammer.on("tap",e._onTap.bind(e)),this.hammer.on("doubletap",e._onDoubleTap.bind(e)),this.hammer.on("hold",e._onHold.bind(e)),this.hammer.on("pinch",e._onPinch.bind(e)),this.hammer.on("touch",e._onTouch.bind(e)),this.hammer.on("dragstart",e._onDragStart.bind(e)),this.hammer.on("drag",e._onDrag.bind(e)),this.hammer.on("dragend",e._onDragEnd.bind(e)),this.hammer.on("release",e._onRelease.bind(e)),this.hammer.on("mousewheel",e._onMouseWheel.bind(e)),this.hammer.on("DOMMouseScroll",e._onMouseWheel.bind(e)),this.hammer.on("mousemove",e._onMouseMoveTitle.bind(e)),this.containerElement.appendChild(this.frame)},s.prototype._createKeyBinds=function(){var t=this;this.mousetrap=r,this.mousetrap.reset(),1==this.constants.keyboard.enabled&&(this.mousetrap.bind("up",this._moveUp.bind(t),"keydown"),this.mousetrap.bind("up",this._yStopMoving.bind(t),"keyup"),this.mousetrap.bind("down",this._moveDown.bind(t),"keydown"),this.mousetrap.bind("down",this._yStopMoving.bind(t),"keyup"),this.mousetrap.bind("left",this._moveLeft.bind(t),"keydown"),this.mousetrap.bind("left",this._xStopMoving.bind(t),"keyup"),this.mousetrap.bind("right",this._moveRight.bind(t),"keydown"),this.mousetrap.bind("right",this._xStopMoving.bind(t),"keyup"),this.mousetrap.bind("=",this._zoomIn.bind(t),"keydown"),this.mousetrap.bind("=",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("-",this._zoomOut.bind(t),"keydown"),this.mousetrap.bind("-",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("[",this._zoomIn.bind(t),"keydown"),this.mousetrap.bind("[",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("]",this._zoomOut.bind(t),"keydown"),this.mousetrap.bind("]",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("pageup",this._zoomIn.bind(t),"keydown"),this.mousetrap.bind("pageup",this._stopZoom.bind(t),"keyup"),this.mousetrap.bind("pagedown",this._zoomOut.bind(t),"keydown"),this.mousetrap.bind("pagedown",this._stopZoom.bind(t),"keyup")),1==this.constants.dataManipulation.enabled&&(this.mousetrap.bind("escape",this._createManipulatorBar.bind(t)),this.mousetrap.bind("del",this._deleteSelected.bind(t)))},s.prototype._getPointer=function(t){return{x:t.pageX-a.getAbsoluteLeft(this.frame.canvas),y:t.pageY-a.getAbsoluteTop(this.frame.canvas)}},s.prototype._onTouch=function(t){this.drag.pointer=this._getPointer(t.gesture.center),this.drag.pinched=!1,this.pinch.scale=this._getScale(),this._handleTouch(this.drag.pointer)},s.prototype._onDragStart=function(){this._handleDragStart()},s.prototype._handleDragStart=function(){var t=this.drag,e=this._getNodeAt(t.pointer);if(t.dragging=!0,t.selection=[],t.translation=this._getTranslation(),t.nodeId=null,null!=e){t.nodeId=e.id,e.isSelected()||this._selectObject(e,!1);for(var i in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(i)){var s=this.selectionObj.nodes[i],o={id:s.id,node:s,x:s.x,y:s.y,xFixed:s.xFixed,yFixed:s.yFixed};s.xFixed=!0,s.yFixed=!0,t.selection.push(o)}}},s.prototype._onDrag=function(t){this._handleOnDrag(t)},s.prototype._handleOnDrag=function(t){if(!this.drag.pinched){var e=this._getPointer(t.gesture.center),i=this,s=this.drag,o=s.selection;if(o&&o.length&&1==this.constants.dragNodes){var n=e.x-s.pointer.x,r=e.y-s.pointer.y;o.forEach(function(t){var e=t.node;t.xFixed||(e.x=i._XconvertDOMtoCanvas(i._XconvertCanvasToDOM(t.x)+n)),t.yFixed||(e.y=i._YconvertDOMtoCanvas(i._YconvertCanvasToDOM(t.y)+r))}),this.moving||(this.moving=!0,this.start())}else if(1==this.constants.dragNetwork){var a=e.x-this.drag.pointer.x,h=e.y-this.drag.pointer.y;this._setTranslation(this.drag.translation.x+a,this.drag.translation.y+h),this._redraw()}}},s.prototype._onDragEnd=function(){this.drag.dragging=!1;var t=this.drag.selection;t&&t.length?(t.forEach(function(t){t.node.xFixed=t.xFixed,t.node.yFixed=t.yFixed}),this.moving=!0,this.start()):this._redraw()},s.prototype._onTap=function(t){var e=this._getPointer(t.gesture.center);this.pointerPosition=e,this._handleTap(e)},s.prototype._onDoubleTap=function(t){var e=this._getPointer(t.gesture.center);this._handleDoubleTap(e)},s.prototype._onHold=function(t){var e=this._getPointer(t.gesture.center);this.pointerPosition=e,this._handleOnHold(e)},s.prototype._onRelease=function(t){var e=this._getPointer(t.gesture.center);this._handleOnRelease(e)},s.prototype._onPinch=function(t){var e=this._getPointer(t.gesture.center);this.drag.pinched=!0,"scale"in this.pinch||(this.pinch.scale=1);var i=this.pinch.scale*t.gesture.scale;this._zoom(i,e)},s.prototype._zoom=function(t,e){if(1==this.constants.zoomable){var i=this._getScale();1e-5>t&&(t=1e-5),t>10&&(t=10);var s=null;void 0!==this.drag&&1==this.drag.dragging&&(s=this.DOMtoCanvas(this.drag.pointer));var o=this._getTranslation(),n=t/i,r=(1-n)*e.x+o.x*n,a=(1-n)*e.y+o.y*n;if(this.areaCenter={x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)},this._setScale(t),this._setTranslation(r,a),this.updateClustersDefault(),null!=s){var h=this.canvasToDOM(s);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}return this._redraw(),t>i?this.emit("zoom",{direction:"+"}):this.emit("zoom",{direction:"-"}),t}},s.prototype._onMouseWheel=function(t){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),e){var i=this._getScale(),s=e/10;0>e&&(s/=1-s),i*=1+s;var o=h.fakeGesture(this,t),n=this._getPointer(o.center);this._zoom(i,n)}t.preventDefault()},s.prototype._onMouseMoveTitle=function(t){var e=h.fakeGesture(this,t),i=this._getPointer(e.center);this.popupObj&&this._checkHidePopup(i);var s=this,o=function(){s._checkShowPopup(i)};if(this.popupTimer&&clearInterval(this.popupTimer),this.drag.dragging||(this.popupTimer=setTimeout(o,this.constants.tooltip.delay)),1==this.constants.hover){for(var n in this.hoverObj.edges)this.hoverObj.edges.hasOwnProperty(n)&&(this.hoverObj.edges[n].hover=!1,delete this.hoverObj.edges[n]);var r=this._getNodeAt(i);null==r&&(r=this._getEdgeAt(i)),null!=r&&this._hoverObject(r);for(var a in this.hoverObj.nodes)this.hoverObj.nodes.hasOwnProperty(a)&&(r instanceof g&&r.id!=a||r instanceof f||null==r)&&(this._blurObject(this.hoverObj.nodes[a]),delete this.hoverObj.nodes[a]);this.redraw()}},s.prototype._checkShowPopup=function(t){var e,i={left:this._XconvertDOMtoCanvas(t.x),top:this._YconvertDOMtoCanvas(t.y),right:this._XconvertDOMtoCanvas(t.x),bottom:this._YconvertDOMtoCanvas(t.y)},s=this.popupObj;if(void 0==this.popupObj){var o=this.nodes;for(e in o)if(o.hasOwnProperty(e)){var n=o[e];if(void 0!==n.getTitle()&&n.isOverlappingWith(i)){this.popupObj=n;break}}}if(void 0===this.popupObj){var r=this.edges;for(e in r)if(r.hasOwnProperty(e)){var a=r[e];if(a.connected&&void 0!==a.getTitle()&&a.isOverlappingWith(i)){this.popupObj=a;break}}}if(this.popupObj){if(this.popupObj!=s){var h=this;h.popup||(h.popup=new v(h.frame,h.constants.tooltip)),h.popup.setPosition(t.x-3,t.y-3),h.popup.setText(h.popupObj.getTitle()),h.popup.show()}}else this.popup&&this.popup.hide()},s.prototype._checkHidePopup=function(t){this.popupObj&&this._getNodeAt(t)||(this.popupObj=void 0,this.popup&&this.popup.hide())},s.prototype.setSize=function(t,e){this.frame.style.width=t,this.frame.style.height=e,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=this.frame.canvas.clientWidth,this.frame.canvas.height=this.frame.canvas.clientHeight,void 0!==this.manipulationDiv&&(this.manipulationDiv.style.width=this.frame.canvas.clientWidth+"px"),void 0!==this.navigationDivs&&void 0!==this.navigationDivs.wrapper&&(this.navigationDivs.wrapper.style.width=this.frame.canvas.clientWidth+"px",this.navigationDivs.wrapper.style.height=this.frame.canvas.clientHeight+"px"),this.emit("resize",{width:this.frame.canvas.width,height:this.frame.canvas.height})},s.prototype._setNodes=function(t){var e=this.nodesData;if(t instanceof d||t instanceof l)this.nodesData=t;else if(t instanceof Array)this.nodesData=new d,this.nodesData.add(t);else{if(t)throw new TypeError("Array or DataSet expected");this.nodesData=new d}if(e&&a.forEach(this.nodesListeners,function(t,i){e.off(i,t)}),this.nodes={},this.nodesData){var i=this;a.forEach(this.nodesListeners,function(t,e){i.nodesData.on(e,t)});var s=this.nodesData.getIds();this._addNodes(s)}this._updateSelection()},s.prototype._addNodes=function(t){for(var e,i=0,s=t.length;s>i;i++){e=t[i];var o=this.nodesData.get(e),n=new g(o,this.images,this.groups,this.constants);if(this.nodes[e]=n,!(0!=n.xFixed&&0!=n.yFixed||null!==n.x&&null!==n.y)){var r=1*t.length,a=2*Math.PI*Math.random();0==n.xFixed&&(n.x=r*Math.cos(a)),0==n.yFixed&&(n.y=r*Math.sin(a))}this.moving=!0}this._updateNodeIndexList(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes(),this._reconnectEdges(),this._updateValueRange(this.nodes),this.updateLabels()},s.prototype._updateNodes=function(t){for(var e=this.nodes,i=this.nodesData,s=0,o=t.length;o>s;s++){var n=t[s],r=e[n],a=i.get(n);r?r.setProperties(a,this.constants):(r=new g(properties,this.images,this.groups,this.constants),e[n]=r)}this.moving=!0,1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateNodeIndexList(),this._reconnectEdges(),this._updateValueRange(e)},s.prototype._removeNodes=function(t){for(var e=this.nodes,i=0,s=t.length;s>i;i++){var o=t[i];delete e[o]}this._updateNodeIndexList(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes(),this._reconnectEdges(),this._updateSelection(),this._updateValueRange(e)},s.prototype._setEdges=function(t){var e=this.edgesData;if(t instanceof d||t instanceof l)this.edgesData=t;else if(t instanceof Array)this.edgesData=new d,this.edgesData.add(t);else{if(t)throw new TypeError("Array or DataSet expected");this.edgesData=new d}if(e&&a.forEach(this.edgesListeners,function(t,i){e.off(i,t)}),this.edges={},this.edgesData){var i=this;a.forEach(this.edgesListeners,function(t,e){i.edgesData.on(e,t)});var s=this.edgesData.getIds();this._addEdges(s)}this._reconnectEdges()},s.prototype._addEdges=function(t){for(var e=this.edges,i=this.edgesData,s=0,o=t.length;o>s;s++){var n=t[s],r=e[n];r&&r.disconnect();var a=i.get(n,{showInternalIds:!0});e[n]=new f(a,this,this.constants)}this.moving=!0,this._updateValueRange(e),this._createBezierNodes(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes()},s.prototype._updateEdges=function(t){for(var e=this.edges,i=this.edgesData,s=0,o=t.length;o>s;s++){var n=t[s],r=i.get(n),a=e[n];a?(a.disconnect(),a.setProperties(r,this.constants),a.connect()):(a=new f(r,this,this.constants),this.edges[n]=a)}this._createBezierNodes(),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this.moving=!0,this._updateValueRange(e)},s.prototype._removeEdges=function(t){for(var e=this.edges,i=0,s=t.length;s>i;i++){var o=t[i],n=e[o];n&&(null!=n.via&&delete this.sectors.support.nodes[n.via.id],n.disconnect(),delete e[o])}this.moving=!0,this._updateValueRange(e),1==this.constants.hierarchicalLayout.enabled&&0==this.initializing&&(this._resetLevels(),this._setupHierarchicalLayout()),this._updateCalculationNodes()},s.prototype._reconnectEdges=function(){var t,e=this.nodes,i=this.edges;for(t in e)e.hasOwnProperty(t)&&(e[t].edges=[]);for(t in i)if(i.hasOwnProperty(t)){var s=i[t];s.from=null,s.to=null,s.connect()}},s.prototype._updateValueRange=function(t){var e,i=void 0,s=void 0;for(e in t)if(t.hasOwnProperty(e)){var o=t[e].getValue();void 0!==o&&(i=void 0===i?o:Math.min(o,i),s=void 0===s?o:Math.max(o,s))}if(void 0!==i&&void 0!==s)for(e in t)t.hasOwnProperty(e)&&t[e].setValueRange(i,s)},s.prototype.redraw=function(){this.setSize(this.width,this.height),this._redraw()},s.prototype._redraw=function(){var t=this.frame.canvas.getContext("2d"),e=this.frame.canvas.width,i=this.frame.canvas.height;t.clearRect(0,0,e,i),t.save(),t.translate(this.translation.x,this.translation.y),t.scale(this.scale,this.scale),this.canvasTopLeft={x:this._XconvertDOMtoCanvas(0),y:this._YconvertDOMtoCanvas(0)},this.canvasBottomRight={x:this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),y:this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)},this._doInAllSectors("_drawAllSectorNodes",t),(0==this.drag.dragging||void 0===this.drag.dragging||0==this.constants.hideEdgesOnDrag)&&this._doInAllSectors("_drawEdges",t),(0==this.drag.dragging||void 0===this.drag.dragging||0==this.constants.hideNodesOnDrag)&&this._doInAllSectors("_drawNodes",t,!1),1==this.controlNodesActive&&this._doInAllSectors("_drawControlNodes",t),t.restore()},s.prototype._setTranslation=function(t,e){void 0===this.translation&&(this.translation={x:0,y:0}),void 0!==t&&(this.translation.x=t),void 0!==e&&(this.translation.y=e),this.emit("viewChanged")},s.prototype._getTranslation=function(){return{x:this.translation.x,y:this.translation.y}},s.prototype._setScale=function(t){this.scale=t},s.prototype._getScale=function(){return this.scale},s.prototype._XconvertDOMtoCanvas=function(t){return(t-this.translation.x)/this.scale},s.prototype._XconvertCanvasToDOM=function(t){return t*this.scale+this.translation.x},s.prototype._YconvertDOMtoCanvas=function(t){return(t-this.translation.y)/this.scale},s.prototype._YconvertCanvasToDOM=function(t){return t*this.scale+this.translation.y},s.prototype.canvasToDOM=function(t){return{x:this._XconvertCanvasToDOM(t.x),y:this._YconvertCanvasToDOM(t.y)}},s.prototype.DOMtoCanvas=function(t){return{x:this._XconvertDOMtoCanvas(t.x),y:this._YconvertDOMtoCanvas(t.y)}},s.prototype._drawNodes=function(t,e){void 0===e&&(e=!1);var i=this.nodes,s=[];for(var o in i)i.hasOwnProperty(o)&&(i[o].setScaleAndPos(this.scale,this.canvasTopLeft,this.canvasBottomRight),i[o].isSelected()?s.push(o):(i[o].inArea()||e)&&i[o].draw(t));for(var n=0,r=s.length;r>n;n++)(i[s[n]].inArea()||e)&&i[s[n]].draw(t)},s.prototype._drawEdges=function(t){var e=this.edges;for(var i in e)if(e.hasOwnProperty(i)){var s=e[i];s.setScale(this.scale),s.connected&&e[i].draw(t)}},s.prototype._drawControlNodes=function(t){var e=this.edges;for(var i in e)e.hasOwnProperty(i)&&e[i]._drawControlNodes(t)},s.prototype._stabilize=function(){1==this.constants.freezeForStabilization&&this._freezeDefinedNodes();for(var t=0;this.moving&&t0)for(t in i)i.hasOwnProperty(t)&&(i[t].discreteStepLimited(e,this.constants.maxVelocity),s=!0);else for(t in i)i.hasOwnProperty(t)&&(i[t].discreteStep(e),s=!0);if(1==s){var o=this.constants.minVelocity/Math.max(this.scale,.05);o>.5*this.constants.maxVelocity?this.moving=!0:(this.moving=this._isMoving(o),0==this.moving&&this.emit("stabilized",{iterations:null}),this.moving=this.moving||this.configurePhysics)}},s.prototype._physicsTick=function(){this.freezeSimulation||1==this.moving&&(this._doInAllActiveSectors("_initializeForceCalculation"),this._doInAllActiveSectors("_discreteStepNodes"),1==this.constants.smoothCurves.enabled&&1==this.constants.smoothCurves.dynamic&&this._doInSupportSector("_discreteStepNodes"),this._findCenter(this._getRange()))},s.prototype._animationStep=function(){this.timer=void 0,this._handleNavigation(),this.start();var t=Date.now(),e=1;this._physicsTick();for(var i=Date.now()-t;i<.9*(this.renderTimestep-this.renderTime)&&eh}return!1},s.prototype._getColor=function(){var t=this.color;return"to"==this.inheritColor?t={highlight:this.to.color.highlight.border,hover:this.to.color.hover.border,color:this.to.color.border}:("from"==this.inheritColor||1==this.inheritColor)&&(t={highlight:this.from.color.highlight.border,hover:this.from.color.hover.border,color:this.from.color.border}),1==this.selected?t.highlight:1==this.hover?t.hover:t.color},s.prototype._drawLine=function(t){if(t.strokeStyle=this._getColor(),t.lineWidth=this._getLineWidth(),this.from!=this.to){var e,i=this._line(t);if(this.label){if(1==this.smoothCurves.enabled&&null!=i){var s=.5*(.5*(this.from.x+i.x)+.5*(this.to.x+i.x)),o=.5*(.5*(this.from.y+i.y)+.5*(this.to.y+i.y));e={x:s,y:o}}else e=this._pointOnLine(.5);this._label(t,this.label,e.x,e.y)}}else{var n,r,a=this.length/4,h=this.from;h.width||h.resize(t),h.width>h.height?(n=h.x+h.width/2,r=h.y-a):(n=h.x+a,r=h.y-h.height/2),this._circle(t,n,r,a),e=this._pointOnCircle(n,r,a,.5),this._label(t,this.label,e.x,e.y)}},s.prototype._getLineWidth=function(){return 1==this.selected?Math.min(this.widthSelected,this.widthMax)*this.networkScaleInv:1==this.hover?Math.min(this.hoverWidth,this.widthMax)*this.networkScaleInv:this.width*this.networkScaleInv},s.prototype._getViaCoordinates=function(){var t=null,e=null,i=this.smoothCurves.roundness,s=this.smoothCurves.type,o=Math.abs(this.from.x-this.to.x),n=Math.abs(this.from.y-this.to.y);return"discrete"==s||"diagonalCross"==s?Math.abs(this.from.x-this.to.x)this.to.y?this.from.xthis.to.x&&(t=this.from.x-i*n,e=this.from.y-i*n):this.from.ythis.to.x&&(t=this.from.x-i*n,e=this.from.y+i*n)),"discrete"==s&&(t=i*n>o?this.from.x:t)):Math.abs(this.from.x-this.to.x)>Math.abs(this.from.y-this.to.y)&&(this.from.y>this.to.y?this.from.xthis.to.x&&(t=this.from.x-i*o,e=this.from.y-i*o):this.from.ythis.to.x&&(t=this.from.x-i*o,e=this.from.y+i*o)),"discrete"==s&&(e=i*o>n?this.from.y:e)):"straightCross"==s?Math.abs(this.from.x-this.to.x)Math.abs(this.from.y-this.to.y)&&(t=this.from.xthis.to.y?this.from.xthis.to.x&&(t=this.from.x-i*n,e=this.from.y-i*n,t=this.to.x>t?this.to.x:t):this.from.ythis.to.x&&(t=this.from.x-i*n,e=this.from.y+i*n,t=this.to.x>t?this.to.x:t)):Math.abs(this.from.x-this.to.x)>Math.abs(this.from.y-this.to.y)&&(this.from.y>this.to.y?this.from.xe?this.to.y:e):this.from.x>this.to.x&&(t=this.from.x-i*o,e=this.from.y-i*o,e=this.to.y>e?this.to.y:e):this.from.ythis.to.x&&(t=this.from.x-i*o,e=this.from.y+i*o,e=this.to.yl.height?(a=l.x+.5*l.width,h=l.y-d):(a=l.x+d,h=l.y-.5*l.height),this._circle(t,a,h,d);var s=.2*Math.PI,o=(10+5*this.width)*this.arrowScaleFactor;e=this._pointOnCircle(a,h,d,.5),t.arrow(e.x,e.y,s,o),t.fill(),t.stroke(),this.label&&(e=this._pointOnCircle(a,h,d,.5),this._label(t,this.label,e.x,e.y)) +}},s.prototype._drawArrow=function(t){1==this.selected?(t.strokeStyle=this.color.highlight,t.fillStyle=this.color.highlight):1==this.hover?(t.strokeStyle=this.color.hover,t.fillStyle=this.color.hover):(t.strokeStyle=this.color.color,t.fillStyle=this.color.color),t.lineWidth=this._getLineWidth();var e,i;if(this.from!=this.to){e=Math.atan2(this.to.y-this.from.y,this.to.x-this.from.x);var s,o=this.to.x-this.from.x,n=this.to.y-this.from.y,r=Math.sqrt(o*o+n*n),a=this.from.distanceToBorder(t,e+Math.PI),h=(r-a)/r,d=h*this.from.x+(1-h)*this.to.x,l=h*this.from.y+(1-h)*this.to.y;1==this.smoothCurves.dynamic&&1==this.smoothCurves.enabled?s=this.via:1==this.smoothCurves.enabled&&(s=this._getViaCoordinates()),1==this.smoothCurves.enabled&&null!=s.x&&(e=Math.atan2(this.to.y-s.y,this.to.x-s.x),o=this.to.x-s.x,n=this.to.y-s.y,r=Math.sqrt(o*o+n*n));var c,p,u=this.to.distanceToBorder(t,e),m=(r-u)/r;if(1==this.smoothCurves.enabled&&null!=s.x?(c=(1-m)*s.x+m*this.to.x,p=(1-m)*s.y+m*this.to.y):(c=(1-m)*this.from.x+m*this.to.x,p=(1-m)*this.from.y+m*this.to.y),t.beginPath(),t.moveTo(d,l),1==this.smoothCurves.enabled&&null!=s.x?t.quadraticCurveTo(s.x,s.y,c,p):t.lineTo(c,p),t.stroke(),i=(10+5*this.width)*this.arrowScaleFactor,t.arrow(c,p,e,i),t.fill(),t.stroke(),this.label){var g;if(1==this.smoothCurves.enabled&&null!=s){var f=.5*(.5*(this.from.x+s.x)+.5*(this.to.x+s.x)),v=.5*(.5*(this.from.y+s.y)+.5*(this.to.y+s.y));g={x:f,y:v}}else g=this._pointOnLine(.5);this._label(t,this.label,g.x,g.y)}}else{var y,b,_,x=this.from,w=.25*Math.max(100,this.length);x.width||x.resize(t),x.width>x.height?(y=x.x+.5*x.width,b=x.y-w,_={x:y,y:x.y,angle:.9*Math.PI}):(y=x.x+w,b=x.y-.5*x.height,_={x:x.x,y:b,angle:.6*Math.PI}),t.beginPath(),t.arc(y,b,w,0,2*Math.PI,!1),t.stroke();var i=(10+5*this.width)*this.arrowScaleFactor;t.arrow(_.x,_.y,_.angle,i),t.fill(),t.stroke(),this.label&&(g=this._pointOnCircle(y,b,w,.5),this._label(t,this.label,g.x,g.y))}},s.prototype._getDistanceToEdge=function(t,e,i,s,o,n){if(this.from!=this.to){if(1==this.smoothCurves.enabled){var r,a;if(1==this.smoothCurves.enabled&&1==this.smoothCurves.dynamic)r=this.via.x,a=this.via.y;else{var h=this._getViaCoordinates();r=h.x,a=h.y}var d,l,c,p,u,m,g,f=1e9;for(l=0;10>l;l++)c=.1*l,p=Math.pow(1-c,2)*t+2*c*(1-c)*r+Math.pow(c,2)*i,u=Math.pow(1-c,2)*e+2*c*(1-c)*a+Math.pow(c,2)*s,l>0&&(d=this._getDistanceToLine(m,g,p,u,o,n),f=f>d?d:f),m=p,g=u;return f}return this._getDistanceToLine(t,e,i,s,o,n)}var p,u,v,y,b=this.length/4,_=this.from;return _.width||_.resize(ctx),_.width>_.height?(p=_.x+_.width/2,u=_.y-b):(p=_.x+b,u=_.y-_.height/2),v=p-o,y=u-n,Math.abs(Math.sqrt(v*v+y*y)-b)},s.prototype._getDistanceToLine=function(t,e,i,s,o,n){var r=i-t,a=s-e,h=r*r+a*a,d=((o-t)*r+(n-e)*a)/h;d>1?d=1:0>d&&(d=0);var l=t+d*r,c=e+d*a,p=l-o,u=c-n;return Math.sqrt(p*p+u*u)},s.prototype.setScale=function(t){this.networkScaleInv=1/t},s.prototype.select=function(){this.selected=!0},s.prototype.unselect=function(){this.selected=!1},s.prototype.positionBezierNode=function(){null!==this.via&&(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y))},s.prototype._drawControlNodes=function(t){if(1==this.controlNodesEnabled){if(null===this.controlNodes.from&&null===this.controlNodes.to){var e="edgeIdFrom:".concat(this.id),i="edgeIdTo:".concat(this.id),s={nodes:{group:"",radius:8},physics:{damping:0},clustering:{maxNodeSizeIncrements:0,nodeScaling:{width:0,height:0,radius:0}}};this.controlNodes.from=new n({id:e,shape:"dot",color:{background:"#ff4e00",border:"#3c3c3c",highlight:{background:"#07f968"}}},{},{},s),this.controlNodes.to=new n({id:i,shape:"dot",color:{background:"#ff4e00",border:"#3c3c3c",highlight:{background:"#07f968"}}},{},{},s)}0==this.controlNodes.from.selected&&0==this.controlNodes.to.selected&&(this.controlNodes.positions=this.getControlNodePositions(t),this.controlNodes.from.x=this.controlNodes.positions.from.x,this.controlNodes.from.y=this.controlNodes.positions.from.y,this.controlNodes.to.x=this.controlNodes.positions.to.x,this.controlNodes.to.y=this.controlNodes.positions.to.y),this.controlNodes.from.draw(t),this.controlNodes.to.draw(t)}else this.controlNodes={from:null,to:null,positions:{}}},s.prototype._enableControlNodes=function(){this.controlNodesEnabled=!0},s.prototype._disableControlNodes=function(){this.controlNodesEnabled=!1},s.prototype._getSelectedControlNode=function(t,e){var i=this.controlNodes.positions,s=Math.sqrt(Math.pow(t-i.from.x,2)+Math.pow(e-i.from.y,2)),o=Math.sqrt(Math.pow(t-i.to.x,2)+Math.pow(e-i.to.y,2));return 15>s?(this.connectedNode=this.from,this.from=this.controlNodes.from,this.controlNodes.from):15>o?(this.connectedNode=this.to,this.to=this.controlNodes.to,this.controlNodes.to):null},s.prototype._restoreControlNodes=function(){1==this.controlNodes.from.selected&&(this.from=this.connectedNode,this.connectedNode=null,this.controlNodes.from.unselect()),1==this.controlNodes.to.selected&&(this.to=this.connectedNode,this.connectedNode=null,this.controlNodes.to.unselect())},s.prototype.getControlNodePositions=function(t){var e,i=Math.atan2(this.to.y-this.from.y,this.to.x-this.from.x),s=this.to.x-this.from.x,o=this.to.y-this.from.y,n=Math.sqrt(s*s+o*o),r=this.from.distanceToBorder(t,i+Math.PI),a=(n-r)/n,h=a*this.from.x+(1-a)*this.to.x,d=a*this.from.y+(1-a)*this.to.y;1==this.smoothCurves.dynamic&&1==this.smoothCurves.enabled?e=this.via:1==this.smoothCurves.enabled&&(e=this._getViaCoordinates()),1==this.smoothCurves.enabled&&null!=e.x&&(i=Math.atan2(this.to.y-e.y,this.to.x-e.x),s=this.to.x-e.x,o=this.to.y-e.y,n=Math.sqrt(s*s+o*o));var l,c,p=this.to.distanceToBorder(t,i),u=(n-p)/n;return 1==this.smoothCurves.enabled&&null!=e.x?(l=(1-u)*e.x+u*this.to.x,c=(1-u)*e.y+u*this.to.y):(l=(1-u)*this.from.x+u*this.to.x,c=(1-u)*this.from.y+u*this.to.y),{from:{x:h,y:d},to:{x:l,y:c}}},t.exports=s},function(t,e,i){function s(){this.clear(),this.defaultIndex=0}var o=i(1);s.DEFAULT=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}}],s.prototype.clear=function(){this.groups={},this.groups.length=function(){var t=0;for(var e in this)this.hasOwnProperty(e)&&t++;return t}},s.prototype.get=function(t){var e=this.groups[t];if(void 0==e){var i=this.defaultIndex%s.DEFAULT.length;this.defaultIndex++,e={},e.color=s.DEFAULT[i],this.groups[t]=e}return e},s.prototype.add=function(t,e){return this.groups[t]=e,e.color&&(e.color=o.parseColor(e.color)),e},t.exports=s},function(t){function e(){this.images={},this.callback=void 0}e.prototype.setOnloadCallback=function(t){this.callback=t},e.prototype.load=function(t){var e=this.images[t];if(void 0==e){var i=this;e=new Image,this.images[t]=e,e.onload=function(){i.callback&&i.callback(this)},e.src=t}return e},t.exports=e},function(t,e,i){function s(t,e,i,s){this.selected=!1,this.hover=!1,this.edges=[],this.dynamicEdges=[],this.reroutedEdges={},this.group=s.nodes.group,this.fontSize=Number(s.nodes.fontSize),this.fontFace=s.nodes.fontFace,this.fontColor=s.nodes.fontColor,this.fontDrawThreshold=3,this.color=s.nodes.color,this.id=void 0,this.shape=s.nodes.shape,this.image=s.nodes.image,this.x=null,this.y=null,this.xFixed=!1,this.yFixed=!1,this.horizontalAlignLeft=!0,this.verticalAlignTop=!0,this.radius=s.nodes.radius,this.baseRadiusValue=s.nodes.radius,this.radiusFixed=!1,this.radiusMin=s.nodes.radiusMin,this.radiusMax=s.nodes.radiusMax,this.level=-1,this.preassignedLevel=!1,this.borderWidth=s.nodes.borderWidth,this.borderWidthSelected=s.nodes.borderWidthSelected,this.imagelist=e,this.grouplist=i,this.fx=0,this.fy=0,this.vx=0,this.vy=0,this.minForce=s.minForce,this.damping=s.physics.damping,this.mass=1,this.fixedData={x:null,y:null},this.setProperties(t,s),this.resetCluster(),this.dynamicEdgesLength=0,this.clusterSession=0,this.clusterSizeWidthFactor=s.clustering.nodeScaling.width,this.clusterSizeHeightFactor=s.clustering.nodeScaling.height,this.clusterSizeRadiusFactor=s.clustering.nodeScaling.radius,this.maxNodeSizeIncrements=s.clustering.maxNodeSizeIncrements,this.growthIndicator=0,this.networkScaleInv=1,this.networkScale=1,this.canvasTopLeft={x:-300,y:-300},this.canvasBottomRight={x:300,y:300},this.parentEdgeId=null}var o=i(1);s.prototype.resetCluster=function(){this.formationScale=void 0,this.clusterSize=1,this.containedNodes={},this.containedEdges={},this.clusterSessions=[]},s.prototype.attachEdge=function(t){-1==this.edges.indexOf(t)&&this.edges.push(t),-1==this.dynamicEdges.indexOf(t)&&this.dynamicEdges.push(t),this.dynamicEdgesLength=this.dynamicEdges.length},s.prototype.detachEdge=function(t){var e=this.edges.indexOf(t);-1!=e&&(this.edges.splice(e,1),this.dynamicEdges.splice(e,1)),this.dynamicEdgesLength=this.dynamicEdges.length},s.prototype.setProperties=function(t,e){if(t){if(this.originalLabel=void 0,void 0!==t.id&&(this.id=t.id),void 0!==t.label&&(this.label=t.label,this.originalLabel=t.label),void 0!==t.title&&(this.title=t.title),void 0!==t.group&&(this.group=t.group),void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y),void 0!==t.value&&(this.value=t.value),void 0!==t.level&&(this.level=t.level,this.preassignedLevel=!0),void 0!==t.borderWidth&&(this.borderWidth=t.borderWidth),void 0!==t.borderWidthSelected&&(this.borderWidthSelected=t.borderWidthSelected),void 0!==t.mass&&(this.mass=t.mass),void 0!==t.horizontalAlignLeft&&(this.horizontalAlignLeft=t.horizontalAlignLeft),void 0!==t.verticalAlignTop&&(this.verticalAlignTop=t.verticalAlignTop),void 0!==t.triggerFunction&&(this.triggerFunction=t.triggerFunction),void 0===this.id)throw"Node must have an id";if(void 0!==this.group&&""!=this.group){var i=this.grouplist.get(this.group);for(var s in i)i.hasOwnProperty(s)&&(this[s]=i[s])}if(void 0!==t.shape&&(this.shape=t.shape),void 0!==t.image&&(this.image=t.image),void 0!==t.radius&&(this.radius=t.radius,this.baseRadiusValue=this.radius),void 0!==t.color&&(this.color=o.parseColor(t.color)),void 0!==t.fontColor&&(this.fontColor=t.fontColor),void 0!==t.fontSize&&(this.fontSize=t.fontSize),void 0!==t.fontFace&&(this.fontFace=t.fontFace),void 0!==this.image&&""!=this.image){if(!this.imagelist)throw"No imagelist provided";this.imageObj=this.imagelist.load(this.image)}switch(this.xFixed=this.xFixed||void 0!==t.x&&!t.allowedToMoveX,this.yFixed=this.yFixed||void 0!==t.y&&!t.allowedToMoveY,this.radiusFixed=this.radiusFixed||void 0!==t.radius,"image"==this.shape&&(this.radiusMin=e.nodes.widthMin,this.radiusMax=e.nodes.widthMax),this.shape){case"database":this.draw=this._drawDatabase,this.resize=this._resizeDatabase;break;case"box":this.draw=this._drawBox,this.resize=this._resizeBox;break;case"circle":this.draw=this._drawCircle,this.resize=this._resizeCircle;break;case"ellipse":this.draw=this._drawEllipse,this.resize=this._resizeEllipse;break;case"image":this.draw=this._drawImage,this.resize=this._resizeImage;break;case"text":this.draw=this._drawText,this.resize=this._resizeText;break;case"dot":this.draw=this._drawDot,this.resize=this._resizeShape;break;case"square":this.draw=this._drawSquare,this.resize=this._resizeShape;break;case"triangle":this.draw=this._drawTriangle,this.resize=this._resizeShape;break;case"triangleDown":this.draw=this._drawTriangleDown,this.resize=this._resizeShape;break;case"star":this.draw=this._drawStar,this.resize=this._resizeShape;break;default:this.draw=this._drawEllipse,this.resize=this._resizeEllipse}this._reset()}},s.prototype.select=function(){this.selected=!0,this._reset()},s.prototype.unselect=function(){this.selected=!1,this._reset()},s.prototype.clearSizeCache=function(){this._reset()},s.prototype._reset=function(){this.width=void 0,this.height=void 0},s.prototype.getTitle=function(){return"function"==typeof this.title?this.title():this.title},s.prototype.distanceToBorder=function(t,e){var i=1;switch(this.width||this.resize(t),this.shape){case"circle":case"dot":return this.radius+i;case"ellipse":var s=this.width/2,o=this.height/2,n=Math.sin(e)*s,r=Math.cos(e)*o;return s*o/Math.sqrt(n*n+r*r);case"box":case"image":case"text":default:return this.width?Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+i:0}},s.prototype._setForce=function(t,e){this.fx=t,this.fy=e},s.prototype._addForce=function(t,e){this.fx+=t,this.fy+=e},s.prototype.discreteStep=function(t){if(!this.xFixed){var e=this.damping*this.vx,i=(this.fx-e)/this.mass;this.vx+=i*t,this.x+=this.vx*t}if(!this.yFixed){var s=this.damping*this.vy,o=(this.fy-s)/this.mass;this.vy+=o*t,this.y+=this.vy*t}},s.prototype.discreteStepLimited=function(t,e){if(this.xFixed)this.fx=0;else{var i=this.damping*this.vx,s=(this.fx-i)/this.mass;this.vx+=s*t,this.vx=Math.abs(this.vx)>e?this.vx>0?e:-e:this.vx,this.x+=this.vx*t}if(this.yFixed)this.fy=0;else{var o=this.damping*this.vy,n=(this.fy-o)/this.mass;this.vy+=n*t,this.vy=Math.abs(this.vy)>e?this.vy>0?e:-e:this.vy,this.y+=this.vy*t}},s.prototype.isFixed=function(){return this.xFixed&&this.yFixed},s.prototype.isMoving=function(t){return Math.abs(this.vx)>t||Math.abs(this.vy)>t},s.prototype.isSelected=function(){return this.selected},s.prototype.getValue=function(){return this.value},s.prototype.getDistance=function(t,e){var i=this.x-t,s=this.y-e;return Math.sqrt(i*i+s*s)},s.prototype.setValueRange=function(t,e){if(!this.radiusFixed&&void 0!==this.value)if(e==t)this.radius=(this.radiusMin+this.radiusMax)/2;else{var i=(this.radiusMax-this.radiusMin)/(e-t);this.radius=(this.value-t)*i+this.radiusMin}this.baseRadiusValue=this.radius},s.prototype.draw=function(){throw"Draw method not initialized for node"},s.prototype.resize=function(){throw"Resize method not initialized for node"},s.prototype.isOverlappingWith=function(t){return this.leftt.left&&this.topt.top},s.prototype._resizeImage=function(){if(!this.width||!this.height){var t,e;if(this.value){this.radius=this.baseRadiusValue;var i=this.imageObj.height/this.imageObj.width;void 0!==i?(t=this.radius||this.imageObj.width,e=this.radius*i||this.imageObj.height):(t=0,e=0)}else t=this.imageObj.width,e=this.imageObj.height;this.width=t,this.height=e,this.growthIndicator=0,this.width>0&&this.height>0&&(this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-t)}},s.prototype._drawImage=function(t){this._resizeImage(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e;if(0!=this.imageObj.width){if(this.clusterSize>1){var i=this.clusterSize>1?10:0;i*=this.networkScaleInv,i=Math.min(.2*this.width,i),t.globalAlpha=.5,t.drawImage(this.imageObj,this.left-i,this.top-i,this.width+2*i,this.height+2*i)}t.globalAlpha=1,t.drawImage(this.imageObj,this.left,this.top,this.width,this.height),e=this.y+this.height/2}else e=this.y;this._label(t,this.label,this.x,e,void 0,"top")},s.prototype._resizeBox=function(t){if(!this.width){var e=5,i=this.getTextSize(t);this.width=i.width+2*e,this.height=i.height+2*e,this.width+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.growthIndicator=this.width-(i.width+2*e)}},s.prototype._drawBox=function(t){this._resizeBox(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e=2.5,i=this.borderWidth,s=this.borderWidthSelected||2*this.borderWidth;t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.roundRect(this.left-2*t.lineWidth,this.top-2*t.lineWidth,this.width+4*t.lineWidth,this.height+4*t.lineWidth,this.radius),t.stroke()),t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.color.background,t.roundRect(this.left,this.top,this.width,this.height,this.radius),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},s.prototype._resizeDatabase=function(t){if(!this.width){var e=5,i=this.getTextSize(t),s=i.width+2*e;this.width=s,this.height=s,this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-s}},s.prototype._drawDatabase=function(t){this._resizeDatabase(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e=2.5,i=this.borderWidth,s=this.borderWidthSelected||2*this.borderWidth;t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.database(this.x-this.width/2-2*t.lineWidth,this.y-.5*this.height-2*t.lineWidth,this.width+4*t.lineWidth,this.height+4*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t.database(this.x-this.width/2,this.y-.5*this.height,this.width,this.height),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},s.prototype._resizeCircle=function(t){if(!this.width){var e=5,i=this.getTextSize(t),s=Math.max(i.width,i.height)+2*e;this.radius=s/2,this.width=s,this.height=s,this.radius+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.radius-.5*s}},s.prototype._drawCircle=function(t){this._resizeCircle(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var e=2.5,i=this.borderWidth,s=this.borderWidthSelected||2*this.borderWidth;t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.circle(this.x,this.y,this.radius+2*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t.circle(this.x,this.y,this.radius),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},s.prototype._resizeEllipse=function(t){if(!this.width){var e=this.getTextSize(t);this.width=1.5*e.width,this.height=2*e.height,this.width1&&(t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.ellipse(this.left-2*t.lineWidth,this.top-2*t.lineWidth,this.width+4*t.lineWidth,this.height+4*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?s:i)+(this.clusterSize>1?e:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t.ellipse(this.left,this.top,this.width,this.height),t.fill(),t.stroke(),this._label(t,this.label,this.x,this.y)},s.prototype._drawDot=function(t){this._drawShape(t,"circle")},s.prototype._drawTriangle=function(t){this._drawShape(t,"triangle")},s.prototype._drawTriangleDown=function(t){this._drawShape(t,"triangleDown")},s.prototype._drawSquare=function(t){this._drawShape(t,"square")},s.prototype._drawStar=function(t){this._drawShape(t,"star")},s.prototype._resizeShape=function(){if(!this.width){this.radius=this.baseRadiusValue;var t=2*this.radius;this.width=t,this.height=t,this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=.5*Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-t}},s.prototype._drawShape=function(t,e){this._resizeShape(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2;var i=2.5,s=this.borderWidth,o=this.borderWidthSelected||2*this.borderWidth,n=2;switch(e){case"dot":n=2;break;case"square":n=2;break;case"triangle":n=3;break;case"triangleDown":n=3;break;case"star":n=4}t.strokeStyle=this.selected?this.color.highlight.border:this.hover?this.color.hover.border:this.color.border,this.clusterSize>1&&(t.lineWidth=(this.selected?o:s)+(this.clusterSize>1?i:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t[e](this.x,this.y,this.radius+n*t.lineWidth),t.stroke()),t.lineWidth=(this.selected?o:s)+(this.clusterSize>1?i:0),t.lineWidth*=this.networkScaleInv,t.lineWidth=Math.min(this.width,t.lineWidth),t.fillStyle=this.selected?this.color.highlight.background:this.hover?this.color.hover.background:this.color.background,t[e](this.x,this.y,this.radius),t.fill(),t.stroke(),this.label&&this._label(t,this.label,this.x,this.y+this.height/2,void 0,"top",!0)},s.prototype._resizeText=function(t){if(!this.width){var e=5,i=this.getTextSize(t);this.width=i.width+2*e,this.height=i.height+2*e,this.width+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeWidthFactor,this.height+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeHeightFactor,this.radius+=Math.min(this.clusterSize-1,this.maxNodeSizeIncrements)*this.clusterSizeRadiusFactor,this.growthIndicator=this.width-(i.width+2*e)}},s.prototype._drawText=function(t){this._resizeText(t),this.left=this.x-this.width/2,this.top=this.y-this.height/2,this._label(t,this.label,this.x,this.y)},s.prototype._label=function(t,e,i,s,o,n,r){if(e&&this.fontSize*this.networkScale>this.fontDrawThreshold){t.font=(this.selected?"bold ":"")+this.fontSize+"px "+this.fontFace,t.fillStyle=this.fontColor||"black",t.textAlign=o||"center",t.textBaseline=n||"middle";var a=e.split("\n"),h=a.length,d=this.fontSize+4,l=s+(1-h)/2*d;1==r&&(l=s+(1-h)/(2*d));for(var c=0;h>c;c++)t.fillText(a[c],i,l),l+=d}},s.prototype.getTextSize=function(t){if(void 0!==this.label){t.font=(this.selected?"bold ":"")+this.fontSize+"px "+this.fontFace;for(var e=this.label.split("\n"),i=(this.fontSize+4)*e.length,s=0,o=0,n=e.length;n>o;o++)s=Math.max(s,t.measureText(e[o]).width);return{width:s,height:i}}return{width:0,height:0}},s.prototype.inArea=function(){return void 0!==this.width?this.x+this.width*this.networkScaleInv>=this.canvasTopLeft.x&&this.x-this.width*this.networkScaleInv=this.canvasTopLeft.y&&this.y-this.height*this.networkScaleInv=this.canvasTopLeft.x&&this.x=this.canvasTopLeft.y&&this.ys&&(n=s-e-this.padding),no&&(r=o-i-this.padding),ri;i++)if(e.id===r.nodes[i].id){o=r.nodes[i];break}for(o||(o={id:e.id},t.node&&(o.attr=a(o.attr,t.node))),i=n.length-1;i>=0;i--){var h=n[i];h.nodes||(h.nodes=[]),-1==h.nodes.indexOf(o)&&h.nodes.push(o)}e.attr&&(o.attr=a(o.attr,e.attr))}function l(t,e){if(t.edges||(t.edges=[]),t.edges.push(e),t.edge){var i=a({},t.edge);e.attr=a(i,e.attr)}}function c(t,e,i,s,o){var n={from:e,to:i,type:s};return t.edge&&(n.attr=a({},t.edge)),n.attr=a(n.attr||{},o),n}function p(){for(k=C.NULL,O="";" "==L||" "==L||"\n"==L||"\r"==L;)o();do{var t=!1;if("#"==L){for(var e=T-1;" "==D.charAt(e)||" "==D.charAt(e);)e--;if("\n"==D.charAt(e)||""==D.charAt(e)){for(;""!=L&&"\n"!=L;)o();t=!0}}if("/"==L&&"/"==n()){for(;""!=L&&"\n"!=L;)o();t=!0}if("/"==L&&"*"==n()){for(;""!=L;){if("*"==L&&"/"==n()){o(),o();break}o()}t=!0}for(;" "==L||" "==L||"\n"==L||"\r"==L;)o()}while(t);if(""==L)return void(k=C.DELIMITER);var i=L+n();if(E[i])return k=C.DELIMITER,O=i,o(),void o();if(E[L])return k=C.DELIMITER,O=L,void o();if(r(L)||"-"==L){for(O+=L,o();r(L);)O+=L,o();return"false"==O?O=!1:"true"==O?O=!0:isNaN(Number(O))||(O=Number(O)),void(k=C.IDENTIFIER)}if('"'==L){for(o();""!=L&&('"'!=L||'"'==L&&'"'==n());)O+=L,'"'==L&&o(),o();if('"'!=L)throw x('End of string " expected');return o(),void(k=C.IDENTIFIER)}for(k=C.UNKNOWN;""!=L;)O+=L,o();throw new SyntaxError('Syntax error in part "'+w(O,30)+'"')}function u(){var t={};if(s(),p(),"strict"==O&&(t.strict=!0,p()),("graph"==O||"digraph"==O)&&(t.type=O,p()),k==C.IDENTIFIER&&(t.id=O,p()),"{"!=O)throw x("Angle bracket { expected");if(p(),m(t),"}"!=O)throw x("Angle bracket } expected");if(p(),""!==O)throw x("End of file expected");return p(),delete t.node,delete t.edge,delete t.graph,t}function m(t){for(;""!==O&&"}"!=O;)g(t),";"==O&&p()}function g(t){var e=f(t);if(e)return void b(t,e);var i=v(t);if(!i){if(k!=C.IDENTIFIER)throw x("Identifier expected");var s=O;if(p(),"="==O){if(p(),k!=C.IDENTIFIER)throw x("Identifier expected");t[s]=O,p()}else y(t,s)}}function f(t){var e=null;if("subgraph"==O&&(e={},e.type="subgraph",p(),k==C.IDENTIFIER&&(e.id=O,p())),"{"==O){if(p(),e||(e={}),e.parent=t,e.node=t.node,e.edge=t.edge,e.graph=t.graph,m(e),"}"!=O)throw x("Angle bracket } expected");p(),delete e.node,delete e.edge,delete e.graph,delete e.parent,t.subgraphs||(t.subgraphs=[]),t.subgraphs.push(e)}return e}function v(t){return"node"==O?(p(),t.node=_(),"node"):"edge"==O?(p(),t.edge=_(),"edge"):"graph"==O?(p(),t.graph=_(),"graph"):null}function y(t,e){var i={id:e},s=_();s&&(i.attr=s),d(t,i),b(t,e)}function b(t,e){for(;"->"==O||"--"==O;){var i,s=O;p();var o=f(t);if(o)i=o;else{if(k!=C.IDENTIFIER)throw x("Identifier or subgraph expected");i=O,d(t,{id:i}),p()}var n=_(),r=c(t,e,i,s,n);l(t,r),e=i}}function _(){for(var t=null;"["==O;){for(p(),t={};""!==O&&"]"!=O;){if(k!=C.IDENTIFIER)throw x("Attribute name expected");var e=O;if(p(),"="!=O)throw x("Equal sign = expected");if(p(),k!=C.IDENTIFIER)throw x("Attribute value expected");var i=O;h(t,e,i),p(),","==O&&p()}if("]"!=O)throw x("Bracket ] expected");p()}return t}function x(t){return new SyntaxError(t+', got "'+w(O,30)+'" (char '+T+")")}function w(t,e){return t.length<=e?t:t.substr(0,27)+"..."}function S(t,e,i){t instanceof Array?t.forEach(function(t){e instanceof Array?e.forEach(function(e){i(t,e)}):i(t,e)}):e instanceof Array?e.forEach(function(e){i(t,e)}):i(t,e)}function M(t){function e(t){var e={from:t.from,to:t.to};return a(e,t.attr),e.style="->"==t.type?"arrow":"line",e}var s=i(t),o={nodes:[],edges:[],options:{}};return s.nodes&&s.nodes.forEach(function(t){var e={id:t.id,label:String(t.label||t.id)};a(e,t.attr),e.image&&(e.shape="image"),o.nodes.push(e)}),s.edges&&s.edges.forEach(function(t){var i,s;i=t.from instanceof Object?t.from.nodes:{id:t.from},s=t.to instanceof Object?t.to.nodes:{id:t.to},t.from instanceof Object&&t.from.edges&&t.from.edges.forEach(function(t){var i=e(t);o.edges.push(i)}),S(i,s,function(i,s){var n=c(o,i.id,s.id,t.type,t.attr),r=e(n);o.edges.push(r)}),t.to instanceof Object&&t.to.edges&&t.to.edges.forEach(function(t){var i=e(t);o.edges.push(i)})}),s.attr&&(o.options=s.attr),o}var C={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},E={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},D="",T=0,L="",O="",k=C.NULL,N=/[a-zA-Z_0-9.:#]/;e.parseDOT=i,e.DOTToGraph=M},function(t,e){function i(t,e){var i=[],s=[]; +this.options={edges:{inheritColor:!0},nodes:{allowedToMove:!1,parseColor:!1}},void 0!==e&&(this.options.nodes.allowedToMove=e.allowedToMove|!1,this.options.nodes.parseColor=e.parseColor|!1,this.options.edges.inheritColor=e.inheritColor|!0);for(var o=t.edges,n=t.nodes,r=0;rs;s++){var o=s%2===0?1.3*i:.5*i;this.lineTo(t+o*Math.sin(2*s*Math.PI/10),e-o*Math.cos(2*s*Math.PI/10))}this.closePath()},CanvasRenderingContext2D.prototype.roundRect=function(t,e,i,s,o){var n=Math.PI/180;0>i-2*o&&(o=i/2),0>s-2*o&&(o=s/2),this.beginPath(),this.moveTo(t+o,e),this.lineTo(t+i-o,e),this.arc(t+i-o,e+o,o,270*n,360*n,!1),this.lineTo(t+i,e+s-o),this.arc(t+i-o,e+s-o,o,0,90*n,!1),this.lineTo(t+o,e+s),this.arc(t+o,e+s-o,o,90*n,180*n,!1),this.lineTo(t,e+o),this.arc(t+o,e+o,o,180*n,270*n,!1)},CanvasRenderingContext2D.prototype.ellipse=function(t,e,i,s){var o=.5522848,n=i/2*o,r=s/2*o,a=t+i,h=e+s,d=t+i/2,l=e+s/2;this.beginPath(),this.moveTo(t,l),this.bezierCurveTo(t,l-r,d-n,e,d,e),this.bezierCurveTo(d+n,e,a,l-r,a,l),this.bezierCurveTo(a,l+r,d+n,h,d,h),this.bezierCurveTo(d-n,h,t,l+r,t,l)},CanvasRenderingContext2D.prototype.database=function(t,e,i,s){var o=1/3,n=i,r=s*o,a=.5522848,h=n/2*a,d=r/2*a,l=t+n,c=e+r,p=t+n/2,u=e+r/2,m=e+(s-r/2),g=e+s;this.beginPath(),this.moveTo(l,u),this.bezierCurveTo(l,u+d,p+h,c,p,c),this.bezierCurveTo(p-h,c,t,u+d,t,u),this.bezierCurveTo(t,u-d,p-h,e,p,e),this.bezierCurveTo(p+h,e,l,u-d,l,u),this.lineTo(l,m),this.bezierCurveTo(l,m+d,p+h,g,p,g),this.bezierCurveTo(p-h,g,t,m+d,t,m),this.lineTo(t,u)},CanvasRenderingContext2D.prototype.arrow=function(t,e,i,s){var o=t-s*Math.cos(i),n=e-s*Math.sin(i),r=t-.9*s*Math.cos(i),a=e-.9*s*Math.sin(i),h=o+s/3*Math.cos(i+.5*Math.PI),d=n+s/3*Math.sin(i+.5*Math.PI),l=o+s/3*Math.cos(i-.5*Math.PI),c=n+s/3*Math.sin(i-.5*Math.PI);this.beginPath(),this.moveTo(t,e),this.lineTo(h,d),this.lineTo(r,a),this.lineTo(l,c),this.closePath()},CanvasRenderingContext2D.prototype.dashedLine=function(t,e,i,s,o){o||(o=[10,5]),0==p&&(p=.001);var n=o.length;this.moveTo(t,e);for(var r=i-t,a=s-e,h=a/r,d=Math.sqrt(r*r+a*a),l=0,c=!0;d>=.1;){var p=o[l++%n];p>d&&(p=d);var u=Math.sqrt(p*p/(1+h*h));0>r&&(u=-u),t+=u,e+=h*u,this[c?"lineTo":"moveTo"](t,e),d-=p,c=!c}})},function(t,e,i){var s=i(55),o=i(49),n=i(50),r=i(51),a=i(52),h=i(53),d=i(54);e._loadMixin=function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])},e._clearMixin=function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=void 0)},e._loadPhysicsSystem=function(){this._loadMixin(s),this._loadSelectedForceSolver(),1==this.constants.configurePhysics&&this._loadPhysicsConfiguration()},e._loadClusterSystem=function(){this.clusterSession=0,this.hubThreshold=5,this._loadMixin(o)},e._loadSectorSystem=function(){this.sectors={},this.activeSector=["default"],this.sectors.active={},this.sectors.active["default"]={nodes:{},edges:{},nodeIndices:[],formationScale:1,drawingNode:void 0},this.sectors.frozen={},this.sectors.support={nodes:{},edges:{},nodeIndices:[],formationScale:1,drawingNode:void 0},this.nodeIndices=this.sectors.active["default"].nodeIndices,this._loadMixin(n)},e._loadSelectionSystem=function(){this.selectionObj={nodes:{},edges:{}},this._loadMixin(r)},e._loadManipulationSystem=function(){this.blockConnectingEdgeSelection=!1,this.forceAppendSelection=!1,1==this.constants.dataManipulation.enabled?(void 0===this.manipulationDiv&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="network-manipulationDiv",this.manipulationDiv.id="network-manipulationDiv",this.manipulationDiv.style.display=1==this.editMode?"block":"none",this.containerElement.insertBefore(this.manipulationDiv,this.frame)),void 0===this.editModeDiv&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="network-manipulation-editMode",this.editModeDiv.id="network-manipulation-editMode",this.editModeDiv.style.display=1==this.editMode?"none":"block",this.containerElement.insertBefore(this.editModeDiv,this.frame)),void 0===this.closeDiv&&(this.closeDiv=document.createElement("div"),this.closeDiv.className="network-manipulation-closeDiv",this.closeDiv.id="network-manipulation-closeDiv",this.closeDiv.style.display=this.manipulationDiv.style.display,this.containerElement.insertBefore(this.closeDiv,this.frame)),this._loadMixin(a),this._createManipulatorBar()):void 0!==this.manipulationDiv&&(this._createManipulatorBar(),this.containerElement.removeChild(this.manipulationDiv),this.containerElement.removeChild(this.editModeDiv),this.containerElement.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this._clearMixin(a))},e._loadNavigationControls=function(){this._loadMixin(h),this._cleanNavigation(),1==this.constants.navigation.enabled&&this._loadNavigationElements()},e._loadHierarchySystem=function(){this._loadMixin(d)}},function(t){function e(t){return t?i(t):void 0}function i(t){for(var i in e.prototype)t[i]=e.prototype[i];return t}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},e.prototype.once=function(t,e){function i(){s.off(t,i),e.apply(this,arguments)}var s=this;return this._callbacks=this._callbacks||{},i.fn=e,this.on(t,i),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks[t];if(!i)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var s,o=0;os;++s)i[s].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t){function e(t,e,i){return t.addEventListener?t.addEventListener(e,i,!1):void t.attachEvent("on"+e,i)}function i(t){return"keypress"==t.type?String.fromCharCode(t.which):_[t.which]?_[t.which]:x[t.which]?x[t.which]:String.fromCharCode(t.which).toLowerCase()}function s(t){var e=t.target||t.srcElement,i=e.tagName;return(" "+e.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"==i||"SELECT"==i||"TEXTAREA"==i||e.contentEditable&&"true"==e.contentEditable}function o(t,e){return t.sort().join(",")===e.sort().join(",")}function n(t){t=t||{};var e,i=!1;for(e in E)t[e]?i=!0:E[e]=0;i||(T=!1)}function r(t,e,i,s,n){var r,a,h=[];if(!M[t])return[];for("keyup"==i&&c(t)&&(e=[t]),r=0;r95&&112>t||_.hasOwnProperty(t)&&(y[_[t]]=t)}return y}function m(t,e,i){return i||(i=u()[t]?"keydown":"keypress"),"keypress"==i&&e.length&&(i="keydown"),i}function g(t,e,s,o){E[t]=0,o||(o=m(e[0],[]));var r,a=function(){T=o,++E[t],p()},d=function(t){h(s,t),"keyup"!==o&&(D=i(t)),setTimeout(n,10)};for(r=0;r1)return g(t,d,e,i);for(h="+"===t?["+"]:t.split("+"),n=0;n":".","?":"/","|":"\\"},S={option:"alt",command:"meta","return":"enter",escape:"esc"},M={},C={},E={},D=!1,T=!1,L=1;20>L;++L)_[111+L]="f"+L;for(L=0;9>=L;++L)_[L+96]=L;e(document,"keypress",l),e(document,"keydown",l),e(document,"keyup",l);var O={bind:function(t,e,i){return v(t instanceof Array?t:[t],e,i),C[t+":"+i]=e,this},unbind:function(t,e){return C[t+":"+e]&&(delete C[t+":"+e],this.bind(t,function(){},e)),this},trigger:function(t,e){return C[t+":"+e](),this},reset:function(){return M={},C={},this}};t.exports=O},function(t,e,i){var s;(function(t,o){(function(n){function r(t,e,i){switch(arguments.length){case 2:return null!=t?t:e;case 3:return null!=t?t:null!=e?e:i;default:throw new Error("Implement me")}}function a(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function h(t,e){function i(){ve.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}var s=!0;return m(function(){return s&&(i(),s=!1),e.apply(this,arguments)},e)}function d(t,e){return function(i){return v(t.call(this,i),e)}}function l(t,e){return function(i){return this.lang().ordinal(t.call(this,i),e)}}function c(){}function p(t){O(t),m(this,t)}function u(t){var e=S(t),i=e.year||0,s=e.quarter||0,o=e.month||0,n=e.week||0,r=e.day||0,a=e.hour||0,h=e.minute||0,d=e.second||0,l=e.millisecond||0;this._milliseconds=+l+1e3*d+6e4*h+36e5*a,this._days=+r+7*n,this._months=+o+3*s+12*i,this._data={},this._bubble()}function m(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return e.hasOwnProperty("toString")&&(t.toString=e.toString),e.hasOwnProperty("valueOf")&&(t.valueOf=e.valueOf),t}function g(t){var e,i={};for(e in t)t.hasOwnProperty(e)&&ke.hasOwnProperty(e)&&(i[e]=t[e]);return i}function f(t){return 0>t?Math.ceil(t):Math.floor(t)}function v(t,e,i){for(var s=""+Math.abs(t),o=t>=0;s.lengths;s++)(i&&t[s]!==e[s]||!i&&C(t[s])!==C(e[s]))&&r++;return r+n}function w(t){if(t){var e=t.toLowerCase().replace(/(.)s$/,"$1");t=ri[t]||ai[e]||e}return t}function S(t){var e,i,s={};for(i in t)t.hasOwnProperty(i)&&(e=w(i),e&&(s[e]=t[i]));return s}function M(t){var e,i;if(0===t.indexOf("week"))e=7,i="day";else{if(0!==t.indexOf("month"))return;e=12,i="month"}ve[t]=function(s,o){var r,a,h=ve.fn._lang[t],d=[];if("number"==typeof s&&(o=s,s=n),a=function(t){var e=ve().utc().set(i,t);return h.call(ve.fn._lang,e,s||"")},null!=o)return a(o);for(r=0;e>r;r++)d.push(a(r));return d}}function C(t){var e=+t,i=0;return 0!==e&&isFinite(e)&&(i=e>=0?Math.floor(e):Math.ceil(e)),i}function E(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function D(t,e,i){return re(ve([t,11,31+e-i]),e,i).week}function T(t){return L(t)?366:365}function L(t){return t%4===0&&t%100!==0||t%400===0}function O(t){var e;t._a&&-2===t._pf.overflow&&(e=t._a[Me]<0||t._a[Me]>11?Me:t._a[Ce]<1||t._a[Ce]>E(t._a[Se],t._a[Me])?Ce:t._a[Ee]<0||t._a[Ee]>23?Ee:t._a[De]<0||t._a[De]>59?De:t._a[Te]<0||t._a[Te]>59?Te:t._a[Le]<0||t._a[Le]>999?Le:-1,t._pf._overflowDayOfYear&&(Se>e||e>Ce)&&(e=Ce),t._pf.overflow=e)}function k(t){return null==t._isValid&&(t._isValid=!isNaN(t._d.getTime())&&t._pf.overflow<0&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&0===t._pf.charsLeftOver&&0===t._pf.unusedTokens.length)),t._isValid}function N(t){return t?t.toLowerCase().replace("_","-"):t}function I(t,e){return e._isUTC?ve(t).zone(e._offset||0):ve(t).local()}function A(t,e){return e.abbr=t,Oe[t]||(Oe[t]=new c),Oe[t].set(e),Oe[t]}function z(t){delete Oe[t]}function P(t){var e,s,o,n,r=0,a=function(t){if(!Oe[t]&&Ne)try{i(56)("./"+t)}catch(e){}return Oe[t]};if(!t)return ve.fn._lang;if(!b(t)){if(s=a(t))return s;t=[t]}for(;r0;){if(s=a(n.slice(0,e).join("-")))return s;if(o&&o.length>=e&&x(n,o,!0)>=e-1)break;e--}r++}return ve.fn._lang}function R(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function F(t){var e,i,s=t.match(Pe);for(e=0,i=s.length;i>e;e++)s[e]=pi[s[e]]?pi[s[e]]:R(s[e]);return function(o){var n="";for(e=0;i>e;e++)n+=s[e]instanceof Function?s[e].call(o,t):s[e];return n}}function H(t,e){return t.isValid()?(e=Y(e,t.lang()),hi[e]||(hi[e]=F(e)),hi[e](t)):t.lang().invalidDate()}function Y(t,e){function i(t){return e.longDateFormat(t)||t}var s=5;for(Re.lastIndex=0;s>=0&&Re.test(t);)t=t.replace(Re,i),Re.lastIndex=0,s-=1;return t}function B(t,e){var i,s=e._strict;switch(t){case"Q":return Ze;case"DDDD":return Ke;case"YYYY":case"GGGG":case"gggg":return s?$e:Ye;case"Y":case"G":case"g":return Qe;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return s?Je:Be;case"S":if(s)return Ze;case"SS":if(s)return qe;case"SSS":if(s)return Ke;case"DDD":return He;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ge;case"a":case"A":return P(e._l)._meridiemParse;case"X":return Ue;case"Z":case"ZZ":return je;case"T":return Ve;case"SSSS":return We;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return s?qe:Fe;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Fe;case"Do":return Xe;default:return i=new RegExp(K(q(t.replace("\\","")),"i"))}}function W(t){t=t||"";var e=t.match(je)||[],i=e[e.length-1]||[],s=(i+"").match(oi)||["-",0,0],o=+(60*s[1])+C(s[2]);return"+"===s[0]?-o:o}function G(t,e,i){var s,o=i._a;switch(t){case"Q":null!=e&&(o[Me]=3*(C(e)-1));break;case"M":case"MM":null!=e&&(o[Me]=C(e)-1);break;case"MMM":case"MMMM":s=P(i._l).monthsParse(e),null!=s?o[Me]=s:i._pf.invalidMonth=e;break;case"D":case"DD":null!=e&&(o[Ce]=C(e));break;case"Do":null!=e&&(o[Ce]=C(parseInt(e,10)));break;case"DDD":case"DDDD":null!=e&&(i._dayOfYear=C(e));break;case"YY":o[Se]=ve.parseTwoDigitYear(e);break;case"YYYY":case"YYYYY":case"YYYYYY":o[Se]=C(e);break;case"a":case"A":i._isPm=P(i._l).isPM(e);break;case"H":case"HH":case"h":case"hh":o[Ee]=C(e);break;case"m":case"mm":o[De]=C(e);break;case"s":case"ss":o[Te]=C(e);break;case"S":case"SS":case"SSS":case"SSSS":o[Le]=C(1e3*("0."+e));break;case"X":i._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":i._useUTC=!0,i._tzm=W(e);break;case"dd":case"ddd":case"dddd":s=P(i._l).weekdaysParse(e),null!=s?(i._w=i._w||{},i._w.d=s):i._pf.invalidWeekday=e;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":t=t.substr(0,1);case"gggg":case"GGGG":case"GGGGG":t=t.substr(0,2),e&&(i._w=i._w||{},i._w[t]=C(e));break;case"gg":case"GG":i._w=i._w||{},i._w[t]=ve.parseTwoDigitYear(e)}}function j(t){var e,i,s,o,n,a,h,d;e=t._w,null!=e.GG||null!=e.W||null!=e.E?(n=1,a=4,i=r(e.GG,t._a[Se],re(ve(),1,4).year),s=r(e.W,1),o=r(e.E,1)):(d=P(t._l),n=d._week.dow,a=d._week.doy,i=r(e.gg,t._a[Se],re(ve(),n,a).year),s=r(e.w,1),null!=e.d?(o=e.d,n>o&&++s):o=null!=e.e?e.e+n:n),h=ae(i,s,o,a,n),t._a[Se]=h.year,t._dayOfYear=h.dayOfYear}function V(t){var e,i,s,o,n=[];if(!t._d){for(s=X(t),t._w&&null==t._a[Ce]&&null==t._a[Me]&&j(t),t._dayOfYear&&(o=r(t._a[Se],s[Se]),t._dayOfYear>T(o)&&(t._pf._overflowDayOfYear=!0),i=ie(o,0,t._dayOfYear),t._a[Me]=i.getUTCMonth(),t._a[Ce]=i.getUTCDate()),e=0;3>e&&null==t._a[e];++e)t._a[e]=n[e]=s[e];for(;7>e;e++)t._a[e]=n[e]=null==t._a[e]?2===e?1:0:t._a[e];t._d=(t._useUTC?ie:ee).apply(null,n),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()+t._tzm)}}function U(t){var e;t._d||(e=S(t._i),t._a=[e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond],V(t))}function X(t){var e=new Date;return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function Z(t){if(t._f===ve.ISO_8601)return void J(t);t._a=[],t._pf.empty=!0;var e,i,s,o,n,r=P(t._l),a=""+t._i,h=a.length,d=0;for(s=Y(t._f,r).match(Pe)||[],e=0;e0&&t._pf.unusedInput.push(n),a=a.slice(a.indexOf(i)+i.length),d+=i.length),pi[o]?(i?t._pf.empty=!1:t._pf.unusedTokens.push(o),G(o,i,t)):t._strict&&!i&&t._pf.unusedTokens.push(o);t._pf.charsLeftOver=h-d,a.length>0&&t._pf.unusedInput.push(a),t._isPm&&t._a[Ee]<12&&(t._a[Ee]+=12),t._isPm===!1&&12===t._a[Ee]&&(t._a[Ee]=0),V(t),O(t)}function q(t){return t.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,i,s,o){return e||i||s||o})}function K(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(t){var e,i,s,o,n;if(0===t._f.length)return t._pf.invalidFormat=!0,void(t._d=new Date(0/0));for(o=0;on)&&(s=n,i=e));m(t,i||e)}function J(t){var e,i,s=t._i,o=ti.exec(s);if(o){for(t._pf.iso=!0,e=0,i=ii.length;i>e;e++)if(ii[e][1].exec(s)){t._f=ii[e][0]+(o[6]||" ");break}for(e=0,i=si.length;i>e;e++)if(si[e][1].exec(s)){t._f+=si[e][0];break}s.match(je)&&(t._f+="Z"),Z(t)}else t._isValid=!1}function Q(t){J(t),t._isValid===!1&&(delete t._isValid,ve.createFromInputFallback(t))}function te(t){var e=t._i,i=Ie.exec(e);e===n?t._d=new Date:i?t._d=new Date(+i[1]):"string"==typeof e?Q(t):b(e)?(t._a=e.slice(0),V(t)):_(e)?t._d=new Date(+e):"object"==typeof e?U(t):"number"==typeof e?t._d=new Date(e):ve.createFromInputFallback(t)}function ee(t,e,i,s,o,n,r){var a=new Date(t,e,i,s,o,n,r);return 1970>t&&a.setFullYear(t),a}function ie(t){var e=new Date(Date.UTC.apply(null,arguments));return 1970>t&&e.setUTCFullYear(t),e}function se(t,e){if("string"==typeof t)if(isNaN(t)){if(t=e.weekdaysParse(t),"number"!=typeof t)return null}else t=parseInt(t,10);return t}function oe(t,e,i,s,o){return o.relativeTime(e||1,!!i,t,s)}function ne(t,e,i){var s=we(Math.abs(t)/1e3),o=we(s/60),n=we(o/60),r=we(n/24),a=we(r/365),h=s0,h[4]=i,oe.apply({},h)}function re(t,e,i){var s,o=i-e,n=i-t.day();return n>o&&(n-=7),o-7>n&&(n+=7),s=ve(t).add("d",n),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function ae(t,e,i,s,o){var n,r,a=ie(t,0,1).getUTCDay();return a=0===a?7:a,i=null!=i?i:o,n=o-a+(a>s?7:0)-(o>a?7:0),r=7*(e-1)+(i-o)+n+1,{year:r>0?t:t-1,dayOfYear:r>0?r:T(t-1)+r}}function he(t){var e=t._i,i=t._f;return null===e||i===n&&""===e?ve.invalid({nullInput:!0}):("string"==typeof e&&(t._i=e=P().preparse(e)),ve.isMoment(e)?(t=g(e),t._d=new Date(+e._d)):i?b(i)?$(t):Z(t):te(t),new p(t))}function de(t,e){var i,s;if(1===e.length&&b(e[0])&&(e=e[0]),!e.length)return ve();for(i=e[0],s=1;s=0?"+":"-";return e+v(Math.abs(t),6)},gg:function(){return v(this.weekYear()%100,2)},gggg:function(){return v(this.weekYear(),4)},ggggg:function(){return v(this.weekYear(),5)},GG:function(){return v(this.isoWeekYear()%100,2)},GGGG:function(){return v(this.isoWeekYear(),4)},GGGGG:function(){return v(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return C(this.milliseconds()/100)},SS:function(){return v(C(this.milliseconds()/10),2)},SSS:function(){return v(this.milliseconds(),3)},SSSS:function(){return v(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+v(C(t/60),2)+":"+v(C(t)%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+v(C(t/60),2)+v(C(t)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},ui=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];li.length;)be=li.pop(),pi[be+"o"]=l(pi[be],be);for(;ci.length;)be=ci.pop(),pi[be+be]=d(pi[be],2);for(pi.DDDD=d(pi.DDD,3),m(c.prototype,{set:function(t){var e,i;for(i in t)e=t[i],"function"==typeof e?this[i]=e:this["_"+i]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,i,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(i=ve.utc([2e3,e]),s="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,i,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(i=ve([2e3,1]).day(e),s="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,i){return t>11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var i=this._calendar[t];return"function"==typeof i?i.apply(e):i},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,i,s){var o=this._relativeTime[i];return"function"==typeof o?o(t,e,i,s):o.replace(/%d/i,t)},pastFuture:function(t,e){var i=this._relativeTime[t>0?"future":"past"];return"function"==typeof i?i(e):i.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return re(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),ve=function(t,e,i,s){var o;return"boolean"==typeof i&&(s=i,i=n),o={},o._isAMomentObject=!0,o._i=t,o._f=e,o._l=i,o._strict=s,o._isUTC=!1,o._pf=a(),he(o)},ve.suppressDeprecationWarnings=!1,ve.createFromInputFallback=h("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i)}),ve.min=function(){var t=[].slice.call(arguments,0);return de("isBefore",t)},ve.max=function(){var t=[].slice.call(arguments,0);return de("isAfter",t)},ve.utc=function(t,e,i,s){var o;return"boolean"==typeof i&&(s=i,i=n),o={},o._isAMomentObject=!0,o._useUTC=!0,o._isUTC=!0,o._l=i,o._i=t,o._f=e,o._strict=s,o._pf=a(),he(o).utc()},ve.unix=function(t){return ve(1e3*t)},ve.duration=function(t,e){var i,s,o,n=t,r=null;return ve.isDuration(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(n={},e?n[e]=t:n.milliseconds=t):(r=Ae.exec(t))?(i="-"===r[1]?-1:1,n={y:0,d:C(r[Ce])*i,h:C(r[Ee])*i,m:C(r[De])*i,s:C(r[Te])*i,ms:C(r[Le])*i}):(r=ze.exec(t))&&(i="-"===r[1]?-1:1,o=function(t){var e=t&&parseFloat(t.replace(",","."));return(isNaN(e)?0:e)*i},n={y:o(r[2]),M:o(r[3]),d:o(r[4]),h:o(r[5]),m:o(r[6]),s:o(r[7]),w:o(r[8])}),s=new u(n),ve.isDuration(t)&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},ve.version=_e,ve.defaultFormat=ei,ve.ISO_8601=function(){},ve.momentProperties=ke,ve.updateOffset=function(){},ve.relativeTimeThreshold=function(t,e){return di[t]===n?!1:(di[t]=e,!0)},ve.lang=function(t,e){var i;return t?(e?A(N(t),e):null===e?(z(t),t="en"):Oe[t]||P(t),i=ve.duration.fn._lang=ve.fn._lang=P(t),i._abbr):ve.fn._lang._abbr},ve.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),P(t)},ve.isMoment=function(t){return t instanceof p||null!=t&&t.hasOwnProperty("_isAMomentObject")},ve.isDuration=function(t){return t instanceof u},be=ui.length-1;be>=0;--be)M(ui[be]);ve.normalizeUnits=function(t){return w(t)},ve.invalid=function(t){var e=ve.utc(0/0);return null!=t?m(e._pf,t):e._pf.userInvalidated=!0,e},ve.parseZone=function(){return ve.apply(null,arguments).parseZone()},ve.parseTwoDigitYear=function(t){return C(t)+(C(t)>68?1900:2e3)},m(ve.fn=p.prototype,{clone:function(){return ve(this)},valueOf:function(){return+this._d+6e4*(this._offset||0) +},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var t=ve(this).utc();return 00:!1},parsingFlags:function(){return m({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=H(this,t||ve.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var i;return i="string"==typeof t&&"string"==typeof e?ve.duration(isNaN(+e)?+t:+e,isNaN(+e)?e:t):"string"==typeof t?ve.duration(+e,t):ve.duration(t,e),y(this,i,1),this},subtract:function(t,e){var i;return i="string"==typeof t&&"string"==typeof e?ve.duration(isNaN(+e)?+t:+e,isNaN(+e)?e:t):"string"==typeof t?ve.duration(+e,t):ve.duration(t,e),y(this,i,-1),this},diff:function(t,e,i){var s,o,n=I(t,this),r=6e4*(this.zone()-n.zone());return e=w(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+n.daysInMonth()),o=12*(this.year()-n.year())+(this.month()-n.month()),o+=(this-ve(this).startOf("month")-(n-ve(n).startOf("month")))/s,o-=6e4*(this.zone()-ve(this).startOf("month").zone()-(n.zone()-ve(n).startOf("month").zone()))/s,"year"===e&&(o/=12)):(s=this-n,o="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-r)/864e5:"week"===e?(s-r)/6048e5:s),i?o:f(o)},from:function(t,e){return ve.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(ve(),t)},calendar:function(t){var e=t||ve(),i=I(e,this).startOf("day"),s=this.diff(i,"days",!0),o=-6>s?"sameElse":-1>s?"lastWeek":0>s?"lastDay":1>s?"sameDay":2>s?"nextDay":7>s?"nextWeek":"sameElse";return this.format(this.lang().calendar(o,this))},isLeapYear:function(){return L(this.year())},isDST:function(){return this.zone()+ve(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+ve(t).startOf(e)},isSame:function(t,e){return e=e||"ms",+this.clone().startOf(e)===+I(t,this).startOf(e)},min:h("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(t){return t=ve.apply(null,arguments),this>t?this:t}),max:h("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(t){return t=ve.apply(null,arguments),t>this?this:t}),zone:function(t,e){var i=this._offset||0;return null==t?this._isUTC?i:this._d.getTimezoneOffset():("string"==typeof t&&(t=W(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,i!==t&&(!e||this._changeInProgress?y(this,ve.duration(i-t,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ve.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(t){return t=t?ve(t).zone():0,(this.zone()-t)%60===0},daysInMonth:function(){return E(this.year(),this.month())},dayOfYear:function(t){var e=we((ve(this).startOf("day")-ve(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},quarter:function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},weekYear:function(t){var e=re(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=re(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=re(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this.day()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},isoWeeksInYear:function(){return D(this.year(),1,4)},weeksInYear:function(){var t=this._lang._week;return D(this.year(),t.dow,t.doy)},get:function(t){return t=w(t),this[t]()},set:function(t,e){return t=w(t),"function"==typeof this[t]&&this[t](e),this},lang:function(t){return t===n?this._lang:(this._lang=P(t),this)}}),ve.fn.millisecond=ve.fn.milliseconds=ue("Milliseconds",!1),ve.fn.second=ve.fn.seconds=ue("Seconds",!1),ve.fn.minute=ve.fn.minutes=ue("Minutes",!1),ve.fn.hour=ve.fn.hours=ue("Hours",!0),ve.fn.date=ue("Date",!0),ve.fn.dates=h("dates accessor is deprecated. Use date instead.",ue("Date",!0)),ve.fn.year=ue("FullYear",!0),ve.fn.years=h("years accessor is deprecated. Use year instead.",ue("FullYear",!0)),ve.fn.days=ve.fn.day,ve.fn.months=ve.fn.month,ve.fn.weeks=ve.fn.week,ve.fn.isoWeeks=ve.fn.isoWeek,ve.fn.quarters=ve.fn.quarter,ve.fn.toJSON=ve.fn.toISOString,m(ve.duration.fn=u.prototype,{_bubble:function(){var t,e,i,s,o=this._milliseconds,n=this._days,r=this._months,a=this._data;a.milliseconds=o%1e3,t=f(o/1e3),a.seconds=t%60,e=f(t/60),a.minutes=e%60,i=f(e/60),a.hours=i%24,n+=f(i/24),a.days=n%30,r+=f(n/30),a.months=r%12,s=f(r/12),a.years=s},weeks:function(){return f(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*C(this._months/12)},humanize:function(t){var e=+this,i=ne(e,!t,this.lang());return t&&(i=this.lang().pastFuture(e,i)),this.lang().postformat(i)},add:function(t,e){var i=ve.duration(t,e);return this._milliseconds+=i._milliseconds,this._days+=i._days,this._months+=i._months,this._bubble(),this},subtract:function(t,e){var i=ve.duration(t,e);return this._milliseconds-=i._milliseconds,this._days-=i._days,this._months-=i._months,this._bubble(),this},get:function(t){return t=w(t),this[t.toLowerCase()+"s"]()},as:function(t){return t=w(t),this["as"+t.charAt(0).toUpperCase()+t.slice(1)+"s"]()},lang:ve.fn.lang,toIsoString:function(){var t=Math.abs(this.years()),e=Math.abs(this.months()),i=Math.abs(this.days()),s=Math.abs(this.hours()),o=Math.abs(this.minutes()),n=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(t?t+"Y":"")+(e?e+"M":"")+(i?i+"D":"")+(s||o||n?"T":"")+(s?s+"H":"")+(o?o+"M":"")+(n?n+"S":""):"P0D"}});for(be in ni)ni.hasOwnProperty(be)&&(ge(be,ni[be]),me(be.toLowerCase()));ge("Weeks",6048e5),ve.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},ve.lang("en",{ordinal:function(t){var e=t%10,i=1===C(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+i}}),Ne?o.exports=ve:(s=function(t,e,i){return i.config&&i.config()&&i.config().noGlobal===!0&&(xe.moment=ye),ve}.call(e,i,e,o),!(s!==n&&(o.exports=s)),fe(!0))}).call(this)}).call(e,function(){return this}(),i(60)(t))},function(t,e,i){var s;!function(o,n){"use strict";function r(){a.READY||(w.determineEventTypes(),x.each(a.gestures,function(t){M.register(t)}),w.onTouch(a.DOCUMENT,v,M.detect),w.onTouch(a.DOCUMENT,y,M.detect),a.READY=!0)}var a=function C(t,e){return new C.Instance(t,e||{})};a.VERSION="1.1.3",a.defaults={behavior:{userSelect:"none",touchAction:"pan-y",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},a.DOCUMENT=document,a.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,a.HAS_TOUCHEVENTS="ontouchstart"in o,a.IS_MOBILE=/mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent),a.NO_MOUSEEVENTS=a.HAS_TOUCHEVENTS&&a.IS_MOBILE||a.HAS_POINTEREVENTS,a.CALCULATE_INTERVAL=25;var h={},d=a.DIRECTION_DOWN="down",l=a.DIRECTION_LEFT="left",c=a.DIRECTION_UP="up",p=a.DIRECTION_RIGHT="right",u=a.POINTER_MOUSE="mouse",m=a.POINTER_TOUCH="touch",g=a.POINTER_PEN="pen",f=a.EVENT_START="start",v=a.EVENT_MOVE="move",y=a.EVENT_END="end",b=a.EVENT_RELEASE="release",_=a.EVENT_TOUCH="touch";a.READY=!1,a.plugins=a.plugins||{},a.gestures=a.gestures||{};var x=a.utils={extend:function(t,e,i){for(var s in e)!e.hasOwnProperty(s)||t[s]!==n&&i||(t[s]=e[s]);return t},on:function(t,e,i){t.addEventListener(e,i,!1)},off:function(t,e,i){t.removeEventListener(e,i,!1)},each:function(t,e,i){var s,o;if("forEach"in t)t.forEach(e,i);else if(t.length!==n){for(s=0,o=t.length;o>s;s++)if(e.call(i,t[s],s,t)===!1)return}else for(s in t)if(t.hasOwnProperty(s)&&e.call(i,t[s],s,t)===!1)return},inStr:function(t,e){return t.indexOf(e)>-1},inArray:function(t,e){if(t.indexOf){var i=t.indexOf(e);return-1===i?!1:i}for(var s=0,o=t.length;o>s;s++)if(t[s]===e)return s;return!1},toArray:function(t){return Array.prototype.slice.call(t,0)},hasParent:function(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1},getCenter:function(t){var e=[],i=[],s=[],o=[],n=Math.min,r=Math.max;return 1===t.length?{pageX:t[0].pageX,pageY:t[0].pageY,clientX:t[0].clientX,clientY:t[0].clientY}:(x.each(t,function(t){e.push(t.pageX),i.push(t.pageY),s.push(t.clientX),o.push(t.clientY)}),{pageX:(n.apply(Math,e)+r.apply(Math,e))/2,pageY:(n.apply(Math,i)+r.apply(Math,i))/2,clientX:(n.apply(Math,s)+r.apply(Math,s))/2,clientY:(n.apply(Math,o)+r.apply(Math,o))/2})},getVelocity:function(t,e,i){return{x:Math.abs(e/t)||0,y:Math.abs(i/t)||0}},getAngle:function(t,e){var i=e.clientX-t.clientX,s=e.clientY-t.clientY;return 180*Math.atan2(s,i)/Math.PI},getDirection:function(t,e){var i=Math.abs(t.clientX-e.clientX),s=Math.abs(t.clientY-e.clientY);return i>=s?t.clientX-e.clientX>0?l:p:t.clientY-e.clientY>0?c:d},getDistance:function(t,e){var i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)},getScale:function(t,e){return t.length>=2&&e.length>=2?this.getDistance(e[0],e[1])/this.getDistance(t[0],t[1]):1},getRotation:function(t,e){return t.length>=2&&e.length>=2?this.getAngle(e[1],e[0])-this.getAngle(t[1],t[0]):0},isVertical:function(t){return t==c||t==d},setPrefixedCss:function(t,e,i,s){var o=["","Webkit","Moz","O","ms"];e=x.toCamelCase(e);for(var n=0;n0&&this.started&&(r=v),this.started=!0;var d=this.collectEventData(i,r,o,t);return e!=y&&s.call(M,d),a&&(d.changedLength=h,d.eventType=a,s.call(M,d),d.eventType=r,delete d.changedLength),r==y&&(s.call(M,d),this.started=!1),r},determineEventTypes:function(){var t;return t=a.HAS_POINTEREVENTS?o.PointerEvent?["pointerdown","pointermove","pointerup pointercancel lostpointercapture"]:["MSPointerDown","MSPointerMove","MSPointerUp MSPointerCancel MSLostPointerCapture"]:a.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],h[f]=t[0],h[v]=t[1],h[y]=t[2],h},getTouchList:function(t,e){if(a.HAS_POINTEREVENTS)return S.getTouchList();if(t.touches){if(e==v)return t.touches;var i=[],s=[].concat(x.toArray(t.touches),x.toArray(t.changedTouches)),o=[];return x.each(s,function(t){x.inArray(i,t.identifier)===!1&&o.push(t),i.push(t.identifier)}),o}return t.identifier=1,[t]},collectEventData:function(t,e,i,s){var o=m;return x.inStr(s.type,"mouse")||S.matchType(u,s)?o=u:S.matchType(g,s)&&(o=g),{center:x.getCenter(i),timeStamp:Date.now(),target:s.target,touches:i,eventType:e,pointerType:o,srcEvent:s,preventDefault:function(){var t=this.srcEvent;t.preventManipulation&&t.preventManipulation(),t.preventDefault&&t.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return M.stopDetect()}}}},S=a.PointerEvent={pointers:{},getTouchList:function(){var t=[];return x.each(this.pointers,function(e){t.push(e)}),t},updatePointer:function(t,e){t==y||t!=y&&1!==e.buttons?delete this.pointers[e.pointerId]:(e.identifier=e.pointerId,this.pointers[e.pointerId]=e)},matchType:function(t,e){if(!e.pointerType)return!1;var i=e.pointerType,s={};return s[u]=i===(e.MSPOINTER_TYPE_MOUSE||u),s[m]=i===(e.MSPOINTER_TYPE_TOUCH||m),s[g]=i===(e.MSPOINTER_TYPE_PEN||g),s[t]},reset:function(){this.pointers={}}},M=a.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(t,e){this.current||(this.stopped=!1,this.current={inst:t,startEvent:x.extend({},e),lastEvent:!1,lastCalcEvent:!1,futureCalcEvent:!1,lastCalcData:{},name:""},this.detect(e))},detect:function(t){if(this.current&&!this.stopped){t=this.extendEventData(t);var e=this.current.inst,i=e.options;return x.each(this.gestures,function(s){!this.stopped&&e.enabled&&i[s.name]&&s.handler.call(s,t,e)},this),this.current&&(this.current.lastEvent=t),t.eventType==y&&this.stopDetect(),t}},stopDetect:function(){this.previous=x.extend({},this.current),this.current=null,this.stopped=!0},getCalculatedData:function(t,e,i,s,o){var n=this.current,r=!1,h=n.lastCalcEvent,d=n.lastCalcData;h&&t.timeStamp-h.timeStamp>a.CALCULATE_INTERVAL&&(e=h.center,i=t.timeStamp-h.timeStamp,s=t.center.clientX-h.center.clientX,o=t.center.clientY-h.center.clientY,r=!0),(t.eventType==_||t.eventType==b)&&(n.futureCalcEvent=t),(!n.lastCalcEvent||r)&&(d.velocity=x.getVelocity(i,s,o),d.angle=x.getAngle(e,t.center),d.direction=x.getDirection(e,t.center),n.lastCalcEvent=n.futureCalcEvent||t,n.futureCalcEvent=t),t.velocityX=d.velocity.x,t.velocityY=d.velocity.y,t.interimAngle=d.angle,t.interimDirection=d.direction},extendEventData:function(t){var e=this.current,i=e.startEvent,s=e.lastEvent||i;(t.eventType==_||t.eventType==b)&&(i.touches=[],x.each(t.touches,function(t){i.touches.push({clientX:t.clientX,clientY:t.clientY})}));var o=t.timeStamp-i.timeStamp,n=t.center.clientX-i.center.clientX,r=t.center.clientY-i.center.clientY;return this.getCalculatedData(t,s.center,o,n,r),x.extend(t,{startEvent:i,deltaTime:o,deltaX:n,deltaY:r,distance:x.getDistance(i.center,t.center),angle:x.getAngle(i.center,t.center),direction:x.getDirection(i.center,t.center),scale:x.getScale(i.touches,t.touches),rotation:x.getRotation(i.touches,t.touches)}),t},register:function(t){var e=t.defaults||{};return e[t.name]===n&&(e[t.name]=!0),x.extend(a.defaults,e,!0),t.index=t.index||1e3,this.gestures.push(t),this.gestures.sort(function(t,e){return t.indexe.index?1:0}),this.gestures}};a.Instance=function(t,e){var i=this;r(),this.element=t,this.enabled=!0,x.each(e,function(t,i){delete e[i],e[x.toCamelCase(i)]=t}),this.options=x.extend(x.extend({},a.defaults),e||{}),this.options.behavior&&x.toggleBehavior(this.element,this.options.behavior,!0),this.eventStartHandler=w.onTouch(t,f,function(t){i.enabled&&t.eventType==f?M.startDetect(i,t):t.eventType==_&&M.detect(t)}),this.eventHandlers=[]},a.Instance.prototype={on:function(t,e){var i=this;return w.on(i.element,t,e,function(t){i.eventHandlers.push({gesture:t,handler:e})}),i},off:function(t,e){var i=this;return w.off(i.element,t,e,function(t){var s=x.inArray({gesture:t,handler:e});s!==!1&&i.eventHandlers.splice(s,1)}),i},trigger:function(t,e){e||(e={});var i=a.DOCUMENT.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=e;var s=this.element;return x.hasParent(e.target,s)&&(s=e.target),s.dispatchEvent(i),this},enable:function(t){return this.enabled=t,this},dispose:function(){var t,e;for(x.toggleBehavior(this.element,this.options.behavior,!1),t=-1;e=this.eventHandlers[++t];)x.off(this.element,e.gesture,e.handler);return this.eventHandlers=[],w.off(this.element,h[f],this.eventStartHandler),null}},function(t){function e(e,s){var o=M.current;if(!(s.options.dragMaxTouches>0&&e.touches.length>s.options.dragMaxTouches))switch(e.eventType){case f:i=!1;break;case v:if(e.distance0)){var r=Math.abs(s.options.dragMinDistance/e.distance);n.pageX+=e.deltaX*r,n.pageY+=e.deltaY*r,n.clientX+=e.deltaX*r,n.clientY+=e.deltaY*r,e=M.extendEventData(e)}(o.lastEvent.dragLockToAxis||s.options.dragLockToAxis&&s.options.dragLockMinDistance<=e.distance)&&(e.dragLockToAxis=!0);var a=o.lastEvent.direction;e.dragLockToAxis&&a!==e.direction&&(e.direction=x.isVertical(a)?e.deltaY<0?c:d:e.deltaX<0?l:p),i||(s.trigger(t+"start",e),i=!0),s.trigger(t,e),s.trigger(t+e.direction,e);var h=x.isVertical(e.direction);(s.options.dragBlockVertical&&h||s.options.dragBlockHorizontal&&!h)&&e.preventDefault();break;case b:i&&e.changedLength<=s.options.dragMaxTouches&&(s.trigger(t+"end",e),i=!1);break;case y:i=!1}}var i=!1;a.gestures.Drag={name:t,index:50,handler:e,defaults:{dragMinDistance:10,dragDistanceCorrection:!0,dragMaxTouches:1,dragBlockHorizontal:!1,dragBlockVertical:!1,dragLockToAxis:!1,dragLockMinDistance:25}}}("drag"),a.gestures.Gesture={name:"gesture",index:1337,handler:function(t,e){e.trigger(this.name,t)}},function(t){function e(e,s){var o=s.options,n=M.current;switch(e.eventType){case f:clearTimeout(i),n.name=t,i=setTimeout(function(){n&&n.name==t&&s.trigger(t,e)},o.holdTimeout);break;case v:e.distance>o.holdThreshold&&clearTimeout(i);break;case b:clearTimeout(i)}}var i;a.gestures.Hold={name:t,index:10,defaults:{holdTimeout:500,holdThreshold:2},handler:e}}("hold"),a.gestures.Release={name:"release",index:1/0,handler:function(t,e){t.eventType==b&&e.trigger(this.name,t)}},a.gestures.Swipe={name:"swipe",index:40,defaults:{swipeMinTouches:1,swipeMaxTouches:1,swipeVelocityX:.6,swipeVelocityY:.6},handler:function(t,e){if(t.eventType==b){var i=t.touches.length,s=e.options;if(is.swipeMaxTouches)return;(t.velocityX>s.swipeVelocityX||t.velocityY>s.swipeVelocityY)&&(e.trigger(this.name,t),e.trigger(this.name+t.direction,t))}}},function(t){function e(e,s){var o,n,r=s.options,a=M.current,h=M.previous;switch(e.eventType){case f:i=!1;break;case v:i=i||e.distance>r.tapMaxDistance;break;case y:!x.inStr(e.srcEvent.type,"cancel")&&e.deltaTimes.options.transformMinRotation&&s.trigger("rotate",e),o>s.options.transformMinScale&&(s.trigger("pinch",e),s.trigger("pinch"+(e.scale<1?"in":"out"),e));break;case b:i&&e.changedLength<2&&(s.trigger(t+"end",e),i=!1)}}var i=!1;a.gestures.Transform={name:t,index:45,defaults:{transformMinScale:.01,transformMinRotation:1},handler:e}}("transform"),s=function(){return a}.call(e,i,e,t),!(s!==n&&(t.exports=s))}(window)},function(t,e){e.startWithClustering=function(){this.clusterToFit(this.constants.clustering.initialMaxNodes,!0),this.updateLabels(),this.stabilize&&this._stabilize(),this.start()},e.clusterToFit=function(t,e){for(var i=this.nodeIndices.length,s=50,o=0;i>t&&s>o;)o%3==0?(this.forceAggregateHubs(!0),this.normalizeClusterLevels()):this.increaseClusterLevel(),i=this.nodeIndices.length,o+=1;o>0&&1==e&&this.repositionNodes(),this._updateCalculationNodes()},e.openCluster=function(t){var e=this.moving;if(t.clusterSize>this.constants.clustering.sectorThreshold&&this._nodeInActiveArea(t)&&("default"!=this._sector()||1!=this.nodeIndices.length)){this._addSector(t);for(var i=0;this.nodeIndices.lengthi;)this.decreaseClusterLevel(),i+=1}else this._expandClusterNode(t,!1,!0),this._updateNodeIndexList(),this._updateDynamicEdges(),this._updateCalculationNodes(),this.updateLabels();this.moving!=e&&this.start()},e.updateClustersDefault=function(){1==this.constants.clustering.enabled&&this.updateClusters(0,!1,!1)},e.increaseClusterLevel=function(){this.updateClusters(-1,!1,!0)},e.decreaseClusterLevel=function(){this.updateClusters(1,!1,!0)},e.updateClusters=function(t,e,i,s){var o=this.moving,n=this.nodeIndices.length;this.previousScale>this.scale&&0==t&&this._collapseSector(),this.previousScale>this.scale||-1==t?this._formClusters(i):(this.previousScalethis.scale||-1==t)&&(this._aggregateHubs(i),this._updateNodeIndexList()),(this.previousScale>this.scale||-1==t)&&(this.handleChains(),this._updateNodeIndexList()),this.previousScale=this.scale,this._updateDynamicEdges(),this.updateLabels(),this.nodeIndices.lengththis.constants.clustering.chainThreshold&&this._reduceAmountOfChains(1-this.constants.clustering.chainThreshold/t)},e._aggregateHubs=function(t){this._getHubSize(),this._formClustersByHub(t,!1)},e.forceAggregateHubs=function(t){var e=this.moving,i=this.nodeIndices.length;this._aggregateHubs(!0),this._updateNodeIndexList(),this._updateDynamicEdges(),this.updateLabels(),this.nodeIndices.length!=i&&(this.clusterSession+=1),(0==t||void 0===t)&&this.moving!=e&&this.start()},e._openClustersBySize=function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t)){var e=this.nodes[t];1==e.inView()&&(e.width*this.scale>this.constants.clustering.screenSizeThreshold*this.frame.canvas.clientWidth||e.height*this.scale>this.constants.clustering.screenSizeThreshold*this.frame.canvas.clientHeight)&&this.openCluster(e)}},e._openClusters=function(t,e){for(var i=0;i1&&(t.clusterSizei)){var r=n.from,a=n.to;n.to.mass>n.from.mass&&(r=n.to,a=n.from),1==a.dynamicEdgesLength?this._addToCluster(r,a,!1):1==r.dynamicEdgesLength&&this._addToCluster(a,r,!1)}}},e._forceClustersByZoom=function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t)){var e=this.nodes[t];if(1==e.dynamicEdgesLength&&0!=e.dynamicEdges.length){var i=e.dynamicEdges[0],s=i.toId==e.id?this.nodes[i.fromId]:this.nodes[i.toId];e.id!=s.id&&(s.mass>e.mass?this._addToCluster(s,e,!0):this._addToCluster(e,s,!0))}}},e._clusterToSmallestNeighbour=function(t){for(var e=-1,i=null,s=0;so.clusterSessions.length&&(e=o.clusterSessions.length,i=o)}null!=o&&void 0!==this.nodes[o.id]&&this._addToCluster(o,t,!0)},e._formClustersByHub=function(t,e){for(var i in this.nodes)this.nodes.hasOwnProperty(i)&&this._formClusterFromHub(this.nodes[i],t,e)},e._formClusterFromHub=function(t,e,i,s){if(void 0===s&&(s=0),t.dynamicEdgesLength>=this.hubThreshold&&0==i||t.dynamicEdgesLength==this.hubThreshold&&1==i){for(var o,n,r,a=this.constants.clustering.clusterEdgeThreshold/this.scale,h=!1,d=[],l=t.dynamicEdges.length,c=0;l>c;c++)d.push(t.dynamicEdges[c].id);if(0==e)for(h=!1,c=0;l>c;c++){var p=this.edges[d[c]];if(void 0!==p&&p.connected&&p.toId!=p.fromId&&(o=p.to.x-p.from.x,n=p.to.y-p.from.y,r=Math.sqrt(o*o+n*n),a>r)){h=!0;break}}if(!e&&h||e)for(c=0;l>c;c++)if(p=this.edges[d[c]],void 0!==p){var u=this.nodes[p.fromId==t.id?p.toId:p.fromId];u.dynamicEdges.length<=this.hubThreshold+s&&u.id!=t.id&&this._addToCluster(t,u,e)}}},e._addToCluster=function(t,e,i){t.containedNodes[e.id]=e;for(var s=0;s1)for(var s=0;s1&&(e.label="[".concat(String(e.clusterSize),"]"))}for(t in this.nodes)this.nodes.hasOwnProperty(t)&&(e=this.nodes[t],1==e.clusterSize&&(e.label=void 0!==e.originalLabel?e.originalLabel:String(e.id)))},e.normalizeClusterLevels=function(){var t,e=0,i=1e9,s=0;for(t in this.nodes)this.nodes.hasOwnProperty(t)&&(s=this.nodes[t].clusterSessions.length,s>e&&(e=s),i>s&&(i=s));if(e-i>this.constants.clustering.clusterLevelDifference){var o=this.nodeIndices.length,n=e-this.constants.clustering.clusterLevelDifference;for(t in this.nodes)this.nodes.hasOwnProperty(t)&&this.nodes[t].clusterSessions.lengths&&(s=n.dynamicEdgesLength),t+=n.dynamicEdgesLength,e+=Math.pow(n.dynamicEdgesLength,2),i+=1}t/=i,e/=i;var r=e-Math.pow(t,2),a=Math.sqrt(r);this.hubThreshold=Math.floor(t+2*a),this.hubThreshold>s&&(this.hubThreshold=s)},e._reduceAmountOfChains=function(t){this.hubThreshold=2;var e=Math.floor(this.nodeIndices.length*t);for(var i in this.nodes)this.nodes.hasOwnProperty(i)&&2==this.nodes[i].dynamicEdgesLength&&this.nodes[i].dynamicEdges.length>=2&&e>0&&(this._formClusterFromHub(this.nodes[i],!0,!0,1),e-=1)},e._getChainFraction=function(){var t=0,e=0;for(var i in this.nodes)this.nodes.hasOwnProperty(i)&&(2==this.nodes[i].dynamicEdgesLength&&this.nodes[i].dynamicEdges.length>=2&&(t+=1),e+=1);return t/e}},function(t,e,i){var s=i(1);e._putDataInSector=function(){this.sectors.active[this._sector()].nodes=this.nodes,this.sectors.active[this._sector()].edges=this.edges,this.sectors.active[this._sector()].nodeIndices=this.nodeIndices},e._switchToSector=function(t,e){void 0===e||"active"==e?this._switchToActiveSector(t):this._switchToFrozenSector(t)},e._switchToActiveSector=function(t){this.nodeIndices=this.sectors.active[t].nodeIndices,this.nodes=this.sectors.active[t].nodes,this.edges=this.sectors.active[t].edges},e._switchToSupportSector=function(){this.nodeIndices=this.sectors.support.nodeIndices,this.nodes=this.sectors.support.nodes,this.edges=this.sectors.support.edges},e._switchToFrozenSector=function(t){this.nodeIndices=this.sectors.frozen[t].nodeIndices,this.nodes=this.sectors.frozen[t].nodes,this.edges=this.sectors.frozen[t].edges},e._loadLatestSector=function(){this._switchToSector(this._sector())},e._sector=function(){return this.activeSector[this.activeSector.length-1]},e._previousSector=function(){if(this.activeSector.length>1)return this.activeSector[this.activeSector.length-2];throw new TypeError("there are not enough sectors in the this.activeSector array.")},e._setActiveSector=function(t){this.activeSector.push(t)},e._forgetLastSector=function(){this.activeSector.pop()},e._createNewSector=function(t){this.sectors.active[t]={nodes:{},edges:{},nodeIndices:[],formationScale:this.scale,drawingNode:void 0},this.sectors.active[t].drawingNode=new Node({id:t,color:{background:"#eaefef",border:"495c5e"}},{},{},this.constants),this.sectors.active[t].drawingNode.clusterSize=2},e._deleteActiveSector=function(t){delete this.sectors.active[t]},e._deleteFrozenSector=function(t){delete this.sectors.frozen[t]},e._freezeSector=function(t){this.sectors.frozen[t]=this.sectors.active[t],this._deleteActiveSector(t)},e._activateSector=function(t){this.sectors.active[t]=this.sectors.frozen[t],this._deleteFrozenSector(t)},e._mergeThisWithFrozen=function(t){for(var e in this.nodes)this.nodes.hasOwnProperty(e)&&(this.sectors.frozen[t].nodes[e]=this.nodes[e]);for(var i in this.edges)this.edges.hasOwnProperty(i)&&(this.sectors.frozen[t].edges[i]=this.edges[i]);for(var s=0;s1?this[t](s[0],s[1]):this[t](e)}this._loadLatestSector()},e._doInSupportSector=function(t,e){if(void 0===e)this._switchToSupportSector(),this[t]();else{this._switchToSupportSector();var i=Array.prototype.splice.call(arguments,1);i.length>1?this[t](i[0],i[1]):this[t](e)}this._loadLatestSector()},e._doInAllFrozenSectors=function(t,e){if(void 0===e)for(var i in this.sectors.frozen)this.sectors.frozen.hasOwnProperty(i)&&(this._switchToFrozenSector(i),this[t]());else for(var i in this.sectors.frozen)if(this.sectors.frozen.hasOwnProperty(i)){this._switchToFrozenSector(i);var s=Array.prototype.splice.call(arguments,1);s.length>1?this[t](s[0],s[1]):this[t](e)}this._loadLatestSector()},e._doInAllSectors=function(t,e){var i=Array.prototype.splice.call(arguments,1);void 0===e?(this._doInAllActiveSectors(t),this._doInAllFrozenSectors(t)):i.length>1?(this._doInAllActiveSectors(t,i[0],i[1]),this._doInAllFrozenSectors(t,i[0],i[1])):(this._doInAllActiveSectors(t,e),this._doInAllFrozenSectors(t,e))},e._clearNodeIndexList=function(){var t=this._sector();this.sectors.active[t].nodeIndices=[],this.nodeIndices=this.sectors.active[t].nodeIndices},e._drawSectorNodes=function(t,e){var i,s=1e9,o=-1e9,n=1e9,r=-1e9;for(var a in this.sectors[e])if(this.sectors[e].hasOwnProperty(a)&&void 0!==this.sectors[e][a].drawingNode){this._switchToSector(a,e),s=1e9,o=-1e9,n=1e9,r=-1e9;for(var h in this.nodes)this.nodes.hasOwnProperty(h)&&(i=this.nodes[h],i.resize(t),n>i.x-.5*i.width&&(n=i.x-.5*i.width),ri.y-.5*i.height&&(s=i.y-.5*i.height),o0?this.nodes[i[i.length-1]]:null},e._getEdgesOverlappingWith=function(t,e){var i=this.edges;for(var s in i)i.hasOwnProperty(s)&&i[s].isOverlappingWith(t)&&e.push(s)},e._getAllEdgesOverlappingWith=function(t){var e=[];return this._doInAllActiveSectors("_getEdgesOverlappingWith",t,e),e},e._getEdgeAt=function(t){var e=this._pointerToPositionObject(t),i=this._getAllEdgesOverlappingWith(e);return i.length>0?this.edges[i[i.length-1]]:null},e._addToSelection=function(t){t instanceof s?this.selectionObj.nodes[t.id]=t:this.selectionObj.edges[t.id]=t},e._addToHover=function(t){t instanceof s?this.hoverObj.nodes[t.id]=t:this.hoverObj.edges[t.id]=t},e._removeFromSelection=function(t){t instanceof s?delete this.selectionObj.nodes[t.id]:delete this.selectionObj.edges[t.id]},e._unselectAll=function(t){void 0===t&&(t=!1);for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&this.selectionObj.nodes[e].unselect();for(var i in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(i)&&this.selectionObj.edges[i].unselect();this.selectionObj={nodes:{},edges:{}},0==t&&this.emit("select",this.getSelection())},e._unselectClusters=function(t){void 0===t&&(t=!1);for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&this.selectionObj.nodes[e].clusterSize>1&&(this.selectionObj.nodes[e].unselect(),this._removeFromSelection(this.selectionObj.nodes[e]));0==t&&this.emit("select",this.getSelection())},e._getSelectedNodeCount=function(){var t=0;for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(t+=1);return t},e._getSelectedNode=function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t))return this.selectionObj.nodes[t];return null},e._getSelectedEdge=function(){for(var t in this.selectionObj.edges)if(this.selectionObj.edges.hasOwnProperty(t))return this.selectionObj.edges[t];return null},e._getSelectedEdgeCount=function(){var t=0;for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&(t+=1);return t},e._getSelectedObjectCount=function(){var t=0;for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(t+=1);for(var i in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(i)&&(t+=1);return t},e._selectionIsEmpty=function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t))return!1;for(var e in this.selectionObj.edges)if(this.selectionObj.edges.hasOwnProperty(e))return!1;return!0},e._clusterInSelection=function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t)&&this.selectionObj.nodes[t].clusterSize>1)return!0;return!1},e._selectConnectedEdges=function(t){for(var e=0;ee;e++){s=t[e];var o=this.nodes[s];if(!o)throw new RangeError('Node with id "'+s+'" not found');this._selectObject(o,!0,!0)}console.log("setSelection is deprecated. Please use selectNodes instead."),this.redraw()},e.selectNodes=function(t,e){var i,s,o;if(!t||void 0==t.length)throw"Selection must be an array with ids";for(this._unselectAll(!0),i=0,s=t.length;s>i;i++){o=t[i];var n=this.nodes[o];if(!n)throw new RangeError('Node with id "'+o+'" not found');this._selectObject(n,!0,!0,e)}this.redraw()},e.selectEdges=function(t){var e,i,s;if(!t||void 0==t.length)throw"Selection must be an array with ids";for(this._unselectAll(!0),e=0,i=t.length;i>e;e++){s=t[e];var o=this.edges[s];if(!o)throw new RangeError('Edge with id "'+s+'" not found');this._selectObject(o,!0,!0,highlightEdges)}this.redraw()},e._updateSelection=function(){for(var t in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(t)&&(this.nodes.hasOwnProperty(t)||delete this.selectionObj.nodes[t]);for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&(this.edges.hasOwnProperty(e)||delete this.selectionObj.edges[e])}},function(t,e,i){var s=i(1),o=i(36),n=i(33);e._clearManipulatorBar=function(){for(;this.manipulationDiv.hasChildNodes();)this.manipulationDiv.removeChild(this.manipulationDiv.firstChild)},e._restoreOverloadedFunctions=function(){for(var t in this.cachedFunctions)this.cachedFunctions.hasOwnProperty(t)&&(this[t]=this.cachedFunctions[t])},e._toggleEditMode=function(){this.editMode=!this.editMode;var t=document.getElementById("network-manipulationDiv"),e=document.getElementById("network-manipulation-closeDiv"),i=document.getElementById("network-manipulation-editMode");1==this.editMode?(t.style.display="block",e.style.display="block",i.style.display="none",e.onclick=this._toggleEditMode.bind(this)):(t.style.display="none",e.style.display="none",i.style.display="block",e.onclick=null),this._createManipulatorBar()},e._createManipulatorBar=function(){if(this.boundFunction&&this.off("select",this.boundFunction),void 0!==this.edgeBeingEdited&&(this.edgeBeingEdited._disableControlNodes(),this.edgeBeingEdited=void 0,this.selectedControlNode=null,this.controlNodesActive=!1),this._restoreOverloadedFunctions(),this.freezeSimulation=!1,this.blockConnectingEdgeSelection=!1,this.forceAppendSelection=!1,1==this.editMode){for(;this.manipulationDiv.hasChildNodes();)this.manipulationDiv.removeChild(this.manipulationDiv.firstChild);this.manipulationDiv.innerHTML=""+this.constants.labels.add+"
"+this.constants.labels.link+"",1==this._getSelectedNodeCount()&&this.triggerFunctions.edit?this.manipulationDiv.innerHTML+="
"+this.constants.labels.editNode+"":1==this._getSelectedEdgeCount()&&0==this._getSelectedNodeCount()&&(this.manipulationDiv.innerHTML+="
"+this.constants.labels.editEdge+""),0==this._selectionIsEmpty()&&(this.manipulationDiv.innerHTML+="
"+this.constants.labels.del+"");var t=document.getElementById("network-manipulate-addNode");t.onclick=this._createAddNodeToolbar.bind(this);var e=document.getElementById("network-manipulate-connectNode");if(e.onclick=this._createAddEdgeToolbar.bind(this),1==this._getSelectedNodeCount()&&this.triggerFunctions.edit){var i=document.getElementById("network-manipulate-editNode");i.onclick=this._editNode.bind(this)}else if(1==this._getSelectedEdgeCount()&&0==this._getSelectedNodeCount()){var i=document.getElementById("network-manipulate-editEdge");i.onclick=this._createEditEdgeToolbar.bind(this)}if(0==this._selectionIsEmpty()){var s=document.getElementById("network-manipulate-delete");s.onclick=this._deleteSelected.bind(this)}var o=document.getElementById("network-manipulation-closeDiv");o.onclick=this._toggleEditMode.bind(this),this.boundFunction=this._createManipulatorBar.bind(this),this.on("select",this.boundFunction)}else{this.editModeDiv.innerHTML=""+this.constants.labels.edit+"";var n=document.getElementById("network-manipulate-editModeButton");n.onclick=this._toggleEditMode.bind(this)}},e._createAddNodeToolbar=function(){this._clearManipulatorBar(),this.boundFunction&&this.off("select",this.boundFunction),this.manipulationDiv.innerHTML=""+this.constants.labels.back+"
"+this.constants.labels.addDescription+"";var t=document.getElementById("network-manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.boundFunction=this._addNode.bind(this),this.on("select",this.boundFunction)},e._createAddEdgeToolbar=function(){this._clearManipulatorBar(),this._unselectAll(!0),this.freezeSimulation=!0,this.boundFunction&&this.off("select",this.boundFunction),this._unselectAll(),this.forceAppendSelection=!1,this.blockConnectingEdgeSelection=!0,this.manipulationDiv.innerHTML=""+this.constants.labels.back+"
"+this.constants.labels.linkDescription+"";var t=document.getElementById("network-manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.boundFunction=this._handleConnect.bind(this),this.on("select",this.boundFunction),this.cachedFunctions._handleTouch=this._handleTouch,this.cachedFunctions._handleOnRelease=this._handleOnRelease,this._handleTouch=this._handleConnect,this._handleOnRelease=this._finishConnect,this._redraw()},e._createEditEdgeToolbar=function(){this._clearManipulatorBar(),this.controlNodesActive=!0,this.boundFunction&&this.off("select",this.boundFunction),this.edgeBeingEdited=this._getSelectedEdge(),this.edgeBeingEdited._enableControlNodes(),this.manipulationDiv.innerHTML=""+this.constants.labels.back+"
"+this.constants.labels.editEdgeDescription+"";var t=document.getElementById("network-manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.cachedFunctions._handleTouch=this._handleTouch,this.cachedFunctions._handleOnRelease=this._handleOnRelease,this.cachedFunctions._handleTap=this._handleTap,this.cachedFunctions._handleDragStart=this._handleDragStart,this.cachedFunctions._handleOnDrag=this._handleOnDrag,this._handleTouch=this._selectControlNode,this._handleTap=function(){},this._handleOnDrag=this._controlNodeDrag,this._handleDragStart=function(){},this._handleOnRelease=this._releaseControlNode,this._redraw()},e._selectControlNode=function(t){this.edgeBeingEdited.controlNodes.from.unselect(),this.edgeBeingEdited.controlNodes.to.unselect(),this.selectedControlNode=this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(t.x),this._YconvertDOMtoCanvas(t.y)),null!==this.selectedControlNode&&(this.selectedControlNode.select(),this.freezeSimulation=!0),this._redraw()},e._controlNodeDrag=function(t){var e=this._getPointer(t.gesture.center);null!==this.selectedControlNode&&void 0!==this.selectedControlNode&&(this.selectedControlNode.x=this._XconvertDOMtoCanvas(e.x),this.selectedControlNode.y=this._YconvertDOMtoCanvas(e.y)),this._redraw()},e._releaseControlNode=function(t){var e=this._getNodeAt(t);null!=e?(1==this.edgeBeingEdited.controlNodes.from.selected&&(this._editEdge(e.id,this.edgeBeingEdited.to.id),this.edgeBeingEdited.controlNodes.from.unselect()),1==this.edgeBeingEdited.controlNodes.to.selected&&(this._editEdge(this.edgeBeingEdited.from.id,e.id),this.edgeBeingEdited.controlNodes.to.unselect())):this.edgeBeingEdited._restoreControlNodes(),this.freezeSimulation=!1,this._redraw()},e._handleConnect=function(t){if(0==this._getSelectedNodeCount()){var e=this._getNodeAt(t);null!=e&&(e.clusterSize>1?alert("Cannot create edges to a cluster."):(this._selectObject(e,!1),this.sectors.support.nodes.targetNode=new o({id:"targetNode"},{},{},this.constants),this.sectors.support.nodes.targetNode.x=e.x,this.sectors.support.nodes.targetNode.y=e.y,this.sectors.support.nodes.targetViaNode=new o({id:"targetViaNode"},{},{},this.constants),this.sectors.support.nodes.targetViaNode.x=e.x,this.sectors.support.nodes.targetViaNode.y=e.y,this.sectors.support.nodes.targetViaNode.parentEdgeId="connectionEdge",this.edges.connectionEdge=new n({id:"connectionEdge",from:e.id,to:this.sectors.support.nodes.targetNode.id},this,this.constants),this.edges.connectionEdge.from=e,this.edges.connectionEdge.connected=!0,this.edges.connectionEdge.smooth=!0,this.edges.connectionEdge.selected=!0,this.edges.connectionEdge.to=this.sectors.support.nodes.targetNode,this.edges.connectionEdge.via=this.sectors.support.nodes.targetViaNode,this.cachedFunctions._handleOnDrag=this._handleOnDrag,this._handleOnDrag=function(t){var e=this._getPointer(t.gesture.center);this.sectors.support.nodes.targetNode.x=this._XconvertDOMtoCanvas(e.x),this.sectors.support.nodes.targetNode.y=this._YconvertDOMtoCanvas(e.y),this.sectors.support.nodes.targetViaNode.x=.5*(this._XconvertDOMtoCanvas(e.x)+this.edges.connectionEdge.from.x),this.sectors.support.nodes.targetViaNode.y=this._YconvertDOMtoCanvas(e.y)},this.moving=!0,this.start()))}},e._finishConnect=function(t){if(1==this._getSelectedNodeCount()){this._handleOnDrag=this.cachedFunctions._handleOnDrag,delete this.cachedFunctions._handleOnDrag;var e=this.edges.connectionEdge.fromId;delete this.edges.connectionEdge,delete this.sectors.support.nodes.targetNode,delete this.sectors.support.nodes.targetViaNode;var i=this._getNodeAt(t);null!=i&&(i.clusterSize>1?alert("Cannot create edges to a cluster."):(this._createEdge(e,i.id),this._createManipulatorBar())),this._unselectAll()}},e._addNode=function(){if(this._selectionIsEmpty()&&1==this.editMode){var t=this._pointerToPositionObject(this.pointerPosition),e={id:s.randomUUID(),x:t.left,y:t.top,label:"new",allowedToMoveX:!0,allowedToMoveY:!0};if(this.triggerFunctions.add)if(2==this.triggerFunctions.add.length){var i=this;this.triggerFunctions.add(e,function(t){i.nodesData.add(t),i._createManipulatorBar(),i.moving=!0,i.start()})}else alert(this.constants.labels.addError),this._createManipulatorBar(),this.moving=!0,this.start();else this.nodesData.add(e),this._createManipulatorBar(),this.moving=!0,this.start()}},e._createEdge=function(t,e){if(1==this.editMode){var i={from:t,to:e};if(this.triggerFunctions.connect)if(2==this.triggerFunctions.connect.length){var s=this;this.triggerFunctions.connect(i,function(t){s.edgesData.add(t),s.moving=!0,s.start()})}else alert(this.constants.labels.linkError),this.moving=!0,this.start();else this.edgesData.add(i),this.moving=!0,this.start()}},e._editEdge=function(t,e){if(1==this.editMode){var i={id:this.edgeBeingEdited.id,from:t,to:e};if(this.triggerFunctions.editEdge)if(2==this.triggerFunctions.editEdge.length){var s=this;this.triggerFunctions.editEdge(i,function(t){s.edgesData.update(t),s.moving=!0,s.start()})}else alert(this.constants.labels.linkError),this.moving=!0,this.start();else this.edgesData.update(i),this.moving=!0,this.start()}},e._editNode=function(){if(this.triggerFunctions.edit&&1==this.editMode){var t=this._getSelectedNode(),e={id:t.id,label:t.label,group:t.group,shape:t.shape,color:{background:t.color.background,border:t.color.border,highlight:{background:t.color.highlight.background,border:t.color.highlight.border}}};if(2==this.triggerFunctions.edit.length){var i=this;this.triggerFunctions.edit(e,function(t){i.nodesData.update(t),i._createManipulatorBar(),i.moving=!0,i.start()})}else alert(this.constants.labels.editError)}else alert(this.constants.labels.editBoundError)},e._deleteSelected=function(){if(!this._selectionIsEmpty()&&1==this.editMode)if(this._clusterInSelection())alert(this.constants.labels.deleteClusterError);else{var t=this.getSelectedNodes(),e=this.getSelectedEdges();if(this.triggerFunctions.del){var i=this,s={nodes:t,edges:e};(this.triggerFunctions.del.length=2)?this.triggerFunctions.del(s,function(t){i.edgesData.remove(t.edges),i.nodesData.remove(t.nodes),i._unselectAll(),i.moving=!0,i.start()}):alert(this.constants.labels.deleteError)}else this.edgesData.remove(e),this.nodesData.remove(t),this._unselectAll(),this.moving=!0,this.start()}}},function(t,e,i){var s=i(1);e._cleanNavigation=function(){var t=document.getElementById("network-navigation_wrapper");null!=t&&this.containerElement.removeChild(t),document.onmouseup=null},e._loadNavigationElements=function(){this._cleanNavigation(),this.navigationDivs={};var t=["up","down","left","right","zoomIn","zoomOut","zoomExtends"],e=["_moveUp","_moveDown","_moveLeft","_moveRight","_zoomIn","_zoomOut","zoomExtent"];this.navigationDivs.wrapper=document.createElement("div"),this.navigationDivs.wrapper.id="network-navigation_wrapper",this.navigationDivs.wrapper.style.position="absolute",this.navigationDivs.wrapper.style.width=this.frame.canvas.clientWidth+"px",this.navigationDivs.wrapper.style.height=this.frame.canvas.clientHeight+"px",this.containerElement.insertBefore(this.navigationDivs.wrapper,this.frame);for(var i=0;i0){"RL"==this.constants.hierarchicalLayout.direction||"DU"==this.constants.hierarchicalLayout.direction?this.constants.hierarchicalLayout.levelSeparation*=-1:this.constants.hierarchicalLayout.levelSeparation=Math.abs(this.constants.hierarchicalLayout.levelSeparation),"RL"==this.constants.hierarchicalLayout.direction||"LR"==this.constants.hierarchicalLayout.direction?1==this.constants.smoothCurves.enabled&&(this.constants.smoothCurves.type="vertical"):1==this.constants.smoothCurves.enabled&&(this.constants.smoothCurves.type="horizontal");var t,e,i=0,s=!1,o=!1;for(e in this.nodes)this.nodes.hasOwnProperty(e)&&(t=this.nodes[e],-1!=t.level?s=!0:o=!0,is&&(n.xFixed=!1,n.x=i[n.level].minPos,r=!0):n.yFixed&&n.level>s&&(n.yFixed=!1,n.y=i[n.level].minPos,r=!0),1==r&&(i[n.level].minPos+=i[n.level].nodeSpacing,n.edges.length>1&&this._placeBranchNodes(n.edges,n.id,i,n.level))}},e._setLevel=function(t,e,i){for(var s=0;st)&&(o.level=t,e.length>1&&this._setLevel(t+1,o.edges,o.id))}},e._restoreNodes=function(){for(var t in this.nodes)this.nodes.hasOwnProperty(t)&&(this.nodes[t].xFixed=!1,this.nodes[t].yFixed=!1)}},function(t,e,i){function s(){this.constants.smoothCurves.enabled=!this.constants.smoothCurves.enabled;var t=document.getElementById("graph_toggleSmooth");t.style.background=1==this.constants.smoothCurves.enabled?"#A4FF56":"#FF8532",this._configureSmoothCurves(!1)}function o(){for(var t in this.calculationNodes)this.calculationNodes.hasOwnProperty(t)&&(this.calculationNodes[t].vx=0,this.calculationNodes[t].vy=0,this.calculationNodes[t].fx=0,this.calculationNodes[t].fy=0);1==this.constants.hierarchicalLayout.enabled?(this._setupHierarchicalLayout(),a.call(this,"graph_H_nd",1,"physics_hierarchicalRepulsion_nodeDistance"),a.call(this,"graph_H_cg",1,"physics_centralGravity"),a.call(this,"graph_H_sc",1,"physics_springConstant"),a.call(this,"graph_H_sl",1,"physics_springLength"),a.call(this,"graph_H_damp",1,"physics_damping")):this.repositionNodes(),this.moving=!0,this.start()}function n(){var t="No options are required, default values used.",e=[],i=document.getElementById("graph_physicsMethod1"),s=document.getElementById("graph_physicsMethod2");if(1==i.checked){if(this.constants.physics.barnesHut.gravitationalConstant!=this.backupConstants.physics.barnesHut.gravitationalConstant&&e.push("gravitationalConstant: "+this.constants.physics.barnesHut.gravitationalConstant),this.constants.physics.centralGravity!=this.backupConstants.physics.barnesHut.centralGravity&&e.push("centralGravity: "+this.constants.physics.centralGravity),this.constants.physics.springLength!=this.backupConstants.physics.barnesHut.springLength&&e.push("springLength: "+this.constants.physics.springLength),this.constants.physics.springConstant!=this.backupConstants.physics.barnesHut.springConstant&&e.push("springConstant: "+this.constants.physics.springConstant),this.constants.physics.damping!=this.backupConstants.physics.barnesHut.damping&&e.push("damping: "+this.constants.physics.damping),0!=e.length){t="var options = {",t+="physics: {barnesHut: {";for(var o=0;othis.constants.clustering.clusterThreshold&&1==this.constants.clustering.enabled&&this.clusterToFit(this.constants.clustering.reduceToNodes,!1),this._calculateForces())},e._calculateForces=function(){this._calculateGravitationalForces(),this._calculateNodeForces(),this.constants.physics.springConstant>0&&(1==this.constants.smoothCurves.enabled&&1==this.constants.smoothCurves.dynamic?this._calculateSpringForcesWithSupport():1==this.constants.physics.hierarchicalRepulsion.enabled?this._calculateHierarchicalSpringForces():this._calculateSpringForces())},e._updateCalculationNodes=function(){if(1==this.constants.smoothCurves.enabled&&1==this.constants.smoothCurves.dynamic){this.calculationNodes={},this.calculationNodeIndices=[];for(var t in this.nodes)this.nodes.hasOwnProperty(t)&&(this.calculationNodes[t]=this.nodes[t]);var e=this.sectors.support.nodes;for(var i in e)e.hasOwnProperty(i)&&(this.edges.hasOwnProperty(e[i].parentEdgeId)?this.calculationNodes[i]=e[i]:e[i]._setForce(0,0));for(var s in this.calculationNodes)this.calculationNodes.hasOwnProperty(s)&&this.calculationNodeIndices.push(s)}else this.calculationNodes=this.nodes,this.calculationNodeIndices=this.nodeIndices},e._calculateGravitationalForces=function(){var t,e,i,s,o,n=this.calculationNodes,r=this.constants.physics.centralGravity,a=0;for(o=0;oSimulation Mode:Barnes HutRepulsionHierarchical
Options:
',this.containerElement.parentElement.insertBefore(this.physicsConfiguration,this.containerElement),this.optionsDiv=document.createElement("div"),this.optionsDiv.style.fontSize="14px",this.optionsDiv.style.fontFamily="verdana",this.containerElement.parentElement.insertBefore(this.optionsDiv,this.containerElement);var e;e=document.getElementById("graph_BH_gc"),e.onchange=a.bind(this,"graph_BH_gc",-1,"physics_barnesHut_gravitationalConstant"),e=document.getElementById("graph_BH_cg"),e.onchange=a.bind(this,"graph_BH_cg",1,"physics_centralGravity"),e=document.getElementById("graph_BH_sc"),e.onchange=a.bind(this,"graph_BH_sc",1,"physics_springConstant"),e=document.getElementById("graph_BH_sl"),e.onchange=a.bind(this,"graph_BH_sl",1,"physics_springLength"),e=document.getElementById("graph_BH_damp"),e.onchange=a.bind(this,"graph_BH_damp",1,"physics_damping"),e=document.getElementById("graph_R_nd"),e.onchange=a.bind(this,"graph_R_nd",1,"physics_repulsion_nodeDistance"),e=document.getElementById("graph_R_cg"),e.onchange=a.bind(this,"graph_R_cg",1,"physics_centralGravity"),e=document.getElementById("graph_R_sc"),e.onchange=a.bind(this,"graph_R_sc",1,"physics_springConstant"),e=document.getElementById("graph_R_sl"),e.onchange=a.bind(this,"graph_R_sl",1,"physics_springLength"),e=document.getElementById("graph_R_damp"),e.onchange=a.bind(this,"graph_R_damp",1,"physics_damping"),e=document.getElementById("graph_H_nd"),e.onchange=a.bind(this,"graph_H_nd",1,"physics_hierarchicalRepulsion_nodeDistance"),e=document.getElementById("graph_H_cg"),e.onchange=a.bind(this,"graph_H_cg",1,"physics_centralGravity"),e=document.getElementById("graph_H_sc"),e.onchange=a.bind(this,"graph_H_sc",1,"physics_springConstant"),e=document.getElementById("graph_H_sl"),e.onchange=a.bind(this,"graph_H_sl",1,"physics_springLength"),e=document.getElementById("graph_H_damp"),e.onchange=a.bind(this,"graph_H_damp",1,"physics_damping"),e=document.getElementById("graph_H_direction"),e.onchange=a.bind(this,"graph_H_direction",t,"hierarchicalLayout_direction"),e=document.getElementById("graph_H_levsep"),e.onchange=a.bind(this,"graph_H_levsep",1,"hierarchicalLayout_levelSeparation"),e=document.getElementById("graph_H_nspac"),e.onchange=a.bind(this,"graph_H_nspac",1,"hierarchicalLayout_nodeSpacing");var i=document.getElementById("graph_physicsMethod1"),d=document.getElementById("graph_physicsMethod2"),l=document.getElementById("graph_physicsMethod3");d.checked=!0,this.constants.physics.barnesHut.enabled&&(i.checked=!0),this.constants.hierarchicalLayout.enabled&&(l.checked=!0);var c=document.getElementById("graph_toggleSmooth"),p=document.getElementById("graph_repositionNodes"),u=document.getElementById("graph_generateOptions");c.onclick=s.bind(this),p.onclick=o.bind(this),u.onclick=n.bind(this),c.style.background=1==this.constants.smoothCurves&&0==this.constants.dynamicSmoothCurves?"#A4FF56":"#FF8532",r.apply(this),i.onchange=r.bind(this),d.onchange=r.bind(this),l.onchange=r.bind(this)}},e._overWriteGraphConstants=function(t,e){var i=t.split("_");1==i.length?this.constants[i[0]]=e:2==i.length?this.constants[i[0]][i[1]]=e:3==i.length&&(this.constants[i[0]][i[1]][i[2]]=e)}},function(t,e,i){function s(t){return i(o(t))}function o(t){return n[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var n={};s.keys=function(){return Object.keys(n)},s.resolve=o,t.exports=s},function(t,e){e._calculateNodeForces=function(){var t,e,i,s,o,n,r,a,h,d,l,c=this.calculationNodes,p=this.calculationNodeIndices,u=-2/3,m=4/3,g=this.constants.physics.repulsion.nodeDistance,f=g;for(d=0;di&&(r=.5*f>i?1:v*i+m,r*=0==n?1:1+n*this.constants.clustering.forceAmplification,r/=i,s=t*r,o=e*r,a.fx-=s,a.fy-=o,h.fx+=s,h.fy+=o)}}},function(t,e){e._calculateNodeForces=function(){var t,e,i,s,o,n,r,a,h,d,l=this.calculationNodes,c=this.calculationNodeIndices,p=this.constants.physics.hierarchicalRepulsion.nodeDistance;for(h=0;hi?-Math.pow(u*i,2)+Math.pow(u*p,2):0,0==i?i=.01:n/=i,s=t*n,o=e*n,r.fx-=s,r.fy-=o,a.fx+=s,a.fy+=o}},e._calculateHierarchicalSpringForces=function(){for(var t,e,i,s,o,n,r,a,h,d=this.edges,l=this.calculationNodes,c=this.calculationNodeIndices,p=0;pn;n++)t=e[i[n]],this._getForceContribution(o.root.children.NW,t),this._getForceContribution(o.root.children.NE,t),this._getForceContribution(o.root.children.SW,t),this._getForceContribution(o.root.children.SE,t)}},e._getForceContribution=function(t,e){if(t.childrenCount>0){var i,s,o;if(i=t.centerOfMass.x-e.x,s=t.centerOfMass.y-e.y,o=Math.sqrt(i*i+s*s),o*t.calcSize>this.constants.physics.barnesHut.theta){0==o&&(o=.1*Math.random(),i=o);var n=this.constants.physics.barnesHut.gravitationalConstant*t.mass*e.mass/(o*o*o),r=i*n,a=s*n;e.fx+=r,e.fy+=a}else if(4==t.childrenCount)this._getForceContribution(t.children.NW,e),this._getForceContribution(t.children.NE,e),this._getForceContribution(t.children.SW,e),this._getForceContribution(t.children.SE,e);else if(t.children.data.id!=e.id){0==o&&(o=.5*Math.random(),i=o);var n=this.constants.physics.barnesHut.gravitationalConstant*t.mass*e.mass/(o*o*o),r=i*n,a=s*n;e.fx+=r,e.fy+=a}}},e._formBarnesHutTree=function(t,e){for(var i,s=e.length,o=Number.MAX_VALUE,n=Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE,h=0;s>h;h++){var d=t[e[h]].x,l=t[e[h]].y;o>d&&(o=d),d>r&&(r=d),n>l&&(n=l),l>a&&(a=l)}var c=Math.abs(r-o)-Math.abs(a-n);c>0?(n-=.5*c,a+=.5*c):(o+=.5*c,r-=.5*c);var p=1e-5,u=Math.max(p,Math.abs(r-o)),m=.5*u,g=.5*(o+r),f=.5*(n+a),v={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:g-m,maxX:g+m,minY:f-m,maxY:f+m},size:u,calcSize:1/u,children:{data:null},maxWidth:0,level:0,childrenCount:4}};for(this._splitBranch(v.root),h=0;s>h;h++)i=t[e[h]],this._placeInTree(v.root,i);this.barnesHutTree=v},e._updateBranchMass=function(t,e){var i=t.mass+e.mass,s=1/i;t.centerOfMass.x=t.centerOfMass.x*t.mass+e.x*e.mass,t.centerOfMass.x*=s,t.centerOfMass.y=t.centerOfMass.y*t.mass+e.y*e.mass,t.centerOfMass.y*=s,t.mass=i;var o=Math.max(Math.max(e.height,e.radius),e.width);t.maxWidth=t.maxWidthe.x?t.children.NW.range.maxY>e.y?this._placeInRegion(t,e,"NW"):this._placeInRegion(t,e,"SW"):t.children.NW.range.maxY>e.y?this._placeInRegion(t,e,"NE"):this._placeInRegion(t,e,"SE")},e._placeInRegion=function(t,e,i){switch(t.children[i].childrenCount){case 0:t.children[i].children.data=e,t.children[i].childrenCount=1,this._updateBranchMass(t.children[i],e);break;case 1:t.children[i].children.data.x==e.x&&t.children[i].children.data.y==e.y?(e.x+=Math.random(),e.y+=Math.random()):(this._splitBranch(t.children[i]),this._placeInTree(t.children[i],e));break;case 4:this._placeInTree(t.children[i],e)}},e._splitBranch=function(t){var e=null;1==t.childrenCount&&(e=t.children.data,t.mass=0,t.centerOfMass.x=0,t.centerOfMass.y=0),t.childrenCount=4,t.children.data=null,this._insertRegion(t,"NW"),this._insertRegion(t,"NE"),this._insertRegion(t,"SW"),this._insertRegion(t,"SE"),null!=e&&this._placeInTree(t,e)},e._insertRegion=function(t,e){var i,s,o,n,r=.5*t.size;switch(e){case"NW":i=t.range.minX,s=t.range.minX+r,o=t.range.minY,n=t.range.minY+r;break;case"NE":i=t.range.minX+r,s=t.range.maxX,o=t.range.minY,n=t.range.minY+r;break;case"SW":i=t.range.minX,s=t.range.minX+r,o=t.range.minY+r,n=t.range.maxY;break;case"SE":i=t.range.minX+r,s=t.range.maxX,o=t.range.minY+r,n=t.range.maxY}t.children[e]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:s,minY:o,maxY:n},size:.5*t.size,calcSize:2*t.calcSize,children:{data:null},maxWidth:0,level:t.level+1,childrenCount:0}},e._drawTree=function(t,e){void 0!==this.barnesHutTree&&(t.lineWidth=1,this._drawBranch(this.barnesHutTree.root,t,e))},e._drawBranch=function(t,e,i){void 0===i&&(i="#FF0000"),4==t.childrenCount&&(this._drawBranch(t.children.NW,e),this._drawBranch(t.children.NE,e),this._drawBranch(t.children.SE,e),this._drawBranch(t.children.SW,e)),e.strokeStyle=i,e.beginPath(),e.moveTo(t.range.minX,t.range.minY),e.lineTo(t.range.maxX,t.range.minY),e.stroke(),e.beginPath(),e.moveTo(t.range.maxX,t.range.minY),e.lineTo(t.range.maxX,t.range.maxY),e.stroke(),e.beginPath(),e.moveTo(t.range.maxX,t.range.maxY),e.lineTo(t.range.minX,t.range.maxY),e.stroke(),e.beginPath(),e.moveTo(t.range.minX,t.range.maxY),e.lineTo(t.range.minX,t.range.minY),e.stroke()}},function(t){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}}])}); +//# sourceMappingURL=vis.map \ No newline at end of file diff --git a/docs/dataset.html b/docs/dataset.html index 220c2bd3..57010e1d 100644 --- a/docs/dataset.html +++ b/docs/dataset.html @@ -691,6 +691,13 @@ DataSet.map(callback [, options]); Order the items by a field name or custom sort function. + + returnType + String + Determine the type of output of the get function. Allowed values are Array | Object | DataTable. + The DataTable refers to a Google DataTable. The default returnType is an array. The object type will return a JSON object with the ID's as keys. + +

diff --git a/docs/network.html b/docs/network.html index e2ffb70b..a0142866 100644 --- a/docs/network.html +++ b/docs/network.html @@ -54,6 +54,7 @@

  • Nodes
  • Edges
  • DOT language
  • +
  • Gephi import
  • @@ -262,6 +263,21 @@ When using a DataSet, the network is automatically updating to changes in the Da Description + + borderWidth + Number + 1 + The width of the border of the node when it is not selected, automatically limited by the width of the node. + + + + + borderWidthSelected + Number + undefined + The width of the border of the node when it is selected. If left at undefined, double the borderWidth will be used. + + color String | Object @@ -672,6 +688,14 @@ When using a DataSet, the network is automatically updating to changes in the Da physics.[method].springLength The resting length of the edge when modeled as a spring. By default the springLength determined by the physics is used. By using this setting you can make certain edges have different resting lengths. + + + inheritColor + String | Boolean + false + Possible values: "to","from", true, false. If this value is set to false, the edge color information is used. If the value is set to true or "from", + the color data from the borders of the "from" node is used. If this value is "to", the color data from the borders of the "to" node is used. + title string | function @@ -736,7 +760,85 @@ var data = { var network = new vis.Network(container, data); +

    Gephi import (JSON)

    + +

    + network can import data straight from an exported json file from gephi. You can get the JSON exporter here: + https://marketplace.gephi.org/plugin/json-exporter/. + An example exists showing how to get a JSON file into Vis: 30_importing_from_gephi. +

    + +

    + Example usage: +

    + +
    +// load the JSON file containing the Gephi network.
    +var gephiJSON = loadJSON("./data/WorldCup2014.json"); // code in example 30
    +
    +// create a data object with the gephi key:
    +var data = {
    +  gephi: gephiJSON
    +};
    +
    +// create a network
    +var network = new vis.Network(container, data);
    +
    +Alternatively you can use the parser manually: +
    +// load the JSON file containing the Gephi network.
    +var gephiJSON = loadJSON("./data/WorldCup2014.json"); // code in example 30
    +
    +// parse the gephi file to receive an object
    +// containing nodes and edges in vis format.
    +var parsed = vis.network.gephiParser.parseGephi(gephiJSON);
    +
    +// provide data in the normal fashion
    +var data = {
    +  nodes: parsed.nodes,
    +  edged: parsed.edges
    +};
    +
    +// create a network
    +var network = new vis.Network(container, data);
    +
    + +

    Gephi parser options

    +There are a few options you can use to tell Vis what to do with the data from Gephi. + +
    +var parserOptions = {
    +  allowedToMove: false,
    +  parseColor: false
    +}
    +var parsed = vis.network.gephiParser.parseGephi(gephiJSON, parserOptions);
    +
    + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    allowedToMoveBooleanfalse + If true, the nodes will move according to the physics model after import. If false, the nodes do not move at all. +
    parseColorBooleanfalse + If true, the color will be parsed by the vis parser, generating extra colors for the borders, highlighs and hover. If false, the node will be the supplied color. +

    Configuration options

    @@ -874,7 +976,22 @@ var options = { Toggle if the nodes can be dragged. This will not affect the dragging of the network. - + + hideNodesOnDrag + Boolean + false + + Toggle if the nodes are drawn during a drag. This can greatly improve performance if you have many nodes. + + + + hideEdgesOnDrag + Boolean + false + + Toggle if the edges are drawn during a drag. This can greatly improve performance if you have many edges. + + navigation Object @@ -895,11 +1012,31 @@ var options = { smoothCurves + Boolean || object + object + If true, edges are drawn as smooth curves. This is more computationally intensive since the edge now is a quadratic Bezier curve. This can be further configured by the options below. + + + + smoothCurves.dynamic Boolean true - If true, edges are drawn as smooth curves. This is more computationally intensive since the edge now is a quadratic Bezier curve with control points on both nodes and an invisible node in the center of the edge. This support node is also handed by the physics simulation. + By default, the edges are dynamic. This means there are support nodes placed in the middle of the edge. This support node is also handed by the physics simulation. If false, the smoothness will be based on the + relative positions of the to and from nodes. This is computationally cheaper but there is no self organisation. + + + smoothCurves.type + String + "continuous" + This option only affects NONdynamic smooth curves. The supported types are: continuous, discrete, diagonalCross, straightCross, horizontal, vertical. The effects of these types + are shown in examples 26 and 27 + + + smoothCurves.roundness + Number + 0.5 + This only affects NONdynamic smooth curves. The roundness can be tweaked with the parameter. The value range is from 0 to 1 with a maximum roundness at 0.5. - selectable Boolean @@ -1223,6 +1360,14 @@ var options = { The resting length of the edge when modeled as a spring. By default the springLength determined by the physics is used. By using this setting you can make certain edges have different resting lengths. + + inheritColor + String | Boolean + false + Possible values: "to","from", true, false. If this value is set to false, the edge color information is used. If the value is set to true or "from", + the color data from the borders of the "from" node is used. If this value is "to", the color data from the borders of the "to" node is used. + + style String @@ -2366,7 +2511,8 @@ network.off('select', onSelect); stabilized - Fired when the network has been stabilized after initialization. This event can be used to trigger the .storePosition() function after stabilization. + Fired when the network has been stabilized. This event can be used to trigger the .storePosition() function after stabilization. When the network in initialized, the parameter + iterations will be the amount of iterations it took to stabilize. After initialization, this parameter is null.
    • iterations: number of iterations used to stabilize
    • diff --git a/docs/timeline.html b/docs/timeline.html index c280eb56..83a2b8ac 100644 --- a/docs/timeline.html +++ b/docs/timeline.html @@ -449,7 +449,21 @@ var options = { margin.item Number 10 - The minimal margin in pixels between items. + The minimal margin in pixels between items in both horizontal and vertical direction. + + + + margin.item.horizontal + Number + 10 + The minimal horizontal margin in pixels between items. + + + + margin.item.vertical + Number + 10 + The minimal vertical margin in pixels between items. @@ -726,6 +740,12 @@ timeline.clear({options: true}); // clear options only Get an array with the ids of the currently selected items. + + getVisibleItems() + Number[] + Get an array with the ids of the currently visible items. + + getWindow() Object diff --git a/examples/network/02_random_nodes.html b/examples/network/02_random_nodes.html index 9a8b1c00..d494d741 100644 --- a/examples/network/02_random_nodes.html +++ b/examples/network/02_random_nodes.html @@ -31,7 +31,8 @@ for (var i = 0; i < nodeCount; i++) { nodes.push({ id: i, - label: String(i) + label: String(i), + radius:300 }); connectionCount[i] = 0; @@ -81,12 +82,12 @@ }, stabilize: false }; - network = new vis.Network(container, data, options); + network = new vis.Network(container, data, options); - // add event listeners - network.on('select', function(params) { - document.getElementById('selection').innerHTML = 'Selection: ' + params.nodes; - }); + // add event listeners + network.on('select', function(params) { + document.getElementById('selection').innerHTML = 'Selection: ' + params.nodes; + }); } diff --git a/examples/network/07_selections.html b/examples/network/07_selections.html index 8b4ba05d..32d84e16 100644 --- a/examples/network/07_selections.html +++ b/examples/network/07_selections.html @@ -56,7 +56,7 @@ }); // set initial selection (id's of some nodes) - network.setSelection([3, 4, 5]); + network.selectNodes([3, 4, 5]); diff --git a/examples/network/23_hierarchical_layout.html b/examples/network/23_hierarchical_layout.html index b4724ff8..bdde2b54 100644 --- a/examples/network/23_hierarchical_layout.html +++ b/examples/network/23_hierarchical_layout.html @@ -82,6 +82,7 @@ edges: { }, stabilize: false, + smoothCurves: false, hierarchicalLayout: { direction: directionInput.value } diff --git a/examples/network/24_hierarchical_layout_userdefined.html b/examples/network/24_hierarchical_layout_userdefined.html index a8df871e..50981a16 100644 --- a/examples/network/24_hierarchical_layout_userdefined.html +++ b/examples/network/24_hierarchical_layout_userdefined.html @@ -20,6 +20,7 @@ var nodes = null; var edges = null; var network = null; + var directionInput = document.getElementById("direction"); function draw() { nodes = []; @@ -113,7 +114,9 @@ }; var options = { - hierarchicalLayout:true + hierarchicalLayout: { + direction: directionInput.value + } }; network = new vis.Network(container, data, options); @@ -122,6 +125,7 @@ document.getElementById('selection').innerHTML = 'Selection: ' + params.nodes; }); } + @@ -129,11 +133,40 @@

      Hierarchical Layout - User-defined

      This example shows a user-defined hierarchical layout. If the user defines levels for nodes but does not do so for all nodes, an alert will show up and hierarchical layout will be disabled. Either all or none can be defined. + If the smooth curves appear to be inverted, the direction of the edge is not in the same direction as the network.
      + + + + +

      + diff --git a/examples/network/26_staticSmoothCurves.html b/examples/network/26_staticSmoothCurves.html new file mode 100644 index 00000000..c12606af --- /dev/null +++ b/examples/network/26_staticSmoothCurves.html @@ -0,0 +1,75 @@ + + + + Network | Static smooth curves + + + + + + + + +

      Static smooth curves

      +
      + All the smooth curves in the examples so far have been using dynamic smooth curves. This means that each curve has a + support node which takes part in the physics simulation. For large networks or dense clusters, this may not be the ideal + solution. To solve this, static smooth curves have been added. The static smooth curves are based only on the positions of the connected + nodes. There are multiple ways to determine the way this curve is drawn. This example shows the effect of the different + types.

      + Drag the nodes around each other to see how the smooth curves are drawn for each setting. For animated system, we + recommend only the continuous mode. In the next example you can see the effect of these methods on a large network. Keep in mind + that the direction (the from and to) of the curve matters. +

      +
      + +Smooth curve type: + +
      + + + + + diff --git a/examples/network/27_world_cup_network.html b/examples/network/27_world_cup_network.html new file mode 100644 index 00000000..54e85cb5 --- /dev/null +++ b/examples/network/27_world_cup_network.html @@ -0,0 +1,10109 @@ + + + + Network | Static smooth curves - World Cup Network + + + + + + + + + +

      Static smooth curves - World Cup Network

      +
      + The static smooth curves are based only on the positions of the connected nodes. + There are multiple ways to determine the way this curve is drawn. + This example shows the effect of the different types on a large network. +

      + Also shown in this example is the inheritColor option of the edges as well as the roundness factor.
      +

      + To improve performance, the physics have been disabled with: +
      {barnesHut: {gravitationalConstant: 0, centralGravity: 0, springConstant: 0}}
      and we have enabled + the toggle hideEdgesOnDrag. +

      +
      + +Smooth curve type: +
      +inheritColor option: +
      +Roundness (0..1): (0.5 is max roundness for continuous, 1.0 for the others) +
      +Hide edges on drag:
      +Hide nodes on drag: + +
      + + + + + + diff --git a/examples/network/28_world_cup_network_performance.html b/examples/network/28_world_cup_network_performance.html new file mode 100644 index 00000000..cffc274c --- /dev/null +++ b/examples/network/28_world_cup_network_performance.html @@ -0,0 +1,10053 @@ + + + + Network | Static smooth curves - World Cup Network + + + + + + + + + +

      Performance - World Cup Network

      +
      + This example shows the performance of vis with a larger network. The edges in particular (~9200) are very computationally intensive + to draw. Drag and hold the graph to see the performance difference if the edges are hidden. +

      + We use the following physics configuration:
      + {barnesHut: {gravitationalConstant: -80000, springConstant: 0.001, springLength: 200}} +

      +
      + +
      + + + + + + diff --git a/examples/network/29_neighbourhood_highlight.html b/examples/network/29_neighbourhood_highlight.html new file mode 100644 index 00000000..901d0c8c --- /dev/null +++ b/examples/network/29_neighbourhood_highlight.html @@ -0,0 +1,10213 @@ + + + + Network | Static smooth curves - World Cup Network + + + + + + + + + +

      Dynamic Data - Neighbourhood Highlight

      +
      + This example shows the power of the DataSet. Once a node is clicked, all nodes are greyed out except for the first and second order connected nodes. + In this example we show how you can determine the order of connection per node as well as applying individual styling to the nodes based on whether or not + they are connected to the selected node. The code doing the highlighting only takes about 20ms, the rest of the time is the redrawing of the network (9200 edges..). +

      +
      + +
      + + + + + + diff --git a/examples/network/30_importing_from_gephi.html b/examples/network/30_importing_from_gephi.html new file mode 100644 index 00000000..7b2f93f1 --- /dev/null +++ b/examples/network/30_importing_from_gephi.html @@ -0,0 +1,166 @@ + + + + Dynamic Data - Importing from Gephi (JSON) + + + + + + + + +

      Dynamic Data - Importing from Gephi (JSON)

      +
      + This example shows how to import a JSON file exported by Gephi. The two options available for the import are + available through the checkboxes. You can download the Gephi JSON exporter here: + https://marketplace.gephi.org/plugin/json-exporter/. + All of Gephi's attributes are also contained within the node elements. This means you can access all of this data through the DataSet. +
      +
      + + +: Allow to move after import.
      +: Parse the color instead of copy (adds borders, highlights etc.) +
      +

      Node Content:

      + + + + + + diff --git a/examples/network/data/WorldCup2014.json b/examples/network/data/WorldCup2014.json new file mode 100644 index 00000000..2f921e0e --- /dev/null +++ b/examples/network/data/WorldCup2014.json @@ -0,0 +1 @@ +{"edges":[{"source":"131","target":"580","id":"4385","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"186","target":"368","id":"5487","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"651","target":"725","id":"10555","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"28","target":"83","id":"2090","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"570","target":"584","id":"10163","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"113","target":"337","id":"4011","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"89","target":"726","id":"3532","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"245","target":"643","id":"6493","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"314","target":"714","id":"7596","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"325","target":"496","id":"7735","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"52","target":"492","id":"2661","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"489","target":"548","id":"9605","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"72","target":"363","id":"3136","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"296","target":"716","id":"7337","attributes":{"Weight":"1.0"},"color":"rgb(148,164,148)","size":1.0},{"source":"60","target":"713","id":"2864","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"210","target":"217","id":"5899","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"246","target":"696","id":"6512","attributes":{"Weight":"1.0"},"color":"rgb(196,67,164)","size":1.0},{"source":"62","target":"375","id":"2912","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"377","target":"561","id":"8391","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"14","target":"190","id":"1777","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"16","target":"21","id":"1821","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"90","target":"375","id":"3544","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"80","target":"348","id":"3315","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"34","target":"229","id":"2247","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"4","target":"347","id":"1543","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"61","target":"350","id":"2879","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"483","target":"512","id":"9570","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"461","target":"463","id":"9374","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"449","target":"478","id":"9249","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"2","target":"99","id":"1489","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"535","target":"669","id":"9978","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"242","target":"502","id":"6439","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"196","target":"728","id":"5678","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"303","target":"616","id":"7445","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"316","target":"643","id":"7620","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"549","target":"700","id":"10058","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"135","target":"717","id":"4479","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"97","target":"655","id":"3703","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"724","target":"730","id":"10678","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"173","target":"418","id":"5237","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"439","target":"695","id":"9144","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"350","target":"534","id":"8081","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"377","target":"391","id":"8378","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"176","target":"492","id":"5293","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"76","target":"728","id":"3240","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"95","target":"448","id":"3653","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"66","target":"78","id":"2993","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"236","target":"552","id":"6351","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"139","target":"434","id":"4545","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"22","target":"24","id":"1958","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"186","target":"334","id":"5485","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"30","target":"324","id":"2154","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"202","target":"450","id":"5775","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"524","target":"688","id":"9891","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"665","target":"693","id":"10599","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"215","target":"723","id":"6005","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"28","target":"627","id":"2118","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"2","target":"31","id":"1487","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"177","target":"625","id":"5320","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"179","target":"677","id":"5365","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"182","target":"662","id":"5412","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"135","target":"567","id":"4473","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"128","target":"248","id":"4309","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"45","target":"123","id":"2495","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"141","target":"622","id":"4601","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"71","target":"714","id":"3128","attributes":{"Weight":"1.0"},"color":"rgb(132,99,229)","size":1.0},{"source":"155","target":"227","id":"4888","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"591","target":"693","id":"10293","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"44","target":"648","id":"2487","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"23","target":"568","id":"1989","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"6","target":"477","id":"1594","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"145","target":"454","id":"4690","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"184","target":"270","id":"5442","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"385","target":"442","id":"8501","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"139","target":"702","id":"4554","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"173","target":"605","id":"5246","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"428","target":"652","id":"9013","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"16","target":"732","id":"1841","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"23","target":"540","id":"1988","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"444","target":"514","id":"9211","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"37","target":"210","id":"2312","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"103","target":"446","id":"3816","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"316","target":"720","id":"7625","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"82","target":"374","id":"3349","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"481","target":"670","id":"9564","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"262","target":"483","id":"6778","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"112","target":"209","id":"3990","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"345","target":"682","id":"8023","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"201","target":"334","id":"5755","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"337","target":"488","id":"7916","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"29","target":"307","id":"2128","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"224","target":"717","id":"6165","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"399","target":"647","id":"8691","attributes":{"Weight":"1.0"},"color":"rgb(148,83,196)","size":1.0},{"source":"347","target":"670","id":"8045","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"627","target":"717","id":"10445","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"115","target":"587","id":"4060","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"186","target":"710","id":"5494","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"551","target":"609","id":"10065","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"252","target":"291","id":"6599","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"442","target":"678","id":"9193","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"274","target":"631","id":"6970","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"454","target":"475","id":"9295","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"216","target":"286","id":"6007","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"567","target":"586","id":"10144","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"383","target":"587","id":"8477","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"230","target":"362","id":"6253","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"382","target":"438","id":"8451","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"104","target":"357","id":"3833","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"79","target":"385","id":"3286","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"191","target":"463","id":"5576","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"527","target":"679","id":"9918","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"104","target":"317","id":"3830","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"343","target":"588","id":"8001","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"252","target":"447","id":"6603","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"38","target":"277","id":"2340","attributes":{"Weight":"1.0"},"color":"rgb(229,180,67)","size":1.0},{"source":"557","target":"696","id":"10100","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"87","target":"663","id":"3478","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"215","target":"339","id":"5989","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"571","target":"719","id":"10178","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"204","target":"302","id":"5807","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"79","target":"455","id":"3290","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"9","target":"102","id":"1662","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"529","target":"699","id":"9941","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"228","target":"324","id":"6220","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"290","target":"395","id":"7245","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"275","target":"304","id":"6975","attributes":{"Weight":"1.0"},"color":"rgb(67,148,148)","size":1.0},{"source":"5","target":"258","id":"1564","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"44","target":"82","id":"2459","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"323","target":"443","id":"7711","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"212","target":"608","id":"5949","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"644","target":"720","id":"10518","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"300","target":"669","id":"7399","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"105","target":"234","id":"3846","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"677","target":"679","id":"10622","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"164","target":"166","id":"5056","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"299","target":"624","id":"7382","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"64","target":"354","id":"2963","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"176","target":"427","id":"5290","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"238","target":"713","id":"6385","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"293","target":"708","id":"7290","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"567","target":"676","id":"10145","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"213","target":"242","id":"5956","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"163","target":"388","id":"5046","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"396","target":"606","id":"8648","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"176","target":"456","id":"5291","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"41","target":"137","id":"2396","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"368","target":"569","id":"8272","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"78","target":"570","id":"3272","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"5","target":"603","id":"1576","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"241","target":"504","id":"6420","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"107","target":"705","id":"3888","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"323","target":"717","id":"7719","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"79","target":"140","id":"3279","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"299","target":"653","id":"7383","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"516","target":"633","id":"9815","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"511","target":"716","id":"9796","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"427","target":"609","id":"8999","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"325","target":"659","id":"7743","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"345","target":"714","id":"8024","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"207","target":"362","id":"5863","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"44","target":"79","id":"2458","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"66","target":"306","id":"3000","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"44","target":"573","id":"2480","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"133","target":"673","id":"4431","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"162","target":"384","id":"5024","attributes":{"Weight":"1.0"},"color":"rgb(115,229,99)","size":1.0},{"source":"216","target":"652","id":"6026","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"114","target":"246","id":"4026","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"146","target":"626","id":"4717","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"477","target":"515","id":"9532","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"251","target":"255","id":"6582","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"226","target":"714","id":"6194","attributes":{"Weight":"1.0"},"color":"rgb(213,132,148)","size":1.0},{"source":"272","target":"437","id":"6939","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"342","target":"691","id":"7989","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"110","target":"397","id":"3946","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"241","target":"480","id":"6418","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"55","target":"444","id":"2735","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"564","target":"592","id":"10131","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"38","target":"424","id":"2343","attributes":{"Weight":"1.0"},"color":"rgb(148,213,148)","size":1.0},{"source":"238","target":"668","id":"6384","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"646","target":"730","id":"10527","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"431","target":"586","id":"9046","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"425","target":"675","id":"8979","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"345","target":"534","id":"8017","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"86","target":"180","id":"3434","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"167","target":"607","id":"5127","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"180","target":"286","id":"5373","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"448","target":"501","id":"9239","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"235","target":"710","id":"6341","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"71","target":"83","id":"3105","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"151","target":"676","id":"4826","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"34","target":"581","id":"2262","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"372","target":"426","id":"8308","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"276","target":"355","id":"6995","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"110","target":"231","id":"3937","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"133","target":"613","id":"4429","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"44","target":"231","id":"2466","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"60","target":"201","id":"2839","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"493","target":"605","id":"9649","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"160","target":"671","id":"4996","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"415","target":"612","id":"8851","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"251","target":"696","id":"6598","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"117","target":"530","id":"4107","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"432","target":"443","id":"9052","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"64","target":"239","id":"2957","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"232","target":"576","id":"6289","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"209","target":"483","id":"5896","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"565","target":"663","id":"10136","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"63","target":"632","id":"2938","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"145","target":"331","id":"4683","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"125","target":"478","id":"4260","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"231","target":"575","id":"6269","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"20","target":"513","id":"1927","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"142","target":"542","id":"4620","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"222","target":"710","id":"6129","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"640","target":"708","id":"10502","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"33","target":"124","id":"2212","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"86","target":"428","id":"3442","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"241","target":"271","id":"6414","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"368","target":"548","id":"8270","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"487","target":"645","id":"9594","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"126","target":"513","id":"4280","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"193","target":"491","id":"5606","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"381","target":"719","id":"8449","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"392","target":"399","id":"8596","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"351","target":"609","id":"8099","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"74","target":"428","id":"3178","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"207","target":"344","id":"5860","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"72","target":"342","id":"3135","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"291","target":"481","id":"7265","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"1","target":"605","id":"1482","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"295","target":"592","id":"7322","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"334","target":"552","id":"7878","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"374","target":"433","id":"8334","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"205","target":"519","id":"5828","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"16","target":"51","id":"1827","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"100","target":"672","id":"3760","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"305","target":"334","id":"7464","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"326","target":"341","id":"7747","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"410","target":"557","id":"8813","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"300","target":"698","id":"7400","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"92","target":"176","id":"3575","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"80","target":"668","id":"3323","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"315","target":"389","id":"7598","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"157","target":"299","id":"4926","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"211","target":"261","id":"5915","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"460","target":"667","id":"9368","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"103","target":"318","id":"3813","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"69","target":"396","id":"3066","attributes":{"Weight":"1.0"},"color":"rgb(132,83,229)","size":1.0},{"source":"339","target":"504","id":"7940","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"479","target":"686","id":"9548","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"145","target":"289","id":"4679","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"434","target":"576","id":"9089","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"635","target":"697","id":"10477","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"298","target":"459","id":"7357","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"114","target":"632","id":"4038","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"165","target":"359","id":"5085","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"214","target":"483","id":"5981","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"332","target":"652","id":"7853","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"244","target":"682","id":"6475","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"61","target":"577","id":"2890","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"130","target":"701","id":"4369","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"23","target":"24","id":"1978","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"498","target":"573","id":"9691","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"266","target":"723","id":"6845","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"382","target":"481","id":"8456","attributes":{"Weight":"1.0"},"color":"rgb(132,164,148)","size":1.0},{"source":"258","target":"430","id":"6701","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"148","target":"458","id":"4745","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"279","target":"366","id":"7038","attributes":{"Weight":"1.0"},"color":"rgb(148,67,213)","size":1.0},{"source":"79","target":"614","id":"3298","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"150","target":"155","id":"4778","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"205","target":"526","id":"5830","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"647","target":"730","id":"10536","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"122","target":"614","id":"4206","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"332","target":"645","id":"7852","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"210","target":"488","id":"5905","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"387","target":"520","id":"8538","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"341","target":"365","id":"7965","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"199","target":"670","id":"5729","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"152","target":"163","id":"4829","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"561","target":"658","id":"10114","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"348","target":"603","id":"8055","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"166","target":"168","id":"5096","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"606","target":"646","id":"10353","attributes":{"Weight":"1.0"},"color":"rgb(132,83,229)","size":1.0},{"source":"3","target":"711","id":"1531","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"118","target":"387","id":"4119","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"239","target":"262","id":"6387","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"283","target":"413","id":"7129","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"202","target":"486","id":"5778","attributes":{"Weight":"1.0"},"color":"rgb(148,213,148)","size":1.0},{"source":"136","target":"206","id":"4483","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"65","target":"347","id":"2982","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"233","target":"699","id":"6310","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"116","target":"415","id":"4079","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"270","target":"312","id":"6905","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"561","target":"647","id":"10113","attributes":{"Weight":"1.0"},"color":"rgb(148,83,196)","size":1.0},{"source":"538","target":"684","id":"9998","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"205","target":"655","id":"5836","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"490","target":"675","id":"9617","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"64","target":"223","id":"2955","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"18","target":"65","id":"1866","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"460","target":"654","id":"9367","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"103","target":"357","id":"3815","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"30","target":"499","id":"2160","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"230","target":"262","id":"6248","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"368","target":"720","id":"8276","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"395","target":"405","id":"8633","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"165","target":"226","id":"5081","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"377","target":"394","id":"8381","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"5","target":"116","id":"1556","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"160","target":"322","id":"4985","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"338","target":"507","id":"7929","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"50","target":"419","id":"2619","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"253","target":"356","id":"6617","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"79","target":"475","id":"3291","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"362","target":"483","id":"8199","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"86","target":"332","id":"3440","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"182","target":"626","id":"5410","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"139","target":"430","id":"4544","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"174","target":"292","id":"5251","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"196","target":"381","id":"5658","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"560","target":"731","id":"10112","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"515","target":"686","id":"9812","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"506","target":"588","id":"9754","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"12","target":"424","id":"1741","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"299","target":"669","id":"7384","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"460","target":"606","id":"9363","attributes":{"Weight":"1.0"},"color":"rgb(132,148,180)","size":1.0},{"source":"401","target":"545","id":"8710","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"390","target":"658","id":"8576","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"661","target":"690","id":"10588","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"515","target":"518","id":"9808","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"162","target":"431","id":"5025","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"71","target":"210","id":"3112","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"395","target":"658","id":"8641","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"50","target":"643","id":"2627","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"317","target":"509","id":"7631","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"47","target":"254","id":"2546","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"398","target":"638","id":"8673","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"578","target":"596","id":"10224","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"523","target":"565","id":"9877","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"518","target":"541","id":"9834","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"305","target":"353","id":"7465","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"115","target":"363","id":"4052","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"28","target":"419","id":"2108","attributes":{"Weight":"1.0"},"color":"rgb(67,180,229)","size":1.0},{"source":"7","target":"596","id":"1616","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"61","target":"327","id":"2876","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"313","target":"459","id":"7569","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"343","target":"378","id":"7994","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"532","target":"685","id":"9957","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"6","target":"77","id":"1581","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"550","target":"712","id":"10063","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"196","target":"667","id":"5677","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"204","target":"636","id":"5815","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"299","target":"703","id":"7386","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"294","target":"629","id":"7307","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"204","target":"516","id":"5810","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"471","target":"515","id":"9469","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"297","target":"715","id":"7351","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"351","target":"367","id":"8089","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"400","target":"423","id":"8697","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"79","target":"648","id":"3300","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"660","target":"696","id":"10586","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"466","target":"646","id":"9419","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"155","target":"359","id":"4893","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"96","target":"234","id":"3673","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"370","target":"701","id":"8290","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"296","target":"525","id":"7329","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"438","target":"466","id":"9126","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"85","target":"323","id":"3417","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"432","target":"514","id":"9056","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"44","target":"627","id":"2486","attributes":{"Weight":"1.0"},"color":"rgb(67,180,196)","size":1.0},{"source":"272","target":"347","id":"6936","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"138","target":"437","id":"4525","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"300","target":"432","id":"7388","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"4","target":"664","id":"1551","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"345","target":"507","id":"8016","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"170","target":"556","id":"5182","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"290","target":"330","id":"7238","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"31","target":"153","id":"2171","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"220","target":"520","id":"6086","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"46","target":"565","id":"2538","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"150","target":"154","id":"4777","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"216","target":"593","id":"6020","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"217","target":"625","id":"6038","attributes":{"Weight":"1.0"},"color":"rgb(67,180,180)","size":1.0},{"source":"310","target":"518","id":"7534","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"16","target":"23","id":"1823","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"82","target":"480","id":"3357","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"332","target":"703","id":"7854","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"448","target":"712","id":"9246","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"384","target":"679","id":"8496","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"218","target":"572","id":"6058","attributes":{"Weight":"1.0"},"color":"rgb(148,115,213)","size":1.0},{"source":"454","target":"623","id":"9303","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"328","target":"615","id":"7791","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"378","target":"388","id":"8394","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"27","target":"575","id":"2077","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"23","target":"174","id":"1983","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"205","target":"218","id":"5821","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"242","target":"365","id":"6435","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"57","target":"604","id":"2788","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"289","target":"529","id":"7227","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"177","target":"366","id":"5308","attributes":{"Weight":"1.0"},"color":"rgb(67,148,180)","size":1.0},{"source":"416","target":"675","id":"8868","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"99","target":"672","id":"3743","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"153","target":"457","id":"4854","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"54","target":"261","id":"2699","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"184","target":"637","id":"5452","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"107","target":"662","id":"3887","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"124","target":"361","id":"4241","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"632","target":"639","id":"10460","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"406","target":"544","id":"8766","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"14","target":"72","id":"1774","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"170","target":"423","id":"5180","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"252","target":"661","id":"6613","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"96","target":"99","id":"3664","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"328","target":"609","id":"7790","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"537","target":"691","id":"9991","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"162","target":"723","id":"5039","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"24","target":"439","id":"2007","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"559","target":"560","id":"10106","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"246","target":"639","id":"6509","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"367","target":"551","id":"8260","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"36","target":"495","id":"2299","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"45","target":"478","id":"2509","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"48","target":"641","id":"2574","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"218","target":"279","id":"6047","attributes":{"Weight":"1.0"},"color":"rgb(148,115,213)","size":1.0},{"source":"304","target":"554","id":"7457","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"138","target":"404","id":"4523","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"154","target":"572","id":"4876","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"354","target":"484","id":"8128","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"56","target":"612","id":"2759","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"144","target":"150","id":"4649","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"575","target":"576","id":"10202","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"492","target":"549","id":"9637","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"431","target":"436","id":"9040","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"93","target":"618","id":"3613","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"359","target":"486","id":"8175","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"39","target":"711","id":"2374","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"160","target":"638","id":"4993","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"401","target":"556","id":"8711","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"113","target":"533","id":"4015","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"586","target":"699","id":"10269","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"76","target":"288","id":"3216","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"289","target":"717","id":"7236","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"98","target":"329","id":"3709","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"129","target":"155","id":"4325","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"243","target":"568","id":"6451","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"374","target":"396","id":"8333","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"176","target":"536","id":"5294","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"238","target":"303","id":"6369","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"206","target":"550","id":"5847","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"473","target":"594","id":"9498","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"370","target":"554","id":"8287","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"328","target":"551","id":"7789","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"23","target":"704","id":"1994","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"23","target":"733","id":"1997","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"260","target":"339","id":"6733","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"459","target":"477","id":"9349","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"44","target":"678","id":"2488","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"575","target":"668","id":"10207","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"465","target":"646","id":"9407","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"290","target":"560","id":"7253","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"129","target":"352","id":"4335","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"374","target":"623","id":"8345","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"343","target":"712","id":"8003","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"96","target":"457","id":"3679","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"542","target":"669","id":"10020","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"10","target":"457","id":"1699","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"416","target":"622","id":"8866","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"48","target":"733","id":"2579","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"433","target":"629","id":"9081","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"130","target":"481","id":"4362","attributes":{"Weight":"1.0"},"color":"rgb(132,148,148)","size":1.0},{"source":"259","target":"553","id":"6721","attributes":{"Weight":"1.0"},"color":"rgb(115,148,164)","size":1.0},{"source":"422","target":"572","id":"8937","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"8","target":"318","id":"1637","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"286","target":"703","id":"7178","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"147","target":"157","id":"4721","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"60","target":"324","id":"2846","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"27","target":"308","id":"2067","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"210","target":"407","id":"5903","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"231","target":"583","id":"6271","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"304","target":"630","id":"7458","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"41","target":"380","id":"2403","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"24","target":"732","id":"2015","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"38","target":"531","id":"2349","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"385","target":"678","id":"8515","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"580","target":"593","id":"10241","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"303","target":"415","id":"7435","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"375","target":"577","id":"8359","attributes":{"Weight":"1.0"},"color":"rgb(83,229,115)","size":1.0},{"source":"455","target":"698","id":"9319","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"102","target":"235","id":"3788","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"163","target":"617","id":"5053","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"180","target":"188","id":"5370","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"320","target":"609","id":"7683","attributes":{"Weight":"1.0"},"color":"rgb(164,99,148)","size":1.0},{"source":"57","target":"87","id":"2768","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"68","target":"270","id":"3039","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"342","target":"702","id":"7990","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"261","target":"450","id":"6760","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"516","target":"697","id":"9822","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"261","target":"279","id":"6752","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"536","target":"700","id":"9984","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"237","target":"452","id":"6361","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"14","target":"115","id":"1776","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"44","target":"717","id":"2490","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"217","target":"627","id":"6040","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"52","target":"615","id":"2666","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"287","target":"631","id":"7192","attributes":{"Weight":"1.0"},"color":"rgb(67,196,229)","size":1.0},{"source":"593","target":"703","id":"10300","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"57","target":"409","id":"2774","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"712","target":"727","id":"10672","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"62","target":"406","id":"2913","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"22","target":"568","id":"1970","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"38","target":"359","id":"2342","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"288","target":"523","id":"7207","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"410","target":"545","id":"8811","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"134","target":"476","id":"4443","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"60","target":"222","id":"2840","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"234","target":"600","id":"6322","attributes":{"Weight":"1.0"},"color":"rgb(67,148,229)","size":1.0},{"source":"247","target":"584","id":"6524","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"346","target":"664","id":"8034","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"150","target":"373","id":"4787","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"318","target":"371","id":"7639","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"145","target":"586","id":"4697","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"94","target":"673","id":"3636","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"482","target":"653","id":"9567","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"392","target":"394","id":"8594","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"53","target":"633","id":"2683","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"354","target":"362","id":"8125","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"485","target":"671","id":"9582","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"113","target":"705","id":"4021","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"474","target":"657","id":"9508","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"76","target":"508","id":"3227","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"17","target":"49","id":"1844","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"260","target":"266","id":"6730","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"112","target":"230","id":"3993","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"624","target":"698","id":"10433","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"601","target":"703","id":"10331","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"181","target":"369","id":"5393","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"229","target":"318","id":"6237","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"541","target":"686","id":"10017","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"443","target":"567","id":"9199","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"359","target":"430","id":"8172","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"556","target":"557","id":"10088","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"340","target":"346","id":"7953","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"155","target":"591","id":"4899","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"247","target":"389","id":"6520","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"316","target":"371","id":"7608","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"27","target":"576","id":"2078","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"95","target":"617","id":"3660","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"110","target":"179","id":"3935","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"545","target":"696","id":"10041","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"432","target":"719","id":"9068","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"568","target":"704","id":"10151","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"68","target":"73","id":"3033","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"297","target":"485","id":"7342","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"304","target":"652","id":"7459","attributes":{"Weight":"1.0"},"color":"rgb(148,115,148)","size":1.0},{"source":"159","target":"671","id":"4976","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"67","target":"73","id":"3013","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"332","target":"528","id":"7845","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"104","target":"275","id":"3827","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"89","target":"127","id":"3513","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"12","target":"202","id":"1731","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"168","target":"430","id":"5137","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"505","target":"574","id":"9745","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"299","target":"455","id":"7375","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"74","target":"172","id":"3170","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"465","target":"724","id":"9412","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"10","target":"130","id":"1688","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"2","target":"130","id":"1493","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"479","target":"515","id":"9543","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"5","target":"308","id":"1566","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"656","target":"660","id":"10573","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"401","target":"660","id":"8715","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"377","target":"390","id":"8377","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"56","target":"667","id":"2762","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"678","target":"687","id":"10625","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"420","target":"705","id":"8913","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"625","target":"654","id":"10434","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"8","target":"177","id":"1634","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"100","target":"181","id":"3749","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"143","target":"698","id":"4648","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"144","target":"603","id":"4668","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"348","target":"702","id":"8059","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"497","target":"684","id":"9685","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"382","target":"651","id":"8463","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"122","target":"687","id":"4210","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"422","target":"693","id":"8941","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"15","target":"274","id":"1806","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"156","target":"375","id":"4913","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"44","target":"547","id":"2479","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"309","target":"369","id":"7517","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"152","target":"343","id":"4833","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"310","target":"470","id":"7529","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"379","target":"505","id":"8411","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"11","target":"272","id":"1713","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"641","target":"733","id":"10510","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"178","target":"367","id":"5332","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"425","target":"472","id":"8965","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"624","target":"653","id":"10431","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"90","target":"213","id":"3538","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"86","target":"716","id":"3454","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"8","target":"646","id":"1652","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"66","target":"389","id":"3003","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"639","target":"715","id":"10497","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"16","target":"293","id":"1832","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"49","target":"317","id":"2590","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"32","target":"656","id":"2202","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"288","target":"567","id":"7213","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"174","target":"732","id":"5261","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"37","target":"722","id":"2327","attributes":{"Weight":"1.0"},"color":"rgb(67,148,229)","size":1.0},{"source":"402","target":"545","id":"8721","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"105","target":"309","id":"3848","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"234","target":"630","id":"6324","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"296","target":"582","id":"7331","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"555","target":"642","id":"10084","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"5","target":"335","id":"1567","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"415","target":"616","id":"8852","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"333","target":"528","id":"7858","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"634","target":"711","id":"10472","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"279","target":"676","id":"7051","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"531","target":"634","id":"9948","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"148","target":"298","id":"4741","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"218","target":"519","id":"6055","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"280","target":"376","id":"7059","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"94","target":"507","id":"3630","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"55","target":"542","id":"2741","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"425","target":"676","id":"8980","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"193","target":"466","id":"5605","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"5","target":"238","id":"1562","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"251","target":"410","id":"6588","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"67","target":"736","id":"3032","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"102","target":"324","id":"3792","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"337","target":"627","id":"7920","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"236","target":"324","id":"6343","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"143","target":"332","id":"4635","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"493","target":"494","id":"9643","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"280","target":"289","id":"7056","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"10","target":"369","id":"1697","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"306","target":"467","id":"7477","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"163","target":"448","id":"5047","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"218","target":"585","id":"6060","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"360","target":"727","id":"8192","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"99","target":"366","id":"3736","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"27","target":"76","id":"2057","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"125","target":"483","id":"4263","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"676","target":"699","id":"10619","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"364","target":"602","id":"8221","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"485","target":"657","id":"9580","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"167","target":"191","id":"5117","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"89","target":"322","id":"3520","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"279","target":"436","id":"7042","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"134","target":"683","id":"4449","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"255","target":"402","id":"6651","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"206","target":"360","id":"5841","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"670","target":"709","id":"10609","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"425","target":"440","id":"8963","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"294","target":"589","id":"7304","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"239","target":"361","id":"6391","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"152","target":"378","id":"4835","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"335","target":"575","id":"7886","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"283","target":"393","id":"7122","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"625","target":"707","id":"10439","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"684","target":"688","id":"10632","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"471","target":"518","id":"9470","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"121","target":"486","id":"4186","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"330","target":"566","id":"7827","attributes":{"Weight":"1.0"},"color":"rgb(213,67,196)","size":1.0},{"source":"48","target":"158","id":"2565","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"503","target":"628","id":"9729","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"301","target":"444","id":"7404","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"31","target":"99","id":"2166","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"208","target":"471","id":"5876","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"379","target":"597","id":"8415","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"40","target":"570","id":"2389","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"300","target":"444","id":"7389","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"547","target":"676","id":"10049","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"425","target":"473","id":"8966","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"460","target":"625","id":"9365","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"195","target":"274","id":"5637","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"176","target":"615","id":"5298","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"588","target":"727","id":"10278","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"603","target":"713","id":"10344","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"50","target":"371","id":"2616","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"218","target":"260","id":"6044","attributes":{"Weight":"1.0"},"color":"rgb(115,196,148)","size":1.0},{"source":"667","target":"677","id":"10602","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"478","target":"482","id":"9539","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"470","target":"541","id":"9463","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"119","target":"360","id":"4138","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"109","target":"248","id":"3914","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"82","target":"337","id":"3348","attributes":{"Weight":"1.0"},"color":"rgb(67,180,196)","size":1.0},{"source":"148","target":"310","id":"4743","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"5","target":"415","id":"1569","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"181","target":"370","id":"5394","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"100","target":"457","id":"3757","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"252","target":"565","id":"6611","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"256","target":"357","id":"6670","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"73","target":"633","id":"3161","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"61","target":"345","id":"2878","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"85","target":"547","id":"3425","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"375","target":"721","id":"8364","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"373","target":"677","id":"8327","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"258","target":"348","id":"6698","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"501","target":"617","id":"9718","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"136","target":"501","id":"4491","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"316","target":"719","id":"7624","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"349","target":"397","id":"8064","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"418","target":"631","id":"8888","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"245","target":"397","id":"6484","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"14","target":"695","id":"1797","attributes":{"Weight":"1.0"},"color":"rgb(148,148,83)","size":1.0},{"source":"10","target":"309","id":"1694","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"118","target":"670","id":"4128","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"115","target":"537","id":"4058","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"538","target":"688","id":"9999","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"106","target":"370","id":"3866","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"53","target":"688","id":"2688","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"311","target":"408","id":"7541","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"158","target":"568","id":"4951","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"146","target":"182","id":"4704","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"266","target":"665","id":"6840","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"582","target":"631","id":"10251","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"264","target":"734","id":"6816","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"39","target":"634","id":"2373","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"122","target":"385","id":"4195","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"142","target":"469","id":"4616","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"263","target":"444","id":"6785","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"131","target":"528","id":"4383","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"88","target":"610","id":"3504","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"458","target":"477","id":"9338","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"700","target":"718","id":"10663","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"618","target":"716","id":"10409","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"77","target":"307","id":"3245","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"113","target":"420","id":"4013","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"167","target":"711","id":"5129","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"508","target":"562","id":"9770","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"4","target":"590","id":"1549","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"361","target":"445","id":"8194","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"338","target":"350","id":"7925","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"315","target":"598","id":"7603","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"82","target":"454","id":"3355","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"29","target":"680","id":"2142","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"51","target":"568","id":"2638","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"69","target":"438","id":"3067","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"435","target":"631","id":"9103","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"115","target":"706","id":"4065","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"132","target":"214","id":"4400","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"443","target":"571","id":"9200","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"119","target":"617","id":"4147","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"4","target":"199","id":"1538","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"335","target":"713","id":"7894","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"58","target":"416","id":"2801","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"240","target":"603","id":"6408","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"152","target":"248","id":"4831","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"345","target":"606","id":"8019","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"94","target":"417","id":"3628","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"496","target":"566","id":"9670","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"120","target":"499","id":"4164","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"14","target":"200","id":"1779","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"135","target":"279","id":"4455","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"12","target":"642","id":"1749","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"177","target":"572","id":"5317","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"332","target":"571","id":"7846","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"234","target":"366","id":"6316","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"111","target":"569","id":"3978","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"46","target":"422","id":"2529","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"78","target":"380","id":"3268","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"5","target":"232","id":"1561","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"454","target":"678","id":"9305","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"504","target":"693","id":"9741","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"337","target":"420","id":"7915","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"66","target":"599","id":"3010","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"150","target":"591","id":"4795","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"249","target":"452","id":"6549","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"558","target":"660","id":"10102","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"448","target":"617","id":"9245","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"124","target":"132","id":"4228","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"196","target":"369","id":"5657","attributes":{"Weight":"1.0"},"color":"rgb(148,67,229)","size":1.0},{"source":"202","target":"211","id":"5765","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"109","target":"563","id":"3924","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"27","target":"238","id":"2064","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"95","target":"588","id":"3659","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"129","target":"531","id":"4343","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"547","target":"586","id":"10047","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"427","target":"492","id":"8995","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"375","target":"455","id":"8353","attributes":{"Weight":"1.0"},"color":"rgb(116,148,148)","size":1.0},{"source":"3","target":"38","id":"1510","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"180","target":"216","id":"5371","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"224","target":"280","id":"6144","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"247","target":"306","id":"6517","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"182","target":"407","id":"5405","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"393","target":"413","id":"8613","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"524","target":"684","id":"9890","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"330","target":"414","id":"7823","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"190","target":"363","id":"5555","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"197","target":"551","id":"5693","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"221","target":"600","id":"6110","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"349","target":"720","id":"8076","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"328","target":"549","id":"7788","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"239","target":"445","id":"6394","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"470","target":"479","id":"9460","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"34","target":"275","id":"2250","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"150","target":"245","id":"4781","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"217","target":"321","id":"6031","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"528","target":"619","id":"9929","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"226","target":"461","id":"6187","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"185","target":"425","id":"5463","attributes":{"Weight":"1.0"},"color":"rgb(229,132,148)","size":1.0},{"source":"296","target":"619","id":"7334","attributes":{"Weight":"1.0"},"color":"rgb(148,164,148)","size":1.0},{"source":"53","target":"183","id":"2672","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"443","target":"589","id":"9202","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"26","target":"252","id":"2044","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"143","target":"624","id":"4644","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"72","target":"200","id":"3133","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"114","target":"160","id":"4024","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"274","target":"494","id":"6963","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"95","target":"630","id":"3661","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"485","target":"632","id":"9577","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"355","target":"510","id":"8133","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"382","target":"650","id":"8462","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"256","target":"355","id":"6669","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"397","target":"644","id":"8660","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"150","target":"164","id":"4779","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"2","target":"630","id":"1506","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"203","target":"577","id":"5798","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"382","target":"735","id":"8471","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"119","target":"388","id":"4140","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"509","target":"546","id":"9778","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"145","target":"567","id":"4695","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"141","target":"249","id":"4588","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"93","target":"571","id":"3608","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"217","target":"337","id":"6032","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"289","target":"732","id":"7237","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"63","target":"671","id":"2942","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"254","target":"401","id":"6635","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"34","target":"510","id":"2259","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"51","target":"439","id":"2636","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"187","target":"301","id":"5498","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"248","target":"360","id":"6530","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"546","target":"592","id":"10045","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"134","target":"544","id":"4447","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"42","target":"580","id":"2429","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"131","target":"188","id":"4371","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"432","target":"653","id":"9065","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"400","target":"557","id":"8700","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"167","target":"185","id":"5116","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"631","target":"734","id":"10458","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"55","target":"669","id":"2744","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"313","target":"479","id":"7574","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"617","target":"727","id":"10405","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"330","target":"413","id":"7822","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"212","target":"676","id":"5954","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"387","target":"396","id":"8534","attributes":{"Weight":"1.0"},"color":"rgb(132,148,213)","size":1.0},{"source":"147","target":"444","id":"4729","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"117","target":"265","id":"4098","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"48","target":"540","id":"2571","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"489","target":"643","id":"9609","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"338","target":"345","id":"7924","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"30","target":"710","id":"2164","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"528","target":"606","id":"9927","attributes":{"Weight":"1.0"},"color":"rgb(213,115,148)","size":1.0},{"source":"21","target":"24","id":"1934","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"142","target":"539","id":"4619","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"125","target":"291","id":"4252","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"153","target":"219","id":"4847","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"77","target":"148","id":"3242","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"261","target":"366","id":"6756","attributes":{"Weight":"1.0"},"color":"rgb(67,148,229)","size":1.0},{"source":"457","target":"672","id":"9332","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"122","target":"374","id":"4194","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"207","target":"361","id":"5862","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"87","target":"562","id":"3472","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"94","target":"396","id":"3627","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"13","target":"192","id":"1758","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"38","target":"711","id":"2354","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"2","target":"234","id":"1497","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"119","target":"727","id":"4149","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"134","target":"530","id":"4446","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"166","target":"240","id":"5100","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"552","target":"710","id":"10070","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"105","target":"130","id":"3842","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"66","target":"192","id":"2995","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"80","target":"116","id":"3304","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"289","target":"704","id":"7235","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"129","target":"711","id":"4348","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"58","target":"125","id":"2794","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"259","target":"537","id":"6720","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"18","target":"199","id":"1869","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"227","target":"371","id":"6202","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"9","target":"60","id":"1661","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"7","target":"480","id":"1612","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"576","target":"646","id":"10214","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"42","target":"652","id":"2434","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"72","target":"702","id":"3148","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"202","target":"462","id":"5777","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"411","target":"658","id":"8826","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"148","target":"468","id":"4747","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"401","target":"402","id":"8707","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"2","target":"100","id":"1490","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"216","target":"277","id":"6006","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"42","target":"618","id":"2432","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"521","target":"594","id":"9858","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"421","target":"663","id":"8928","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"141","target":"481","id":"4598","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"186","target":"324","id":"5484","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"108","target":"494","id":"3898","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"480","target":"577","id":"9553","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"131","target":"716","id":"4395","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"264","target":"646","id":"6806","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"409","target":"440","id":"8792","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"211","target":"462","id":"5923","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"127","target":"246","id":"4288","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"61","target":"325","id":"2875","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"454","target":"517","id":"9298","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"17","target":"103","id":"1845","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"480","target":"678","id":"9558","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"159","target":"553","id":"4970","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"393","target":"561","id":"8617","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"368","target":"595","id":"8273","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"44","target":"614","id":"2484","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"488","target":"561","id":"9596","attributes":{"Weight":"1.0"},"color":"rgb(148,99,196)","size":1.0},{"source":"189","target":"655","id":"5547","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"136","target":"388","id":"4489","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"195","target":"205","id":"5635","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"199","target":"347","id":"5720","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"395","target":"399","id":"8632","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"62","target":"513","id":"2916","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"578","target":"610","id":"10227","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"177","target":"522","id":"5314","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"420","target":"626","id":"8910","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"221","target":"366","id":"6099","attributes":{"Weight":"1.0"},"color":"rgb(67,148,229)","size":1.0},{"source":"138","target":"628","id":"4529","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"157","target":"521","id":"4936","attributes":{"Weight":"1.0"},"color":"rgb(180,67,229)","size":1.0},{"source":"201","target":"548","id":"5761","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"391","target":"414","id":"8587","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"332","target":"618","id":"7850","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"201","target":"429","id":"5758","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"58","target":"249","id":"2797","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"474","target":"726","id":"9511","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"690","target":"692","id":"10645","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"475","target":"480","id":"9512","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"434","target":"668","id":"9093","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"386","target":"415","id":"8518","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"128","target":"336","id":"4310","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"450","target":"462","id":"9258","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"496","target":"714","id":"9677","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"47","target":"255","id":"2547","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"83","target":"407","id":"3379","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"522","target":"679","id":"9872","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"149","target":"566","id":"4770","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"42","target":"131","id":"2414","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"224","target":"547","id":"6157","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"242","target":"513","id":"6440","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"529","target":"569","id":"9937","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"86","target":"99","id":"3432","attributes":{"Weight":"1.0"},"color":"rgb(148,115,148)","size":1.0},{"source":"2","target":"701","id":"1509","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"2","target":"153","id":"1494","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"596","target":"602","id":"10306","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"112","target":"214","id":"3991","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"102","target":"264","id":"3790","attributes":{"Weight":"1.0"},"color":"rgb(148,83,180)","size":1.0},{"source":"29","target":"298","id":"2127","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"101","target":"230","id":"3770","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"187","target":"535","id":"5504","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"83","target":"533","id":"3382","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"82","target":"498","id":"3358","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"241","target":"453","id":"6417","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"149","target":"659","id":"4773","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"166","target":"677","id":"5112","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"307","target":"515","id":"7493","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"393","target":"731","id":"8619","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"87","target":"288","id":"3458","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"267","target":"446","id":"6853","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"376","target":"676","id":"8374","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"307","target":"620","id":"7496","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"429","target":"643","id":"9025","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"331","target":"567","id":"7837","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"57","target":"381","id":"2773","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"134","target":"265","id":"4437","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"239","target":"484","id":"6396","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"596","target":"665","id":"10309","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"36","target":"570","id":"2300","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"248","target":"501","id":"6534","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"637","target":"684","id":"10484","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"324","target":"499","id":"7725","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"126","target":"375","id":"4276","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"171","target":"579","id":"5203","attributes":{"Weight":"1.0"},"color":"rgb(132,99,229)","size":1.0},{"source":"205","target":"435","id":"5825","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"60","target":"120","id":"2835","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"287","target":"734","id":"7195","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"319","target":"600","id":"7668","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"52","target":"329","id":"2653","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"176","target":"351","id":"5286","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"584","target":"598","id":"10260","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"493","target":"525","id":"9645","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"352","target":"461","id":"8106","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"76","target":"425","id":"3221","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"222","target":"334","id":"6120","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"242","target":"683","id":"6445","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"330","target":"391","id":"7813","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"156","target":"476","id":"4915","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"301","target":"542","id":"7410","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"269","target":"731","id":"6903","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"111","target":"245","id":"3965","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"364","target":"721","id":"8229","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"40","target":"284","id":"2382","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"308","target":"555","id":"7504","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"151","target":"233","id":"4808","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"473","target":"663","id":"9500","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"266","target":"271","id":"6830","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"501","target":"588","id":"9717","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"536","target":"549","id":"9980","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"462","target":"555","id":"9384","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"251","target":"558","id":"6593","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"396","target":"534","id":"8646","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"496","target":"534","id":"9669","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"221","target":"225","id":"6092","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"88","target":"177","id":"3483","attributes":{"Weight":"1.0"},"color":"rgb(115,229,99)","size":1.0},{"source":"31","target":"106","id":"2169","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"166","target":"185","id":"5097","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"138","target":"220","id":"4517","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"314","target":"350","id":"7584","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"565","target":"589","id":"10132","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"534","target":"606","id":"9967","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"187","target":"653","id":"5508","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"279","target":"280","id":"7034","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"134","target":"502","id":"4444","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"273","target":"306","id":"6948","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"281","target":"466","id":"7082","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"4","target":"272","id":"1540","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"464","target":"492","id":"9396","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"674","target":"694","id":"10615","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"56","target":"707","id":"2766","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"197","target":"232","id":"5679","attributes":{"Weight":"1.0"},"color":"rgb(83,148,180)","size":1.0},{"source":"36","target":"40","id":"2285","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"199","target":"503","id":"5724","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"289","target":"376","id":"7221","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"246","target":"553","id":"6505","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"190","target":"232","id":"5551","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"365","target":"502","id":"8235","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"140","target":"455","id":"4569","attributes":{"Weight":"1.0"},"color":"rgb(99,148,180)","size":1.0},{"source":"310","target":"620","id":"7536","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"504","target":"661","id":"9737","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"131","target":"332","id":"4376","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"556","target":"694","id":"10093","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"183","target":"538","id":"5427","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"356","target":"401","id":"8139","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"407","target":"533","id":"8771","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"458","target":"468","id":"9335","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"534","target":"566","id":"9966","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"10","target":"100","id":"1685","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"290","target":"394","id":"7244","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"17","target":"318","id":"1855","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"198","target":"736","id":"5714","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"182","target":"210","id":"5400","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"218","target":"493","id":"6053","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"385","target":"573","id":"8508","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"341","target":"530","id":"7971","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"473","target":"508","id":"9490","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"591","target":"629","id":"10290","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"404","target":"709","id":"8752","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"456","target":"615","id":"9327","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"394","target":"658","id":"8630","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"443","target":"623","id":"9203","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"4","target":"628","id":"1550","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"493","target":"722","id":"9653","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"331","target":"586","id":"7838","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"329","target":"700","id":"7809","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"87","target":"523","id":"3470","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"36","target":"41","id":"2286","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"83","target":"662","id":"3386","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"110","target":"316","id":"3941","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"381","target":"562","id":"8440","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"140","target":"179","id":"4559","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"511","target":"601","id":"9791","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"384","target":"408","id":"8484","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"106","target":"309","id":"3863","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"403","target":"505","id":"8731","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"267","target":"564","id":"6858","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"571","target":"580","id":"10167","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"378","target":"617","id":"8404","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"367","target":"700","id":"8263","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"80","target":"616","id":"3322","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"102","target":"334","id":"3793","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"27","target":"348","id":"2069","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"138","target":"199","id":"4516","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"33","target":"643","id":"2241","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"118","target":"520","id":"4123","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"168","target":"359","id":"5135","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"77","target":"470","id":"3251","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"520","target":"628","id":"9849","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"485","target":"621","id":"9576","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"202","target":"225","id":"5768","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"396","target":"682","id":"8653","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"3","target":"226","id":"1520","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"284","target":"380","id":"7139","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"613","target":"714","id":"10393","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"219","target":"672","id":"6076","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"333","target":"618","id":"7864","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"381","target":"604","id":"8445","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"339","target":"596","id":"7943","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"417","target":"613","id":"8874","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"215","target":"578","id":"5994","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"138","target":"503","id":"4526","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"75","target":"194","id":"3196","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"102","target":"186","id":"3784","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"26","target":"59","id":"2038","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"164","target":"629","id":"5069","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"298","target":"515","id":"7363","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"456","target":"549","id":"9324","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"397","target":"719","id":"8663","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"35","target":"584","id":"2281","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"203","target":"623","id":"5801","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"171","target":"338","id":"5194","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"62","target":"91","id":"2901","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"703","target":"716","id":"10665","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"543","target":"629","id":"10028","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"173","target":"585","id":"5245","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"93","target":"528","id":"3607","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"177","target":"667","id":"5322","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"304","target":"366","id":"7452","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"112","target":"124","id":"3986","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"151","target":"342","id":"4815","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"349","target":"629","id":"8072","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"208","target":"515","id":"5879","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"409","target":"629","id":"8806","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"455","target":"624","id":"9314","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"205","target":"296","id":"5823","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"11","target":"709","id":"1727","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"296","target":"722","id":"7338","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"230","target":"239","id":"6247","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"241","target":"690","id":"6427","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"294","target":"569","id":"7301","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"91","target":"156","id":"3557","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"325","target":"613","id":"7742","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"485","target":"715","id":"9583","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"13","target":"570","id":"1768","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"189","target":"484","id":"5543","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"56","target":"384","id":"2752","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"106","target":"457","id":"3867","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"227","target":"644","id":"6213","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"438","target":"729","id":"9136","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"68","target":"736","id":"3055","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"565","target":"728","id":"10137","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"506","target":"563","id":"9753","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"562","target":"646","id":"10122","attributes":{"Weight":"1.0"},"color":"rgb(148,83,229)","size":1.0},{"source":"317","target":"546","id":"7633","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"160","target":"485","id":"4988","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"21","target":"439","id":"1946","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"33","target":"262","id":"2223","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"146","target":"321","id":"4709","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"425","target":"589","id":"8974","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"30","target":"429","id":"2158","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"650","target":"725","id":"10548","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"393","target":"560","id":"8616","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"199","target":"340","id":"5718","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"294","target":"349","id":"7294","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"454","target":"611","id":"9301","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"278","target":"662","id":"7032","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"660","target":"694","id":"10585","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"112","target":"262","id":"3995","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"35","target":"380","id":"2276","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"99","target":"130","id":"3728","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"20","target":"681","id":"1930","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"24","target":"540","id":"2008","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"9","target":"235","id":"1668","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"8","target":"60","id":"1627","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"183","target":"707","id":"5437","attributes":{"Weight":"1.0"},"color":"rgb(99,229,99)","size":1.0},{"source":"573","target":"679","id":"10193","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"577","target":"721","id":"10223","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"152","target":"588","id":"4842","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"378","target":"563","id":"8402","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"82","target":"475","id":"3356","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"498","target":"577","id":"9692","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"125","target":"565","id":"4264","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"151","target":"436","id":"4818","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"277","target":"333","id":"7006","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"279","target":"331","id":"7037","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"242","target":"406","id":"6437","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"49","target":"658","id":"2601","attributes":{"Weight":"1.0"},"color":"rgb(148,148,115)","size":1.0},{"source":"115","target":"383","id":"4054","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"89","target":"398","id":"3521","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"195","target":"444","id":"5641","attributes":{"Weight":"1.0"},"color":"rgb(99,115,229)","size":1.0},{"source":"252","target":"675","id":"6614","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"44","target":"238","id":"2467","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"275","target":"546","id":"6986","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"82","target":"327","id":"3347","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"46","target":"58","id":"2517","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"69","target":"689","id":"3077","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"342","target":"547","id":"7982","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"71","target":"626","id":"3124","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"262","target":"484","id":"6779","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"46","target":"661","id":"2540","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"16","target":"695","id":"1838","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"299","target":"602","id":"7381","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"459","target":"515","id":"9351","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"228","target":"334","id":"6221","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"60","target":"228","id":"2841","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"429","target":"569","id":"9023","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"338","target":"566","id":"7931","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"33","target":"720","id":"2242","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"393","target":"414","id":"8614","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"141","target":"252","id":"4589","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"215","target":"602","id":"5996","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"75","target":"383","id":"3202","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"214","target":"354","id":"5977","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"77","target":"298","id":"3244","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"127","target":"638","id":"4298","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"100","target":"630","id":"3759","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"30","target":"489","id":"2159","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"325","target":"714","id":"7746","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"7","target":"241","id":"1605","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"114","target":"553","id":"4036","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"388","target":"727","id":"8554","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"440","target":"663","id":"9163","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"70","target":"202","id":"3084","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"521","target":"543","id":"9854","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"321","target":"533","id":"7689","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"147","target":"669","id":"4738","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"104","target":"546","id":"3837","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"349","target":"419","id":"8065","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"89","target":"632","id":"3526","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"688","target":"736","id":"10638","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"431","target":"547","id":"9044","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"372","target":"492","id":"8312","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"40","target":"389","id":"2386","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"118","target":"664","id":"4127","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"71","target":"407","id":"3119","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"123","target":"482","id":"4224","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"267","target":"317","id":"6849","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"546","target":"564","id":"10043","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"435","target":"493","id":"9095","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"356","target":"400","id":"8138","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"430","target":"634","id":"9035","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"134","target":"513","id":"4445","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"7","target":"578","id":"1615","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"310","target":"477","id":"7531","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"172","target":"625","id":"5224","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"22","target":"158","id":"1963","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"14","target":"194","id":"1778","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"375","target":"687","id":"8363","attributes":{"Weight":"1.0"},"color":"rgb(83,229,115)","size":1.0},{"source":"222","target":"228","id":"6115","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"213","target":"530","id":"5966","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"266","target":"364","id":"6832","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"127","target":"257","id":"4289","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"2","target":"672","id":"1508","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"391","target":"394","id":"8580","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"138","target":"520","id":"4527","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"204","target":"637","id":"5816","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"127","target":"726","id":"4304","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"497","target":"538","id":"9680","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"269","target":"559","id":"6899","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"88","target":"261","id":"3489","attributes":{"Weight":"1.0"},"color":"rgb(115,229,148)","size":1.0},{"source":"289","target":"547","id":"7230","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"107","target":"146","id":"3873","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"461","target":"531","id":"9377","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"325","target":"338","id":"7730","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"163","target":"588","id":"5052","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"137","target":"666","id":"4514","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"278","target":"626","id":"7030","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"257","target":"553","id":"6684","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"27","target":"679","id":"2084","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"264","target":"724","id":"6812","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"49","target":"357","id":"2593","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"94","target":"682","id":"3637","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"366","target":"572","id":"8246","attributes":{"Weight":"1.0"},"color":"rgb(148,67,213)","size":1.0},{"source":"107","target":"579","id":"3884","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"253","target":"556","id":"6624","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"141","target":"696","id":"4603","attributes":{"Weight":"1.0"},"color":"rgb(213,148,83)","size":1.0},{"source":"16","target":"24","id":"1824","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"215","target":"638","id":"5998","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"264","target":"729","id":"6814","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"336","target":"343","id":"7896","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"1","target":"218","id":"1470","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"212","target":"462","id":"5944","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"629","target":"644","id":"10450","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"38","target":"168","id":"2335","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"19","target":"449","id":"1903","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"170","target":"356","id":"5175","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"130","target":"534","id":"4364","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"365","target":"544","id":"8238","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"266","target":"578","id":"6835","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"441","target":"465","id":"9167","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"381","target":"409","id":"8428","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"3","target":"121","id":"1512","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"196","target":"652","id":"5675","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"98","target":"176","id":"3705","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"227","target":"720","id":"6216","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"94","target":"613","id":"3634","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"489","target":"552","id":"9606","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"66","target":"402","id":"3004","attributes":{"Weight":"1.0"},"color":"rgb(148,132,164)","size":1.0},{"source":"545","target":"656","id":"10037","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"100","target":"219","id":"3750","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"159","target":"246","id":"4962","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"8","target":"654","id":"1653","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"401","target":"558","id":"8713","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"241","target":"602","id":"6423","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"356","target":"674","id":"8149","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"125","target":"237","id":"4249","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"57","target":"440","id":"2777","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"60","target":"562","id":"2858","attributes":{"Weight":"1.0"},"color":"rgb(229,67,180)","size":1.0},{"source":"45","target":"59","id":"2493","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"328","target":"372","id":"7781","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"72","target":"706","id":"3149","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"74","target":"625","id":"3185","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"53","target":"270","id":"2676","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"173","target":"655","id":"5248","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"159","target":"639","id":"4974","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"54","target":"451","id":"2710","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"336","target":"501","id":"7903","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"103","target":"509","id":"3817","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"142","target":"624","id":"4621","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"277","target":"528","id":"7011","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"96","target":"366","id":"3676","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"187","target":"299","id":"5496","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"392","target":"393","id":"8593","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"521","target":"604","id":"9860","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"444","target":"624","id":"9215","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"137","target":"584","id":"4511","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"308","target":"348","id":"7500","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"319","target":"720","id":"7673","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"33","target":"361","id":"2229","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"121","target":"634","id":"4189","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"169","target":"318","id":"5155","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"133","target":"396","id":"4422","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"331","target":"490","id":"7834","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"86","target":"131","id":"3433","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"90","target":"544","id":"3550","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"172","target":"654","id":"5225","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"204","target":"635","id":"5814","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"107","target":"337","id":"3879","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"473","target":"523","id":"9492","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"132","target":"484","id":"4412","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"285","target":"382","id":"7148","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"94","target":"314","id":"3622","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"160","target":"553","id":"4989","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"203","target":"678","id":"5804","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"219","target":"554","id":"6074","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"226","target":"486","id":"6189","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"310","target":"479","id":"7532","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"104","target":"295","id":"3829","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"60","target":"334","id":"2847","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"69","target":"650","id":"3075","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"295","target":"446","id":"7316","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"241","target":"266","id":"6413","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"466","target":"647","id":"9420","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"640","target":"732","id":"10503","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"169","target":"355","id":"5157","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"175","target":"263","id":"5264","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"179","target":"238","id":"5348","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"263","target":"300","id":"6782","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"63","target":"89","id":"2921","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"265","target":"544","id":"6827","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"93","target":"579","id":"3609","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"478","target":"622","id":"9541","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"111","target":"368","id":"3970","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"350","target":"417","id":"8078","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"215","target":"266","id":"5987","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"247","target":"315","id":"6518","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"171","target":"350","id":"5196","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"367","target":"549","id":"8259","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"82","target":"203","id":"3346","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"49","target":"509","id":"2595","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"57","target":"523","id":"2782","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"32","target":"696","id":"2206","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"271","target":"453","id":"6920","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"253","target":"694","id":"6630","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"69","target":"647","id":"3074","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"3","target":"185","id":"1518","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"388","target":"712","id":"8553","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"190","target":"537","id":"5561","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"481","target":"482","id":"9560","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"146","target":"286","id":"4708","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"334","target":"710","id":"7880","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"143","target":"542","id":"4643","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"387","target":"633","id":"8541","attributes":{"Weight":"1.0"},"color":"rgb(99,229,132)","size":1.0},{"source":"17","target":"581","id":"1863","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"290","target":"392","id":"7242","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"180","target":"333","id":"5375","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"16","target":"158","id":"1828","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"99","target":"369","id":"3737","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"61","target":"714","id":"2898","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"384","target":"431","id":"8485","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"149","target":"325","id":"4761","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"378","target":"448","id":"8396","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"408","target":"612","id":"8781","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"128","target":"501","id":"4316","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"539","target":"653","id":"10004","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"149","target":"714","id":"4776","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"284","target":"389","id":"7140","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"427","target":"549","id":"8997","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"57","target":"521","id":"2781","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"461","target":"661","id":"9381","attributes":{"Weight":"1.0"},"color":"rgb(196,213,67)","size":1.0},{"source":"419","target":"462","id":"8895","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"261","target":"693","id":"6771","attributes":{"Weight":"1.0"},"color":"rgb(115,229,148)","size":1.0},{"source":"392","target":"559","id":"8602","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"694","target":"696","id":"10656","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"24","target":"158","id":"2002","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"526","target":"652","id":"9907","attributes":{"Weight":"1.0"},"color":"rgb(148,164,148)","size":1.0},{"source":"31","target":"369","id":"2178","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"578","target":"665","id":"10230","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"139","target":"583","id":"4549","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"146","target":"662","id":"4719","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"480","target":"687","id":"9559","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"12","target":"608","id":"1748","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"193","target":"646","id":"5607","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"63","target":"161","id":"2927","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"244","target":"325","id":"6460","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"30","target":"120","id":"2146","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"190","target":"342","id":"5554","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"448","target":"588","id":"9244","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"28","target":"643","id":"2119","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"315","target":"666","id":"7605","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"524","target":"736","id":"9893","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"102","target":"201","id":"3785","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"60","target":"353","id":"2848","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"122","target":"480","id":"4200","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"298","target":"310","id":"7354","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"39","target":"430","id":"2367","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"334","target":"548","id":"7877","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"428","target":"593","id":"9009","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"112","target":"239","id":"3994","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"250","target":"400","id":"6564","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"252","target":"483","id":"6610","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"381","target":"432","id":"8431","attributes":{"Weight":"1.0"},"color":"rgb(180,67,229)","size":1.0},{"source":"129","target":"486","id":"4342","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"149","target":"314","id":"4760","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"77","target":"458","id":"3248","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"243","target":"292","id":"6447","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"21","target":"74","id":"1938","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"364","target":"661","id":"8223","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"177","target":"527","id":"5315","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"199","target":"437","id":"5723","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"229","target":"592","id":"6246","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"301","target":"432","id":"7403","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"166","target":"191","id":"5098","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"84","target":"627","id":"3403","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"255","target":"400","id":"6649","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"284","target":"599","id":"7146","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"663","target":"728","id":"10594","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"167","target":"240","id":"5119","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"392","target":"658","id":"8605","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"70","target":"642","id":"3103","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"33","target":"419","id":"2232","attributes":{"Weight":"1.0"},"color":"rgb(148,180,148)","size":1.0},{"source":"119","target":"136","id":"4131","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"156","target":"513","id":"4917","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"495","target":"598","id":"9665","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"44","target":"577","id":"2481","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"261","target":"422","id":"6758","attributes":{"Weight":"1.0"},"color":"rgb(132,229,148)","size":1.0},{"source":"21","target":"158","id":"1939","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"15","target":"582","id":"1815","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"622","target":"676","id":"10424","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"383","target":"537","id":"8475","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"142","target":"514","id":"4617","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"632","target":"657","id":"10461","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"143","target":"147","id":"4626","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"265","target":"406","id":"6822","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"195","target":"585","id":"5648","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"274","target":"655","id":"6971","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"284","target":"570","id":"7143","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"386","target":"612","id":"8524","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"651","target":"734","id":"10558","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"113","target":"321","id":"4010","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"270","target":"736","id":"6917","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"253","target":"545","id":"6623","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"246","target":"621","id":"6506","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"95","target":"128","id":"3641","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"513","target":"544","id":"9798","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"118","target":"347","id":"4118","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"389","target":"598","id":"8559","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"107","target":"626","id":"3885","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"504","target":"690","id":"9739","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"373","target":"719","id":"8329","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"171","target":"325","id":"5193","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"429","target":"720","id":"9027","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"28","target":"429","id":"2110","attributes":{"Weight":"1.0"},"color":"rgb(148,99,180)","size":1.0},{"source":"37","target":"217","id":"2313","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"24","target":"174","id":"2003","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"54","target":"225","id":"2698","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"358","target":"642","id":"8168","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"381","target":"440","id":"8432","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"305","target":"429","id":"7467","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"247","target":"284","id":"6516","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"455","target":"721","id":"9320","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"298","target":"477","id":"7361","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"90","target":"549","id":"3551","attributes":{"Weight":"1.0"},"color":"rgb(100,148,148)","size":1.0},{"source":"28","target":"182","id":"2097","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"57","target":"271","id":"2771","attributes":{"Weight":"1.0"},"color":"rgb(196,148,148)","size":1.0},{"source":"67","target":"538","id":"3024","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"197","target":"427","id":"5687","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"245","target":"368","id":"6481","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"245","target":"569","id":"6489","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"494","target":"631","id":"9660","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"391","target":"395","id":"8581","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"425","target":"594","id":"8975","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"293","target":"704","id":"7289","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"120","target":"548","id":"4165","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"68","target":"198","id":"3036","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"27","target":"144","id":"2061","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"1","target":"274","id":"1471","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"621","target":"632","id":"10415","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"69","target":"382","id":"3064","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"341","target":"513","id":"7970","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"508","target":"728","id":"9776","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"408","target":"654","id":"8783","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"441","target":"651","id":"9173","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"438","target":"650","id":"9130","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"382","target":"465","id":"8454","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"318","target":"581","id":"7649","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"4","target":"670","id":"1552","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"204","target":"697","id":"5819","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"428","target":"716","id":"9016","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"577","target":"614","id":"10218","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"319","target":"487","id":"7663","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"179","target":"522","id":"5355","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"369","target":"526","id":"8279","attributes":{"Weight":"1.0"},"color":"rgb(67,115,229)","size":1.0},{"source":"128","target":"712","id":"4323","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"111","target":"150","id":"3960","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"575","target":"612","id":"10205","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"59","target":"141","id":"2817","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"494","target":"525","id":"9655","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"257","target":"398","id":"6680","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"478","target":"481","id":"9538","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"67","target":"633","id":"3025","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"322","target":"632","id":"7700","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"571","target":"644","id":"10174","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"366","target":"422","id":"8243","attributes":{"Weight":"1.0"},"color":"rgb(132,148,148)","size":1.0},{"source":"426","target":"492","id":"8985","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"107","target":"182","id":"3874","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"392","target":"413","id":"8600","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"642","target":"707","id":"10512","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"381","target":"565","id":"8441","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"331","target":"443","id":"7833","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"114","target":"161","id":"4025","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"522","target":"677","id":"9871","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"313","target":"620","id":"7578","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"281","target":"729","id":"7092","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"84","target":"579","id":"3401","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"70","target":"287","id":"3091","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"2","target":"309","id":"1499","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"491","target":"647","id":"9625","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"655","target":"722","id":"10572","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"268","target":"392","id":"6868","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"57","target":"508","id":"2780","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"142","target":"535","id":"4618","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"275","target":"317","id":"6976","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"10","target":"96","id":"1683","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"222","target":"353","id":"6121","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"222","target":"595","id":"6128","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"223","target":"239","id":"6131","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"518","target":"656","id":"9837","attributes":{"Weight":"1.0"},"color":"rgb(229,83,83)","size":1.0},{"source":"324","target":"368","id":"7722","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"91","target":"406","id":"3565","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"371","target":"576","id":"8298","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"126","target":"213","id":"4270","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"285","target":"725","id":"7160","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"37","target":"113","id":"2309","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"187","target":"300","id":"5497","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"115","target":"691","id":"4063","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"519","target":"655","id":"9846","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"20","target":"213","id":"1917","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"149","target":"673","id":"4774","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"237","target":"711","id":"6367","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"314","target":"417","id":"7586","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"368","target":"489","id":"8267","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"55","target":"299","id":"2730","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"21","target":"532","id":"1947","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"367","target":"427","id":"8254","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"149","target":"613","id":"4772","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"431","target":"443","id":"9041","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"246","target":"516","id":"6504","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"179","target":"685","id":"5367","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"172","target":"612","id":"5222","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"70","target":"225","id":"3089","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"409","target":"521","id":"8797","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"350","target":"507","id":"8080","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"151","target":"289","id":"4812","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"399","target":"560","id":"8689","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"196","target":"565","id":"5671","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"290","target":"689","id":"7256","attributes":{"Weight":"1.0"},"color":"rgb(148,83,196)","size":1.0},{"source":"396","target":"496","id":"8644","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"374","target":"573","id":"8341","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"94","target":"133","id":"3618","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"46","target":"125","id":"2521","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"5","target":"139","id":"1557","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"245","target":"294","id":"6477","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"481","target":"534","id":"9562","attributes":{"Weight":"1.0"},"color":"rgb(197,148,148)","size":1.0},{"source":"473","target":"562","id":"9495","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"28","target":"662","id":"2120","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"162","target":"301","id":"5021","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"440","target":"521","id":"9153","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"197","target":"254","id":"5680","attributes":{"Weight":"1.0"},"color":"rgb(164,67,164)","size":1.0},{"source":"469","target":"535","id":"9447","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"621","target":"639","id":"10417","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"496","target":"630","id":"9673","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"143","target":"469","id":"4639","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"551","target":"718","id":"10068","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"297","target":"322","id":"7339","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"378","target":"506","id":"8399","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"136","target":"617","id":"4496","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"108","target":"525","id":"3900","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"141","target":"447","id":"4594","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"489","target":"720","id":"9611","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"370","target":"672","id":"8289","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"16","target":"22","id":"1822","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"59","target":"711","id":"2832","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"60","target":"460","id":"2852","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"281","target":"725","id":"7091","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"282","target":"730","id":"7113","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"689","target":"729","id":"10641","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"206","target":"588","id":"5849","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"44","target":"442","id":"2473","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"56","target":"74","id":"2746","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"129","target":"463","id":"4341","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"228","target":"548","id":"6227","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"223","target":"484","id":"6140","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"535","target":"624","id":"9976","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"210","target":"626","id":"5908","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"165","target":"634","id":"5092","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"382","target":"534","id":"8459","attributes":{"Weight":"1.0"},"color":"rgb(132,83,229)","size":1.0},{"source":"642","target":"726","id":"10513","attributes":{"Weight":"1.0"},"color":"rgb(115,148,229)","size":1.0},{"source":"69","target":"441","id":"3068","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"324","target":"710","id":"7729","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"157","target":"432","id":"4929","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"142","target":"301","id":"4612","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"55","target":"455","id":"2736","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"51","target":"640","id":"2639","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"604","target":"663","id":"10346","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"602","target":"692","id":"10337","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"148","target":"459","id":"4746","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"76","target":"629","id":"3237","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"269","target":"377","id":"6886","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"40","target":"495","id":"2388","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"611","target":"678","id":"10379","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"154","target":"569","id":"4875","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"486","target":"618","id":"9587","attributes":{"Weight":"1.0"},"color":"rgb(229,180,67)","size":1.0},{"source":"491","target":"650","id":"9626","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"216","target":"571","id":"6017","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"510","target":"581","id":"9784","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"194","target":"691","id":"5632","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"121","target":"352","id":"4181","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"60","target":"305","id":"2844","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"39","target":"607","id":"2372","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"37","target":"83","id":"2306","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"202","target":"618","id":"5783","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"53","target":"302","id":"2677","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"79","target":"577","id":"3296","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"154","target":"294","id":"4865","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"55","target":"539","id":"2740","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"54","target":"432","id":"2707","attributes":{"Weight":"1.0"},"color":"rgb(99,148,229)","size":1.0},{"source":"411","target":"560","id":"8824","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"406","target":"683","id":"8768","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"399","target":"413","id":"8685","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"171","target":"566","id":"5202","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"176","target":"329","id":"5285","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"337","target":"662","id":"7922","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"145","target":"151","id":"4674","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"32","target":"556","id":"2199","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"7","target":"693","id":"1623","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"536","target":"551","id":"9981","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"38","target":"185","id":"2336","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"220","target":"503","id":"6085","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"621","target":"715","id":"10421","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"281","target":"735","id":"7095","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"191","target":"352","id":"5572","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"70","target":"451","id":"3097","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"391","target":"560","id":"8589","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"264","target":"285","id":"6799","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"616","target":"713","id":"10402","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"248","target":"336","id":"6528","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"22","target":"292","id":"1966","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"283","target":"411","id":"7127","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"190","target":"702","id":"5567","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"472","target":"473","id":"9476","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"127","target":"485","id":"4294","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"189","target":"262","id":"5534","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"232","target":"668","id":"6293","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"112","target":"320","id":"3996","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"36","target":"78","id":"2288","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"93","target":"703","id":"3616","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"126","target":"406","id":"4277","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"86","target":"277","id":"3437","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"278","target":"627","id":"7031","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"164","target":"719","id":"5074","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"135","target":"436","id":"4467","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"54","target":"450","id":"2709","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"48","target":"732","id":"2578","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"280","target":"436","id":"7061","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"339","target":"692","id":"7949","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"538","target":"635","id":"9995","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"145","target":"676","id":"4698","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"650","target":"729","id":"10549","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"633","target":"637","id":"10467","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"347","target":"590","id":"8042","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"133","target":"338","id":"4419","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"258","target":"702","id":"6711","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"124","target":"189","id":"4229","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"436","target":"567","id":"9111","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"15","target":"418","id":"1808","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"330","target":"411","id":"7820","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"251","target":"557","id":"6592","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"63","target":"553","id":"2936","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"306","target":"495","id":"7478","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"54","target":"221","id":"2697","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"95","target":"119","id":"3640","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"50","target":"489","id":"2621","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"391","target":"731","id":"8592","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"125","target":"622","id":"4265","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"389","target":"584","id":"8558","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"339","target":"661","id":"7946","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"121","target":"531","id":"4187","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"9","target":"324","id":"1671","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"173","target":"722","id":"5249","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"388","target":"501","id":"8547","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"302","target":"312","id":"7417","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"377","target":"393","id":"8380","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"163","target":"563","id":"5051","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"654","target":"668","id":"10566","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"527","target":"654","id":"9915","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"449","target":"675","id":"9254","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"212","target":"419","id":"5938","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"59","target":"249","id":"2819","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"298","target":"468","id":"7358","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"617","target":"680","id":"10403","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"429","target":"489","id":"9018","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"336","target":"617","id":"7908","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"224","target":"233","id":"6142","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"93","target":"619","id":"3614","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"431","target":"676","id":"9048","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"227","target":"342","id":"6200","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"279","target":"529","id":"7045","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"364","target":"453","id":"8217","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"265","target":"683","id":"6829","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"267","target":"510","id":"6856","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"529","target":"547","id":"9935","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"88","target":"366","id":"3495","attributes":{"Weight":"1.0"},"color":"rgb(115,148,148)","size":1.0},{"source":"525","target":"526","id":"9894","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"126","target":"326","id":"4273","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"286","target":"571","id":"7171","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"213","target":"683","id":"5970","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"303","target":"603","id":"7444","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"179","target":"612","id":"5360","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"37","target":"84","id":"2307","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"68","target":"637","id":"3050","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"25","target":"733","id":"2034","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"422","target":"481","id":"8935","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"123","target":"416","id":"4217","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"96","target":"153","id":"3669","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"14","target":"342","id":"1783","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"263","target":"542","id":"6791","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"354","target":"361","id":"8124","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"131","target":"644","id":"4392","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"125","target":"482","id":"4262","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"638","target":"723","id":"10493","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"97","target":"605","id":"3701","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"316","target":"349","id":"7607","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"356","target":"557","id":"8145","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"54","target":"212","id":"2695","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"442","target":"648","id":"9192","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"90","target":"156","id":"3537","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"46","target":"237","id":"2523","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"365","target":"681","id":"8239","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"661","target":"723","id":"10592","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"27","target":"616","id":"2081","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"62","target":"213","id":"2906","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"8","target":"408","id":"1641","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"207","target":"239","id":"5857","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"54","target":"555","id":"2713","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"58","target":"141","id":"2795","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"29","target":"458","id":"2131","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"183","target":"697","id":"5436","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"427","target":"551","id":"8998","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"92","target":"492","id":"3587","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"466","target":"730","id":"9427","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"329","target":"343","id":"7794","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"139","target":"576","id":"4548","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"105","target":"370","id":"3851","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"173","target":"205","id":"5233","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"643","target":"720","id":"10516","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"381","target":"728","id":"8450","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"253","target":"674","id":"6629","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"314","target":"345","id":"7583","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"327","target":"374","id":"7758","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"104","target":"318","id":"3831","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"42","target":"619","id":"2433","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"379","target":"403","id":"8409","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"78","target":"247","id":"3263","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"142","target":"175","id":"4607","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"76","target":"472","id":"3224","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"358","target":"450","id":"8161","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"341","target":"502","id":"7969","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"33","target":"445","id":"2234","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"387","target":"437","id":"8536","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"216","target":"623","id":"6024","attributes":{"Weight":"1.0"},"color":"rgb(148,196,115)","size":1.0},{"source":"226","target":"634","id":"6192","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"96","target":"672","id":"3682","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"90","target":"681","id":"3552","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"77","target":"541","id":"3257","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"154","target":"726","id":"4885","attributes":{"Weight":"1.0"},"color":"rgb(196,67,213)","size":1.0},{"source":"127","target":"322","id":"4291","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"90","target":"134","id":"3536","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"314","target":"534","id":"7589","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"228","target":"353","id":"6222","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"453","target":"602","id":"9285","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"397","target":"629","id":"8658","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"186","target":"353","id":"5486","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"144","target":"434","id":"4661","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"229","target":"581","id":"6245","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"614","target":"678","id":"10396","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"305","target":"499","id":"7469","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"124","target":"362","id":"4242","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"651","target":"724","id":"10554","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"172","target":"384","id":"5214","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"431","target":"699","id":"9049","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"96","target":"369","id":"3677","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"111","target":"529","id":"3977","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"166","target":"531","id":"5109","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"208","target":"680","id":"5883","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"443","target":"717","id":"9207","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"359","target":"373","id":"8170","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"160","target":"257","id":"4982","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"53","target":"637","id":"2686","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"369","target":"554","id":"8280","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"81","target":"310","id":"3329","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"387","target":"404","id":"8535","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"73","target":"635","id":"3162","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"43","target":"138","id":"2439","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"47","target":"400","id":"2550","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"191","target":"486","id":"5577","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"57","target":"615","id":"2789","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"104","target":"267","id":"3826","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"153","target":"309","id":"4850","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"95","target":"206","id":"3645","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"227","target":"591","id":"6209","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"68","target":"636","id":"3049","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"6","target":"307","id":"1586","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"139","target":"258","id":"4537","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"43","target":"404","id":"2447","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"489","target":"569","id":"9607","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"48","target":"640","id":"2573","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"291","target":"449","id":"7262","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"96","target":"630","id":"3681","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"428","target":"532","id":"9005","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"135","target":"419","id":"4464","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"87","target":"449","id":"3464","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"55","target":"469","id":"2737","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"25","target":"120","id":"2019","attributes":{"Weight":"1.0"},"color":"rgb(229,67,99)","size":1.0},{"source":"341","target":"681","id":"7973","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"275","target":"352","id":"6978","attributes":{"Weight":"1.0"},"color":"rgb(148,213,67)","size":1.0},{"source":"10","target":"99","id":"1684","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"371","target":"528","id":"8294","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"239","target":"344","id":"6389","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"85","target":"135","id":"3407","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"338","target":"673","id":"7935","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"192","target":"284","id":"5584","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"525","target":"655","id":"9901","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"8","target":"685","id":"1657","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"116","target":"616","id":"4089","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"39","target":"461","id":"2368","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"166","target":"685","id":"5113","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"288","target":"508","id":"7204","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"133","target":"171","id":"4415","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"295","target":"564","id":"7320","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"9","target":"228","id":"1667","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"430","target":"668","id":"9037","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"250","target":"482","id":"6569","attributes":{"Weight":"1.0"},"color":"rgb(213,148,83)","size":1.0},{"source":"77","target":"680","id":"3259","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"76","target":"562","id":"3231","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"252","target":"452","id":"6605","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"289","target":"431","id":"7223","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"356","target":"556","id":"8144","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"18","target":"138","id":"1868","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"178","target":"372","id":"5333","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"272","target":"404","id":"6938","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"391","target":"561","id":"8590","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"473","target":"521","id":"9491","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"301","target":"514","id":"7407","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"28","target":"489","id":"2112","attributes":{"Weight":"1.0"},"color":"rgb(148,99,180)","size":1.0},{"source":"52","target":"56","id":"2646","attributes":{"Weight":"1.0"},"color":"rgb(83,148,180)","size":1.0},{"source":"243","target":"695","id":"6454","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"599","target":"666","id":"10321","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"410","target":"696","id":"8819","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"135","target":"368","id":"4462","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"45","target":"565","id":"2513","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"206","target":"712","id":"5851","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"15","target":"494","id":"1811","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"179","target":"386","id":"5352","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"74","target":"704","id":"3191","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"54","target":"419","id":"2705","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"428","target":"601","id":"9010","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"121","target":"607","id":"4188","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"241","target":"364","id":"6416","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"5","target":"668","id":"1578","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"231","target":"258","id":"6260","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"286","target":"528","id":"7170","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"292","target":"704","id":"7279","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"169","target":"546","id":"5164","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"49","target":"581","id":"2599","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"176","target":"609","id":"5297","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"271","target":"690","id":"6929","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"211","target":"358","id":"5918","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"314","target":"325","id":"7581","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"317","target":"564","id":"7634","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"103","target":"229","id":"3806","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"423","target":"557","id":"8944","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"418","target":"519","id":"8882","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"35","target":"598","id":"2282","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"271","target":"610","id":"6925","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"221","target":"287","id":"6096","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"440","target":"508","id":"9152","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"74","target":"679","id":"3189","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"158","target":"174","id":"4945","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"45","target":"675","id":"2516","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"45","target":"622","id":"2514","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"76","target":"523","id":"3229","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"375","target":"406","id":"8350","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"68","target":"574","id":"3046","attributes":{"Weight":"1.0"},"color":"rgb(99,229,83)","size":1.0},{"source":"519","target":"585","id":"9843","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"562","target":"594","id":"10119","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"79","target":"316","id":"3282","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"76","target":"409","id":"3219","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"364","target":"692","id":"8227","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"444","target":"669","id":"9217","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"36","target":"380","id":"2296","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"64","target":"101","id":"2946","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"201","target":"324","id":"5754","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"121","target":"276","id":"4180","attributes":{"Weight":"1.0"},"color":"rgb(148,213,67)","size":1.0},{"source":"527","target":"707","id":"9920","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"182","target":"705","id":"5413","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"283","target":"394","id":"7123","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"28","target":"488","id":"2111","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"447","target":"675","id":"9237","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"24","target":"695","id":"2012","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"281","target":"491","id":"7083","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"511","target":"528","id":"9786","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"550","target":"617","id":"10062","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"562","target":"728","id":"10125","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"73","target":"637","id":"3164","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"274","target":"605","id":"6969","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"508","target":"565","id":"9771","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"79","target":"145","id":"3280","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"223","target":"362","id":"6137","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"311","target":"685","id":"7554","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"50","target":"227","id":"2609","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"556","target":"674","id":"10092","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"23","target":"48","id":"1980","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"446","target":"564","id":"9228","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"189","target":"354","id":"5538","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"391","target":"393","id":"8579","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"493","target":"655","id":"9652","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"174","target":"708","id":"5260","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"246","target":"726","id":"6514","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"337","target":"387","id":"7912","attributes":{"Weight":"1.0"},"color":"rgb(67,180,213)","size":1.0},{"source":"297","target":"553","id":"7343","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"571","target":"589","id":"10168","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"63","target":"638","id":"2939","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"304","target":"457","id":"7455","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"177","target":"677","id":"5323","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"286","target":"511","id":"7169","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"94","target":"338","id":"3624","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"357","target":"592","id":"8158","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"256","target":"581","id":"6676","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"633","target":"697","id":"10470","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"92","target":"328","id":"3578","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"4","target":"340","id":"1541","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"22","target":"708","id":"1975","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"612","target":"625","id":"10382","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"208","target":"307","id":"5869","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"42","target":"601","id":"2431","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"26","target":"45","id":"2035","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"453","target":"721","id":"9292","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"439","target":"733","id":"9149","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"432","target":"539","id":"9058","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"58","target":"277","id":"2799","attributes":{"Weight":"1.0"},"color":"rgb(213,196,67)","size":1.0},{"source":"175","target":"301","id":"5267","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"493","target":"582","id":"9647","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"336","target":"378","id":"7899","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"99","target":"234","id":"3732","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"46","target":"416","id":"2528","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"33","target":"112","id":"2211","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"633","target":"736","id":"10471","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"120","target":"305","id":"4157","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"47","target":"558","id":"2558","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"355","target":"546","id":"8134","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"146","target":"579","id":"4716","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"21","target":"568","id":"1949","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"304","target":"667","id":"7460","attributes":{"Weight":"1.0"},"color":"rgb(67,148,180)","size":1.0},{"source":"637","target":"688","id":"10485","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"395","target":"560","id":"8639","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"115","target":"505","id":"4057","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"8","target":"150","id":"1632","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"13","target":"284","id":"1761","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"193","target":"382","id":"5600","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"196","target":"526","id":"5668","attributes":{"Weight":"1.0"},"color":"rgb(148,115,229)","size":1.0},{"source":"503","target":"590","id":"9728","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"202","target":"319","id":"5771","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"23","target":"243","id":"1984","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"56","target":"311","id":"2751","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"33","target":"135","id":"2214","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"25","target":"708","id":"2032","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"178","target":"456","id":"5336","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"34","target":"355","id":"2255","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"567","target":"699","id":"10146","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"165","target":"285","id":"5083","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"45","target":"141","id":"2497","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"516","target":"688","id":"9820","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"532","target":"679","id":"9956","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"101","target":"354","id":"3775","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"357","target":"546","id":"8155","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"336","target":"588","id":"7907","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"323","target":"331","id":"7707","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"192","target":"584","id":"5592","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"319","target":"451","id":"7661","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"270","target":"497","id":"6906","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"59","target":"482","id":"2829","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"126","target":"156","id":"4269","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"143","target":"175","id":"4628","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"370","target":"457","id":"8286","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"219","target":"370","id":"6072","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"200","target":"587","id":"5742","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"343","target":"448","id":"7996","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"341","target":"683","id":"7974","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"172","target":"667","id":"5226","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"25","target":"568","id":"2027","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"435","target":"525","id":"9098","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"632","target":"715","id":"10463","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"155","target":"720","id":"4906","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"213","target":"341","id":"5959","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"260","target":"661","id":"6745","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"619","target":"716","id":"10412","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"151","target":"699","id":"4827","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"57","target":"473","id":"2779","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"231","target":"713","id":"6277","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"689","target":"735","id":"10644","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"352","target":"369","id":"8104","attributes":{"Weight":"1.0"},"color":"rgb(148,132,148)","size":1.0},{"source":"376","target":"431","id":"8365","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"102","target":"499","id":"3798","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"111","target":"373","id":"3972","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"80","target":"583","id":"3320","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"441","target":"730","id":"9178","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"37","target":"146","id":"2310","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"125","target":"449","id":"4257","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"206","target":"506","id":"5846","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"280","target":"631","id":"7071","attributes":{"Weight":"1.0"},"color":"rgb(148,115,213)","size":1.0},{"source":"682","target":"714","id":"10631","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"63","target":"114","id":"2923","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"49","target":"229","id":"2584","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"33","target":"354","id":"2228","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"42","target":"86","id":"2412","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"113","target":"217","id":"4008","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"474","target":"621","id":"9504","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"240","target":"491","id":"6405","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"291","target":"447","id":"7261","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"170","target":"402","id":"5178","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"258","target":"415","id":"6700","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"31","target":"672","id":"2183","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"71","target":"84","id":"3106","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"125","target":"252","id":"4251","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"293","target":"540","id":"7284","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"540","target":"640","id":"10008","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"121","target":"711","id":"4190","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"243","target":"540","id":"6450","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"228","target":"429","id":"6224","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"140","target":"145","id":"4556","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"294","target":"443","id":"7300","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"66","target":"284","id":"2999","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"150","target":"719","id":"4802","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"406","target":"681","id":"8767","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"317","target":"510","id":"7632","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"281","target":"724","id":"7090","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"421","target":"682","id":"8929","attributes":{"Weight":"1.0"},"color":"rgb(213,67,229)","size":1.0},{"source":"158","target":"292","id":"4947","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"259","target":"649","id":"6725","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"653","target":"669","id":"10563","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"535","target":"539","id":"9974","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"432","target":"644","id":"9064","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"692","target":"721","id":"10652","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"522","target":"625","id":"9868","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"375","target":"544","id":"8358","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"306","target":"584","id":"7480","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"528","target":"601","id":"9926","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"627","target":"662","id":"10443","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"173","target":"435","id":"5238","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"139","target":"440","id":"4546","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"559","target":"561","id":"10107","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"330","target":"394","id":"7816","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"207","target":"223","id":"5855","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"511","target":"571","id":"9788","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"558","target":"694","id":"10104","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"216","target":"432","id":"6013","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"15","target":"435","id":"1809","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"50","target":"294","id":"2611","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"224","target":"555","id":"6158","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"78","target":"192","id":"3262","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"5","target":"144","id":"1558","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"126","target":"681","id":"4283","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"270","target":"697","id":"6916","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"87","target":"565","id":"3473","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"256","target":"295","id":"6666","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"166","target":"352","id":"5101","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"201","target":"368","id":"5757","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"594","target":"604","id":"10302","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"148","target":"470","id":"4748","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"145","target":"323","id":"4681","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"256","target":"318","id":"6668","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"410","target":"694","id":"8818","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"216","target":"294","id":"6008","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"163","target":"360","id":"5044","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"332","target":"511","id":"7844","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"625","target":"685","id":"10438","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"311","target":"522","id":"7543","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"132","target":"230","id":"4402","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"151","target":"529","id":"4821","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"173","target":"519","id":"5241","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"554","target":"672","id":"10080","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"5","target":"713","id":"1579","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"16","target":"568","id":"1835","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"265","target":"530","id":"6826","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"613","target":"682","id":"10392","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"28","target":"569","id":"2115","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"2","target":"366","id":"1501","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"62","target":"502","id":"2915","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"19","target":"55","id":"1889","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"189","target":"239","id":"5533","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"164","target":"245","id":"5058","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"316","target":"577","id":"7617","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"225","target":"319","id":"6169","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"112","target":"354","id":"3998","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"614","target":"623","id":"10394","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"448","target":"727","id":"9247","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"126","target":"544","id":"4282","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"59","target":"481","id":"2828","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"162","target":"299","id":"5020","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"90","target":"406","id":"3545","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"398","target":"715","id":"8680","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"621","target":"706","id":"10420","attributes":{"Weight":"1.0"},"color":"rgb(115,148,164)","size":1.0},{"source":"337","target":"705","id":"7923","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"188","target":"703","id":"5526","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"277","target":"652","id":"7020","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"19","target":"141","id":"1894","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"338","target":"606","id":"7932","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"132","target":"362","id":"4409","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"587","target":"702","id":"10274","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"110","target":"547","id":"3947","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"97","target":"525","id":"3697","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"554","target":"630","id":"10079","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"432","target":"669","id":"9066","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"393","target":"559","id":"8615","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"82","target":"396","id":"3352","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"46","target":"59","id":"2518","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"43","target":"346","id":"2444","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"529","target":"643","id":"9939","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"385","target":"517","id":"8506","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"21","target":"292","id":"1943","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"568","target":"708","id":"10152","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"442","target":"721","id":"9195","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"1","target":"526","id":"1479","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"19","target":"478","id":"1905","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"345","target":"715","id":"8025","attributes":{"Weight":"1.0"},"color":"rgb(180,67,229)","size":1.0},{"source":"287","target":"608","id":"7191","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"293","target":"732","id":"7291","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"21","target":"640","id":"1950","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"492","target":"615","id":"9640","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"398","target":"621","id":"8671","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"27","target":"498","id":"2074","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"455","target":"669","id":"9316","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"342","target":"383","id":"7977","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"600","target":"642","id":"10324","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"504","target":"665","id":"9738","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"332","target":"601","id":"7849","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"58","target":"622","id":"2812","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"141","target":"675","id":"4602","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"134","target":"326","id":"4438","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"32","target":"558","id":"2201","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"290","target":"561","id":"7254","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"94","target":"566","id":"3632","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"93","target":"428","id":"3605","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"465","target":"735","id":"9417","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"528","target":"576","id":"9923","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"89","target":"485","id":"3523","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"10","target":"672","id":"1702","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"148","target":"208","id":"4740","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"237","target":"675","id":"6366","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"406","target":"530","id":"8765","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"71","target":"420","id":"3120","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"222","target":"235","id":"6116","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"282","target":"491","id":"7103","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"19","target":"26","id":"1886","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"140","target":"721","id":"4585","attributes":{"Weight":"1.0"},"color":"rgb(115,229,99)","size":1.0},{"source":"147","target":"698","id":"4739","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"61","target":"375","id":"2880","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"170","target":"401","id":"5177","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"74","target":"667","id":"3187","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"58","target":"237","id":"2796","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"143","target":"309","id":"4634","attributes":{"Weight":"1.0"},"color":"rgb(99,67,229)","size":1.0},{"source":"391","target":"411","id":"8584","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"14","target":"706","id":"1799","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"274","target":"418","id":"6960","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"173","target":"274","id":"5235","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"130","target":"503","id":"4363","attributes":{"Weight":"1.0"},"color":"rgb(67,148,213)","size":1.0},{"source":"26","target":"558","id":"2054","attributes":{"Weight":"1.0"},"color":"rgb(213,148,83)","size":1.0},{"source":"310","target":"459","id":"7527","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"614","target":"648","id":"10395","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"59","target":"452","id":"2826","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"142","target":"299","id":"4610","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"308","target":"713","id":"7513","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"13","target":"273","id":"1760","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"162","target":"504","id":"5027","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"308","target":"616","id":"7509","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"71","target":"533","id":"3122","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"8","target":"116","id":"1629","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"314","target":"566","id":"7590","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"170","target":"254","id":"5173","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"212","target":"221","id":"5932","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"665","target":"692","id":"10598","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"76","target":"303","id":"3217","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"37","target":"71","id":"2305","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"580","target":"618","id":"10243","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"118","target":"709","id":"4129","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"292","target":"732","id":"7281","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"251","target":"660","id":"6595","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"390","target":"561","id":"8575","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"611","target":"623","id":"10376","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"79","target":"611","id":"3297","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"156","target":"530","id":"4918","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"167","target":"430","id":"5122","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"4","target":"503","id":"1547","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"390","target":"394","id":"8565","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"308","target":"603","id":"7508","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"46","target":"482","id":"2536","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"529","target":"586","id":"9938","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"255","target":"558","id":"6657","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"66","target":"273","id":"2998","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"6","target":"458","id":"1589","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"83","target":"210","id":"3374","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"650","target":"735","id":"10552","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"109","target":"136","id":"3910","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"542","target":"624","id":"10018","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"445","target":"484","id":"9220","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"12","target":"645","id":"1750","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"492","target":"551","id":"9638","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"216","target":"619","id":"6023","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"646","target":"724","id":"10524","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"178","target":"700","id":"5344","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"596","target":"721","id":"10313","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"75","target":"342","id":"3199","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"160","target":"657","id":"4995","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"303","target":"335","id":"7432","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"302","target":"635","id":"7423","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"249","target":"483","id":"6554","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"57","target":"594","id":"2787","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"122","target":"577","id":"4204","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"151","target":"443","id":"4819","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"646","target":"735","id":"10529","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"382","target":"725","id":"8467","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"241","target":"693","id":"6429","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"432","target":"542","id":"9059","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"75","target":"379","id":"3201","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"321","target":"420","id":"7687","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"133","target":"417","id":"4423","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"218","target":"693","id":"6065","attributes":{"Weight":"1.0"},"color":"rgb(115,196,148)","size":1.0},{"source":"1","target":"97","id":"1465","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"546","target":"581","id":"10044","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"201","target":"552","id":"5762","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"97","target":"195","id":"3686","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"56","target":"677","id":"2763","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"138","target":"193","id":"4515","attributes":{"Weight":"1.0"},"color":"rgb(67,164,213)","size":1.0},{"source":"295","target":"510","id":"7318","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"428","target":"540","id":"9006","attributes":{"Weight":"1.0"},"color":"rgb(229,115,67)","size":1.0},{"source":"316","target":"397","id":"7611","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"485","target":"639","id":"9579","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"569","target":"719","id":"10161","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"330","target":"561","id":"7826","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"490","target":"676","id":"9618","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"584","target":"599","id":"10261","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"277","target":"571","id":"7013","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"443","target":"490","id":"9196","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"128","target":"513","id":"4318","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"137","target":"380","id":"4506","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"166","target":"167","id":"5095","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"172","target":"522","id":"5218","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"177","target":"311","id":"5307","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"404","target":"661","id":"8749","attributes":{"Weight":"1.0"},"color":"rgb(115,229,132)","size":1.0},{"source":"328","target":"700","id":"7792","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"14","target":"243","id":"1780","attributes":{"Weight":"1.0"},"color":"rgb(148,148,83)","size":1.0},{"source":"693","target":"723","id":"10655","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"404","target":"664","id":"8750","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"399","target":"411","id":"8683","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"169","target":"667","id":"5169","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"306","target":"666","id":"7483","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"240","target":"521","id":"6406","attributes":{"Weight":"1.0"},"color":"rgb(229,132,148)","size":1.0},{"source":"446","target":"510","id":"9226","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"470","target":"477","id":"9459","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"92","target":"426","id":"3583","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"231","target":"586","id":"6272","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"432","target":"589","id":"9061","attributes":{"Weight":"1.0"},"color":"rgb(180,67,229)","size":1.0},{"source":"116","target":"150","id":"4068","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"41","target":"66","id":"2394","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"656","target":"696","id":"10576","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"318","target":"510","id":"7643","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"642","target":"645","id":"10511","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"142","target":"432","id":"4613","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"374","target":"633","id":"8346","attributes":{"Weight":"1.0"},"color":"rgb(99,229,115)","size":1.0},{"source":"50","target":"135","id":"2604","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"102","target":"489","id":"3797","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"243","target":"704","id":"6455","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"623","target":"648","id":"10427","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"440","target":"594","id":"9160","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"102","target":"710","id":"3803","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"629","target":"643","id":"10449","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"180","target":"580","id":"5380","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"64","target":"125","id":"2949","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"200","target":"537","id":"5739","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"328","target":"367","id":"7780","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"175","target":"698","id":"5281","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"131","target":"333","id":"4377","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"172","target":"621","id":"5223","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"306","target":"599","id":"7482","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"264","target":"282","id":"6798","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"255","target":"410","id":"6652","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"571","target":"601","id":"10170","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"432","target":"444","id":"9053","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"366","target":"630","id":"8248","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"558","target":"674","id":"10103","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"428","target":"703","id":"9014","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"460","target":"612","id":"9364","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"72","target":"259","id":"3134","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"154","target":"707","id":"4882","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"224","target":"279","id":"6143","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"35","target":"36","id":"2264","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"169","target":"357","id":"5158","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"144","target":"562","id":"4664","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"35","target":"192","id":"2270","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"213","target":"681","id":"5969","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"199","target":"272","id":"5716","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"729","target":"734","id":"10686","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"409","target":"562","id":"8800","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"455","target":"577","id":"9313","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"376","target":"502","id":"8369","attributes":{"Weight":"1.0"},"color":"rgb(164,148,132)","size":1.0},{"source":"194","target":"259","id":"5619","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"540","target":"568","id":"10007","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"185","target":"531","id":"5470","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"311","target":"667","id":"7551","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"340","target":"437","id":"7957","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"284","target":"467","id":"7141","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"234","target":"672","id":"6326","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"120","target":"368","id":"4161","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"289","target":"436","id":"7224","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"232","target":"415","id":"6286","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"154","target":"155","id":"4859","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"13","target":"389","id":"1765","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"494","target":"526","id":"9656","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"141","target":"452","id":"4596","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"108","target":"195","id":"3890","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"443","target":"529","id":"9197","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"45","target":"661","id":"2515","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"195","target":"435","id":"5640","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"240","target":"461","id":"6402","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"45","target":"422","id":"2504","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"173","target":"494","id":"5240","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"457","target":"701","id":"9333","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"247","target":"598","id":"6525","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"547","target":"717","id":"10051","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"371","target":"569","id":"8296","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"328","target":"329","id":"7778","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"80","target":"603","id":"3321","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"172","target":"532","id":"5220","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"200","target":"649","id":"5745","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"555","target":"645","id":"10085","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"26","target":"675","id":"2056","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"53","target":"524","id":"2681","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"71","target":"705","id":"3127","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"3","target":"486","id":"1527","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"434","target":"713","id":"9094","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"639","target":"657","id":"10495","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"203","target":"454","id":"5791","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"95","target":"248","id":"3647","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"3","target":"39","id":"1511","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"49","target":"510","id":"2596","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"92","target":"615","id":"3592","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"419","target":"451","id":"8894","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"128","target":"388","id":"4314","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"187","target":"539","id":"5505","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"8","target":"667","id":"1654","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"92","target":"197","id":"3577","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"87","target":"473","id":"3466","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"189","target":"483","id":"5542","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"152","target":"617","id":"4843","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"154","target":"316","id":"4867","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"252","target":"481","id":"6608","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"507","target":"613","id":"9761","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"45","target":"46","id":"2491","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"120","target":"222","id":"4152","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"150","target":"644","id":"4799","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"312","target":"635","id":"7561","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"15","target":"631","id":"1818","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"275","target":"355","id":"6979","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"427","target":"718","id":"9002","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"38","target":"634","id":"2352","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"139","target":"575","id":"4547","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"375","target":"442","id":"8351","attributes":{"Weight":"1.0"},"color":"rgb(83,229,115)","size":1.0},{"source":"570","target":"599","id":"10165","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"327","target":"480","id":"7766","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"388","target":"563","id":"8550","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"240","target":"607","id":"6409","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"373","target":"397","id":"8320","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"351","target":"426","id":"8091","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"171","target":"200","id":"5190","attributes":{"Weight":"1.0"},"color":"rgb(132,148,164)","size":1.0},{"source":"348","target":"575","id":"8052","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"50","target":"591","id":"2625","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"276","target":"295","id":"6992","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"214","target":"230","id":"5972","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"630","target":"701","id":"10455","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"204","target":"524","id":"5811","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"246","target":"257","id":"6497","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"505","target":"649","id":"9748","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"17","target":"267","id":"1850","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"2","target":"639","id":"1507","attributes":{"Weight":"1.0"},"color":"rgb(115,67,229)","size":1.0},{"source":"555","target":"600","id":"10082","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"116","target":"231","id":"4069","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"498","target":"678","id":"9698","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"108","target":"418","id":"3895","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"221","target":"487","id":"6106","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"218","target":"366","id":"6049","attributes":{"Weight":"1.0"},"color":"rgb(67,115,229)","size":1.0},{"source":"398","target":"657","id":"8676","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"523","target":"594","id":"9879","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"275","target":"564","id":"6987","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"318","target":"646","id":"7652","attributes":{"Weight":"1.0"},"color":"rgb(67,164,148)","size":1.0},{"source":"462","target":"600","id":"9385","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"18","target":"387","id":"1876","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"38","target":"226","id":"2338","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"180","target":"593","id":"5381","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"555","target":"608","id":"10083","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"127","target":"657","id":"4300","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"196","target":"562","id":"5670","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"505","target":"537","id":"9744","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"415","target":"576","id":"8848","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"486","target":"607","id":"9586","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"91","target":"613","id":"3571","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"42","target":"703","id":"2435","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"264","target":"438","id":"6801","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"87","target":"212","id":"3457","attributes":{"Weight":"1.0"},"color":"rgb(148,148,229)","size":1.0},{"source":"279","target":"323","id":"7036","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"268","target":"283","id":"6862","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"218","target":"274","id":"6046","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"117","target":"126","id":"4093","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"231","target":"576","id":"6270","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"409","target":"565","id":"8801","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"101","target":"262","id":"3772","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"278","target":"488","id":"7027","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"725","target":"730","id":"10682","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"233","target":"567","id":"6307","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"269","target":"399","id":"6893","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"436","target":"547","id":"9110","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"157","target":"603","id":"4940","attributes":{"Weight":"1.0"},"color":"rgb(99,148,180)","size":1.0},{"source":"518","target":"686","id":"9839","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"158","target":"704","id":"4955","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"160","target":"614","id":"4990","attributes":{"Weight":"1.0"},"color":"rgb(115,148,196)","size":1.0},{"source":"52","target":"178","id":"2650","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"436","target":"529","id":"9109","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"429","target":"548","id":"9021","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"433","target":"623","id":"9080","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"51","target":"540","id":"2637","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"21","target":"243","id":"1941","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"43","target":"340","id":"2443","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"543","target":"562","id":"10022","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"69","target":"387","id":"3065","attributes":{"Weight":"1.0"},"color":"rgb(67,164,213)","size":1.0},{"source":"4","target":"404","id":"1545","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"198","target":"688","id":"5712","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"430","target":"711","id":"9039","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"72","target":"574","id":"3143","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"280","target":"608","id":"7070","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"251","target":"253","id":"6580","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"37","target":"579","id":"2322","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"272","target":"503","id":"6940","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"258","target":"583","id":"6706","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"277","target":"618","id":"7017","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"98","target":"492","id":"3717","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"124","target":"223","id":"4233","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"258","target":"440","id":"6703","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"266","target":"690","id":"6841","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"108","target":"519","id":"3899","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"202","target":"261","id":"5769","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"85","target":"431","id":"3420","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"347","target":"709","id":"8046","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"497","target":"516","id":"9678","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"423","target":"656","id":"8946","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"183","target":"302","id":"5419","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"86","target":"580","id":"3446","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"426","target":"456","id":"8983","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"221","target":"591","id":"6109","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"679","target":"685","id":"10627","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"363","target":"537","id":"8208","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"295","target":"509","id":"7317","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"596","target":"692","id":"10311","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"71","target":"662","id":"3126","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"368","target":"710","id":"8275","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"527","target":"685","id":"9919","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"228","target":"710","id":"6230","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"115","target":"702","id":"4064","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"99","target":"309","id":"3735","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"459","target":"680","id":"9355","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"175","target":"653","id":"5279","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"366","target":"457","id":"8244","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"359","target":"397","id":"8171","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"102","target":"697","id":"3802","attributes":{"Weight":"1.0"},"color":"rgb(180,148,99)","size":1.0},{"source":"234","target":"287","id":"6313","attributes":{"Weight":"1.0"},"color":"rgb(67,148,229)","size":1.0},{"source":"130","target":"370","id":"4358","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"480","target":"497","id":"9549","attributes":{"Weight":"1.0"},"color":"rgb(99,229,115)","size":1.0},{"source":"288","target":"473","id":"7203","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"352","target":"526","id":"8109","attributes":{"Weight":"1.0"},"color":"rgb(148,180,148)","size":1.0},{"source":"145","target":"375","id":"4684","attributes":{"Weight":"1.0"},"color":"rgb(164,148,132)","size":1.0},{"source":"424","target":"636","id":"8960","attributes":{"Weight":"1.0"},"color":"rgb(99,229,148)","size":1.0},{"source":"133","target":"606","id":"4428","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"49","target":"295","id":"2589","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"318","target":"606","id":"7651","attributes":{"Weight":"1.0"},"color":"rgb(132,148,148)","size":1.0},{"source":"160","target":"632","id":"4992","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"175","target":"455","id":"5271","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"265","target":"502","id":"6824","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"64","target":"512","id":"2972","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"101","target":"209","id":"3767","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"275","target":"318","id":"6977","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"340","target":"404","id":"7956","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"160","target":"726","id":"4998","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"578","target":"601","id":"10225","attributes":{"Weight":"1.0"},"color":"rgb(196,196,67)","size":1.0},{"source":"23","target":"293","id":"1986","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"71","target":"488","id":"3121","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"287","target":"469","id":"7187","attributes":{"Weight":"1.0"},"color":"rgb(99,148,229)","size":1.0},{"source":"601","target":"716","id":"10332","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"119","target":"128","id":"4130","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"126","target":"476","id":"4278","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"364","target":"504","id":"8218","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"142","target":"455","id":"4615","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"516","target":"736","id":"9823","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"425","target":"562","id":"8972","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"424","target":"645","id":"8962","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"543","target":"663","id":"10029","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"578","target":"602","id":"10226","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"656","target":"674","id":"10574","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"411","target":"561","id":"8825","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"243","target":"641","id":"6453","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"458","target":"686","id":"9345","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"257","target":"723","id":"6693","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"474","target":"553","id":"9503","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"62","target":"341","id":"2910","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"171","target":"345","id":"5195","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"464","target":"549","id":"9398","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"202","target":"645","id":"5785","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"498","target":"614","id":"9694","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"297","target":"663","id":"7349","attributes":{"Weight":"1.0"},"color":"rgb(196,67,229)","size":1.0},{"source":"255","target":"674","id":"6660","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"507","target":"715","id":"9766","attributes":{"Weight":"1.0"},"color":"rgb(180,67,229)","size":1.0},{"source":"327","target":"573","id":"7769","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"128","target":"206","id":"4308","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"203","target":"614","id":"5800","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"351","target":"549","id":"8097","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"319","target":"642","id":"7670","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"282","target":"466","id":"7102","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"280","target":"699","id":"7073","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"145","target":"224","id":"4675","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"240","target":"531","id":"6407","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"169","target":"446","id":"5160","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"124","target":"271","id":"4237","attributes":{"Weight":"1.0"},"color":"rgb(196,180,67)","size":1.0},{"source":"64","target":"661","id":"2974","attributes":{"Weight":"1.0"},"color":"rgb(196,180,67)","size":1.0},{"source":"8","target":"371","id":"1638","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"159","target":"322","id":"4966","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"100","target":"369","id":"3755","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"444","target":"535","id":"9212","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"118","target":"138","id":"4112","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"675","target":"676","id":"10617","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"352","target":"531","id":"8110","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"276","target":"564","id":"7001","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"307","target":"468","id":"7488","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"119","target":"336","id":"4136","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"192","target":"247","id":"5582","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"230","target":"483","id":"6255","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"230","target":"512","id":"6257","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"280","target":"734","id":"7075","attributes":{"Weight":"1.0"},"color":"rgb(148,83,213)","size":1.0},{"source":"474","target":"632","id":"9505","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"553","target":"671","id":"10076","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"386","target":"460","id":"8519","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"606","target":"682","id":"10356","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"574","target":"718","id":"10201","attributes":{"Weight":"1.0"},"color":"rgb(83,148,164)","size":1.0},{"source":"108","target":"655","id":"3906","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"223","target":"344","id":"6134","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"125","target":"141","id":"4248","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"405","target":"411","id":"8753","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"339","target":"610","id":"7945","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"389","target":"599","id":"8560","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"661","target":"721","id":"10591","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"77","target":"620","id":"3258","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"141","target":"237","id":"4586","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"175","target":"535","id":"5275","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"443","target":"586","id":"9201","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"30","target":"552","id":"2162","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"135","target":"429","id":"4465","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"496","target":"659","id":"9674","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"130","target":"382","id":"4359","attributes":{"Weight":"1.0"},"color":"rgb(67,83,229)","size":1.0},{"source":"7","target":"504","id":"1614","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"500","target":"537","id":"9706","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"327","target":"687","id":"7776","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"307","target":"541","id":"7495","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"327","target":"375","id":"7759","attributes":{"Weight":"1.0"},"color":"rgb(83,229,115)","size":1.0},{"source":"211","target":"486","id":"5924","attributes":{"Weight":"1.0"},"color":"rgb(148,213,148)","size":1.0},{"source":"523","target":"543","id":"9875","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"76","target":"440","id":"3223","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"342","target":"574","id":"7983","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"237","target":"252","id":"6355","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"249","target":"622","id":"6556","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"478","target":"675","id":"9542","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"119","target":"248","id":"4135","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"111","target":"591","id":"3980","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"249","target":"461","id":"6550","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"310","target":"458","id":"7526","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"194","target":"403","id":"5624","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"136","target":"448","id":"4490","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"215","target":"260","id":"5986","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"401","target":"656","id":"8714","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"98","target":"551","id":"3720","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"604","target":"621","id":"10345","attributes":{"Weight":"1.0"},"color":"rgb(196,67,229)","size":1.0},{"source":"37","target":"337","id":"2316","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"180","target":"528","id":"5378","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"361","target":"483","id":"8195","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"110","target":"349","id":"3943","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"162","target":"339","id":"5022","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"231","target":"308","id":"6262","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"89","target":"715","id":"3531","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"338","target":"714","id":"7937","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"185","target":"461","id":"5466","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"433","target":"687","id":"9085","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"217","target":"705","id":"6042","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"224","target":"676","id":"6162","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"533","target":"627","id":"9963","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"12","target":"600","id":"1747","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"418","target":"722","id":"8890","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"288","target":"381","id":"7197","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"15","target":"519","id":"1812","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"475","target":"678","id":"9523","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"74","target":"527","id":"3181","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"143","target":"535","id":"4641","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"98","target":"456","id":"3715","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"41","target":"192","id":"2397","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"394","target":"559","id":"8627","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"158","target":"439","id":"4949","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"268","target":"390","id":"6866","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"331","target":"436","id":"7832","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"238","target":"308","id":"6370","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"27","target":"116","id":"2059","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"161","target":"322","id":"5002","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"364","target":"693","id":"8228","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"498","target":"679","id":"9699","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"344","target":"484","id":"8010","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"517","target":"648","id":"9831","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"134","target":"375","id":"4441","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"142","target":"157","id":"4606","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"596","target":"693","id":"10312","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"188","target":"428","id":"5516","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"382","target":"647","id":"8461","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"4","target":"65","id":"1535","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"340","target":"387","id":"7955","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"52","target":"464","id":"2660","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"78","target":"389","id":"3269","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"573","target":"687","id":"10194","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"124","target":"615","id":"4247","attributes":{"Weight":"1.0"},"color":"rgb(164,99,148)","size":1.0},{"source":"11","target":"65","id":"1707","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"612","target":"679","id":"10386","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"112","target":"189","id":"3988","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"166","target":"359","id":"5102","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"572","target":"644","id":"10182","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"429","target":"529","id":"9020","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"193","target":"734","id":"5616","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"280","target":"547","id":"7066","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"19","target":"59","id":"1891","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"57","target":"124","id":"2769","attributes":{"Weight":"1.0"},"color":"rgb(229,99,148)","size":1.0},{"source":"533","target":"626","id":"9962","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"64","target":"124","id":"2948","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"451","target":"487","id":"9268","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"72","target":"194","id":"3132","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"185","target":"191","id":"5457","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"289","target":"699","id":"7234","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"371","target":"606","id":"8300","attributes":{"Weight":"1.0"},"color":"rgb(213,67,213)","size":1.0},{"source":"113","target":"674","id":"4020","attributes":{"Weight":"1.0"},"color":"rgb(148,99,164)","size":1.0},{"source":"31","target":"130","id":"2170","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"82","target":"385","id":"3350","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"203","target":"611","id":"5799","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"612","target":"667","id":"10384","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"55","target":"653","id":"2743","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"250","target":"410","id":"6567","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"20","target":"502","id":"1926","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"249","target":"449","id":"6548","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"528","target":"571","id":"9922","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"179","target":"408","id":"5353","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"30","target":"305","id":"2153","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"111","target":"227","id":"3964","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"36","target":"273","id":"2292","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"208","target":"620","id":"5882","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"173","target":"525","id":"5242","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"510","target":"564","id":"9783","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"149","target":"417","id":"4766","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"175","target":"669","id":"5280","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"344","target":"445","id":"8008","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"99","target":"701","id":"3744","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"129","target":"373","id":"4337","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"342","target":"627","id":"7987","attributes":{"Weight":"1.0"},"color":"rgb(67,180,164)","size":1.0},{"source":"198","target":"633","id":"5706","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"291","target":"422","id":"7260","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"292","target":"695","id":"7278","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"292","target":"439","id":"7273","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"502","target":"681","id":"9724","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"436","target":"717","id":"9116","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"97","target":"437","id":"3693","attributes":{"Weight":"1.0"},"color":"rgb(67,196,213)","size":1.0},{"source":"177","target":"384","id":"5309","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"213","target":"365","id":"5960","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"704","target":"733","id":"10668","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"473","target":"604","id":"9499","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"90","target":"326","id":"3541","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"14","target":"379","id":"1785","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"56","target":"177","id":"2749","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"188","target":"593","id":"5521","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"433","target":"678","id":"9083","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"131","target":"623","id":"4391","attributes":{"Weight":"1.0"},"color":"rgb(148,196,115)","size":1.0},{"source":"88","target":"279","id":"3492","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"182","target":"627","id":"5411","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"224","target":"490","id":"6155","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"345","target":"417","id":"8014","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"76","target":"543","id":"3230","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"8","target":"384","id":"1639","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"51","target":"641","id":"2640","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"6","target":"298","id":"1585","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"44","target":"586","id":"2482","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"229","target":"256","id":"6231","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"2","target":"105","id":"1491","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"688","target":"697","id":"10637","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"349","target":"569","id":"8069","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"130","target":"291","id":"4353","attributes":{"Weight":"1.0"},"color":"rgb(132,148,148)","size":1.0},{"source":"39","target":"240","id":"2364","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"192","target":"380","id":"5587","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"194","target":"342","id":"5620","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"73","target":"184","id":"3151","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"664","target":"709","id":"10596","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"193","target":"689","id":"5611","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"296","target":"519","id":"7328","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"124","target":"354","id":"4240","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"66","target":"467","id":"3005","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"301","target":"384","id":"7401","attributes":{"Weight":"1.0"},"color":"rgb(99,148,180)","size":1.0},{"source":"110","target":"164","id":"3934","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"42","target":"528","id":"2427","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"63","target":"639","id":"2940","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"56","target":"625","id":"2760","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"601","target":"619","id":"10328","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"84","target":"113","id":"3389","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"523","target":"562","id":"9876","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"294","target":"397","id":"7298","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"323","target":"676","id":"7717","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"176","target":"718","id":"5300","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"28","target":"113","id":"2094","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"146","target":"210","id":"4705","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"252","target":"416","id":"6601","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"184","target":"736","id":"5456","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"612","target":"681","id":"10387","attributes":{"Weight":"1.0"},"color":"rgb(83,229,99)","size":1.0},{"source":"392","target":"411","id":"8598","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"336","target":"356","id":"7897","attributes":{"Weight":"1.0"},"color":"rgb(229,148,83)","size":1.0},{"source":"137","target":"598","id":"4512","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"172","target":"604","id":"5221","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"250","target":"423","id":"6568","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"381","target":"594","id":"8444","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"498","target":"629","id":"9696","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"394","target":"731","id":"8631","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"7","target":"271","id":"1608","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"266","target":"693","id":"6843","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"201","target":"710","id":"5764","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"391","target":"399","id":"8582","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"179","target":"231","id":"5347","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"325","target":"539","id":"7739","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"11","target":"220","id":"1711","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"459","target":"620","id":"9354","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"42","target":"93","id":"2413","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"198","target":"524","id":"5704","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"350","target":"659","id":"8085","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"316","target":"442","id":"7612","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"50","target":"429","id":"2620","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"409","target":"573","id":"8802","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"430","target":"702","id":"9038","attributes":{"Weight":"1.0"},"color":"rgb(148,213,83)","size":1.0},{"source":"21","target":"733","id":"1956","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"385","target":"614","id":"8511","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"211","target":"608","id":"5928","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"44","target":"122","id":"2461","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"435","target":"494","id":"9096","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"724","target":"734","id":"10679","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"283","target":"392","id":"7121","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"383","target":"649","id":"8479","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"185","target":"352","id":"5461","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"177","target":"532","id":"5316","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"384","target":"667","id":"8494","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"291","target":"478","id":"7264","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"377","target":"731","id":"8393","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"115","target":"379","id":"4053","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"490","target":"699","id":"9619","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"455","target":"687","id":"9318","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"46","target":"141","id":"2522","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"586","target":"627","id":"10267","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"409","target":"433","id":"8791","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"403","target":"649","id":"8736","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"317","target":"357","id":"7629","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"65","target":"346","id":"2981","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"46","target":"291","id":"2526","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"272","target":"340","id":"6934","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"550","target":"588","id":"10061","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"150","target":"720","id":"4803","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"184","target":"636","id":"5451","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"84","target":"407","id":"3397","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"71","target":"579","id":"3123","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"405","target":"731","id":"8761","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"349","target":"644","id":"8074","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"281","target":"614","id":"7084","attributes":{"Weight":"1.0"},"color":"rgb(67,164,196)","size":1.0},{"source":"116","target":"528","id":"4082","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"575","target":"583","id":"10203","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"251","target":"694","id":"6597","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"248","target":"712","id":"6540","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"421","target":"728","id":"8930","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"60","target":"646","id":"2862","attributes":{"Weight":"1.0"},"color":"rgb(148,83,180)","size":1.0},{"source":"258","target":"654","id":"6709","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"319","target":"429","id":"7659","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"260","target":"271","id":"6731","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"86","target":"286","id":"3438","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"329","target":"367","id":"7796","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"454","target":"480","id":"9296","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"210","target":"337","id":"5902","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"590","target":"709","id":"10289","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"229","target":"267","id":"6232","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"419","target":"642","id":"8903","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"382","target":"491","id":"8457","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"289","target":"323","id":"7219","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"120","target":"708","id":"4168","attributes":{"Weight":"1.0"},"color":"rgb(229,67,99)","size":1.0},{"source":"459","target":"471","id":"9348","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"183","target":"224","id":"5417","attributes":{"Weight":"1.0"},"color":"rgb(180,148,132)","size":1.0},{"source":"536","target":"718","id":"9985","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"280","target":"490","id":"7064","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"28","target":"420","id":"2109","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"284","target":"315","id":"7138","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"343","target":"388","id":"7995","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"335","target":"415","id":"7882","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"70","target":"645","id":"3104","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"689","target":"724","id":"10639","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"424","target":"642","id":"8961","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"195","target":"218","id":"5636","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"83","target":"420","id":"3380","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"140","target":"460","id":"4570","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"528","target":"593","id":"9925","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"623","target":"719","id":"10430","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"115","target":"194","id":"4048","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"330","target":"560","id":"7825","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"305","target":"324","id":"7463","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"524","target":"636","id":"9888","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"150","target":"371","id":"4786","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"68","target":"312","id":"3041","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"526","target":"582","id":"9903","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"82","target":"517","id":"3359","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"339","target":"693","id":"7950","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"183","target":"726","id":"5438","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"518","target":"620","id":"9836","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"217","target":"533","id":"6036","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"199","target":"664","id":"5728","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"337","target":"533","id":"7917","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"416","target":"447","id":"8857","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"378","target":"399","id":"8395","attributes":{"Weight":"1.0"},"color":"rgb(229,148,115)","size":1.0},{"source":"158","target":"641","id":"4953","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"417","target":"534","id":"8871","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"19","target":"447","id":"1902","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"577","target":"678","id":"10221","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"197","target":"456","id":"5688","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"294","target":"644","id":"7309","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"583","target":"603","id":"10254","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"572","target":"693","id":"10183","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"506","target":"727","id":"9757","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"148","target":"307","id":"4742","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"528","target":"646","id":"9930","attributes":{"Weight":"1.0"},"color":"rgb(148,132,148)","size":1.0},{"source":"61","target":"145","id":"2869","attributes":{"Weight":"1.0"},"color":"rgb(213,67,213)","size":1.0},{"source":"52","target":"718","id":"2668","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"159","target":"632","id":"4972","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"433","target":"543","id":"9075","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"356","target":"423","id":"8142","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"206","target":"448","id":"5844","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"170","target":"545","id":"5181","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"295","target":"357","id":"7315","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"229","target":"564","id":"6244","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"128","target":"360","id":"4312","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"129","target":"240","id":"4334","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"88","target":"422","id":"3496","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"159","target":"621","id":"4971","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"31","target":"100","id":"2167","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"76","target":"594","id":"3235","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"600","target":"608","id":"10322","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"97","target":"296","id":"3690","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"121","target":"191","id":"4177","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"566","target":"613","id":"10139","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"296","target":"494","id":"7327","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"12","target":"450","id":"1742","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"27","target":"139","id":"2060","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"432","target":"455","id":"9054","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"399","target":"731","id":"8693","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"396","target":"566","id":"8647","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"537","target":"649","id":"9990","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"147","target":"539","id":"4734","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"266","target":"692","id":"6842","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"470","target":"471","id":"9458","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"421","target":"473","id":"8917","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"288","target":"409","id":"7198","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"472","target":"508","id":"9477","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"428","target":"619","id":"9012","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"53","target":"736","id":"2690","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"288","target":"728","id":"7218","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"45","target":"237","id":"2498","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"15","target":"108","id":"1801","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"49","target":"169","id":"2582","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"441","target":"734","id":"9179","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"236","target":"305","id":"6342","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"100","target":"130","id":"3747","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"144","target":"668","id":"4672","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"335","target":"726","id":"7895","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"318","target":"509","id":"7642","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"607","target":"711","id":"10360","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"639","target":"671","id":"10496","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"605","target":"631","id":"10349","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"91","target":"242","id":"3559","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"315","target":"467","id":"7599","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"108","target":"218","id":"3892","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"140","target":"678","id":"4580","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"144","target":"303","id":"4654","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"82","target":"633","id":"3365","attributes":{"Weight":"1.0"},"color":"rgb(99,229,115)","size":1.0},{"source":"255","target":"660","id":"6659","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"167","target":"226","id":"5118","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"96","target":"701","id":"3683","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"169","target":"352","id":"5156","attributes":{"Weight":"1.0"},"color":"rgb(148,213,67)","size":1.0},{"source":"517","target":"573","id":"9825","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"339","target":"453","id":"7939","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"60","target":"429","id":"2851","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"594","target":"728","id":"10304","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"75","target":"537","id":"3206","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"27","target":"573","id":"2076","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"169","target":"581","id":"5166","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"225","target":"462","id":"6175","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"311","target":"654","id":"7550","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"254","target":"674","id":"6645","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"586","target":"676","id":"10268","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"160","target":"297","id":"4984","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"508","target":"604","id":"9774","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"261","target":"642","id":"6769","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"587","target":"649","id":"10272","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"235","target":"353","id":"6333","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"248","target":"343","id":"6529","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"401","target":"694","id":"8717","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"568","target":"733","id":"10155","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"188","target":"652","id":"5525","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"637","target":"736","id":"10487","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"289","target":"540","id":"7229","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"102","target":"222","id":"3786","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"61","target":"94","id":"2866","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"435","target":"582","id":"9100","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"282","target":"650","id":"7106","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"44","target":"475","id":"2475","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"347","target":"628","id":"8043","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"20","target":"375","id":"1923","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"677","target":"707","id":"10624","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"404","target":"565","id":"8746","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"7","target":"690","id":"1621","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"430","target":"440","id":"9028","attributes":{"Weight":"1.0"},"color":"rgb(229,132,148)","size":1.0},{"source":"225","target":"358","id":"6170","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"77","target":"208","id":"3243","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"465","target":"689","id":"9411","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"17","target":"564","id":"1862","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"124","target":"445","id":"4243","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"523","target":"649","id":"9881","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"326","target":"513","id":"7753","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"205","target":"631","id":"5835","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"59","target":"478","id":"2827","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"284","target":"495","id":"7142","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"259","target":"500","id":"6718","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"123","target":"141","id":"4212","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"274","target":"296","id":"6959","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"107","target":"488","id":"3882","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"145","target":"699","id":"4701","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"602","target":"610","id":"10333","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"269","target":"405","id":"6894","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"213","target":"476","id":"5963","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"257","target":"474","id":"6682","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"14","target":"259","id":"1781","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"64","target":"262","id":"2960","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"114","target":"297","id":"4028","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"191","target":"634","id":"5580","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"674","target":"696","id":"10616","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"286","target":"601","id":"7174","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"423","target":"558","id":"8945","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"436","target":"676","id":"9113","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"654","target":"707","id":"10571","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"61","target":"140","id":"2868","attributes":{"Weight":"1.0"},"color":"rgb(132,148,180)","size":1.0},{"source":"328","target":"718","id":"7793","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"144","target":"583","id":"4667","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"279","target":"289","id":"7035","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"357","target":"446","id":"8152","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"197","target":"328","id":"5681","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"247","target":"380","id":"6519","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"269","target":"393","id":"6890","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"453","target":"610","id":"9286","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"498","target":"517","id":"9689","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"290","target":"731","id":"7257","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"32","target":"410","id":"2196","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"291","target":"534","id":"7268","attributes":{"Weight":"1.0"},"color":"rgb(197,148,148)","size":1.0},{"source":"110","target":"572","id":"3949","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"83","target":"107","id":"3370","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"62","target":"134","id":"2904","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"7","target":"723","id":"1625","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"171","target":"606","id":"5205","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"458","target":"471","id":"9337","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"562","target":"606","id":"10121","attributes":{"Weight":"1.0"},"color":"rgb(213,67,229)","size":1.0},{"source":"161","target":"671","id":"5012","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"336","target":"550","id":"7905","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"266","target":"602","id":"6837","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"80","target":"144","id":"3306","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"569","target":"629","id":"10158","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"371","target":"719","id":"8306","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"353","target":"429","id":"8117","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"129","target":"677","id":"4346","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"159","target":"398","id":"4967","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"48","target":"174","id":"2566","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"190","target":"383","id":"5557","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"252","target":"461","id":"6606","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"396","target":"613","id":"8649","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"57","target":"472","id":"2778","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"87","target":"421","id":"3461","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"186","target":"595","id":"5493","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"479","target":"541","id":"9545","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"409","target":"472","id":"8793","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"335","target":"348","id":"7881","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"308","target":"583","id":"7507","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"321","target":"488","id":"7688","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"297","target":"398","id":"7340","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"635","target":"636","id":"10473","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"19","target":"45","id":"1887","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"245","target":"719","id":"6495","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"264","target":"465","id":"6803","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"216","target":"428","id":"6012","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"112","target":"344","id":"3997","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"153","target":"672","id":"4857","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"172","target":"177","id":"5211","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"184","target":"497","id":"5445","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"483","target":"661","id":"9572","attributes":{"Weight":"1.0"},"color":"rgb(196,180,67)","size":1.0},{"source":"143","target":"455","id":"4638","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"627","target":"705","id":"10444","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"275","target":"526","id":"6985","attributes":{"Weight":"1.0"},"color":"rgb(67,196,148)","size":1.0},{"source":"672","target":"701","id":"10612","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"218","target":"591","id":"6061","attributes":{"Weight":"1.0"},"color":"rgb(148,115,213)","size":1.0},{"source":"111","target":"164","id":"3963","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"543","target":"604","id":"10027","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"337","target":"626","id":"7919","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"18","target":"220","id":"1870","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"57","target":"76","id":"2767","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"26","target":"416","id":"2046","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"108","target":"631","id":"3905","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"169","target":"592","id":"5167","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"295","target":"581","id":"7321","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"85","target":"490","id":"3423","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"275","target":"592","id":"6989","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"89","target":"297","id":"3519","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"157","target":"300","id":"4927","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"496","target":"613","id":"9672","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"51","target":"158","id":"2631","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"30","target":"368","id":"2157","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"227","target":"397","id":"6204","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"73","target":"736","id":"3168","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"276","target":"357","id":"6996","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"582","target":"585","id":"10249","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"242","target":"574","id":"6443","attributes":{"Weight":"1.0"},"color":"rgb(83,229,83)","size":1.0},{"source":"269","target":"283","id":"6883","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"29","target":"515","id":"2138","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"42","target":"277","id":"2420","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"286","target":"326","id":"7165","attributes":{"Weight":"1.0"},"color":"rgb(164,196,67)","size":1.0},{"source":"582","target":"722","id":"10253","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"19","target":"58","id":"1890","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"51","target":"733","id":"2645","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"95","target":"109","id":"3639","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"188","target":"619","id":"5524","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"93","target":"332","id":"3603","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"215","target":"241","id":"5984","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"111","target":"644","id":"3983","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"275","target":"652","id":"6990","attributes":{"Weight":"1.0"},"color":"rgb(148,196,67)","size":1.0},{"source":"35","target":"306","id":"2274","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"508","target":"663","id":"9775","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"144","target":"575","id":"4665","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"298","target":"458","id":"7356","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"85","target":"676","id":"3428","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"108","target":"585","id":"3903","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"134","target":"681","id":"4448","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"165","target":"461","id":"5087","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"654","target":"667","id":"10565","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"425","target":"449","id":"8964","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"404","target":"416","id":"8740","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"444","target":"455","id":"9209","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"128","target":"550","id":"4319","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"126","target":"502","id":"4279","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"283","target":"658","id":"7135","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"661","target":"692","id":"10589","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"96","target":"130","id":"3668","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"131","target":"443","id":"4381","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"659","target":"714","id":"10583","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"73","target":"688","id":"3166","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"6","target":"81","id":"1582","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"5","target":"157","id":"1559","attributes":{"Weight":"1.0"},"color":"rgb(99,148,180)","size":1.0},{"source":"253","target":"402","id":"6620","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"44","target":"151","id":"2462","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"229","target":"546","id":"6243","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"610","target":"693","id":"10372","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"725","target":"735","id":"10684","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"51","target":"292","id":"2634","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"155","target":"349","id":"4892","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"650","target":"734","id":"10551","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"121","target":"185","id":"4176","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"56","target":"386","id":"2753","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"168","target":"352","id":"5134","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"61","target":"534","id":"2888","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"189","target":"512","id":"5544","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"199","target":"387","id":"5721","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"419","target":"555","id":"8899","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"318","target":"592","id":"7650","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"10","target":"106","id":"1687","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"282","target":"465","id":"7101","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"23","target":"695","id":"1992","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"133","target":"534","id":"4426","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"45","target":"447","id":"2505","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"155","target":"316","id":"4891","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"254","target":"557","id":"6641","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"441","target":"724","id":"9175","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"252","target":"449","id":"6604","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"67","target":"312","id":"3020","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"16","target":"708","id":"1840","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"144","target":"616","id":"4670","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"219","target":"457","id":"6073","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"439","target":"732","id":"9148","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"72","target":"691","id":"3147","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"352","target":"607","id":"8111","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"224","target":"529","id":"6156","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"216","target":"716","id":"6028","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"159","target":"485","id":"4969","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"175","target":"539","id":"5276","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"68","target":"635","id":"3048","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"174","target":"733","id":"5262","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"568","target":"709","id":"10153","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"345","target":"659","id":"8021","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"54","target":"216","id":"2696","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"6","target":"148","id":"1583","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"188","target":"528","id":"5518","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"9","target":"201","id":"1665","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"282","target":"735","id":"7115","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"10","target":"105","id":"1686","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"212","target":"449","id":"5941","attributes":{"Weight":"1.0"},"color":"rgb(132,229,148)","size":1.0},{"source":"169","target":"564","id":"5165","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"162","target":"721","id":"5038","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"259","target":"587","id":"6723","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"192","target":"495","id":"5590","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"296","target":"631","id":"7335","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"296","target":"526","id":"7330","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"574","target":"587","id":"10195","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"385","target":"475","id":"8503","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"640","target":"695","id":"10500","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"202","target":"642","id":"5784","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"452","target":"503","id":"9277","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"387","target":"709","id":"8544","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"66","target":"380","id":"3002","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"171","target":"673","id":"5208","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"488","target":"626","id":"9598","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"121","target":"463","id":"4185","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"22","target":"439","id":"1968","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"608","target":"631","id":"10361","attributes":{"Weight":"1.0"},"color":"rgb(67,196,229)","size":1.0},{"source":"59","target":"252","id":"2820","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"517","target":"577","id":"9826","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"323","target":"567","id":"7715","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"106","target":"369","id":"3865","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"470","target":"680","id":"9465","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"170","target":"251","id":"5171","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"224","target":"726","id":"6166","attributes":{"Weight":"1.0"},"color":"rgb(196,67,213)","size":1.0},{"source":"375","target":"683","id":"8362","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"5","target":"303","id":"1565","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"240","target":"486","id":"6404","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"94","target":"345","id":"3625","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"225","target":"600","id":"6178","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"279","target":"693","id":"7052","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"307","target":"686","id":"7498","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"342","target":"717","id":"7992","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"176","target":"328","id":"5284","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"82","target":"678","id":"3367","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"494","target":"585","id":"9658","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"98","target":"351","id":"3710","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"68","target":"302","id":"3040","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"460","target":"713","id":"9373","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"28","target":"278","id":"2101","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"57","target":"288","id":"2772","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"162","target":"690","id":"5034","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"94","target":"244","id":"3621","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"266","target":"339","id":"6831","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"283","target":"559","id":"7131","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"120","target":"595","id":"4167","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"187","target":"669","id":"5509","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"293","target":"641","id":"7287","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"439","target":"568","id":"9141","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"52","target":"176","id":"2649","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"579","target":"626","id":"10237","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"235","target":"429","id":"6335","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"398","target":"654","id":"8675","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"397","target":"569","id":"8655","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"65","target":"503","id":"2986","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"148","target":"541","id":"4754","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"264","target":"730","id":"6815","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"551","target":"615","id":"10066","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"128","target":"152","id":"4306","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"33","target":"344","id":"2226","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"273","target":"315","id":"6949","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"212","target":"358","id":"5937","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"386","target":"685","id":"8532","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"577","target":"648","id":"10220","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"164","target":"591","id":"5068","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"253","target":"254","id":"6615","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"444","target":"542","id":"9214","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"116","target":"576","id":"4085","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"297","target":"638","id":"7346","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"76","target":"589","id":"3234","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"118","target":"346","id":"4117","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"18","target":"670","id":"1884","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"172","target":"527","id":"5219","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"26","target":"125","id":"2040","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"129","target":"359","id":"4336","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"18","target":"404","id":"1877","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"268","target":"413","id":"6876","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"270","target":"633","id":"6910","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"226","target":"607","id":"6191","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"314","target":"659","id":"7593","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"310","target":"680","id":"7537","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"528","target":"580","id":"9924","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"651","target":"735","id":"10559","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"42","target":"202","id":"2417","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"363","target":"379","id":"8202","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"113","target":"662","id":"4019","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"261","target":"462","id":"6762","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"266","target":"596","id":"6836","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"201","target":"222","id":"5749","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"506","target":"712","id":"9756","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"163","target":"378","id":"5045","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"31","target":"96","id":"2165","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"19","target":"622","id":"1908","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"276","target":"509","id":"6998","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"2","target":"322","id":"1500","attributes":{"Weight":"1.0"},"color":"rgb(115,67,229)","size":1.0},{"source":"360","target":"448","id":"8184","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"216","target":"644","id":"6025","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"502","target":"530","id":"9722","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"158","target":"640","id":"4952","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"209","target":"512","id":"5898","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"167","target":"359","id":"5121","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"170","target":"253","id":"5172","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"212","target":"319","id":"5936","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"517","target":"614","id":"9828","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"344","target":"354","id":"8005","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"224","target":"567","id":"6159","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"251","target":"336","id":"6583","attributes":{"Weight":"1.0"},"color":"rgb(229,148,83)","size":1.0},{"source":"625","target":"679","id":"10437","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"197","target":"329","id":"5682","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"132","target":"189","id":"4397","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"78","target":"306","id":"3266","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"351","target":"615","id":"8100","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"165","target":"430","id":"5086","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"202","target":"287","id":"5770","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"2","target":"370","id":"1503","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"464","target":"615","id":"9402","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"168","target":"226","id":"5132","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"143","target":"645","id":"4645","attributes":{"Weight":"1.0"},"color":"rgb(99,148,229)","size":1.0},{"source":"165","target":"711","id":"5093","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"24","target":"243","id":"2004","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"121","target":"240","id":"4179","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"374","target":"687","id":"8349","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"114","target":"322","id":"4029","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"169","target":"510","id":"5162","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"191","target":"359","id":"5573","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"342","target":"649","id":"7988","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"311","target":"527","id":"7545","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"59","target":"416","id":"2822","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"222","target":"236","id":"6117","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"390","target":"731","id":"8577","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"40","target":"41","id":"2375","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"693","target":"721","id":"10654","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"81","target":"148","id":"3325","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"202","target":"424","id":"5774","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"312","target":"736","id":"7567","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"28","target":"135","id":"2095","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"122","target":"442","id":"4197","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"352","target":"667","id":"8114","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"228","target":"499","id":"6226","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"90","target":"341","id":"3542","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"329","target":"372","id":"7797","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"371","target":"572","id":"8297","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"464","target":"536","id":"9397","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"381","target":"508","id":"8436","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"116","target":"303","id":"4073","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"421","target":"562","id":"8922","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"303","target":"498","id":"7438","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"280","target":"443","id":"7062","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"151","target":"490","id":"4820","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"421","target":"440","id":"8915","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"286","target":"580","id":"7172","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"264","target":"647","id":"6807","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"440","target":"523","id":"9154","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"303","target":"434","id":"7437","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"229","target":"446","id":"6240","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"43","target":"590","id":"2453","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"117","target":"156","id":"4095","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"217","target":"488","id":"6035","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"234","target":"554","id":"6321","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"186","target":"552","id":"5492","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"106","target":"153","id":"3858","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"95","target":"712","id":"3662","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"553","target":"715","id":"10077","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"19","target":"452","id":"1904","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"45","target":"481","id":"2510","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"133","target":"314","id":"4417","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"489","target":"595","id":"9608","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"466","target":"729","id":"9426","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"95","target":"343","id":"3649","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"86","target":"93","id":"3431","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"38","target":"537","id":"2350","attributes":{"Weight":"1.0"},"color":"rgb(148,213,83)","size":1.0},{"source":"464","target":"552","id":"9400","attributes":{"Weight":"1.0"},"color":"rgb(164,67,180)","size":1.0},{"source":"1","target":"722","id":"1485","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"208","target":"518","id":"5880","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"91","target":"341","id":"3562","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"157","target":"469","id":"4933","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"411","target":"412","id":"8820","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"377","target":"559","id":"8389","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"263","target":"432","id":"6784","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"253","target":"410","id":"6621","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"608","target":"734","id":"10364","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"326","target":"530","id":"7754","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"116","target":"713","id":"4092","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"211","target":"600","id":"5927","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"201","target":"236","id":"5752","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"121","target":"166","id":"4173","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"232","target":"583","id":"6290","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"85","target":"279","id":"3414","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"4","target":"387","id":"1544","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"186","target":"201","id":"5478","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"102","target":"552","id":"3800","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"228","target":"368","id":"6223","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"64","target":"344","id":"2962","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"222","target":"499","id":"6125","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"312","target":"538","id":"7559","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"135","target":"289","id":"4457","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"399","target":"658","id":"8692","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"210","target":"533","id":"5906","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"103","target":"317","id":"3812","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"52","target":"551","id":"2664","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"501","target":"506","id":"9714","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"315","target":"584","id":"7602","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"375","target":"476","id":"8354","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"195","target":"631","id":"5650","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"94","target":"659","id":"3635","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"251","target":"423","id":"6589","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"205","target":"722","id":"5837","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"647","target":"735","id":"10538","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"19","target":"125","id":"1893","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"575","target":"616","id":"10206","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"41","target":"315","id":"2402","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"118","target":"595","id":"4125","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"148","target":"518","id":"4753","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"650","target":"689","id":"10546","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"355","target":"564","id":"8135","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"11","target":"664","id":"1725","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"17","target":"510","id":"1860","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"8","target":"679","id":"1656","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"570","target":"666","id":"10166","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"301","target":"669","id":"7414","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"199","target":"404","id":"5722","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"42","target":"188","id":"2416","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"19","target":"123","id":"1892","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"289","target":"443","id":"7225","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"490","target":"547","id":"9613","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"110","target":"245","id":"3939","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"373","target":"569","id":"8321","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"277","target":"593","id":"7015","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"163","target":"248","id":"5041","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"227","target":"373","id":"6203","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"47","target":"556","id":"2556","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"206","target":"563","id":"5848","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"301","target":"455","id":"7405","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"193","target":"441","id":"5603","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"235","target":"305","id":"6330","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"120","target":"201","id":"4151","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"116","target":"562","id":"4083","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"444","target":"653","id":"9216","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"46","target":"252","id":"2525","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"329","target":"536","id":"7803","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"267","target":"592","id":"6860","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"104","target":"581","id":"3839","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"162","target":"266","id":"5018","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"465","target":"491","id":"9406","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"91","target":"326","id":"3561","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"268","target":"330","id":"6864","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"285","target":"441","id":"7150","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"86","target":"333","id":"3441","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"282","target":"647","id":"7105","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"431","target":"602","id":"9047","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"667","target":"679","id":"10603","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"85","target":"233","id":"3413","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"330","target":"395","id":"7817","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"30","target":"595","id":"2163","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"249","target":"447","id":"6547","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"145","target":"721","id":"4703","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"467","target":"666","id":"9435","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"160","target":"474","id":"4987","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"463","target":"531","id":"9392","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"440","target":"583","id":"9158","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"122","target":"433","id":"4196","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"28","target":"111","id":"2093","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"200","target":"403","id":"5736","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"407","target":"579","id":"8772","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"689","target":"734","id":"10643","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"131","target":"652","id":"4393","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"62","target":"156","id":"2905","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"255","target":"423","id":"6653","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"25","target":"292","id":"2023","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"362","target":"445","id":"8198","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"499","target":"548","id":"9701","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"150","target":"397","id":"4788","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"209","target":"320","id":"5890","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"277","target":"428","id":"7008","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"212","target":"450","id":"5942","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"8","target":"140","id":"1630","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"145","target":"717","id":"4702","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"241","target":"339","id":"6415","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"529","target":"676","id":"9940","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"391","target":"413","id":"8586","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"17","target":"357","id":"1857","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"336","target":"563","id":"7906","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"376","target":"586","id":"8373","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"75","target":"259","id":"3198","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"6","target":"686","id":"1601","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"333","target":"593","id":"7862","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"212","target":"261","id":"5934","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"603","target":"668","id":"10343","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"68","target":"497","id":"3042","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"45","target":"452","id":"2507","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"325","target":"345","id":"7731","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"110","target":"373","id":"3945","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"331","target":"717","id":"7841","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"280","target":"676","id":"7072","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"53","target":"73","id":"2671","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"326","target":"375","id":"7749","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"245","target":"572","id":"6490","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"489","target":"529","id":"9604","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"505","target":"691","id":"9749","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"386","target":"707","id":"8533","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"715","target":"726","id":"10673","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"400","target":"660","id":"8703","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"63","target":"322","id":"2932","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"516","target":"538","id":"9814","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"383","target":"597","id":"8478","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"166","target":"461","id":"5106","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"319","target":"529","id":"7665","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"1","target":"631","id":"1483","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"514","target":"669","id":"9806","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"649","target":"691","id":"10542","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"395","target":"561","id":"8640","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"156","target":"213","id":"4907","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"61","target":"673","id":"2894","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"384","target":"703","id":"8498","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"585","target":"655","id":"10265","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"187","target":"514","id":"5503","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"339","target":"723","id":"7952","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"281","target":"650","id":"7087","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"91","target":"530","id":"3569","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"3","target":"165","id":"1514","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"574","target":"691","id":"10198","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"526","target":"585","id":"9904","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"290","target":"391","id":"7241","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"400","target":"402","id":"8695","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"272","target":"346","id":"6935","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"346","target":"628","id":"8033","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"540","target":"708","id":"10012","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"519","target":"582","id":"9842","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"565","target":"604","id":"10134","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"405","target":"560","id":"8758","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"179","target":"679","id":"5366","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"107","target":"113","id":"3872","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"181","target":"672","id":"5398","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"223","target":"262","id":"6132","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"79","target":"687","id":"3302","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"218","target":"494","id":"6054","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"227","target":"643","id":"6212","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"476","target":"513","id":"9526","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"422","target":"591","id":"8938","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"248","target":"388","id":"6532","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"416","target":"461","id":"8860","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"458","target":"518","id":"9341","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"28","target":"368","id":"2106","attributes":{"Weight":"1.0"},"color":"rgb(148,99,180)","size":1.0},{"source":"88","target":"215","id":"3484","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"545","target":"674","id":"10039","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"270","target":"636","id":"6912","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"458","target":"470","id":"9336","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"328","target":"456","id":"7784","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"583","target":"668","id":"10257","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"17","target":"34","id":"1843","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"177","target":"279","id":"5306","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"77","target":"477","id":"3253","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"68","target":"688","id":"3052","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"225","target":"555","id":"6177","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"9","target":"710","id":"1681","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"279","target":"443","id":"7043","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"332","target":"333","id":"7842","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"209","target":"230","id":"5887","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"74","target":"289","id":"3173","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"5","target":"80","id":"1555","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"246","target":"638","id":"6508","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"170","target":"558","id":"5184","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"264","target":"491","id":"6805","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"451","target":"608","id":"9271","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"29","target":"477","id":"2136","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"197","target":"718","id":"5697","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"296","target":"655","id":"7336","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"426","target":"609","id":"8989","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"39","target":"168","id":"2360","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"151","target":"238","id":"4809","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"535","target":"542","id":"9975","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"571","target":"619","id":"10172","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"353","target":"499","id":"8119","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"95","target":"550","id":"3657","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"159","target":"638","id":"4973","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"68","target":"524","id":"3044","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"24","target":"641","id":"2011","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"561","target":"731","id":"10115","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"98","target":"197","id":"3707","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"602","target":"723","id":"10341","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"118","target":"199","id":"4113","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"148","target":"313","id":"4744","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"211","target":"451","id":"5922","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"154","target":"591","id":"4877","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"181","target":"309","id":"5391","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"569","target":"643","id":"10159","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"500","target":"574","id":"9707","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"72","target":"403","id":"3139","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"221","target":"555","id":"6107","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"130","target":"452","id":"4360","attributes":{"Weight":"1.0"},"color":"rgb(132,148,148)","size":1.0},{"source":"65","target":"670","id":"2991","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"190","target":"197","id":"5549","attributes":{"Weight":"1.0"},"color":"rgb(83,148,164)","size":1.0},{"source":"526","target":"631","id":"9906","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"186","target":"222","id":"5479","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"255","target":"556","id":"6655","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"117","target":"544","id":"4108","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"81","target":"459","id":"3332","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"9","target":"222","id":"1666","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"67","target":"524","id":"3023","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"54","target":"589","id":"2715","attributes":{"Weight":"1.0"},"color":"rgb(148,148,229)","size":1.0},{"source":"24","target":"704","id":"2013","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"86","target":"662","id":"3452","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"364","target":"690","id":"8226","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"724","target":"735","id":"10680","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"638","target":"715","id":"10492","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"122","target":"498","id":"4201","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"390","target":"393","id":"8564","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"104","target":"446","id":"3834","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"460","target":"522","id":"9357","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"440","target":"543","id":"9155","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"244","target":"417","id":"6465","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"60","target":"595","id":"2860","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"409","target":"589","id":"8803","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"579","target":"627","id":"10238","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"388","target":"617","id":"8552","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"301","target":"653","id":"7413","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"181","target":"366","id":"5392","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"154","target":"373","id":"4871","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"578","target":"690","id":"10231","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"17","target":"104","id":"1846","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"348","target":"440","id":"8051","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"624","target":"669","id":"10432","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"116","target":"460","id":"4081","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"193","target":"650","id":"5609","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"320","target":"361","id":"7676","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"204","target":"538","id":"5812","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"251","target":"656","id":"6594","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"652","target":"716","id":"10562","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"469","target":"608","id":"9451","attributes":{"Weight":"1.0"},"color":"rgb(99,148,229)","size":1.0},{"source":"43","target":"533","id":"2452","attributes":{"Weight":"1.0"},"color":"rgb(67,180,213)","size":1.0},{"source":"545","target":"557","id":"10035","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"445","target":"638","id":"9222","attributes":{"Weight":"1.0"},"color":"rgb(196,99,148)","size":1.0},{"source":"523","target":"682","id":"9883","attributes":{"Weight":"1.0"},"color":"rgb(213,67,229)","size":1.0},{"source":"277","target":"619","id":"7018","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"623","target":"687","id":"10429","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"347","target":"503","id":"8040","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"31","target":"219","id":"2173","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"175","target":"444","id":"5270","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"353","target":"552","id":"8121","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"189","target":"207","id":"5528","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"321","target":"627","id":"7692","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"60","target":"144","id":"2836","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"177","target":"261","id":"5305","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"188","target":"618","id":"5523","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"157","target":"444","id":"4931","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"105","target":"672","id":"3855","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"268","target":"395","id":"6871","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"56","target":"408","id":"2754","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"173","target":"526","id":"5243","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"258","target":"398","id":"6699","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"282","target":"683","id":"7108","attributes":{"Weight":"1.0"},"color":"rgb(83,164,148)","size":1.0},{"source":"493","target":"631","id":"9651","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"408","target":"532","id":"8780","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"73","target":"538","id":"3160","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"113","target":"407","id":"4012","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"75","target":"363","id":"3200","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"503","target":"709","id":"9732","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"168","target":"410","id":"5136","attributes":{"Weight":"1.0"},"color":"rgb(229,132,83)","size":1.0},{"source":"435","target":"655","id":"9104","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"156","target":"406","id":"4914","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"470","target":"518","id":"9462","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"384","target":"532","id":"8489","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"343","target":"563","id":"8000","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"64","target":"404","id":"2966","attributes":{"Weight":"1.0"},"color":"rgb(148,180,132)","size":1.0},{"source":"137","target":"570","id":"4510","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"47","target":"250","id":"2543","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"250","target":"556","id":"6571","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"60","target":"489","id":"2853","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"453","target":"504","id":"9282","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"641","target":"709","id":"10508","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"410","target":"558","id":"8814","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"433","target":"498","id":"9073","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"596","target":"661","id":"10308","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"429","target":"552","id":"9022","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"504","target":"578","id":"9733","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"193","target":"408","id":"5601","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"433","target":"517","id":"9074","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"256","target":"267","id":"6663","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"152","target":"388","id":"4836","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"309","target":"370","id":"7518","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"331","target":"699","id":"7840","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"183","target":"636","id":"5431","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"224","target":"642","id":"6161","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"13","target":"247","id":"1759","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"643","target":"719","id":"10515","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"364","target":"596","id":"8220","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"298","target":"471","id":"7360","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"465","target":"650","id":"9409","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"441","target":"646","id":"9170","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"399","target":"414","id":"8686","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"288","target":"527","id":"7209","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"375","target":"513","id":"8356","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"100","target":"554","id":"3758","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"212","target":"622","id":"5950","attributes":{"Weight":"1.0"},"color":"rgb(132,229,148)","size":1.0},{"source":"22","target":"120","id":"1962","attributes":{"Weight":"1.0"},"color":"rgb(229,67,99)","size":1.0},{"source":"649","target":"682","id":"10541","attributes":{"Weight":"1.0"},"color":"rgb(132,148,164)","size":1.0},{"source":"190","target":"691","id":"5566","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"257","target":"638","id":"6687","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"324","target":"548","id":"7726","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"273","target":"598","id":"6956","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"525","target":"527","id":"9895","attributes":{"Weight":"1.0"},"color":"rgb(67,196,180)","size":1.0},{"source":"609","target":"700","id":"10366","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"250","target":"402","id":"6566","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"66","target":"584","id":"3008","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"534","target":"659","id":"9969","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"233","target":"547","id":"6306","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"447","target":"452","id":"9232","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"66","target":"315","id":"3001","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"60","target":"576","id":"2859","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"220","target":"664","id":"6089","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"376","target":"547","id":"8371","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"231","target":"627","id":"6275","attributes":{"Weight":"1.0"},"color":"rgb(67,180,180)","size":1.0},{"source":"263","target":"455","id":"6786","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"144","target":"232","id":"4651","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"453","target":"596","id":"9284","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"60","target":"235","id":"2842","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"219","target":"304","id":"6068","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"61","target":"79","id":"2865","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"334","target":"499","id":"7876","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"324","target":"353","id":"7721","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"420","target":"579","id":"8909","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"106","target":"701","id":"3871","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"59","target":"449","id":"2825","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"285","target":"491","id":"7153","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"133","target":"682","id":"4432","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"49","target":"546","id":"2597","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"730","target":"734","id":"10688","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"277","target":"580","id":"7014","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"282","target":"441","id":"7100","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"76","target":"196","id":"3215","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"52","target":"427","id":"2658","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"105","target":"106","id":"3841","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"88","target":"266","id":"3490","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"269","target":"392","id":"6889","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"629","target":"719","id":"10452","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"86","target":"593","id":"3447","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"2","target":"554","id":"1505","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"650","target":"724","id":"10547","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"46","target":"481","id":"2535","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"223","target":"361","id":"6136","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"539","target":"542","id":"10002","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"203","target":"517","id":"5795","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"237","target":"622","id":"6365","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"499","target":"595","id":"9703","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"184","target":"697","id":"5455","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"27","target":"409","id":"2070","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"469","target":"600","id":"9450","attributes":{"Weight":"1.0"},"color":"rgb(99,148,229)","size":1.0},{"source":"245","target":"644","id":"6494","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"188","target":"216","id":"5511","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"143","target":"669","id":"4647","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"476","target":"530","id":"9527","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"498","target":"648","id":"9697","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"260","target":"693","id":"6749","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"566","target":"673","id":"10141","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"426","target":"464","id":"8984","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"44","target":"623","id":"2485","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"379","target":"574","id":"8413","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"200","target":"500","id":"5737","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"316","target":"591","id":"7618","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"246","target":"671","id":"6511","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"138","target":"347","id":"4521","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"254","target":"556","id":"6640","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"30","target":"102","id":"2145","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"13","target":"306","id":"1762","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"259","target":"574","id":"6722","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"154","target":"245","id":"4864","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"261","target":"572","id":"6765","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"632","target":"726","id":"10464","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"265","target":"326","id":"6818","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"527","target":"532","id":"9911","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"267","target":"355","id":"6851","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"203","target":"480","id":"5793","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"215","target":"257","id":"5985","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"416","target":"483","id":"8864","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"75","target":"200","id":"3197","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"12","target":"54","id":"1729","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"372","target":"609","id":"8316","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"152","target":"501","id":"4838","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"196","target":"425","id":"5661","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"13","target":"137","id":"1757","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"256","target":"509","id":"6672","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"234","target":"608","id":"6323","attributes":{"Weight":"1.0"},"color":"rgb(67,148,229)","size":1.0},{"source":"421","target":"649","id":"8927","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"33","target":"368","id":"2231","attributes":{"Weight":"1.0"},"color":"rgb(229,99,99)","size":1.0},{"source":"398","target":"485","id":"8668","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"296","target":"418","id":"7323","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"301","target":"535","id":"7408","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"609","target":"615","id":"10365","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"573","target":"648","id":"10191","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"235","target":"324","id":"6331","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"136","target":"152","id":"4481","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"154","target":"644","id":"4881","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"161","target":"474","id":"5004","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"68","target":"184","id":"3035","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"264","target":"725","id":"6813","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"99","target":"300","id":"3733","attributes":{"Weight":"1.0"},"color":"rgb(99,67,229)","size":1.0},{"source":"235","target":"334","id":"6332","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"461","target":"607","id":"9379","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"515","target":"680","id":"9811","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"468","target":"620","id":"9443","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"485","target":"663","id":"9581","attributes":{"Weight":"1.0"},"color":"rgb(196,67,229)","size":1.0},{"source":"553","target":"657","id":"10075","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"474","target":"485","id":"9502","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"185","target":"676","id":"5475","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"164","target":"359","id":"5062","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"288","target":"421","id":"7199","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"73","target":"516","id":"3158","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"106","target":"234","id":"3861","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"291","target":"675","id":"7271","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"53","target":"635","id":"2684","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"191","target":"607","id":"5579","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"410","target":"674","id":"8817","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"397","target":"720","id":"8664","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"90","target":"242","id":"3539","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"88","target":"578","id":"3500","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"98","target":"464","id":"3716","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"162","target":"665","id":"5033","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"178","target":"426","id":"5334","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"13","target":"78","id":"1756","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"25","target":"293","id":"2024","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"350","target":"613","id":"8084","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"250","target":"660","id":"6576","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"131","target":"216","id":"4372","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"11","target":"340","id":"1714","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"455","target":"514","id":"9309","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"172","target":"707","id":"5231","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"214","target":"344","id":"5976","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"236","target":"595","id":"6352","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"299","target":"542","id":"7380","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"67","target":"497","id":"3021","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"311","target":"707","id":"7555","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"157","target":"301","id":"4928","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"67","target":"302","id":"3019","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"262","target":"362","id":"6776","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"53","target":"198","id":"2674","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"161","target":"715","id":"5013","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"6","target":"470","id":"1592","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"580","target":"703","id":"10246","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"422","target":"622","id":"8939","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"91","target":"544","id":"3570","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"50","target":"572","id":"2624","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"66","target":"253","id":"2997","attributes":{"Weight":"1.0"},"color":"rgb(148,132,164)","size":1.0},{"source":"192","target":"599","id":"5594","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"62","target":"265","id":"2908","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"138","target":"664","id":"4530","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"350","target":"566","id":"8082","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"179","target":"667","id":"5364","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"93","target":"652","id":"3615","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"52","target":"367","id":"2655","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"70","target":"212","id":"3086","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"454","target":"498","id":"9297","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"725","target":"734","id":"10683","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"69","target":"491","id":"3071","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"390","target":"395","id":"8566","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"423","target":"660","id":"8947","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"15","target":"722","id":"1820","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"497","target":"524","id":"9679","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"420","target":"627","id":"8911","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"5","target":"583","id":"1575","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"223","target":"445","id":"6138","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"322","target":"671","id":"7704","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"22","target":"641","id":"1972","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"347","target":"520","id":"8041","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"98","target":"700","id":"3723","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"143","target":"263","id":"4630","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"607","target":"634","id":"10359","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"430","target":"607","id":"9034","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"85","target":"224","id":"3412","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"262","target":"445","id":"6777","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"379","target":"587","id":"8414","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"459","target":"686","id":"9356","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"24","target":"51","id":"2000","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"379","target":"500","id":"8410","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"452","target":"675","id":"9281","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"30","target":"228","id":"2150","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"120","target":"236","id":"4155","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"72","target":"115","id":"3130","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"175","target":"187","id":"5263","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"144","target":"460","id":"4662","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"220","target":"437","id":"6084","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"283","target":"399","id":"7125","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"408","target":"685","id":"8787","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"44","target":"203","id":"2464","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"186","target":"305","id":"5483","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"178","target":"329","id":"5330","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"120","target":"710","id":"4169","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"175","target":"299","id":"5265","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"154","target":"349","id":"4869","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"95","target":"727","id":"3663","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"139","target":"398","id":"4542","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"193","target":"264","id":"5596","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"195","target":"296","id":"5638","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"367","target":"536","id":"8258","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"207","target":"484","id":"5866","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"311","target":"612","id":"7548","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"91","target":"126","id":"3555","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"233","target":"280","id":"6296","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"22","target":"25","id":"1959","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"443","target":"644","id":"9204","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"421","target":"604","id":"8926","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"353","target":"710","id":"8123","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"101","target":"362","id":"3777","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"33","target":"239","id":"2221","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"215","target":"271","id":"5988","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"562","target":"565","id":"10116","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"60","target":"186","id":"2838","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"379","target":"691","id":"8417","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"238","target":"616","id":"6382","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"491","target":"521","id":"9622","attributes":{"Weight":"1.0"},"color":"rgb(148,83,229)","size":1.0},{"source":"332","target":"428","id":"7843","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"372","target":"718","id":"8319","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"50","target":"349","id":"2614","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"707","target":"726","id":"10669","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"650","target":"651","id":"10545","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"236","target":"353","id":"6345","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"119","target":"588","id":"4146","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"35","target":"137","id":"2269","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"330","target":"377","id":"7811","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"187","target":"455","id":"5501","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"256","target":"317","id":"6667","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"123","target":"622","id":"4226","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"231","target":"547","id":"6268","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"635","target":"688","id":"10476","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"130","target":"366","id":"4356","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"172","target":"386","id":"5215","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"300","target":"662","id":"7398","attributes":{"Weight":"1.0"},"color":"rgb(99,99,229)","size":1.0},{"source":"96","target":"554","id":"3680","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"343","target":"360","id":"7993","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"415","target":"668","id":"8853","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"286","target":"333","id":"7167","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"115","target":"403","id":"4055","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"462","target":"487","id":"9383","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"280","target":"287","id":"7055","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"38","target":"240","id":"2339","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"162","target":"692","id":"5035","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"319","target":"555","id":"7666","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"565","target":"594","id":"10133","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"28","target":"337","id":"2104","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"608","target":"642","id":"10362","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"64","target":"416","id":"2967","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"1","target":"582","id":"1480","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"172","target":"311","id":"5213","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"227","target":"629","id":"6211","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"384","target":"527","id":"8488","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"63","target":"160","id":"2926","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"109","target":"152","id":"3911","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"283","target":"731","id":"7136","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"388","target":"506","id":"8548","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"597","target":"649","id":"10315","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"584","target":"666","id":"10262","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"140","target":"311","id":"4560","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"80","target":"139","id":"3305","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"107","target":"420","id":"3881","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"102","target":"236","id":"3789","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"135","target":"145","id":"4450","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"160","target":"161","id":"4980","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"219","target":"369","id":"6071","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"42","target":"286","id":"2421","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"203","target":"498","id":"5794","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"472","target":"604","id":"9485","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"251","target":"400","id":"6585","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"381","target":"543","id":"8439","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"350","target":"496","id":"8079","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"189","target":"445","id":"5541","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"195","target":"655","id":"5651","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"381","target":"421","id":"8429","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"371","target":"646","id":"8304","attributes":{"Weight":"1.0"},"color":"rgb(148,83,213)","size":1.0},{"source":"319","target":"368","id":"7656","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"268","target":"405","id":"6873","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"162","target":"661","id":"5032","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"297","target":"639","id":"7347","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"580","target":"652","id":"10245","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"92","target":"98","id":"3574","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"250","target":"696","id":"6579","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"76","target":"498","id":"3226","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"533","target":"662","id":"9964","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"438","target":"689","id":"9133","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"365","target":"476","id":"8234","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"264","target":"650","id":"6808","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"378","target":"488","id":"8397","attributes":{"Weight":"1.0"},"color":"rgb(148,180,148)","size":1.0},{"source":"253","target":"558","id":"6626","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"452","target":"482","id":"9276","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"47","target":"251","id":"2544","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"155","target":"685","id":"4904","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"320","target":"354","id":"7675","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"346","target":"520","id":"8031","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"19","target":"46","id":"1888","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"515","target":"541","id":"9809","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"333","target":"652","id":"7866","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"102","target":"368","id":"3795","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"215","target":"610","id":"5997","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"109","target":"448","id":"3920","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"104","target":"355","id":"3832","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"44","target":"611","id":"2483","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"54","target":"424","id":"2706","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"97","target":"218","id":"3688","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"109","target":"163","id":"3912","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"85","target":"187","id":"3411","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"497","target":"688","id":"9686","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"121","target":"165","id":"4172","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"122","target":"611","id":"4205","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"35","target":"247","id":"2271","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"619","target":"703","id":"10411","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"25","target":"158","id":"2020","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"432","target":"698","id":"9067","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"332","target":"619","id":"7851","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"64","target":"483","id":"2970","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"397","target":"572","id":"8656","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"18","target":"272","id":"1871","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"10","target":"366","id":"1696","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"44","target":"517","id":"2478","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"88","target":"721","id":"3510","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"308","target":"576","id":"7506","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"570","target":"598","id":"10164","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"320","target":"445","id":"7679","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"200","target":"593","id":"5743","attributes":{"Weight":"1.0"},"color":"rgb(148,196,83)","size":1.0},{"source":"55","target":"157","id":"2726","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"54","target":"131","id":"2692","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"154","target":"555","id":"4874","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"155","target":"397","id":"4896","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"271","target":"692","id":"6930","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"334","target":"429","id":"7873","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"22","target":"48","id":"1960","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"275","target":"295","id":"6974","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"241","target":"596","id":"6422","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"136","target":"550","id":"4493","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"128","target":"163","id":"4307","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"280","target":"586","id":"7068","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"93","target":"580","id":"3610","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"111","target":"719","id":"3984","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"372","target":"536","id":"8313","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"360","target":"550","id":"8187","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"45","target":"404","id":"2502","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"43","target":"520","id":"2451","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"125","target":"422","id":"4255","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"84","target":"217","id":"3393","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"475","target":"623","id":"9520","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"553","target":"621","id":"10071","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"130","target":"457","id":"4361","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"1","target":"195","id":"1468","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"400","target":"656","id":"8702","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"371","target":"591","id":"8299","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"69","target":"193","id":"3057","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"294","target":"572","id":"7303","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"579","target":"593","id":"10236","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"69","target":"730","id":"3081","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"111","target":"572","id":"3979","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"72","target":"383","id":"3138","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"28","target":"533","id":"2114","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"41","target":"78","id":"2395","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"159","target":"302","id":"4965","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"430","target":"486","id":"9031","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"308","target":"434","id":"7502","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"27","target":"583","id":"2079","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"395","target":"413","id":"8636","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"721","target":"723","id":"10675","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"128","target":"378","id":"4313","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"251","target":"402","id":"6587","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"274","target":"585","id":"6968","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"597","target":"691","id":"10316","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"11","target":"347","id":"1716","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"352","target":"486","id":"8108","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"386","target":"575","id":"8523","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"5","target":"616","id":"1577","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"50","target":"629","id":"2626","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"215","target":"453","id":"5992","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"131","target":"286","id":"4374","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"238","target":"258","id":"6368","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"67","target":"636","id":"3027","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"2","target":"181","id":"1495","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"128","target":"448","id":"4315","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"281","target":"465","id":"7081","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"424","target":"537","id":"8956","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"185","target":"226","id":"5459","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"231","target":"238","id":"6259","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"243","target":"733","id":"6458","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"575","target":"603","id":"10204","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"143","target":"444","id":"4637","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"496","target":"606","id":"9671","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"5","target":"491","id":"1571","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"109","target":"588","id":"3925","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"365","target":"375","id":"8231","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"342","target":"587","id":"7985","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"272","target":"664","id":"6944","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"140","target":"707","id":"4584","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"195","target":"494","id":"5643","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"91","target":"375","id":"3564","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"612","target":"616","id":"10381","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"673","target":"714","id":"10614","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"473","target":"565","id":"9496","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"374","target":"678","id":"8348","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"243","target":"640","id":"6452","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"218","target":"526","id":"6057","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"203","target":"385","id":"5788","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"349","target":"489","id":"8067","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"477","target":"620","id":"9535","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"329","target":"351","id":"7795","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"109","target":"343","id":"3916","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"65","target":"138","id":"2976","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"250","target":"255","id":"6562","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"259","target":"379","id":"6715","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"288","target":"522","id":"7206","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"134","target":"406","id":"4442","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"169","target":"652","id":"5168","attributes":{"Weight":"1.0"},"color":"rgb(148,196,67)","size":1.0},{"source":"373","target":"572","id":"8322","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"85","target":"717","id":"3430","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"180","target":"332","id":"5374","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"163","target":"712","id":"5054","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"333","target":"619","id":"7865","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"324","target":"595","id":"7728","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"43","target":"709","id":"2457","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"238","target":"576","id":"6378","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"85","target":"331","id":"3418","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"225","target":"645","id":"6181","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"342","target":"706","id":"7991","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"84","target":"705","id":"3405","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"185","target":"240","id":"5460","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"400","target":"696","id":"8706","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"343","target":"727","id":"8004","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"131","target":"601","id":"4388","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"15","target":"655","id":"1819","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"154","target":"642","id":"4879","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"230","target":"445","id":"6254","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"559","target":"658","id":"10108","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"467","target":"584","id":"9432","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"97","target":"722","id":"3704","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"9","target":"120","id":"1663","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"288","target":"604","id":"7216","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"536","target":"609","id":"9982","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"114","target":"127","id":"4022","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"14","target":"363","id":"1784","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"169","target":"509","id":"5161","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"209","target":"262","id":"5889","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"294","target":"371","id":"7295","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"303","target":"573","id":"7440","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"573","target":"611","id":"10187","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"288","target":"565","id":"7212","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"576","target":"603","id":"10211","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"261","target":"419","id":"6757","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"359","target":"607","id":"8177","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"273","target":"284","id":"6947","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"75","target":"649","id":"3210","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"418","target":"585","id":"8886","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"46","target":"452","id":"2532","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"37","target":"321","id":"2315","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"268","target":"559","id":"6878","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"144","target":"713","id":"4673","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"470","target":"620","id":"9464","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"261","target":"319","id":"6754","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"265","target":"513","id":"6825","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"209","target":"362","id":"5894","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"137","target":"204","id":"4500","attributes":{"Weight":"1.0"},"color":"rgb(99,213,148)","size":1.0},{"source":"77","target":"81","id":"3241","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"327","target":"385","id":"7760","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"10","target":"554","id":"1700","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"37","target":"627","id":"2324","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"125","target":"461","id":"4259","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"123","target":"291","id":"4216","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"7","target":"602","id":"1617","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"9","target":"552","id":"1679","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"111","target":"154","id":"3961","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"244","target":"338","id":"6461","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"506","target":"550","id":"9752","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"296","target":"585","id":"7332","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"227","target":"231","id":"6195","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"292","target":"568","id":"7275","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"534","target":"613","id":"9968","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"15","target":"605","id":"1817","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"115","target":"200","id":"4049","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"128","target":"343","id":"4311","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"69","target":"337","id":"3062","attributes":{"Weight":"1.0"},"color":"rgb(67,116,229)","size":1.0},{"source":"222","target":"548","id":"6126","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"324","target":"429","id":"7723","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"198","target":"636","id":"5708","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"236","target":"334","id":"6344","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"432","target":"571","id":"9060","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"28","target":"84","id":"2091","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"418","target":"435","id":"8879","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"305","target":"710","id":"7473","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"132","target":"207","id":"4398","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"300","target":"455","id":"7390","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"177","target":"591","id":"5318","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"85","target":"145","id":"3408","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"1","target":"15","id":"1464","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"168","target":"531","id":"5141","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"549","target":"609","id":"10056","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"203","target":"327","id":"5786","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"345","target":"566","id":"8018","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"339","target":"690","id":"7948","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"281","target":"382","id":"7078","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"65","target":"437","id":"2985","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"589","target":"623","id":"10281","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"383","target":"691","id":"8480","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"440","target":"589","id":"9159","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"43","target":"503","id":"2450","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"333","target":"571","id":"7859","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"341","target":"406","id":"7967","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"375","target":"530","id":"8357","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"47","target":"660","id":"2560","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"76","target":"381","id":"3218","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"150","target":"606","id":"4796","attributes":{"Weight":"1.0"},"color":"rgb(213,67,213)","size":1.0},{"source":"108","target":"296","id":"3894","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"55","target":"432","id":"2734","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"258","target":"668","id":"6710","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"434","target":"583","id":"9090","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"38","target":"486","id":"2347","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"371","target":"643","id":"8302","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"27","target":"434","id":"2073","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"183","target":"308","id":"5420","attributes":{"Weight":"1.0"},"color":"rgb(99,229,99)","size":1.0},{"source":"336","target":"360","id":"7898","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"286","target":"619","id":"7176","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"573","target":"577","id":"10186","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"131","target":"381","id":"4378","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"43","target":"387","id":"2446","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"313","target":"471","id":"7572","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"124","target":"484","id":"4245","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"98","target":"178","id":"3706","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"185","target":"449","id":"5465","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"415","target":"713","id":"8855","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"40","target":"306","id":"2383","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"435","target":"585","id":"9101","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"92","target":"372","id":"3582","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"473","target":"589","id":"9497","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"135","target":"699","id":"4478","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"244","target":"350","id":"6463","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"87","target":"381","id":"3459","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"143","target":"299","id":"4631","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"84","target":"626","id":"3402","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"249","target":"482","id":"6553","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"519","target":"631","id":"9845","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"484","target":"701","id":"9574","attributes":{"Weight":"1.0"},"color":"rgb(148,99,148)","size":1.0},{"source":"437","target":"664","id":"9121","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"408","target":"679","id":"8786","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"171","target":"613","id":"5206","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"180","target":"716","id":"5387","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"396","target":"633","id":"8650","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"312","target":"688","id":"7565","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"323","target":"431","id":"7709","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"329","target":"492","id":"7802","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"436","target":"586","id":"9112","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"270","target":"524","id":"6908","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"129","target":"226","id":"4333","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"33","target":"529","id":"2239","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"424","target":"600","id":"8958","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"150","target":"646","id":"4800","attributes":{"Weight":"1.0"},"color":"rgb(148,83,213)","size":1.0},{"source":"409","target":"425","id":"8790","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"62","target":"90","id":"2900","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"230","target":"354","id":"6251","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"547","target":"627","id":"10048","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"273","target":"389","id":"6951","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"89","target":"639","id":"3528","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"285","target":"466","id":"7152","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"398","target":"474","id":"8667","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"25","target":"732","id":"2033","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"657","target":"726","id":"10579","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"319","target":"450","id":"7660","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"146","target":"326","id":"4710","attributes":{"Weight":"1.0"},"color":"rgb(83,180,148)","size":1.0},{"source":"44","target":"385","id":"2471","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"161","target":"257","id":"5000","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"137","target":"389","id":"4507","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"186","target":"548","id":"5491","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"385","target":"454","id":"8502","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"82","target":"611","id":"3362","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"455","target":"539","id":"9311","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"372","target":"615","id":"8317","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"92","target":"329","id":"3579","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"265","target":"476","id":"6823","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"316","target":"454","id":"7613","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"121","target":"226","id":"4178","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"176","target":"178","id":"5282","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"647","target":"729","id":"10535","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"402","target":"694","id":"8728","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"329","target":"426","id":"7798","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"227","target":"294","id":"6198","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"164","target":"644","id":"5071","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"287","target":"450","id":"7184","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"113","target":"146","id":"4005","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"164","target":"373","id":"5064","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"401","target":"410","id":"8708","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"363","target":"383","id":"8203","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"90","target":"502","id":"3547","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"33","target":"101","id":"2209","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"409","target":"523","id":"8798","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"21","target":"732","id":"1955","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"215","target":"445","id":"5991","attributes":{"Weight":"1.0"},"color":"rgb(196,180,67)","size":1.0},{"source":"521","target":"523","id":"9853","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"438","target":"441","id":"9124","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"125","target":"416","id":"4254","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"591","target":"720","id":"10295","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"485","target":"638","id":"9578","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"251","target":"545","id":"6590","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"330","target":"390","id":"7812","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"177","target":"685","id":"5325","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"516","target":"636","id":"9817","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"225","target":"642","id":"6180","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"288","target":"562","id":"7211","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"379","target":"383","id":"8408","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"520","target":"670","id":"9851","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"439","target":"540","id":"9140","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"196","target":"523","id":"5667","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"539","target":"698","id":"10006","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"628","target":"709","id":"10448","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"210","target":"662","id":"5910","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"104","target":"510","id":"3836","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"137","target":"192","id":"4499","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"19","target":"370","id":"1899","attributes":{"Weight":"1.0"},"color":"rgb(132,148,148)","size":1.0},{"source":"212","target":"424","id":"5939","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"275","target":"509","id":"6983","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"500","target":"597","id":"9709","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"331","target":"676","id":"7839","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"94","target":"606","id":"3633","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"271","target":"723","id":"6933","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"667","target":"685","id":"10604","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"95","target":"336","id":"3648","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"201","target":"489","id":"5759","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"260","target":"572","id":"6739","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"116","target":"434","id":"4080","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"381","target":"644","id":"8447","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"442","target":"623","id":"9191","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"84","target":"662","id":"3404","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"52","target":"609","id":"2665","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"424","target":"451","id":"8952","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"35","target":"78","id":"2268","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"279","target":"591","id":"7050","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"303","target":"583","id":"7443","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"318","target":"357","id":"7638","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"16","target":"540","id":"1834","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"355","target":"592","id":"8137","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"110","target":"238","id":"3938","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"95","target":"152","id":"3643","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"274","target":"519","id":"6964","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"522","target":"685","id":"9873","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"136","target":"727","id":"4498","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"93","target":"333","id":"3604","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"611","target":"648","id":"10377","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"88","target":"572","id":"3499","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"460","target":"528","id":"9359","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"433","target":"442","id":"9069","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"54","target":"487","id":"2712","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"21","target":"540","id":"1948","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"142","target":"444","id":"4614","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"254","target":"423","id":"6638","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"649","target":"702","id":"10543","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"79","target":"721","id":"3303","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"529","target":"720","id":"9943","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"227","target":"238","id":"6196","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"510","target":"546","id":"9782","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"491","target":"730","id":"9632","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"88","target":"661","id":"3505","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"35","target":"66","id":"2267","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"403","target":"587","id":"8734","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"181","target":"304","id":"5390","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"147","target":"469","id":"4731","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"294","target":"432","id":"7299","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"303","target":"308","id":"7431","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"103","target":"169","id":"3805","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"159","target":"160","id":"4959","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"167","target":"634","id":"5128","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"233","target":"289","id":"6297","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"621","target":"726","id":"10422","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"40","target":"192","id":"2379","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"252","target":"622","id":"6612","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"255","target":"557","id":"6656","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"393","target":"395","id":"8608","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"127","target":"474","id":"4293","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"335","target":"583","id":"7888","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"142","target":"143","id":"4604","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"119","target":"343","id":"4137","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"184","target":"684","id":"5453","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"493","target":"624","id":"9650","attributes":{"Weight":"1.0"},"color":"rgb(99,115,229)","size":1.0},{"source":"433","target":"454","id":"9070","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"219","target":"366","id":"6070","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"545","target":"722","id":"10042","attributes":{"Weight":"1.0"},"color":"rgb(148,115,164)","size":1.0},{"source":"320","target":"484","id":"7681","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"401","target":"674","id":"8716","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"64","target":"230","id":"2956","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"138","target":"709","id":"4532","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"211","target":"645","id":"5931","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"133","target":"507","id":"4425","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"418","target":"655","id":"8889","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"351","target":"536","id":"8096","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"340","target":"520","id":"7959","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"231","target":"348","id":"6265","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"577","target":"623","id":"10219","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"403","target":"574","id":"8733","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"20","target":"134","id":"1915","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"472","target":"649","id":"9486","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"311","target":"567","id":"7547","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"40","target":"599","id":"2392","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"203","target":"656","id":"5803","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"453","target":"665","id":"9288","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"340","target":"664","id":"7962","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"534","target":"673","id":"9971","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"220","target":"346","id":"6080","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"326","target":"365","id":"7748","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"418","target":"493","id":"8880","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"203","target":"573","id":"5797","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"524","target":"633","id":"9886","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"95","target":"378","id":"3651","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"465","target":"725","id":"9413","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"355","target":"581","id":"8136","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"164","target":"227","id":"5057","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"374","target":"648","id":"8347","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"121","target":"168","id":"4175","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"24","target":"120","id":"2001","attributes":{"Weight":"1.0"},"color":"rgb(229,67,99)","size":1.0},{"source":"606","target":"713","id":"10357","attributes":{"Weight":"1.0"},"color":"rgb(132,148,180)","size":1.0},{"source":"340","target":"628","id":"7961","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"606","target":"613","id":"10352","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"305","target":"368","id":"7466","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"648","target":"687","id":"10540","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"343","target":"506","id":"7998","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"207","target":"483","id":"5865","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"190","target":"505","id":"5560","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"150","target":"643","id":"4798","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"48","target":"292","id":"2568","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"483","target":"565","id":"9571","attributes":{"Weight":"1.0"},"color":"rgb(229,99,148)","size":1.0},{"source":"122","target":"327","id":"4193","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"647","target":"651","id":"10531","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"496","target":"507","id":"9668","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"43","target":"118","id":"2438","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"112","target":"132","id":"3987","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"279","target":"431","id":"7041","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"114","target":"523","id":"4035","attributes":{"Weight":"1.0"},"color":"rgb(196,67,229)","size":1.0},{"source":"461","target":"711","id":"9382","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"183","target":"524","id":"5426","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"278","target":"321","id":"7023","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"647","target":"689","id":"10532","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"547","target":"699","id":"10050","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"366","target":"701","id":"8251","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"215","target":"692","id":"6002","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"11","target":"437","id":"1719","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"186","target":"228","id":"5480","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"32","target":"47","id":"2185","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"411","target":"731","id":"8827","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"17","target":"295","id":"1853","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"588","target":"617","id":"10276","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"91","target":"134","id":"3556","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"9","target":"305","id":"1670","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"565","target":"661","id":"10135","attributes":{"Weight":"1.0"},"color":"rgb(196,148,148)","size":1.0},{"source":"44","target":"227","id":"2465","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"57","target":"421","id":"2775","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"566","target":"714","id":"10143","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"522","target":"707","id":"9874","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"4","target":"220","id":"1539","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"233","target":"586","id":"6308","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"212","target":"425","id":"5940","attributes":{"Weight":"1.0"},"color":"rgb(148,148,229)","size":1.0},{"source":"440","target":"654","id":"9162","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"612","target":"654","id":"10383","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"426","target":"615","id":"8990","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"371","target":"373","id":"8291","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"37","target":"488","id":"2319","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"279","target":"490","id":"7044","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"155","target":"719","id":"4905","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"63","target":"697","id":"2943","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"260","target":"578","id":"6740","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"115","target":"649","id":"4062","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"227","target":"245","id":"6197","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"124","target":"483","id":"4244","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"431","target":"529","id":"9043","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"137","target":"247","id":"4501","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"7","target":"266","id":"1607","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"301","target":"539","id":"7409","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"98","target":"615","id":"3722","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"494","target":"655","id":"9661","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"140","target":"177","id":"4558","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"90","target":"513","id":"3548","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"216","target":"332","id":"6009","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"258","target":"603","id":"6707","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"392","target":"731","id":"8606","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"518","target":"680","id":"9838","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"127","target":"297","id":"4290","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"39","target":"185","id":"2361","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"299","target":"431","id":"7372","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"262","target":"361","id":"6775","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"100","target":"366","id":"3754","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"57","target":"425","id":"2776","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"244","target":"673","id":"6474","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"227","target":"717","id":"6214","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"313","target":"458","id":"7568","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"141","target":"449","id":"4595","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"84","target":"146","id":"3390","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"209","target":"223","id":"5886","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"394","target":"405","id":"8622","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"390","target":"559","id":"8573","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"6","target":"471","id":"1593","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"321","target":"340","id":"7685","attributes":{"Weight":"1.0"},"color":"rgb(67,180,213)","size":1.0},{"source":"208","target":"298","id":"5868","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"97","target":"494","id":"3695","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"204","target":"312","id":"5808","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"204","target":"633","id":"5813","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"609","target":"718","id":"10367","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"708","target":"732","id":"10670","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"181","target":"554","id":"5396","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"46","target":"478","id":"2534","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"441","target":"689","id":"9174","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"335","target":"668","id":"7892","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"188","target":"333","id":"5515","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"408","target":"527","id":"8779","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"64","target":"214","id":"2954","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"597","target":"706","id":"10318","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"91","target":"513","id":"3568","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"83","target":"217","id":"3375","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"196","target":"663","id":"5676","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"499","target":"710","id":"9704","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"562","target":"663","id":"10123","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"509","target":"581","id":"9780","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"302","target":"714","id":"7429","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"380","target":"666","id":"8427","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"271","target":"578","id":"6922","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"600","target":"631","id":"10323","attributes":{"Weight":"1.0"},"color":"rgb(67,196,229)","size":1.0},{"source":"414","target":"560","id":"8842","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"73","target":"684","id":"3165","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"165","target":"167","id":"5077","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"100","target":"106","id":"3746","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"344","target":"361","id":"8006","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"239","target":"362","id":"6392","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"46","target":"64","id":"2519","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"88","target":"260","id":"3488","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"78","target":"284","id":"3265","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"50","target":"529","id":"2622","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"238","target":"575","id":"6377","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"521","target":"728","id":"9862","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"509","target":"510","id":"9777","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"12","target":"70","id":"1730","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"224","target":"289","id":"6145","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"557","target":"656","id":"10096","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"33","target":"223","id":"2219","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"354","target":"445","id":"8126","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"16","target":"48","id":"1826","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"532","target":"612","id":"9951","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"235","target":"236","id":"6329","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"38","target":"607","id":"2351","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"152","target":"727","id":"4845","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"236","target":"548","id":"6350","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"476","target":"683","id":"9530","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"304","target":"672","id":"7461","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"322","target":"485","id":"7697","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"180","target":"618","id":"5383","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"213","target":"544","id":"5967","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"354","target":"512","id":"8129","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"33","target":"512","id":"2238","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"208","target":"310","id":"5870","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"266","target":"721","id":"6844","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"111","target":"629","id":"3981","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"555","target":"726","id":"10087","attributes":{"Weight":"1.0"},"color":"rgb(115,148,229)","size":1.0},{"source":"120","target":"334","id":"4159","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"61","target":"338","id":"2877","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"93","target":"593","id":"3611","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"213","target":"375","id":"5961","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"150","target":"528","id":"4790","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"409","target":"421","id":"8789","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"416","target":"478","id":"8861","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"356","target":"656","id":"8147","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"338","target":"659","id":"7934","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"115","target":"597","id":"4061","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"413","target":"658","id":"8839","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"238","target":"603","id":"6381","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"406","target":"502","id":"8763","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"404","target":"670","id":"8751","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"397","target":"643","id":"8659","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"299","target":"469","id":"7376","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"190","target":"403","id":"5558","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"414","target":"559","id":"8841","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"27","target":"629","id":"2082","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"42","target":"211","id":"2418","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"539","target":"624","id":"10003","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"30","target":"548","id":"2161","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"103","target":"256","id":"3807","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"91","target":"117","id":"3554","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"52","target":"98","id":"2648","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"36","target":"598","id":"2302","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"356","target":"558","id":"8146","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"338","target":"396","id":"7926","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"453","target":"692","id":"9290","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"155","target":"294","id":"4890","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"398","target":"553","id":"8669","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"222","target":"305","id":"6118","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"649","target":"706","id":"10544","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"640","target":"641","id":"10499","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"11","target":"590","id":"1723","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"24","target":"293","id":"2006","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"44","target":"687","id":"2489","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"178","target":"615","id":"5343","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"434","target":"491","id":"9086","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"641","target":"708","id":"10507","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"620","target":"686","id":"10414","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"385","target":"480","id":"8504","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"30","target":"222","id":"2149","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"75","target":"115","id":"3194","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"226","target":"359","id":"6185","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"227","target":"627","id":"6210","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"181","target":"701","id":"5399","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"93","target":"277","id":"3601","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"441","target":"729","id":"9177","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"410","target":"556","id":"8812","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"351","target":"492","id":"8095","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"398","target":"430","id":"8665","attributes":{"Weight":"1.0"},"color":"rgb(196,132,148)","size":1.0},{"source":"88","target":"596","id":"3502","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"49","target":"198","id":"2583","attributes":{"Weight":"1.0"},"color":"rgb(99,229,67)","size":1.0},{"source":"430","target":"531","id":"9032","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"419","target":"643","id":"8904","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"328","target":"492","id":"7786","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"111","target":"371","id":"3971","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"229","target":"509","id":"6241","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"469","target":"698","id":"9456","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"135","target":"376","id":"4463","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"70","target":"462","id":"3098","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"272","target":"709","id":"6946","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"434","target":"575","id":"9088","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"261","target":"287","id":"6753","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"224","target":"331","id":"6148","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"123","target":"422","id":"4218","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"176","target":"372","id":"5288","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"134","target":"213","id":"4435","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"5","target":"521","id":"1572","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"402","target":"556","id":"8722","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"416","target":"422","id":"8856","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"182","target":"278","id":"5402","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"346","target":"503","id":"8030","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"113","target":"210","id":"4007","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"300","target":"624","id":"7396","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"623","target":"678","id":"10428","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"394","target":"413","id":"8625","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"114","target":"639","id":"4040","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"326","target":"681","id":"7756","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"172","target":"677","id":"5227","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"13","target":"380","id":"1764","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"246","target":"715","id":"6513","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"151","target":"280","id":"4811","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"360","target":"712","id":"8191","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"197","target":"351","id":"5683","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"88","target":"504","id":"3498","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"68","target":"516","id":"3043","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"275","target":"510","id":"6984","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"151","target":"279","id":"4810","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"146","target":"278","id":"4707","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"79","target":"433","id":"3287","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"145","target":"327","id":"4682","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"170","target":"557","id":"5183","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"21","target":"428","id":"1945","attributes":{"Weight":"1.0"},"color":"rgb(229,115,67)","size":1.0},{"source":"63","target":"398","id":"2933","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"203","target":"648","id":"5802","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"24","target":"640","id":"2010","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"46","target":"447","id":"2530","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"19","target":"675","id":"1909","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"475","target":"577","id":"9517","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"106","target":"554","id":"3868","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"298","target":"686","id":"7368","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"118","target":"503","id":"4122","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"232","target":"254","id":"6280","attributes":{"Weight":"1.0"},"color":"rgb(148,148,116)","size":1.0},{"source":"470","target":"515","id":"9461","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"231","target":"303","id":"6261","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"438","target":"651","id":"9131","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"155","target":"166","id":"4887","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"469","target":"631","id":"9453","attributes":{"Weight":"1.0"},"color":"rgb(99,115,229)","size":1.0},{"source":"394","target":"395","id":"8620","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"462","target":"726","id":"9390","attributes":{"Weight":"1.0"},"color":"rgb(115,148,229)","size":1.0},{"source":"344","target":"362","id":"8007","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"192","target":"306","id":"5585","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"566","target":"606","id":"10138","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"299","target":"300","id":"7369","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"461","target":"565","id":"9378","attributes":{"Weight":"1.0"},"color":"rgb(229,132,148)","size":1.0},{"source":"27","target":"668","id":"2083","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"33","target":"483","id":"2235","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"275","target":"276","id":"6973","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"307","target":"310","id":"7484","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"461","target":"483","id":"9375","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"287","target":"555","id":"7189","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"300","target":"535","id":"7393","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"238","target":"586","id":"6380","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"307","target":"470","id":"7489","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"135","target":"323","id":"4459","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"89","target":"657","id":"3529","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"342","target":"586","id":"7984","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"367","target":"718","id":"8264","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"107","target":"533","id":"3883","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"110","target":"644","id":"3955","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"39","target":"166","id":"2358","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"119","target":"206","id":"4134","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"342","target":"379","id":"7976","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"187","target":"624","id":"5507","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"384","target":"460","id":"8486","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"22","target":"695","id":"1973","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"216","target":"580","id":"6018","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"151","target":"224","id":"4805","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"445","target":"512","id":"9221","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"28","target":"529","id":"2113","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"20","target":"156","id":"1916","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"145","target":"529","id":"4693","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"92","target":"609","id":"3591","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"46","target":"483","id":"2537","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"424","target":"517","id":"8955","attributes":{"Weight":"1.0"},"color":"rgb(67,229,196)","size":1.0},{"source":"9","target":"499","id":"1677","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"271","target":"596","id":"6923","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"477","target":"479","id":"9531","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"130","target":"672","id":"4368","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"212","target":"451","id":"5943","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"315","target":"495","id":"7600","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"170","target":"410","id":"5179","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"629","target":"720","id":"10453","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"268","target":"269","id":"6861","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"558","target":"656","id":"10101","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"26","target":"249","id":"2043","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"269","target":"412","id":"6896","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"35","target":"666","id":"2284","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"1","target":"205","id":"1469","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"303","target":"576","id":"7442","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"69","target":"264","id":"3058","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"284","target":"598","id":"7145","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"145","target":"443","id":"4689","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"37","target":"533","id":"2320","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"175","target":"300","id":"5266","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"245","target":"720","id":"6496","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"203","target":"687","id":"5805","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"253","target":"423","id":"6622","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"381","target":"425","id":"8430","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"114","target":"671","id":"4043","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"221","target":"608","id":"6111","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"316","target":"721","id":"7626","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"127","target":"398","id":"4292","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"243","target":"708","id":"6456","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"44","target":"327","id":"2468","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"199","target":"590","id":"5726","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"601","target":"655","id":"10330","attributes":{"Weight":"1.0"},"color":"rgb(148,164,148)","size":1.0},{"source":"127","target":"553","id":"4295","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"277","target":"537","id":"7012","attributes":{"Weight":"1.0"},"color":"rgb(148,196,83)","size":1.0},{"source":"13","target":"666","id":"1772","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"297","target":"657","id":"7348","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"197","target":"464","id":"5689","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"50","target":"373","id":"2617","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"488","target":"627","id":"9599","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"583","target":"654","id":"10256","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"99","target":"105","id":"3726","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"61","target":"316","id":"2874","attributes":{"Weight":"1.0"},"color":"rgb(213,67,213)","size":1.0},{"source":"47","target":"402","id":"2552","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"502","target":"513","id":"9721","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"71","target":"321","id":"3117","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"571","target":"716","id":"10177","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"590","target":"628","id":"10286","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"36","target":"192","id":"2290","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"60","target":"102","id":"2833","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"297","target":"474","id":"7341","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"131","target":"719","id":"4396","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"322","target":"621","id":"7699","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"409","target":"663","id":"8807","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"678","target":"721","id":"10626","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"3","target":"461","id":"1525","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"198","target":"497","id":"5702","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"123","target":"558","id":"4225","attributes":{"Weight":"1.0"},"color":"rgb(213,148,83)","size":1.0},{"source":"62","target":"530","id":"2917","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"140","target":"527","id":"4572","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"162","target":"602","id":"5030","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"473","target":"543","id":"9494","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"170","target":"250","id":"5170","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"419","target":"429","id":"8892","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"702","target":"706","id":"10664","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"454","target":"721","id":"9307","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"142","target":"660","id":"4623","attributes":{"Weight":"1.0"},"color":"rgb(180,67,164)","size":1.0},{"source":"467","target":"598","id":"9433","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"117","target":"213","id":"4096","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"218","target":"418","id":"6050","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"20","target":"341","id":"1921","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"363","target":"505","id":"8207","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"214","target":"262","id":"5974","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"114","target":"715","id":"4045","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"158","target":"733","id":"4958","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"417","target":"566","id":"8872","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"451","target":"600","id":"9270","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"38","target":"191","id":"2337","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"576","target":"668","id":"10215","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"137","target":"467","id":"4508","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"136","target":"163","id":"4482","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"646","target":"713","id":"10523","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"149","target":"345","id":"4763","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"524","target":"538","id":"9885","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"690","target":"723","id":"10648","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"151","target":"376","id":"4816","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"116","target":"668","id":"4091","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"110","target":"586","id":"3950","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"80","target":"434","id":"3317","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"234","target":"280","id":"6312","attributes":{"Weight":"1.0"},"color":"rgb(148,67,213)","size":1.0},{"source":"168","target":"191","id":"5131","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"20","target":"683","id":"1931","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"500","target":"706","id":"9713","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"130","target":"219","id":"4351","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"194","target":"505","id":"5626","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"17","target":"446","id":"1858","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"178","target":"197","id":"5328","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"261","target":"555","id":"6764","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"406","target":"476","id":"8762","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"47","target":"170","id":"2542","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"611","target":"656","id":"10378","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"196","target":"589","id":"5672","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"454","target":"648","id":"9304","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"67","target":"198","id":"3016","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"34","target":"592","id":"2263","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"224","target":"335","id":"6149","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"40","target":"315","id":"2384","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"528","target":"562","id":"9921","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"196","target":"543","id":"5669","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"101","target":"483","id":"3780","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"52","target":"700","id":"2667","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"157","target":"624","id":"4941","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"151","target":"179","id":"4804","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"228","target":"552","id":"6228","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"535","target":"653","id":"9977","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"20","target":"476","id":"1925","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"155","target":"245","id":"4889","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"494","target":"605","id":"9659","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"516","target":"524","id":"9813","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"501","target":"727","id":"9720","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"433","target":"648","id":"9082","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"365","target":"390","id":"8232","attributes":{"Weight":"1.0"},"color":"rgb(164,148,115)","size":1.0},{"source":"404","target":"503","id":"8744","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"4","target":"138","id":"1537","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"636","target":"697","id":"10482","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"503","target":"670","id":"9731","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"356","target":"696","id":"8151","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"615","target":"700","id":"10398","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"168","target":"607","id":"5143","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"320","target":"344","id":"7674","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"638","target":"671","id":"10490","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"40","target":"137","id":"2378","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"384","target":"677","id":"8495","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"295","target":"317","id":"7312","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"179","target":"311","id":"5349","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"245","target":"489","id":"6487","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"135","target":"547","id":"4472","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"78","target":"273","id":"3264","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"147","target":"514","id":"4732","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"384","target":"522","id":"8487","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"29","target":"208","id":"2126","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"60","target":"606","id":"2861","attributes":{"Weight":"1.0"},"color":"rgb(213,67,180)","size":1.0},{"source":"233","target":"376","id":"6300","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"635","target":"736","id":"10478","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"54","target":"381","id":"2704","attributes":{"Weight":"1.0"},"color":"rgb(148,148,229)","size":1.0},{"source":"171","target":"714","id":"5210","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"5","target":"575","id":"1573","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"112","target":"512","id":"4004","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"182","target":"420","id":"5406","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"69","target":"282","id":"3060","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"37","target":"545","id":"2321","attributes":{"Weight":"1.0"},"color":"rgb(148,99,164)","size":1.0},{"source":"363","target":"574","id":"8209","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"175","target":"624","id":"5278","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"40","target":"380","id":"2385","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"25","target":"439","id":"2025","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"39","target":"352","id":"2365","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"386","target":"532","id":"8522","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"449","target":"490","id":"9252","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"157","target":"187","id":"4923","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"78","target":"137","id":"3261","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"724","target":"729","id":"10677","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"211","target":"555","id":"5926","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"148","target":"477","id":"4750","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"253","target":"557","id":"6625","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"9","target":"429","id":"1675","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"252","target":"478","id":"6607","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"611","target":"687","id":"10380","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"421","target":"565","id":"8923","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"511","target":"593","id":"9790","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"279","target":"717","id":"7054","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"32","target":"250","id":"2187","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"93","target":"131","id":"3595","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"360","target":"563","id":"8188","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"404","target":"483","id":"8743","attributes":{"Weight":"1.0"},"color":"rgb(148,180,132)","size":1.0},{"source":"344","target":"483","id":"8009","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"13","target":"35","id":"1751","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"367","target":"609","id":"8261","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"442","target":"687","id":"9194","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"35","target":"599","id":"2283","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"557","target":"558","id":"10095","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"471","target":"686","id":"9475","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"156","target":"502","id":"4916","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"486","target":"531","id":"9585","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"68","target":"718","id":"3054","attributes":{"Weight":"1.0"},"color":"rgb(116,148,148)","size":1.0},{"source":"273","target":"467","id":"6952","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"269","target":"560","id":"6900","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"256","target":"446","id":"6671","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"631","target":"655","id":"10456","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"433","target":"611","id":"9078","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"226","target":"463","id":"6188","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"224","target":"699","id":"6163","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"135","target":"224","id":"4452","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"508","target":"521","id":"9767","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"197","target":"536","id":"5691","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"11","target":"346","id":"1715","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"259","target":"702","id":"6727","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"116","target":"371","id":"4078","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"220","target":"404","id":"6083","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"540","target":"732","id":"10013","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"174","target":"695","id":"5258","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"253","target":"400","id":"6618","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"316","target":"644","id":"7621","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"116","target":"308","id":"4074","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"71","target":"278","id":"3115","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"7","target":"453","id":"1611","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"352","target":"634","id":"8112","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"194","target":"649","id":"5631","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"376","target":"443","id":"8367","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"285","target":"734","id":"7163","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"290","target":"411","id":"7248","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"416","target":"449","id":"8858","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"374","target":"442","id":"8335","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"593","target":"619","id":"10298","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"257","target":"632","id":"6686","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"399","target":"488","id":"8687","attributes":{"Weight":"1.0"},"color":"rgb(148,99,196)","size":1.0},{"source":"409","target":"473","id":"8794","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"57","target":"562","id":"2784","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"50","target":"644","id":"2628","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"376","target":"567","id":"8372","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"208","target":"458","id":"5872","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"532","target":"540","id":"9950","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"389","target":"570","id":"8557","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"381","target":"521","id":"8437","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"183","target":"555","id":"5428","attributes":{"Weight":"1.0"},"color":"rgb(99,229,148)","size":1.0},{"source":"270","target":"688","id":"6915","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"381","target":"473","id":"8435","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"353","target":"368","id":"8116","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"38","target":"430","id":"2344","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"270","target":"538","id":"6909","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"452","target":"534","id":"9278","attributes":{"Weight":"1.0"},"color":"rgb(197,148,148)","size":1.0},{"source":"84","target":"107","id":"3388","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"258","target":"335","id":"6697","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"458","target":"620","id":"9343","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"270","target":"637","id":"6913","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"91","target":"502","id":"3567","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"13","target":"66","id":"1755","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"54","target":"608","id":"2717","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"361","target":"484","id":"8196","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"342","target":"500","id":"7979","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"73","target":"524","id":"3159","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"31","target":"370","id":"2179","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"593","target":"601","id":"10296","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"394","target":"414","id":"8626","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"171","target":"417","id":"5198","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"371","target":"562","id":"8295","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"48","target":"708","id":"2577","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"460","target":"677","id":"9369","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"661","target":"665","id":"10587","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"448","target":"506","id":"9240","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"133","target":"244","id":"4416","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"23","target":"158","id":"1982","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"81","target":"479","id":"3338","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"218","target":"435","id":"6052","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"65","target":"520","id":"2987","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"367","target":"426","id":"8253","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"123","target":"481","id":"4223","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"390","target":"399","id":"8567","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"428","target":"571","id":"9007","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"507","target":"714","id":"9765","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"267","target":"275","id":"6846","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"725","target":"729","id":"10681","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"261","target":"600","id":"6767","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"466","target":"735","id":"9429","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"336","target":"388","id":"7900","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"174","target":"568","id":"5255","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"522","target":"612","id":"9867","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"294","target":"643","id":"7308","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"612","target":"707","id":"10389","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"576","target":"606","id":"10212","attributes":{"Weight":"1.0"},"color":"rgb(132,148,180)","size":1.0},{"source":"75","target":"574","id":"3207","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"417","target":"659","id":"8875","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"276","target":"546","id":"7000","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"135","target":"280","id":"4456","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"391","target":"405","id":"8583","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"124","target":"320","id":"4238","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"12","target":"462","id":"1744","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"507","target":"534","id":"9758","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"104","target":"229","id":"3824","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"170","target":"255","id":"5174","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"526","target":"667","id":"9909","attributes":{"Weight":"1.0"},"color":"rgb(67,196,180)","size":1.0},{"source":"117","target":"375","id":"4102","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"371","target":"713","id":"8305","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"279","target":"567","id":"7047","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"525","target":"722","id":"9902","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"257","target":"445","id":"6681","attributes":{"Weight":"1.0"},"color":"rgb(196,99,148)","size":1.0},{"source":"71","target":"226","id":"3114","attributes":{"Weight":"1.0"},"color":"rgb(148,164,148)","size":1.0},{"source":"452","target":"481","id":"9275","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"242","target":"341","id":"6434","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"286","target":"593","id":"7173","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"247","target":"599","id":"6526","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"241","target":"610","id":"6424","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"100","target":"701","id":"3761","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"425","target":"565","id":"8973","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"61","target":"455","id":"2885","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"143","target":"187","id":"4629","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"221","target":"419","id":"6100","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"34","target":"546","id":"2260","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"259","target":"706","id":"6728","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"289","target":"532","id":"7228","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"6","target":"680","id":"1600","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"349","target":"643","id":"8073","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"93","target":"180","id":"3597","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"326","target":"544","id":"7755","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"295","target":"355","id":"7314","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"128","target":"588","id":"4321","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"626","target":"662","id":"10441","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"207","target":"230","id":"5856","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"17","target":"317","id":"1854","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"287","target":"451","id":"7185","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"610","target":"690","id":"10370","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"335","target":"616","id":"7890","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"275","target":"357","id":"6980","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"566","target":"659","id":"10140","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"330","target":"399","id":"7818","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"120","target":"429","id":"4162","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"564","target":"581","id":"10130","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"98","target":"372","id":"3712","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"442","target":"577","id":"9188","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"154","target":"719","id":"4883","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"71","target":"627","id":"3125","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"16","target":"174","id":"1829","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"87","target":"675","id":"3479","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"54","target":"70","id":"2691","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"505","target":"702","id":"9750","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"241","target":"578","id":"6421","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"422","target":"447","id":"8931","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"326","target":"683","id":"7757","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"54","target":"645","id":"2721","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"157","target":"240","id":"4924","attributes":{"Weight":"1.0"},"color":"rgb(180,132,148)","size":1.0},{"source":"239","target":"391","id":"6393","attributes":{"Weight":"1.0"},"color":"rgb(229,99,115)","size":1.0},{"source":"162","target":"364","id":"5023","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"213","target":"635","id":"5968","attributes":{"Weight":"1.0"},"color":"rgb(116,229,67)","size":1.0},{"source":"248","target":"448","id":"6533","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"425","target":"728","id":"8981","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"277","target":"332","id":"7005","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"103","target":"275","id":"3809","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"378","target":"588","id":"8403","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"425","target":"543","id":"8971","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"179","target":"654","id":"5363","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"101","target":"207","id":"3766","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"349","target":"591","id":"8071","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"64","target":"249","id":"2958","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"462","target":"707","id":"9389","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"65","target":"664","id":"2990","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"596","target":"723","id":"10314","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"260","target":"610","id":"6744","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"337","target":"579","id":"7918","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"39","target":"121","id":"2355","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"285","target":"438","id":"7149","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"14","target":"702","id":"1798","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"97","target":"173","id":"3685","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"166","target":"397","id":"5104","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"250","target":"694","id":"6578","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"258","target":"713","id":"6712","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"184","target":"302","id":"5443","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"421","target":"472","id":"8916","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"508","target":"543","id":"9769","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"117","target":"134","id":"4094","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"7","target":"661","id":"1619","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"389","target":"467","id":"8555","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"316","target":"327","id":"7606","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"6","target":"518","id":"1597","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"32","target":"255","id":"2191","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"33","target":"245","id":"2222","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"80","target":"575","id":"3318","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"144","target":"308","id":"4655","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"131","target":"432","id":"4380","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"32","target":"660","id":"2203","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"61","target":"678","id":"2895","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"210","target":"278","id":"5900","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"453","target":"690","id":"9289","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"54","target":"719","id":"2722","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"80","target":"335","id":"3314","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"34","target":"318","id":"2254","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"31","target":"701","id":"2184","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"582","target":"655","id":"10252","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"211","target":"487","id":"5925","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"224","target":"443","id":"6153","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"82","target":"573","id":"3360","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"614","target":"687","id":"10397","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"268","target":"731","id":"6882","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"517","target":"678","id":"9832","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"610","target":"692","id":"10371","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"398","target":"702","id":"8679","attributes":{"Weight":"1.0"},"color":"rgb(115,148,164)","size":1.0},{"source":"515","target":"620","id":"9810","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"133","target":"659","id":"4430","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"283","target":"330","id":"7117","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"264","target":"466","id":"6804","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"8","target":"527","id":"1644","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"161","target":"553","id":"5006","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"205","target":"582","id":"5832","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"129","target":"164","id":"4326","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"530","target":"683","id":"9946","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"44","target":"179","id":"2463","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"225","target":"419","id":"6171","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"675","target":"728","id":"10618","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"212","target":"645","id":"5952","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"230","target":"484","id":"6256","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"16","target":"733","id":"1842","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"61","target":"314","id":"2873","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"370","target":"630","id":"8288","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"360","target":"388","id":"8183","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"421","target":"594","id":"8925","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"76","target":"663","id":"3238","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"9","target":"236","id":"1669","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"242","target":"544","id":"6442","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"82","target":"623","id":"3364","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"456","target":"536","id":"9323","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"225","target":"424","id":"6172","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"401","target":"557","id":"8712","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"392","target":"414","id":"8601","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"121","target":"461","id":"4184","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"285","target":"650","id":"7156","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"38","target":"517","id":"2348","attributes":{"Weight":"1.0"},"color":"rgb(148,213,115)","size":1.0},{"source":"181","target":"219","id":"5388","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"492","target":"535","id":"9635","attributes":{"Weight":"1.0"},"color":"rgb(116,67,229)","size":1.0},{"source":"6","target":"310","id":"1587","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"384","target":"707","id":"8499","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"67","target":"697","id":"3031","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"437","target":"520","id":"9118","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"28","target":"720","id":"2122","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"225","target":"451","id":"6174","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"572","target":"719","id":"10184","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"27","target":"80","id":"2058","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"279","target":"572","id":"7048","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"115","target":"342","id":"4051","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"63","target":"257","id":"2929","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"182","target":"488","id":"5407","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"311","target":"384","id":"7539","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"387","target":"664","id":"8542","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"263","target":"669","id":"6795","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"131","target":"511","id":"4382","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"63","target":"485","id":"2935","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"164","target":"720","id":"5075","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"70","target":"608","id":"3102","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"283","target":"414","id":"7130","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"40","target":"598","id":"2391","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"98","target":"718","id":"3724","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"238","target":"335","id":"6371","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"640","target":"733","id":"10504","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"132","target":"512","id":"4413","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"119","target":"378","id":"4139","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"405","target":"658","id":"8760","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"313","target":"468","id":"7570","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"398","target":"632","id":"8672","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"155","target":"643","id":"4901","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"377","target":"414","id":"8388","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"135","target":"489","id":"4469","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"31","target":"309","id":"2176","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"102","target":"595","id":"3801","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"509","target":"592","id":"9781","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"25","target":"51","id":"2018","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"445","target":"483","id":"9219","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"21","target":"25","id":"1935","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"50","target":"164","id":"2608","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"203","target":"374","id":"5787","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"227","target":"569","id":"6206","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"384","target":"685","id":"8497","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"18","target":"628","id":"1882","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"140","target":"687","id":"4583","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"78","target":"495","id":"3271","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"52","target":"456","id":"2659","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"42","target":"428","id":"2424","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"220","target":"340","id":"6079","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"269","target":"658","id":"6902","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"98","target":"367","id":"3711","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"212","target":"487","id":"5945","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"545","target":"556","id":"10034","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"39","target":"463","id":"2369","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"96","target":"370","id":"3678","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"190","target":"706","id":"5568","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"244","target":"613","id":"6471","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"635","target":"637","id":"10474","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"313","target":"477","id":"7573","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"200","target":"597","id":"5744","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"69","target":"285","id":"3061","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"250","target":"674","id":"6577","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"587","target":"597","id":"10271","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"256","target":"276","id":"6665","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"147","target":"455","id":"4730","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"136","target":"712","id":"4497","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"144","target":"606","id":"4669","attributes":{"Weight":"1.0"},"color":"rgb(132,148,180)","size":1.0},{"source":"319","target":"349","id":"7654","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"284","target":"306","id":"7137","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"195","target":"605","id":"5649","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"628","target":"664","id":"10446","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"421","target":"508","id":"8918","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"101","target":"361","id":"3776","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"21","target":"708","id":"1954","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"184","target":"312","id":"5444","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"154","target":"224","id":"4862","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"174","target":"704","id":"5259","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"10","target":"153","id":"1689","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"84","target":"533","id":"3400","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"18","target":"383","id":"1875","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"198","target":"538","id":"5705","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"260","target":"665","id":"6746","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"306","target":"380","id":"7475","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"235","target":"489","id":"6336","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"1","target":"519","id":"1477","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"665","target":"723","id":"10601","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"46","target":"675","id":"2541","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"127","target":"715","id":"4303","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"81","target":"620","id":"3342","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"216","target":"618","id":"6022","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"54","target":"202","id":"2693","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"192","target":"666","id":"5595","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"177","target":"221","id":"5303","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"183","target":"462","id":"5423","attributes":{"Weight":"1.0"},"color":"rgb(99,229,148)","size":1.0},{"source":"185","target":"728","id":"5477","attributes":{"Weight":"1.0"},"color":"rgb(229,132,148)","size":1.0},{"source":"60","target":"150","id":"2837","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"287","target":"462","id":"7186","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"179","target":"586","id":"5359","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"269","target":"390","id":"6887","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"16","target":"439","id":"1833","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"176","target":"700","id":"5299","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"8","target":"460","id":"1642","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"114","target":"257","id":"4027","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"52","target":"197","id":"2651","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"122","target":"266","id":"4192","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"95","target":"244","id":"3646","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"416","target":"481","id":"8862","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"342","target":"403","id":"7978","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"114","target":"421","id":"4031","attributes":{"Weight":"1.0"},"color":"rgb(196,67,229)","size":1.0},{"source":"177","target":"218","id":"5302","attributes":{"Weight":"1.0"},"color":"rgb(67,196,180)","size":1.0},{"source":"82","target":"614","id":"3363","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"192","target":"315","id":"5586","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"548","target":"710","id":"10054","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"65","target":"340","id":"2980","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"71","target":"146","id":"3109","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"159","target":"257","id":"4963","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"137","target":"306","id":"4504","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"225","target":"287","id":"6168","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"117","target":"700","id":"4111","attributes":{"Weight":"1.0"},"color":"rgb(100,148,148)","size":1.0},{"source":"208","target":"541","id":"5881","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"195","target":"493","id":"5642","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"668","target":"713","id":"10607","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"280","target":"331","id":"7058","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"469","target":"514","id":"9446","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"87","target":"185","id":"3455","attributes":{"Weight":"1.0"},"color":"rgb(229,132,148)","size":1.0},{"source":"677","target":"685","id":"10623","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"197","target":"700","id":"5696","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"79","target":"375","id":"3285","attributes":{"Weight":"1.0"},"color":"rgb(83,229,115)","size":1.0},{"source":"156","target":"242","id":"4908","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"537","target":"706","id":"9993","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"214","target":"320","id":"5975","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"632","target":"671","id":"10462","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"448","target":"520","id":"9241","attributes":{"Weight":"1.0"},"color":"rgb(148,229,132)","size":1.0},{"source":"211","target":"618","id":"5929","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"524","target":"637","id":"9889","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"189","target":"230","id":"5532","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"454","target":"577","id":"9300","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"29","target":"310","id":"2129","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"298","target":"479","id":"7362","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"79","target":"623","id":"3299","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"141","target":"482","id":"4599","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"211","target":"642","id":"5930","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"438","target":"724","id":"9134","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"189","target":"361","id":"5539","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"329","target":"464","id":"7801","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"259","target":"363","id":"6714","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"525","target":"567","id":"9896","attributes":{"Weight":"1.0"},"color":"rgb(148,115,213)","size":1.0},{"source":"475","target":"614","id":"9519","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"122","target":"454","id":"4198","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"15","target":"97","id":"1800","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"661","target":"693","id":"10590","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"477","target":"680","id":"9536","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"183","target":"736","id":"5439","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"110","target":"719","id":"3957","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"200","target":"579","id":"5741","attributes":{"Weight":"1.0"},"color":"rgb(67,180,164)","size":1.0},{"source":"543","target":"589","id":"10025","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"258","target":"575","id":"6704","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"3","target":"634","id":"1530","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"633","target":"635","id":"10465","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"35","target":"570","id":"2280","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"196","target":"421","id":"5660","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"336","target":"448","id":"7902","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"87","target":"440","id":"3463","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"374","target":"611","id":"8343","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"220","target":"709","id":"6091","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"205","target":"585","id":"5833","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"15","target":"296","id":"1807","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"44","target":"454","id":"2474","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"577","target":"611","id":"10217","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"327","target":"455","id":"7764","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"572","target":"629","id":"10180","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"441","target":"650","id":"9172","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"216","target":"703","id":"6027","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"243","target":"439","id":"6449","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"289","target":"567","id":"7231","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"440","target":"472","id":"9150","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"372","target":"549","id":"8314","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"39","target":"129","id":"2356","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"468","target":"680","id":"9444","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"114","target":"398","id":"4030","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"205","target":"525","id":"5829","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"234","target":"304","id":"6314","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"302","target":"736","id":"7430","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"364","target":"665","id":"8224","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"267","target":"509","id":"6855","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"263","target":"539","id":"6790","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"166","target":"607","id":"5110","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"312","target":"497","id":"7556","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"412","target":"413","id":"8828","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"109","target":"119","id":"3908","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"264","target":"281","id":"6797","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"68","target":"697","id":"3053","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"287","target":"487","id":"7188","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"59","target":"422","id":"2823","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"58","target":"452","id":"2806","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"524","target":"635","id":"9887","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"414","target":"658","id":"8844","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"15","target":"195","id":"1803","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"277","target":"424","id":"7007","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"136","target":"336","id":"4485","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"174","target":"640","id":"5256","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"202","target":"221","id":"5767","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"125","target":"404","id":"4253","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"43","target":"437","id":"2448","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"569","target":"572","id":"10156","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"457","target":"630","id":"9331","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"425","target":"508","id":"8968","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"351","target":"456","id":"8093","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"114","target":"682","id":"4044","attributes":{"Weight":"1.0"},"color":"rgb(180,67,229)","size":1.0},{"source":"500","target":"505","id":"9705","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"47","target":"696","id":"2563","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"451","target":"462","id":"9267","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"307","target":"479","id":"7492","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"110","target":"150","id":"3930","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"315","target":"380","id":"7597","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"384","target":"625","id":"8492","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"23","target":"698","id":"1993","attributes":{"Weight":"1.0"},"color":"rgb(180,67,148)","size":1.0},{"source":"103","target":"581","id":"3821","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"244","target":"314","id":"6459","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"38","target":"461","id":"2345","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"113","target":"278","id":"4009","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"1","target":"108","id":"1466","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"527","target":"612","id":"9913","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"33","target":"50","id":"2207","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"241","target":"692","id":"6428","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"466","target":"651","id":"9422","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"309","target":"332","id":"7515","attributes":{"Weight":"1.0"},"color":"rgb(148,115,148)","size":1.0},{"source":"317","target":"355","id":"7628","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"182","target":"533","id":"5408","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"88","target":"241","id":"3487","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"504","target":"692","id":"9740","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"208","target":"459","id":"5873","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"14","target":"292","id":"1782","attributes":{"Weight":"1.0"},"color":"rgb(148,148,83)","size":1.0},{"source":"41","target":"584","id":"2408","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"633","target":"688","id":"10469","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"7","target":"339","id":"1609","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"373","target":"720","id":"8330","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"26","target":"123","id":"2039","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"263","target":"299","id":"6781","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"447","target":"481","id":"9234","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"228","target":"489","id":"6225","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"291","target":"670","id":"7270","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"12","target":"319","id":"1738","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"433","target":"577","id":"9077","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"345","target":"613","id":"8020","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"25","target":"243","id":"2022","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"178","target":"427","id":"5335","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"454","target":"614","id":"9302","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"402","target":"696","id":"8729","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"323","target":"529","id":"7713","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"157","target":"175","id":"4922","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"473","target":"728","id":"9501","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"88","target":"723","id":"3511","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"541","target":"620","id":"10015","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"29","target":"471","id":"2135","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"8","target":"311","id":"1636","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"106","target":"304","id":"3862","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"3","target":"607","id":"1529","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"37","target":"626","id":"2323","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"149","target":"682","id":"4775","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"176","target":"551","id":"5296","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"109","target":"501","id":"3921","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"183","target":"204","id":"5416","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"251","target":"401","id":"6586","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"492","target":"609","id":"9639","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"254","target":"545","id":"6639","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"169","target":"275","id":"5150","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"28","target":"33","id":"2086","attributes":{"Weight":"1.0"},"color":"rgb(148,132,148)","size":1.0},{"source":"108","target":"435","id":"3896","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"193","target":"724","id":"5612","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"320","target":"362","id":"7677","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"74","target":"654","id":"3186","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"323","target":"699","id":"7718","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"77","target":"310","id":"3246","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"353","target":"595","id":"8122","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"36","target":"315","id":"2295","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"547","target":"567","id":"10046","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"199","target":"274","id":"5717","attributes":{"Weight":"1.0"},"color":"rgb(67,196,213)","size":1.0},{"source":"7","target":"692","id":"1622","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"136","target":"506","id":"4492","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"571","target":"703","id":"10176","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"460","target":"679","id":"9370","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"190","target":"254","id":"5552","attributes":{"Weight":"1.0"},"color":"rgb(148,148,100)","size":1.0},{"source":"14","target":"574","id":"1791","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"42","target":"716","id":"2436","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"233","target":"443","id":"6303","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"61","target":"171","id":"2871","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"459","target":"470","id":"9347","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"127","target":"639","id":"4299","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"43","target":"347","id":"2445","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"18","target":"43","id":"1865","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"277","target":"636","id":"7019","attributes":{"Weight":"1.0"},"color":"rgb(180,196,67)","size":1.0},{"source":"154","target":"462","id":"4873","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"161","target":"398","id":"5003","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"522","target":"532","id":"9865","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"275","target":"667","id":"6991","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"161","target":"726","id":"5014","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"193","target":"281","id":"5597","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"41","target":"273","id":"2399","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"468","target":"515","id":"9440","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"495","target":"666","id":"9667","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"166","target":"226","id":"5099","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"50","target":"316","id":"2612","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"435","target":"526","id":"9099","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"41","target":"570","id":"2407","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"176","target":"464","id":"5292","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"245","target":"629","id":"6492","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"438","target":"647","id":"9129","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"140","target":"384","id":"4564","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"196","target":"508","id":"5665","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"485","target":"726","id":"9584","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"387","target":"670","id":"8543","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"68","target":"684","id":"3051","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"329","target":"563","id":"7806","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"67","target":"684","id":"3029","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"26","target":"447","id":"2048","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"538","target":"636","id":"9996","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"197","target":"367","id":"5684","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"312","target":"684","id":"7564","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"268","target":"560","id":"6879","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"611","target":"614","id":"10375","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"437","target":"628","id":"9120","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"197","target":"615","id":"5695","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"110","target":"591","id":"3951","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"298","target":"307","id":"7353","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"610","target":"723","id":"10374","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"73","target":"697","id":"3167","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"179","target":"527","id":"5356","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"387","target":"503","id":"8537","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"74","target":"179","id":"3172","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"374","target":"385","id":"8331","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"138","target":"346","id":"4520","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"326","target":"406","id":"7750","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"268","target":"377","id":"6865","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"482","target":"622","id":"9566","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"317","target":"446","id":"7630","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"72","target":"190","id":"3131","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"146","target":"407","id":"4712","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"161","target":"632","id":"5008","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"425","target":"663","id":"8978","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"107","target":"278","id":"3877","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"133","target":"325","id":"4418","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"142","target":"187","id":"4608","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"390","target":"405","id":"8568","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"41","target":"467","id":"2405","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"300","target":"469","id":"7391","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"122","target":"203","id":"4191","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"652","target":"667","id":"10560","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"502","target":"683","id":"9725","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"402","target":"656","id":"8725","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"394","target":"399","id":"8621","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"358","target":"600","id":"8166","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"205","target":"494","id":"5827","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"249","target":"481","id":"6552","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"519","target":"605","id":"9844","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"382","target":"689","id":"8465","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"266","target":"610","id":"6838","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"299","target":"384","id":"7371","attributes":{"Weight":"1.0"},"color":"rgb(99,148,180)","size":1.0},{"source":"346","target":"404","id":"8028","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"8","target":"576","id":"1648","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"52","target":"426","id":"2657","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"329","target":"551","id":"7805","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"146","target":"627","id":"4718","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"360","target":"617","id":"8190","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"296","target":"450","id":"7325","attributes":{"Weight":"1.0"},"color":"rgb(67,196,229)","size":1.0},{"source":"88","target":"271","id":"3491","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"246","target":"474","id":"6502","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"375","target":"678","id":"8360","attributes":{"Weight":"1.0"},"color":"rgb(83,229,115)","size":1.0},{"source":"436","target":"490","id":"9107","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"532","target":"677","id":"9955","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"363","target":"597","id":"8211","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"418","target":"494","id":"8881","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"264","target":"382","id":"6800","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"81","target":"477","id":"3337","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"264","target":"689","id":"6810","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"423","target":"545","id":"8942","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"349","target":"529","id":"8068","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"165","target":"240","id":"5082","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"45","target":"249","id":"2499","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"200","target":"342","id":"5732","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"545","target":"694","id":"10040","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"396","target":"417","id":"8643","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"719","target":"720","id":"10674","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"549","target":"615","id":"10057","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"264","target":"441","id":"6802","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"732","target":"733","id":"10690","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"28","target":"407","id":"2107","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"319","target":"608","id":"7669","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"111","target":"489","id":"3976","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"36","target":"66","id":"2287","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"37","target":"182","id":"2311","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"17","target":"256","id":"1849","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"459","target":"518","id":"9352","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"403","target":"537","id":"8732","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"248","target":"588","id":"6538","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"28","target":"705","id":"2121","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"46","target":"404","id":"2527","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"136","target":"248","id":"4484","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"391","target":"412","id":"8585","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"441","target":"466","id":"9168","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"589","target":"604","id":"10280","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"500","target":"691","id":"9711","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"98","target":"427","id":"3714","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"26","target":"291","id":"2045","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"409","target":"508","id":"8796","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"69","target":"466","id":"3070","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"484","target":"512","id":"9573","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"123","target":"249","id":"4214","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"237","target":"416","id":"6357","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"249","target":"675","id":"6558","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"360","target":"506","id":"8186","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"560","target":"561","id":"10110","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"190","target":"200","id":"5550","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"148","target":"686","id":"4757","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"12","target":"221","id":"1734","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"3","target":"240","id":"1521","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"240","target":"359","id":"6399","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"278","target":"579","id":"7029","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"378","target":"647","id":"8405","attributes":{"Weight":"1.0"},"color":"rgb(148,164,148)","size":1.0},{"source":"298","target":"680","id":"7367","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"92","target":"700","id":"3593","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"335","target":"434","id":"7883","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"171","target":"659","id":"5207","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"305","target":"595","id":"7472","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"388","target":"448","id":"8546","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"174","target":"439","id":"5253","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"199","target":"346","id":"5719","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"198","target":"637","id":"5709","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"33","target":"209","id":"2217","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"294","target":"720","id":"7311","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"319","target":"462","id":"7662","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"19","target":"237","id":"1895","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"246","target":"657","id":"6510","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"163","target":"343","id":"5043","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"38","target":"129","id":"2331","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"13","target":"599","id":"1771","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"149","target":"606","id":"4771","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"13","target":"40","id":"1753","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"189","target":"344","id":"5537","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"131","target":"277","id":"4373","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"526","target":"722","id":"9910","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"164","target":"397","id":"5065","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"156","target":"265","id":"4909","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"194","target":"587","id":"5629","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"443","target":"676","id":"9205","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"54","target":"571","id":"2714","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"90","target":"530","id":"3549","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"557","target":"660","id":"10097","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"123","target":"675","id":"4227","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"458","target":"541","id":"9342","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"300","target":"542","id":"7395","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"464","target":"609","id":"9401","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"23","target":"732","id":"1996","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"647","target":"734","id":"10537","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"149","target":"534","id":"4769","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"101","target":"112","id":"3762","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"70","target":"600","id":"3101","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"373","target":"685","id":"8328","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"532","target":"704","id":"9958","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"3","target":"430","id":"1524","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"65","target":"590","id":"2988","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"161","target":"246","id":"4999","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"196","target":"304","id":"5655","attributes":{"Weight":"1.0"},"color":"rgb(148,67,229)","size":1.0},{"source":"373","target":"643","id":"8325","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"1","target":"655","id":"1484","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"39","target":"165","id":"2357","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"455","target":"469","id":"9308","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"98","target":"536","id":"3718","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"443","target":"699","id":"9206","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"632","target":"638","id":"10459","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"461","target":"486","id":"9376","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"355","target":"446","id":"8131","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"32","target":"254","id":"2190","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"163","target":"206","id":"5040","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"246","target":"485","id":"6503","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"418","target":"526","id":"8884","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"414","target":"561","id":"8843","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"271","target":"339","id":"6918","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"104","target":"276","id":"3828","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"157","target":"434","id":"4930","attributes":{"Weight":"1.0"},"color":"rgb(99,148,180)","size":1.0},{"source":"107","target":"407","id":"3880","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"77","target":"471","id":"3252","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"695","target":"732","id":"10659","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"545","target":"558","id":"10036","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"50","target":"155","id":"2607","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"85","target":"586","id":"3427","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"11","target":"118","id":"1708","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"67","target":"270","id":"3018","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"314","target":"496","id":"7587","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"435","target":"519","id":"9097","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"242","target":"375","id":"6436","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"173","target":"582","id":"5244","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"347","target":"664","id":"8044","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"5","target":"27","id":"1554","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"456","target":"700","id":"9328","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"434","target":"616","id":"9092","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"150","target":"294","id":"4782","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"454","target":"455","id":"9294","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"36","target":"584","id":"2301","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"504","target":"610","id":"9736","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"290","target":"393","id":"7243","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"23","target":"708","id":"1995","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"268","target":"658","id":"6881","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"127","target":"160","id":"4286","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"97","target":"493","id":"3694","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"92","target":"427","id":"3584","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"48","target":"704","id":"2576","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"154","target":"371","id":"4870","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"468","target":"686","id":"9445","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"107","target":"321","id":"3878","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"29","target":"479","id":"2137","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"578","target":"692","id":"10232","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"276","target":"446","id":"6997","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"45","target":"58","id":"2492","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"170","target":"696","id":"5189","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"28","target":"321","id":"2103","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"47","target":"694","id":"2562","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"490","target":"586","id":"9615","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"455","target":"678","id":"9317","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"268","target":"394","id":"6870","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"297","target":"621","id":"7344","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"41","target":"389","id":"2404","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"53","target":"497","id":"2679","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"53","target":"68","id":"2670","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"382","target":"441","id":"8452","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"95","target":"163","id":"3644","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"303","target":"679","id":"7448","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"139","target":"616","id":"4551","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"578","target":"721","id":"10234","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"145","target":"316","id":"4680","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"507","target":"566","id":"9759","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"180","target":"652","id":"5385","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"202","target":"451","id":"5776","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"87","target":"521","id":"3469","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"349","target":"368","id":"8061","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"118","target":"220","id":"4114","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"58","target":"123","id":"2793","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"300","target":"301","id":"7387","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"367","target":"372","id":"8252","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"21","target":"23","id":"1933","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"325","target":"507","id":"7736","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"34","target":"317","id":"2253","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"605","target":"655","id":"10350","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"215","target":"364","id":"5990","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"261","target":"608","id":"6768","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"194","target":"379","id":"5622","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"178","target":"718","id":"5345","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"422","target":"478","id":"8934","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"61","target":"721","id":"2899","attributes":{"Weight":"1.0"},"color":"rgb(180,148,148)","size":1.0},{"source":"79","target":"517","id":"3294","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"3","target":"129","id":"1513","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"246","target":"632","id":"6507","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"147","target":"175","id":"4722","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"422","target":"675","id":"8940","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"80","target":"576","id":"3319","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"8","target":"74","id":"1628","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"329","target":"718","id":"7810","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"144","target":"258","id":"4653","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"117","target":"341","id":"4100","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"238","target":"348","id":"6373","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"468","target":"518","id":"9441","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"231","target":"232","id":"6258","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"392","target":"412","id":"8599","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"81","target":"518","id":"3340","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"56","target":"679","id":"2764","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"140","target":"522","id":"4571","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"440","target":"473","id":"9151","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"355","target":"357","id":"8130","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"244","target":"534","id":"6468","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"130","target":"309","id":"4355","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"115","target":"190","id":"4047","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"259","target":"383","id":"6716","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"46","target":"461","id":"2533","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"21","target":"704","id":"1953","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"543","target":"594","id":"10026","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"220","target":"387","id":"6082","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"402","target":"410","id":"8719","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"246","target":"297","id":"6498","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"619","target":"652","id":"10410","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"491","target":"646","id":"9624","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"112","target":"445","id":"4001","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"80","target":"308","id":"3313","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"685","target":"707","id":"10635","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"242","target":"265","id":"6432","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"166","target":"430","id":"5105","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"171","target":"244","id":"5191","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"180","target":"428","id":"5376","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"198","target":"635","id":"5707","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"180","target":"601","id":"5382","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"97","target":"418","id":"3691","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"170","target":"674","id":"5187","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"283","target":"377","id":"7118","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"151","target":"227","id":"4806","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"608","target":"645","id":"10363","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"695","target":"704","id":"10657","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"155","target":"629","id":"4900","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"477","target":"518","id":"9533","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"404","target":"437","id":"8741","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"438","target":"730","id":"9137","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"311","target":"679","id":"7553","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"553","target":"639","id":"10074","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"55","target":"147","id":"2725","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"517","target":"687","id":"9833","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"101","target":"132","id":"3764","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"20","target":"62","id":"1910","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"52","target":"92","id":"2647","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"261","target":"358","id":"6755","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"50","target":"110","id":"2602","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"165","target":"191","id":"5080","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"458","target":"515","id":"9340","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"332","target":"593","id":"7848","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"296","target":"435","id":"7324","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"245","target":"591","id":"6491","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"168","target":"461","id":"5138","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"130","target":"181","id":"4350","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"144","target":"646","id":"4671","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"226","target":"711","id":"6193","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"143","target":"301","id":"4633","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"60","target":"236","id":"2843","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"653","target":"698","id":"10564","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"16","target":"292","id":"1831","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"127","target":"159","id":"4285","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"17","target":"169","id":"1847","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"168","target":"240","id":"5133","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"58","target":"517","id":"2810","attributes":{"Weight":"1.0"},"color":"rgb(132,229,115)","size":1.0},{"source":"139","target":"308","id":"4539","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"435","target":"605","id":"9102","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"405","target":"412","id":"8754","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"129","target":"634","id":"4345","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"53","target":"636","id":"2685","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"394","target":"411","id":"8623","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"421","target":"523","id":"8920","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"319","target":"358","id":"7655","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"171","target":"682","id":"5209","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"271","target":"721","id":"6932","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"383","target":"505","id":"8474","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"346","target":"590","id":"8032","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"382","target":"734","id":"8470","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"559","target":"731","id":"10109","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"153","target":"366","id":"4851","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"33","target":"362","id":"2230","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"44","target":"480","id":"2476","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"43","target":"473","id":"2449","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"164","target":"349","id":"5061","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"273","target":"599","id":"6957","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"217","target":"407","id":"6033","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"320","target":"483","id":"7680","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"267","target":"581","id":"6859","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"212","target":"287","id":"5935","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"263","target":"535","id":"6789","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"147","target":"535","id":"4733","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"407","target":"627","id":"8774","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"636","target":"684","id":"10480","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"327","target":"614","id":"7772","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"309","target":"457","id":"7519","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"332","target":"716","id":"7855","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"187","target":"698","id":"5510","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"248","target":"617","id":"6539","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"27","target":"433","id":"2072","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"173","target":"195","id":"5232","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"89","target":"621","id":"3525","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"501","target":"712","id":"9719","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"447","target":"478","id":"9233","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"469","target":"542","id":"9449","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"72","target":"649","id":"3146","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"442","target":"573","id":"9187","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"424","target":"608","id":"8959","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"316","target":"687","id":"7623","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"537","target":"574","id":"9986","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"416","target":"565","id":"8865","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"154","target":"335","id":"4868","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"162","target":"215","id":"5015","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"207","target":"209","id":"5853","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"95","target":"388","id":"3652","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"395","target":"559","id":"8638","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"378","target":"727","id":"8407","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"27","target":"603","id":"2080","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"14","target":"75","id":"1775","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"185","target":"622","id":"5472","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"169","target":"317","id":"5154","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"57","target":"663","id":"2790","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"250","target":"656","id":"6575","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"5","target":"231","id":"1560","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"418","target":"605","id":"8887","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"356","target":"402","id":"8140","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"155","target":"164","id":"4886","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"248","target":"563","id":"6537","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"514","target":"542","id":"9803","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"148","target":"620","id":"4755","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"221","target":"642","id":"6112","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"132","target":"320","id":"4405","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"83","target":"488","id":"3381","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"395","target":"414","id":"8637","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"184","target":"635","id":"5450","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"236","target":"710","id":"6353","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"331","target":"376","id":"7830","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"330","target":"658","id":"7828","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"601","target":"652","id":"10329","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"523","target":"604","id":"9880","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"36","target":"389","id":"2297","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"145","target":"442","id":"4688","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"412","target":"414","id":"8829","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"288","target":"663","id":"7217","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"525","target":"582","id":"9897","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"83","target":"579","id":"3383","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"27","target":"335","id":"2068","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"317","target":"318","id":"7627","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"24","target":"733","id":"2016","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"251","target":"254","id":"6581","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"85","target":"436","id":"3421","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"281","target":"689","id":"7089","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"352","target":"463","id":"8107","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"157","target":"653","id":"4942","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"16","target":"25","id":"1825","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"151","target":"431","id":"4817","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"2","target":"369","id":"1502","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"409","target":"679","id":"8808","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"69","target":"735","id":"3083","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"433","target":"475","id":"9071","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"58","target":"447","id":"2804","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"60","target":"710","id":"2863","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"189","target":"578","id":"5545","attributes":{"Weight":"1.0"},"color":"rgb(196,180,67)","size":1.0},{"source":"307","target":"459","id":"7487","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"262","target":"344","id":"6773","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"427","target":"700","id":"9001","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"336","target":"727","id":"7910","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"20","target":"406","id":"1924","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"244","target":"630","id":"6472","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"288","target":"472","id":"7202","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"125","target":"452","id":"4258","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"208","target":"470","id":"5875","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"67","target":"635","id":"3026","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"473","target":"533","id":"9493","attributes":{"Weight":"1.0"},"color":"rgb(148,99,229)","size":1.0},{"source":"132","target":"262","id":"4404","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"2","target":"10","id":"1486","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"94","target":"149","id":"3619","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"451","target":"555","id":"9269","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"140","target":"612","id":"4575","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"491","target":"651","id":"9627","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"311","target":"525","id":"7544","attributes":{"Weight":"1.0"},"color":"rgb(67,196,180)","size":1.0},{"source":"250","target":"558","id":"6573","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"466","target":"725","id":"9425","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"245","target":"349","id":"6480","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"486","target":"634","id":"9588","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"152","target":"506","id":"4839","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"185","target":"430","id":"5464","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"255","target":"656","id":"6658","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"231","target":"668","id":"6276","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"181","target":"457","id":"5395","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"104","target":"564","id":"3838","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"16","target":"243","id":"1830","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"46","target":"622","id":"2539","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"363","target":"403","id":"8204","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"241","target":"723","id":"6431","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"49","target":"276","id":"2588","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"397","target":"677","id":"8661","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"22","target":"733","id":"1977","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"70","target":"214","id":"3087","attributes":{"Weight":"1.0"},"color":"rgb(148,180,148)","size":1.0},{"source":"69","target":"633","id":"3072","attributes":{"Weight":"1.0"},"color":"rgb(99,164,148)","size":1.0},{"source":"183","target":"637","id":"5432","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"604","target":"706","id":"10347","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"407","target":"626","id":"8773","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"269","target":"391","id":"6888","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"312","target":"697","id":"7566","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"122","target":"475","id":"4199","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"78","target":"315","id":"3267","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"177","target":"679","id":"5324","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"86","target":"618","id":"3449","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"667","target":"707","id":"10605","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"43","target":"199","id":"2440","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"426","target":"700","id":"8991","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"101","target":"457","id":"3779","attributes":{"Weight":"1.0"},"color":"rgb(148,99,148)","size":1.0},{"source":"53","target":"204","id":"2675","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"211","target":"287","id":"5916","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"106","target":"219","id":"3860","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"292","target":"293","id":"7272","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"56","target":"460","id":"2755","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"8","target":"606","id":"1649","attributes":{"Weight":"1.0"},"color":"rgb(132,148,180)","size":1.0},{"source":"87","target":"409","id":"3460","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"263","target":"698","id":"6796","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"145","target":"687","id":"4700","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"289","target":"676","id":"7233","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"118","target":"272","id":"4115","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"134","target":"365","id":"4440","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"408","target":"625","id":"8782","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"23","target":"25","id":"1979","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"151","target":"547","id":"4822","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"218","target":"261","id":"6045","attributes":{"Weight":"1.0"},"color":"rgb(67,196,229)","size":1.0},{"source":"270","target":"635","id":"6911","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"398","target":"440","id":"8666","attributes":{"Weight":"1.0"},"color":"rgb(196,67,229)","size":1.0},{"source":"377","target":"395","id":"8382","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"689","target":"730","id":"10642","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"471","target":"620","id":"9473","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"34","target":"267","id":"2249","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"178","target":"609","id":"5342","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"185","target":"711","id":"5476","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"74","target":"386","id":"3176","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"39","target":"359","id":"2366","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"238","target":"627","id":"6383","attributes":{"Weight":"1.0"},"color":"rgb(67,180,180)","size":1.0},{"source":"161","target":"657","id":"5011","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"202","target":"358","id":"5772","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"511","target":"703","id":"9795","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"31","target":"181","id":"2172","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"217","target":"662","id":"6041","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"534","target":"682","id":"9972","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"10","target":"630","id":"1701","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"87","target":"589","id":"3474","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"622","target":"728","id":"10425","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"160","target":"639","id":"4994","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"11","target":"43","id":"1705","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"480","target":"614","id":"9555","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"113","target":"627","id":"4018","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"250","target":"254","id":"6561","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"56","target":"654","id":"2761","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"669","target":"698","id":"10608","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"205","target":"274","id":"5822","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"290","target":"413","id":"7250","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"456","target":"718","id":"9329","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"269","target":"394","id":"6891","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"616","target":"668","id":"10400","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"173","target":"296","id":"5236","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"384","target":"654","id":"8493","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"448","target":"563","id":"9243","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"563","target":"727","id":"10129","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"98","target":"426","id":"3713","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"486","target":"711","id":"9589","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"557","target":"694","id":"10099","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"219","target":"309","id":"6069","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"246","target":"322","id":"6499","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"73","target":"312","id":"3156","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"147","target":"432","id":"4728","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"605","target":"722","id":"10351","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"386","target":"408","id":"8517","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"349","target":"429","id":"8066","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"364","target":"438","id":"8216","attributes":{"Weight":"1.0"},"color":"rgb(115,164,148)","size":1.0},{"source":"339","target":"602","id":"7944","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"340","target":"347","id":"7954","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"219","target":"234","id":"6067","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"208","target":"468","id":"5874","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"303","target":"433","id":"7436","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"116","target":"606","id":"4088","attributes":{"Weight":"1.0"},"color":"rgb(132,148,180)","size":1.0},{"source":"407","target":"488","id":"8770","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"223","target":"230","id":"6130","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"64","target":"207","id":"2952","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"341","target":"476","id":"7968","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"109","target":"360","id":"3917","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"148","target":"479","id":"4751","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"225","target":"450","id":"6173","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"207","target":"512","id":"5867","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"376","target":"436","id":"8366","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"111","target":"429","id":"3975","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"31","target":"366","id":"2177","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"261","target":"645","id":"6770","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"207","target":"445","id":"5864","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"691","target":"706","id":"10650","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"20","target":"365","id":"1922","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"146","target":"533","id":"4715","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"436","target":"516","id":"9108","attributes":{"Weight":"1.0"},"color":"rgb(180,148,132)","size":1.0},{"source":"100","target":"304","id":"3752","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"233","target":"529","id":"6305","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"235","target":"499","id":"6337","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"110","target":"371","id":"3944","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"38","target":"165","id":"2332","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"351","target":"551","id":"8098","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"94","target":"534","id":"3631","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"390","target":"413","id":"8571","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"69","target":"729","id":"3080","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"197","target":"549","id":"5692","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"116","target":"139","id":"4066","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"288","target":"311","id":"7196","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"263","target":"514","id":"6788","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"281","target":"651","id":"7088","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"33","target":"349","id":"2227","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"50","target":"111","id":"2603","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"309","target":"645","id":"7522","attributes":{"Weight":"1.0"},"color":"rgb(67,148,229)","size":1.0},{"source":"310","target":"471","id":"7530","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"364","target":"610","id":"8222","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"10","target":"234","id":"1692","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"442","target":"455","id":"9182","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"105","target":"369","id":"3850","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"33","target":"111","id":"2210","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"34","target":"295","id":"2252","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"425","target":"490","id":"8967","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"125","target":"249","id":"4250","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"8","target":"562","id":"1647","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"563","target":"712","id":"10128","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"235","target":"548","id":"6338","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"26","target":"622","id":"2055","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"283","target":"395","id":"7124","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"251","target":"556","id":"6591","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"483","target":"484","id":"9569","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"398","target":"726","id":"8681","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"621","target":"638","id":"10416","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"358","target":"645","id":"8169","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"330","target":"412","id":"7821","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"218","target":"722","id":"6066","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"229","target":"510","id":"6242","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"249","target":"252","id":"6542","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"235","target":"368","id":"6334","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"422","target":"482","id":"8936","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"381","target":"571","id":"8442","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"623","target":"644","id":"10426","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"159","target":"226","id":"4961","attributes":{"Weight":"1.0"},"color":"rgb(196,132,148)","size":1.0},{"source":"86","target":"571","id":"3445","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"417","target":"496","id":"8869","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"394","target":"412","id":"8624","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"437","target":"670","id":"9122","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"391","target":"392","id":"8578","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"516","target":"696","id":"9821","attributes":{"Weight":"1.0"},"color":"rgb(180,148,83)","size":1.0},{"source":"27","target":"303","id":"2066","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"237","target":"482","id":"6364","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"74","target":"732","id":"3193","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"676","target":"717","id":"10620","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"3","target":"166","id":"1515","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"131","target":"619","id":"4390","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"491","target":"724","id":"9629","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"454","target":"573","id":"9299","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"310","target":"313","id":"7525","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"11","target":"711","id":"1728","attributes":{"Weight":"1.0"},"color":"rgb(148,213,132)","size":1.0},{"source":"239","target":"512","id":"6397","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"588","target":"712","id":"10277","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"353","target":"548","id":"8120","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"180","target":"619","id":"5384","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"475","target":"517","id":"9514","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"616","target":"681","id":"10401","attributes":{"Weight":"1.0"},"color":"rgb(83,229,99)","size":1.0},{"source":"224","target":"436","id":"6152","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"480","target":"498","id":"9550","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"202","target":"608","id":"5782","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"279","target":"699","id":"7053","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"79","target":"442","id":"3288","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"434","target":"603","id":"9091","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"245","target":"529","id":"6488","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"99","target":"457","id":"3739","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"79","target":"327","id":"3283","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"130","target":"554","id":"4365","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"9","target":"489","id":"1676","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"150","target":"460","id":"4789","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"522","target":"527","id":"9864","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"131","target":"703","id":"4394","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"45","target":"482","id":"2511","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"227","target":"547","id":"6205","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"85","target":"376","id":"3419","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"525","target":"605","id":"9899","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"88","target":"693","id":"3509","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"276","target":"318","id":"6994","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"254","target":"558","id":"6642","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"602","target":"693","id":"10338","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"276","target":"581","id":"7002","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"425","target":"604","id":"8976","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"293","target":"733","id":"7292","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"319","target":"645","id":"7672","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"12","target":"487","id":"1745","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"613","target":"673","id":"10391","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"626","target":"627","id":"10440","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"380","target":"598","id":"8425","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"198","target":"302","id":"5700","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"313","target":"680","id":"7579","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"327","target":"498","id":"7767","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"15","target":"218","id":"1805","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"42","target":"216","id":"2419","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"400","target":"558","id":"8701","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"232","target":"308","id":"6283","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"129","target":"461","id":"4340","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"386","target":"677","id":"8529","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"119","target":"550","id":"4144","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"281","target":"730","id":"7093","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"493","target":"519","id":"9644","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"277","target":"601","id":"7016","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"196","target":"288","id":"5654","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"470","target":"686","id":"9466","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"277","target":"286","id":"7004","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"103","target":"510","id":"3818","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"378","target":"712","id":"8406","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"12","target":"451","id":"1743","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"115","target":"500","id":"4056","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"288","target":"594","id":"7215","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"573","target":"614","id":"10188","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"32","target":"251","id":"2188","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"193","target":"651","id":"5610","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"280","target":"600","id":"7069","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"141","target":"291","id":"4590","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"476","target":"502","id":"9525","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"383","target":"500","id":"8473","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"358","target":"608","id":"8167","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"659","target":"682","id":"10582","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"280","target":"469","id":"7063","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"7","target":"497","id":"1613","attributes":{"Weight":"1.0"},"color":"rgb(148,229,67)","size":1.0},{"source":"22","target":"732","id":"1976","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"224","target":"462","id":"6154","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"132","target":"361","id":"4408","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"322","target":"639","id":"7702","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"83","target":"146","id":"3372","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"152","target":"206","id":"4830","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"170","target":"400","id":"5176","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"449","target":"676","id":"9255","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"41","target":"284","id":"2400","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"78","target":"598","id":"3274","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"495","target":"599","id":"9666","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"147","target":"653","id":"4737","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"191","target":"711","id":"5581","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"214","target":"445","id":"5980","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"135","target":"331","id":"4460","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"282","target":"651","id":"7107","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"6","target":"459","id":"1590","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"256","target":"510","id":"6673","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"167","target":"461","id":"5123","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"195","target":"525","id":"5645","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"200","target":"574","id":"5740","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"511","target":"652","id":"9794","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"57","target":"589","id":"2786","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"358","target":"487","id":"8164","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"133","target":"714","id":"4433","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"80","target":"258","id":"3311","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"117","target":"513","id":"4106","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"26","target":"46","id":"2036","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"69","target":"465","id":"3069","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"455","target":"535","id":"9310","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"601","target":"618","id":"10327","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"618","target":"619","id":"10406","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"115","target":"259","id":"4050","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"202","target":"555","id":"5780","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"144","target":"238","id":"4652","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"174","target":"540","id":"5254","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"104","target":"592","id":"3840","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"491","target":"725","id":"9630","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"206","target":"388","id":"5843","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"244","target":"714","id":"6476","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"87","target":"622","id":"3477","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"25","target":"174","id":"2021","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"200","target":"379","id":"5734","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"437","target":"590","id":"9119","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"88","target":"218","id":"3485","attributes":{"Weight":"1.0"},"color":"rgb(115,196,148)","size":1.0},{"source":"3","target":"359","id":"1523","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"421","target":"425","id":"8914","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"20","target":"126","id":"1914","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"159","target":"297","id":"4964","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"79","target":"82","id":"3277","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"241","target":"665","id":"6426","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"49","target":"256","id":"2585","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"405","target":"414","id":"8756","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"76","target":"421","id":"3220","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"53","target":"697","id":"2689","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"108","target":"205","id":"3891","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"51","target":"732","id":"2644","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"118","target":"628","id":"4126","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"222","target":"552","id":"6127","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"521","target":"603","id":"9859","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"282","target":"382","id":"7098","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"40","target":"584","id":"2390","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"242","target":"476","id":"6438","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"273","target":"666","id":"6958","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"336","target":"712","id":"7909","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"654","target":"677","id":"10567","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"444","target":"698","id":"9218","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"330","target":"559","id":"7824","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"120","target":"293","id":"4156","attributes":{"Weight":"1.0"},"color":"rgb(229,67,99)","size":1.0},{"source":"299","target":"444","id":"7374","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"84","target":"278","id":"3394","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"75","target":"500","id":"3204","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"184","target":"198","id":"5440","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"488","target":"705","id":"9602","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"283","target":"560","id":"7132","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"573","target":"623","id":"10189","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"23","target":"292","id":"1985","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"83","target":"627","id":"3385","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"154","target":"643","id":"4880","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"39","target":"226","id":"2363","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"400","target":"674","id":"8704","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"111","target":"397","id":"3973","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"207","target":"262","id":"5858","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"126","target":"683","id":"4284","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"334","target":"368","id":"7872","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"323","target":"436","id":"7710","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"286","target":"428","id":"7168","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"93","target":"200","id":"3599","attributes":{"Weight":"1.0"},"color":"rgb(148,196,83)","size":1.0},{"source":"516","target":"684","id":"9819","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"209","target":"344","id":"5891","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"255","target":"696","id":"6662","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"378","target":"550","id":"8400","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"65","target":"199","id":"2977","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"511","target":"619","id":"9793","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"165","target":"607","id":"5091","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"280","target":"431","id":"7060","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"351","target":"372","id":"8090","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"20","target":"544","id":"1929","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"1","target":"435","id":"1474","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"364","target":"723","id":"8230","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"216","target":"511","id":"6015","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"103","target":"276","id":"3810","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"417","target":"507","id":"8870","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"250","target":"251","id":"6559","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"64","target":"112","id":"2947","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"41","target":"598","id":"2409","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"236","target":"429","id":"6347","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"294","target":"571","id":"7302","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"489","target":"499","id":"9603","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"105","target":"457","id":"3852","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"176","target":"549","id":"5295","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"235","target":"595","id":"6340","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"165","target":"166","id":"5076","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"385","target":"623","id":"8512","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"150","target":"349","id":"4785","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"345","target":"350","id":"8012","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"338","target":"682","id":"7936","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"17","target":"592","id":"1864","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"49","target":"592","id":"2600","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"52","target":"351","id":"2654","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"374","target":"454","id":"8336","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"222","target":"429","id":"6123","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"301","target":"703","id":"7416","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"32","target":"423","id":"2197","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"233","target":"323","id":"6298","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"630","target":"672","id":"10454","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"363","target":"706","id":"8215","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"498","target":"543","id":"9690","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"401","target":"696","id":"8718","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"141","target":"516","id":"4600","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"101","target":"239","id":"3771","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"314","target":"682","id":"7595","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"67","target":"184","id":"3015","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"61","target":"244","id":"2872","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"393","target":"394","id":"8607","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"71","target":"107","id":"3107","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"309","target":"672","id":"7523","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"419","target":"489","id":"8897","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"33","target":"64","id":"2208","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"154","target":"629","id":"4878","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"193","target":"729","id":"5614","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"337","target":"396","id":"7913","attributes":{"Weight":"1.0"},"color":"rgb(132,99,229)","size":1.0},{"source":"708","target":"733","id":"10671","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"42","target":"593","id":"2430","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"395","target":"411","id":"8634","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"207","target":"214","id":"5854","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"518","target":"611","id":"9835","attributes":{"Weight":"1.0"},"color":"rgb(148,164,115)","size":1.0},{"source":"7","target":"665","id":"1620","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"249","target":"478","id":"6551","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"257","target":"639","id":"6688","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"281","target":"285","id":"7077","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"438","target":"465","id":"9125","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"126","target":"265","id":"4272","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"240","target":"430","id":"6400","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"156","target":"341","id":"4911","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"116","target":"144","id":"4067","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"29","target":"459","id":"2132","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"347","target":"437","id":"8039","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"513","target":"681","id":"9799","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"406","target":"513","id":"8764","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"188","target":"716","id":"5527","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"494","target":"582","id":"9657","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"469","target":"669","id":"9455","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"263","target":"624","id":"6792","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"491","target":"735","id":"9634","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"144","target":"415","id":"4660","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"119","target":"501","id":"4142","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"140","target":"327","id":"4562","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"154","target":"227","id":"4863","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"396","target":"714","id":"8654","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"416","target":"482","id":"8863","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"8","target":"386","id":"1640","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"270","target":"684","id":"6914","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"436","target":"699","id":"9115","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"153","target":"304","id":"4849","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"245","target":"371","id":"6482","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"328","target":"464","id":"7785","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"64","target":"132","id":"2950","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"277","target":"716","id":"7022","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"109","target":"206","id":"3913","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"208","target":"479","id":"5878","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"321","target":"337","id":"7684","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"156","target":"683","id":"4921","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"139","target":"144","id":"4533","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"383","target":"403","id":"8472","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"226","target":"302","id":"6183","attributes":{"Weight":"1.0"},"color":"rgb(180,213,67)","size":1.0},{"source":"680","target":"686","id":"10629","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"398","target":"671","id":"8678","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"139","target":"713","id":"4555","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"70","target":"211","id":"3085","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"363","target":"417","id":"8205","attributes":{"Weight":"1.0"},"color":"rgb(132,148,164)","size":1.0},{"source":"403","target":"702","id":"8738","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"372","target":"456","id":"8310","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"124","target":"239","id":"4235","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"471","target":"541","id":"9471","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"154","target":"308","id":"4866","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"22","target":"640","id":"1971","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"298","target":"541","id":"7365","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"249","target":"661","id":"6557","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"117","target":"681","id":"4109","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"472","target":"562","id":"9481","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"18","target":"437","id":"1878","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"286","target":"332","id":"7166","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"306","target":"570","id":"7479","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"214","target":"512","id":"5983","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"33","target":"489","id":"2237","attributes":{"Weight":"1.0"},"color":"rgb(229,99,99)","size":1.0},{"source":"131","target":"428","id":"4379","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"273","target":"570","id":"6954","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"3","target":"352","id":"1522","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"371","target":"720","id":"8307","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"359","target":"463","id":"8174","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"27","target":"232","id":"2063","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"83","target":"705","id":"3387","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"451","target":"642","id":"9272","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"596","target":"690","id":"10310","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"64","target":"362","id":"2965","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"444","target":"469","id":"9210","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"246","target":"398","id":"6500","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"160","target":"715","id":"4997","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"175","target":"511","id":"5273","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"217","target":"626","id":"6039","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"250","target":"545","id":"6570","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"432","target":"535","id":"9057","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"729","target":"735","id":"10687","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"491","target":"689","id":"9628","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"121","target":"359","id":"4182","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"242","target":"326","id":"6433","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"288","target":"425","id":"7200","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"89","target":"246","id":"3517","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"145","target":"577","id":"4696","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"259","target":"597","id":"6724","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"55","target":"142","id":"2723","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"20","target":"530","id":"1928","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"192","target":"598","id":"5593","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"150","target":"629","id":"4797","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"210","target":"579","id":"5907","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"526","target":"655","id":"9908","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"28","target":"71","id":"2089","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"184","target":"633","id":"5449","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"324","target":"334","id":"7720","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"184","target":"538","id":"5448","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"390","target":"411","id":"8569","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"308","target":"462","id":"7503","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"83","target":"278","id":"3376","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"629","target":"679","id":"10451","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"402","target":"558","id":"8724","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"384","target":"386","id":"8483","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"49","target":"267","id":"2586","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"467","target":"599","id":"9434","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"350","target":"673","id":"8086","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"105","target":"701","id":"3856","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"322","target":"638","id":"7701","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"34","target":"104","id":"2245","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"161","target":"638","id":"5009","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"255","target":"356","id":"6648","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"2","target":"304","id":"1498","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"187","target":"444","id":"5500","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"54","target":"600","id":"2716","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"138","target":"590","id":"4528","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"134","target":"242","id":"4436","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"30","target":"201","id":"2148","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"147","target":"301","id":"4727","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"70","target":"487","id":"3099","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"24","target":"568","id":"2009","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"76","target":"565","id":"3232","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"569","target":"644","id":"10160","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"69","target":"281","id":"3059","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"108","target":"173","id":"3889","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"647","target":"725","id":"10534","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"178","target":"492","id":"5338","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"496","target":"682","id":"9676","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"21","target":"22","id":"1932","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"48","target":"439","id":"2570","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"36","target":"467","id":"2298","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"124","target":"207","id":"4230","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"571","target":"652","id":"10175","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"37","target":"662","id":"2325","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"28","target":"579","id":"2116","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"338","target":"496","id":"7928","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"48","target":"695","id":"2575","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"110","target":"155","id":"3933","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"177","target":"422","id":"5312","attributes":{"Weight":"1.0"},"color":"rgb(132,229,99)","size":1.0},{"source":"579","target":"705","id":"10240","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"181","target":"234","id":"5389","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"291","target":"416","id":"7259","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"302","target":"637","id":"7425","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"205","target":"493","id":"5826","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"333","target":"578","id":"7860","attributes":{"Weight":"1.0"},"color":"rgb(196,196,67)","size":1.0},{"source":"654","target":"685","id":"10569","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"280","target":"323","id":"7057","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"271","target":"364","id":"6919","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"466","target":"650","id":"9421","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"449","target":"481","id":"9250","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"363","target":"587","id":"8210","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"129","target":"165","id":"4327","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"94","target":"496","id":"3629","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"307","target":"313","id":"7485","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"87","target":"196","id":"3456","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"522","target":"654","id":"9869","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"374","target":"480","id":"8338","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"81","target":"541","id":"3341","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"303","target":"575","id":"7441","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"340","target":"590","id":"7960","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"231","target":"603","id":"6273","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"269","target":"413","id":"6897","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"436","target":"696","id":"9114","attributes":{"Weight":"1.0"},"color":"rgb(229,67,148)","size":1.0},{"source":"578","target":"655","id":"10228","attributes":{"Weight":"1.0"},"color":"rgb(115,196,148)","size":1.0},{"source":"309","target":"701","id":"7524","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"363","target":"500","id":"8206","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"516","target":"635","id":"9816","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"475","target":"498","id":"9513","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"269","target":"561","id":"6901","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"500","target":"649","id":"9710","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"245","target":"429","id":"6486","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"394","target":"560","id":"8628","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"195","target":"582","id":"5647","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"492","target":"718","id":"9642","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"150","target":"316","id":"4783","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"554","target":"701","id":"10081","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"357","target":"581","id":"8157","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"638","target":"657","id":"10489","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"523","target":"728","id":"9884","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"130","target":"369","id":"4357","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"189","target":"333","id":"5536","attributes":{"Weight":"1.0"},"color":"rgb(229,148,67)","size":1.0},{"source":"321","target":"407","id":"7686","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"142","target":"300","id":"4611","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"17","target":"229","id":"1848","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"490","target":"622","id":"9616","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"431","target":"567","id":"9045","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"613","target":"659","id":"10390","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"503","target":"664","id":"9730","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"204","target":"497","id":"5809","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"532","target":"667","id":"9954","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"198","target":"697","id":"5713","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"360","target":"588","id":"8189","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"254","target":"656","id":"6643","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"492","target":"536","id":"9636","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"362","target":"512","id":"8201","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"75","target":"587","id":"3208","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"481","target":"622","id":"9563","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"290","target":"377","id":"7239","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"105","target":"304","id":"3847","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"179","target":"547","id":"5358","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"314","target":"606","id":"7591","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"374","target":"498","id":"8339","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"102","target":"429","id":"3796","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"307","target":"477","id":"7491","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"19","target":"422","id":"1901","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"281","target":"441","id":"7080","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"560","target":"658","id":"10111","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"511","target":"618","id":"9792","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"244","target":"566","id":"6469","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"287","target":"358","id":"7181","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"177","target":"693","id":"5326","attributes":{"Weight":"1.0"},"color":"rgb(115,229,99)","size":1.0},{"source":"299","target":"535","id":"7378","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"348","target":"713","id":"8060","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"407","target":"705","id":"8776","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"293","target":"568","id":"7285","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"572","target":"643","id":"10181","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"19","target":"249","id":"1896","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"53","target":"538","id":"2682","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"135","target":"431","id":"4466","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"534","target":"714","id":"9973","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"573","target":"629","id":"10190","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"213","target":"326","id":"5958","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"456","target":"464","id":"9321","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"399","target":"561","id":"8690","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"85","target":"567","id":"3426","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"679","target":"707","id":"10628","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"18","target":"118","id":"1867","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"294","target":"381","id":"7297","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"385","target":"648","id":"8513","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"280","target":"717","id":"7074","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"276","target":"317","id":"6993","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"11","target":"670","id":"1726","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"491","target":"734","id":"9633","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"463","target":"607","id":"9393","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"84","target":"210","id":"3392","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"61","target":"613","id":"2892","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"288","target":"543","id":"7210","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"88","target":"453","id":"3497","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"135","target":"490","id":"4470","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"127","target":"671","id":"4301","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"177","target":"654","id":"5321","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"35","target":"273","id":"2272","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"368","target":"499","id":"8268","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"245","target":"319","id":"6479","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"365","target":"406","id":"8233","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"188","target":"277","id":"5512","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"145","target":"431","id":"4686","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"369","target":"652","id":"8282","attributes":{"Weight":"1.0"},"color":"rgb(148,115,148)","size":1.0},{"source":"142","target":"653","id":"4622","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"479","target":"620","id":"9546","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"67","target":"183","id":"3014","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"271","target":"504","id":"6921","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"602","target":"661","id":"10334","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"417","target":"714","id":"8878","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"21","target":"289","id":"1942","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"201","target":"353","id":"5756","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"579","target":"662","id":"10239","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"177","target":"386","id":"5310","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"298","target":"313","id":"7355","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"81","target":"680","id":"3343","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"218","target":"582","id":"6059","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"80","target":"232","id":"3309","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"154","target":"183","id":"4861","attributes":{"Weight":"1.0"},"color":"rgb(180,148,132)","size":1.0},{"source":"279","target":"422","id":"7040","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"438","target":"491","id":"9127","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"379","target":"706","id":"8419","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"109","target":"727","id":"3928","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"525","target":"585","id":"9898","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"64","target":"445","id":"2968","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"221","target":"422","id":"6101","attributes":{"Weight":"1.0"},"color":"rgb(132,229,148)","size":1.0},{"source":"257","target":"485","id":"6683","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"474","target":"638","id":"9506","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"368","target":"552","id":"8271","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"242","target":"718","id":"6446","attributes":{"Weight":"1.0"},"color":"rgb(100,148,148)","size":1.0},{"source":"154","target":"164","id":"4860","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"58","target":"482","id":"2809","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"209","target":"361","id":"5893","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"59","target":"622","id":"2830","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"368","target":"643","id":"8274","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"93","target":"216","id":"3600","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"84","target":"488","id":"3399","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"306","target":"598","id":"7481","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"572","target":"591","id":"10179","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"490","target":"728","id":"9621","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"53","target":"184","id":"2673","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"525","target":"631","id":"9900","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"149","target":"496","id":"4767","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"70","target":"450","id":"3096","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"135","target":"720","id":"4480","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"222","target":"489","id":"6124","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"469","target":"624","id":"9452","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"129","target":"685","id":"4347","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"6","target":"313","id":"1588","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"257","target":"657","id":"6689","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"522","target":"567","id":"9866","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"327","target":"577","id":"7770","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"113","target":"488","id":"4014","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"318","target":"446","id":"7640","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"15","target":"585","id":"1816","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"32","target":"694","id":"2205","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"58","target":"481","id":"2808","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"203","target":"442","id":"5790","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"258","target":"303","id":"6695","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"568","target":"640","id":"10148","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"529","target":"717","id":"9942","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"160","target":"246","id":"4981","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"333","target":"601","id":"7863","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"460","target":"685","id":"9371","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"147","target":"299","id":"4725","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"293","target":"640","id":"7286","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"298","target":"620","id":"7366","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"235","target":"552","id":"6339","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"291","target":"452","id":"7263","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"643","target":"644","id":"10514","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"503","target":"520","id":"9726","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"250","target":"401","id":"6565","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"11","target":"628","id":"1724","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"190","target":"379","id":"5556","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"99","target":"370","id":"3738","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"36","target":"137","id":"2289","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"45","target":"64","id":"2494","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"190","target":"259","id":"5553","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"366","target":"369","id":"8241","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"149","target":"396","id":"4765","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"468","target":"471","id":"9437","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"213","target":"502","id":"5964","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"265","target":"375","id":"6821","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"459","target":"468","id":"9346","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"273","target":"584","id":"6955","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"480","target":"573","id":"9552","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"40","target":"666","id":"2393","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"292","target":"640","id":"7276","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"63","target":"726","id":"2945","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"309","target":"366","id":"7516","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"445","target":"692","id":"9223","attributes":{"Weight":"1.0"},"color":"rgb(196,180,67)","size":1.0},{"source":"516","target":"637","id":"9818","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"151","target":"323","id":"4813","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"97","target":"526","id":"3698","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"28","target":"349","id":"2105","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"64","target":"252","id":"2959","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"418","target":"525","id":"8883","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"145","target":"490","id":"4692","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"86","target":"216","id":"3436","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"315","target":"599","id":"7604","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"18","target":"709","id":"1885","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"216","target":"333","id":"6010","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"224","target":"308","id":"6146","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"260","target":"422","id":"6736","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"651","target":"689","id":"10553","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"391","target":"658","id":"8591","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"190","target":"597","id":"5564","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"471","target":"550","id":"9472","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"330","target":"731","id":"7829","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"194","target":"706","id":"5634","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"58","target":"449","id":"2805","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"301","target":"624","id":"7412","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"116","target":"646","id":"4090","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"450","target":"642","id":"9264","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"363","target":"691","id":"8213","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"78","target":"599","id":"3275","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"140","target":"386","id":"4565","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"172","target":"679","id":"5228","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"384","target":"602","id":"8490","attributes":{"Weight":"1.0"},"color":"rgb(115,229,99)","size":1.0},{"source":"86","target":"528","id":"3444","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"77","target":"686","id":"3260","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"375","target":"454","id":"8352","attributes":{"Weight":"1.0"},"color":"rgb(83,229,115)","size":1.0},{"source":"37","target":"407","id":"2317","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"413","target":"561","id":"8838","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"219","target":"630","id":"6075","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"80","target":"231","id":"3308","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"239","target":"354","id":"6390","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"508","target":"589","id":"9772","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"6","target":"479","id":"1595","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"29","target":"541","id":"2140","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"310","target":"541","id":"7535","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"99","target":"304","id":"3734","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"538","target":"736","id":"10001","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"453","target":"693","id":"9291","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"188","target":"511","id":"5517","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"79","target":"678","id":"3301","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"408","target":"667","id":"8784","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"247","target":"666","id":"6527","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"82","target":"122","id":"3345","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"128","target":"727","id":"4324","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"238","target":"415","id":"6374","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"217","target":"579","id":"6037","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"543","target":"573","id":"10024","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"326","target":"476","id":"7751","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"578","target":"661","id":"10229","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"111","target":"316","id":"3967","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"445","target":"723","id":"9224","attributes":{"Weight":"1.0"},"color":"rgb(196,180,67)","size":1.0},{"source":"197","target":"609","id":"5694","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"641","target":"732","id":"10509","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"131","target":"593","id":"4387","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"86","target":"601","id":"3448","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"145","target":"547","id":"4694","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"329","target":"609","id":"7807","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"272","target":"590","id":"6942","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"101","target":"484","id":"3781","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"52","target":"549","id":"2663","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"640","target":"704","id":"10501","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"571","target":"593","id":"10169","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"59","target":"237","id":"2818","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"455","target":"653","id":"9315","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"85","target":"699","id":"3429","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"449","target":"622","id":"9253","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"646","target":"650","id":"10520","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"381","target":"589","id":"8443","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"234","target":"734","id":"6328","attributes":{"Weight":"1.0"},"color":"rgb(67,83,229)","size":1.0},{"source":"540","target":"695","id":"10010","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"549","target":"551","id":"10055","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"537","target":"636","id":"9989","attributes":{"Weight":"1.0"},"color":"rgb(99,229,83)","size":1.0},{"source":"398","target":"583","id":"8670","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"637","target":"697","id":"10486","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"527","target":"667","id":"9916","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"440","target":"565","id":"9157","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"238","target":"717","id":"6386","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"294","target":"373","id":"7296","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"389","target":"495","id":"8556","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"263","target":"653","id":"6793","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"84","target":"182","id":"3391","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"134","target":"156","id":"4434","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"33","target":"320","id":"2225","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"543","target":"565","id":"10023","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"238","target":"434","id":"6375","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"66","target":"247","id":"2996","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"474","target":"671","id":"9509","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"232","target":"258","id":"6281","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"29","target":"81","id":"2124","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"102","target":"120","id":"3783","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"302","target":"697","id":"7428","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"158","target":"243","id":"4946","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"21","target":"174","id":"1940","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"147","target":"300","id":"4726","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"183","target":"642","id":"5433","attributes":{"Weight":"1.0"},"color":"rgb(99,229,148)","size":1.0},{"source":"58","target":"537","id":"2811","attributes":{"Weight":"1.0"},"color":"rgb(132,229,83)","size":1.0},{"source":"90","target":"117","id":"3534","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"114","target":"649","id":"4041","attributes":{"Weight":"1.0"},"color":"rgb(115,148,164)","size":1.0},{"source":"303","target":"348","id":"7433","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"215","target":"693","id":"6003","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"704","target":"708","id":"10666","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"631","target":"722","id":"10457","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"59","target":"123","id":"2815","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"372","target":"464","id":"8311","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"135","target":"529","id":"4471","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"25","target":"641","id":"2029","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"131","target":"294","id":"4375","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"81","target":"686","id":"3344","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"188","target":"286","id":"5513","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"127","target":"690","id":"4302","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"152","target":"336","id":"4832","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"91","target":"476","id":"3566","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"7","target":"260","id":"1606","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"351","target":"700","id":"8101","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"598","target":"666","id":"10320","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"260","target":"364","id":"6734","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"133","target":"350","id":"4421","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"10","target":"219","id":"1691","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"307","target":"458","id":"7486","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"532","target":"625","id":"9952","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"558","target":"696","id":"10105","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"232","target":"575","id":"6288","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"427","target":"464","id":"8994","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"371","target":"644","id":"8303","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"418","target":"582","id":"8885","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"426","target":"536","id":"8986","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"382","target":"730","id":"8469","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"130","target":"670","id":"4367","attributes":{"Weight":"1.0"},"color":"rgb(67,148,213)","size":1.0},{"source":"229","target":"276","id":"6234","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"26","target":"481","id":"2052","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"311","target":"460","id":"7542","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"200","target":"691","id":"5746","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"576","target":"583","id":"10210","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"240","target":"634","id":"6410","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"118","target":"590","id":"4124","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"151","target":"717","id":"4828","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"343","target":"617","id":"8002","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"39","target":"167","id":"2359","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"118","target":"340","id":"4116","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"257","target":"692","id":"6691","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"299","target":"432","id":"7373","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"197","target":"426","id":"5686","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"88","target":"690","id":"3507","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"139","target":"603","id":"4550","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"302","target":"538","id":"7421","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"11","target":"447","id":"1720","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"158","target":"293","id":"4948","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"514","target":"539","id":"9802","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"621","target":"657","id":"10418","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"258","target":"576","id":"6705","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"404","target":"628","id":"8748","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"99","target":"219","id":"3731","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"569","target":"720","id":"10162","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"29","target":"148","id":"2125","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"435","target":"722","id":"9105","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"138","target":"272","id":"4518","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"91","target":"213","id":"3558","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"383","target":"702","id":"8481","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"183","target":"335","id":"5422","attributes":{"Weight":"1.0"},"color":"rgb(99,229,99)","size":1.0},{"source":"466","target":"491","id":"9418","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"377","target":"399","id":"8383","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"116","target":"583","id":"4086","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"498","target":"623","id":"9695","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"31","target":"630","id":"2182","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"183","target":"312","id":"5421","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"110","target":"720","id":"3958","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"163","target":"550","id":"5050","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"253","target":"660","id":"6628","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"1","target":"585","id":"1481","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"116","target":"238","id":"4071","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"298","target":"470","id":"7359","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"224","target":"376","id":"6150","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"187","target":"432","id":"5499","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"30","target":"235","id":"2151","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"421","target":"543","id":"8921","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"7","target":"215","id":"1604","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"200","target":"383","id":"5735","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"521","target":"663","id":"9861","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"164","target":"316","id":"5060","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"189","target":"214","id":"5530","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"79","target":"573","id":"3295","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"132","target":"239","id":"4403","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"117","target":"683","id":"4110","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"152","target":"360","id":"4834","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"101","target":"214","id":"3768","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"105","target":"181","id":"3844","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"374","target":"517","id":"8340","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"306","target":"389","id":"7476","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"501","target":"550","id":"9715","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"348","target":"398","id":"8047","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"621","target":"671","id":"10419","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"313","target":"470","id":"7571","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"83","target":"113","id":"3371","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"232","target":"616","id":"6292","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"633","target":"636","id":"10466","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"73","target":"198","id":"3152","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"357","target":"509","id":"8153","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"13","target":"495","id":"1767","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"136","target":"563","id":"4494","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"155","target":"572","id":"4898","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"260","target":"504","id":"6738","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"267","target":"546","id":"6857","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"59","target":"125","id":"2816","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"533","target":"579","id":"9961","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"112","target":"207","id":"3989","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"56","target":"685","id":"2765","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"277","target":"517","id":"7010","attributes":{"Weight":"1.0"},"color":"rgb(148,196,115)","size":1.0},{"source":"317","target":"581","id":"7635","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"626","target":"705","id":"10442","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"198","target":"658","id":"5710","attributes":{"Weight":"1.0"},"color":"rgb(180,148,115)","size":1.0},{"source":"229","target":"317","id":"6236","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"65","target":"118","id":"2975","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"124","target":"230","id":"4234","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"428","target":"618","id":"9011","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"574","target":"702","id":"10199","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"334","target":"489","id":"7875","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"97","target":"519","id":"3696","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"180","target":"703","id":"5386","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"497","target":"635","id":"9682","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"157","target":"455","id":"4932","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"442","target":"611","id":"9189","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"164","target":"572","id":"5067","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"122","target":"623","id":"4207","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"403","target":"706","id":"8739","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"111","target":"643","id":"3982","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"63","target":"621","id":"2937","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"141","target":"416","id":"4591","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"520","target":"664","id":"9850","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"585","target":"605","id":"10263","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"81","target":"313","id":"3330","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"18","target":"520","id":"1880","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"248","target":"550","id":"6536","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"167","target":"168","id":"5115","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"14","target":"640","id":"1794","attributes":{"Weight":"1.0"},"color":"rgb(148,148,83)","size":1.0},{"source":"14","target":"500","id":"1788","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"415","target":"603","id":"8850","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"369","target":"630","id":"8281","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"56","target":"140","id":"2747","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"145","target":"280","id":"4678","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"209","target":"214","id":"5885","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"26","target":"482","id":"2053","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"59","target":"675","id":"2831","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"45","target":"291","id":"2501","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"428","target":"528","id":"9004","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"88","target":"162","id":"3482","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"51","target":"243","id":"2633","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"544","target":"681","id":"10032","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"281","target":"734","id":"7094","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"543","target":"728","id":"10031","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"419","target":"645","id":"8905","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"426","target":"551","id":"8988","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"381","target":"472","id":"8434","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"76","target":"473","id":"3225","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"527","target":"567","id":"9912","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"356","target":"410","id":"8141","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"161","target":"485","id":"5005","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"283","target":"561","id":"7133","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"38","target":"39","id":"2328","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"51","target":"708","id":"2643","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"134","target":"341","id":"4439","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"201","target":"235","id":"5751","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"63","target":"264","id":"2930","attributes":{"Weight":"1.0"},"color":"rgb(115,83,229)","size":1.0},{"source":"676","target":"728","id":"10621","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"286","target":"716","id":"7179","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"684","target":"697","id":"10633","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"358","target":"451","id":"8162","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"112","target":"361","id":"3999","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"335","target":"603","id":"7889","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"212","target":"642","id":"5951","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"412","target":"559","id":"8830","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"114","target":"726","id":"4046","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"146","target":"217","id":"4706","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"64","target":"189","id":"2951","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"244","target":"396","id":"6464","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"92","target":"456","id":"3585","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"80","target":"167","id":"3307","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"521","target":"565","id":"9856","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"109","target":"336","id":"3915","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"104","target":"509","id":"3835","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"226","target":"240","id":"6182","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"480","target":"611","id":"9554","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"305","target":"552","id":"7471","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"119","target":"152","id":"4132","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"317","target":"592","id":"7636","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"257","target":"297","id":"6678","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"514","target":"624","id":"9804","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"48","target":"243","id":"2567","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"372","target":"427","id":"8309","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"209","target":"239","id":"5888","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"381","target":"443","id":"8433","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"385","target":"577","id":"8509","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"165","target":"352","id":"5084","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"254","target":"660","id":"6644","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"10","target":"701","id":"1703","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"200","target":"259","id":"5731","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"409","target":"498","id":"8795","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"12","target":"287","id":"1737","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"14","target":"16","id":"1773","attributes":{"Weight":"1.0"},"color":"rgb(148,148,83)","size":1.0},{"source":"179","target":"227","id":"5346","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"245","target":"373","id":"6483","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"471","target":"477","id":"9467","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"575","target":"681","id":"10208","attributes":{"Weight":"1.0"},"color":"rgb(83,229,99)","size":1.0},{"source":"462","target":"645","id":"9388","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"83","target":"321","id":"3377","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"95","target":"136","id":"3642","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"252","target":"482","id":"6609","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"494","target":"722","id":"9662","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"171","target":"534","id":"5201","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"41","target":"599","id":"2410","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"438","target":"646","id":"9128","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"490","target":"529","id":"9612","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"393","target":"412","id":"8612","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"215","target":"661","id":"5999","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"100","target":"234","id":"3751","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"305","target":"489","id":"7468","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"136","target":"588","id":"4495","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"203","target":"518","id":"5796","attributes":{"Weight":"1.0"},"color":"rgb(148,164,115)","size":1.0},{"source":"475","target":"518","id":"9515","attributes":{"Weight":"1.0"},"color":"rgb(148,164,115)","size":1.0},{"source":"189","target":"320","id":"5535","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"268","target":"290","id":"6863","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"272","target":"387","id":"6937","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"66","target":"598","id":"3009","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"493","target":"585","id":"9648","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"216","target":"589","id":"6019","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"469","target":"653","id":"9454","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"292","target":"540","id":"7274","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"359","target":"531","id":"8176","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"14","target":"691","id":"1796","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"304","target":"526","id":"7456","attributes":{"Weight":"1.0"},"color":"rgb(67,115,229)","size":1.0},{"source":"97","target":"205","id":"3687","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"420","target":"533","id":"8908","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"618","target":"652","id":"10407","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"108","target":"526","id":"3901","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"692","target":"723","id":"10653","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"544","target":"683","id":"10033","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"103","target":"104","id":"3804","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"70","target":"555","id":"3100","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"274","target":"493","id":"6962","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"97","target":"631","id":"3702","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"46","target":"449","id":"2531","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"241","target":"721","id":"6430","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"185","target":"463","id":"5467","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"157","target":"535","id":"4937","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"25","target":"540","id":"2026","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"556","target":"660","id":"10091","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"471","target":"479","id":"9468","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"158","target":"708","id":"4956","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"221","target":"358","id":"6098","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"359","target":"685","id":"8180","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"12","target":"261","id":"1736","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"141","target":"478","id":"4597","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"548","target":"552","id":"10052","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"90","target":"683","id":"3553","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"68","target":"633","id":"3047","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"2","target":"106","id":"1492","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"191","target":"461","id":"5575","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"582","target":"605","id":"10250","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"7","target":"610","id":"1618","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"487","target":"600","id":"9591","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"237","target":"481","id":"6363","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"165","target":"185","id":"5079","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"690","target":"693","id":"10646","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"3","target":"191","id":"1519","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"323","target":"376","id":"7708","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"333","target":"511","id":"7857","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"132","target":"354","id":"4407","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"465","target":"466","id":"9405","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"576","target":"713","id":"10216","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"172","target":"179","id":"5212","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"206","target":"617","id":"5850","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"63","target":"297","id":"2931","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"98","target":"549","id":"3719","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"77","target":"459","id":"3249","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"318","target":"576","id":"7648","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"191","target":"430","id":"5574","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"442","target":"517","id":"9186","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"63","target":"127","id":"2924","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"555","target":"707","id":"10086","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"81","target":"298","id":"3327","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"311","target":"677","id":"7552","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"460","target":"562","id":"9361","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"131","target":"589","id":"4386","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"199","target":"709","id":"5730","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"290","target":"390","id":"7240","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"472","target":"682","id":"9488","attributes":{"Weight":"1.0"},"color":"rgb(213,67,229)","size":1.0},{"source":"98","target":"328","id":"3708","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"79","target":"454","id":"3289","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"55","target":"175","id":"2727","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"16","target":"704","id":"1839","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"593","target":"618","id":"10297","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"505","target":"587","id":"9746","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"249","target":"404","id":"6544","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"409","target":"594","id":"8804","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"175","target":"432","id":"5269","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"346","target":"670","id":"8035","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"221","target":"451","id":"6104","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"175","target":"325","id":"5268","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"220","target":"670","id":"6090","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"129","target":"430","id":"4339","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"58","target":"675","id":"2814","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"432","target":"623","id":"9062","attributes":{"Weight":"1.0"},"color":"rgb(99,148,196)","size":1.0},{"source":"185","target":"486","id":"5468","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"238","target":"342","id":"6372","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"657","target":"715","id":"10578","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"89","target":"161","id":"3516","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"652","target":"703","id":"10561","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"9","target":"368","id":"1674","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"253","target":"696","id":"6631","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"491","target":"729","id":"9631","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"259","target":"342","id":"6713","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"49","target":"103","id":"2580","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"6","target":"208","id":"1584","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"452","target":"478","id":"9274","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"437","target":"503","id":"9117","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"255","target":"545","id":"6654","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"162","target":"596","id":"5029","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"442","target":"475","id":"9183","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"47","target":"545","id":"2555","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"50","target":"154","id":"2606","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"116","target":"603","id":"4087","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"195","target":"526","id":"5646","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"141","target":"422","id":"4592","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"261","target":"451","id":"6761","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"193","target":"465","id":"5604","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"203","target":"433","id":"5789","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"123","target":"478","id":"4222","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"259","target":"403","id":"6717","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"322","target":"726","id":"7706","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"21","target":"641","id":"1951","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"241","target":"260","id":"6412","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"241","target":"497","id":"6419","attributes":{"Weight":"1.0"},"color":"rgb(148,229,67)","size":1.0},{"source":"225","target":"608","id":"6179","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"196","target":"473","id":"5664","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"480","target":"623","id":"9556","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"423","target":"696","id":"8950","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"472","target":"663","id":"9487","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"334","target":"353","id":"7870","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"99","target":"554","id":"3740","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"413","target":"731","id":"8840","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"74","target":"677","id":"3188","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"42","target":"486","id":"2425","attributes":{"Weight":"1.0"},"color":"rgb(229,180,67)","size":1.0},{"source":"200","target":"363","id":"5733","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"233","target":"717","id":"6311","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"502","target":"544","id":"9723","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"124","target":"344","id":"4239","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"53","target":"312","id":"2678","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"304","target":"309","id":"7450","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"339","target":"364","id":"7938","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"479","target":"518","id":"9544","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"124","target":"512","id":"4246","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"410","target":"423","id":"8810","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"236","target":"499","id":"6349","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"233","target":"331","id":"6299","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"82","target":"442","id":"3354","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"55","target":"535","id":"2739","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"1","target":"494","id":"1476","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"385","target":"433","id":"8500","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"27","target":"713","id":"2085","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"103","target":"564","id":"3820","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"40","target":"66","id":"2376","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"697","target":"736","id":"10661","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"159","target":"657","id":"4975","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"583","target":"702","id":"10258","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"290","target":"405","id":"7247","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"267","target":"276","id":"6847","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"386","target":"654","id":"8527","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"139","target":"654","id":"4552","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"348","target":"430","id":"8049","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"244","target":"659","id":"6473","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"11","target":"59","id":"1706","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"466","target":"724","id":"9424","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"505","target":"597","id":"9747","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"241","target":"661","id":"6425","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"301","target":"698","id":"7415","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"70","target":"419","id":"3094","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"304","target":"352","id":"7451","attributes":{"Weight":"1.0"},"color":"rgb(148,132,148)","size":1.0},{"source":"369","target":"370","id":"8277","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"253","target":"255","id":"6616","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"113","target":"626","id":"4017","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"356","target":"660","id":"8148","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"184","target":"688","id":"5454","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"54","target":"211","id":"2694","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"606","target":"673","id":"10355","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"581","target":"592","id":"10248","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"636","target":"736","id":"10483","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"42","target":"332","id":"2422","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"150","target":"318","id":"4784","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"155","target":"677","id":"4903","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"405","target":"561","id":"8759","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"69","target":"646","id":"3073","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"191","target":"226","id":"5569","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"97","target":"108","id":"3684","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"299","target":"698","id":"7385","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"30","target":"236","id":"2152","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"150","target":"713","id":"4801","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"61","target":"507","id":"2887","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"110","target":"227","id":"3936","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"13","target":"41","id":"1754","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"458","target":"459","id":"9334","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"149","target":"338","id":"4762","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"96","target":"304","id":"3674","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"124","target":"209","id":"4231","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"50","target":"720","id":"2630","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"95","target":"501","id":"3655","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"179","target":"707","id":"5368","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"236","target":"489","id":"6348","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"258","target":"434","id":"6702","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"11","target":"18","id":"1704","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"430","target":"583","id":"9033","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"99","target":"181","id":"3730","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"423","target":"556","id":"8943","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"7","target":"721","id":"1624","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"64","target":"461","id":"2969","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"176","target":"197","id":"5283","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"196","target":"594","id":"5673","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"602","target":"690","id":"10336","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"327","target":"611","id":"7771","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"325","target":"682","id":"7745","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"171","target":"314","id":"5192","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"103","target":"267","id":"3808","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"35","target":"495","id":"2279","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"92","target":"178","id":"3576","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"225","target":"261","id":"6167","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"402","target":"660","id":"8726","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"296","target":"493","id":"7326","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"168","target":"185","id":"5130","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"211","target":"319","id":"5917","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"194","target":"383","id":"5623","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"92","target":"536","id":"3588","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"281","target":"282","id":"7076","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"365","target":"530","id":"8237","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"258","target":"616","id":"6708","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"3","target":"168","id":"1517","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"86","target":"188","id":"3435","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"234","target":"370","id":"6318","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"120","target":"489","id":"4163","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"120","target":"228","id":"4153","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"234","target":"457","id":"6319","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"620","target":"680","id":"10413","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"412","target":"560","id":"8831","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"316","target":"629","id":"7619","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"323","target":"547","id":"7714","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"135","target":"151","id":"4451","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"32","target":"557","id":"2200","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"88","target":"665","id":"3506","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"145","target":"455","id":"4691","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"346","target":"387","id":"8027","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"412","target":"731","id":"8834","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"230","target":"320","id":"6249","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"400","target":"401","id":"8694","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"335","target":"707","id":"7893","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"126","target":"134","id":"4268","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"112","target":"483","id":"4002","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"68","target":"538","id":"3045","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"5","target":"348","id":"1568","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"117","target":"365","id":"4101","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"589","target":"728","id":"10285","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"324","target":"489","id":"7724","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"285","target":"724","id":"7159","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"335","target":"462","id":"7884","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"89","target":"160","id":"3515","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"505","target":"706","id":"9751","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"419","target":"569","id":"8900","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"219","target":"701","id":"6077","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"53","target":"67","id":"2669","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"43","target":"65","id":"2437","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"439","target":"709","id":"9147","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"359","target":"634","id":"8178","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"81","target":"468","id":"3333","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"538","target":"697","id":"10000","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"304","target":"369","id":"7453","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"127","target":"621","id":"4296","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"28","target":"319","id":"2102","attributes":{"Weight":"1.0"},"color":"rgb(67,180,229)","size":1.0},{"source":"53","target":"516","id":"2680","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"163","target":"506","id":"5049","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"87","target":"490","id":"3467","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"50","target":"245","id":"2610","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"234","target":"701","id":"6327","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"138","target":"670","id":"4531","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"116","target":"335","id":"4076","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"29","target":"470","id":"2134","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"450","target":"487","id":"9259","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"75","target":"702","id":"3212","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"226","target":"352","id":"6184","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"11","target":"520","id":"1722","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"393","target":"658","id":"8618","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"352","target":"359","id":"8103","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"450","target":"619","id":"9263","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"268","target":"412","id":"6875","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"79","target":"203","id":"3281","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"213","target":"265","id":"5957","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"482","target":"675","id":"9568","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"61","target":"687","id":"2897","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"290","target":"399","id":"7246","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"539","target":"669","id":"10005","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"334","target":"355","id":"7871","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"62","target":"126","id":"2903","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"153","target":"181","id":"4846","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"188","target":"580","id":"5520","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"99","target":"153","id":"3729","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"232","target":"434","id":"6287","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"399","target":"559","id":"8688","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"316","target":"455","id":"7614","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"198","target":"516","id":"5703","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"132","target":"344","id":"4406","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"312","target":"633","id":"7560","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"439","target":"640","id":"9142","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"202","target":"419","id":"5773","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"602","target":"721","id":"10340","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"208","target":"477","id":"5877","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"145","target":"678","id":"4699","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"646","target":"725","id":"10525","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"194","target":"537","id":"5627","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"528","target":"652","id":"9931","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"598","target":"599","id":"10319","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"474","target":"639","id":"9507","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"32","target":"674","id":"2204","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"135","target":"443","id":"4468","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"90","target":"126","id":"3535","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"25","target":"695","id":"2030","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"568","target":"695","id":"10150","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"220","target":"272","id":"6078","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"580","target":"619","id":"10244","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"519","target":"525","id":"9840","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"318","target":"528","id":"7644","attributes":{"Weight":"1.0"},"color":"rgb(148,196,67)","size":1.0},{"source":"173","target":"631","id":"5247","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"8","target":"172","id":"1633","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"72","target":"500","id":"3140","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"265","target":"681","id":"6828","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"220","target":"628","id":"6088","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"635","target":"684","id":"10475","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"321","target":"705","id":"7694","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"162","target":"610","id":"5031","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"74","target":"460","id":"3179","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"260","target":"261","id":"6729","attributes":{"Weight":"1.0"},"color":"rgb(115,229,148)","size":1.0},{"source":"78","target":"467","id":"3270","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"665","target":"721","id":"10600","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"69","target":"724","id":"3078","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"380","target":"389","id":"8420","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"468","target":"477","id":"9438","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"340","target":"670","id":"7963","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"359","target":"677","id":"8179","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"73","target":"302","id":"3155","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"156","target":"681","id":"4920","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"517","target":"636","id":"9830","attributes":{"Weight":"1.0"},"color":"rgb(99,229,115)","size":1.0},{"source":"369","target":"457","id":"8278","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"65","target":"272","id":"2979","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"319","target":"419","id":"7657","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"120","target":"186","id":"4150","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"5","target":"434","id":"1570","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"290","target":"559","id":"7252","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"14","target":"383","id":"1786","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"110","target":"294","id":"3940","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"28","target":"37","id":"2087","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"556","target":"558","id":"10089","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"568","target":"641","id":"10149","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"218","target":"525","id":"6056","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"497","target":"636","id":"9683","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"92","target":"549","id":"3589","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"47","target":"423","id":"2554","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"538","target":"633","id":"9994","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"497","target":"637","id":"9684","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"69","target":"82","id":"3056","attributes":{"Weight":"1.0"},"color":"rgb(67,164,196)","size":1.0},{"source":"24","target":"25","id":"1998","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"416","target":"661","id":"8867","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"393","target":"405","id":"8610","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"349","target":"719","id":"8075","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"327","target":"442","id":"7762","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"303","target":"409","id":"7434","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"143","target":"300","id":"4632","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"285","target":"465","id":"7151","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"185","target":"359","id":"5462","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"316","target":"678","id":"7622","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"8","target":"532","id":"1646","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"29","target":"77","id":"2123","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"404","target":"461","id":"8742","attributes":{"Weight":"1.0"},"color":"rgb(148,213,132)","size":1.0},{"source":"15","target":"525","id":"1813","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"96","target":"186","id":"3671","attributes":{"Weight":"1.0"},"color":"rgb(148,67,180)","size":1.0},{"source":"62","target":"681","id":"2919","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"38","target":"167","id":"2334","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"193","target":"285","id":"5599","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"101","target":"445","id":"3778","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"172","target":"460","id":"5217","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"442","target":"480","id":"9184","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"327","target":"648","id":"7774","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"119","target":"563","id":"4145","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"88","target":"591","id":"3501","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"278","target":"407","id":"7025","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"388","target":"423","id":"8545","attributes":{"Weight":"1.0"},"color":"rgb(229,148,83)","size":1.0},{"source":"351","target":"427","id":"8092","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"25","target":"704","id":"2031","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"45","target":"125","id":"2496","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"471","target":"680","id":"9474","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"514","target":"698","id":"9807","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"43","target":"664","id":"2455","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"323","target":"490","id":"7712","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"341","target":"544","id":"7972","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"165","target":"531","id":"5090","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"254","target":"356","id":"6633","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"126","target":"530","id":"4281","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"586","target":"717","id":"10270","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"414","target":"731","id":"8845","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"400","target":"694","id":"8705","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"65","target":"404","id":"2984","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"294","target":"591","id":"7305","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"354","target":"483","id":"8127","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"67","target":"637","id":"3028","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"144","target":"348","id":"4658","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"82","target":"648","id":"3366","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"30","target":"353","id":"2156","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"24","target":"708","id":"2014","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"312","target":"524","id":"7558","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"220","target":"347","id":"6081","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"507","target":"682","id":"9764","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"440","target":"562","id":"9156","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"639","target":"726","id":"10498","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"108","target":"582","id":"3902","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"214","target":"361","id":"5978","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"474","target":"715","id":"9510","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"26","target":"452","id":"2050","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"520","target":"590","id":"9848","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"86","target":"652","id":"3451","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"510","target":"592","id":"9785","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"44","target":"374","id":"2470","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"123","target":"452","id":"4221","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"187","target":"469","id":"5502","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"115","target":"574","id":"4059","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"734","target":"735","id":"10691","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"206","target":"501","id":"5845","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"153","target":"369","id":"4852","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"151","target":"331","id":"4814","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"221","target":"462","id":"6105","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"125","target":"661","id":"4266","attributes":{"Weight":"1.0"},"color":"rgb(180,229,67)","size":1.0},{"source":"41","target":"666","id":"2411","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"118","target":"437","id":"4121","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"587","target":"706","id":"10275","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"374","target":"475","id":"8337","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"633","target":"684","id":"10468","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"60","target":"552","id":"2857","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"244","target":"606","id":"6470","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"577","target":"687","id":"10222","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"382","target":"670","id":"8464","attributes":{"Weight":"1.0"},"color":"rgb(67,164,213)","size":1.0},{"source":"4","target":"437","id":"1546","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"75","target":"706","id":"3213","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"287","target":"642","id":"7193","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"228","target":"595","id":"6229","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"34","target":"256","id":"2248","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"468","target":"479","id":"9439","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"206","target":"248","id":"5838","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"12","target":"212","id":"1733","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"464","target":"718","id":"9404","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"18","target":"590","id":"1881","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"103","target":"592","id":"3822","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"35","target":"41","id":"2266","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"130","target":"630","id":"4366","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"89","target":"474","id":"3522","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"318","target":"546","id":"7645","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"33","target":"207","id":"2216","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"392","target":"405","id":"8597","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"322","target":"553","id":"7698","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"26","target":"422","id":"2047","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"231","target":"717","id":"6278","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"137","target":"599","id":"4513","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"147","target":"263","id":"4724","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"562","target":"713","id":"10124","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"182","target":"579","id":"5409","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"511","target":"580","id":"9789","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"159","target":"474","id":"4968","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"93","target":"171","id":"3596","attributes":{"Weight":"1.0"},"color":"rgb(213,115,148)","size":1.0},{"source":"301","target":"431","id":"7402","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"35","target":"389","id":"2277","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"328","target":"426","id":"7782","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"528","target":"618","id":"9928","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"398","target":"668","id":"8677","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"55","target":"624","id":"2742","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"12","target":"419","id":"1740","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"415","target":"434","id":"8846","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"164","target":"685","id":"5073","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"366","target":"370","id":"8242","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"148","target":"515","id":"4752","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"130","target":"234","id":"4352","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"49","target":"318","id":"2591","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"140","target":"375","id":"4563","attributes":{"Weight":"1.0"},"color":"rgb(83,229,99)","size":1.0},{"source":"183","target":"198","id":"5415","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"262","target":"320","id":"6772","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"83","target":"337","id":"3378","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"636","target":"637","id":"10479","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"425","target":"622","id":"8977","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"308","target":"642","id":"7510","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"27","target":"231","id":"2062","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"231","target":"415","id":"6266","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"363","target":"649","id":"8212","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"119","target":"448","id":"4141","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"9","target":"334","id":"1672","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"38","target":"121","id":"2330","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"289","target":"331","id":"7220","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"8","target":"677","id":"1655","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"35","target":"315","id":"2275","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"417","target":"606","id":"8873","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"35","target":"284","id":"2273","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"13","target":"467","id":"1766","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"247","target":"570","id":"6523","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"28","target":"107","id":"2092","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"299","target":"539","id":"7379","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"56","target":"179","id":"2750","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"221","target":"319","id":"6097","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"306","target":"315","id":"7474","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"327","target":"678","id":"7775","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"323","target":"586","id":"7716","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"282","target":"285","id":"7096","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"183","target":"184","id":"5414","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"34","target":"49","id":"2243","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"45","target":"449","id":"2506","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"422","target":"452","id":"8933","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"449","target":"728","id":"9256","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"343","target":"550","id":"7999","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"167","target":"463","id":"5124","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"135","target":"643","id":"4476","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"138","target":"408","id":"4524","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"109","target":"550","id":"3923","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"290","target":"414","id":"7251","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"175","target":"469","id":"5272","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"14","target":"537","id":"1790","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"269","target":"414","id":"6898","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"124","target":"214","id":"4232","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"76","target":"87","id":"3214","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"481","target":"675","id":"9565","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"68","target":"242","id":"3038","attributes":{"Weight":"1.0"},"color":"rgb(116,229,67)","size":1.0},{"source":"140","target":"577","id":"4574","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"386","target":"679","id":"8530","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"531","target":"607","id":"9947","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"519","target":"722","id":"9847","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"105","target":"630","id":"3854","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"328","target":"351","id":"7779","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"487","target":"642","id":"9593","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"457","target":"554","id":"9330","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"140","target":"685","id":"4582","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"232","target":"348","id":"6285","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"237","target":"478","id":"6362","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"74","target":"540","id":"3183","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"191","target":"324","id":"5571","attributes":{"Weight":"1.0"},"color":"rgb(229,132,99)","size":1.0},{"source":"433","target":"573","id":"9076","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"34","target":"509","id":"2258","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"60","target":"368","id":"2849","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"186","target":"499","id":"5490","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"211","target":"450","id":"5921","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"146","target":"705","id":"4720","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"532","target":"732","id":"9960","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"392","target":"395","id":"8595","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"149","target":"350","id":"4764","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"8","target":"56","id":"1626","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"64","target":"209","id":"2953","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"25","target":"640","id":"2028","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"11","target":"503","id":"1721","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"160","target":"281","id":"4983","attributes":{"Weight":"1.0"},"color":"rgb(115,83,229)","size":1.0},{"source":"446","target":"581","id":"9229","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"376","target":"490","id":"8368","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"409","target":"604","id":"8805","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"45","target":"461","id":"2508","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"18","target":"664","id":"1883","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"9","target":"353","id":"1673","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"244","target":"507","id":"6467","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"198","target":"312","id":"5701","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"450","target":"451","id":"9257","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"360","target":"378","id":"8182","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"507","target":"673","id":"9763","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"297","target":"726","id":"7352","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"178","target":"328","id":"5329","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"488","target":"579","id":"9597","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"671","target":"715","id":"10610","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"148","target":"680","id":"4756","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"233","target":"490","id":"6304","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"526","target":"605","id":"9905","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"179","target":"625","id":"5361","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"441","target":"735","id":"9180","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"316","target":"375","id":"7610","attributes":{"Weight":"1.0"},"color":"rgb(164,148,132)","size":1.0},{"source":"33","target":"319","id":"2224","attributes":{"Weight":"1.0"},"color":"rgb(148,180,148)","size":1.0},{"source":"117","target":"242","id":"4097","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"350","target":"682","id":"8087","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"319","target":"424","id":"7658","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"463","target":"486","id":"9391","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"509","target":"564","id":"9779","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"376","target":"717","id":"8376","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"142","target":"263","id":"4609","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"174","target":"243","id":"5250","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"64","target":"565","id":"2973","attributes":{"Weight":"1.0"},"color":"rgb(229,99,148)","size":1.0},{"source":"324","target":"552","id":"7727","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"177","target":"260","id":"5304","attributes":{"Weight":"1.0"},"color":"rgb(115,229,99)","size":1.0},{"source":"427","target":"456","id":"8993","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"379","target":"649","id":"8416","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"120","target":"552","id":"4166","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"374","target":"387","id":"8332","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"458","target":"680","id":"9344","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"91","target":"265","id":"3560","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"254","target":"410","id":"6637","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"117","target":"406","id":"4103","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"97","target":"435","id":"3692","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"61","target":"133","id":"2867","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"255","target":"694","id":"6661","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"244","target":"345","id":"6462","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"382","target":"452","id":"8453","attributes":{"Weight":"1.0"},"color":"rgb(132,164,148)","size":1.0},{"source":"424","target":"462","id":"8953","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"52","target":"536","id":"2662","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"209","target":"354","id":"5892","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"309","target":"630","id":"7521","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"112","target":"362","id":"4000","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"145","target":"376","id":"4685","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"32","target":"253","id":"2189","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"164","target":"677","id":"5072","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"254","target":"694","id":"6646","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"159","target":"715","id":"4978","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"410","target":"656","id":"8815","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"66","target":"570","id":"3007","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"234","target":"369","id":"6317","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"105","target":"219","id":"3845","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"141","target":"436","id":"4593","attributes":{"Weight":"1.0"},"color":"rgb(213,148,132)","size":1.0},{"source":"21","target":"51","id":"1937","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"366","target":"554","id":"8245","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"93","target":"601","id":"3612","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"70","target":"319","id":"3092","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"32","target":"401","id":"2194","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"437","target":"709","id":"9123","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"271","target":"661","id":"6927","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"67","target":"688","id":"3030","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"279","target":"547","id":"7046","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"130","target":"153","id":"4349","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"11","target":"199","id":"1710","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"183","target":"635","id":"5430","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"38","target":"463","id":"2346","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"26","target":"478","id":"2051","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"121","target":"430","id":"4183","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"276","target":"592","id":"7003","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"169","target":"229","id":"5147","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"178","target":"536","id":"5339","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"325","target":"350","id":"7732","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"110","target":"717","id":"3956","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"95","target":"496","id":"3654","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"167","target":"352","id":"5120","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"178","target":"549","id":"5340","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"402","target":"674","id":"8727","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"426","target":"718","id":"8992","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"33","target":"214","id":"2218","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"612","target":"677","id":"10385","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"260","target":"690","id":"6747","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"73","target":"636","id":"3163","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"205","target":"418","id":"5824","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"364","target":"578","id":"8219","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"252","target":"422","id":"6602","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"263","target":"660","id":"6794","attributes":{"Weight":"1.0"},"color":"rgb(180,67,164)","size":1.0},{"source":"57","target":"728","id":"2791","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"180","target":"277","id":"5372","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"476","target":"544","id":"9528","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"450","target":"555","id":"9260","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"446","target":"546","id":"9227","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"105","target":"153","id":"3843","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"223","target":"483","id":"6139","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"390","target":"391","id":"8562","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"111","target":"720","id":"3985","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"377","target":"413","id":"8387","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"348","target":"583","id":"8054","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"110","target":"151","id":"3931","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"339","target":"578","id":"7942","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"74","target":"707","id":"3192","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"27","target":"258","id":"2065","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"285","target":"729","id":"7161","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"293","target":"695","id":"7288","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"405","target":"413","id":"8755","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"129","target":"167","id":"4329","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"302","target":"636","id":"7424","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"447","target":"711","id":"9238","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"26","target":"141","id":"2041","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"334","target":"446","id":"7874","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"283","target":"405","id":"7126","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"84","target":"420","id":"3398","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"17","target":"509","id":"1859","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"94","target":"350","id":"3626","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"250","target":"356","id":"6563","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"47","target":"356","id":"2549","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"37","target":"705","id":"2326","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"56","target":"522","id":"2756","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"107","target":"210","id":"3875","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"14","target":"597","id":"1793","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"300","target":"539","id":"7394","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"174","target":"641","id":"5257","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"287","target":"419","id":"7182","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"52","target":"372","id":"2656","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"84","target":"321","id":"3395","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"248","target":"378","id":"6531","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"164","target":"294","id":"5059","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"63","target":"159","id":"2925","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"310","target":"686","id":"7538","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"488","target":"533","id":"9595","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"403","target":"597","id":"8735","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"49","target":"446","id":"2594","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"302","target":"688","id":"7427","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"38","target":"352","id":"2341","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"438","target":"734","id":"9138","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"116","target":"258","id":"4072","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"184","target":"516","id":"5446","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"431","target":"717","id":"9051","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"131","target":"618","id":"4389","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"587","target":"691","id":"10273","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"348","target":"616","id":"8056","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"281","target":"647","id":"7086","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"123","target":"125","id":"4211","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"549","target":"718","id":"10059","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"158","target":"695","id":"4954","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"388","target":"588","id":"8551","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"282","target":"689","id":"7109","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"286","target":"652","id":"7177","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"504","target":"602","id":"9735","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"15","target":"493","id":"1810","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"88","target":"602","id":"3503","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"229","target":"357","id":"6239","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"446","target":"592","id":"9230","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"415","target":"575","id":"8847","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"590","target":"670","id":"10288","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"336","target":"401","id":"7901","attributes":{"Weight":"1.0"},"color":"rgb(229,148,83)","size":1.0},{"source":"178","target":"464","id":"5337","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"395","target":"731","id":"8642","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"377","target":"411","id":"8385","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"111","target":"319","id":"3968","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"390","target":"392","id":"8563","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"280","target":"567","id":"7067","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"507","target":"659","id":"9762","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"60","target":"499","id":"2854","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"531","target":"711","id":"9949","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"122","target":"678","id":"4209","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"111","target":"349","id":"3969","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"5","target":"576","id":"1574","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"135","target":"676","id":"4477","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"81","target":"458","id":"3331","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"339","target":"514","id":"7941","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"173","target":"493","id":"5239","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"271","target":"693","id":"6931","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"4","target":"18","id":"1533","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"419","target":"608","id":"8902","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"439","target":"641","id":"9143","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"409","target":"728","id":"8809","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"617","target":"712","id":"10404","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"156","target":"365","id":"4912","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"275","target":"369","id":"6981","attributes":{"Weight":"1.0"},"color":"rgb(67,148,148)","size":1.0},{"source":"428","target":"704","id":"9015","attributes":{"Weight":"1.0"},"color":"rgb(229,115,67)","size":1.0},{"source":"126","target":"341","id":"4274","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"77","target":"468","id":"3250","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"440","target":"604","id":"9161","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"50","target":"150","id":"2605","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"100","target":"309","id":"3753","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"691","target":"702","id":"10649","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"8","target":"625","id":"1651","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"24","target":"292","id":"2005","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"48","target":"568","id":"2572","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"112","target":"484","id":"4003","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"153","target":"554","id":"4855","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"318","target":"564","id":"7647","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"436","target":"443","id":"9106","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"96","target":"105","id":"3666","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"143","target":"539","id":"4642","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"148","target":"471","id":"4749","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"280","target":"529","id":"7065","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"557","target":"674","id":"10098","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"39","target":"191","id":"2362","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"452","target":"622","id":"9279","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"411","target":"414","id":"8822","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"393","target":"411","id":"8611","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"264","target":"651","id":"6809","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"465","target":"734","id":"9416","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"93","target":"188","id":"3598","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"429","target":"710","id":"9026","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"22","target":"174","id":"1964","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"83","target":"182","id":"3373","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"327","target":"433","id":"7761","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"210","target":"705","id":"5911","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"329","target":"427","id":"7799","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"120","target":"235","id":"4154","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"319","target":"489","id":"7664","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"139","target":"415","id":"4543","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"276","target":"510","id":"6999","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"39","target":"531","id":"2371","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"687","target":"721","id":"10636","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"441","target":"725","id":"9176","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"326","target":"502","id":"7752","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"129","target":"397","id":"4338","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"173","target":"218","id":"5234","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"353","target":"489","id":"8118","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"200","target":"706","id":"5748","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"233","target":"431","id":"6301","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"257","target":"671","id":"6690","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"168","target":"557","id":"5142","attributes":{"Weight":"1.0"},"color":"rgb(229,132,83)","size":1.0},{"source":"201","target":"305","id":"5753","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"65","target":"387","id":"2983","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"61","target":"442","id":"2883","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"197","target":"372","id":"5685","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"578","target":"693","id":"10233","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"373","target":"591","id":"8323","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"325","target":"566","id":"7740","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"140","target":"654","id":"4577","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"189","target":"601","id":"5546","attributes":{"Weight":"1.0"},"color":"rgb(229,148,67)","size":1.0},{"source":"259","target":"691","id":"6726","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"343","target":"501","id":"7997","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"211","target":"419","id":"5919","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"205","target":"559","id":"5831","attributes":{"Weight":"1.0"},"color":"rgb(148,115,196)","size":1.0},{"source":"211","target":"221","id":"5913","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"232","target":"603","id":"6291","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"169","target":"256","id":"5148","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"382","target":"503","id":"8458","attributes":{"Weight":"1.0"},"color":"rgb(67,164,213)","size":1.0},{"source":"478","target":"558","id":"9540","attributes":{"Weight":"1.0"},"color":"rgb(213,148,83)","size":1.0},{"source":"230","target":"361","id":"6252","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"583","target":"616","id":"10255","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"345","target":"396","id":"8013","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"101","target":"320","id":"3773","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"99","target":"100","id":"3725","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"59","target":"447","id":"2824","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"562","target":"576","id":"10117","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"342","target":"597","id":"7986","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"271","target":"602","id":"6924","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"166","target":"711","id":"5114","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"447","target":"482","id":"9235","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"99","target":"106","id":"3727","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"8","target":"612","id":"1650","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"226","target":"531","id":"6190","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"372","target":"700","id":"8318","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"553","target":"632","id":"10072","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"81","target":"208","id":"3326","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"234","target":"631","id":"6325","attributes":{"Weight":"1.0"},"color":"rgb(67,115,229)","size":1.0},{"source":"329","target":"615","id":"7808","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"116","target":"232","id":"4070","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"104","target":"256","id":"3825","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"179","target":"532","id":"5357","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"369","target":"672","id":"8284","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"167","target":"531","id":"5126","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"251","target":"356","id":"6584","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"303","target":"713","id":"7449","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"34","target":"446","id":"2257","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"295","target":"546","id":"7319","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"730","target":"735","id":"10689","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"171","target":"496","id":"5199","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"37","target":"420","id":"2318","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"184","target":"524","id":"5447","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"11","target":"138","id":"1709","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"327","target":"454","id":"7763","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"117","target":"326","id":"4099","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"144","target":"335","id":"4657","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"19","target":"291","id":"1898","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"274","target":"582","id":"6967","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"150","target":"227","id":"4780","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"193","target":"725","id":"5613","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"200","target":"505","id":"5738","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"462","target":"608","id":"9386","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"16","target":"640","id":"1836","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"479","target":"680","id":"9547","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"438","target":"735","id":"9139","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"257","target":"715","id":"6692","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"109","target":"128","id":"3909","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"157","target":"539","id":"4938","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"419","target":"450","id":"8893","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"227","target":"719","id":"6215","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"349","target":"572","id":"8070","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"14","target":"649","id":"1795","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"282","target":"364","id":"7097","attributes":{"Weight":"1.0"},"color":"rgb(115,164,148)","size":1.0},{"source":"38","target":"58","id":"2329","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"520","target":"709","id":"9852","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"220","target":"590","id":"6087","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"14","target":"505","id":"1789","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"69","target":"651","id":"3076","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"6","target":"29","id":"1580","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"111","target":"419","id":"3974","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"238","target":"547","id":"6376","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"371","target":"629","id":"8301","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"342","target":"363","id":"7975","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"35","target":"40","id":"2265","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"371","target":"397","id":"8292","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"55","target":"187","id":"2728","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"411","target":"559","id":"8823","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"108","target":"605","id":"3904","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"54","target":"462","id":"2711","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"190","target":"587","id":"5563","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"58","target":"59","id":"2792","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"434","target":"521","id":"9087","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"17","target":"275","id":"1851","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"190","target":"649","id":"5565","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"69","target":"734","id":"3082","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"139","target":"303","id":"4538","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"325","target":"511","id":"7737","attributes":{"Weight":"1.0"},"color":"rgb(213,115,148)","size":1.0},{"source":"196","target":"275","id":"5653","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"85","target":"289","id":"3416","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"347","target":"404","id":"8038","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"151","target":"567","id":"4823","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"224","target":"323","id":"6147","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"57","target":"565","id":"2785","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"80","target":"713","id":"3324","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"245","target":"316","id":"6478","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"491","target":"603","id":"9623","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"397","target":"685","id":"8662","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"14","target":"403","id":"1787","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"287","target":"424","id":"7183","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"551","target":"700","id":"10067","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"385","target":"498","id":"8505","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"172","target":"408","id":"5216","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"472","target":"589","id":"9483","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"350","target":"606","id":"8083","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"288","target":"440","id":"7201","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"261","target":"487","id":"6763","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"314","target":"673","id":"7594","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"136","target":"360","id":"4487","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"345","target":"496","id":"8015","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"206","target":"378","id":"5842","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"108","target":"722","id":"3907","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"466","target":"734","id":"9428","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"377","target":"658","id":"8392","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"66","target":"495","id":"3006","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"68","target":"204","id":"3037","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"314","target":"613","id":"7592","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"407","target":"420","id":"8769","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"318","target":"460","id":"7641","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"101","target":"223","id":"3769","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"287","target":"600","id":"7190","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"268","target":"399","id":"6872","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"523","target":"663","id":"9882","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"543","target":"679","id":"10030","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"61","target":"417","id":"2882","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"223","target":"320","id":"6133","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"58","target":"252","id":"2798","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"100","target":"370","id":"3756","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"143","target":"432","id":"4636","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"150","target":"562","id":"4791","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"54","target":"623","id":"2718","attributes":{"Weight":"1.0"},"color":"rgb(67,229,196)","size":1.0},{"source":"140","target":"454","id":"4568","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"490","target":"567","id":"9614","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"563","target":"617","id":"10127","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"517","target":"537","id":"9824","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"453","target":"578","id":"9283","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"413","target":"559","id":"8836","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"73","target":"497","id":"3157","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"144","target":"576","id":"4666","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"424","target":"450","id":"8951","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"446","target":"509","id":"9225","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"72","target":"505","id":"3141","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"249","target":"565","id":"6555","attributes":{"Weight":"1.0"},"color":"rgb(213,148,148)","size":1.0},{"source":"284","target":"666","id":"7147","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"110","target":"111","id":"3929","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"448","target":"550","id":"9242","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"316","target":"373","id":"7609","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"196","target":"521","id":"5666","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"164","target":"569","id":"5066","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"395","target":"412","id":"8635","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"4","target":"346","id":"1542","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"218","target":"422","id":"6051","attributes":{"Weight":"1.0"},"color":"rgb(132,196,148)","size":1.0},{"source":"36","target":"284","id":"2293","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"224","target":"707","id":"6164","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"8","target":"713","id":"1659","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"337","target":"374","id":"7911","attributes":{"Weight":"1.0"},"color":"rgb(67,180,196)","size":1.0},{"source":"320","target":"367","id":"7678","attributes":{"Weight":"1.0"},"color":"rgb(164,99,148)","size":1.0},{"source":"15","target":"173","id":"1802","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"221","target":"279","id":"6095","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"361","target":"362","id":"8193","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"571","target":"618","id":"10171","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"329","target":"456","id":"7800","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"417","target":"673","id":"8876","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"250","target":"653","id":"6574","attributes":{"Weight":"1.0"},"color":"rgb(180,67,164)","size":1.0},{"source":"309","target":"554","id":"7520","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"107","target":"217","id":"3876","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"140","target":"442","id":"4567","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"92","target":"464","id":"3586","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"86","target":"511","id":"3443","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"602","target":"703","id":"10339","attributes":{"Weight":"1.0"},"color":"rgb(196,196,67)","size":1.0},{"source":"302","target":"516","id":"7419","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"140","target":"625","id":"4576","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"494","target":"519","id":"9654","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"521","target":"589","id":"9857","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"149","target":"507","id":"4768","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"78","target":"584","id":"3273","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"17","target":"276","id":"1852","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"340","target":"709","id":"7964","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"19","target":"482","id":"1907","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"318","target":"713","id":"7653","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"180","target":"571","id":"5379","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"31","target":"304","id":"2175","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"12","target":"211","id":"1732","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"269","target":"411","id":"6895","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"81","target":"470","id":"3334","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"18","target":"503","id":"1879","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"322","target":"398","id":"7695","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"73","target":"270","id":"3154","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"12","target":"358","id":"1739","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"91","target":"683","id":"3573","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"247","target":"495","id":"6522","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"382","target":"466","id":"8455","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"433","target":"679","id":"9084","attributes":{"Weight":"1.0"},"color":"rgb(67,229,148)","size":1.0},{"source":"382","target":"646","id":"8460","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"574","target":"597","id":"10196","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"51","target":"174","id":"2632","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"215","target":"690","id":"6001","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"411","target":"413","id":"8821","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"489","target":"710","id":"9610","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"10","target":"31","id":"1682","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"263","target":"469","id":"6787","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"218","target":"605","id":"6062","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"236","target":"368","id":"6346","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"367","target":"456","id":"8255","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"212","target":"600","id":"5948","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"86","target":"703","id":"3453","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"31","target":"234","id":"2174","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"183","target":"497","id":"5424","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"2","target":"96","id":"1488","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"114","target":"485","id":"4034","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"224","target":"586","id":"6160","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"133","target":"149","id":"4414","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"553","target":"726","id":"10078","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"403","target":"500","id":"8730","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"189","target":"362","id":"5540","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"233","target":"436","id":"6302","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"61","target":"566","id":"2889","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"42","target":"333","id":"2423","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"155","target":"371","id":"4894","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"426","target":"427","id":"8982","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"472","target":"594","id":"9484","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"152","target":"712","id":"4844","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"206","target":"336","id":"5839","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"507","target":"606","id":"9760","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"308","target":"668","id":"7511","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"651","target":"730","id":"10557","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"44","target":"498","id":"2477","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"61","target":"454","id":"2884","attributes":{"Weight":"1.0"},"color":"rgb(132,148,196)","size":1.0},{"source":"333","target":"655","id":"7867","attributes":{"Weight":"1.0"},"color":"rgb(148,164,148)","size":1.0},{"source":"517","target":"623","id":"9829","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"26","target":"58","id":"2037","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"110","target":"154","id":"3932","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"480","target":"648","id":"9557","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"396","target":"673","id":"8652","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"85","target":"147","id":"3409","attributes":{"Weight":"1.0"},"color":"rgb(180,67,213)","size":1.0},{"source":"47","target":"557","id":"2557","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"127","target":"632","id":"4297","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"163","target":"336","id":"5042","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"283","target":"566","id":"7134","attributes":{"Weight":"1.0"},"color":"rgb(213,67,196)","size":1.0},{"source":"85","target":"529","id":"3424","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"161","target":"621","id":"5007","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"197","target":"492","id":"5690","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"139","target":"232","id":"4535","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"252","target":"404","id":"6600","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"151","target":"627","id":"4825","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"185","target":"212","id":"5458","attributes":{"Weight":"1.0"},"color":"rgb(148,213,148)","size":1.0},{"source":"167","target":"486","id":"5125","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"311","target":"625","id":"7549","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"503","target":"534","id":"9727","attributes":{"Weight":"1.0"},"color":"rgb(132,148,213)","size":1.0},{"source":"333","target":"703","id":"7868","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"92","target":"367","id":"3581","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"60","target":"528","id":"2855","attributes":{"Weight":"1.0"},"color":"rgb(229,115,99)","size":1.0},{"source":"303","target":"668","id":"7447","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"45","target":"416","id":"2503","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"355","target":"509","id":"8132","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"118","target":"404","id":"4120","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"106","target":"672","id":"3870","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"463","target":"711","id":"9395","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"37","target":"278","id":"2314","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"162","target":"693","id":"5036","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"169","target":"526","id":"5163","attributes":{"Weight":"1.0"},"color":"rgb(67,196,148)","size":1.0},{"source":"294","target":"316","id":"7293","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"81","target":"474","id":"3336","attributes":{"Weight":"1.0"},"color":"rgb(196,83,148)","size":1.0},{"source":"62","target":"117","id":"2902","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"65","target":"220","id":"2978","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"290","target":"412","id":"7249","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"221","target":"261","id":"6094","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"264","target":"697","id":"6811","attributes":{"Weight":"1.0"},"color":"rgb(99,164,148)","size":1.0},{"source":"660","target":"674","id":"10584","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"54","target":"287","id":"2700","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"149","target":"171","id":"4758","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"87","target":"425","id":"3462","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"64","target":"484","id":"2971","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"390","target":"412","id":"8570","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"237","target":"447","id":"6359","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"342","target":"537","id":"7981","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"644","target":"719","id":"10517","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"29","target":"686","id":"2143","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"155","target":"373","id":"4895","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"117","target":"476","id":"4104","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"239","target":"483","id":"6395","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"206","target":"343","id":"5840","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"56","target":"532","id":"2758","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"207","target":"354","id":"5861","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"271","target":"665","id":"6928","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"684","target":"736","id":"10634","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"114","target":"621","id":"4037","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"153","target":"370","id":"4853","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"278","target":"420","id":"7026","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"10","target":"370","id":"1698","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"74","target":"140","id":"3169","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"49","target":"104","id":"2581","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"333","target":"580","id":"7861","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"384","target":"612","id":"8491","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"222","target":"368","id":"6122","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"101","target":"512","id":"3782","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"529","target":"567","id":"9936","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"127","target":"161","id":"4287","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"101","target":"189","id":"3765","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"168","target":"634","id":"5144","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"245","target":"419","id":"6485","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"191","target":"240","id":"5570","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"199","target":"628","id":"5727","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"346","target":"347","id":"8026","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"267","target":"357","id":"6852","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"15","target":"205","id":"1804","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"18","target":"346","id":"1873","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"234","target":"469","id":"6320","attributes":{"Weight":"1.0"},"color":"rgb(99,67,229)","size":1.0},{"source":"348","target":"576","id":"8053","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"151","target":"586","id":"4824","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"215","target":"596","id":"5995","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"177","target":"707","id":"5327","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"231","target":"342","id":"6264","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"330","target":"392","id":"7814","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"20","target":"326","id":"1920","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"351","target":"718","id":"8102","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"429","target":"499","id":"9019","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"523","target":"589","id":"9878","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"101","target":"344","id":"3774","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"128","target":"136","id":"4305","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"350","target":"714","id":"8088","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"135","target":"586","id":"4475","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"417","target":"682","id":"8877","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"67","target":"204","id":"3017","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"394","target":"561","id":"8629","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"333","target":"716","id":"7869","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"447","target":"449","id":"9231","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"528","target":"703","id":"9932","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"131","target":"571","id":"4384","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"137","target":"315","id":"4505","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"1","target":"493","id":"1475","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"224","target":"431","id":"6151","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"341","target":"375","id":"7966","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"203","target":"475","id":"5792","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"441","target":"491","id":"9169","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"415","target":"681","id":"8854","attributes":{"Weight":"1.0"},"color":"rgb(83,229,99)","size":1.0},{"source":"14","target":"587","id":"1792","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"33","target":"429","id":"2233","attributes":{"Weight":"1.0"},"color":"rgb(229,99,99)","size":1.0},{"source":"277","target":"703","id":"7021","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"248","target":"727","id":"6541","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"270","target":"516","id":"6907","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"430","target":"654","id":"9036","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"87","target":"604","id":"3476","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"234","target":"309","id":"6315","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"204","target":"688","id":"5818","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"116","target":"318","id":"4075","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"375","target":"502","id":"8355","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"359","target":"461","id":"8173","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"294","target":"719","id":"7310","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"396","target":"659","id":"8651","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"162","target":"260","id":"5017","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"93","target":"511","id":"3606","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"85","target":"280","id":"3415","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"591","target":"643","id":"10291","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"463","target":"634","id":"9394","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"352","target":"430","id":"8105","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"199","target":"520","id":"5725","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"380","target":"467","id":"8421","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"86","target":"619","id":"3450","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"59","target":"291","id":"2821","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"169","target":"276","id":"5151","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"1","target":"418","id":"1473","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"297","target":"632","id":"7345","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"458","target":"479","id":"9339","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"223","target":"512","id":"6141","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"79","target":"374","id":"3284","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"47","target":"253","id":"2545","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"212","target":"225","id":"5933","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"186","target":"235","id":"5481","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"12","target":"225","id":"1735","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"128","target":"617","id":"4322","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"80","target":"415","id":"3316","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"193","target":"438","id":"5602","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"477","target":"686","id":"9537","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"308","target":"415","id":"7501","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"60","target":"318","id":"2845","attributes":{"Weight":"1.0"},"color":"rgb(148,148,99)","size":1.0},{"source":"572","target":"720","id":"10185","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"585","target":"631","id":"10264","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"275","target":"446","id":"6982","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"625","target":"677","id":"10436","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"182","target":"337","id":"5404","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"410","target":"660","id":"8816","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"21","target":"695","id":"1952","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"215","target":"504","id":"5993","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"132","target":"223","id":"4401","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"109","target":"712","id":"3927","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"40","target":"273","id":"2381","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"46","target":"123","id":"2520","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"8","target":"707","id":"1658","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"7","target":"364","id":"1610","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"408","target":"707","id":"8788","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"227","target":"572","id":"6207","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"89","target":"638","id":"3527","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"22","target":"704","id":"1974","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"193","target":"647","id":"5608","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"493","target":"526","id":"9646","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"218","target":"631","id":"6063","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"60","target":"548","id":"2856","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"162","target":"703","id":"5037","attributes":{"Weight":"1.0"},"color":"rgb(196,196,67)","size":1.0},{"source":"195","target":"722","id":"5652","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"129","target":"607","id":"4344","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"192","target":"273","id":"5583","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"63","target":"657","id":"2941","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"359","target":"711","id":"8181","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"240","target":"352","id":"6398","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"368","target":"419","id":"8265","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"125","target":"447","id":"4256","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"88","target":"221","id":"3486","attributes":{"Weight":"1.0"},"color":"rgb(115,229,148)","size":1.0},{"source":"425","target":"521","id":"8969","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"83","target":"626","id":"3384","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"13","target":"36","id":"1752","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"346","target":"437","id":"8029","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"231","target":"434","id":"6267","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"671","target":"726","id":"10611","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"72","target":"537","id":"3142","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"279","target":"586","id":"7049","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"121","target":"167","id":"4174","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"33","target":"569","id":"2240","attributes":{"Weight":"1.0"},"color":"rgb(229,99,132)","size":1.0},{"source":"120","target":"324","id":"4158","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"38","target":"636","id":"2353","attributes":{"Weight":"1.0"},"color":"rgb(180,213,67)","size":1.0},{"source":"472","target":"543","id":"9480","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"129","target":"168","id":"4330","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"4","target":"11","id":"1532","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"87","target":"508","id":"3468","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"421","target":"589","id":"8924","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"107","target":"627","id":"3886","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"39","target":"486","id":"2370","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"282","target":"646","id":"7104","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"47","target":"401","id":"2551","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"291","target":"382","id":"7258","attributes":{"Weight":"1.0"},"color":"rgb(132,164,148)","size":1.0},{"source":"393","target":"399","id":"8609","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"90","target":"91","id":"3533","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"89","target":"114","id":"3512","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"221","target":"260","id":"6093","attributes":{"Weight":"1.0"},"color":"rgb(115,229,148)","size":1.0},{"source":"54","target":"443","id":"2708","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"548","target":"595","id":"10053","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"202","target":"212","id":"5766","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"157","target":"542","id":"4939","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"228","target":"236","id":"6218","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"185","target":"607","id":"5471","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"333","target":"428","id":"7856","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"51","target":"293","id":"2635","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"62","target":"544","id":"2918","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"22","target":"243","id":"1965","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"157","target":"698","id":"4944","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"196","target":"440","id":"5662","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"152","target":"550","id":"4840","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"95","target":"563","id":"3658","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"269","target":"330","id":"6885","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"192","target":"467","id":"5589","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"182","target":"321","id":"5403","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"285","target":"730","id":"7162","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"604","target":"728","id":"10348","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"139","target":"348","id":"4541","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"177","target":"460","id":"5313","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"396","target":"507","id":"8645","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"170","target":"656","id":"5185","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"325","target":"534","id":"7738","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"321","target":"662","id":"7693","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"540","target":"733","id":"10014","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"646","target":"729","id":"10526","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"485","target":"553","id":"9575","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"28","target":"217","id":"2099","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"196","target":"409","id":"5659","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"105","target":"554","id":"3853","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"179","target":"342","id":"5350","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"125","target":"481","id":"4261","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"140","target":"408","id":"4566","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"188","target":"601","id":"5522","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"349","target":"371","id":"8062","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"64","target":"361","id":"2964","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"656","target":"694","id":"10575","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"66","target":"137","id":"2994","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"7","target":"162","id":"1603","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"51","target":"704","id":"2642","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"74","target":"408","id":"3177","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"72","target":"587","id":"3144","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"606","target":"659","id":"10354","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"212","target":"728","id":"5955","attributes":{"Weight":"1.0"},"color":"rgb(148,148,229)","size":1.0},{"source":"65","target":"628","id":"2989","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"283","target":"391","id":"7120","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"150","target":"569","id":"4792","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"149","target":"244","id":"4759","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"229","target":"275","id":"6233","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"166","target":"463","id":"5107","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"424","target":"555","id":"8957","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"126","target":"242","id":"4271","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"228","target":"235","id":"6217","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"175","target":"514","id":"5274","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"27","target":"543","id":"2075","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"535","target":"698","id":"9979","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"264","target":"735","id":"6817","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"358","target":"419","id":"8159","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"662","target":"705","id":"10593","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"266","target":"661","id":"6839","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"108","target":"493","id":"3897","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"519","target":"526","id":"9841","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"143","target":"514","id":"4640","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"460","target":"707","id":"9372","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"349","target":"373","id":"8063","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"440","target":"702","id":"9165","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"232","target":"303","id":"6282","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"328","target":"536","id":"7787","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"156","target":"326","id":"4910","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"153","target":"234","id":"4848","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"9","target":"548","id":"1678","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"221","target":"693","id":"6114","attributes":{"Weight":"1.0"},"color":"rgb(115,229,148)","size":1.0},{"source":"161","target":"297","id":"5001","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"419","target":"424","id":"8891","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"97","target":"582","id":"3699","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"145","target":"436","id":"4687","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"545","target":"660","id":"10038","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"186","target":"429","id":"5488","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"426","target":"549","id":"8987","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"381","target":"623","id":"8446","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"313","target":"515","id":"7575","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"538","target":"637","id":"9997","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"681","target":"683","id":"10630","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"345","target":"673","id":"8022","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"237","target":"291","id":"6356","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"62","target":"476","id":"2914","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"182","target":"217","id":"5401","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"532","target":"707","id":"9959","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"390","target":"414","id":"8572","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"139","target":"668","id":"4553","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"161","target":"639","id":"5010","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"71","target":"113","id":"3108","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"222","target":"324","id":"6119","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"6","target":"515","id":"1596","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"430","target":"463","id":"9030","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"165","target":"729","id":"5094","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"260","target":"279","id":"6732","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"421","target":"521","id":"8919","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"162","target":"241","id":"5016","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"40","target":"467","id":"2387","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"61","target":"396","id":"2881","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"397","target":"591","id":"8657","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"43","target":"628","id":"2454","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"227","target":"349","id":"6201","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"260","target":"692","id":"6748","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"11","target":"237","id":"1712","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"147","target":"542","id":"4735","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"81","target":"307","id":"3328","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"240","target":"463","id":"6403","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"380","target":"584","id":"8424","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"444","target":"539","id":"9213","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"282","target":"734","id":"7114","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"79","target":"498","id":"3293","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"11","target":"387","id":"1717","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"190","target":"500","id":"5559","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"171","target":"593","id":"5204","attributes":{"Weight":"1.0"},"color":"rgb(213,115,148)","size":1.0},{"source":"120","target":"353","id":"4160","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"340","target":"503","id":"7958","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"36","target":"247","id":"2291","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"57","target":"543","id":"2783","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"314","target":"396","id":"7585","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"102","target":"228","id":"3787","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"302","target":"684","id":"7426","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"603","target":"616","id":"10342","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"196","target":"352","id":"5656","attributes":{"Weight":"1.0"},"color":"rgb(229,132,148)","size":1.0},{"source":"612","target":"685","id":"10388","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"92","target":"351","id":"3580","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"218","target":"655","id":"6064","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"282","target":"729","id":"7112","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"13","target":"315","id":"1763","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"208","target":"313","id":"5871","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"42","target":"571","id":"2428","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"55","target":"370","id":"2733","attributes":{"Weight":"1.0"},"color":"rgb(99,67,229)","size":1.0},{"source":"168","target":"711","id":"5145","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"43","target":"220","id":"2441","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"221","target":"572","id":"6108","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"250","target":"253","id":"6560","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"29","target":"468","id":"2133","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"190","target":"194","id":"5548","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"159","target":"161","id":"4960","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"147","target":"624","id":"4736","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"249","target":"416","id":"6545","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"10","target":"304","id":"1693","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"172","target":"685","id":"5229","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"242","target":"530","id":"6441","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"33","target":"132","id":"2213","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"419","target":"529","id":"8898","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"95","target":"360","id":"3650","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"30","target":"60","id":"2144","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"487","target":"608","id":"9592","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"254","target":"255","id":"6632","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"178","target":"351","id":"5331","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"50","target":"569","id":"2623","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"475","target":"611","id":"9518","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"126","target":"365","id":"4275","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"71","target":"159","id":"3110","attributes":{"Weight":"1.0"},"color":"rgb(115,99,229)","size":1.0},{"source":"427","target":"615","id":"9000","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"58","target":"422","id":"2802","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"33","target":"189","id":"2215","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"302","target":"497","id":"7418","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"475","target":"656","id":"9522","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"367","target":"492","id":"8257","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"646","target":"689","id":"10522","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"334","target":"595","id":"7879","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"138","target":"340","id":"4519","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"201","target":"228","id":"5750","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"575","target":"713","id":"10209","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"71","target":"302","id":"3116","attributes":{"Weight":"1.0"},"color":"rgb(99,180,148)","size":1.0},{"source":"3","target":"167","id":"1516","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"285","target":"651","id":"7157","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"113","target":"182","id":"4006","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"223","target":"354","id":"6135","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"589","target":"594","id":"10279","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"431","target":"703","id":"9050","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"22","target":"293","id":"1967","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"337","target":"407","id":"7914","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"128","target":"563","id":"4320","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"88","target":"364","id":"3494","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"346","target":"709","id":"8036","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"26","target":"237","id":"2042","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"109","target":"617","id":"3926","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"198","target":"270","id":"5699","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"450","target":"600","id":"9261","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"338","target":"613","id":"7933","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"313","target":"686","id":"7580","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"569","target":"591","id":"10157","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"500","target":"587","id":"9708","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"390","target":"560","id":"8574","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"215","target":"665","id":"6000","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"274","target":"435","id":"6961","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"28","target":"245","id":"2100","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"6","target":"620","id":"1599","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"34","target":"357","id":"2256","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"6","target":"468","id":"1591","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"646","target":"647","id":"10519","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"513","target":"683","id":"9800","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"668","target":"702","id":"10606","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"468","target":"470","id":"9436","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"528","target":"716","id":"9934","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"465","target":"729","id":"9414","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"659","target":"673","id":"10581","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"139","target":"231","id":"4534","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"166","target":"486","id":"5108","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"77","target":"515","id":"3255","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"8","target":"522","id":"1643","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"331","target":"547","id":"7836","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"144","target":"371","id":"4659","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"196","target":"604","id":"5674","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"60","target":"371","id":"2850","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"42","target":"180","id":"2415","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"452","target":"670","id":"9280","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"497","target":"736","id":"9688","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"132","target":"445","id":"4410","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"487","target":"555","id":"9590","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"308","target":"726","id":"7514","attributes":{"Weight":"1.0"},"color":"rgb(115,148,180)","size":1.0},{"source":"573","target":"678","id":"10192","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"110","target":"627","id":"3952","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"74","target":"177","id":"3171","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"110","target":"643","id":"3954","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"442","target":"498","id":"9185","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"352","target":"652","id":"8113","attributes":{"Weight":"1.0"},"color":"rgb(229,180,67)","size":1.0},{"source":"216","target":"443","id":"6014","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"553","target":"638","id":"10073","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"289","target":"428","id":"7222","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"155","target":"644","id":"4902","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"477","target":"541","id":"9534","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"189","target":"209","id":"5529","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"281","target":"646","id":"7085","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"329","target":"549","id":"7804","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"71","target":"337","id":"3118","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"211","target":"424","id":"5920","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"260","target":"591","id":"6741","attributes":{"Weight":"1.0"},"color":"rgb(196,148,132)","size":1.0},{"source":"475","target":"648","id":"9521","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"46","target":"249","id":"2524","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"84","target":"337","id":"3396","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"285","target":"647","id":"7155","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"532","target":"654","id":"9953","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"451","target":"645","id":"9273","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"450","target":"645","id":"9265","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"254","target":"400","id":"6634","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"347","target":"387","id":"8037","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"242","target":"681","id":"6444","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"32","target":"170","id":"2186","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"31","target":"457","id":"2180","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"58","target":"424","id":"2803","attributes":{"Weight":"1.0"},"color":"rgb(132,229,148)","size":1.0},{"source":"3","target":"463","id":"1526","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"268","target":"393","id":"6869","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"92","target":"718","id":"3594","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"695","target":"708","id":"10658","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"524","target":"697","id":"9892","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"322","target":"657","id":"7703","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"381","target":"523","id":"8438","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"42","target":"511","id":"2426","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"58","target":"478","id":"2807","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"275","target":"581","id":"6988","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"155","target":"569","id":"4897","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"540","target":"704","id":"10011","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"82","target":"433","id":"3353","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"140","target":"677","id":"4579","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"433","target":"614","id":"9079","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"194","target":"574","id":"5628","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"62","target":"326","id":"2909","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"356","target":"694","id":"8150","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"377","target":"412","id":"8386","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"342","target":"505","id":"7980","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"153","target":"701","id":"4858","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"278","target":"533","id":"7028","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"348","target":"668","id":"8058","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"336","target":"506","id":"7904","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"530","target":"544","id":"9944","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"310","target":"468","id":"7528","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"429","target":"595","id":"9024","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"207","target":"320","id":"5859","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"492","target":"700","id":"9641","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"23","target":"640","id":"1990","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"32","target":"400","id":"2193","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"232","target":"713","id":"6294","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"233","target":"676","id":"6309","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"45","target":"483","id":"2512","attributes":{"Weight":"1.0"},"color":"rgb(213,180,67)","size":1.0},{"source":"290","target":"658","id":"7255","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"383","target":"706","id":"8482","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"212","target":"675","id":"5953","attributes":{"Weight":"1.0"},"color":"rgb(132,229,148)","size":1.0},{"source":"490","target":"717","id":"9620","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"261","target":"424","id":"6759","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"285","target":"646","id":"7154","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"480","target":"517","id":"9551","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"179","target":"717","id":"5369","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"481","target":"503","id":"9561","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"596","target":"610","id":"10307","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"399","target":"405","id":"8682","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"7","target":"88","id":"1602","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"593","target":"652","id":"10299","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"18","target":"347","id":"1874","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"542","target":"653","id":"10019","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"385","target":"518","id":"8507","attributes":{"Weight":"1.0"},"color":"rgb(148,164,115)","size":1.0},{"source":"285","target":"689","id":"7158","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"647","target":"650","id":"10530","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"75","target":"190","id":"3195","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"339","target":"665","id":"7947","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"36","target":"599","id":"2303","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"475","target":"573","id":"9516","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"453","target":"661","id":"9287","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"521","target":"562","id":"9855","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"189","target":"223","id":"5531","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"288","target":"525","id":"7208","attributes":{"Weight":"1.0"},"color":"rgb(148,115,229)","size":1.0},{"source":"468","target":"541","id":"9442","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"68","target":"183","id":"3034","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"237","target":"422","id":"6358","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"61","target":"659","id":"2893","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"226","target":"430","id":"6186","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"360","target":"501","id":"8185","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"646","target":"651","id":"10521","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"571","target":"623","id":"10173","attributes":{"Weight":"1.0"},"color":"rgb(148,196,115)","size":1.0},{"source":"454","target":"687","id":"9306","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"120","target":"733","id":"4170","attributes":{"Weight":"1.0"},"color":"rgb(229,67,99)","size":1.0},{"source":"407","target":"662","id":"8775","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"141","target":"246","id":"4587","attributes":{"Weight":"1.0"},"color":"rgb(180,148,148)","size":1.0},{"source":"464","target":"700","id":"9403","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"606","target":"714","id":"10358","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"500","target":"702","id":"9712","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"650","target":"730","id":"10550","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"43","target":"272","id":"2442","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"550","target":"727","id":"10064","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"247","target":"273","id":"6515","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"568","target":"732","id":"10154","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"67","target":"68","id":"3012","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"274","target":"722","id":"6972","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"61","target":"606","id":"2891","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"287","target":"645","id":"7194","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"602","target":"665","id":"10335","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"542","target":"698","id":"10021","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"135","target":"233","id":"4453","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"403","target":"691","id":"8737","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"327","target":"623","id":"7773","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"641","target":"704","id":"10506","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"530","target":"681","id":"9945","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"366","target":"672","id":"8249","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"50","target":"368","id":"2615","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"33","target":"230","id":"2220","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"87","target":"472","id":"3465","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"99","target":"662","id":"3742","attributes":{"Weight":"1.0"},"color":"rgb(67,99,229)","size":1.0},{"source":"272","target":"520","id":"6941","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"194","target":"200","id":"5618","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"214","target":"223","id":"5971","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"162","target":"453","id":"5026","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"169","target":"304","id":"5153","attributes":{"Weight":"1.0"},"color":"rgb(67,148,148)","size":1.0},{"source":"304","target":"370","id":"7454","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"610","target":"721","id":"10373","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"260","target":"721","id":"6750","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"74","target":"612","id":"3184","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"38","target":"166","id":"2333","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"259","target":"505","id":"6719","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"591","target":"719","id":"10294","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"211","target":"225","id":"5914","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"114","target":"472","id":"4032","attributes":{"Weight":"1.0"},"color":"rgb(196,67,229)","size":1.0},{"source":"142","target":"669","id":"4624","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"159","target":"714","id":"4977","attributes":{"Weight":"1.0"},"color":"rgb(180,67,229)","size":1.0},{"source":"416","target":"452","id":"8859","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"125","target":"675","id":"4267","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"248","target":"506","id":"6535","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"593","target":"716","id":"10301","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"62","target":"242","id":"2907","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"299","target":"514","id":"7377","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"432","target":"624","id":"9063","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"74","target":"532","id":"3182","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"216","target":"601","id":"6021","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"47","target":"336","id":"2548","attributes":{"Weight":"1.0"},"color":"rgb(229,148,83)","size":1.0},{"source":"116","target":"575","id":"4084","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"84","target":"731","id":"3406","attributes":{"Weight":"1.0"},"color":"rgb(148,99,196)","size":1.0},{"source":"2","target":"219","id":"1496","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"296","target":"605","id":"7333","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"208","target":"686","id":"5884","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"265","target":"365","id":"6820","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"428","target":"511","id":"9003","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"30","target":"334","id":"2155","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"321","target":"579","id":"7690","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"94","target":"714","id":"3638","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"419","target":"720","id":"8906","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"348","target":"434","id":"8050","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"461","target":"634","id":"9380","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"136","target":"378","id":"4488","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"8","target":"528","id":"1645","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"60","target":"116","id":"2834","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"312","target":"637","id":"7563","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"209","target":"445","id":"5895","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"440","target":"668","id":"9164","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"267","target":"318","id":"6850","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"628","target":"670","id":"10447","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"537","target":"587","id":"9987","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"154","target":"720","id":"4884","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"257","target":"621","id":"6685","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"132","target":"209","id":"4399","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"48","target":"293","id":"2569","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"58","target":"636","id":"2813","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"467","target":"495","id":"9430","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"450","target":"608","id":"9262","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"163","target":"727","id":"5055","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"268","target":"391","id":"6867","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"449","target":"452","id":"9248","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"580","target":"716","id":"10247","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"460","target":"576","id":"9362","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"574","target":"706","id":"10200","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"303","target":"543","id":"7439","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"19","target":"252","id":"1897","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"176","target":"426","id":"5289","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"585","target":"722","id":"10266","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"408","target":"460","id":"8777","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"72","target":"379","id":"3137","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"158","target":"540","id":"4950","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"514","target":"535","id":"9801","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"190","target":"574","id":"5562","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"297","target":"671","id":"7350","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"312","target":"636","id":"7562","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"100","target":"105","id":"3745","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"389","target":"666","id":"8561","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"374","target":"577","id":"8342","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"319","target":"569","id":"7667","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"260","target":"453","id":"6737","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"513","target":"530","id":"9797","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"123","target":"449","id":"4220","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"111","target":"155","id":"3962","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"77","target":"313","id":"3247","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"412","target":"658","id":"8833","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"469","target":"734","id":"9457","attributes":{"Weight":"1.0"},"color":"rgb(99,83,229)","size":1.0},{"source":"96","target":"219","id":"3672","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"302","target":"633","id":"7422","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"460","target":"532","id":"9360","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"385","target":"687","id":"8516","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"386","target":"667","id":"8528","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"363","target":"702","id":"8214","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"49","target":"275","id":"2587","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"270","target":"302","id":"6904","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"192","target":"570","id":"5591","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"35","target":"467","id":"2278","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"129","target":"166","id":"4328","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"50","target":"719","id":"2629","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"162","target":"578","id":"5028","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"215","target":"721","id":"6004","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"256","target":"592","id":"6677","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"527","target":"625","id":"9914","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"402","target":"557","id":"8723","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"119","target":"712","id":"4148","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"74","target":"311","id":"3174","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"62","target":"683","id":"2920","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"247","target":"467","id":"6521","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"284","target":"584","id":"7144","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"55","target":"263","id":"2729","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"24","target":"48","id":"1999","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"249","target":"422","id":"6546","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"243","target":"732","id":"6457","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"385","target":"611","id":"8510","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"198","target":"204","id":"5698","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"154","target":"397","id":"4872","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"172","target":"706","id":"5230","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"537","target":"702","id":"9992","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"56","target":"172","id":"2748","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"28","target":"626","id":"2117","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"225","target":"487","id":"6176","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"140","target":"316","id":"4561","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"376","target":"699","id":"8375","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"398","target":"639","id":"8674","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"80","target":"303","id":"3312","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"44","target":"433","id":"2472","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"497","target":"697","id":"9687","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"187","target":"542","id":"5506","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"196","target":"472","id":"5663","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"93","target":"716","id":"3617","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"313","target":"518","id":"7576","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"339","target":"721","id":"7951","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"9","target":"186","id":"1664","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"262","target":"354","id":"6774","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"23","target":"641","id":"1991","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"729","target":"730","id":"10685","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"212","target":"555","id":"5947","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"23","target":"439","id":"1987","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"517","target":"611","id":"9827","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"139","target":"238","id":"4536","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"94","target":"171","id":"3620","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"4","target":"709","id":"1553","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"690","target":"721","id":"10647","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"420","target":"488","id":"8907","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"114","target":"657","id":"4042","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"135","target":"349","id":"4461","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"140","target":"679","id":"4581","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"53","target":"684","id":"2687","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"600","target":"645","id":"10325","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"85","target":"443","id":"3422","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"673","target":"682","id":"10613","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"325","target":"417","id":"7734","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"73","target":"183","id":"3150","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"432","target":"469","id":"9055","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"431","target":"490","id":"9042","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"21","target":"48","id":"1936","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"4","target":"520","id":"1548","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"658","target":"731","id":"10580","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"282","target":"725","id":"7111","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"327","target":"517","id":"7768","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"689","target":"725","id":"10640","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"54","target":"319","id":"2702","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"272","target":"670","id":"6945","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"131","target":"180","id":"4370","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"77","target":"518","id":"3256","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"366","target":"591","id":"8247","attributes":{"Weight":"1.0"},"color":"rgb(148,67,213)","size":1.0},{"source":"128","target":"506","id":"4317","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"119","target":"506","id":"4143","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"692","target":"693","id":"10651","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"443","target":"547","id":"9198","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"66","target":"666","id":"3011","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"63","target":"474","id":"2934","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"188","target":"571","id":"5519","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"419","target":"600","id":"8901","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"269","target":"290","id":"6884","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"430","target":"461","id":"9029","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"147","target":"187","id":"4723","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"20","target":"91","id":"1912","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"488","target":"647","id":"9600","attributes":{"Weight":"1.0"},"color":"rgb(67,116,229)","size":1.0},{"source":"240","target":"711","id":"6411","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"618","target":"703","id":"10408","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"237","target":"449","id":"6360","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"351","target":"464","id":"8094","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"88","target":"692","id":"3508","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"459","target":"479","id":"9350","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"385","target":"656","id":"8514","attributes":{"Weight":"1.0"},"color":"rgb(148,148,132)","size":1.0},{"source":"638","target":"692","id":"10491","attributes":{"Weight":"1.0"},"color":"rgb(164,148,148)","size":1.0},{"source":"533","target":"705","id":"9965","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"318","target":"562","id":"7646","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"133","target":"345","id":"4420","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"171","target":"396","id":"5197","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"399","target":"412","id":"8684","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"439","target":"708","id":"9146","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"137","target":"273","id":"4502","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"82","target":"687","id":"3368","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"1","target":"525","id":"1478","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"231","target":"616","id":"6274","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"295","target":"318","id":"7313","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"110","target":"569","id":"3948","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"318","target":"355","id":"7637","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"26","target":"449","id":"2049","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"142","target":"147","id":"4605","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"168","target":"486","id":"5140","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"75","target":"403","id":"3203","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"72","target":"75","id":"3129","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"169","target":"267","id":"5149","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"103","target":"295","id":"3811","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"19","target":"416","id":"1900","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"103","target":"355","id":"3814","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"102","target":"305","id":"3791","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"90","target":"265","id":"3540","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"260","target":"596","id":"6742","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"135","target":"319","id":"4458","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"552","target":"595","id":"10069","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"43","target":"670","id":"2456","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"301","target":"469","id":"7406","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"567","target":"717","id":"10147","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"56","target":"527","id":"2757","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"150","target":"572","id":"4793","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"229","target":"355","id":"6238","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"111","target":"135","id":"3959","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"109","target":"378","id":"3918","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"86","target":"300","id":"3439","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"187","target":"263","id":"5495","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"335","target":"576","id":"7887","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"391","target":"559","id":"8588","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"164","target":"643","id":"5070","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"453","target":"723","id":"9293","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"378","target":"501","id":"8398","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"183","target":"684","id":"5434","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"58","target":"291","id":"2800","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"428","target":"732","id":"9017","attributes":{"Weight":"1.0"},"color":"rgb(229,115,67)","size":1.0},{"source":"34","target":"169","id":"2246","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"79","target":"480","id":"3292","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"228","target":"305","id":"6219","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"425","target":"523","id":"8970","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"260","target":"602","id":"6743","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"106","target":"630","id":"3869","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"314","target":"338","id":"7582","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"111","target":"294","id":"3966","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"36","target":"666","id":"2304","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"595","target":"710","id":"10305","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"376","target":"529","id":"8370","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"55","target":"514","id":"2738","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"330","target":"393","id":"7815","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"157","target":"669","id":"4943","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"438","target":"725","id":"9135","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"106","target":"181","id":"3859","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"400","target":"545","id":"8698","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"540","target":"641","id":"10009","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"130","target":"304","id":"4354","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"386","target":"527","id":"8521","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"316","target":"572","id":"7616","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"191","target":"531","id":"5578","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"169","target":"295","id":"5152","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"31","target":"554","id":"2181","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"122","target":"517","id":"4202","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"160","target":"621","id":"4991","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"267","target":"494","id":"6854","attributes":{"Weight":"1.0"},"color":"rgb(67,196,148)","size":1.0},{"source":"73","target":"204","id":"3153","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"47","target":"656","id":"2559","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"307","target":"680","id":"7497","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"527","target":"677","id":"9917","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"13","target":"584","id":"1769","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"495","target":"584","id":"9664","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"67","target":"516","id":"3022","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"227","target":"316","id":"6199","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"386","target":"522","id":"8520","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"464","target":"551","id":"9399","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"37","target":"107","id":"2308","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"273","target":"495","id":"6953","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"357","target":"564","id":"8156","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"591","target":"644","id":"10292","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"96","target":"100","id":"3665","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"263","target":"301","id":"6783","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"392","target":"561","id":"8604","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"422","target":"449","id":"8932","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"177","target":"408","id":"5311","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"101","target":"124","id":"3763","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"321","target":"626","id":"7691","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"344","target":"512","id":"8011","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"695","target":"733","id":"10660","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"289","target":"586","id":"7232","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"194","target":"702","id":"5633","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"76","target":"604","id":"3236","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"654","target":"702","id":"10570","attributes":{"Weight":"1.0"},"color":"rgb(67,229,116)","size":1.0},{"source":"428","target":"580","id":"9008","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"4","target":"118","id":"1536","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"169","target":"369","id":"5159","attributes":{"Weight":"1.0"},"color":"rgb(67,148,148)","size":1.0},{"source":"229","target":"295","id":"6235","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"537","target":"597","id":"9988","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"365","target":"513","id":"8236","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"2","target":"457","id":"1504","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"36","target":"306","id":"2294","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"23","target":"51","id":"1981","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"278","target":"705","id":"7033","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"257","target":"322","id":"6679","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"387","target":"590","id":"8539","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"300","target":"514","id":"7392","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"157","target":"514","id":"4935","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"106","target":"130","id":"3857","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"291","target":"503","id":"7267","attributes":{"Weight":"1.0"},"color":"rgb(132,229,132)","size":1.0},{"source":"288","target":"589","id":"7214","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"379","target":"702","id":"8418","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"322","target":"715","id":"7705","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"33","target":"484","id":"2236","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"202","target":"487","id":"5779","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"30","target":"186","id":"2147","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"55","target":"143","id":"2724","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"267","target":"295","id":"6848","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"3","target":"531","id":"1528","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"177","target":"612","id":"5319","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"81","target":"515","id":"3339","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"51","target":"695","id":"2641","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"304","target":"701","id":"7462","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"496","target":"673","id":"9675","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"380","target":"599","id":"8426","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"47","target":"674","id":"2561","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"392","target":"560","id":"8603","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"54","target":"294","id":"2701","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"251","target":"674","id":"6596","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"211","target":"212","id":"5912","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"166","target":"373","id":"5103","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"194","target":"500","id":"5625","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"303","target":"629","id":"7446","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"102","target":"353","id":"3794","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"654","target":"679","id":"10568","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"11","target":"404","id":"1718","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"180","target":"511","id":"5377","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"495","target":"570","id":"9663","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"81","target":"471","id":"3335","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"415","target":"583","id":"8849","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"268","target":"414","id":"6877","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"50","target":"319","id":"2613","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"76","target":"573","id":"3233","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"379","target":"537","id":"8412","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"368","target":"429","id":"8266","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"108","target":"274","id":"3893","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"254","target":"696","id":"6647","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"185","target":"634","id":"5473","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"369","target":"667","id":"8283","attributes":{"Weight":"1.0"},"color":"rgb(67,148,180)","size":1.0},{"source":"61","target":"496","id":"2886","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"165","target":"486","id":"5089","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"274","target":"526","id":"6966","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"65","target":"709","id":"2992","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"556","target":"656","id":"10090","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"455","target":"542","id":"9312","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"19","target":"481","id":"1906","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"153","target":"630","id":"4856","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"651","target":"729","id":"10556","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"195","target":"519","id":"5644","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"589","target":"719","id":"10284","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"90","target":"476","id":"3546","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"213","target":"513","id":"5965","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"260","target":"723","id":"6751","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"87","target":"728","id":"3481","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"52","target":"328","id":"2652","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"5","target":"240","id":"1563","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"374","target":"614","id":"8344","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"85","target":"151","id":"3410","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"186","target":"489","id":"5489","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"221","target":"645","id":"6113","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"78","target":"666","id":"3276","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"366","target":"693","id":"8250","attributes":{"Weight":"1.0"},"color":"rgb(115,148,148)","size":1.0},{"source":"365","target":"683","id":"8240","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"472","target":"521","id":"9478","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"176","target":"367","id":"5287","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"150","target":"576","id":"4794","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"227","target":"586","id":"6208","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"337","target":"633","id":"7921","attributes":{"Weight":"1.0"},"color":"rgb(99,180,148)","size":1.0},{"source":"10","target":"181","id":"1690","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"348","target":"654","id":"8057","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"136","target":"343","id":"4486","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"367","target":"464","id":"8256","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"301","target":"602","id":"7411","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"217","target":"278","id":"6030","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"140","target":"172","id":"4557","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"299","target":"301","id":"7370","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"590","target":"664","id":"10287","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"364","target":"683","id":"8225","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"70","target":"424","id":"3095","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"308","target":"575","id":"7505","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"166","target":"634","id":"5111","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"250","target":"557","id":"6572","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"594","target":"663","id":"10303","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"74","target":"384","id":"3175","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"61","target":"149","id":"2870","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"183","target":"633","id":"5429","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"260","target":"366","id":"6735","attributes":{"Weight":"1.0"},"color":"rgb(115,148,148)","size":1.0},{"source":"641","target":"695","id":"10505","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"144","target":"231","id":"4650","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"174","target":"293","id":"5252","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"373","target":"644","id":"8326","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"314","target":"507","id":"7588","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"427","target":"536","id":"8996","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"449","target":"482","id":"9251","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"320","target":"512","id":"7682","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"163","target":"501","id":"5048","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"261","target":"591","id":"6766","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"89","target":"257","id":"3518","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"648","target":"678","id":"10539","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"88","target":"339","id":"3493","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"217","target":"420","id":"6034","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"332","target":"580","id":"7847","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"362","target":"484","id":"8200","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"230","target":"344","id":"6250","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"319","target":"643","id":"7671","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"188","target":"332","id":"5514","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"129","target":"191","id":"4332","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"499","target":"552","id":"9702","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"144","target":"528","id":"4663","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"49","target":"355","id":"2592","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"210","target":"321","id":"5901","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"625","target":"667","id":"10435","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"233","target":"279","id":"6295","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"283","target":"412","id":"7128","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"75","target":"505","id":"3205","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"283","target":"290","id":"7116","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"206","target":"727","id":"5852","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"469","target":"539","id":"9448","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"283","target":"390","id":"7119","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"4","target":"43","id":"1534","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"20","target":"90","id":"1911","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"199","target":"220","id":"5715","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"238","target":"583","id":"6379","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"165","target":"168","id":"5078","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"442","target":"614","id":"9190","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"29","target":"313","id":"2130","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"146","target":"337","id":"4711","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"97","target":"274","id":"3689","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"287","target":"319","id":"7180","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"472","target":"565","id":"9482","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"55","target":"698","id":"2745","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"268","target":"411","id":"6874","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"156","target":"544","id":"4919","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"646","target":"734","id":"10528","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"610","target":"661","id":"10368","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"61","target":"682","id":"2896","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"325","target":"396","id":"7733","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"265","target":"341","id":"6819","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"87","target":"594","id":"3475","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"386","target":"681","id":"8531","attributes":{"Weight":"1.0"},"color":"rgb(83,229,99)","size":1.0},{"source":"372","target":"551","id":"8315","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"285","target":"735","id":"7164","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"476","target":"681","id":"9529","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"112","target":"223","id":"3992","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"541","target":"680","id":"10016","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"1","target":"173","id":"1467","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"204","target":"270","id":"5806","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"578","target":"723","id":"10235","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"424","target":"487","id":"8954","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"243","target":"293","id":"6448","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"269","target":"395","id":"6892","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"246","target":"436","id":"6501","attributes":{"Weight":"1.0"},"color":"rgb(196,67,213)","size":1.0},{"source":"277","target":"511","id":"7009","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"183","target":"688","id":"5435","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"443","target":"719","id":"9208","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"99","target":"630","id":"3741","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"497","target":"633","id":"9681","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"460","target":"527","id":"9358","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"377","target":"392","id":"8379","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"137","target":"284","id":"4503","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"74","target":"685","id":"3190","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"423","target":"674","id":"8948","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"589","target":"644","id":"10282","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"77","target":"479","id":"3254","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"17","target":"546","id":"1861","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"216","target":"381","id":"6011","attributes":{"Weight":"1.0"},"color":"rgb(229,115,148)","size":1.0},{"source":"600","target":"734","id":"10326","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"271","target":"615","id":"6926","attributes":{"Weight":"1.0"},"color":"rgb(132,148,148)","size":1.0},{"source":"253","target":"656","id":"6627","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"268","target":"561","id":"6880","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"358","target":"424","id":"8160","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"638","target":"639","id":"10488","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"179","target":"627","id":"5362","attributes":{"Weight":"1.0"},"color":"rgb(67,180,180)","size":1.0},{"source":"456","target":"551","id":"9325","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"138","target":"387","id":"4522","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"501","target":"563","id":"9716","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"82","target":"577","id":"3361","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"387","target":"628","id":"8540","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"194","target":"597","id":"5630","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"63","target":"715","id":"2944","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"325","target":"606","id":"7741","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"335","target":"555","id":"7885","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"135","target":"569","id":"4474","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"562","target":"604","id":"10120","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"232","target":"335","id":"6284","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"272","target":"628","id":"6943","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"194","target":"363","id":"5621","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"308","target":"335","id":"7499","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"291","target":"622","id":"7269","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"386","target":"616","id":"8525","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"123","target":"237","id":"4213","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"20","target":"265","id":"1919","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"55","target":"301","id":"2732","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"110","target":"629","id":"3953","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"528","target":"713","id":"9933","attributes":{"Weight":"1.0"},"color":"rgb(148,196,99)","size":1.0},{"source":"316","target":"569","id":"7615","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"105","target":"366","id":"3849","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"152","target":"448","id":"4837","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"456","target":"609","id":"9326","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"310","target":"515","id":"7533","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"158","target":"732","id":"4957","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"109","target":"388","id":"3919","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"96","target":"181","id":"3670","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"71","target":"182","id":"3111","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"202","target":"600","id":"5781","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"286","target":"618","id":"7175","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"100","target":"153","id":"3748","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"307","target":"518","id":"7494","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"201","target":"595","id":"5763","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"273","target":"380","id":"6950","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"181","target":"630","id":"5397","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"576","target":"616","id":"10213","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"465","target":"647","id":"9408","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"64","target":"320","id":"2961","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"279","target":"376","id":"7039","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"140","target":"667","id":"4578","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"266","target":"504","id":"6834","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"239","target":"320","id":"6388","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"76","target":"679","id":"3239","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"162","target":"271","id":"5019","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"40","target":"247","id":"2380","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"20","target":"242","id":"1918","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"352","target":"711","id":"8115","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"54","target":"358","id":"2703","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"9","target":"595","id":"1680","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"244","target":"496","id":"6466","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"401","target":"423","id":"8709","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"382","target":"724","id":"8466","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"31","target":"105","id":"2168","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"40","target":"78","id":"2377","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"498","target":"687","id":"9700","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"298","target":"518","id":"7364","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"10","target":"341","id":"1695","attributes":{"Weight":"1.0"},"color":"rgb(83,148,148)","size":1.0},{"source":"184","target":"204","id":"5441","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"335","target":"642","id":"7891","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"45","target":"252","id":"2500","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"205","target":"605","id":"5834","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"47","target":"410","id":"2553","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"237","target":"249","id":"6354","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"312","target":"516","id":"7557","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"123","target":"447","id":"4219","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"183","target":"270","id":"5418","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"214","target":"362","id":"5979","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"75","target":"691","id":"3211","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"6","target":"541","id":"1598","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"62","target":"365","id":"2911","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"356","target":"545","id":"8143","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"27","target":"415","id":"2071","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"140","target":"532","id":"4573","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"50","target":"397","id":"2618","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"249","target":"291","id":"6543","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"508","target":"594","id":"9773","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"70","target":"358","id":"3093","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"294","target":"623","id":"7306","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"322","target":"474","id":"7696","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"402","target":"423","id":"8720","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"143","target":"157","id":"4627","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"699","target":"717","id":"10662","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"15","target":"526","id":"1814","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"274","target":"525","id":"6965","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"8","target":"144","id":"1631","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"522","target":"525","id":"9863","attributes":{"Weight":"1.0"},"color":"rgb(67,196,180)","size":1.0},{"source":"22","target":"51","id":"1961","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"91","target":"365","id":"3563","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"221","target":"424","id":"6102","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"615","target":"718","id":"10399","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"447","target":"622","id":"9236","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"96","target":"106","id":"3667","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"404","target":"520","id":"8745","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"22","target":"23","id":"1957","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"34","target":"276","id":"2251","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"16","target":"641","id":"1837","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"460","target":"646","id":"9366","attributes":{"Weight":"1.0"},"color":"rgb(67,164,180)","size":1.0},{"source":"400","target":"410","id":"8696","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"488","target":"662","id":"9601","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"168","target":"463","id":"5139","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"636","target":"688","id":"10481","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"175","target":"542","id":"5277","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"327","target":"721","id":"7777","attributes":{"Weight":"1.0"},"color":"rgb(115,229,115)","size":1.0},{"source":"71","target":"217","id":"3113","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"231","target":"335","id":"6263","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"302","target":"524","id":"7420","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"28","target":"210","id":"2098","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"48","target":"51","id":"2564","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"133","target":"566","id":"4427","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"89","target":"159","id":"3514","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"157","target":"491","id":"4934","attributes":{"Weight":"1.0"},"color":"rgb(99,83,229)","size":1.0},{"source":"232","target":"238","id":"6279","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"262","target":"512","id":"6780","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"574","target":"649","id":"10197","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"109","target":"506","id":"3922","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"257","target":"726","id":"6694","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"123","target":"252","id":"4215","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"583","target":"713","id":"10259","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"466","target":"689","id":"9423","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"440","target":"728","id":"9166","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"63","target":"102","id":"2922","attributes":{"Weight":"1.0"},"color":"rgb(196,67,180)","size":1.0},{"source":"216","target":"719","id":"6029","attributes":{"Weight":"1.0"},"color":"rgb(229,115,132)","size":1.0},{"source":"459","target":"541","id":"9353","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"192","target":"389","id":"5588","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"95","target":"506","id":"3656","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"28","target":"50","id":"2088","attributes":{"Weight":"1.0"},"color":"rgb(148,99,213)","size":1.0},{"source":"377","target":"405","id":"8384","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"404","target":"590","id":"8747","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"506","target":"617","id":"9755","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"311","target":"532","id":"7546","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"408","target":"522","id":"8778","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"8","target":"179","id":"1635","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"96","target":"309","id":"3675","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"146","target":"488","id":"4714","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"291","target":"482","id":"7266","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"378","target":"561","id":"8401","attributes":{"Weight":"1.0"},"color":"rgb(229,148,115)","size":1.0},{"source":"121","target":"129","id":"4171","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"377","target":"560","id":"8390","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"32","target":"545","id":"2198","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"368","target":"529","id":"8269","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"511","target":"539","id":"9787","attributes":{"Weight":"1.0"},"color":"rgb(180,115,148)","size":1.0},{"source":"439","target":"704","id":"9145","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"420","target":"662","id":"8912","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"647","target":"724","id":"10533","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"278","target":"337","id":"7024","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"292","target":"708","id":"7280","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"373","target":"629","id":"8324","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"361","target":"512","id":"8197","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"97","target":"585","id":"3700","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"177","target":"179","id":"5301","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"331","target":"431","id":"7831","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"80","target":"238","id":"3310","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"256","target":"564","id":"6675","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"380","target":"570","id":"8423","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"49","target":"564","id":"2598","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"622","target":"675","id":"10423","attributes":{"Weight":"1.0"},"color":"rgb(197,229,67)","size":1.0},{"source":"413","target":"414","id":"8835","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"29","target":"620","id":"2141","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"193","target":"730","id":"5615","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"70","target":"221","id":"3088","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"146","target":"420","id":"4713","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"69","target":"725","id":"3079","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"508","target":"523","id":"9768","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"69","target":"374","id":"3063","attributes":{"Weight":"1.0"},"color":"rgb(67,164,196)","size":1.0},{"source":"357","target":"510","id":"8154","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"214","target":"484","id":"5982","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"186","target":"236","id":"5482","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"419","target":"487","id":"8896","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"498","target":"611","id":"9693","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"664","target":"670","id":"10595","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"266","target":"453","id":"6833","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"288","target":"521","id":"7205","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"132","target":"483","id":"4411","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"72","target":"597","id":"3145","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"139","target":"335","id":"4540","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"102","target":"548","id":"3799","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"185","target":"675","id":"5474","attributes":{"Weight":"1.0"},"color":"rgb(213,213,67)","size":1.0},{"source":"198","target":"684","id":"5711","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"209","target":"484","id":"5897","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"597","target":"702","id":"10317","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"92","target":"551","id":"3590","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"89","target":"671","id":"3530","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"216","target":"528","id":"6016","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"106","target":"366","id":"3864","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"185","target":"490","id":"5469","attributes":{"Weight":"1.0"},"color":"rgb(229,132,132)","size":1.0},{"source":"383","target":"574","id":"8476","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"330","target":"405","id":"7819","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"308","target":"707","id":"7512","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"9","target":"30","id":"1660","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"82","target":"387","id":"3351","attributes":{"Weight":"1.0"},"color":"rgb(67,229,180)","size":1.0},{"source":"110","target":"342","id":"3942","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"74","target":"522","id":"3180","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"589","target":"663","id":"10283","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"300","target":"653","id":"7397","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"380","target":"495","id":"8422","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"75","target":"597","id":"3209","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"221","target":"450","id":"6103","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"358","target":"462","id":"8163","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"338","target":"417","id":"7927","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"704","target":"732","id":"10667","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"358","target":"555","id":"8165","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"281","target":"438","id":"7079","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"144","target":"318","id":"4656","attributes":{"Weight":"1.0"},"color":"rgb(67,229,99)","size":1.0},{"source":"200","target":"702","id":"5747","attributes":{"Weight":"1.0"},"color":"rgb(67,229,100)","size":1.0},{"source":"21","target":"293","id":"1944","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"313","target":"541","id":"7577","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"44","target":"342","id":"2469","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"305","target":"548","id":"7470","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"438","target":"683","id":"9132","attributes":{"Weight":"1.0"},"color":"rgb(83,164,148)","size":1.0},{"source":"556","target":"696","id":"10094","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"408","target":"677","id":"8785","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"179","target":"384","id":"5351","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"282","target":"438","id":"7099","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"213","target":"406","id":"5962","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"137","target":"495","id":"4509","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"18","target":"340","id":"1872","attributes":{"Weight":"1.0"},"color":"rgb(67,229,197)","size":1.0},{"source":"258","target":"308","id":"6696","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"76","target":"433","id":"3222","attributes":{"Weight":"1.0"},"color":"rgb(148,148,196)","size":1.0},{"source":"1","target":"296","id":"1472","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"145","target":"233","id":"4676","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"90","target":"365","id":"3543","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"22","target":"540","id":"1969","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"165","target":"463","id":"5088","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"412","target":"561","id":"8832","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"193","target":"282","id":"5598","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"218","target":"221","id":"6043","attributes":{"Weight":"1.0"},"color":"rgb(67,196,229)","size":1.0},{"source":"210","target":"627","id":"5909","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"20","target":"117","id":"1913","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"119","target":"163","id":"4133","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"93","target":"286","id":"3602","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"34","target":"103","id":"2244","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"256","target":"546","id":"6674","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"28","target":"146","id":"2096","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"375","target":"681","id":"8361","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"103","target":"546","id":"3819","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"195","target":"418","id":"5639","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"54","target":"644","id":"2720","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"371","target":"460","id":"8293","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0},{"source":"169","target":"196","id":"5146","attributes":{"Weight":"1.0"},"color":"rgb(148,148,148)","size":1.0},{"source":"178","target":"551","id":"5341","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"87","target":"676","id":"3480","attributes":{"Weight":"1.0"},"color":"rgb(229,67,213)","size":1.0},{"source":"566","target":"682","id":"10142","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"122","target":"573","id":"4203","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"472","target":"523","id":"9479","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"212","target":"490","id":"5946","attributes":{"Weight":"1.0"},"color":"rgb(148,148,213)","size":1.0},{"source":"293","target":"439","id":"7283","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"17","target":"355","id":"1856","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"350","target":"396","id":"8077","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"472","target":"728","id":"9489","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"369","target":"701","id":"8285","attributes":{"Weight":"1.0"},"color":"rgb(67,67,229)","size":1.0},{"source":"338","target":"534","id":"7930","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"98","target":"609","id":"3721","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"179","target":"460","id":"5354","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"331","target":"529","id":"7835","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"218","target":"296","id":"6048","attributes":{"Weight":"1.0"},"color":"rgb(67,164,229)","size":1.0},{"source":"400","target":"556","id":"8699","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"292","target":"733","id":"7282","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"638","target":"726","id":"10494","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"122","target":"648","id":"4208","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"70","target":"261","id":"3090","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"450","target":"716","id":"9266","attributes":{"Weight":"1.0"},"color":"rgb(148,196,148)","size":1.0},{"source":"44","target":"110","id":"2460","attributes":{"Weight":"1.0"},"color":"rgb(148,148,180)","size":1.0},{"source":"41","target":"495","id":"2406","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"183","target":"516","id":"5425","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"124","target":"262","id":"4236","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"381","target":"663","id":"8448","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"170","target":"694","id":"5188","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"214","target":"239","id":"5973","attributes":{"Weight":"1.0"},"color":"rgb(229,132,67)","size":1.0},{"source":"171","target":"507","id":"5200","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"116","target":"348","id":"4077","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"292","target":"641","id":"7277","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"580","target":"601","id":"10242","attributes":{"Weight":"1.0"},"color":"rgb(229,164,67)","size":1.0},{"source":"327","target":"475","id":"7765","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"83","target":"84","id":"3369","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"442","target":"454","id":"9181","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"129","target":"185","id":"4331","attributes":{"Weight":"1.0"},"color":"rgb(229,197,67)","size":1.0},{"source":"256","target":"275","id":"6664","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"87","target":"543","id":"3471","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"164","target":"371","id":"5063","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"382","target":"729","id":"8468","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"562","target":"589","id":"10118","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"348","target":"415","id":"8048","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"433","target":"480","id":"9072","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"89","target":"553","id":"3524","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"386","target":"625","id":"8526","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"41","target":"306","id":"2401","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"405","target":"559","id":"8757","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"34","target":"564","id":"2261","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"54","target":"642","id":"2719","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"79","target":"122","id":"3278","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"55","target":"300","id":"2731","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"724","target":"725","id":"10676","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"665","target":"690","id":"10597","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"57","target":"196","id":"2770","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"159","target":"726","id":"4979","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"465","target":"651","id":"9410","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"282","target":"724","id":"7110","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"325","target":"673","id":"7744","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"504","target":"596","id":"9734","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"94","target":"325","id":"3623","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"113","target":"579","id":"4016","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"409","target":"543","id":"8799","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"253","target":"401","id":"6619","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"311","target":"386","id":"7540","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"462","target":"642","id":"9387","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"504","target":"723","id":"9743","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"514","target":"653","id":"9805","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"367","target":"615","id":"8262","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"423","target":"694","id":"8949","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"157","target":"263","id":"4925","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"160","target":"398","id":"4986","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"114","target":"474","id":"4033","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"143","target":"653","id":"4646","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"563","target":"588","id":"10126","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"504","target":"721","id":"9742","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"289","target":"490","id":"7226","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"135","target":"245","id":"4454","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"104","target":"169","id":"3823","attributes":{"Weight":"1.0"},"color":"rgb(67,229,67)","size":1.0},{"source":"12","target":"555","id":"1746","attributes":{"Weight":"1.0"},"color":"rgb(67,229,229)","size":1.0},{"source":"307","target":"471","id":"7490","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"25","target":"48","id":"2017","attributes":{"Weight":"1.0"},"color":"rgb(229,67,67)","size":1.0},{"source":"114","target":"159","id":"4023","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"328","target":"427","id":"7783","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"657","target":"671","id":"10577","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"522","target":"667","id":"9870","attributes":{"Weight":"1.0"},"color":"rgb(67,229,132)","size":1.0},{"source":"467","target":"570","id":"9431","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"441","target":"647","id":"9171","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"534","target":"670","id":"9970","attributes":{"Weight":"1.0"},"color":"rgb(132,148,213)","size":1.0},{"source":"465","target":"730","id":"9415","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"201","target":"499","id":"5760","attributes":{"Weight":"1.0"},"color":"rgb(229,67,132)","size":1.0},{"source":"29","target":"518","id":"2139","attributes":{"Weight":"1.0"},"color":"rgb(229,100,67)","size":1.0},{"source":"550","target":"563","id":"10060","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"254","target":"402","id":"6636","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"204","target":"736","id":"5820","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"133","target":"496","id":"4424","attributes":{"Weight":"1.0"},"color":"rgb(197,67,229)","size":1.0},{"source":"255","target":"401","id":"6650","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"388","target":"550","id":"8549","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"114","target":"638","id":"4039","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"193","target":"735","id":"5617","attributes":{"Weight":"1.0"},"color":"rgb(67,100,229)","size":1.0},{"source":"117","target":"502","id":"4105","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"41","target":"247","id":"2398","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"152","target":"563","id":"4841","attributes":{"Weight":"1.0"},"color":"rgb(229,229,67)","size":1.0},{"source":"32","target":"356","id":"2192","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"32","target":"402","id":"2195","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"142","target":"698","id":"4625","attributes":{"Weight":"1.0"},"color":"rgb(132,67,229)","size":1.0},{"source":"413","target":"560","id":"8837","attributes":{"Weight":"1.0"},"color":"rgb(229,67,164)","size":1.0},{"source":"456","target":"492","id":"9322","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"91","target":"681","id":"3572","attributes":{"Weight":"1.0"},"color":"rgb(100,229,67)","size":1.0},{"source":"240","target":"434","id":"6401","attributes":{"Weight":"1.0"},"color":"rgb(148,213,99)","size":1.0},{"source":"610","target":"665","id":"10369","attributes":{"Weight":"1.0"},"color":"rgb(164,229,67)","size":1.0},{"source":"76","target":"521","id":"3228","attributes":{"Weight":"1.0"},"color":"rgb(229,67,229)","size":1.0},{"source":"204","target":"684","id":"5817","attributes":{"Weight":"1.0"},"color":"rgb(132,229,67)","size":1.0},{"source":"210","target":"420","id":"5904","attributes":{"Weight":"1.0"},"color":"rgb(67,132,229)","size":1.0},{"source":"145","target":"279","id":"4677","attributes":{"Weight":"1.0"},"color":"rgb(229,67,197)","size":1.0},{"source":"536","target":"615","id":"9983","attributes":{"Weight":"1.0"},"color":"rgb(100,67,229)","size":1.0},{"source":"63","target":"246","id":"2928","attributes":{"Weight":"1.0"},"color":"rgb(164,67,229)","size":1.0},{"source":"170","target":"660","id":"5186","attributes":{"Weight":"1.0"},"color":"rgb(229,67,100)","size":1.0},{"source":"475","target":"687","id":"9524","attributes":{"Weight":"1.0"},"color":"rgb(67,229,164)","size":1.0},{"source":"13","target":"598","id":"1770","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"315","target":"570","id":"7601","attributes":{"Weight":"1.0"},"color":"rgb(67,197,229)","size":1.0},{"source":"151","target":"231","id":"4807","attributes":{"Weight":"1.0"},"color":"rgb(148,148,164)","size":1.0}],"nodes":[{"label":"Ha Dae-sung","x":1235.4569091796875,"y":1551.8240966796875,"id":"268","attributes":{"Eigenvector Centrality":"0.2315255949886878","Betweenness Centrality":"0.0","Appearances":"13","No":"8","Country":"South Korea","Club Country":"China","Club":"Beijing Guoan","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"2 March 1985 (aged 29)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Maxi Pereira","x":-192.70481872558594,"y":101.33695220947266,"id":"486","attributes":{"Eigenvector Centrality":"0.445244561946227","Betweenness Centrality":"0.002622941975601633","Appearances":"90","No":"16","Country":"Uruguay","Club Country":"Portugal","Club":"Benfica","Weighted Degree":"26.0","Modularity Class":"6","Date of birth / Age":"8 June 1984 (aged 30)","Degree":"26","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.32096069868995636"},"color":"rgb(229,197,67)","size":15.333333969116211},{"label":"Manabu Saito","x":700.6929931640625,"y":617.4116821289062,"id":"441","attributes":{"Eigenvector Centrality":"0.3171815377783478","Betweenness Centrality":"0.0","Appearances":"5","No":"20","Country":"Japan","Club Country":"Japan","Club":"Yokohama F. Marinos","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"4 April 1990 (aged 24)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Augusto Fernández","x":-1096.7728271484375,"y":332.52386474609375,"id":"70","attributes":{"Eigenvector Centrality":"0.4883294167498835","Betweenness Centrality":"0.0013747511405558612","Appearances":"9","No":"13","Country":"Argentina","Club Country":"Spain","Club":"Celta Vigo","Weighted Degree":"23.0","Modularity Class":"19","Date of birth / Age":"10 April 1986 (aged 28)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3013530135301353"},"color":"rgb(67,229,229)","size":11.333333015441895},{"label":"Edinson Cavani","x":-109.81510162353516,"y":97.26505279541016,"id":"185","attributes":{"Eigenvector Centrality":"0.5745311470651605","Betweenness Centrality":"0.003956184981235499","Appearances":"62","No":"21","Country":"Uruguay","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"31.0","Modularity Class":"6","Date of birth / Age":"14 February 1987 (aged 27)","Degree":"31","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.328125"},"color":"rgb(229,197,67)","size":22.0},{"label":"Matthias Ginter","x":444.2855224609375,"y":-312.178466796875,"id":"480","attributes":{"Eigenvector Centrality":"0.5180768997288345","Betweenness Centrality":"0.0023990924168658203","Appearances":"2","No":"3","Country":"Germany","Club Country":"Germany","Club":"SC Freiburg","Weighted Degree":"25.0","Modularity Class":"13","Date of birth / Age":"19 January 1994 (aged 20)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3188720173535792"},"color":"rgb(67,229,164)","size":14.0},{"label":"Ki Sung-yueng","x":1168.5513916015625,"y":1424.8240966796875,"id":"390","attributes":{"Eigenvector Centrality":"0.24281665265392566","Betweenness Centrality":"0.0038744127800200497","Appearances":"58","No":"16","Country":"South Korea","Club Country":"England","Club":"Sunderland","Weighted Degree":"23.0","Modularity Class":"10","Date of birth / Age":"24 January 1989 (aged 25)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.2628755364806867"},"color":"rgb(229,67,164)","size":11.333333015441895},{"label":"Johan Djourou","x":57.069740295410156,"y":323.0292663574219,"id":"339","attributes":{"Eigenvector Centrality":"0.39804740593626875","Betweenness Centrality":"7.203079250750265E-4","Appearances":"44","No":"20","Country":"Switzerland","Club Country":"Germany","Club":"Hamburger SV","Weighted Degree":"23.0","Modularity Class":"0","Date of birth / Age":"18 January 1987 (aged 27)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3002450980392157"},"color":"rgb(164,229,67)","size":11.333333015441895},{"label":"Ogenyi Onazi","x":-33.87162780761719,"y":-1294.2327880859375,"id":"537","attributes":{"Eigenvector Centrality":"0.4166984434880051","Betweenness Centrality":"0.01153289479646615","Appearances":"21","No":"17","Country":"Nigeria","Club Country":"Italy","Club":"Lazio","Weighted Degree":"28.0","Modularity Class":"14","Date of birth / Age":"25 December 1992 (aged 21)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3336359509759419"},"color":"rgb(67,229,100)","size":18.0},{"label":"Noel Valladares (c)","x":1633.689697265625,"y":-1230.439697265625,"id":"536","attributes":{"Eigenvector Centrality":"0.2366488794633179","Betweenness Centrality":"0.0","Appearances":"122","No":"18","Country":"Honduras","Club Country":"Honduras","Club":"Olimpia","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"3 May 1977 (aged 37)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Jackson Martínez","x":-870.146240234375,"y":947.0243530273438,"id":"304","attributes":{"Eigenvector Centrality":"0.446466126398784","Betweenness Centrality":"0.007655587436909223","Appearances":"27","No":"21","Country":"Colombia","Club Country":"Portugal","Club":"Porto","Weighted Degree":"29.0","Modularity Class":"11","Date of birth / Age":"3 October 1986 (aged 27)","Degree":"29","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.3315290933694181"},"color":"rgb(67,67,229)","size":19.333332061767578},{"label":"Shkodran Mustafi","x":459.89215087890625,"y":-438.27008056640625,"id":"648","attributes":{"Eigenvector Centrality":"0.4748329217376384","Betweenness Centrality":"0.0","Appearances":"1","No":"21","Country":"Germany","Club Country":"Italy","Club":"Sampdoria","Weighted Degree":"22.0","Modularity Class":"13","Date of birth / Age":"17 April 1992 (aged 22)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2955367913148371"},"color":"rgb(67,229,164)","size":10.0},{"label":"Leonardo Bonucci","x":125.05670928955078,"y":766.1940307617188,"id":"416","attributes":{"Eigenvector Centrality":"0.5455496050511396","Betweenness Centrality":"0.0016215443882875223","Appearances":"37","No":"19","Country":"Italy","Club Country":"Italy","Club":"Juventus","Weighted Degree":"28.0","Modularity Class":"3","Date of birth / Age":"1 May 1987 (aged 27)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(197,229,67)","size":18.0},{"label":"Eugenio Mena","x":-294.9122009277344,"y":1499.1805419921875,"id":"209","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"25","No":"2","Country":"Chile","Club Country":"Brazil","Club":"Santos","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"18 July 1988 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Rafael Márquez (c)","x":-2148.71923828125,"y":446.01300048828125,"id":"581","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"120","No":"4","Country":"Mexico","Club Country":"Mexico","Club":"León","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"13 February 1979 (aged 35)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Glen Johnson","x":-77.03864288330078,"y":-917.1484985351562,"id":"258","attributes":{"Eigenvector Centrality":"0.6237674591008824","Betweenness Centrality":"0.0010635550306756442","Appearances":"52","No":"2","Country":"England","Club Country":"England","Club":"Liverpool","Weighted Degree":"27.0","Modularity Class":"28","Date of birth / Age":"23 August 1984 (aged 29)","Degree":"27","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3247901016349978"},"color":"rgb(67,229,132)","size":16.666667938232422},{"label":"Kunle Odunlami","x":-51.50978469848633,"y":-1656.866943359375,"id":"403","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"11","No":"12","Country":"Nigeria","Club Country":"Nigeria","Club":"Sunshine Stars","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"5 March 1990 (aged 24)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Jerry Bengtson","x":1590.51611328125,"y":-1207.114501953125,"id":"328","attributes":{"Eigenvector Centrality":"0.23664887946331797","Betweenness Centrality":"0.0","Appearances":"44","No":"11","Country":"Honduras","Club Country":"United States","Club":"New England Revolution","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"8 April 1987 (aged 27)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Park Chu-young","x":1047.7447509765625,"y":1576.7559814453125,"id":"559","attributes":{"Eigenvector Centrality":"0.2434948987926026","Betweenness Centrality":"0.005100478514823181","Appearances":"64","No":"10","Country":"South Korea","Club Country":"England","Club":"Watford","Weighted Degree":"23.0","Modularity Class":"10","Date of birth / Age":"10 July 1985 (aged 28)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.26649746192893403"},"color":"rgb(229,67,164)","size":11.333333015441895},{"label":"Sergey Ryzhikov","x":-1292.9913330078125,"y":-1369.3878173828125,"id":"641","attributes":{"Eigenvector Centrality":"0.2784495406871368","Betweenness Centrality":"0.0019868644316807485","Appearances":"1","No":"16","Country":"Russia","Club Country":"Russia","Club":"Rubin Kazan","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"19 September 1980 (aged 33)","Degree":"23","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.256186824677588"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Sammir","x":-386.4237060546875,"y":741.6884155273438,"id":"624","attributes":{"Eigenvector Centrality":"0.3564884604564037","Betweenness Centrality":"0.0013005076523818384","Appearances":"6","No":"19","Country":"Croatia","Club Country":"Spain","Club":"Getafe","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"23 April 1987 (aged 27)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30209617755856966"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Milan Badelj","x":-271.9816589355469,"y":685.1373901367188,"id":"514","attributes":{"Eigenvector Centrality":"0.3589573457329694","Betweenness Centrality":"6.712739342317829E-4","Appearances":"9","No":"15","Country":"Croatia","Club Country":"Germany","Club":"Hamburger SV","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"25 February 1989 (aged 25)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3008595988538682"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"José María Basanta","x":-1144.7310791015625,"y":286.07470703125,"id":"358","attributes":{"Eigenvector Centrality":"0.4756507714516443","Betweenness Centrality":"0.0","Appearances":"10","No":"23","Country":"Argentina","Club Country":"Mexico","Club":"Monterrey","Weighted Degree":"22.0","Modularity Class":"19","Date of birth / Age":"3 April 1984 (aged 30)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2930622009569378"},"color":"rgb(67,229,229)","size":10.0},{"label":"Raúl Albiol","x":-934.9326782226562,"y":-101.35684204101562,"id":"591","attributes":{"Eigenvector Centrality":"0.9188656127061582","Betweenness Centrality":"0.004836935094169011","Appearances":"46","No":"2","Country":"Spain","Club Country":"Italy","Club":"Napoli","Weighted Degree":"32.0","Modularity Class":"23","Date of birth / Age":"4 September 1985 (aged 28)","Degree":"32","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.34249767008387694"},"color":"rgb(229,67,197)","size":23.33333396911621},{"label":"Jordan Henderson","x":-137.00108337402344,"y":-918.7854614257812,"id":"348","attributes":{"Eigenvector Centrality":"0.6237674591008823","Betweenness Centrality":"0.0010635550306756442","Appearances":"11","No":"14","Country":"England","Club Country":"England","Club":"Liverpool","Weighted Degree":"27.0","Modularity Class":"28","Date of birth / Age":"17 June 1990 (aged 23)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3247901016349978"},"color":"rgb(67,229,132)","size":16.666667938232422},{"label":"Masoud Shojaei","x":2059.234375,"y":1154.055419921875,"id":"467","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"50","No":"7","Country":"Iran","Club Country":"Spain","Club":"Las Palmas","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"9 June 1984 (aged 30)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Eden Hazard","x":-567.4556884765625,"y":-819.4087524414062,"id":"179","attributes":{"Eigenvector Centrality":"0.8054480780736979","Betweenness Centrality":"0.004148263742758199","Appearances":"45","No":"10","Country":"Belgium","Club Country":"England","Club":"Chelsea","Weighted Degree":"33.0","Modularity Class":"28","Date of birth / Age":"7 January 1991 (aged 23)","Degree":"33","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34950071326676174"},"color":"rgb(67,229,132)","size":24.666667938232422},{"label":"Victor Moses","x":-114.1285629272461,"y":-1433.164306640625,"id":"702","attributes":{"Eigenvector Centrality":"0.4988980810402226","Betweenness Centrality":"0.0059333803012395","Appearances":"22","No":"11","Country":"Nigeria","Club Country":"England","Club":"Liverpool","Weighted Degree":"31.0","Modularity Class":"14","Date of birth / Age":"12 December 1990 (aged 23)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3206806282722513"},"color":"rgb(67,229,100)","size":22.0},{"label":"Gotoku Sakai","x":626.2552490234375,"y":448.10638427734375,"id":"264","attributes":{"Eigenvector Centrality":"0.3583261950704595","Betweenness Centrality":"0.006133180800190253","Appearances":"12","No":"3","Country":"Japan","Club Country":"Germany","Club":"VfB Stuttgart","Weighted Degree":"25.0","Modularity Class":"27","Date of birth / Age":"14 March 1991 (aged 23)","Degree":"25","Position":"DF","Eccentricity":"4.0","Closeness Centrality":"0.33669262482821805"},"color":"rgb(67,100,229)","size":14.0},{"label":"Jung Sung-ryong","x":1253.423583984375,"y":1593.709716796875,"id":"377","attributes":{"Eigenvector Centrality":"0.2315255949886878","Betweenness Centrality":"0.0","Appearances":"61","No":"1","Country":"South Korea","Club Country":"South Korea","Club":"Suwon Bluewings","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"4 January 1985 (aged 29)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Giorgos Samaras","x":1468.084716796875,"y":290.1719665527344,"id":"254","attributes":{"Eigenvector Centrality":"0.3022386539935686","Betweenness Centrality":"0.015975933226232208","Appearances":"74","No":"7","Country":"Greece","Club Country":"Scotland","Club":"Celtic","Weighted Degree":"25.0","Modularity Class":"15","Date of birth / Age":"21 February 1985 (aged 29)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30523255813953487"},"color":"rgb(229,67,100)","size":14.0},{"label":"Fabrice Olinga","x":342.7852783203125,"y":88.49571228027344,"id":"217","attributes":{"Eigenvector Centrality":"0.3410519410379994","Betweenness Centrality":"0.0014859748176380408","Appearances":"8","No":"19","Country":"Cameroon","Club Country":"Belgium","Club":"Zulte Waregem","Weighted Degree":"23.0","Modularity Class":"17","Date of birth / Age":"12 May 1996 (aged 18)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.32407407407407407"},"color":"rgb(67,132,229)","size":11.333333015441895},{"label":"Maxim Choupo-Moting","x":590.2083740234375,"y":305.8430480957031,"id":"488","attributes":{"Eigenvector Centrality":"0.37131553578083376","Betweenness Centrality":"0.01444381785094054","Appearances":"26","No":"13","Country":"Cameroon","Club Country":"Germany","Club":"Mainz 05","Weighted Degree":"26.0","Modularity Class":"17","Date of birth / Age":"23 March 1989 (aged 25)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3319783197831978"},"color":"rgb(67,132,229)","size":15.333333969116211},{"label":"Jermaine Jones","x":734.7730102539062,"y":-1356.2696533203125,"id":"326","attributes":{"Eigenvector Centrality":"0.30080819732983394","Betweenness Centrality":"0.005869237175578168","Appearances":"42","No":"13","Country":"United States","Club Country":"Turkey","Club":"Be?ikta?","Weighted Degree":"24.0","Modularity Class":"26","Date of birth / Age":"3 November 1981 (aged 32)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3057404326123128"},"color":"rgb(100,229,67)","size":12.666666984558105},{"label":"Viktor Fayzulin","x":-1257.4415283203125,"y":-1320.703125,"id":"704","attributes":{"Eigenvector Centrality":"0.34982465542448266","Betweenness Centrality":"0.004583905120882726","Appearances":"19","No":"20","Country":"Russia","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"26.0","Modularity Class":"2","Date of birth / Age":"22 April 1986 (aged 28)","Degree":"26","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.27904328018223234"},"color":"rgb(229,67,67)","size":15.333333969116211},{"label":"Ghasem Haddadifar","x":1942.61962890625,"y":1184.328125,"id":"247","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"17","No":"11","Country":"Iran","Club Country":"Iran","Club":"Zob Ahan","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"12 July 1983 (aged 30)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Mamadou Sakho","x":-55.28839874267578,"y":-503.58740234375,"id":"440","attributes":{"Eigenvector Centrality":"0.6719226159356836","Betweenness Centrality":"0.0030924546628977845","Appearances":"19","No":"5","Country":"France","Club Country":"England","Club":"Liverpool","Weighted Degree":"31.0","Modularity Class":"16","Date of birth / Age":"13 February 1990 (aged 24)","Degree":"31","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3309320126069338"},"color":"rgb(229,67,229)","size":22.0},{"label":"Majeed Waris","x":324.3560485839844,"y":1417.5355224609375,"id":"437","attributes":{"Eigenvector Centrality":"0.30228653977349984","Betweenness Centrality":"0.002131225990650735","Appearances":"13","No":"18","Country":"Ghana","Club Country":"France","Club":"Valenciennes","Weighted Degree":"23.0","Modularity Class":"5","Date of birth / Age":"19 September 1991 (aged 22)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.29708973322554566"},"color":"rgb(67,229,197)","size":11.333333015441895},{"label":"Jaime Ayoví","x":-1695.57470703125,"y":-675.8545532226562,"id":"305","attributes":{"Eigenvector Centrality":"0.3623062182068215","Betweenness Centrality":"0.0","Appearances":"30","No":"17","Country":"Ecuador","Club Country":"Mexico","Club":"Tijuana","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"21 February 1988 (aged 26)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Christian Atsu","x":298.6339111328125,"y":1290.552734375,"id":"118","attributes":{"Eigenvector Centrality":"0.3040272220343691","Betweenness Centrality":"0.0033363298478359237","Appearances":"23","No":"7","Country":"Ghana","Club Country":"Netherlands","Club":"Vitesse","Weighted Degree":"23.0","Modularity Class":"5","Date of birth / Age":"10 January 1992 (aged 22)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2960128876359243"},"color":"rgb(67,229,197)","size":11.333333015441895},{"label":"Albert Adomah","x":449.0231628417969,"y":1183.720458984375,"id":"18","attributes":{"Eigenvector Centrality":"0.3025700565824491","Betweenness Centrality":"0.003289744732058429","Appearances":"15","No":"14","Country":"Ghana","Club Country":"England","Club":"Middlesbrough","Weighted Degree":"23.0","Modularity Class":"5","Date of birth / Age":"13 December 1987 (aged 26)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2973300970873787"},"color":"rgb(67,229,197)","size":11.333333015441895},{"label":"João Moutinho","x":-709.1241455078125,"y":410.86029052734375,"id":"332","attributes":{"Eigenvector Centrality":"0.45621028793672236","Betweenness Centrality":"0.0015929309060191388","Appearances":"68","No":"8","Country":"Portugal","Club Country":"France","Club":"AS Monaco","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"8 September 1986 (aged 27)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(229,164,67)","size":14.0},{"label":"Neymar","x":-688.3394775390625,"y":-195.9782257080078,"id":"529","attributes":{"Eigenvector Centrality":"0.9475639715704524","Betweenness Centrality":"0.005368122690024312","Appearances":"49","No":"10","Country":"Brazil","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"36.0","Modularity Class":"23","Date of birth / Age":"5 February 1992 (aged 22)","Degree":"36","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.34249767008387694"},"color":"rgb(229,67,197)","size":28.66666603088379},{"label":"Giannis Fetfatzidis","x":1469.207275390625,"y":587.9270629882812,"id":"250","attributes":{"Eigenvector Centrality":"0.2880961103470562","Betweenness Centrality":"0.004458743060852615","Appearances":"19","No":"18","Country":"Greece","Club Country":"Italy","Club":"Genoa","Weighted Degree":"24.0","Modularity Class":"15","Date of birth / Age":"21 December 1990 (aged 23)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2996331023236853"},"color":"rgb(229,67,100)","size":12.666666984558105},{"label":"Axel Witsel","x":-844.521240234375,"y":-894.0247192382812,"id":"74","attributes":{"Eigenvector Centrality":"0.6174086302888657","Betweenness Centrality":"0.006770928561410678","Appearances":"48","No":"6","Country":"Belgium","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"28.0","Modularity Class":"28","Date of birth / Age":"12 January 1989 (aged 25)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3343949044585987"},"color":"rgb(67,229,132)","size":18.0},{"label":"Gary Medel","x":-135.52125549316406,"y":1534.207275390625,"id":"239","attributes":{"Eigenvector Centrality":"0.32635320504193394","Betweenness Centrality":"0.006690023717310697","Appearances":"61","No":"17","Country":"Chile","Club Country":"Wales","Club":"Cardiff City","Weighted Degree":"23.0","Modularity Class":"18","Date of birth / Age":"3 August 1987 (aged 26)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.2878965922444183"},"color":"rgb(229,132,67)","size":11.333333015441895},{"label":"Eyong Enoh","x":420.9879455566406,"y":149.03363037109375,"id":"210","attributes":{"Eigenvector Centrality":"0.3227718779440803","Betweenness Centrality":"0.0","Appearances":"38","No":"18","Country":"Cameroon","Club Country":"Turkey","Club":"Antalyaspor","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"23 March 1986 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"Reza Haghighi","x":1912.50830078125,"y":1151.8526611328125,"id":"599","attributes":{"Eigenvector Centrality":"0.21274429344229642","Betweenness Centrality":"0.0","Appearances":"8","No":"8","Country":"Iran","Club Country":"Iran","Club":"Persepolis","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"1 February 1989 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Rahman Ahmadi","x":2011.62890625,"y":1143.9183349609375,"id":"584","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"10","No":"1","Country":"Iran","Club Country":"Iran","Club":"Sepahan","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"30 July 1980 (aged 33)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Landry N\u0027Guémo","x":380.334228515625,"y":127.53271484375,"id":"407","attributes":{"Eigenvector Centrality":"0.3227718779440803","Betweenness Centrality":"0.0","Appearances":"40","No":"7","Country":"Cameroon","Club Country":"France","Club":"Bordeaux","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"28 November 1985 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"Omar Gonzalez","x":770.2596435546875,"y":-1596.33251953125,"id":"544","attributes":{"Eigenvector Centrality":"0.27181518429351065","Betweenness Centrality":"0.0","Appearances":"20","No":"3","Country":"United States","Club Country":"United States","Club":"Los Angeles Galaxy","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"11 October 1988 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Mauricio Isla","x":-142.6880340576172,"y":1330.8896484375,"id":"483","attributes":{"Eigenvector Centrality":"0.5204561062047254","Betweenness Centrality":"0.00860736609402208","Appearances":"47","No":"4","Country":"Chile","Club Country":"Italy","Club":"Juventus","Weighted Degree":"32.0","Modularity Class":"18","Date of birth / Age":"12 June 1988 (aged 26)","Degree":"32","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.31599312123817713"},"color":"rgb(229,132,67)","size":23.33333396911621},{"label":"Marco Ureña","x":2171.260498046875,"y":406.7074890136719,"id":"448","attributes":{"Eigenvector Centrality":"0.24681597010360032","Betweenness Centrality":"0.007576013866204986","Appearances":"24","No":"21","Country":"Costa Rica","Club Country":"Russia","Club":"Kuban Krasnodar","Weighted Degree":"23.0","Modularity Class":"29","Date of birth / Age":"5 March 1990 (aged 24)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.27212143650499815"},"color":"rgb(229,229,67)","size":11.333333015441895},{"label":"Alireza Haghighi","x":1910.173095703125,"y":1066.8309326171875,"id":"35","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"6","No":"12","Country":"Iran","Club Country":"Portugal","Club":"Sporting Covilhã","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"2 May 1988 (aged 26)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Nabil Ghilas","x":-1331.1390380859375,"y":965.755126953125,"id":"526","attributes":{"Eigenvector Centrality":"0.4451346192495991","Betweenness Centrality":"0.00948599580264796","Appearances":"5","No":"9","Country":"Algeria","Club Country":"Portugal","Club":"Porto","Weighted Degree":"30.0","Modularity Class":"24","Date of birth / Age":"20 April 1990 (aged 24)","Degree":"30","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.32608695652173914"},"color":"rgb(67,164,229)","size":20.666667938232422},{"label":"Ejike Uzoenyi","x":-90.41376495361328,"y":-1613.627685546875,"id":"194","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"21","No":"3","Country":"Nigeria","Club Country":"Nigeria","Club":"Enugu Rangers","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"23 March 1988 (aged 26)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Giancarlo González","x":2265.36669921875,"y":299.92572021484375,"id":"248","attributes":{"Eigenvector Centrality":"0.23496944760866384","Betweenness Centrality":"0.0","Appearances":"35","No":"3","Country":"Costa Rica","Club Country":"United States","Club":"Columbus Crew","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"8 February 1988 (aged 26)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Ezequiel Lavezzi","x":-846.7564697265625,"y":254.6559600830078,"id":"212","attributes":{"Eigenvector Centrality":"0.6719025529242287","Betweenness Centrality":"0.0033630652398584098","Appearances":"31","No":"22","Country":"Argentina","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"31.0","Modularity Class":"19","Date of birth / Age":"3 May 1985 (aged 29)","Degree":"31","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3173575129533679"},"color":"rgb(67,229,229)","size":22.0},{"label":"Mats Hummels","x":607.8975219726562,"y":-421.7085876464844,"id":"475","attributes":{"Eigenvector Centrality":"0.500680986024227","Betweenness Centrality":"0.008472576600609625","Appearances":"30","No":"5","Country":"Germany","Club Country":"Germany","Club":"Borussia Dortmund","Weighted Degree":"24.0","Modularity Class":"13","Date of birth / Age":"16 December 1988 (aged 25)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.310126582278481"},"color":"rgb(67,229,164)","size":12.666666984558105},{"label":"Lee Keun-ho","x":1296.3543701171875,"y":1607.599609375,"id":"413","attributes":{"Eigenvector Centrality":"0.23152559498868786","Betweenness Centrality":"0.0","Appearances":"63","No":"11","Country":"South Korea","Club Country":"South Korea","Club":"Sangju Sangmu","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"11 April 1985 (aged 29)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Giovanni Sio","x":405.2397155761719,"y":-662.28076171875,"id":"257","attributes":{"Eigenvector Centrality":"0.37146876286160685","Betweenness Centrality":"0.004611725554141086","Appearances":"7","No":"21","Country":"Ivory Coast","Club Country":"Switzerland","Club":"Basel","Weighted Degree":"26.0","Modularity Class":"9","Date of birth / Age":"31 March 1989 (aged 25)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(164,67,229)","size":15.333333969116211},{"label":"Yuri Lodygin","x":-1301.04150390625,"y":-1265.7510986328125,"id":"732","attributes":{"Eigenvector Centrality":"0.34982465542448254","Betweenness Centrality":"0.004583905120882726","Appearances":"3","No":"12","Country":"Russia","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"26.0","Modularity Class":"2","Date of birth / Age":"26 May 1990 (aged 24)","Degree":"26","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.27904328018223234"},"color":"rgb(229,67,67)","size":15.333333969116211},{"label":"Sol Bamba","x":570.6759033203125,"y":-908.820556640625,"id":"657","attributes":{"Eigenvector Centrality":"0.30966117600400694","Betweenness Centrality":"0.0","Appearances":"43","No":"22","Country":"Ivory Coast","Club Country":"Turkey","Club":"Trabzonspor","Weighted Degree":"22.0","Modularity Class":"9","Date of birth / Age":"13 January 1985 (aged 29)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2929453965723396"},"color":"rgb(164,67,229)","size":10.0},{"label":"Aïssa Mandi","x":-1380.8287353515625,"y":1169.2930908203125,"id":"15","attributes":{"Eigenvector Centrality":"0.2958935568628798","Betweenness Centrality":"0.0","Appearances":"2","No":"20","Country":"Algeria","Club Country":"France","Club":"Reims","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"22 October 1991 (aged 22)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Ognjen Vukojevic","x":-265.94671630859375,"y":620.2861938476562,"id":"539","attributes":{"Eigenvector Centrality":"0.37500667699203727","Betweenness Centrality":"0.0014678886642237275","Appearances":"55","No":"8","Country":"Croatia","Club Country":"Ukraine","Club":"Dynamo Kyiv","Weighted Degree":"24.0","Modularity Class":"25","Date of birth / Age":"20 December 1983 (aged 30)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31450577663671375"},"color":"rgb(132,67,229)","size":12.666666984558105},{"label":"Lucas Digne","x":-18.41677474975586,"y":-111.03685760498047,"id":"425","attributes":{"Eigenvector Centrality":"0.6370473545952836","Betweenness Centrality":"0.001865102966313942","Appearances":"2","No":"17","Country":"France","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"29.0","Modularity Class":"16","Date of birth / Age":"20 July 1993 (aged 20)","Degree":"29","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(229,67,229)","size":19.333332061767578},{"label":"Christian Noboa","x":-1672.23583984375,"y":-885.3366088867188,"id":"120","attributes":{"Eigenvector Centrality":"0.4300722628882676","Betweenness Centrality":"0.01081726782351466","Appearances":"42","No":"6","Country":"Ecuador","Club Country":"Russia","Club":"Dynamo Moscow","Weighted Degree":"28.0","Modularity Class":"4","Date of birth / Age":"9 April 1985 (aged 29)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.29317909852413243"},"color":"rgb(229,67,132)","size":18.0},{"label":"Koo Ja-cheol (c)","x":1210.030029296875,"y":1383.635498046875,"id":"399","attributes":{"Eigenvector Centrality":"0.2716656711357499","Betweenness Centrality":"0.007710065459146181","Appearances":"37","No":"13","Country":"South Korea","Club Country":"Germany","Club":"Mainz 05","Weighted Degree":"25.0","Modularity Class":"10","Date of birth / Age":"27 February 1989 (aged 25)","Degree":"25","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.28846153846153844"},"color":"rgb(229,67,164)","size":14.0},{"label":"Adnan Januzaj","x":-638.5029907226562,"y":-663.0790405273438,"id":"8","attributes":{"Eigenvector Centrality":"0.8465738555476343","Betweenness Centrality":"0.005671820760248386","Appearances":"1","No":"20","Country":"Belgium","Club Country":"England","Club":"Manchester United","Weighted Degree":"34.0","Modularity Class":"28","Date of birth / Age":"5 February 1995 (aged 19)","Degree":"34","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3554158607350097"},"color":"rgb(67,229,132)","size":26.0},{"label":"Rúben Amorim","x":-743.581787109375,"y":322.57769775390625,"id":"618","attributes":{"Eigenvector Centrality":"0.4623139362600413","Betweenness Centrality":"0.0011159545915913598","Appearances":"13","No":"20","Country":"Portugal","Club Country":"Portugal","Club":"Benfica","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"27 January 1985 (aged 29)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31722054380664655"},"color":"rgb(229,164,67)","size":14.0},{"label":"Daniel Van Buyten","x":-361.6231994628906,"y":-626.7444458007812,"id":"140","attributes":{"Eigenvector Centrality":"0.835724321534549","Betweenness Centrality":"0.008695741941330284","Appearances":"79","No":"15","Country":"Belgium","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"35.0","Modularity Class":"28","Date of birth / Age":"7 February 1978 (aged 36)","Degree":"35","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.35627726611730487"},"color":"rgb(67,229,132)","size":27.33333396911621},{"label":"Cristian Gamboa","x":2154.08251953125,"y":199.01004028320312,"id":"128","attributes":{"Eigenvector Centrality":"0.24626357410920513","Betweenness Centrality":"0.004369178047589387","Appearances":"25","No":"16","Country":"Costa Rica","Club Country":"Norway","Club":"Rosenborg","Weighted Degree":"23.0","Modularity Class":"29","Date of birth / Age":"24 October 1989 (aged 24)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.26717557251908397"},"color":"rgb(229,229,67)","size":11.333333015441895},{"label":"Luiz Gustavo","x":-456.71649169921875,"y":-142.21359252929688,"id":"431","attributes":{"Eigenvector Centrality":"0.6500423521794667","Betweenness Centrality":"0.002644490835880301","Appearances":"19","No":"17","Country":"Brazil","Club Country":"Germany","Club":"VfL Wolfsburg","Weighted Degree":"28.0","Modularity Class":"23","Date of birth / Age":"23 July 1987 (aged 26)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33242876526458615"},"color":"rgb(229,67,197)","size":18.0},{"label":"Haris Seferovic","x":141.21534729003906,"y":262.27655029296875,"id":"271","attributes":{"Eigenvector Centrality":"0.4282958634195428","Betweenness Centrality":"0.006035628087924649","Appearances":"11","No":"9","Country":"Switzerland","Club Country":"Spain","Club":"Real Sociedad","Weighted Degree":"25.0","Modularity Class":"0","Date of birth / Age":"22 February 1992 (aged 22)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.317083692838654"},"color":"rgb(164,229,67)","size":14.0},{"label":"Bruno Martins Indi","x":870.9440307617188,"y":71.02484130859375,"id":"94","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"16","No":"4","Country":"Netherlands","Club Country":"Netherlands","Club":"Feyenoord","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"8 February 1992 (aged 22)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"Harrison Afful","x":468.0885314941406,"y":1387.692626953125,"id":"272","attributes":{"Eigenvector Centrality":"0.2902743690727881","Betweenness Centrality":"0.0","Appearances":"41","No":"23","Country":"Ghana","Club Country":"Tunisia","Club":"Espérance","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"24 June 1986 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Pedro","x":-1064.4056396484375,"y":-381.1362609863281,"id":"569","attributes":{"Eigenvector Centrality":"0.9370904429273632","Betweenness Centrality":"0.0017384725186443504","Appearances":"40","No":"11","Country":"Spain","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"28 July 1987 (aged 26)","Degree":"31","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(229,67,197)","size":22.0},{"label":"Marcos Rojo","x":-1169.275390625,"y":359.34051513671875,"id":"450","attributes":{"Eigenvector Centrality":"0.5206596128107512","Betweenness Centrality":"0.0012988089193429497","Appearances":"22","No":"16","Country":"Argentina","Club Country":"Portugal","Club":"Sporting CP","Weighted Degree":"25.0","Modularity Class":"19","Date of birth / Age":"20 March 1990 (aged 24)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31038851351351354"},"color":"rgb(67,229,229)","size":14.0},{"label":"Rony Martínez","x":1436.8521728515625,"y":-978.241455078125,"id":"615","attributes":{"Eigenvector Centrality":"0.2843426001461682","Betweenness Centrality":"0.011544965385101183","Appearances":"12","No":"16","Country":"Honduras","Club Country":"Honduras","Club":"Real Sociedad","Weighted Degree":"25.0","Modularity Class":"7","Date of birth / Age":"16 October 1988 (aged 25)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2986590816741162"},"color":"rgb(100,67,229)","size":14.0},{"label":"Marcelo","x":-546.0523071289062,"y":-181.72265625,"id":"443","attributes":{"Eigenvector Centrality":"0.8244385370187147","Betweenness Centrality":"0.002939462204472773","Appearances":"31","No":"6","Country":"Brazil","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"33.0","Modularity Class":"23","Date of birth / Age":"12 May 1988 (aged 26)","Degree":"33","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3394919168591224"},"color":"rgb(229,67,197)","size":24.666667938232422},{"label":"Lukas Podolski","x":202.08969116210938,"y":-446.2755126953125,"id":"433","attributes":{"Eigenvector Centrality":"0.6437896004097903","Betweenness Centrality":"0.002673471053911242","Appearances":"114","No":"10","Country":"Germany","Club Country":"England","Club":"Arsenal","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"4 June 1985 (aged 29)","Degree":"29","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3219448094612352"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Diego Lugano (c)","x":-32.81373596191406,"y":-13.45755386352539,"id":"167","attributes":{"Eigenvector Centrality":"0.3938483696056438","Betweenness Centrality":"5.998164097045359E-4","Appearances":"94","No":"2","Country":"Uruguay","Club Country":"England","Club":"West Bromwich Albion","Weighted Degree":"23.0","Modularity Class":"6","Date of birth / Age":"2 November 1980 (aged 33)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31831961888263316"},"color":"rgb(229,197,67)","size":11.333333015441895},{"label":"Bryan Ruiz (c)","x":2006.2958984375,"y":332.363525390625,"id":"95","attributes":{"Eigenvector Centrality":"0.27578394718697025","Betweenness Centrality":"0.017798712465968473","Appearances":"63","No":"10","Country":"Costa Rica","Club Country":"Netherlands","Club":"PSV","Weighted Degree":"25.0","Modularity Class":"29","Date of birth / Age":"18 August 1985 (aged 28)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2892561983471074"},"color":"rgb(229,229,67)","size":14.0},{"label":"Jerry Palacios","x":1713.39697265625,"y":-1049.36083984375,"id":"329","attributes":{"Eigenvector Centrality":"0.2572578722910379","Betweenness Centrality":"0.007827260909354134","Appearances":"24","No":"9","Country":"Honduras","Club Country":"Costa Rica","Club":"Alajuelense","Weighted Degree":"24.0","Modularity Class":"7","Date of birth / Age":"1 November 1981 (aged 32)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2768361581920904"},"color":"rgb(100,67,229)","size":12.666666984558105},{"label":"Emilio Izaguirre","x":1455.924072265625,"y":-1104.433837890625,"id":"197","attributes":{"Eigenvector Centrality":"0.2813611118856367","Betweenness Centrality":"0.011679703221250124","Appearances":"68","No":"7","Country":"Honduras","Club Country":"Scotland","Club":"Celtic","Weighted Degree":"25.0","Modularity Class":"7","Date of birth / Age":"10 May 1986 (aged 28)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2968497576736672"},"color":"rgb(100,67,229)","size":14.0},{"label":"Nicolás Lodeiro","x":-54.9222297668457,"y":16.616008758544922,"id":"531","attributes":{"Eigenvector Centrality":"0.37564528732258246","Betweenness Centrality":"0.0","Appearances":"26","No":"14","Country":"Uruguay","Club Country":"Brazil","Club":"Corinthians","Weighted Degree":"22.0","Modularity Class":"6","Date of birth / Age":"21 March 1989 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3121019108280255"},"color":"rgb(229,197,67)","size":10.0},{"label":"Raphaël Varane","x":-176.20541381835938,"y":-169.9130401611328,"id":"589","attributes":{"Eigenvector Centrality":"0.742488542981204","Betweenness Centrality":"0.0035273454232103265","Appearances":"6","No":"4","Country":"France","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"32.0","Modularity Class":"16","Date of birth / Age":"25 April 1993 (aged 21)","Degree":"32","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.33576975788031066"},"color":"rgb(229,67,229)","size":23.33333396911621},{"label":"Mattia Perin","x":272.2126770019531,"y":763.703857421875,"id":"482","attributes":{"Eigenvector Centrality":"0.44532305932946153","Betweenness Centrality":"0.0034549672499168743","Appearances":"0","No":"13","Country":"Italy","Club Country":"Italy","Club":"Genoa","Weighted Degree":"24.0","Modularity Class":"3","Date of birth / Age":"10 November 1992 (aged 21)","Degree":"24","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.31183708103521424"},"color":"rgb(197,229,67)","size":12.666666984558105},{"label":"Šime Vrsaljko","x":-183.1659393310547,"y":697.4119873046875,"id":"653","attributes":{"Eigenvector Centrality":"0.3720817713091997","Betweenness Centrality":"0.0039034450268718027","Appearances":"7","No":"2","Country":"Croatia","Club Country":"Italy","Club":"Genoa","Weighted Degree":"24.0","Modularity Class":"25","Date of birth / Age":"10 January 1992 (aged 22)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(132,67,229)","size":12.666666984558105},{"label":"Paulinho","x":-575.74462890625,"y":-298.09417724609375,"id":"567","attributes":{"Eigenvector Centrality":"0.6368676039157191","Betweenness Centrality":"0.002227988166518949","Appearances":"26","No":"8","Country":"Brazil","Club Country":"England","Club":"Tottenham Hotspur","Weighted Degree":"27.0","Modularity Class":"23","Date of birth / Age":"25 July 1988 (aged 25)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3327297419646899"},"color":"rgb(229,67,197)","size":16.666667938232422},{"label":"Medhi Lacen","x":-1321.0677490234375,"y":1173.3302001953125,"id":"493","attributes":{"Eigenvector Centrality":"0.30926248352056784","Betweenness Centrality":"0.0011823348492373809","Appearances":"30","No":"8","Country":"Algeria","Club Country":"Spain","Club":"Getafe","Weighted Degree":"23.0","Modularity Class":"24","Date of birth / Age":"15 May 1984 (aged 30)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2950622240064231"},"color":"rgb(67,164,229)","size":11.333333015441895},{"label":"Ahmed Musa","x":-341.6416320800781,"y":-1640.5048828125,"id":"14","attributes":{"Eigenvector Centrality":"0.36203263260642976","Betweenness Centrality":"0.009769556368358679","Appearances":"35","No":"7","Country":"Nigeria","Club Country":"Russia","Club":"CSKA Moscow","Weighted Degree":"27.0","Modularity Class":"14","Date of birth / Age":"14 October 1992 (aged 21)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2930622009569378"},"color":"rgb(67,229,100)","size":16.666667938232422},{"label":"Max Gradel","x":486.3621826171875,"y":-849.3237915039062,"id":"485","attributes":{"Eigenvector Centrality":"0.32737398677050034","Betweenness Centrality":"5.067313329973086E-4","Appearances":"26","No":"15","Country":"Ivory Coast","Club Country":"France","Club":"Saint-Étienne","Weighted Degree":"23.0","Modularity Class":"9","Date of birth / Age":"30 November 1987 (aged 26)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30548628428927677"},"color":"rgb(164,67,229)","size":11.333333015441895},{"label":"Yoichiro Kakitani","x":646.9409790039062,"y":622.2392578125,"id":"729","attributes":{"Eigenvector Centrality":"0.33192039229134085","Betweenness Centrality":"0.0010231003820519223","Appearances":"12","No":"11","Country":"Japan","Club Country":"Japan","Club":"Cerezo Osaka","Weighted Degree":"23.0","Modularity Class":"27","Date of birth / Age":"3 January 1990 (aged 24)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3190104166666667"},"color":"rgb(67,100,229)","size":11.333333015441895},{"label":"Jefferson","x":-426.4915771484375,"y":-267.5847473144531,"id":"323","attributes":{"Eigenvector Centrality":"0.5425650576268322","Betweenness Centrality":"0.0","Appearances":"9","No":"1","Country":"Brazil","Club Country":"Brazil","Club":"Botafogo","Weighted Degree":"22.0","Modularity Class":"23","Date of birth / Age":"2 January 1983 (aged 31)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3158573270305114"},"color":"rgb(229,67,197)","size":10.0},{"label":"Reuben Gabriel","x":-132.04296875,"y":-1684.207275390625,"id":"597","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"11","No":"4","Country":"Nigeria","Club Country":"Belgium","Club":"Waasland-Beveren","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"25 September 1990 (aged 23)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Adam Kwarasey","x":427.3985290527344,"y":1398.171875,"id":"4","attributes":{"Eigenvector Centrality":"0.2902743690727881","Betweenness Centrality":"0.0","Appearances":"21","No":"12","Country":"Ghana","Club Country":"Norway","Club":"Strømsgodset","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"12 December 1987 (aged 26)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Sergio Busquets","x":-999.5798950195312,"y":-234.14259338378906,"id":"643","attributes":{"Eigenvector Centrality":"0.9370904429273632","Betweenness Centrality":"0.0017384725186443504","Appearances":"65","No":"16","Country":"Spain","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"16 July 1988 (aged 25)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(229,67,197)","size":22.0},{"label":"James Milner","x":-219.63795471191406,"y":-778.5797119140625,"id":"308","attributes":{"Eigenvector Centrality":"0.7015324384017535","Betweenness Centrality":"0.003652191896387035","Appearances":"47","No":"17","Country":"England","Club Country":"England","Club":"Manchester City","Weighted Degree":"30.0","Modularity Class":"28","Date of birth / Age":"4 January 1986 (aged 28)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3316787003610108"},"color":"rgb(67,229,132)","size":20.666667938232422},{"label":"Kyle Beckerman","x":814.4154052734375,"y":-1616.4197998046875,"id":"406","attributes":{"Eigenvector Centrality":"0.2718151842935107","Betweenness Centrality":"0.0","Appearances":"37","No":"15","Country":"United States","Club Country":"United States","Club":"Real Salt Lake","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"23 April 1982 (aged 32)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Charles Itandje","x":514.8746337890625,"y":203.30963134765625,"id":"113","attributes":{"Eigenvector Centrality":"0.3337787545251496","Betweenness Centrality":"0.0034398247134625596","Appearances":"9","No":"16","Country":"Cameroon","Club Country":"Turkey","Club":"Konyaspor","Weighted Degree":"23.0","Modularity Class":"17","Date of birth / Age":"2 November 1982 (aged 31)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(67,132,229)","size":11.333333015441895},{"label":"Javad Nekounam (c)","x":1956.9619140625,"y":1077.9049072265625,"id":"315","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"140","No":"6","Country":"Iran","Club Country":"Kuwait","Club":"Al-Kuwait","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"7 October 1980 (aged 33)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Oleg Shatov","x":-1223.315185546875,"y":-1368.6673583984375,"id":"540","attributes":{"Eigenvector Centrality":"0.34982465542448277","Betweenness Centrality":"0.004583905120882726","Appearances":"7","No":"17","Country":"Russia","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"26.0","Modularity Class":"2","Date of birth / Age":"29 July 1990 (aged 23)","Degree":"26","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.27904328018223234"},"color":"rgb(229,67,67)","size":15.333333969116211},{"label":"Park Joo-ho","x":1252.9921875,"y":1424.8128662109375,"id":"561","attributes":{"Eigenvector Centrality":"0.2716656711357499","Betweenness Centrality":"0.007710065459146181","Appearances":"14","No":"22","Country":"South Korea","Club Country":"Germany","Club":"Mainz 05","Weighted Degree":"25.0","Modularity Class":"10","Date of birth / Age":"16 January 1987 (aged 27)","Degree":"25","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.28846153846153844"},"color":"rgb(229,67,164)","size":14.0},{"label":"James Troisi","x":2041.552490234375,"y":-703.1470336914062,"id":"310","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"11","No":"14","Country":"Australia","Club Country":"Australia","Club":"Melbourne Victory","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"3 July 1988 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"José Holebas","x":1657.004638671875,"y":513.2495727539062,"id":"356","attributes":{"Eigenvector Centrality":"0.269759009750252","Betweenness Centrality":"0.0018881692306353887","Appearances":"22","No":"20","Country":"Greece","Club Country":"Greece","Club":"Olympiacos","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"27 June 1984 (aged 29)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2878965922444183"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Cristián Zapata","x":-503.78399658203125,"y":1159.0504150390625,"id":"130","attributes":{"Eigenvector Centrality":"0.43182337544263927","Betweenness Centrality":"0.007566531908575593","Appearances":"24","No":"2","Country":"Colombia","Club Country":"Italy","Club":"Milan","Weighted Degree":"29.0","Modularity Class":"11","Date of birth / Age":"30 September 1986 (aged 27)","Degree":"29","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.32054077627562144"},"color":"rgb(67,67,229)","size":19.333332061767578},{"label":"José María Giménez","x":-198.00405883789062,"y":-82.70488739013672,"id":"359","attributes":{"Eigenvector Centrality":"0.5243629945948548","Betweenness Centrality":"0.0015151368839237088","Appearances":"6","No":"13","Country":"Uruguay","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"28.0","Modularity Class":"6","Date of birth / Age":"20 January 1995 (aged 19)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3236459709379128"},"color":"rgb(229,197,67)","size":18.0},{"label":"Brayan Beckeles","x":1616.7569580078125,"y":-1172.5592041015625,"id":"92","attributes":{"Eigenvector Centrality":"0.23664887946331797","Betweenness Centrality":"0.0","Appearances":"23","No":"21","Country":"Honduras","Club Country":"Honduras","Club":"Olimpia","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"28 November 1985 (aged 28)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Cheick Tioté","x":389.42742919921875,"y":-827.5474853515625,"id":"114","attributes":{"Eigenvector Centrality":"0.3955908250789612","Betweenness Centrality":"0.0038844035920882927","Appearances":"43","No":"9","Country":"Ivory Coast","Club Country":"England","Club":"Newcastle United","Weighted Degree":"27.0","Modularity Class":"9","Date of birth / Age":"21 June 1986 (aged 27)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3215223097112861"},"color":"rgb(164,67,229)","size":16.666667938232422},{"label":"Bakhtiar Rahmani","x":2063.09375,"y":1033.573974609375,"id":"78","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"4","No":"18","Country":"Iran","Club Country":"Iran","Club":"Foolad","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"23 September 1991 (aged 22)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Lucas Biglia","x":-845.6185913085938,"y":161.40000915527344,"id":"424","attributes":{"Eigenvector Centrality":"0.5820067449262724","Betweenness Centrality":"0.006925465581949424","Appearances":"18","No":"6","Country":"Argentina","Club Country":"Italy","Club":"Lazio","Weighted Degree":"28.0","Modularity Class":"19","Date of birth / Age":"30 January 1986 (aged 28)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3346994535519126"},"color":"rgb(67,229,229)","size":18.0},{"label":"Ben Halloran","x":1954.241943359375,"y":-623.5980834960938,"id":"81","attributes":{"Eigenvector Centrality":"0.23369288429660703","Betweenness Centrality":"0.013237904694991245","Appearances":"2","No":"10","Country":"Australia","Club Country":"Germany","Club":"Fortuna Düsseldorf","Weighted Degree":"23.0","Modularity Class":"12","Date of birth / Age":"14 June 1992 (aged 21)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.25008506294658045"},"color":"rgb(229,100,67)","size":11.333333015441895},{"label":"Vladimir Granat","x":-1378.149658203125,"y":-1417.718994140625,"id":"708","attributes":{"Eigenvector Centrality":"0.2816622746350613","Betweenness Centrality":"6.368705012250895E-4","Appearances":"5","No":"13","Country":"Russia","Club Country":"Russia","Club":"Dynamo Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"22 May 1987 (aged 27)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.25538568450312715"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Loukas Vyntra","x":1712.4525146484375,"y":526.8307495117188,"id":"423","attributes":{"Eigenvector Centrality":"0.2684383531644051","Betweenness Centrality":"0.0025456380080491328","Appearances":"50","No":"11","Country":"Greece","Club Country":"Spain","Club":"Levante","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"5 February 1981 (aged 33)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2878965922444183"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Mark Milligan","x":2173.81640625,"y":-588.3220825195312,"id":"459","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"29","No":"5","Country":"Australia","Club Country":"Australia","Club":"Melbourne Victory","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"4 August 1985 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Ermin Bicakcic","x":1292.2596435546875,"y":-362.4537353515625,"id":"204","attributes":{"Eigenvector Centrality":"0.2936293974441563","Betweenness Centrality":"0.03700993584936544","Appearances":"7","No":"3","Country":"Bosnia and Herzegovina","Club Country":"Germany","Club":"Eintracht Braunschweig","Weighted Degree":"23.0","Modularity Class":"20","Date of birth / Age":"24 January 1990 (aged 24)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(132,229,67)","size":11.333333015441895},{"label":"Wilfried Bony","x":607.7100219726562,"y":-803.1463012695312,"id":"715","attributes":{"Eigenvector Centrality":"0.3359593705908816","Betweenness Centrality":"0.0021532541982020393","Appearances":"24","No":"12","Country":"Ivory Coast","Club Country":"Wales","Club":"Swansea City","Weighted Degree":"24.0","Modularity Class":"9","Date of birth / Age":"10 December 1988 (aged 25)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(164,67,229)","size":12.666666984558105},{"label":"Hélder Postiga","x":-469.88958740234375,"y":192.2259979248047,"id":"277","attributes":{"Eigenvector Centrality":"0.5176962646733128","Betweenness Centrality":"0.009650096557354645","Appearances":"69","No":"23","Country":"Portugal","Club Country":"Italy","Club":"Lazio","Weighted Degree":"28.0","Modularity Class":"8","Date of birth / Age":"2 August 1982 (aged 31)","Degree":"28","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3437792329279701"},"color":"rgb(229,164,67)","size":18.0},{"label":"Jorge Valdivia","x":-250.01519775390625,"y":1428.5059814453125,"id":"354","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"57","No":"10","Country":"Chile","Club Country":"Brazil","Club":"Palmeiras","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"3 October 1983 (aged 30)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Beto","x":-614.7037963867188,"y":392.89617919921875,"id":"86","attributes":{"Eigenvector Centrality":"0.45178798123360137","Betweenness Centrality":"0.00215629425092769","Appearances":"7","No":"22","Country":"Portugal","Club Country":"Spain","Club":"Sevilla","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"1 May 1982 (aged 32)","Degree":"25","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3278322925958965"},"color":"rgb(229,164,67)","size":14.0},{"label":"Cesc Fàbregas","x":-1070.073486328125,"y":-271.4660339355469,"id":"111","attributes":{"Eigenvector Centrality":"0.9370904429273634","Betweenness Centrality":"0.0017384725186443504","Appearances":"89","No":"10","Country":"Spain","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"4 May 1987 (aged 27)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(229,67,197)","size":22.0},{"label":"Josip Drmic","x":179.95460510253906,"y":206.55291748046875,"id":"364","attributes":{"Eigenvector Centrality":"0.42346070544921693","Betweenness Centrality":"0.005301782677055976","Appearances":"7","No":"19","Country":"Switzerland","Club Country":"Germany","Club":"1. FC Nürnberg","Weighted Degree":"25.0","Modularity Class":"0","Date of birth / Age":"8 August 1992 (aged 21)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3111769686706181"},"color":"rgb(164,229,67)","size":14.0},{"label":"André Ayew","x":486.661865234375,"y":1226.37353515625,"id":"43","attributes":{"Eigenvector Centrality":"0.32139173401751836","Betweenness Centrality":"0.003044413609568673","Appearances":"49","No":"10","Country":"Ghana","Club Country":"France","Club":"Marseille","Weighted Degree":"24.0","Modularity Class":"5","Date of birth / Age":"17 December 1989 (aged 24)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31025749261291685"},"color":"rgb(67,229,197)","size":12.666666984558105},{"label":"Stéphane Mbia","x":284.8869934082031,"y":226.59521484375,"id":"662","attributes":{"Eigenvector Centrality":"0.36731258194731503","Betweenness Centrality":"0.006208857054612341","Appearances":"49","No":"17","Country":"Cameroon","Club Country":"Spain","Club":"Sevilla","Weighted Degree":"25.0","Modularity Class":"17","Date of birth / Age":"20 May 1986 (aged 28)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33182844243792325"},"color":"rgb(67,132,229)","size":14.0},{"label":"Michael Babatunde","x":-143.01881408691406,"y":-1634.2734375,"id":"500","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"5","No":"18","Country":"Nigeria","Club Country":"Ukraine","Club":"Volyn Lutsk","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"24 December 1992 (aged 21)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Peter Odemwingie","x":110.87254333496094,"y":-1595.626953125,"id":"574","attributes":{"Eigenvector Centrality":"0.3422176819910441","Betweenness Centrality":"0.008219781078795195","Appearances":"61","No":"8","Country":"Nigeria","Club Country":"England","Club":"Stoke City","Weighted Degree":"25.0","Modularity Class":"14","Date of birth / Age":"15 July 1981 (aged 32)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.315450643776824"},"color":"rgb(67,229,100)","size":14.0},{"label":"Aron Jóhannsson","x":819.320068359375,"y":-1520.021240234375,"id":"62","attributes":{"Eigenvector Centrality":"0.27181518429351065","Betweenness Centrality":"0.0","Appearances":"8","No":"9","Country":"United States","Club Country":"Netherlands","Club":"AZ","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"10 November 1990 (aged 23)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Gianluigi Buffon (c)","x":152.25355529785156,"y":824.187744140625,"id":"249","attributes":{"Eigenvector Centrality":"0.5455496050511397","Betweenness Centrality":"0.0016215443882875223","Appearances":"140","No":"1","Country":"Italy","Club Country":"Italy","Club":"Juventus","Weighted Degree":"28.0","Modularity Class":"3","Date of birth / Age":"28 January 1978 (aged 36)","Degree":"28","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(197,229,67)","size":18.0},{"label":"Leighton Baines","x":-237.56211853027344,"y":-998.0780029296875,"id":"415","attributes":{"Eigenvector Centrality":"0.5738583419916762","Betweenness Centrality":"0.0013664563333722465","Appearances":"24","No":"3","Country":"England","Club Country":"England","Club":"Everton","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"11 December 1984 (aged 29)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31183708103521424"},"color":"rgb(67,229,132)","size":14.0},{"label":"Mathis Bolly","x":651.6246337890625,"y":-893.9707641601562,"id":"474","attributes":{"Eigenvector Centrality":"0.3195851154336105","Betweenness Centrality":"0.014729679390309034","Appearances":"4","No":"6","Country":"Ivory Coast","Club Country":"Germany","Club":"Fortuna Düsseldorf","Weighted Degree":"23.0","Modularity Class":"9","Date of birth / Age":"14 November 1990 (aged 23)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2979327117957033"},"color":"rgb(164,67,229)","size":11.333333015441895},{"label":"Fidel Martínez","x":-1762.245361328125,"y":-617.6648559570312,"id":"228","attributes":{"Eigenvector Centrality":"0.3623062182068215","Betweenness Centrality":"0.0","Appearances":"8","No":"20","Country":"Ecuador","Club Country":"Mexico","Club":"Tijuana","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"15 February 1990 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Bernard","x":-458.79998779296875,"y":-206.65052795410156,"id":"85","attributes":{"Eigenvector Centrality":"0.5696754174200716","Betweenness Centrality":"0.0013333964544832435","Appearances":"11","No":"20","Country":"Brazil","Club Country":"Ukraine","Club":"Shakhtar Donetsk","Weighted Degree":"24.0","Modularity Class":"23","Date of birth / Age":"8 September 1992 (aged 21)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3202614379084967"},"color":"rgb(229,67,197)","size":12.666666984558105},{"label":"Michael Essien","x":376.83282470703125,"y":1298.3724365234375,"id":"503","attributes":{"Eigenvector Centrality":"0.3941490291913924","Betweenness Centrality":"0.004358888803155806","Appearances":"57","No":"5","Country":"Ghana","Club Country":"Italy","Club":"Milan","Weighted Degree":"28.0","Modularity Class":"5","Date of birth / Age":"3 December 1982 (aged 31)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31223449447748514"},"color":"rgb(67,229,197)","size":18.0},{"label":"Luis Garrido","x":1665.724609375,"y":-1263.9407958984375,"id":"426","attributes":{"Eigenvector Centrality":"0.23664887946331803","Betweenness Centrality":"0.0","Appearances":"20","No":"19","Country":"Honduras","Club Country":"Honduras","Club":"Olimpia","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"5 November 1990 (aged 23)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"David Myrie","x":2254.470947265625,"y":256.6007080078125,"id":"152","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"10","No":"8","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Herediano","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"1 June 1988 (aged 26)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Anthony Vanden Borre","x":-577.663330078125,"y":-888.8426513671875,"id":"56","attributes":{"Eigenvector Centrality":"0.532050214639082","Betweenness Centrality":"0.006584182583039559","Appearances":"25","No":"21","Country":"Belgium","Club Country":"Belgium","Club":"Anderlecht","Weighted Degree":"23.0","Modularity Class":"28","Date of birth / Age":"24 October 1987 (aged 26)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3321283325802079"},"color":"rgb(67,229,132)","size":11.333333015441895},{"label":"Jasper Cillessen","x":884.7673950195312,"y":31.96728515625,"id":"314","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"8","No":"1","Country":"Netherlands","Club Country":"Netherlands","Club":"Ajax","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"22 April 1989 (aged 25)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"Fraser Forster","x":12.960638999938965,"y":-928.6837768554688,"id":"232","attributes":{"Eigenvector Centrality":"0.5560882486054125","Betweenness Centrality":"0.010448734894018583","Appearances":"2","No":"22","Country":"England","Club Country":"Scotland","Club":"Celtic","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"17 March 1988 (aged 26)","Degree":"25","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3197042192257503"},"color":"rgb(67,229,132)","size":14.0},{"label":"Andrés Iniesta","x":-1067.9244384765625,"y":-187.44284057617188,"id":"50","attributes":{"Eigenvector Centrality":"0.9370904429273634","Betweenness Centrality":"0.0017384725186443504","Appearances":"97","No":"6","Country":"Spain","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"11 May 1984 (aged 30)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(229,67,197)","size":22.0},{"label":"Santi Cazorla","x":-670.4064331054688,"y":-383.8587951660156,"id":"629","attributes":{"Eigenvector Centrality":"0.8894294715329176","Betweenness Centrality":"0.002430245927643242","Appearances":"64","No":"20","Country":"Spain","Club Country":"England","Club":"Arsenal","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"13 December 1984 (aged 29)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3287119856887299"},"color":"rgb(229,67,197)","size":22.0},{"label":"Henri Bedimo","x":380.5469665527344,"y":174.65756225585938,"id":"278","attributes":{"Eigenvector Centrality":"0.3227718779440803","Betweenness Centrality":"0.0","Appearances":"31","No":"12","Country":"Cameroon","Club Country":"France","Club":"Lyon","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"4 June 1984 (aged 30)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"Koke","x":-921.220947265625,"y":-304.28424072265625,"id":"397","attributes":{"Eigenvector Centrality":"0.7852248920099726","Betweenness Centrality":"7.220203040676876E-4","Appearances":"8","No":"17","Country":"Spain","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"27.0","Modularity Class":"23","Date of birth / Age":"8 January 1992 (aged 22)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3215223097112861"},"color":"rgb(229,67,197)","size":16.666667938232422},{"label":"Vedran Corluka","x":-415.46148681640625,"y":539.5565185546875,"id":"698","attributes":{"Eigenvector Centrality":"0.35564443225400655","Betweenness Centrality":"0.004616126670181397","Appearances":"72","No":"5","Country":"Croatia","Club Country":"Russia","Club":"Lokomotiv Moscow","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"5 February 1986 (aged 28)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2995110024449878"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Salomon Kalou","x":392.3309326171875,"y":-927.29150390625,"id":"621","attributes":{"Eigenvector Centrality":"0.3612323923614013","Betweenness Centrality":"0.0028479267154006356","Appearances":"67","No":"8","Country":"Ivory Coast","Club Country":"France","Club":"Lille","Weighted Degree":"25.0","Modularity Class":"9","Date of birth / Age":"5 August 1985 (aged 28)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.31722054380664655"},"color":"rgb(164,67,229)","size":14.0},{"label":"Maya Yoshida","x":540.3438720703125,"y":427.262451171875,"id":"491","attributes":{"Eigenvector Centrality":"0.43319192924031613","Betweenness Centrality":"0.006300072262103494","Appearances":"41","No":"22","Country":"Japan","Club Country":"England","Club":"Southampton","Weighted Degree":"28.0","Modularity Class":"27","Date of birth / Age":"24 August 1988 (aged 25)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3331822302810517"},"color":"rgb(67,100,229)","size":18.0},{"label":"Luis López","x":1610.1837158203125,"y":-1129.569091796875,"id":"427","attributes":{"Eigenvector Centrality":"0.23664887946331797","Betweenness Centrality":"0.0","Appearances":"0","No":"1","Country":"Honduras","Club Country":"Honduras","Club":"Real España","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"13 September 1993 (aged 20)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Kolo Touré","x":297.0413513183594,"y":-918.4600830078125,"id":"398","attributes":{"Eigenvector Centrality":"0.5026225442560357","Betweenness Centrality":"0.006800410251941604","Appearances":"107","No":"4","Country":"Ivory Coast","Club Country":"England","Club":"Liverpool","Weighted Degree":"31.0","Modularity Class":"9","Date of birth / Age":"19 March 1981 (aged 33)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3237885462555066"},"color":"rgb(164,67,229)","size":22.0},{"label":"Fernando Gago","x":-1147.2889404296875,"y":214.82017517089844,"id":"225","attributes":{"Eigenvector Centrality":"0.4756507714516442","Betweenness Centrality":"0.0","Appearances":"49","No":"5","Country":"Argentina","Club Country":"Argentina","Club":"Boca Juniors","Weighted Degree":"22.0","Modularity Class":"19","Date of birth / Age":"10 April 1986 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2930622009569378"},"color":"rgb(67,229,229)","size":10.0},{"label":"Juan Guillermo Cuadrado","x":-683.1348266601562,"y":1184.008056640625,"id":"370","attributes":{"Eigenvector Centrality":"0.343991844651082","Betweenness Centrality":"0.0018381218571182874","Appearances":"28","No":"11","Country":"Colombia","Club Country":"Italy","Club":"Fiorentina","Weighted Degree":"24.0","Modularity Class":"11","Date of birth / Age":"26 May 1988 (aged 26)","Degree":"24","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3115727002967359"},"color":"rgb(67,67,229)","size":12.666666984558105},{"label":"Arjen Robben","x":630.8056640625,"y":-143.44236755371094,"id":"61","attributes":{"Eigenvector Centrality":"0.6544203740928541","Betweenness Centrality":"0.013375499273402567","Appearances":"75","No":"11","Country":"Netherlands","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"35.0","Modularity Class":"22","Date of birth / Age":"23 January 1984 (aged 30)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34834123222748814"},"color":"rgb(197,67,229)","size":27.33333396911621},{"label":"Mitchell Langerak","x":1759.883544921875,"y":-484.94677734375,"id":"518","attributes":{"Eigenvector Centrality":"0.30472064669130067","Betweenness Centrality":"0.03540110990626156","Appearances":"3","No":"12","Country":"Australia","Club Country":"Germany","Club":"Borussia Dortmund","Weighted Degree":"27.0","Modularity Class":"12","Date of birth / Age":"22 August 1988 (aged 25)","Degree":"27","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.2609158679446219"},"color":"rgb(229,100,67)","size":16.666667938232422},{"label":"Yohan Cabaye","x":-73.94801330566406,"y":-145.8044891357422,"id":"728","attributes":{"Eigenvector Centrality":"0.6370473545952837","Betweenness Centrality":"0.001865102966313942","Appearances":"30","No":"6","Country":"France","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"29.0","Modularity Class":"16","Date of birth / Age":"14 January 1986 (aged 28)","Degree":"29","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(229,67,229)","size":19.333332061767578},{"label":"Jonathan Mensah","x":461.7189025878906,"y":1342.453125,"id":"346","attributes":{"Eigenvector Centrality":"0.2902743690727881","Betweenness Centrality":"0.0","Appearances":"27","No":"19","Country":"Ghana","Club Country":"France","Club":"Évian","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"13 July 1990 (aged 23)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Cristopher Toselli","x":-291.25885009765625,"y":1453.383056640625,"id":"132","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"4","No":"12","Country":"Chile","Club Country":"Chile","Club":"Universidad Católica","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"22 June 1988 (aged 25)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Claudio Marchisio","x":71.69534301757812,"y":813.5997924804688,"id":"125","attributes":{"Eigenvector Centrality":"0.5455496050511397","Betweenness Centrality":"0.0016215443882875223","Appearances":"44","No":"8","Country":"Italy","Club Country":"Italy","Club":"Juventus","Weighted Degree":"28.0","Modularity Class":"3","Date of birth / Age":"19 January 1986 (aged 28)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(197,229,67)","size":18.0},{"label":"Phil Jones","x":-300.3230285644531,"y":-774.0247192382812,"id":"576","attributes":{"Eigenvector Centrality":"0.7938188270448314","Betweenness Centrality":"0.0038886080479693477","Appearances":"10","No":"16","Country":"England","Club Country":"England","Club":"Manchester United","Weighted Degree":"32.0","Modularity Class":"28","Date of birth / Age":"21 February 1992 (aged 22)","Degree":"32","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3393351800554017"},"color":"rgb(67,229,132)","size":23.33333396911621},{"label":"Jack Wilshere","x":-130.01361083984375,"y":-811.2896728515625,"id":"303","attributes":{"Eigenvector Centrality":"0.7063239842607693","Betweenness Centrality":"0.001711566637513174","Appearances":"18","No":"7","Country":"England","Club Country":"England","Club":"Arsenal","Weighted Degree":"30.0","Modularity Class":"28","Date of birth / Age":"1 January 1992 (aged 22)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3199825859817153"},"color":"rgb(67,229,132)","size":20.666667938232422},{"label":"Stephen Adams","x":502.8428955078125,"y":1418.3192138671875,"id":"664","attributes":{"Eigenvector Centrality":"0.2902743690727881","Betweenness Centrality":"0.0","Appearances":"7","No":"1","Country":"Ghana","Club Country":"Ghana","Club":"Aduana Stars","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"28 September 1989 (aged 24)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Randall Brenes","x":2309.687255859375,"y":299.45452880859375,"id":"588","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"39","No":"14","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Cartaginés","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"13 August 1983 (aged 30)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Darijo Srna (c)","x":-317.2035827636719,"y":580.4688720703125,"id":"147","attributes":{"Eigenvector Centrality":"0.36375321381526937","Betweenness Centrality":"2.8773715502087595E-4","Appearances":"112","No":"11","Country":"Croatia","Club Country":"Ukraine","Club":"Shakhtar Donetsk","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"1 May 1982 (aged 32)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30246913580246915"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Carlos Bacca","x":-687.1920776367188,"y":1106.895751953125,"id":"99","attributes":{"Eigenvector Centrality":"0.3586902689991431","Betweenness Centrality":"0.004048504558302689","Appearances":"11","No":"17","Country":"Colombia","Club Country":"Spain","Club":"Sevilla","Weighted Degree":"25.0","Modularity Class":"11","Date of birth / Age":"8 September 1986 (aged 27)","Degree":"25","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.31928757602085145"},"color":"rgb(67,67,229)","size":14.0},{"label":"Dejan Lovren","x":-235.10853576660156,"y":422.8890686035156,"id":"157","attributes":{"Eigenvector Centrality":"0.45972067931258953","Betweenness Centrality":"0.007199493511865955","Appearances":"25","No":"6","Country":"Croatia","Club Country":"England","Club":"Southampton","Weighted Degree":"28.0","Modularity Class":"25","Date of birth / Age":"5 July 1989 (aged 24)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(132,67,229)","size":18.0},{"label":"Mario Götze","x":301.4177551269531,"y":-338.4355163574219,"id":"454","attributes":{"Eigenvector Centrality":"0.6585766805388434","Betweenness Centrality":"0.0026429368589338613","Appearances":"29","No":"19","Country":"Germany","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"3 June 1992 (aged 22)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3390221402214022"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Danny Welbeck","x":-294.47705078125,"y":-689.566650390625,"id":"144","attributes":{"Eigenvector Centrality":"0.793818827044831","Betweenness Centrality":"0.0038886080479693477","Appearances":"24","No":"11","Country":"England","Club Country":"England","Club":"Manchester United","Weighted Degree":"32.0","Modularity Class":"28","Date of birth / Age":"26 November 1990 (aged 23)","Degree":"32","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3393351800554017"},"color":"rgb(67,229,132)","size":23.33333396911621},{"label":"Óscar Boniek García","x":1554.068359375,"y":-1285.441650390625,"id":"549","attributes":{"Eigenvector Centrality":"0.24794367045748955","Betweenness Centrality":"0.0014579941476906906","Appearances":"92","No":"14","Country":"Honduras","Club Country":"United States","Club":"Houston Dynamo","Weighted Degree":"23.0","Modularity Class":"7","Date of birth / Age":"4 September 1984 (aged 29)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2750748502994012"},"color":"rgb(100,67,229)","size":11.333333015441895},{"label":"Jorge Fucile","x":-342.37835693359375,"y":145.5472869873047,"id":"352","attributes":{"Eigenvector Centrality":"0.5227167128747061","Betweenness Centrality":"0.009620495110563395","Appearances":"42","No":"4","Country":"Uruguay","Club Country":"Portugal","Club":"Porto","Weighted Degree":"30.0","Modularity Class":"6","Date of birth / Age":"19 November 1984 (aged 29)","Degree":"30","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.34154275092936803"},"color":"rgb(229,197,67)","size":20.666667938232422},{"label":"Rickie Lambert","x":-64.72023010253906,"y":-747.4366455078125,"id":"603","attributes":{"Eigenvector Centrality":"0.5904515327423896","Betweenness Centrality":"0.0016054547217210155","Appearances":"6","No":"18","Country":"England","Club Country":"England","Club":"Southampton","Weighted Degree":"26.0","Modularity Class":"28","Date of birth / Age":"16 February 1982 (aged 32)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.32407407407407407"},"color":"rgb(67,229,132)","size":15.333333969116211},{"label":"Ignazio Abate","x":229.4017333984375,"y":946.2020263671875,"id":"291","attributes":{"Eigenvector Centrality":"0.4999140209709583","Betweenness Centrality":"0.003073405743850096","Appearances":"20","No":"7","Country":"Italy","Club Country":"Italy","Club":"Milan","Weighted Degree":"27.0","Modularity Class":"3","Date of birth / Age":"12 November 1986 (aged 27)","Degree":"27","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31928757602085145"},"color":"rgb(197,229,67)","size":16.666667938232422},{"label":"Antoine Griezmann","x":63.922183990478516,"y":-173.6581573486328,"id":"57","attributes":{"Eigenvector Centrality":"0.5246495592217708","Betweenness Centrality":"0.008309679999517289","Appearances":"4","No":"11","Country":"France","Club Country":"Spain","Club":"Real Sociedad","Weighted Degree":"25.0","Modularity Class":"16","Date of birth / Age":"21 March 1991 (aged 23)","Degree":"25","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.32695729537366547"},"color":"rgb(229,67,229)","size":14.0},{"label":"Asmir Begovic","x":1126.9224853515625,"y":-656.7363891601562,"id":"68","attributes":{"Eigenvector Centrality":"0.320955391099679","Betweenness Centrality":"0.010086360119179452","Appearances":"30","No":"1","Country":"Bosnia and Herzegovina","Club Country":"England","Club":"Stoke City","Weighted Degree":"25.0","Modularity Class":"20","Date of birth / Age":"20 June 1987 (aged 26)","Degree":"25","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.32666666666666666"},"color":"rgb(132,229,67)","size":14.0},{"label":"Gervinho","x":560.3703002929688,"y":-680.4623413085938,"id":"246","attributes":{"Eigenvector Centrality":"0.3739231420118122","Betweenness Centrality":"0.008762525083432785","Appearances":"53","No":"10","Country":"Ivory Coast","Club Country":"Italy","Club":"Roma","Weighted Degree":"26.0","Modularity Class":"9","Date of birth / Age":"27 May 1987 (aged 27)","Degree":"26","Position":"FW","Eccentricity":"4.0","Closeness Centrality":"0.329006266786034"},"color":"rgb(164,67,229)","size":15.333333969116211},{"label":"Shinji Kagawa","x":282.6526184082031,"y":314.0347900390625,"id":"646","attributes":{"Eigenvector Centrality":"0.6754701881349925","Betweenness Centrality":"0.015603619215489676","Appearances":"57","No":"10","Country":"Japan","Club Country":"England","Club":"Manchester United","Weighted Degree":"35.0","Modularity Class":"27","Date of birth / Age":"17 March 1989 (aged 25)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3491686460807601"},"color":"rgb(67,100,229)","size":27.33333396911621},{"label":"Leroy Fer","x":837.33251953125,"y":-102.8897476196289,"id":"417","attributes":{"Eigenvector Centrality":"0.34753754509962104","Betweenness Centrality":"0.0017622038238311907","Appearances":"6","No":"18","Country":"Netherlands","Club Country":"England","Club":"Norwich City","Weighted Degree":"23.0","Modularity Class":"22","Date of birth / Age":"5 January 1990 (aged 24)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.317083692838654"},"color":"rgb(197,67,229)","size":11.333333015441895},{"label":"Abel Hernández","x":-85.60250091552734,"y":-6.678264617919922,"id":"3","attributes":{"Eigenvector Centrality":"0.37564528732258257","Betweenness Centrality":"0.0","Appearances":"12","No":"8","Country":"Uruguay","Club Country":"Italy","Club":"Palermo","Weighted Degree":"22.0","Modularity Class":"6","Date of birth / Age":"8 August 1990 (aged 23)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3121019108280255"},"color":"rgb(229,197,67)","size":10.0},{"label":"Aurélien Chedjou","x":479.9815979003906,"y":42.06589126586914,"id":"71","attributes":{"Eigenvector Centrality":"0.38111818720911783","Betweenness Centrality":"0.007567747700183238","Appearances":"31","No":"14","Country":"Cameroon","Club Country":"Turkey","Club":"Galatasaray","Weighted Degree":"26.0","Modularity Class":"17","Date of birth / Age":"20 June 1985 (aged 28)","Degree":"26","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3423381462505822"},"color":"rgb(67,132,229)","size":15.333333969116211},{"label":"Mateo Kovacic","x":-492.02667236328125,"y":654.4241943359375,"id":"469","attributes":{"Eigenvector Centrality":"0.47619962944812927","Betweenness Centrality":"0.0057313310683672425","Appearances":"10","No":"20","Country":"Croatia","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"29.0","Modularity Class":"25","Date of birth / Age":"6 May 1994 (aged 20)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.32608695652173914"},"color":"rgb(132,67,229)","size":19.333332061767578},{"label":"Vasilis Torosidis","x":1423.180908203125,"y":425.19268798828125,"id":"696","attributes":{"Eigenvector Centrality":"0.32379379672378844","Betweenness Centrality":"0.015251801587601078","Appearances":"66","No":"15","Country":"Greece","Club Country":"Italy","Club":"Roma","Weighted Degree":"26.0","Modularity Class":"15","Date of birth / Age":"10 June 1985 (aged 29)","Degree":"26","Position":"DF","Eccentricity":"4.0","Closeness Centrality":"0.31928757602085145"},"color":"rgb(229,67,100)","size":15.333333969116211},{"label":"Matteo Darmian","x":332.641357421875,"y":846.0514526367188,"id":"478","attributes":{"Eigenvector Centrality":"0.43196054419267377","Betweenness Centrality":"0.0018820457212751422","Appearances":"1","No":"4","Country":"Italy","Club Country":"Italy","Club":"Torino","Weighted Degree":"23.0","Modularity Class":"3","Date of birth / Age":"2 December 1989 (aged 24)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30497925311203317"},"color":"rgb(197,229,67)","size":11.333333015441895},{"label":"Fernando Muslera","x":73.75354766845703,"y":-37.718238830566406,"id":"226","attributes":{"Eigenvector Centrality":"0.43253266088929565","Betweenness Centrality":"0.00796097224898124","Appearances":"58","No":"1","Country":"Uruguay","Club Country":"Turkey","Club":"Galatasaray","Weighted Degree":"26.0","Modularity Class":"6","Date of birth / Age":"16 June 1986 (aged 27)","Degree":"26","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.34249767008387694"},"color":"rgb(229,197,67)","size":15.333333969116211},{"label":"Rio Mavuba","x":-65.83039093017578,"y":-421.9732971191406,"id":"604","attributes":{"Eigenvector Centrality":"0.5305324640410493","Betweenness Centrality":"0.0017087585037009543","Appearances":"12","No":"12","Country":"France","Club Country":"France","Club":"Lille","Weighted Degree":"25.0","Modularity Class":"16","Date of birth / Age":"8 March 1984 (aged 30)","Degree":"25","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.32579787234042556"},"color":"rgb(229,67,229)","size":14.0},{"label":"Didier Ya Konan","x":543.8720092773438,"y":-767.3469848632812,"id":"160","attributes":{"Eigenvector Centrality":"0.34039082013140126","Betweenness Centrality":"0.003415370768047869","Appearances":"25","No":"13","Country":"Ivory Coast","Club Country":"Germany","Club":"Hannover 96","Weighted Degree":"24.0","Modularity Class":"9","Date of birth / Age":"22 May 1984 (aged 30)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.31370038412291934"},"color":"rgb(164,67,229)","size":12.666666984558105},{"label":"Islam Slimani","x":-1357.2412109375,"y":1056.663818359375,"id":"296","attributes":{"Eigenvector Centrality":"0.34570611332658036","Betweenness Centrality":"0.00227391237436229","Appearances":"20","No":"13","Country":"Algeria","Club Country":"Portugal","Club":"Sporting CP","Weighted Degree":"25.0","Modularity Class":"24","Date of birth / Age":"18 June 1988 (aged 25)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30246913580246915"},"color":"rgb(67,164,229)","size":14.0},{"label":"Brad Guzan","x":829.8171997070312,"y":-1411.882568359375,"id":"91","attributes":{"Eigenvector Centrality":"0.28491855645503317","Betweenness Centrality":"0.0014353729751920106","Appearances":"25","No":"12","Country":"United States","Club Country":"England","Club":"Aston Villa","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"9 September 1984 (aged 29)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2929453965723396"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"José Pedro Fuenzalida","x":-198.39776611328125,"y":1545.63720703125,"id":"361","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"23","No":"19","Country":"Chile","Club Country":"Chile","Club":"Colo-Colo","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"22 February 1985 (aged 29)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Luís Neto","x":-787.0558471679688,"y":-14.597501754760742,"id":"428","attributes":{"Eigenvector Centrality":"0.5291116763411419","Betweenness Centrality":"0.007266376231630914","Appearances":"9","No":"14","Country":"Portugal","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"29.0","Modularity Class":"8","Date of birth / Age":"26 May 1988 (aged 26)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3223684210526316"},"color":"rgb(229,164,67)","size":19.333332061767578},{"label":"Dries Mertens","x":-646.4434204101562,"y":-473.26361083984375,"id":"177","attributes":{"Eigenvector Centrality":"0.7906646703428208","Betweenness Centrality":"0.007893651717681398","Appearances":"25","No":"14","Country":"Belgium","Club Country":"Italy","Club":"Napoli","Weighted Degree":"33.0","Modularity Class":"28","Date of birth / Age":"6 May 1987 (aged 27)","Degree":"33","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3531955790485344"},"color":"rgb(67,229,132)","size":24.666667938232422},{"label":"Jan Vertonghen","x":-726.4645385742188,"y":-735.5794067382812,"id":"311","attributes":{"Eigenvector Centrality":"0.5781054780643132","Betweenness Centrality":"0.0013899483715746057","Appearances":"56","No":"5","Country":"Belgium","Club Country":"England","Club":"Tottenham Hotspur","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"24 April 1987 (aged 27)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33638443935926776"},"color":"rgb(67,229,132)","size":14.0},{"label":"Joao Rojas","x":-1776.6961669921875,"y":-531.8544921875,"id":"334","attributes":{"Eigenvector Centrality":"0.38534499087839263","Betweenness Centrality":"0.003660717358574628","Appearances":"30","No":"9","Country":"Ecuador","Club Country":"Mexico","Club":"Cruz Azul","Weighted Degree":"24.0","Modularity Class":"4","Date of birth / Age":"14 June 1989 (aged 24)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2942353883106485"},"color":"rgb(229,67,132)","size":12.666666984558105},{"label":"Ben Foster","x":-170.4840545654297,"y":-869.5690307617188,"id":"80","attributes":{"Eigenvector Centrality":"0.5333561865660762","Betweenness Centrality":"4.2496140393833733E-4","Appearances":"7","No":"13","Country":"England","Club Country":"England","Club":"West Bromwich Albion","Weighted Degree":"23.0","Modularity Class":"28","Date of birth / Age":"3 May 1983 (aged 31)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.30624999999999997"},"color":"rgb(67,229,132)","size":11.333333015441895},{"label":"Reza Ghoochannejhad","x":2037.90625,"y":1109.2969970703125,"id":"598","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"14","No":"16","Country":"Iran","Club Country":"England","Club":"Charlton Athletic","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"20 September 1987 (aged 26)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Ivan Perišic","x":-294.8162841796875,"y":494.7712097167969,"id":"299","attributes":{"Eigenvector Centrality":"0.44148422896622697","Betweenness Centrality":"0.0021210911790253153","Appearances":"29","No":"4","Country":"Croatia","Club Country":"Germany","Club":"VfL Wolfsburg","Weighted Degree":"27.0","Modularity Class":"25","Date of birth / Age":"2 February 1989 (aged 25)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.317083692838654"},"color":"rgb(132,67,229)","size":16.666667938232422},{"label":"Frank Lampard","x":-247.65232849121094,"y":-855.8526000976562,"id":"231","attributes":{"Eigenvector Centrality":"0.7775723533806831","Betweenness Centrality":"0.0029928487399309587","Appearances":"105","No":"8","Country":"England","Club Country":"England","Club":"Chelsea","Weighted Degree":"32.0","Modularity Class":"28","Date of birth / Age":"20 June 1978 (aged 35)","Degree":"32","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3315290933694181"},"color":"rgb(67,229,132)","size":23.33333396911621},{"label":"Yasuhito Endo","x":785.9192504882812,"y":586.3290405273438,"id":"724","attributes":{"Eigenvector Centrality":"0.31718153777834773","Betweenness Centrality":"0.0","Appearances":"144","No":"7","Country":"Japan","Club Country":"Japan","Club":"Gamba Osaka","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"28 January 1980 (aged 34)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Kevin Mirallas","x":-563.9285278320312,"y":-964.3165893554688,"id":"386","attributes":{"Eigenvector Centrality":"0.5945562042887822","Betweenness Centrality":"0.0024227939394388456","Appearances":"44","No":"11","Country":"Belgium","Club Country":"England","Club":"Everton","Weighted Degree":"26.0","Modularity Class":"28","Date of birth / Age":"5 October 1987 (aged 26)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3330312641594925"},"color":"rgb(67,229,132)","size":15.333333969116211},{"label":"Johnny Acosta","x":2202.927978515625,"y":222.98760986328125,"id":"343","attributes":{"Eigenvector Centrality":"0.24571486118323416","Betweenness Centrality":"0.003463283566079935","Appearances":"25","No":"2","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Alajuelense","Weighted Degree":"23.0","Modularity Class":"29","Date of birth / Age":"21 July 1983 (aged 30)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.26601520086862107"},"color":"rgb(229,229,67)","size":11.333333015441895},{"label":"Vincent Enyeama","x":-105.49050903320312,"y":-1519.4764404296875,"id":"706","attributes":{"Eigenvector Centrality":"0.3575079291455913","Betweenness Centrality":"0.0026743855225904787","Appearances":"91","No":"1","Country":"Nigeria","Club Country":"France","Club":"Lille","Weighted Degree":"25.0","Modularity Class":"14","Date of birth / Age":"29 August 1982 (aged 31)","Degree":"25","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.31437125748503"},"color":"rgb(67,229,100)","size":14.0},{"label":"Rodrigo Muñoz","x":-20.128692626953125,"y":28.408824920654297,"id":"607","attributes":{"Eigenvector Centrality":"0.37564528732258257","Betweenness Centrality":"0.0","Appearances":"0","No":"12","Country":"Uruguay","Club Country":"Paraguay","Club":"Libertad","Weighted Degree":"22.0","Modularity Class":"6","Date of birth / Age":"22 January 1982 (aged 32)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3121019108280255"},"color":"rgb(229,197,67)","size":10.0},{"label":"Laurent Koscielny","x":-15.055593490600586,"y":-387.5162048339844,"id":"409","attributes":{"Eigenvector Centrality":"0.6518193073443905","Betweenness Centrality":"0.0017629955601543275","Appearances":"17","No":"21","Country":"France","Club Country":"England","Club":"Arsenal","Weighted Degree":"29.0","Modularity Class":"16","Date of birth / Age":"10 September 1985 (aged 28)","Degree":"29","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3262316910785619"},"color":"rgb(229,67,229)","size":19.333332061767578},{"label":"Steven Gerrard (c)","x":-159.652099609375,"y":-980.668701171875,"id":"668","attributes":{"Eigenvector Centrality":"0.6237674591008822","Betweenness Centrality":"0.0010635550306756442","Appearances":"111","No":"4","Country":"England","Club Country":"England","Club":"Liverpool","Weighted Degree":"27.0","Modularity Class":"28","Date of birth / Age":"30 May 1980 (aged 34)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3247901016349978"},"color":"rgb(67,229,132)","size":16.666667938232422},{"label":"Andrea Pirlo","x":108.05339813232422,"y":870.1171264648438,"id":"46","attributes":{"Eigenvector Centrality":"0.5455496050511397","Betweenness Centrality":"0.0016215443882875223","Appearances":"109","No":"21","Country":"Italy","Club Country":"Italy","Club":"Juventus","Weighted Degree":"28.0","Modularity Class":"3","Date of birth / Age":"19 May 1979 (aged 35)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(197,229,67)","size":18.0},{"label":"Aleksei Kozlov","x":-1463.252685546875,"y":-1376.61376953125,"id":"25","attributes":{"Eigenvector Centrality":"0.28166227463506127","Betweenness Centrality":"6.368705012250895E-4","Appearances":"11","No":"2","Country":"Russia","Club Country":"Russia","Club":"Dynamo Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"16 November 1986 (aged 27)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.25538568450312715"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Yeltsin Tejeda","x":2354.937255859375,"y":330.5636291503906,"id":"727","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"22","No":"17","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Saprissa","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"17 March 1992 (aged 22)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"John Brooks","x":729.48095703125,"y":-1409.59375,"id":"341","attributes":{"Eigenvector Centrality":"0.2843366476001853","Betweenness Centrality":"0.0036883088645504737","Appearances":"4","No":"6","Country":"United States","Club Country":"Germany","Club":"Hertha BSC","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"28 January 1993 (aged 21)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2979327117957033"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"Kwadwo Asamoah","x":285.1675720214844,"y":1193.169677734375,"id":"404","attributes":{"Eigenvector Centrality":"0.5138638941206055","Betweenness Centrality":"0.013451953978807028","Appearances":"62","No":"20","Country":"Ghana","Club Country":"Italy","Club":"Juventus","Weighted Degree":"33.0","Modularity Class":"5","Date of birth / Age":"9 December 1988 (aged 25)","Degree":"33","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3225098727512067"},"color":"rgb(67,229,197)","size":24.666667938232422},{"label":"Andrei Semyonov","x":-1427.725830078125,"y":-1522.6015625,"id":"48","attributes":{"Eigenvector Centrality":"0.26569304291819806","Betweenness Centrality":"0.0","Appearances":"1","No":"5","Country":"Russia","Club Country":"Russia","Club":"Terek Grozny","Weighted Degree":"22.0","Modularity Class":"2","Date of birth / Age":"24 March 1989 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.23244781783681215"},"color":"rgb(229,67,67)","size":10.0},{"label":"Geoff Cameron","x":820.3438720703125,"y":-1464.11474609375,"id":"242","attributes":{"Eigenvector Centrality":"0.3091550505336035","Betweenness Centrality":"0.007189506868566205","Appearances":"27","No":"20","Country":"United States","Club Country":"England","Club":"Stoke City","Weighted Degree":"25.0","Modularity Class":"26","Date of birth / Age":"11 July 1985 (aged 28)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3090832632464256"},"color":"rgb(100,229,67)","size":14.0},{"label":"Juan Camilo Zúñiga","x":-759.6773071289062,"y":893.1192626953125,"id":"366","attributes":{"Eigenvector Centrality":"0.5886662376124554","Betweenness Centrality":"0.01051159651060277","Appearances":"50","No":"18","Country":"Colombia","Club Country":"Italy","Club":"Napoli","Weighted Degree":"33.0","Modularity Class":"11","Date of birth / Age":"14 December 1985 (aged 28)","Degree":"33","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3333333333333333"},"color":"rgb(67,67,229)","size":24.666667938232422},{"label":"Julian Green","x":627.960205078125,"y":-1176.4527587890625,"id":"375","attributes":{"Eigenvector Centrality":"0.592763148395897","Betweenness Centrality":"0.018661873881244673","Appearances":"2","No":"16","Country":"United States","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"35.0","Modularity Class":"26","Date of birth / Age":"6 June 1995 (aged 19)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3327297419646899"},"color":"rgb(100,229,67)","size":27.33333396911621},{"label":"Yuya Osako","x":806.6990356445312,"y":633.545654296875,"id":"735","attributes":{"Eigenvector Centrality":"0.31718153777834784","Betweenness Centrality":"0.0","Appearances":"9","No":"18","Country":"Japan","Club Country":"Germany","Club":"1860 München","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"18 May 1990 (aged 24)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Sammy N\u0027Djock","x":341.5248107910156,"y":155.8591766357422,"id":"626","attributes":{"Eigenvector Centrality":"0.32277187794408035","Betweenness Centrality":"0.0","Appearances":"3","No":"23","Country":"Cameroon","Club Country":"Turkey","Club":"Fethiyespor","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"25 February 1990 (aged 24)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"João Pereira","x":-649.9645385742188,"y":448.8273620605469,"id":"333","attributes":{"Eigenvector Centrality":"0.4540996988101742","Betweenness Centrality":"0.0033859990894464925","Appearances":"36","No":"21","Country":"Portugal","Club Country":"Spain","Club":"Valencia","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"25 February 1984 (aged 30)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.32507739938080493"},"color":"rgb(229,164,67)","size":14.0},{"label":"Ron-Robert Zieler","x":479.21453857421875,"y":-376.45037841796875,"id":"614","attributes":{"Eigenvector Centrality":"0.5011578446474096","Betweenness Centrality":"0.0032324185183237805","Appearances":"3","No":"12","Country":"Germany","Club Country":"Germany","Club":"Hannover 96","Weighted Degree":"24.0","Modularity Class":"13","Date of birth / Age":"12 February 1989 (aged 25)","Degree":"24","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.31599312123817713"},"color":"rgb(67,229,164)","size":12.666666984558105},{"label":"Éder Álvarez Balanta","x":-862.3296508789062,"y":1190.236083984375,"id":"181","attributes":{"Eigenvector Centrality":"0.313949251078916","Betweenness Centrality":"0.0","Appearances":"3","No":"16","Country":"Colombia","Club Country":"Argentina","Club":"River Plate","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"28 February 1993 (aged 21)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Martín Demichelis","x":-893.08544921875,"y":82.94781494140625,"id":"462","attributes":{"Eigenvector Centrality":"0.6398902783818312","Betweenness Centrality":"0.003598075368399343","Appearances":"38","No":"15","Country":"Argentina","Club Country":"England","Club":"Manchester City","Weighted Degree":"29.0","Modularity Class":"19","Date of birth / Age":"20 December 1980 (aged 33)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3316787003610108"},"color":"rgb(67,229,229)","size":19.333332061767578},{"label":"Mattia De Sciglio","x":304.86956787109375,"y":920.4893798828125,"id":"481","attributes":{"Eigenvector Centrality":"0.49991402097095844","Betweenness Centrality":"0.003073405743850096","Appearances":"11","No":"2","Country":"Italy","Club Country":"Italy","Club":"Milan","Weighted Degree":"27.0","Modularity Class":"3","Date of birth / Age":"20 October 1992 (aged 21)","Degree":"27","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31928757602085145"},"color":"rgb(197,229,67)","size":16.666667938232422},{"label":"Silvestre Varela","x":-839.6356811523438,"y":400.2161865234375,"id":"652","attributes":{"Eigenvector Centrality":"0.5557776384808136","Betweenness Centrality":"0.006533778730302813","Appearances":"24","No":"18","Country":"Portugal","Club Country":"Portugal","Club":"Porto","Weighted Degree":"30.0","Modularity Class":"8","Date of birth / Age":"2 February 1985 (aged 29)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3387096774193548"},"color":"rgb(229,164,67)","size":20.666667938232422},{"label":"Sergei Ignashevich","x":-1314.4222412109375,"y":-1444.7847900390625,"id":"640","attributes":{"Eigenvector Centrality":"0.27975304502942105","Betweenness Centrality":"8.329697214751982E-4","Appearances":"96","No":"4","Country":"Russia","Club Country":"Russia","Club":"CSKA Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"14 July 1979 (aged 34)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.2544132917964694"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Masato Morishige","x":677.7444458007812,"y":664.5134887695312,"id":"466","attributes":{"Eigenvector Centrality":"0.3171815377783477","Betweenness Centrality":"0.0","Appearances":"10","No":"6","Country":"Japan","Club Country":"Japan","Club":"F.C. Tokyo","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"21 May 1987 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Daniele De Rossi","x":294.1720886230469,"y":656.4853515625,"id":"141","attributes":{"Eigenvector Centrality":"0.4810207457061944","Betweenness Centrality":"0.006374040778649005","Appearances":"95","No":"16","Country":"Italy","Club Country":"Italy","Club":"Roma","Weighted Degree":"26.0","Modularity Class":"3","Date of birth / Age":"24 July 1983 (aged 30)","Degree":"26","Position":"MF","Eccentricity":"4.0","Closeness Centrality":"0.32754010695187163"},"color":"rgb(197,229,67)","size":15.333333969116211},{"label":"Asamoah Gyan (c)","x":384.49658203125,"y":1385.8724365234375,"id":"65","attributes":{"Eigenvector Centrality":"0.29027436907278803","Betweenness Centrality":"0.0","Appearances":"79","No":"3","Country":"Ghana","Club Country":"United Arab Emirates","Club":"Al-Ain","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"22 November 1985 (aged 28)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Eduardo dos Reis Carvalho","x":-685.5633544921875,"y":299.7951965332031,"id":"188","attributes":{"Eigenvector Centrality":"0.40962360528145036","Betweenness Centrality":"0.0","Appearances":"34","No":"1","Country":"Portugal","Club Country":"Portugal","Club":"Braga","Weighted Degree":"22.0","Modularity Class":"8","Date of birth / Age":"19 September 1982 (aged 31)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.30714584203928125"},"color":"rgb(229,164,67)","size":10.0},{"label":"Claudio Bravo (c)","x":-193.7080078125,"y":1267.75439453125,"id":"124","attributes":{"Eigenvector Centrality":"0.36167758865639443","Betweenness Centrality":"0.00416233990960059","Appearances":"79","No":"1","Country":"Chile","Club Country":"Spain","Club":"Real Sociedad","Weighted Degree":"25.0","Modularity Class":"18","Date of birth / Age":"13 April 1983 (aged 31)","Degree":"25","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.30561330561330563"},"color":"rgb(229,132,67)","size":14.0},{"label":"Mickaël Landreau","x":-46.635650634765625,"y":-207.5623779296875,"id":"508","attributes":{"Eigenvector Centrality":"0.4836397599249273","Betweenness Centrality":"0.0","Appearances":"11","No":"23","Country":"France","Club Country":"France","Club":"Bastia","Weighted Degree":"22.0","Modularity Class":"16","Date of birth / Age":"14 May 1979 (aged 35)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.3037190082644628"},"color":"rgb(229,67,229)","size":10.0},{"label":"Carlos Valdés","x":-788.6849365234375,"y":1186.095947265625,"id":"106","attributes":{"Eigenvector Centrality":"0.313949251078916","Betweenness Centrality":"0.0","Appearances":"14","No":"23","Country":"Colombia","Club Country":"Argentina","Club":"San Lorenzo","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"22 May 1985 (aged 29)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Reto Ziegler","x":3.86130690574646,"y":248.17929077148438,"id":"596","attributes":{"Eigenvector Centrality":"0.384616160215653","Betweenness Centrality":"0.0","Appearances":"35","No":"3","Country":"Switzerland","Club Country":"Italy","Club":"Sassuolo","Weighted Degree":"22.0","Modularity Class":"0","Date of birth / Age":"16 January 1986 (aged 28)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2922465208747515"},"color":"rgb(164,229,67)","size":10.0},{"label":"Diego Benaglio","x":-65.3055419921875,"y":256.201171875,"id":"162","attributes":{"Eigenvector Centrality":"0.4795399294217994","Betweenness Centrality":"0.0025216888133772915","Appearances":"57","No":"1","Country":"Switzerland","Club Country":"Germany","Club":"VfL Wolfsburg","Weighted Degree":"27.0","Modularity Class":"0","Date of birth / Age":"8 September 1983 (aged 30)","Degree":"27","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.31942633637548895"},"color":"rgb(164,229,67)","size":16.666667938232422},{"label":"Mario Martínez","x":1689.1534423828125,"y":-1223.1529541015625,"id":"456","attributes":{"Eigenvector Centrality":"0.23664887946331803","Betweenness Centrality":"0.0","Appearances":"37","No":"10","Country":"Honduras","Club Country":"Honduras","Club":"Real España","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"30 July 1989 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"DeAndre Yedlin","x":776.4466552734375,"y":-1500.7615966796875,"id":"156","attributes":{"Eigenvector Centrality":"0.2718151842935107","Betweenness Centrality":"0.0","Appearances":"4","No":"2","Country":"United States","Club Country":"United States","Club":"Seattle Sounders FC","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"9 July 1993 (aged 20)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Alex Wilkinson","x":2120.3818359375,"y":-724.7479858398438,"id":"29","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"3","No":"22","Country":"Australia","Club Country":"South Korea","Club":"Jeonbuk Hyundai Motors","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"13 August 1984 (aged 29)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Yuri Zhirkov","x":-1464.4825439453125,"y":-1475.711669921875,"id":"733","attributes":{"Eigenvector Centrality":"0.2816622746350614","Betweenness Centrality":"6.368705012250895E-4","Appearances":"60","No":"18","Country":"Russia","Club Country":"Russia","Club":"Dynamo Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"20 August 1983 (aged 30)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.25538568450312715"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Alan Dzagoev","x":-1268.1650390625,"y":-1469.7052001953125,"id":"16","attributes":{"Eigenvector Centrality":"0.27975304502942094","Betweenness Centrality":"8.329697214751982E-4","Appearances":"32","No":"10","Country":"Russia","Club Country":"Russia","Club":"CSKA Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"17 June 1990 (aged 23)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.2544132917964694"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Rui Patrício","x":-770.5219116210938,"y":432.8207702636719,"id":"619","attributes":{"Eigenvector Centrality":"0.4410475661612916","Betweenness Centrality":"0.001075874410151188","Appearances":"30","No":"12","Country":"Portugal","Club Country":"Portugal","Club":"Sporting CP","Weighted Degree":"24.0","Modularity Class":"8","Date of birth / Age":"15 February 1988 (aged 26)","Degree":"24","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3185955786736021"},"color":"rgb(229,164,67)","size":12.666666984558105},{"label":"Kostas Katsouranis","x":1625.112060546875,"y":590.2659301757812,"id":"400","attributes":{"Eigenvector Centrality":"0.2581333696341679","Betweenness Centrality":"0.0","Appearances":"111","No":"21","Country":"Greece","Club Country":"Greece","Club":"PAOK","Weighted Degree":"22.0","Modularity Class":"15","Date of birth / Age":"21 June 1979 (aged 34)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2760045061960195"},"color":"rgb(229,67,100)","size":10.0},{"label":"Jozy Altidore","x":866.4315185546875,"y":-1353.639892578125,"id":"365","attributes":{"Eigenvector Centrality":"0.282018657273756","Betweenness Centrality":"0.004513119899770913","Appearances":"70","No":"17","Country":"United States","Club Country":"England","Club":"Sunderland","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"6 November 1989 (aged 24)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"Yacine Brahimi","x":-1176.72509765625,"y":1144.9345703125,"id":"722","attributes":{"Eigenvector Centrality":"0.3206186598118753","Betweenness Centrality":"0.011120766403752676","Appearances":"6","No":"11","Country":"Algeria","Club Country":"Spain","Club":"Granada","Weighted Degree":"24.0","Modularity Class":"24","Date of birth / Age":"8 February 1990 (aged 24)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3125"},"color":"rgb(67,164,229)","size":12.666666984558105},{"label":"Lee Bum-young","x":1190.99267578125,"y":1637.5755615234375,"id":"411","attributes":{"Eigenvector Centrality":"0.23152559498868786","Betweenness Centrality":"0.0","Appearances":"0","No":"23","Country":"South Korea","Club Country":"South Korea","Club":"Busan IPark","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"2 April 1989 (aged 25)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Juan Carlos Paredes","x":-1452.1322021484375,"y":-446.3980712890625,"id":"368","attributes":{"Eigenvector Centrality":"0.7525405481416904","Betweenness Centrality":"0.006691544296226193","Appearances":"38","No":"4","Country":"Ecuador","Club Country":"Ecuador","Club":"Barcelona","Weighted Degree":"35.0","Modularity Class":"4","Date of birth / Age":"8 July 1987 (aged 26)","Degree":"35","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(229,67,132)","size":27.33333396911621},{"label":"Eduardo da Silva","x":-364.40460205078125,"y":586.625732421875,"id":"187","attributes":{"Eigenvector Centrality":"0.36375321381526937","Betweenness Centrality":"2.8773715502087595E-4","Appearances":"63","No":"22","Country":"Croatia","Club Country":"Ukraine","Club":"Shakhtar Donetsk","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"25 February 1983 (aged 31)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30246913580246915"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Giorgos Karagounis (c)","x":1659.2034912109375,"y":651.7564086914062,"id":"253","attributes":{"Eigenvector Centrality":"0.26821419599108537","Betweenness Centrality":"0.011764360515140076","Appearances":"135","No":"10","Country":"Greece","Club Country":"England","Club":"Fulham","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"6 March 1977 (aged 37)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2784090909090909"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Fernandinho","x":-442.978759765625,"y":-336.26580810546875,"id":"224","attributes":{"Eigenvector Centrality":"0.7476247846505292","Betweenness Centrality":"0.004586029475076887","Appearances":"7","No":"5","Country":"Brazil","Club Country":"England","Club":"Manchester City","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"4 May 1985 (aged 29)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34653465346534656"},"color":"rgb(229,67,197)","size":22.0},{"label":"Willian","x":-440.7384338378906,"y":-410.82391357421875,"id":"717","attributes":{"Eigenvector Centrality":"0.7525362816963489","Betweenness Centrality":"0.002196566654268722","Appearances":"7","No":"19","Country":"Brazil","Club Country":"England","Club":"Chelsea","Weighted Degree":"30.0","Modularity Class":"23","Date of birth / Age":"9 August 1988 (aged 25)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3471894189891356"},"color":"rgb(229,67,197)","size":20.666667938232422},{"label":"Ricardo Rodríguez","x":-71.6590805053711,"y":197.1143798828125,"id":"602","attributes":{"Eigenvector Centrality":"0.47953992942179946","Betweenness Centrality":"0.0025216888133772915","Appearances":"21","No":"13","Country":"Switzerland","Club Country":"Germany","Club":"VfL Wolfsburg","Weighted Degree":"27.0","Modularity Class":"0","Date of birth / Age":"25 August 1992 (aged 21)","Degree":"27","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31942633637548895"},"color":"rgb(164,229,67)","size":16.666667938232422},{"label":"Brad Davis","x":915.6695556640625,"y":-1565.895263671875,"id":"90","attributes":{"Eigenvector Centrality":"0.282163463180194","Betweenness Centrality":"0.0017638995236230006","Appearances":"16","No":"14","Country":"United States","Club Country":"United States","Club":"Houston Dynamo","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"8 November 1981 (aged 32)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2877838684416601"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"Xavi","x":-1013.392822265625,"y":-319.8654479980469,"id":"720","attributes":{"Eigenvector Centrality":"0.9370904429273632","Betweenness Centrality":"0.0017384725186443504","Appearances":"132","No":"8","Country":"Spain","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"25 January 1980 (aged 34)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(229,67,197)","size":22.0},{"label":"Yaya Touré","x":251.69076538085938,"y":-758.7758178710938,"id":"726","attributes":{"Eigenvector Centrality":"0.5209154819658625","Betweenness Centrality":"0.009566975454863513","Appearances":"82","No":"19","Country":"Ivory Coast","Club Country":"England","Club":"Manchester City","Weighted Degree":"31.0","Modularity Class":"9","Date of birth / Age":"13 May 1983 (aged 31)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3330312641594925"},"color":"rgb(164,67,229)","size":22.0},{"label":"Kevin De Bruyne","x":-581.4454956054688,"y":-583.9620971679688,"id":"384","attributes":{"Eigenvector Centrality":"0.6295071279602001","Betweenness Centrality":"0.0038293176434487024","Appearances":"21","No":"7","Country":"Belgium","Club Country":"Germany","Club":"VfL Wolfsburg","Weighted Degree":"28.0","Modularity Class":"28","Date of birth / Age":"28 June 1991 (aged 22)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3380864765409384"},"color":"rgb(67,229,132)","size":18.0},{"label":"Oswaldo Minda","x":-1549.43017578125,"y":-719.5339965820312,"id":"552","attributes":{"Eigenvector Centrality":"0.37271345847500326","Betweenness Centrality":"0.005310330072733828","Appearances":"18","No":"14","Country":"Ecuador","Club Country":"United States","Club":"Chivas USA","Weighted Degree":"23.0","Modularity Class":"4","Date of birth / Age":"July 26, 1983 (aged 30)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3006134969325153"},"color":"rgb(229,67,132)","size":11.333333015441895},{"label":"Raheem Sterling","x":-93.5101089477539,"y":-985.4642944335938,"id":"583","attributes":{"Eigenvector Centrality":"0.6237674591008822","Betweenness Centrality":"0.0010635550306756442","Appearances":"4","No":"19","Country":"England","Club Country":"England","Club":"Liverpool","Weighted Degree":"27.0","Modularity Class":"28","Date of birth / Age":"8 December 1994 (aged 19)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3247901016349978"},"color":"rgb(67,229,132)","size":16.666667938232422},{"label":"Chigozie Agbim","x":-67.00606536865234,"y":-1575.5159912109375,"id":"115","attributes":{"Eigenvector Centrality":"0.3058149002352039","Betweenness Centrality":"0.0","Appearances":"11","No":"21","Country":"Nigeria","Club Country":"Nigeria","Club":"Gombe United","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"28 November 1984 (aged 29)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Bacary Sagna","x":-102.57307434082031,"y":-365.2166442871094,"id":"76","attributes":{"Eigenvector Centrality":"0.6518193073443906","Betweenness Centrality":"0.0017629955601543275","Appearances":"41","No":"15","Country":"France","Club Country":"England","Club":"Arsenal","Weighted Degree":"29.0","Modularity Class":"16","Date of birth / Age":"14 February 1983 (aged 31)","Degree":"29","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3262316910785619"},"color":"rgb(229,67,229)","size":19.333332061767578},{"label":"Timothy Chandler","x":803.3570556640625,"y":-1282.82470703125,"id":"683","attributes":{"Eigenvector Centrality":"0.3137272348985455","Betweenness Centrality":"0.005346568845878015","Appearances":"13","No":"21","Country":"United States","Club Country":"Germany","Club":"1. FC Nürnberg","Weighted Degree":"25.0","Modularity Class":"26","Date of birth / Age":"29 March 1990 (aged 24)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30284301606922126"},"color":"rgb(100,229,67)","size":14.0},{"label":"Muhamed Bešic","x":1194.709228515625,"y":-510.0015563964844,"id":"524","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"9","No":"7","Country":"Bosnia and Herzegovina","Club Country":"Hungary","Club":"Ferencváros","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"10 September 1992 (aged 21)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Patrice Evra","x":-226.57672119140625,"y":-327.58880615234375,"id":"562","attributes":{"Eigenvector Centrality":"0.8374426942127946","Betweenness Centrality":"0.008276091758701315","Appearances":"58","No":"3","Country":"France","Club Country":"England","Club":"Manchester United","Weighted Degree":"35.0","Modularity Class":"16","Date of birth / Age":"15 May 1981 (aged 33)","Degree":"35","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3441011235955056"},"color":"rgb(229,67,229)","size":27.33333396911621},{"label":"Edgar Salli","x":416.1859130859375,"y":196.34884643554688,"id":"182","attributes":{"Eigenvector Centrality":"0.3227718779440803","Betweenness Centrality":"0.0","Appearances":"9","No":"20","Country":"Cameroon","Club Country":"France","Club":"Lens","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"17 August 1992 (aged 21)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"José de Jesús Corona","x":-2099.093994140625,"y":287.1224670410156,"id":"355","attributes":{"Eigenvector Centrality":"0.29131873163694544","Betweenness Centrality":"0.0012783129193471678","Appearances":"34","No":"1","Country":"Mexico","Club Country":"Mexico","Club":"Cruz Azul","Weighted Degree":"23.0","Modularity Class":"21","Date of birth / Age":"26 January 1981 (aged 33)","Degree":"23","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.2744585511575803"},"color":"rgb(67,229,67)","size":11.333333015441895},{"label":"Óscar Bagüí","x":-1773.5125732421875,"y":-705.2896118164062,"id":"548","attributes":{"Eigenvector Centrality":"0.3623062182068213","Betweenness Centrality":"0.0","Appearances":"21","No":"18","Country":"Ecuador","Club Country":"Ecuador","Club":"Emelec","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"10 December 1982 (aged 31)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Djamel Mesbah","x":-1360.75830078125,"y":1211.451904296875,"id":"173","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"26","No":"6","Country":"Algeria","Club Country":"Italy","Club":"Livorno","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"9 October 1984 (aged 29)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Austin Ejide","x":-127.88009643554688,"y":-1587.7188720703125,"id":"72","attributes":{"Eigenvector Centrality":"0.3058149002352039","Betweenness Centrality":"0.0","Appearances":"31","No":"16","Country":"Nigeria","Club Country":"Israel","Club":"Hapoel Be\u0027er Sheva","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"8 April 1984 (aged 30)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Daniel Sturridge","x":-202.59893798828125,"y":-933.4009399414062,"id":"139","attributes":{"Eigenvector Centrality":"0.6237674591008823","Betweenness Centrality":"0.0010635550306756442","Appearances":"12","No":"9","Country":"England","Club Country":"England","Club":"Liverpool","Weighted Degree":"27.0","Modularity Class":"28","Date of birth / Age":"1 September 1989 (aged 24)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3247901016349978"},"color":"rgb(67,229,132)","size":16.666667938232422},{"label":"Toby Alderweireld","x":-719.4182739257812,"y":-665.7479858398438,"id":"685","attributes":{"Eigenvector Centrality":"0.6799862056462357","Betweenness Centrality":"0.0018763771735177332","Appearances":"34","No":"2","Country":"Belgium","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"29.0","Modularity Class":"28","Date of birth / Age":"2 March 1989 (aged 25)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3313796212804328"},"color":"rgb(67,229,132)","size":19.333332061767578},{"label":"Christoph Kramer","x":422.9450988769531,"y":-364.4662170410156,"id":"122","attributes":{"Eigenvector Centrality":"0.4894396183916067","Betweenness Centrality":"6.915469095936232E-4","Appearances":"2","No":"23","Country":"Germany","Club Country":"Germany","Club":"Borussia Mönchengladbach","Weighted Degree":"23.0","Modularity Class":"13","Date of birth / Age":"12 February 1991 (aged 23)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30599500416319736"},"color":"rgb(67,229,164)","size":11.333333015441895},{"label":"Esteban Granados","x":2281.050048828125,"y":393.7303161621094,"id":"206","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"11","No":"13","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Herediano","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"25 October 1985 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Gary Cahill","x":-301.79718017578125,"y":-918.284912109375,"id":"238","attributes":{"Eigenvector Centrality":"0.7775723533806831","Betweenness Centrality":"0.0029928487399309587","Appearances":"24","No":"5","Country":"England","Club Country":"England","Club":"Chelsea","Weighted Degree":"32.0","Modularity Class":"28","Date of birth / Age":"19 December 1985 (aged 28)","Degree":"32","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3315290933694181"},"color":"rgb(67,229,132)","size":23.33333396911621},{"label":"Jonathan de Guzmán","x":917.8981323242188,"y":-45.65421676635742,"id":"345","attributes":{"Eigenvector Centrality":"0.3481568776699336","Betweenness Centrality":"0.0010475901113017954","Appearances":"10","No":"8","Country":"Netherlands","Club Country":"Wales","Club":"Swansea City","Weighted Degree":"23.0","Modularity Class":"22","Date of birth / Age":"13 September 1987 (aged 26)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31873373807458805"},"color":"rgb(197,67,229)","size":11.333333015441895},{"label":"Senijad Ibricic","x":1235.974853515625,"y":-497.09393310546875,"id":"637","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"42","No":"17","Country":"Bosnia and Herzegovina","Club Country":"Turkey","Club":"Kayseri Erciyesspor","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"26 September 1985 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Héctor Herrera","x":-1799.6182861328125,"y":372.85076904296875,"id":"275","attributes":{"Eigenvector Centrality":"0.4116885255313005","Betweenness Centrality":"0.009305549137125925","Appearances":"13","No":"6","Country":"Mexico","Club Country":"Portugal","Club":"Porto","Weighted Degree":"29.0","Modularity Class":"21","Date of birth / Age":"19 April 1990 (aged 24)","Degree":"29","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3128991060025543"},"color":"rgb(67,229,67)","size":19.333332061767578},{"label":"Mario Gavranovic","x":52.757667541503906,"y":247.96585083007812,"id":"453","attributes":{"Eigenvector Centrality":"0.384616160215653","Betweenness Centrality":"0.0","Appearances":"11","No":"17","Country":"Switzerland","Club Country":"Switzerland","Club":"Zürich","Weighted Degree":"22.0","Modularity Class":"0","Date of birth / Age":"24 November 1989 (aged 24)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2922465208747515"},"color":"rgb(164,229,67)","size":10.0},{"label":"Fabian Schär","x":38.15908432006836,"y":161.535400390625,"id":"215","attributes":{"Eigenvector Centrality":"0.4279165187640593","Betweenness Centrality":"0.0017015426628181239","Appearances":"6","No":"22","Country":"Switzerland","Club Country":"Switzerland","Club":"Basel","Weighted Degree":"25.0","Modularity Class":"0","Date of birth / Age":"20 December 1991 (aged 22)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31038851351351354"},"color":"rgb(164,229,67)","size":14.0},{"label":"Faryd Mondragón","x":-825.1312255859375,"y":1158.5755615234375,"id":"219","attributes":{"Eigenvector Centrality":"0.313949251078916","Betweenness Centrality":"0.0","Appearances":"50","No":"22","Country":"Colombia","Club Country":"Colombia","Club":"Deportivo Cali","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"21 June 1971 (aged 42)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Agustín Orión","x":-1115.8746337890625,"y":250.34307861328125,"id":"12","attributes":{"Eigenvector Centrality":"0.47565077145164436","Betweenness Centrality":"0.0","Appearances":"3","No":"12","Country":"Argentina","Club Country":"Argentina","Club":"Boca Juniors","Weighted Degree":"22.0","Modularity Class":"19","Date of birth / Age":"26 July 1981 (aged 32)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2930622009569378"},"color":"rgb(67,229,229)","size":10.0},{"label":"Lazaros Christodoulopoulos","x":1501.577880859375,"y":504.683837890625,"id":"410","attributes":{"Eigenvector Centrality":"0.27279029487191714","Betweenness Centrality":"0.003339511771537693","Appearances":"19","No":"16","Country":"Greece","Club Country":"Italy","Club":"Bologna","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"19 December 1986 (aged 27)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2955367913148371"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Gökhan Inler (c)","x":-228.7349853515625,"y":213.2960662841797,"id":"260","attributes":{"Eigenvector Centrality":"0.6153709092825858","Betweenness Centrality":"0.004199284588766183","Appearances":"73","No":"8","Country":"Switzerland","Club Country":"Italy","Club":"Napoli","Weighted Degree":"31.0","Modularity Class":"0","Date of birth / Age":"27 June 1984 (aged 29)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3331822302810517"},"color":"rgb(164,229,67)","size":22.0},{"label":"Makoto Hasebe (c)","x":672.8050537109375,"y":505.12762451171875,"id":"438","attributes":{"Eigenvector Centrality":"0.34512034913799255","Betweenness Centrality":"0.003186055679065411","Appearances":"78","No":"17","Country":"Japan","Club Country":"Germany","Club":"1. FC Nürnberg","Weighted Degree":"24.0","Modularity Class":"27","Date of birth / Age":"18 January 1984 (aged 30)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3237885462555066"},"color":"rgb(67,100,229)","size":12.666666984558105},{"label":"Pierre Webó","x":292.5826721191406,"y":67.77238464355469,"id":"579","attributes":{"Eigenvector Centrality":"0.3844635752484932","Betweenness Centrality":"0.004484998410532358","Appearances":"56","No":"15","Country":"Cameroon","Club Country":"Turkey","Club":"Fenerbahçe","Weighted Degree":"26.0","Modularity Class":"17","Date of birth / Age":"20 January 1982 (aged 32)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3312302839116719"},"color":"rgb(67,132,229)","size":15.333333969116211},{"label":"Philipp Lahm (c)","x":350.3982849121094,"y":-483.0366516113281,"id":"577","attributes":{"Eigenvector Centrality":"0.6585766805388437","Betweenness Centrality":"0.0026429368589338613","Appearances":"106","No":"16","Country":"Germany","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"11 November 1983 (aged 30)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3390221402214022"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Senad Lulic","x":921.6593627929688,"y":-424.2279052734375,"id":"636","attributes":{"Eigenvector Centrality":"0.39543615259664133","Betweenness Centrality":"0.012993279574519087","Appearances":"33","No":"16","Country":"Bosnia and Herzegovina","Club Country":"Italy","Club":"Lazio","Weighted Degree":"28.0","Modularity Class":"20","Date of birth / Age":"18 January 1986 (aged 28)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3447467166979362"},"color":"rgb(132,229,67)","size":18.0},{"label":"Benedikt Höwedes","x":472.64324951171875,"y":-229.064208984375,"id":"82","attributes":{"Eigenvector Centrality":"0.5529715553555452","Betweenness Centrality":"0.006227653676219969","Appearances":"21","No":"4","Country":"Germany","Club Country":"Germany","Club":"Schalke \u002704","Weighted Degree":"27.0","Modularity Class":"13","Date of birth / Age":"29 February 1988 (aged 26)","Degree":"27","Position":"DF","Eccentricity":"4.0","Closeness Centrality":"0.3353102189781022"},"color":"rgb(67,229,164)","size":16.666667938232422},{"label":"Kostas Manolas","x":1643.82080078125,"y":458.0362854003906,"id":"401","attributes":{"Eigenvector Centrality":"0.26975900975025197","Betweenness Centrality":"0.0018881692306353887","Appearances":"9","No":"4","Country":"Greece","Club Country":"Greece","Club":"Olympiacos","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"14 June 1991 (aged 22)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2878965922444183"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Fabián Orellana","x":-331.134033203125,"y":1411.263916015625,"id":"214","attributes":{"Eigenvector Centrality":"0.3330736796416985","Betweenness Centrality":"0.001077331406628747","Appearances":"26","No":"14","Country":"Chile","Club Country":"Spain","Club":"Celta Vigo","Weighted Degree":"23.0","Modularity Class":"18","Date of birth / Age":"27 January 1986 (aged 28)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.2851047323506594"},"color":"rgb(229,132,67)","size":11.333333015441895},{"label":"Donis Escober","x":1653.1510009765625,"y":-1192.211181640625,"id":"176","attributes":{"Eigenvector Centrality":"0.23664887946331797","Betweenness Centrality":"0.0","Appearances":"26","No":"22","Country":"Honduras","Club Country":"Honduras","Club":"Olimpia","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"3 February 1980 (aged 34)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Ricardo Costa","x":-699.53125,"y":481.9271545410156,"id":"601","attributes":{"Eigenvector Centrality":"0.4540996988101741","Betweenness Centrality":"0.0033859990894464925","Appearances":"19","No":"13","Country":"Portugal","Club Country":"Spain","Club":"Valencia","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"16 May 1981 (aged 33)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.32507739938080493"},"color":"rgb(229,164,67)","size":14.0},{"label":"Ezequiel Garay","x":-1064.4405517578125,"y":219.3739471435547,"id":"211","attributes":{"Eigenvector Centrality":"0.5249878217996955","Betweenness Centrality":"8.46487079105798E-4","Appearances":"18","No":"2","Country":"Argentina","Club Country":"Portugal","Club":"Benfica","Weighted Degree":"25.0","Modularity Class":"19","Date of birth / Age":"10 October 1986 (aged 27)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3084347461183382"},"color":"rgb(67,229,229)","size":14.0},{"label":"Alexis Sánchez","x":-613.0529174804688,"y":828.0868530273438,"id":"33","attributes":{"Eigenvector Centrality":"0.7577535645406533","Betweenness Centrality":"0.017626870894997412","Appearances":"67","No":"7","Country":"Chile","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"37.0","Modularity Class":"18","Date of birth / Age":"19 December 1988 (aged 25)","Degree":"37","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.31599312123817713"},"color":"rgb(229,132,67)","size":30.0},{"label":"Fernando Torres","x":-744.5380249023438,"y":-446.9110107421875,"id":"227","attributes":{"Eigenvector Centrality":"0.9333483233206638","Betweenness Centrality":"0.002581134642452991","Appearances":"107","No":"9","Country":"Spain","Club Country":"England","Club":"Chelsea","Weighted Degree":"32.0","Modularity Class":"23","Date of birth / Age":"20 March 1984 (aged 30)","Degree":"32","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.34186046511627904"},"color":"rgb(229,67,197)","size":23.33333396911621},{"label":"Gonzalo Higuaín","x":-976.8049926757812,"y":255.48199462890625,"id":"261","attributes":{"Eigenvector Centrality":"0.7220713713108181","Betweenness Centrality":"0.003097438956551802","Appearances":"36","No":"9","Country":"Argentina","Club Country":"Italy","Club":"Napoli","Weighted Degree":"32.0","Modularity Class":"19","Date of birth / Age":"10 December 1987 (aged 26)","Degree":"32","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3313796212804328"},"color":"rgb(67,229,229)","size":23.33333396911621},{"label":"Ehsan Hajsafi","x":1992.868408203125,"y":1102.4462890625,"id":"192","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"62","No":"3","Country":"Iran","Club Country":"Iran","Club":"Sepahan","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"25 February 1990 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Bruno Alves","x":-538.8344116210938,"y":183.03184509277344,"id":"93","attributes":{"Eigenvector Centrality":"0.45315937558107916","Betweenness Centrality":"0.0029488481093627983","Appearances":"72","No":"2","Country":"Portugal","Club Country":"Turkey","Club":"Fenerbahçe","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"27 November 1981 (aged 32)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3295964125560538"},"color":"rgb(229,164,67)","size":14.0},{"label":"Nicolas N\u0027Koulou","x":368.8940734863281,"y":227.7928924560547,"id":"533","attributes":{"Eigenvector Centrality":"0.3530552378369678","Betweenness Centrality":"0.004082717349656557","Appearances":"48","No":"3","Country":"Cameroon","Club Country":"France","Club":"Marseille","Weighted Degree":"24.0","Modularity Class":"17","Date of birth / Age":"27 March 1990 (aged 24)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.32856504246759055"},"color":"rgb(67,132,229)","size":12.666666984558105},{"label":"Olivier Giroud","x":-51.68798065185547,"y":-320.7739562988281,"id":"543","attributes":{"Eigenvector Centrality":"0.6518193073443905","Betweenness Centrality":"0.0017629955601543275","Appearances":"30","No":"9","Country":"France","Club Country":"England","Club":"Arsenal","Weighted Degree":"29.0","Modularity Class":"16","Date of birth / Age":"30 September 1986 (aged 27)","Degree":"29","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.3262316910785619"},"color":"rgb(229,67,229)","size":19.333332061767578},{"label":"Carlo Costly","x":1569.5697021484375,"y":-1167.26904296875,"id":"98","attributes":{"Eigenvector Centrality":"0.23664887946331803","Betweenness Centrality":"0.0","Appearances":"70","No":"13","Country":"Honduras","Club Country":"Honduras","Club":"Real España","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"18 July 1982 (aged 31)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Joseph Yobo (c)","x":3.398852586746216,"y":-1540.3546142578125,"id":"363","attributes":{"Eigenvector Centrality":"0.31894295086009894","Betweenness Centrality":"0.001459927835720332","Appearances":"97","No":"2","Country":"Nigeria","Club Country":"England","Club":"Norwich City","Weighted Degree":"23.0","Modularity Class":"14","Date of birth / Age":"6 September 1980 (aged 33)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30359355638166047"},"color":"rgb(67,229,100)","size":11.333333015441895},{"label":"Ángel di María","x":-968.576416015625,"y":161.4849395751953,"id":"54","attributes":{"Eigenvector Centrality":"0.7593130725565046","Betweenness Centrality":"0.0038213005480664053","Appearances":"47","No":"7","Country":"Argentina","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"33.0","Modularity Class":"19","Date of birth / Age":"14 February 1988 (aged 26)","Degree":"33","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.32450331125827814"},"color":"rgb(67,229,229)","size":24.666667938232422},{"label":"Jordy Clasie","x":920.4804077148438,"y":7.3684821128845215,"id":"350","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"8","No":"16","Country":"Netherlands","Club Country":"Netherlands","Club":"Feyenoord","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"27 June 1991 (aged 22)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"Steve von Bergen","x":10.285480499267578,"y":206.5318145751953,"id":"665","attributes":{"Eigenvector Centrality":"0.384616160215653","Betweenness Centrality":"0.0","Appearances":"41","No":"5","Country":"Switzerland","Club Country":"Switzerland","Club":"Young Boys","Weighted Degree":"22.0","Modularity Class":"0","Date of birth / Age":"10 June 1983 (aged 31)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2922465208747515"},"color":"rgb(164,229,67)","size":10.0},{"label":"Jorge Claros","x":1693.2894287109375,"y":-1172.8018798828125,"id":"351","attributes":{"Eigenvector Centrality":"0.23664887946331803","Betweenness Centrality":"0.0","Appearances":"49","No":"20","Country":"Honduras","Club Country":"Honduras","Club":"Motagua","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"8 January 1986 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Afriyie Acquah","x":358.2573547363281,"y":1238.4801025390625,"id":"11","attributes":{"Eigenvector Centrality":"0.3547601242424494","Betweenness Centrality":"0.0031553330963140233","Appearances":"5","No":"6","Country":"Ghana","Club Country":"Italy","Club":"Parma","Weighted Degree":"26.0","Modularity Class":"5","Date of birth / Age":"5 January 1992 (aged 22)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3001224989791752"},"color":"rgb(67,229,197)","size":15.333333969116211},{"label":"Godfrey Oboabona","x":9.590389251708984,"y":-1597.5946044921875,"id":"259","attributes":{"Eigenvector Centrality":"0.3182459136756436","Betweenness Centrality":"0.0012640880568401147","Appearances":"35","No":"14","Country":"Nigeria","Club Country":"Turkey","Club":"Çaykur Rizespor","Weighted Degree":"23.0","Modularity Class":"14","Date of birth / Age":"16 August 1990 (aged 23)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3007364975450082"},"color":"rgb(67,229,100)","size":11.333333015441895},{"label":"Chris Smalling","x":-375.0207214355469,"y":-737.6563720703125,"id":"116","attributes":{"Eigenvector Centrality":"0.7938188270448313","Betweenness Centrality":"0.0038886080479693477","Appearances":"12","No":"12","Country":"England","Club Country":"England","Club":"Manchester United","Weighted Degree":"32.0","Modularity Class":"28","Date of birth / Age":"22 November 1989 (aged 24)","Degree":"32","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3393351800554017"},"color":"rgb(67,229,132)","size":23.33333396911621},{"label":"Shinji Okazaki","x":873.31982421875,"y":703.7589721679688,"id":"647","attributes":{"Eigenvector Centrality":"0.3658451426994684","Betweenness Centrality":"0.01364644508084283","Appearances":"76","No":"9","Country":"Japan","Club Country":"Germany","Club":"Mainz 05","Weighted Degree":"26.0","Modularity Class":"27","Date of birth / Age":"16 April 1986 (aged 28)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3313796212804328"},"color":"rgb(67,100,229)","size":15.333333969116211},{"label":"Panagiotis Kone","x":1535.2935791015625,"y":466.85699462890625,"id":"557","attributes":{"Eigenvector Centrality":"0.27279029487191714","Betweenness Centrality":"0.003339511771537693","Appearances":"16","No":"8","Country":"Greece","Club Country":"Italy","Club":"Bologna","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"26 July 1987 (aged 26)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2955367913148371"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Michel Vorm","x":868.7987060546875,"y":-56.30570602416992,"id":"507","attributes":{"Eigenvector Centrality":"0.34815687766993364","Betweenness Centrality":"0.0010475901113017954","Appearances":"14","No":"22","Country":"Netherlands","Club Country":"Wales","Club":"Swansea City","Weighted Degree":"23.0","Modularity Class":"22","Date of birth / Age":"3 October 1983 (aged 30)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.31873373807458805"},"color":"rgb(197,67,229)","size":11.333333015441895},{"label":"Moussa Sissoko","x":49.93161392211914,"y":-364.4847106933594,"id":"523","attributes":{"Eigenvector Centrality":"0.5292224497836602","Betweenness Centrality":"0.0019647591823339743","Appearances":"17","No":"18","Country":"France","Club Country":"England","Club":"Newcastle United","Weighted Degree":"25.0","Modularity Class":"16","Date of birth / Age":"16 August 1989 (aged 24)","Degree":"25","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3315290933694181"},"color":"rgb(229,67,229)","size":14.0},{"label":"Haris Medunjanin","x":1200.25390625,"y":-418.5536193847656,"id":"270","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"35","No":"18","Country":"Bosnia and Herzegovina","Club Country":"Turkey","Club":"Gaziantepspor","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"8 March 1985 (aged 29)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Jasmin Fejzic","x":1170.343505859375,"y":-544.86572265625,"id":"312","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"0","No":"12","Country":"Bosnia and Herzegovina","Club Country":"Germany","Club":"VfR Aalen","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"15 May 1986 (aged 28)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Mohammed Rabiu","x":577.3356323242188,"y":1315.146484375,"id":"520","attributes":{"Eigenvector Centrality":"0.3006021575032019","Betweenness Centrality":"0.008146054895944195","Appearances":"17","No":"17","Country":"Ghana","Club Country":"Russia","Club":"Kuban Krasnodar","Weighted Degree":"23.0","Modularity Class":"5","Date of birth / Age":"31 December 1989 (aged 24)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.29720986655883547"},"color":"rgb(67,229,197)","size":11.333333015441895},{"label":"Morgan Schneiderlin","x":8.893564224243164,"y":-207.0862274169922,"id":"521","attributes":{"Eigenvector Centrality":"0.5951644353181168","Betweenness Centrality":"0.003380555121507494","Appearances":"1","No":"22","Country":"France","Club Country":"England","Club":"Southampton","Weighted Degree":"28.0","Modularity Class":"16","Date of birth / Age":"8 November 1989 (aged 24)","Degree":"28","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.32989228007181326"},"color":"rgb(229,67,229)","size":18.0},{"label":"Xabi Alonso","x":-899.6201171875,"y":-193.28744506835938,"id":"719","attributes":{"Eigenvector Centrality":"0.904011259559127","Betweenness Centrality":"0.001687861941424018","Appearances":"111","No":"14","Country":"Spain","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"25 November 1981 (aged 32)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3350045578851413"},"color":"rgb(229,67,197)","size":22.0},{"label":"Sergio Ramos","x":-838.3143310546875,"y":-237.3342742919922,"id":"644","attributes":{"Eigenvector Centrality":"0.9040112595591273","Betweenness Centrality":"0.001687861941424018","Appearances":"117","No":"15","Country":"Spain","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"30 March 1986 (aged 28)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3350045578851413"},"color":"rgb(229,67,197)","size":22.0},{"label":"Mauricio Pinilla","x":-356.00860595703125,"y":1526.689208984375,"id":"484","attributes":{"Eigenvector Centrality":"0.32867119536836353","Betweenness Centrality":"0.0016022418362757359","Appearances":"27","No":"9","Country":"Chile","Club Country":"Italy","Club":"Cagliari","Weighted Degree":"23.0","Modularity Class":"18","Date of birth / Age":"4 February 1984 (aged 30)","Degree":"23","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.2854368932038835"},"color":"rgb(229,132,67)","size":11.333333015441895},{"label":"Giovani dos Santos","x":-2058.406494140625,"y":426.6941833496094,"id":"256","attributes":{"Eigenvector Centrality":"0.2771264523867947","Betweenness Centrality":"0.0","Appearances":"76","No":"10","Country":"Mexico","Club Country":"Spain","Club":"Villarreal","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"11 May 1989 (aged 25)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Sebastián Coates","x":-52.67010498046875,"y":55.84718322753906,"id":"634","attributes":{"Eigenvector Centrality":"0.37564528732258257","Betweenness Centrality":"0.0","Appearances":"15","No":"19","Country":"Uruguay","Club Country":"Uruguay","Club":"Nacional","Weighted Degree":"22.0","Modularity Class":"6","Date of birth / Age":"7 October 1990 (aged 23)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3121019108280255"},"color":"rgb(229,197,67)","size":10.0},{"label":"Rodrigo Palacio","x":-1056.1539306640625,"y":433.82733154296875,"id":"608","attributes":{"Eigenvector Centrality":"0.5658107599692683","Betweenness Centrality":"0.0025393109943757006","Appearances":"22","No":"18","Country":"Argentina","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"27.0","Modularity Class":"19","Date of birth / Age":"5 February 1982 (aged 32)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3272484416740873"},"color":"rgb(67,229,229)","size":16.666667938232422},{"label":"Pejman Montazeri","x":2022.994140625,"y":1015.429931640625,"id":"570","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"22","No":"15","Country":"Iran","Club Country":"Qatar","Club":"Umm Salal","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"6 September 1983 (aged 30)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Osman Chávez","x":1657.87158203125,"y":-1139.41357421875,"id":"551","attributes":{"Eigenvector Centrality":"0.23664887946331795","Betweenness Centrality":"0.0","Appearances":"54","No":"2","Country":"Honduras","Club Country":"China","Club":"Qingdao Jonoon","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"29 July 1984 (aged 29)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Kim Shin-wook","x":1231.204833984375,"y":1679.30859375,"id":"394","attributes":{"Eigenvector Centrality":"0.23152559498868786","Betweenness Centrality":"0.0","Appearances":"27","No":"18","Country":"South Korea","Club Country":"South Korea","Club":"Ulsan Hyundai","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"14 April 1988 (aged 26)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Khosro Heydari","x":2085.276611328125,"y":1118.5545654296875,"id":"389","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"49","No":"2","Country":"Iran","Club Country":"Iran","Club":"Esteghlal","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"14 September 1983 (aged 30)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Diego Costa","x":-946.3432006835938,"y":-379.19134521484375,"id":"164","attributes":{"Eigenvector Centrality":"0.7852248920099726","Betweenness Centrality":"7.220203040676876E-4","Appearances":"2","No":"19","Country":"Spain","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"27.0","Modularity Class":"23","Date of birth / Age":"7 October 1988 (aged 25)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3215223097112861"},"color":"rgb(229,67,197)","size":16.666667938232422},{"label":"Hiroki Sakai","x":714.5648803710938,"y":462.325927734375,"id":"281","attributes":{"Eigenvector Centrality":"0.3477183857332478","Betweenness Centrality":"0.0032794346304893863","Appearances":"18","No":"21","Country":"Japan","Club Country":"Germany","Club":"Hannover 96","Weighted Degree":"24.0","Modularity Class":"27","Date of birth / Age":"12 April 1990 (aged 24)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(67,100,229)","size":12.666666984558105},{"label":"Mario Mandžukic","x":-149.63389587402344,"y":325.6033020019531,"id":"455","attributes":{"Eigenvector Centrality":"0.663406558743265","Betweenness Centrality":"0.010037273598114245","Appearances":"50","No":"17","Country":"Croatia","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"35.0","Modularity Class":"25","Date of birth / Age":"21 May 1986 (aged 28)","Degree":"35","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(132,67,229)","size":27.33333396911621},{"label":"Ashkan Dejagah","x":1842.160400390625,"y":978.629150390625,"id":"66","attributes":{"Eigenvector Centrality":"0.23463431563555487","Betweenness Centrality":"0.021760525958165706","Appearances":"14","No":"21","Country":"Iran","Club Country":"England","Club":"Fulham","Weighted Degree":"24.0","Modularity Class":"1","Date of birth / Age":"5 July 1986 (aged 27)","Degree":"24","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.2317880794701987"},"color":"rgb(67,197,229)","size":12.666666984558105},{"label":"Philippe Senderos","x":-84.25211334228516,"y":385.70135498046875,"id":"578","attributes":{"Eigenvector Centrality":"0.44557482377385943","Betweenness Centrality":"0.0032141732482156185","Appearances":"53","No":"4","Country":"Switzerland","Club Country":"Spain","Club":"Valencia","Weighted Degree":"26.0","Modularity Class":"0","Date of birth / Age":"14 February 1985 (aged 29)","Degree":"26","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31558608844997854"},"color":"rgb(164,229,67)","size":15.333333969116211},{"label":"Massimo Luongo","x":2135.375244140625,"y":-676.9358520507812,"id":"468","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"1","No":"21","Country":"Australia","Club Country":"England","Club":"Swindon Town","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"25 September 1992 (aged 21)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Ivan Franjic","x":2090.4951171875,"y":-571.4816284179688,"id":"298","attributes":{"Eigenvector Centrality":"0.22132294330055013","Betweenness Centrality":"0.0","Appearances":"9","No":"2","Country":"Australia","Club Country":"Australia","Club":"Brisbane Roar","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"10 September 1987 (aged 26)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Joël Matip","x":540.7796630859375,"y":139.5815887451172,"id":"337","attributes":{"Eigenvector Centrality":"0.4237417749913705","Betweenness Centrality":"0.007099320902674921","Appearances":"23","No":"21","Country":"Cameroon","Club Country":"Germany","Club":"Schalke \u002704","Weighted Degree":"28.0","Modularity Class":"17","Date of birth / Age":"8 August 1991 (aged 22)","Degree":"28","Position":"MF","Eccentricity":"4.0","Closeness Centrality":"0.3452325035227807"},"color":"rgb(67,132,229)","size":18.0},{"label":"Michael Bradley","x":721.9478759765625,"y":-1477.4307861328125,"id":"502","attributes":{"Eigenvector Centrality":"0.29057372512473595","Betweenness Centrality":"0.0021113417181140752","Appearances":"86","No":"4","Country":"United States","Club Country":"Canada","Club":"Toronto FC","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"31 July 1987 (aged 26)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.29829545454545453"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"Fredy Guarín","x":-787.8544311523438,"y":1018.7176513671875,"id":"234","attributes":{"Eigenvector Centrality":"0.44651895950904885","Betweenness Centrality":"0.006124835129264176","Appearances":"49","No":"13","Country":"Colombia","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"29.0","Modularity Class":"11","Date of birth / Age":"30 June 1986 (aged 27)","Degree":"29","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.32579787234042556"},"color":"rgb(67,67,229)","size":19.333332061767578},{"label":"Júlio César","x":-374.46234130859375,"y":-336.2733154296875,"id":"376","attributes":{"Eigenvector Centrality":"0.554070122482655","Betweenness Centrality":"0.002682419843539279","Appearances":"80","No":"12","Country":"Brazil","Club Country":"Canada","Club":"Toronto FC","Weighted Degree":"23.0","Modularity Class":"23","Date of birth / Age":"3 September 1979 (aged 34)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.32579787234042556"},"color":"rgb(229,67,197)","size":11.333333015441895},{"label":"Robin van Persie (c)","x":425.4057312011719,"y":-117.818603515625,"id":"606","attributes":{"Eigenvector Centrality":"0.6930127535568564","Betweenness Centrality":"0.016157179699501083","Appearances":"85","No":"9","Country":"Netherlands","Club Country":"England","Club":"Manchester United","Weighted Degree":"35.0","Modularity Class":"22","Date of birth / Age":"6 August 1983 (aged 30)","Degree":"35","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.349002849002849"},"color":"rgb(197,67,229)","size":27.33333396911621},{"label":"Mariano Andújar","x":-1186.145263671875,"y":246.04403686523438,"id":"451","attributes":{"Eigenvector Centrality":"0.47565077145164436","Betweenness Centrality":"0.0","Appearances":"10","No":"21","Country":"Argentina","Club Country":"Italy","Club":"Catania","Weighted Degree":"22.0","Modularity Class":"19","Date of birth / Age":"30 July 1983 (aged 30)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2930622009569378"},"color":"rgb(67,229,229)","size":10.0},{"label":"Lee Chung-yong","x":1146.0408935546875,"y":1647.960205078125,"id":"412","attributes":{"Eigenvector Centrality":"0.23152559498868786","Betweenness Centrality":"0.0","Appearances":"55","No":"17","Country":"South Korea","Club Country":"England","Club":"Bolton Wanderers","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"2 July 1988 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Andranik Teymourian","x":1940.65771484375,"y":1114.891357421875,"id":"41","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"79","No":"14","Country":"Iran","Club Country":"Iran","Club":"Esteghlal","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"6 March 1983 (aged 31)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Sammy Bossut","x":-665.6251831054688,"y":-835.4097900390625,"id":"625","attributes":{"Eigenvector Centrality":"0.5344280608201899","Betweenness Centrality":"0.001607259967508427","Appearances":"0","No":"13","Country":"Belgium","Club Country":"Belgium","Club":"Zulte Waregem","Weighted Degree":"23.0","Modularity Class":"28","Date of birth / Age":"11 August 1985 (aged 28)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3343949044585987"},"color":"rgb(67,229,132)","size":11.333333015441895},{"label":"Juan Mata","x":-837.1373291015625,"y":-428.5978088378906,"id":"371","attributes":{"Eigenvector Centrality":"1.0","Betweenness Centrality":"0.005194225936839837","Appearances":"33","No":"13","Country":"Spain","Club Country":"England","Club":"Manchester United","Weighted Degree":"34.0","Modularity Class":"23","Date of birth / Age":"28 April 1988 (aged 26)","Degree":"34","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3478466635115949"},"color":"rgb(229,67,197)","size":26.0},{"label":"Faouzi Ghoulam","x":-1163.78857421875,"y":887.729736328125,"id":"218","attributes":{"Eigenvector Centrality":"0.571120930615696","Betweenness Centrality":"0.011614602667759096","Appearances":"6","No":"3","Country":"Algeria","Club Country":"Italy","Club":"Napoli","Weighted Degree":"33.0","Modularity Class":"24","Date of birth / Age":"1 February 1991 (aged 23)","Degree":"33","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3282715497990174"},"color":"rgb(67,164,229)","size":24.666667938232422},{"label":"Kenneth Omeruo","x":-33.326751708984375,"y":-1484.3856201171875,"id":"383","attributes":{"Eigenvector Centrality":"0.3177111385028752","Betweenness Centrality":"0.0033306119897154834","Appearances":"17","No":"22","Country":"Nigeria","Club Country":"England","Club":"Middlesbrough","Weighted Degree":"23.0","Modularity Class":"14","Date of birth / Age":"17 October 1993 (aged 20)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30222039473684215"},"color":"rgb(67,229,100)","size":11.333333015441895},{"label":"Yann Sommer","x":110.02254486083984,"y":216.66073608398438,"id":"723","attributes":{"Eigenvector Centrality":"0.4279165187640593","Betweenness Centrality":"0.0017015426628181239","Appearances":"6","No":"12","Country":"Switzerland","Club Country":"Switzerland","Club":"Basel","Weighted Degree":"25.0","Modularity Class":"0","Date of birth / Age":"17 December 1988 (aged 25)","Degree":"25","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.31038851351351354"},"color":"rgb(164,229,67)","size":14.0},{"label":"Park Jong-woo","x":1236.085205078125,"y":1634.40380859375,"id":"560","attributes":{"Eigenvector Centrality":"0.2315255949886878","Betweenness Centrality":"0.0","Appearances":"10","No":"15","Country":"South Korea","Club Country":"China","Club":"Guangzhou R\u0026F","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"10 March 1989 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Arthur Boka","x":447.86834716796875,"y":-798.1806030273438,"id":"63","attributes":{"Eigenvector Centrality":"0.35099862946861243","Betweenness Centrality":"0.008388572053063042","Appearances":"78","No":"3","Country":"Ivory Coast","Club Country":"Germany","Club":"VfB Stuttgart","Weighted Degree":"25.0","Modularity Class":"9","Date of birth / Age":"2 April 1983 (aged 31)","Degree":"25","Position":"DF","Eccentricity":"4.0","Closeness Centrality":"0.32407407407407407"},"color":"rgb(164,67,229)","size":14.0},{"label":"Eiji Kawashima","x":599.2489624023438,"y":588.3504638671875,"id":"193","attributes":{"Eigenvector Centrality":"0.34852679481914073","Betweenness Centrality":"0.0021785252251571444","Appearances":"56","No":"1","Country":"Japan","Club Country":"Belgium","Club":"Standard Liège","Weighted Degree":"24.0","Modularity Class":"27","Date of birth / Age":"20 March 1983 (aged 31)","Degree":"24","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3249336870026525"},"color":"rgb(67,100,229)","size":12.666666984558105},{"label":"Javier Hernández","x":-1606.5635986328125,"y":123.67082214355469,"id":"318","attributes":{"Eigenvector Centrality":"0.6365445749365468","Betweenness Centrality":"0.02191152925089069","Appearances":"62","No":"14","Country":"Mexico","Club Country":"England","Club":"Manchester United","Weighted Degree":"35.0","Modularity Class":"21","Date of birth / Age":"1 June 1988 (aged 26)","Degree":"35","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.3211009174311927"},"color":"rgb(67,229,67)","size":27.33333396911621},{"label":"Terence Kongolo","x":966.4187622070312,"y":-4.162721157073975,"id":"673","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"1","No":"14","Country":"Netherlands","Club Country":"Netherlands","Club":"Feyenoord","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"14 February 1994 (aged 20)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"Fabian Johnson","x":879.2975463867188,"y":-1453.8760986328125,"id":"213","attributes":{"Eigenvector Centrality":"0.28349810265891734","Betweenness Centrality":"0.002395894042282543","Appearances":"22","No":"23","Country":"United States","Club Country":"Germany","Club":"1899 Hoffenheim","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"11 December 1987 (aged 26)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2973300970873787"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"Mehdi Mostefa","x":-1480.4698486328125,"y":1115.907470703125,"id":"494","attributes":{"Eigenvector Centrality":"0.30735480949810884","Betweenness Centrality":"0.001735065078748807","Appearances":"23","No":"22","Country":"Algeria","Club Country":"France","Club":"Ajaccio","Weighted Degree":"23.0","Modularity Class":"24","Date of birth / Age":"30 August 1983 (aged 30)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.29178245335450576"},"color":"rgb(67,164,229)","size":11.333333015441895},{"label":"Andrés Guardado","x":-1822.0682373046875,"y":449.0326232910156,"id":"49","attributes":{"Eigenvector Centrality":"0.2999622703453746","Betweenness Centrality":"0.009651872776145686","Appearances":"104","No":"18","Country":"Mexico","Club Country":"Germany","Club":"Bayer Leverkusen","Weighted Degree":"24.0","Modularity Class":"21","Date of birth / Age":"28 September 1986 (aged 27)","Degree":"24","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.28982649842271296"},"color":"rgb(67,229,67)","size":12.666666984558105},{"label":"Maksim Kanunnikov","x":-1315.3818359375,"y":-1323.4705810546875,"id":"439","attributes":{"Eigenvector Centrality":"0.2784495406871368","Betweenness Centrality":"0.0019868644316807485","Appearances":"2","No":"6","Country":"Russia","Club Country":"Russia","Club":"Rubin Kazan","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"14 July 1991 (aged 22)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.256186824677588"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Edin Višca","x":1198.7845458984375,"y":-465.6673889160156,"id":"184","attributes":{"Eigenvector Centrality":"0.28396954172011374","Betweenness Centrality":"0.0","Appearances":"10","No":"19","Country":"Bosnia and Herzegovina","Club Country":"Turkey","Club":"?stanbul Ba?ak?ehir","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"17 February 1990 (aged 24)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Pablo Armero","x":-854.2186889648438,"y":1249.3016357421875,"id":"554","attributes":{"Eigenvector Centrality":"0.31394925107891597","Betweenness Centrality":"0.0","Appearances":"53","No":"7","Country":"Colombia","Club Country":"England","Club":"West Ham United","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"2 November 1986 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Dario Vidošic","x":2016.283203125,"y":-666.3252563476562,"id":"148","attributes":{"Eigenvector Centrality":"0.22132294330055013","Betweenness Centrality":"0.0","Appearances":"23","No":"20","Country":"Australia","Club Country":"Switzerland","Club":"Sion","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"8 April 1987 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Theofanis Gekas","x":1527.901123046875,"y":552.6124267578125,"id":"674","attributes":{"Eigenvector Centrality":"0.27085145055391363","Betweenness Centrality":"0.002908370966594667","Appearances":"72","No":"17","Country":"Greece","Club Country":"Turkey","Club":"Konyaspor","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"23 May 1980 (aged 34)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2961321514907333"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Paul Aguilar","x":-2114.9287109375,"y":482.1558532714844,"id":"564","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"30","No":"22","Country":"Mexico","Club Country":"Mexico","Club":"América","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"6 March 1986 (aged 28)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Karim Benzema","x":-255.21575927734375,"y":-165.30316162109375,"id":"381","attributes":{"Eigenvector Centrality":"0.7424885429812043","Betweenness Centrality":"0.0035273454232103265","Appearances":"66","No":"10","Country":"France","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"32.0","Modularity Class":"16","Date of birth / Age":"19 December 1987 (aged 26)","Degree":"32","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.33576975788031066"},"color":"rgb(229,67,229)","size":23.33333396911621},{"label":"Vedad Ibiševic","x":1011.349853515625,"y":-507.7367248535156,"id":"697","attributes":{"Eigenvector Centrality":"0.32601187536143794","Betweenness Centrality":"0.009130368482483735","Appearances":"55","No":"9","Country":"Bosnia and Herzegovina","Club Country":"Germany","Club":"VfB Stuttgart","Weighted Degree":"25.0","Modularity Class":"20","Date of birth / Age":"6 August 1984 (aged 29)","Degree":"25","Position":"FW","Eccentricity":"4.0","Closeness Centrality":"0.3321283325802079"},"color":"rgb(132,229,67)","size":14.0},{"label":"Jefferson Montero","x":-1599.2291259765625,"y":-622.9718627929688,"id":"324","attributes":{"Eigenvector Centrality":"0.37658875098697026","Betweenness Centrality":"0.0026941239537997667","Appearances":"40","No":"7","Country":"Ecuador","Club Country":"Mexico","Club":"Morelia","Weighted Degree":"23.0","Modularity Class":"4","Date of birth / Age":"1 September 1989 (aged 24)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30110610405571486"},"color":"rgb(229,67,132)","size":11.333333015441895},{"label":"Marco Parolo","x":223.34402465820312,"y":798.16845703125,"id":"447","attributes":{"Eigenvector Centrality":"0.44952910121457834","Betweenness Centrality":"4.3533065978638123E-4","Appearances":"4","No":"18","Country":"Italy","Club Country":"Italy","Club":"Parma","Weighted Degree":"24.0","Modularity Class":"3","Date of birth / Age":"25 January 1985 (aged 29)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30714584203928125"},"color":"rgb(197,229,67)","size":12.666666984558105},{"label":"José Rojas","x":-307.82147216796875,"y":1544.14697265625,"id":"362","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"19","No":"13","Country":"Chile","Club Country":"Chile","Club":"Universidad de Chile","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"3 June 1983 (aged 31)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Thiago Motta","x":60.09503936767578,"y":671.3873291015625,"id":"675","attributes":{"Eigenvector Centrality":"0.5779444332967031","Betweenness Centrality":"0.001710601263663759","Appearances":"20","No":"5","Country":"Italy","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"29.0","Modularity Class":"3","Date of birth / Age":"28 August 1982 (aged 31)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3166738474795347"},"color":"rgb(197,229,67)","size":19.333332061767578},{"label":"Masahiko Inoha","x":730.9411010742188,"y":583.111083984375,"id":"465","attributes":{"Eigenvector Centrality":"0.3171815377783478","Betweenness Centrality":"0.0","Appearances":"21","No":"19","Country":"Japan","Club Country":"Japan","Club":"Jubilo Iwata","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"28 August 1983 (aged 30)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Dani Alves","x":-742.1677856445312,"y":-271.697998046875,"id":"135","attributes":{"Eigenvector Centrality":"0.947563971570452","Betweenness Centrality":"0.005368122690024312","Appearances":"75","No":"2","Country":"Brazil","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"36.0","Modularity Class":"23","Date of birth / Age":"6 May 1983 (aged 31)","Degree":"36","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.34249767008387694"},"color":"rgb(229,67,197)","size":28.66666603088379},{"label":"Ryan McGowan","x":2185.520263671875,"y":-671.7802124023438,"id":"620","attributes":{"Eigenvector Centrality":"0.22132294330055013","Betweenness Centrality":"0.0","Appearances":"9","No":"19","Country":"Australia","Club Country":"China","Club":"Shandong Luneng Taishan","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"15 August 1989 (aged 24)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Lee Yong","x":1208.6063232421875,"y":1598.1090087890625,"id":"414","attributes":{"Eigenvector Centrality":"0.23152559498868786","Betweenness Centrality":"0.0","Appearances":"12","No":"12","Country":"South Korea","Club Country":"South Korea","Club":"Ulsan Hyundai","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"24 December 1986 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Antonio Candreva","x":180.96414184570312,"y":574.769287109375,"id":"58","attributes":{"Eigenvector Centrality":"0.5275205103981985","Betweenness Centrality":"0.00895640114460652","Appearances":"20","No":"6","Country":"Italy","Club Country":"Italy","Club":"Lazio","Weighted Degree":"28.0","Modularity Class":"3","Date of birth / Age":"28 February 1987 (aged 27)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33424283765347884"},"color":"rgb(197,229,67)","size":18.0},{"label":"Walter Gargano","x":-40.0959358215332,"y":145.01853942871094,"id":"711","attributes":{"Eigenvector Centrality":"0.4378381017420734","Betweenness Centrality":"0.0029785823951134294","Appearances":"63","No":"5","Country":"Uruguay","Club Country":"Italy","Club":"Parma","Weighted Degree":"26.0","Modularity Class":"6","Date of birth / Age":"23 July 1984 (aged 29)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3204010462074978"},"color":"rgb(229,197,67)","size":15.333333969116211},{"label":"Steven Defour","x":-855.4899291992188,"y":-553.7450561523438,"id":"667","attributes":{"Eigenvector Centrality":"0.6646783589767196","Betweenness Centrality":"0.008614529247819509","Appearances":"43","No":"16","Country":"Belgium","Club Country":"Portugal","Club":"Porto","Weighted Degree":"30.0","Modularity Class":"28","Date of birth / Age":"15 April 1988 (aged 26)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.35083532219570407"},"color":"rgb(67,229,132)","size":20.666667938232422},{"label":"Maxi Rodríguez","x":-1193.765625,"y":294.735595703125,"id":"487","attributes":{"Eigenvector Centrality":"0.47565077145164436","Betweenness Centrality":"0.0","Appearances":"55","No":"11","Country":"Argentina","Club Country":"Argentina","Club":"Newell\u0027s Old Boys","Weighted Degree":"22.0","Modularity Class":"19","Date of birth / Age":"2 January 1981 (aged 33)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2930622009569378"},"color":"rgb(67,229,229)","size":10.0},{"label":"Tranquillo Barnetta","x":73.72463989257812,"y":117.78337097167969,"id":"690","attributes":{"Eigenvector Centrality":"0.3971021212364907","Betweenness Centrality":"9.117937878248679E-4","Appearances":"74","No":"7","Country":"Switzerland","Club Country":"Germany","Club":"Eintracht Frankfurt","Weighted Degree":"23.0","Modularity Class":"0","Date of birth / Age":"22 May 1985 (aged 29)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3053593685085168"},"color":"rgb(164,229,67)","size":11.333333015441895},{"label":"Constant Djakpa","x":513.1433715820312,"y":-809.9959106445312,"id":"127","attributes":{"Eigenvector Centrality":"0.32415574535906994","Betweenness Centrality":"8.776465884449839E-4","Appearances":"5","No":"18","Country":"Ivory Coast","Club Country":"Germany","Club":"Eintracht Frankfurt","Weighted Degree":"23.0","Modularity Class":"9","Date of birth / Age":"17 October 1986 (aged 27)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30523255813953487"},"color":"rgb(164,67,229)","size":11.333333015441895},{"label":"Carlos Carbonero","x":-742.2178344726562,"y":1199.126220703125,"id":"100","attributes":{"Eigenvector Centrality":"0.3139492510789159","Betweenness Centrality":"0.0","Appearances":"1","No":"5","Country":"Colombia","Club Country":"Argentina","Club":"River Plate","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"25 July 1990 (aged 23)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Thiago Silva (c)","x":-361.4657287597656,"y":-169.6861114501953,"id":"676","attributes":{"Eigenvector Centrality":"0.7136149540335622","Betweenness Centrality":"0.0035076449501830744","Appearances":"46","No":"3","Country":"Brazil","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"30.0","Modularity Class":"23","Date of birth / Age":"22 September 1984 (aged 29)","Degree":"30","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3336359509759419"},"color":"rgb(229,67,197)","size":20.666667938232422},{"label":"Miroslav Klose","x":293.1423645019531,"y":-267.2074890136719,"id":"517","attributes":{"Eigenvector Centrality":"0.5811899312198234","Betweenness Centrality":"0.010562454139187511","Appearances":"132","No":"11","Country":"Germany","Club Country":"Italy","Club":"Lazio","Weighted Degree":"28.0","Modularity Class":"13","Date of birth / Age":"9 June 1978 (aged 36)","Degree":"28","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.33746556473829203"},"color":"rgb(67,229,164)","size":18.0},{"label":"Xherdan Shaqiri","x":141.72509765625,"y":12.289528846740723,"id":"721","attributes":{"Eigenvector Centrality":"0.7024966189465659","Betweenness Centrality":"0.009639109401232904","Appearances":"33","No":"23","Country":"Switzerland","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"35.0","Modularity Class":"0","Date of birth / Age":"10 October 1991 (aged 22)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3383977900552486"},"color":"rgb(164,229,67)","size":27.33333396911621},{"label":"Roman Weidenfeller","x":605.18408203125,"y":-360.4881896972656,"id":"611","attributes":{"Eigenvector Centrality":"0.5006809860242267","Betweenness Centrality":"0.008472576600609625","Appearances":"3","No":"22","Country":"Germany","Club Country":"Germany","Club":"Borussia Dortmund","Weighted Degree":"24.0","Modularity Class":"13","Date of birth / Age":"6 August 1980 (aged 33)","Degree":"24","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.310126582278481"},"color":"rgb(67,229,164)","size":12.666666984558105},{"label":"Javier Mascherano","x":-1221.532470703125,"y":91.2391586303711,"id":"319","attributes":{"Eigenvector Centrality":"0.884141666517999","Betweenness Centrality":"0.004626645517321425","Appearances":"98","No":"14","Country":"Argentina","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"36.0","Modularity Class":"19","Date of birth / Age":"8 June 1984 (aged 30)","Degree":"36","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3273942093541203"},"color":"rgb(67,229,229)","size":28.66666603088379},{"label":"Carlos Carmona","x":-345.68072509765625,"y":1473.065185546875,"id":"101","attributes":{"Eigenvector Centrality":"0.3286711953683635","Betweenness Centrality":"0.0016022418362757356","Appearances":"44","No":"6","Country":"Chile","Club Country":"Italy","Club":"Atalanta","Weighted Degree":"23.0","Modularity Class":"18","Date of birth / Age":"21 February 1987 (aged 27)","Degree":"23","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2854368932038835"},"color":"rgb(229,132,67)","size":11.333333015441895},{"label":"Liassine Cadamuro-Bentaïba","x":-1424.95849609375,"y":1185.5799560546875,"id":"418","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"7","No":"17","Country":"Algeria","Club Country":"Spain","Club":"Mallorca","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"5 March 1988 (aged 26)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Alex Oxlade-Chamberlain","x":-56.5023193359375,"y":-825.344482421875,"id":"27","attributes":{"Eigenvector Centrality":"0.706323984260769","Betweenness Centrality":"0.001711566637513174","Appearances":"15","No":"15","Country":"England","Club Country":"England","Club":"Arsenal","Weighted Degree":"30.0","Modularity Class":"28","Date of birth / Age":"15 August 1993 (aged 20)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3199825859817153"},"color":"rgb(67,229,132)","size":20.666667938232422},{"label":"Jalal Hosseini","x":2076.03515625,"y":1075.61083984375,"id":"306","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"85","No":"4","Country":"Iran","Club Country":"Iran","Club":"Persepolis","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"3 February 1982 (aged 32)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Johnny Herrera","x":-225.40228271484375,"y":1509.60302734375,"id":"344","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"8","No":"23","Country":"Chile","Club Country":"Chile","Club":"Universidad de Chile","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"9 May 1981 (aged 33)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Rafik Halliche","x":-1426.09912109375,"y":1266.290771484375,"id":"582","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"29","No":"5","Country":"Algeria","Club Country":"Portugal","Club":"Académica","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"2 September 1986 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Kim Seung-gyu","x":1189.895751953125,"y":1559.8544921875,"id":"393","attributes":{"Eigenvector Centrality":"0.23152559498868777","Betweenness Centrality":"0.0","Appearances":"5","No":"21","Country":"South Korea","Club Country":"South Korea","Club":"Ulsan Hyundai","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"30 September 1990 (aged 23)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"William Carvalho","x":-772.361083984375,"y":375.0953674316406,"id":"716","attributes":{"Eigenvector Centrality":"0.4410475661612916","Betweenness Centrality":"0.001075874410151188","Appearances":"4","No":"6","Country":"Portugal","Club Country":"Portugal","Club":"Sporting CP","Weighted Degree":"24.0","Modularity Class":"8","Date of birth / Age":"7 April 1992 (aged 22)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3185955786736021"},"color":"rgb(229,164,67)","size":12.666666984558105},{"label":"Gabriel Paletta","x":206.93821716308594,"y":845.000732421875,"id":"237","attributes":{"Eigenvector Centrality":"0.4495291012145782","Betweenness Centrality":"4.3533065978638123E-4","Appearances":"2","No":"20","Country":"Italy","Club Country":"Italy","Club":"Parma","Weighted Degree":"24.0","Modularity Class":"3","Date of birth / Age":"15 February 1986 (aged 28)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30714584203928125"},"color":"rgb(197,229,67)","size":12.666666984558105},{"label":"Keylor Navas","x":2179.6376953125,"y":330.6126708984375,"id":"388","attributes":{"Eigenvector Centrality":"0.24591596591658982","Betweenness Centrality":"0.0020809246802811297","Appearances":"53","No":"1","Country":"Costa Rica","Club Country":"Spain","Club":"Levante","Weighted Degree":"23.0","Modularity Class":"29","Date of birth / Age":"15 December 1986 (aged 27)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.26844411979547117"},"color":"rgb(229,229,67)","size":11.333333015441895},{"label":"Martín Silva","x":-0.6348667740821838,"y":1.9825427532196045,"id":"463","attributes":{"Eigenvector Centrality":"0.37564528732258246","Betweenness Centrality":"0.0","Appearances":"4","No":"23","Country":"Uruguay","Club Country":"Brazil","Club":"Vasco da Gama","Weighted Degree":"22.0","Modularity Class":"6","Date of birth / Age":"25 March 1983 (aged 31)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3121019108280255"},"color":"rgb(229,197,67)","size":10.0},{"label":"Mathieu Valbuena","x":44.39426040649414,"y":-119.34598541259766,"id":"473","attributes":{"Eigenvector Centrality":"0.5095573508334031","Betweenness Centrality":"0.0046278408281149215","Appearances":"34","No":"8","Country":"France","Club Country":"France","Club":"Marseille","Weighted Degree":"24.0","Modularity Class":"16","Date of birth / Age":"28 September 1984 (aged 29)","Degree":"24","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3247901016349978"},"color":"rgb(229,67,229)","size":12.666666984558105},{"label":"Ante Rebic","x":-308.12176513671875,"y":744.3989868164062,"id":"55","attributes":{"Eigenvector Centrality":"0.37367251459016204","Betweenness Centrality":"0.002289273069692677","Appearances":"5","No":"16","Country":"Croatia","Club Country":"Italy","Club":"Fiorentina","Weighted Degree":"24.0","Modularity Class":"25","Date of birth / Age":"21 September 1993 (aged 20)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3125"},"color":"rgb(132,67,229)","size":12.666666984558105},{"label":"Danijel Pranjic","x":-193.00035095214844,"y":612.0997924804688,"id":"142","attributes":{"Eigenvector Centrality":"0.35596191653510817","Betweenness Centrality":"0.00248185018192758","Appearances":"50","No":"3","Country":"Croatia","Club Country":"Greece","Club":"Panathinaikos","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"2 December 1981 (aged 32)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30676126878130217"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Andrey Yeshchenko","x":-1412.1168212890625,"y":-1477.236083984375,"id":"51","attributes":{"Eigenvector Centrality":"0.2656930429181982","Betweenness Centrality":"0.0","Appearances":"12","No":"22","Country":"Russia","Club Country":"Russia","Club":"Anzhi Makhachkala","Weighted Degree":"22.0","Modularity Class":"2","Date of birth / Age":"9 February 1984 (aged 30)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.23244781783681215"},"color":"rgb(229,67,67)","size":10.0},{"label":"Atsuto Uchida","x":789.1749877929688,"y":479.1142272949219,"id":"69","attributes":{"Eigenvector Centrality":"0.4182713819100073","Betweenness Centrality":"0.00731168207978959","Appearances":"68","No":"2","Country":"Japan","Club Country":"Germany","Club":"Schalke \u002704","Weighted Degree":"28.0","Modularity Class":"27","Date of birth / Age":"27 March 1988 (aged 26)","Degree":"28","Position":"DF","Eccentricity":"4.0","Closeness Centrality":"0.34329752452125173"},"color":"rgb(67,100,229)","size":18.0},{"label":"Thibaut Courtois","x":-784.1881713867188,"y":-694.4415893554688,"id":"677","attributes":{"Eigenvector Centrality":"0.6799862056462357","Betweenness Centrality":"0.0018763771735177332","Appearances":"17","No":"1","Country":"Belgium","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"29.0","Modularity Class":"28","Date of birth / Age":"11 May 1992 (aged 22)","Degree":"29","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3313796212804328"},"color":"rgb(67,229,132)","size":19.333332061767578},{"label":"John Boye","x":493.59832763671875,"y":1298.4100341796875,"id":"340","attributes":{"Eigenvector Centrality":"0.30301525489271036","Betweenness Centrality":"0.0013356812076157393","Appearances":"30","No":"21","Country":"Ghana","Club Country":"France","Club":"Rennes","Weighted Degree":"23.0","Modularity Class":"5","Date of birth / Age":"23 April 1987 (aged 27)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2984165651644336"},"color":"rgb(67,229,197)","size":11.333333015441895},{"label":"Lionel Messi (c)","x":-1133.2008056640625,"y":55.981807708740234,"id":"419","attributes":{"Eigenvector Centrality":"0.884141666517999","Betweenness Centrality":"0.004626645517321425","Appearances":"86","No":"10","Country":"Argentina","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"36.0","Modularity Class":"19","Date of birth / Age":"24 June 1987 (aged 26)","Degree":"36","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3273942093541203"},"color":"rgb(67,229,229)","size":28.66666603088379},{"label":"Mathieu Debuchy","x":14.882935523986816,"y":-313.2035827636719,"id":"472","attributes":{"Eigenvector Centrality":"0.5292224497836601","Betweenness Centrality":"0.0019647591823339743","Appearances":"21","No":"2","Country":"France","Club Country":"England","Club":"Newcastle United","Weighted Degree":"25.0","Modularity Class":"16","Date of birth / Age":"28 July 1985 (aged 28)","Degree":"25","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3315290933694181"},"color":"rgb(229,67,229)","size":14.0},{"label":"Blaise Matuidi","x":-108.93384552001953,"y":-90.56800842285156,"id":"87","attributes":{"Eigenvector Centrality":"0.6370473545952838","Betweenness Centrality":"0.001865102966313942","Appearances":"23","No":"14","Country":"France","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"29.0","Modularity Class":"16","Date of birth / Age":"9 April 1987 (aged 27)","Degree":"29","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(229,67,229)","size":19.333332061767578},{"label":"Lorenzo Insigne","x":-68.64961242675781,"y":680.9847412109375,"id":"422","attributes":{"Eigenvector Centrality":"0.6915881955717977","Betweenness Centrality":"0.008719166745740005","Appearances":"5","No":"22","Country":"Italy","Club Country":"Italy","Club":"Napoli","Weighted Degree":"33.0","Modularity Class":"3","Date of birth / Age":"4 June 1991 (aged 23)","Degree":"33","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3322784810126582"},"color":"rgb(197,229,67)","size":24.666667938232422},{"label":"Diego Calvo","x":2308.55810546875,"y":341.5826416015625,"id":"163","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"10","No":"20","Country":"Costa Rica","Club Country":"Norway","Club":"Vålerenga","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"25 March 1991 (aged 23)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Hiroshi Kiyotake","x":729.6253662109375,"y":516.7271728515625,"id":"282","attributes":{"Eigenvector Centrality":"0.34512034913799255","Betweenness Centrality":"0.003186055679065411","Appearances":"25","No":"8","Country":"Japan","Club Country":"Germany","Club":"1. FC Nürnberg","Weighted Degree":"24.0","Modularity Class":"27","Date of birth / Age":"12 November 1989 (aged 24)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3237885462555066"},"color":"rgb(67,100,229)","size":12.666666984558105},{"label":"Renato Ibarra","x":-1613.8062744140625,"y":-545.0514526367188,"id":"595","attributes":{"Eigenvector Centrality":"0.3742367393926188","Betweenness Centrality":"0.003419150984977221","Appearances":"18","No":"5","Country":"Ecuador","Club Country":"Netherlands","Club":"Vitesse","Weighted Degree":"23.0","Modularity Class":"4","Date of birth / Age":"20 January 1991 (aged 23)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3"},"color":"rgb(229,67,132)","size":11.333333015441895},{"label":"Miralem Pjanic","x":1103.220947265625,"y":-385.4655456542969,"id":"516","attributes":{"Eigenvector Centrality":"0.3489363879046361","Betweenness Centrality":"0.008708846173341396","Appearances":"48","No":"8","Country":"Bosnia and Herzegovina","Club Country":"Italy","Club":"Roma","Weighted Degree":"26.0","Modularity Class":"20","Date of birth / Age":"2 April 1990 (aged 24)","Degree":"26","Position":"MF","Eccentricity":"4.0","Closeness Centrality":"0.3385536619069553"},"color":"rgb(132,229,67)","size":15.333333969116211},{"label":"Charles Aránguiz","x":-251.59664916992188,"y":1476.45458984375,"id":"112","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"21","No":"20","Country":"Chile","Club Country":"Brazil","Club":"Internacional","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"17 April 1989 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"César Azpilicueta","x":-780.8587646484375,"y":-518.6594848632812,"id":"110","attributes":{"Eigenvector Centrality":"0.9333483233206638","Betweenness Centrality":"0.002581134642452991","Appearances":"6","No":"22","Country":"Spain","Club Country":"England","Club":"Chelsea","Weighted Degree":"32.0","Modularity Class":"23","Date of birth / Age":"28 August 1989 (aged 24)","Degree":"32","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.34186046511627904"},"color":"rgb(229,67,197)","size":23.33333396911621},{"label":"Rémy Cabella","x":-28.49822998046875,"y":-252.28802490234375,"id":"594","attributes":{"Eigenvector Centrality":"0.48363975992492747","Betweenness Centrality":"0.0","Appearances":"1","No":"7","Country":"France","Club Country":"France","Club":"Montpellier","Weighted Degree":"22.0","Modularity Class":"16","Date of birth / Age":"8 March 1990 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.3037190082644628"},"color":"rgb(229,67,229)","size":10.0},{"label":"Aleksei Ionov","x":-1428.007080078125,"y":-1427.2176513671875,"id":"24","attributes":{"Eigenvector Centrality":"0.2816622746350613","Betweenness Centrality":"6.368705012250895E-4","Appearances":"5","No":"21","Country":"Russia","Club Country":"Russia","Club":"Dynamo Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"18 February 1989 (aged 25)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.25538568450312715"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Vieirinha","x":-584.5398559570312,"y":300.7301940917969,"id":"703","attributes":{"Eigenvector Centrality":"0.5206064074642943","Betweenness Centrality":"0.0029301281450007945","Appearances":"9","No":"10","Country":"Portugal","Club Country":"Germany","Club":"VfL Wolfsburg","Weighted Degree":"28.0","Modularity Class":"8","Date of birth / Age":"24 January 1986 (aged 28)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.32565352237483386"},"color":"rgb(229,164,67)","size":18.0},{"label":"Joel Campbell","x":2111.1640625,"y":365.17755126953125,"id":"336","attributes":{"Eigenvector Centrality":"0.2789506377156212","Betweenness Centrality":"0.00832814736706791","Appearances":"33","No":"9","Country":"Costa Rica","Club Country":"Greece","Club":"Olympiacos","Weighted Degree":"26.0","Modularity Class":"29","Date of birth / Age":"26 June 1992 (aged 21)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2687385740402194"},"color":"rgb(229,229,67)","size":15.333333969116211},{"label":"Carlos Salcido","x":-2011.8602294921875,"y":347.6936340332031,"id":"104","attributes":{"Eigenvector Centrality":"0.2771264523867947","Betweenness Centrality":"0.0","Appearances":"122","No":"3","Country":"Mexico","Club Country":"Mexico","Club":"UANL","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"2 April 1980 (aged 34)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Mathew Ryan","x":2056.780517578125,"y":-519.5844116210938,"id":"471","attributes":{"Eigenvector Centrality":"0.2315995769978225","Betweenness Centrality":"0.0038336165219305914","Appearances":"7","No":"1","Country":"Australia","Club Country":"Belgium","Club":"Club Brugge","Weighted Degree":"23.0","Modularity Class":"12","Date of birth / Age":"8 April 1992 (aged 22)","Degree":"23","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.23535062439961577"},"color":"rgb(229,100,67)","size":11.333333015441895},{"label":"Samuel Inkoom","x":406.61175537109375,"y":1441.41943359375,"id":"628","attributes":{"Eigenvector Centrality":"0.29027436907278803","Betweenness Centrality":"0.0","Appearances":"46","No":"2","Country":"Ghana","Club Country":"Greece","Club":"Platanias","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"1 June 1989 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Granit Xhaka","x":60.45975875854492,"y":205.4804229736328,"id":"266","attributes":{"Eigenvector Centrality":"0.4016189697530195","Betweenness Centrality":"6.451424399991758E-4","Appearances":"26","No":"10","Country":"Switzerland","Club Country":"Germany","Club":"Borussia Mönchengladbach","Weighted Degree":"23.0","Modularity Class":"0","Date of birth / Age":"27 September 1992 (aged 21)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30222039473684215"},"color":"rgb(164,229,67)","size":11.333333015441895},{"label":"Carl Medjani","x":-1275.965087890625,"y":1205.1011962890625,"id":"97","attributes":{"Eigenvector Centrality":"0.30778242364802144","Betweenness Centrality":"0.002125132721118146","Appearances":"26","No":"12","Country":"Algeria","Club Country":"France","Club":"Valenciennes","Weighted Degree":"23.0","Modularity Class":"24","Date of birth / Age":"15 May 1985 (aged 29)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2980535279805353"},"color":"rgb(67,164,229)","size":11.333333015441895},{"label":"Ramon Azeez","x":-83.1539077758789,"y":-1703.900634765625,"id":"587","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"2","No":"15","Country":"Nigeria","Club Country":"Spain","Club":"Almería","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"12 December 1992 (aged 21)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Didier Zokora","x":526.2356567382812,"y":-881.0933227539062,"id":"161","attributes":{"Eigenvector Centrality":"0.30966117600400694","Betweenness Centrality":"0.0","Appearances":"119","No":"5","Country":"Ivory Coast","Club Country":"Turkey","Club":"Trabzonspor","Weighted Degree":"22.0","Modularity Class":"9","Date of birth / Age":"14 December 1980 (aged 33)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2929453965723396"},"color":"rgb(164,67,229)","size":10.0},{"label":"Yasuyuki Konno","x":772.3632202148438,"y":672.5744018554688,"id":"725","attributes":{"Eigenvector Centrality":"0.31718153777834784","Betweenness Centrality":"0.0","Appearances":"81","No":"15","Country":"Japan","Club Country":"Japan","Club":"Gamba Osaka","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"25 January 1983 (aged 31)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Phil Jagielka","x":-210.36138916015625,"y":-1046.0340576171875,"id":"575","attributes":{"Eigenvector Centrality":"0.5738583419916762","Betweenness Centrality":"0.0013664563333722465","Appearances":"26","No":"6","Country":"England","Club Country":"England","Club":"Everton","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"17 August 1982 (aged 31)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31183708103521424"},"color":"rgb(67,229,132)","size":14.0},{"label":"Michael Uchebo","x":-95.68781280517578,"y":-1656.3585205078125,"id":"505","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"4","No":"20","Country":"Nigeria","Club Country":"Belgium","Club":"Cercle Brugge","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"2 February 1990 (aged 24)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Andreas Samaris","x":1692.9754638671875,"y":475.92816162109375,"id":"47","attributes":{"Eigenvector Centrality":"0.2697590097502519","Betweenness Centrality":"0.0018881692306353887","Appearances":"4","No":"22","Country":"Greece","Club Country":"Greece","Club":"Olympiacos","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"13 June 1989 (aged 24)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2878965922444183"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Emmanuel Agyemang-Badu","x":311.23797607421875,"y":1367.975341796875,"id":"199","attributes":{"Eigenvector Centrality":"0.30228653977349984","Betweenness Centrality":"0.002131225990650736","Appearances":"49","No":"8","Country":"Ghana","Club Country":"Italy","Club":"Udinese","Weighted Degree":"23.0","Modularity Class":"5","Date of birth / Age":"2 December 1990 (aged 23)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.29708973322554566"},"color":"rgb(67,229,197)","size":11.333333015441895},{"label":"Michael Lang","x":29.4794864654541,"y":282.8443908691406,"id":"504","attributes":{"Eigenvector Centrality":"0.3846161602156529","Betweenness Centrality":"0.0","Appearances":"6","No":"6","Country":"Switzerland","Club Country":"Switzerland","Club":"Grasshopper","Weighted Degree":"22.0","Modularity Class":"0","Date of birth / Age":"8 February 1991 (aged 23)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2922465208747515"},"color":"rgb(164,229,67)","size":10.0},{"label":"Shuichi Gonda","x":757.8242797851562,"y":624.099853515625,"id":"650","attributes":{"Eigenvector Centrality":"0.31718153777834773","Betweenness Centrality":"0.0","Appearances":"2","No":"23","Country":"Japan","Club Country":"Japan","Club":"F.C. Tokyo","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"3 March 1989 (aged 25)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Celso Borges","x":2214.53955078125,"y":283.7978820800781,"id":"109","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"63","No":"5","Country":"Costa Rica","Club Country":"Sweden","Club":"AIK","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"27 May 1988 (aged 26)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Javi Martínez","x":-549.7433471679688,"y":-388.08502197265625,"id":"316","attributes":{"Eigenvector Centrality":"0.9931923382141185","Betweenness Centrality":"0.008269325861106165","Appearances":"17","No":"4","Country":"Spain","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"35.0","Modularity Class":"23","Date of birth / Age":"2 September 1988 (aged 25)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34653465346534656"},"color":"rgb(229,67,197)","size":27.33333396911621},{"label":"Sylvain Gbohouo","x":531.5452880859375,"y":-936.862060546875,"id":"671","attributes":{"Eigenvector Centrality":"0.30966117600400694","Betweenness Centrality":"0.0","Appearances":"2","No":"16","Country":"Ivory Coast","Club Country":"Ivory Coast","Club":"Séwé Sport","Weighted Degree":"22.0","Modularity Class":"9","Date of birth / Age":"29 October 1988 (aged 25)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2929453965723396"},"color":"rgb(164,67,229)","size":10.0},{"label":"Sead Kolašinac","x":1107.5244140625,"y":-303.2990417480469,"id":"633","attributes":{"Eigenvector Centrality":"0.3859570622009839","Betweenness Centrality":"0.013926412977704486","Appearances":"4","No":"5","Country":"Bosnia and Herzegovina","Club Country":"Germany","Club":"Schalke \u002704","Weighted Degree":"28.0","Modularity Class":"20","Date of birth / Age":"20 June 1993 (aged 20)","Degree":"28","Position":"DF","Eccentricity":"4.0","Closeness Centrality":"0.34090909090909094"},"color":"rgb(132,229,67)","size":18.0},{"label":"Vangelis Moras","x":1602.7227783203125,"y":488.2573547363281,"id":"694","attributes":{"Eigenvector Centrality":"0.25813336963416805","Betweenness Centrality":"0.0","Appearances":"19","No":"5","Country":"Greece","Club Country":"Italy","Club":"Verona","Weighted Degree":"22.0","Modularity Class":"15","Date of birth / Age":"26 August 1981 (aged 32)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2760045061960195"},"color":"rgb(229,67,100)","size":10.0},{"label":"Mesut Özil","x":266.2100524902344,"y":-466.7005310058594,"id":"498","attributes":{"Eigenvector Centrality":"0.6437896004097903","Betweenness Centrality":"0.002673471053911242","Appearances":"55","No":"8","Country":"Germany","Club Country":"England","Club":"Arsenal","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"15 October 1988 (aged 25)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3219448094612352"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Daniel Cambronero","x":2228.9765625,"y":327.57440185546875,"id":"136","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"4","No":"23","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Herediano","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"8 January 1986 (aged 28)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Alberto Aquilani","x":51.16946029663086,"y":883.6702880859375,"id":"19","attributes":{"Eigenvector Centrality":"0.446913802610424","Betweenness Centrality":"0.00214616718692594","Appearances":"35","No":"14","Country":"Italy","Club Country":"Italy","Club":"Fiorentina","Weighted Degree":"24.0","Modularity Class":"3","Date of birth / Age":"7 July 1984 (aged 29)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.310126582278481"},"color":"rgb(197,229,67)","size":12.666666984558105},{"label":"Matthew Špiranovic","x":2061.166748046875,"y":-656.2603149414062,"id":"479","attributes":{"Eigenvector Centrality":"0.2213229433005502","Betweenness Centrality":"0.0","Appearances":"18","No":"6","Country":"Australia","Club Country":"Australia","Club":"Western Sydney Wanderers","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"27 June 1988 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Thomas Müller","x":396.2323913574219,"y":-434.3363952636719,"id":"678","attributes":{"Eigenvector Centrality":"0.6585766805388439","Betweenness Centrality":"0.0026429368589338613","Appearances":"49","No":"13","Country":"Germany","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"13 September 1989 (aged 24)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3390221402214022"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Riyad Mahrez","x":-1375.4896240234375,"y":1263.62109375,"id":"605","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"2","No":"21","Country":"Algeria","Club Country":"England","Club":"Leicester City","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"21 February 1991 (aged 23)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Alireza Jahanbakhsh","x":1942.0732421875,"y":1034.900146484375,"id":"36","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"7","No":"9","Country":"Iran","Club Country":"Netherlands","Club":"NEC","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"11 August 1993 (aged 20)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Hotaru Yamaguchi","x":665.15576171875,"y":571.1557006835938,"id":"285","attributes":{"Eigenvector Centrality":"0.33192039229134085","Betweenness Centrality":"0.0010231003820519223","Appearances":"12","No":"16","Country":"Japan","Club Country":"Japan","Club":"Cerezo Osaka","Weighted Degree":"23.0","Modularity Class":"27","Date of birth / Age":"6 October 1990 (aged 23)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3190104166666667"},"color":"rgb(67,100,229)","size":11.333333015441895},{"label":"Hugo Campagnaro","x":-1030.6343994140625,"y":363.070556640625,"id":"287","attributes":{"Eigenvector Centrality":"0.5658107599692684","Betweenness Centrality":"0.0025393109943757006","Appearances":"15","No":"3","Country":"Argentina","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"27.0","Modularity Class":"19","Date of birth / Age":"27 June 1980 (aged 33)","Degree":"27","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3272484416740873"},"color":"rgb(67,229,229)","size":16.666667938232422},{"label":"Diego Godín","x":-229.68458557128906,"y":-28.488847732543945,"id":"166","attributes":{"Eigenvector Centrality":"0.5243629945948549","Betweenness Centrality":"0.0015151368839237088","Appearances":"77","No":"3","Country":"Uruguay","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"28.0","Modularity Class":"6","Date of birth / Age":"16 February 1986 (aged 28)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3236459709379128"},"color":"rgb(229,197,67)","size":18.0},{"label":"Roman Bürki","x":84.80470275878906,"y":279.10205078125,"id":"610","attributes":{"Eigenvector Centrality":"0.3846161602156529","Betweenness Centrality":"0.0","Appearances":"0","No":"21","Country":"Switzerland","Club Country":"Switzerland","Club":"Grasshopper","Weighted Degree":"22.0","Modularity Class":"0","Date of birth / Age":"14 November 1990 (aged 23)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2922465208747515"},"color":"rgb(164,229,67)","size":10.0},{"label":"Didier Drogba (c)","x":598.4851684570312,"y":-735.1734008789062,"id":"159","attributes":{"Eigenvector Centrality":"0.3683202285259076","Betweenness Centrality":"0.006250022365764094","Appearances":"101","No":"11","Country":"Ivory Coast","Club Country":"Turkey","Club":"Galatasaray","Weighted Degree":"26.0","Modularity Class":"9","Date of birth / Age":"11 March 1978 (aged 36)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3276861346411057"},"color":"rgb(164,67,229)","size":15.333333969116211},{"label":"Sejad Salihovic","x":1178.591064453125,"y":-598.7509765625,"id":"635","attributes":{"Eigenvector Centrality":"0.29529844322499244","Betweenness Centrality":"0.0028150615386489113","Appearances":"42","No":"23","Country":"Bosnia and Herzegovina","Club Country":"Germany","Club":"1899 Hoffenheim","Weighted Degree":"23.0","Modularity Class":"20","Date of birth / Age":"8 October 1984 (aged 29)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31518010291595194"},"color":"rgb(132,229,67)","size":11.333333015441895},{"label":"Christian Bolaños","x":2234.70166015625,"y":376.90460205078125,"id":"119","attributes":{"Eigenvector Centrality":"0.23496944760866384","Betweenness Centrality":"0.0","Appearances":"55","No":"7","Country":"Costa Rica","Club Country":"Denmark","Club":"Copenhagen","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"17 May 1984 (aged 30)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Carlos Peña","x":-2037.2489013671875,"y":386.7759704589844,"id":"103","attributes":{"Eigenvector Centrality":"0.2771264523867947","Betweenness Centrality":"0.0","Appearances":"16","No":"21","Country":"Mexico","Club Country":"Mexico","Club":"León","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"29 March 1990 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Izet Hajrovic","x":1073.4324951171875,"y":-468.6595458984375,"id":"302","attributes":{"Eigenvector Centrality":"0.3433334744187318","Betweenness Centrality":"0.0069532743678391755","Appearances":"7","No":"20","Country":"Bosnia and Herzegovina","Club Country":"Turkey","Club":"Galatasaray","Weighted Degree":"26.0","Modularity Class":"20","Date of birth / Age":"4 August 1991 (aged 22)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3359232175502742"},"color":"rgb(132,229,67)","size":15.333333969116211},{"label":"Joël Veltman","x":921.6832885742188,"y":59.57893753051758,"id":"338","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"2","No":"13","Country":"Netherlands","Club Country":"Netherlands","Club":"Ajax","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"15 January 1992 (aged 22)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"David Silva","x":-782.8482666015625,"y":-359.30230712890625,"id":"154","attributes":{"Eigenvector Centrality":"0.8845575771108349","Betweenness Centrality":"0.006629652754318272","Appearances":"80","No":"21","Country":"Spain","Club Country":"England","Club":"Manchester City","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"8 January 1986 (aged 28)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3407510431154381"},"color":"rgb(229,67,197)","size":22.0},{"label":"Manuel Neuer","x":362.2953186035156,"y":-299.9522399902344,"id":"442","attributes":{"Eigenvector Centrality":"0.6585766805388434","Betweenness Centrality":"0.0026429368589338613","Appearances":"45","No":"1","Country":"Germany","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"27 March 1986 (aged 28)","Degree":"29","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3390221402214022"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Kim Bo-kyung","x":1094.657470703125,"y":1613.0086669921875,"id":"391","attributes":{"Eigenvector Centrality":"0.24403600463458192","Betweenness Centrality":"0.006087158361550197","Appearances":"28","No":"7","Country":"South Korea","Club Country":"Wales","Club":"Cardiff City","Weighted Degree":"23.0","Modularity Class":"10","Date of birth / Age":"6 October 1989 (aged 24)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.26785714285714285"},"color":"rgb(229,67,164)","size":11.333333015441895},{"label":"Eugene Galekovic","x":2152.16015625,"y":-634.9464721679688,"id":"208","attributes":{"Eigenvector Centrality":"0.22132294330055013","Betweenness Centrality":"0.0","Appearances":"8","No":"18","Country":"Australia","Club Country":"Australia","Club":"Adelaide United","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"12 June 1981 (aged 33)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Emmanuel Emenike","x":-64.24840545654297,"y":-1362.014404296875,"id":"200","attributes":{"Eigenvector Centrality":"0.36794115334947153","Betweenness Centrality":"0.005599744925127154","Appearances":"23","No":"9","Country":"Nigeria","Club Country":"Turkey","Club":"Fenerbahçe","Weighted Degree":"26.0","Modularity Class":"14","Date of birth / Age":"10 May 1987 (aged 27)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3168103448275862"},"color":"rgb(67,229,100)","size":15.333333969116211},{"label":"Wesley Sneijder","x":805.6671752929688,"y":-40.13237762451172,"id":"714","attributes":{"Eigenvector Centrality":"0.39319035954961806","Betweenness Centrality":"0.006544290321462833","Appearances":"99","No":"10","Country":"Netherlands","Club Country":"Turkey","Club":"Galatasaray","Weighted Degree":"26.0","Modularity Class":"22","Date of birth / Age":"9 June 1984 (aged 30)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.337620578778135"},"color":"rgb(197,67,229)","size":15.333333969116211},{"label":"Walter Ayoví","x":-1792.04833984375,"y":-657.5009155273438,"id":"710","attributes":{"Eigenvector Centrality":"0.36230621820682135","Betweenness Centrality":"0.0","Appearances":"90","No":"10","Country":"Ecuador","Club Country":"Mexico","Club":"Pachuca","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"11 August 1979 (aged 34)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Valentin Stocker","x":93.9429931640625,"y":165.77862548828125,"id":"692","attributes":{"Eigenvector Centrality":"0.4279165187640592","Betweenness Centrality":"0.0017015426628181239","Appearances":"24","No":"14","Country":"Switzerland","Club Country":"Switzerland","Club":"Basel","Weighted Degree":"25.0","Modularity Class":"0","Date of birth / Age":"12 April 1989 (aged 25)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31038851351351354"},"color":"rgb(164,229,67)","size":14.0},{"label":"David Villa","x":-854.8253784179688,"y":-313.9442443847656,"id":"155","attributes":{"Eigenvector Centrality":"0.7852248920099724","Betweenness Centrality":"7.220203040676876E-4","Appearances":"96","No":"7","Country":"Spain","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"27.0","Modularity Class":"23","Date of birth / Age":"3 December 1981 (aged 32)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3215223097112861"},"color":"rgb(229,67,197)","size":16.666667938232422},{"label":"Sergio Agüero","x":-986.2796630859375,"y":70.57652282714844,"id":"642","attributes":{"Eigenvector Centrality":"0.6398902783818313","Betweenness Centrality":"0.003598075368399343","Appearances":"51","No":"20","Country":"Argentina","Club Country":"England","Club":"Manchester City","Weighted Degree":"29.0","Modularity Class":"19","Date of birth / Age":"2 June 1988 (aged 26)","Degree":"29","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3316787003610108"},"color":"rgb(67,229,229)","size":19.333332061767578},{"label":"Kim Young-gwon","x":1284.3221435546875,"y":1556.894775390625,"id":"395","attributes":{"Eigenvector Centrality":"0.23152559498868786","Betweenness Centrality":"0.0","Appearances":"21","No":"5","Country":"South Korea","Club Country":"China","Club":"Guangzhou Evergrande","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"27 February 1990 (aged 24)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Adrián Bone","x":-1657.1593017578125,"y":-645.242919921875,"id":"9","attributes":{"Eigenvector Centrality":"0.36230621820682135","Betweenness Centrality":"0.0","Appearances":"3","No":"12","Country":"Ecuador","Club Country":"Ecuador","Club":"El Nacional","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"8 September 1988 (aged 25)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Benoît Assou-Ekotto","x":484.17120361328125,"y":273.5126953125,"id":"84","attributes":{"Eigenvector Centrality":"0.3330106718881068","Betweenness Centrality":"0.0036584595528713027","Appearances":"22","No":"2","Country":"Cameroon","Club Country":"England","Club":"Queens Park Rangers","Weighted Degree":"23.0","Modularity Class":"17","Date of birth / Age":"24 March 1984 (aged 30)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3190104166666667"},"color":"rgb(67,132,229)","size":11.333333015441895},{"label":"Efe Ambrose","x":91.53675842285156,"y":-1502.422119140625,"id":"190","attributes":{"Eigenvector Centrality":"0.3486435360657821","Betweenness Centrality":"0.008270857775066283","Appearances":"37","No":"5","Country":"Nigeria","Club Country":"Scotland","Club":"Celtic","Weighted Degree":"25.0","Modularity Class":"14","Date of birth / Age":"18 October 1988 (aged 25)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31518010291595194"},"color":"rgb(67,229,100)","size":14.0},{"label":"Oliver Bozanic","x":2198.375732421875,"y":-627.1802368164062,"id":"541","attributes":{"Eigenvector Centrality":"0.22132294330055013","Betweenness Centrality":"0.0","Appearances":"3","No":"13","Country":"Australia","Club Country":"Switzerland","Club":"Luzern","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"8 January 1989 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Eduardo Vargas","x":-348.89111328125,"y":1339.4359130859375,"id":"189","attributes":{"Eigenvector Centrality":"0.3789565490107093","Betweenness Centrality":"0.006733824897676562","Appearances":"30","No":"11","Country":"Chile","Club Country":"Spain","Club":"Valencia","Weighted Degree":"26.0","Modularity Class":"18","Date of birth / Age":"20 November 1989 (aged 24)","Degree":"26","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.30359355638166047"},"color":"rgb(229,132,67)","size":15.333333969116211},{"label":"Azubuike Egwuekwe","x":-40.1948127746582,"y":-1612.722900390625,"id":"75","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"31","No":"6","Country":"Nigeria","Club Country":"Nigeria","Club":"Warri Wolves","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"16 July 1989 (aged 24)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Giannis Maniatis","x":1675.661376953125,"y":562.7532958984375,"id":"251","attributes":{"Eigenvector Centrality":"0.269759009750252","Betweenness Centrality":"0.0018881692306353887","Appearances":"30","No":"2","Country":"Greece","Club Country":"Greece","Club":"Olympiacos","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"12 October 1986 (aged 27)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2878965922444183"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Víctor Bernárdez","x":1542.3271484375,"y":-1230.5048828125,"id":"700","attributes":{"Eigenvector Centrality":"0.24794367045748958","Betweenness Centrality":"0.0014579941476906906","Appearances":"78","No":"5","Country":"Honduras","Club Country":"United States","Club":"San Jose Earthquakes","Weighted Degree":"23.0","Modularity Class":"7","Date of birth / Age":"24 May 1982 (aged 32)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2750748502994012"},"color":"rgb(100,67,229)","size":11.333333015441895},{"label":"Asmir Avdukic","x":1126.556396484375,"y":-529.686279296875,"id":"67","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"3","No":"22","Country":"Bosnia and Herzegovina","Club Country":"Bosnia and Herzegovina","Club":"Borac Banja Luka","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"13 May 1981 (aged 33)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Avdija Vršajevic","x":1155.9981689453125,"y":-446.0126647949219,"id":"73","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"13","No":"2","Country":"Bosnia and Herzegovina","Club Country":"Croatia","Club":"Hajduk Split","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"6 March 1986 (aged 28)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Carlos Sánchez","x":-775.6780395507812,"y":1232.408935546875,"id":"105","attributes":{"Eigenvector Centrality":"0.31394925107891597","Betweenness Centrality":"0.0","Appearances":"44","No":"6","Country":"Colombia","Club Country":"Spain","Club":"Elche","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"6 February 1986 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Diego Reyes","x":-1751.081298828125,"y":432.3384704589844,"id":"169","attributes":{"Eigenvector Centrality":"0.41168852553130064","Betweenness Centrality":"0.009305549137125925","Appearances":"14","No":"5","Country":"Mexico","Club Country":"Portugal","Club":"Porto","Weighted Degree":"29.0","Modularity Class":"21","Date of birth / Age":"19 September 1992 (aged 21)","Degree":"29","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3128991060025543"},"color":"rgb(67,229,67)","size":19.333332061767578},{"label":"Serge Aurier","x":471.92193603515625,"y":-746.9190673828125,"id":"639","attributes":{"Eigenvector Centrality":"0.3226876976851504","Betweenness Centrality":"0.002014868000803819","Appearances":"8","No":"17","Country":"Ivory Coast","Club Country":"France","Club":"Toulouse","Weighted Degree":"23.0","Modularity Class":"9","Date of birth / Age":"24 December 1992 (aged 21)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30817610062893086"},"color":"rgb(164,67,229)","size":11.333333015441895},{"label":"Juan Fernando Quintero","x":-908.9094848632812,"y":1006.1945190429688,"id":"369","attributes":{"Eigenvector Centrality":"0.446466126398784","Betweenness Centrality":"0.007655587436909223","Appearances":"4","No":"20","Country":"Colombia","Club Country":"Portugal","Club":"Porto","Weighted Degree":"29.0","Modularity Class":"11","Date of birth / Age":"18 January 1993 (aged 21)","Degree":"29","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3315290933694181"},"color":"rgb(67,67,229)","size":19.333332061767578},{"label":"Vasili Berezutski (c)","x":-1323.1439208984375,"y":-1494.270751953125,"id":"695","attributes":{"Eigenvector Centrality":"0.2797530450294211","Betweenness Centrality":"8.329697214751982E-4","Appearances":"78","No":"14","Country":"Russia","Club Country":"Russia","Club":"CSKA Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"20 June 1982 (aged 31)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.2544132917964694"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Patrick Pemberton","x":2230.439208984375,"y":179.53189086914062,"id":"563","attributes":{"Eigenvector Centrality":"0.24571486118323413","Betweenness Centrality":"0.003463283566079935","Appearances":"21","No":"18","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Alajuelense","Weighted Degree":"23.0","Modularity Class":"29","Date of birth / Age":"24 April 1982 (aged 32)","Degree":"23","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.26601520086862107"},"color":"rgb(229,229,67)","size":11.333333015441895},{"label":"Alessio Cerci","x":276.6270751953125,"y":826.5160522460938,"id":"26","attributes":{"Eigenvector Centrality":"0.4319605441926736","Betweenness Centrality":"0.0018820457212751422","Appearances":"12","No":"11","Country":"Italy","Club Country":"Italy","Club":"Torino","Weighted Degree":"23.0","Modularity Class":"3","Date of birth / Age":"23 July 1987 (aged 26)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30497925311203317"},"color":"rgb(197,229,67)","size":11.333333015441895},{"label":"Hulk","x":-676.1294555664062,"y":-547.0525512695312,"id":"289","attributes":{"Eigenvector Centrality":"0.6585476210563139","Betweenness Centrality":"0.00902132999561875","Appearances":"35","No":"7","Country":"Brazil","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"29.0","Modularity Class":"23","Date of birth / Age":"25 July 1986 (aged 27)","Degree":"29","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.33018867924528306"},"color":"rgb(229,67,197)","size":19.333332061767578},{"label":"Juan Carlos García","x":1576.5137939453125,"y":-1044.39697265625,"id":"367","attributes":{"Eigenvector Centrality":"0.2495870836760396","Betweenness Centrality":"0.00224748146417088","Appearances":"34","No":"6","Country":"Honduras","Club Country":"England","Club":"Wigan Athletic","Weighted Degree":"23.0","Modularity Class":"7","Date of birth / Age":"8 March 1988 (aged 26)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,67,229)","size":11.333333015441895},{"label":"Miguel Layún","x":-2150.14892578125,"y":351.6337890625,"id":"510","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"15","No":"7","Country":"Mexico","Club Country":"Mexico","Club":"América","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"25 June 1988 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Kwak Tae-hwi","x":1276.581298828125,"y":1652.844970703125,"id":"405","attributes":{"Eigenvector Centrality":"0.23152559498868777","Betweenness Centrality":"0.0","Appearances":"35","No":"4","Country":"South Korea","Club Country":"Saudi Arabia","Club":"Al-Hilal","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"8 July 1981 (aged 32)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Graham Zusi","x":821.1793823242188,"y":-1568.8907470703125,"id":"265","attributes":{"Eigenvector Centrality":"0.2718151842935107","Betweenness Centrality":"0.0","Appearances":"23","No":"19","Country":"United States","Club Country":"United States","Club":"Sporting Kansas City","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"18 August 1986 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Gastón Ramírez","x":-52.539005279541016,"y":-56.3730354309082,"id":"240","attributes":{"Eigenvector Centrality":"0.49007679600185783","Betweenness Centrality":"0.004586755672605624","Appearances":"29","No":"18","Country":"Uruguay","Club Country":"England","Club":"Southampton","Weighted Degree":"28.0","Modularity Class":"6","Date of birth / Age":"2 December 1990 (aged 23)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3339391185824625"},"color":"rgb(229,197,67)","size":18.0},{"label":"Gerard Piqué","x":-1126.433837890625,"y":-326.654052734375,"id":"245","attributes":{"Eigenvector Centrality":"0.9370904429273632","Betweenness Centrality":"0.0017384725186443504","Appearances":"60","No":"3","Country":"Spain","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"2 February 1987 (aged 27)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(229,67,197)","size":22.0},{"label":"Bailey Wright","x":2074.923095703125,"y":-613.9719848632812,"id":"77","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"0","No":"8","Country":"Australia","Club Country":"England","Club":"Preston North End","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"28 July 1992 (aged 21)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Toni Šunjic","x":1221.8553466796875,"y":-554.8410034179688,"id":"688","attributes":{"Eigenvector Centrality":"0.28396954172011374","Betweenness Centrality":"0.0","Appearances":"8","No":"15","Country":"Bosnia and Herzegovina","Club Country":"Ukraine","Club":"Zorya Luhansk","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"15 December 1988 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Sergio Romero","x":-1110.6038818359375,"y":391.8827819824219,"id":"645","attributes":{"Eigenvector Centrality":"0.52052076818968","Betweenness Centrality":"0.00163007937425408","Appearances":"47","No":"1","Country":"Argentina","Club Country":"France","Club":"AS Monaco","Weighted Degree":"25.0","Modularity Class":"19","Date of birth / Age":"22 February 1987 (aged 27)","Degree":"25","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3168103448275862"},"color":"rgb(67,229,229)","size":14.0},{"label":"David Luiz","x":-401.1297607421875,"y":-483.5873107910156,"id":"151","attributes":{"Eigenvector Centrality":"0.7525362816963485","Betweenness Centrality":"0.002196566654268722","Appearances":"36","No":"4","Country":"Brazil","Club Country":"England","Club":"Chelsea","Weighted Degree":"30.0","Modularity Class":"23","Date of birth / Age":"22 April 1987 (aged 27)","Degree":"30","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3471894189891356"},"color":"rgb(229,67,197)","size":20.666667938232422},{"label":"Sulley Muntari","x":435.7590026855469,"y":1263.3812255859375,"id":"670","attributes":{"Eigenvector Centrality":"0.39414902919139266","Betweenness Centrality":"0.004358888803155806","Appearances":"82","No":"11","Country":"Ghana","Club Country":"Italy","Club":"Milan","Weighted Degree":"28.0","Modularity Class":"5","Date of birth / Age":"27 August 1984 (aged 29)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31223449447748514"},"color":"rgb(67,229,197)","size":18.0},{"label":"Yoshito Okubo","x":717.3280639648438,"y":699.9623413085938,"id":"730","attributes":{"Eigenvector Centrality":"0.31718153777834784","Betweenness Centrality":"0.0","Appearances":"57","No":"13","Country":"Japan","Club Country":"Japan","Club":"Kawasaki Frontale","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"9 June 1982 (aged 32)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Francisco Javier Rodríguez","x":-2058.64453125,"y":342.1274719238281,"id":"229","attributes":{"Eigenvector Centrality":"0.2771264523867947","Betweenness Centrality":"0.0","Appearances":"95","No":"2","Country":"Mexico","Club Country":"Mexico","Club":"América","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"20 October 1981 (aged 32)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Tim Howard","x":597.1010131835938,"y":-1458.6304931640625,"id":"681","attributes":{"Eigenvector Centrality":"0.37125489722394445","Betweenness Centrality":"0.007200099994456211","Appearances":"100","No":"1","Country":"United States","Club Country":"England","Club":"Everton","Weighted Degree":"27.0","Modularity Class":"26","Date of birth / Age":"6 March 1979 (aged 35)","Degree":"27","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.30359355638166047"},"color":"rgb(100,229,67)","size":16.666667938232422},{"label":"Kim Chang-soo","x":1182.64794921875,"y":1681.892333984375,"id":"392","attributes":{"Eigenvector Centrality":"0.23152559498868777","Betweenness Centrality":"0.0","Appearances":"9","No":"2","Country":"South Korea","Club Country":"Japan","Club":"Kashiwa Reysol","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"12 September 1985 (aged 28)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Igor Akinfeev","x":-1278.8709716796875,"y":-1521.6795654296875,"id":"292","attributes":{"Eigenvector Centrality":"0.27975304502942094","Betweenness Centrality":"8.329697214751982E-4","Appearances":"68","No":"1","Country":"Russia","Club Country":"Russia","Club":"CSKA Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"8 April 1986 (aged 28)","Degree":"23","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.2544132917964694"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Anel Hadžic","x":1149.517822265625,"y":-490.4151306152344,"id":"53","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"2","No":"21","Country":"Bosnia and Herzegovina","Club Country":"Austria","Club":"Sturm Graz","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"16 August 1989 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Jordi Alba","x":-1139.678955078125,"y":-237.86505126953125,"id":"349","attributes":{"Eigenvector Centrality":"0.9370904429273634","Betweenness Centrality":"0.0017384725186443504","Appearances":"26","No":"18","Country":"Spain","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"21 March 1989 (aged 25)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33777573529411764"},"color":"rgb(229,67,197)","size":22.0},{"label":"Teófilo Gutiérrez","x":-811.0554809570312,"y":1271.3983154296875,"id":"672","attributes":{"Eigenvector Centrality":"0.31394925107891597","Betweenness Centrality":"0.0","Appearances":"30","No":"9","Country":"Colombia","Club Country":"Argentina","Club":"River Plate","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"17 May 1985 (aged 29)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Daniel Davari","x":1905.60986328125,"y":955.88916015625,"id":"137","attributes":{"Eigenvector Centrality":"0.22438444470902533","Betweenness Centrality":"0.034852343427392886","Appearances":"4","No":"22","Country":"Iran","Club Country":"Germany","Club":"Eintracht Braunschweig","Weighted Degree":"23.0","Modularity Class":"1","Date of birth / Age":"6 January 1988 (aged 26)","Degree":"23","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.24739145069000334"},"color":"rgb(67,197,229)","size":11.333333015441895},{"label":"Serey Die","x":467.3825988769531,"y":-653.703857421875,"id":"638","attributes":{"Eigenvector Centrality":"0.37146876286160685","Betweenness Centrality":"0.004611725554141086","Appearances":"7","No":"20","Country":"Ivory Coast","Club Country":"Switzerland","Club":"Basel","Weighted Degree":"26.0","Modularity Class":"9","Date of birth / Age":"7 November 1984 (aged 29)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(164,67,229)","size":15.333333969116211},{"label":"Yun Suk-young","x":1131.668212890625,"y":1494.437255859375,"id":"731","attributes":{"Eigenvector Centrality":"0.2442236139118131","Betweenness Centrality":"0.002477907299557519","Appearances":"4","No":"3","Country":"South Korea","Club Country":"England","Club":"Queens Park Rangers","Weighted Degree":"23.0","Modularity Class":"10","Date of birth / Age":"13 February 1990 (aged 24)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.27242401779095626"},"color":"rgb(229,67,164)","size":11.333333015441895},{"label":"Wilson Palacios","x":1475.9537353515625,"y":-1233.8828125,"id":"718","attributes":{"Eigenvector Centrality":"0.2749352578108993","Betweenness Centrality":"0.008565859408081519","Appearances":"95","No":"8","Country":"Honduras","Club Country":"England","Club":"Stoke City","Weighted Degree":"25.0","Modularity Class":"7","Date of birth / Age":"29 July 1984 (aged 29)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.29672991522002423"},"color":"rgb(100,67,229)","size":14.0},{"label":"Steven Beitashour","x":1978.978515625,"y":1007.80078125,"id":"666","attributes":{"Eigenvector Centrality":"0.21274429344229642","Betweenness Centrality":"0.0","Appearances":"6","No":"20","Country":"Iran","Club Country":"Canada","Club":"Vancouver Whitecaps FC","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"1 February 1987 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Nicolas Lombaerts","x":-803.9263916015625,"y":-951.1397705078125,"id":"532","attributes":{"Eigenvector Centrality":"0.6174086302888655","Betweenness Centrality":"0.006770928561410678","Appearances":"25","No":"18","Country":"Belgium","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"28.0","Modularity Class":"28","Date of birth / Age":"20 March 1985 (aged 29)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3343949044585987"},"color":"rgb(67,229,132)","size":18.0},{"label":"Victor","x":-504.1156921386719,"y":-310.5911865234375,"id":"699","attributes":{"Eigenvector Centrality":"0.5425650576268322","Betweenness Centrality":"0.0","Appearances":"6","No":"22","Country":"Brazil","Club Country":"Brazil","Club":"Atlético Mineiro","Weighted Degree":"22.0","Modularity Class":"23","Date of birth / Age":"21 January 1983 (aged 31)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3158573270305114"},"color":"rgb(229,67,197)","size":10.0},{"label":"Mikkel Diskerud","x":941.4994506835938,"y":-1436.3448486328125,"id":"513","attributes":{"Eigenvector Centrality":"0.2821282119717931","Betweenness Centrality":"0.00491295354819868","Appearances":"20","No":"10","Country":"United States","Club Country":"Norway","Club":"Rosenborg","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"2 October 1990 (aged 23)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28857479387514723"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"Dante","x":-212.989501953125,"y":-416.6596374511719,"id":"145","attributes":{"Eigenvector Centrality":"0.856259545753813","Betweenness Centrality":"0.008027278474858441","Appearances":"12","No":"13","Country":"Brazil","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"35.0","Modularity Class":"23","Date of birth / Age":"18 October 1983 (aged 30)","Degree":"35","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3510028653295129"},"color":"rgb(229,67,197)","size":27.33333396911621},{"label":"Emir Spahic (c)","x":1039.750244140625,"y":-336.38665771484375,"id":"198","attributes":{"Eigenvector Centrality":"0.30657356383479545","Betweenness Centrality":"0.01353674285470377","Appearances":"74","No":"4","Country":"Bosnia and Herzegovina","Club Country":"Germany","Club":"Bayer Leverkusen","Weighted Degree":"24.0","Modularity Class":"20","Date of birth / Age":"18 August 1980 (aged 33)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3225098727512067"},"color":"rgb(132,229,67)","size":12.666666984558105},{"label":"Tim Krul","x":749.574951171875,"y":-122.82310485839844,"id":"682","attributes":{"Eigenvector Centrality":"0.42046095610267226","Betweenness Centrality":"0.005581921144737077","Appearances":"5","No":"23","Country":"Netherlands","Club Country":"England","Club":"Newcastle United","Weighted Degree":"27.0","Modularity Class":"22","Date of birth / Age":"3 April 1988 (aged 26)","Degree":"27","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3313796212804328"},"color":"rgb(197,67,229)","size":16.666667938232422},{"label":"Edder Delgado","x":1622.098388671875,"y":-1283.4814453125,"id":"178","attributes":{"Eigenvector Centrality":"0.23664887946331803","Betweenness Centrality":"0.0","Appearances":"26","No":"12","Country":"Honduras","Club Country":"Honduras","Club":"Real España","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"20 November 1986 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Chris Wondolowski","x":915.552978515625,"y":-1512.6751708984375,"id":"117","attributes":{"Eigenvector Centrality":"0.282163463180194","Betweenness Centrality":"0.0017638995236230008","Appearances":"21","No":"18","Country":"United States","Club Country":"United States","Club":"San Jose Earthquakes","Weighted Degree":"23.0","Modularity Class":"26","Date of birth / Age":"28 January 1983 (aged 31)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2877838684416601"},"color":"rgb(100,229,67)","size":11.333333015441895},{"label":"Memphis Depay","x":929.3518676757812,"y":119.25907897949219,"id":"496","attributes":{"Eigenvector Centrality":"0.36016990192205894","Betweenness Centrality":"0.005645297467686556","Appearances":"6","No":"21","Country":"Netherlands","Club Country":"Netherlands","Club":"PSV","Weighted Degree":"24.0","Modularity Class":"22","Date of birth / Age":"13 February 1994 (aged 20)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3273942093541203"},"color":"rgb(197,67,229)","size":12.666666984558105},{"label":"Jérôme Boateng","x":313.90338134765625,"y":-414.4244689941406,"id":"327","attributes":{"Eigenvector Centrality":"0.6585766805388437","Betweenness Centrality":"0.0026429368589338613","Appearances":"39","No":"20","Country":"Germany","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"3 September 1988 (aged 25)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3390221402214022"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Nani","x":-646.500244140625,"y":40.37836456298828,"id":"528","attributes":{"Eigenvector Centrality":"0.7654159805026451","Betweenness Centrality":"0.010494679938814755","Appearances":"75","No":"17","Country":"Portugal","Club Country":"England","Club":"Manchester United","Weighted Degree":"35.0","Modularity Class":"8","Date of birth / Age":"17 November 1986 (aged 27)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34702549575070823"},"color":"rgb(229,164,67)","size":27.33333396911621},{"label":"Michael Barrantes","x":2300.956298828125,"y":256.1389465332031,"id":"501","attributes":{"Eigenvector Centrality":"0.23496944760866373","Betweenness Centrality":"0.0","Appearances":"50","No":"11","Country":"Costa Rica","Club Country":"Norway","Club":"Aalesund","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"4 October 1983 (aged 30)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Gelson Fernandes","x":151.718017578125,"y":158.9506072998047,"id":"241","attributes":{"Eigenvector Centrality":"0.41564407300864686","Betweenness Centrality":"0.0029131326818128433","Appearances":"47","No":"16","Country":"Switzerland","Club Country":"Germany","Club":"SC Freiburg","Weighted Degree":"24.0","Modularity Class":"0","Date of birth / Age":"2 September 1986 (aged 27)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3150450064294899"},"color":"rgb(164,229,67)","size":12.666666984558105},{"label":"Oscar","x":-364.28692626953125,"y":-412.46795654296875,"id":"547","attributes":{"Eigenvector Centrality":"0.7525362816963487","Betweenness Centrality":"0.002196566654268722","Appearances":"31","No":"11","Country":"Brazil","Club Country":"England","Club":"Chelsea","Weighted Degree":"30.0","Modularity Class":"23","Date of birth / Age":"9 September 1991 (aged 22)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3471894189891356"},"color":"rgb(229,67,197)","size":20.666667938232422},{"label":"El Arbi Hillel Soudani","x":-1331.9407958984375,"y":1124.369873046875,"id":"195","attributes":{"Eigenvector Centrality":"0.3092624835205678","Betweenness Centrality":"0.0011823348492373815","Appearances":"22","No":"15","Country":"Algeria","Club Country":"Croatia","Club":"Dinamo Zagreb","Weighted Degree":"23.0","Modularity Class":"24","Date of birth / Age":"25 November 1987 (aged 26)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2950622240064231"},"color":"rgb(67,164,229)","size":11.333333015441895},{"label":"Vincent Aboubakar","x":458.3448486328125,"y":202.27162170410156,"id":"705","attributes":{"Eigenvector Centrality":"0.32277187794408035","Betweenness Centrality":"0.0","Appearances":"24","No":"10","Country":"Cameroon","Club Country":"France","Club":"Lorient","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"22 January 1992 (aged 22)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"Paul Pogba","x":8.138252258300781,"y":94.41950225830078,"id":"565","attributes":{"Eigenvector Centrality":"0.7020295109364902","Betweenness Centrality":"0.00827672737020524","Appearances":"11","No":"19","Country":"France","Club Country":"Italy","Club":"Juventus","Weighted Degree":"33.0","Modularity Class":"16","Date of birth / Age":"15 March 1993 (aged 21)","Degree":"33","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.33424283765347884"},"color":"rgb(229,67,229)","size":24.666667938232422},{"label":"Alejandro Bedoya","x":784.4288940429688,"y":-1547.6514892578125,"id":"20","attributes":{"Eigenvector Centrality":"0.27181518429351065","Betweenness Centrality":"0.0","Appearances":"28","No":"11","Country":"United States","Club Country":"France","Club":"Nantes","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"29 April 1987 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Hossein Mahini","x":1969.51806640625,"y":1144.54345703125,"id":"284","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"22","No":"13","Country":"Iran","Club Country":"Iran","Club":"Persepolis","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"16 September 1986 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Aleksandr Kerzhakov","x":-1228.88916015625,"y":-1267.0670166015625,"id":"21","attributes":{"Eigenvector Centrality":"0.3498246554244825","Betweenness Centrality":"0.004583905120882726","Appearances":"80","No":"11","Country":"Russia","Club Country":"Russia","Club":"Zenit Saint Petersburg","Weighted Degree":"26.0","Modularity Class":"2","Date of birth / Age":"27 November 1982 (aged 31)","Degree":"26","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.27904328018223234"},"color":"rgb(229,67,67)","size":15.333333969116211},{"label":"Frickson Erazo","x":-1740.312255859375,"y":-668.1109619140625,"id":"235","attributes":{"Eigenvector Centrality":"0.3623062182068215","Betweenness Centrality":"0.0","Appearances":"37","No":"3","Country":"Ecuador","Club Country":"Brazil","Club":"Flamengo","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"5 May 1988 (aged 26)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Ousmane Viera","x":474.08282470703125,"y":-965.5185546875,"id":"553","attributes":{"Eigenvector Centrality":"0.3219703768914536","Betweenness Centrality":"0.0013416368447328885","Appearances":"1","No":"2","Country":"Ivory Coast","Club Country":"Turkey","Club":"Çaykur Rizespor","Weighted Degree":"23.0","Modularity Class":"9","Date of birth / Age":"21 December 1986 (aged 27)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30334296326867516"},"color":"rgb(164,67,229)","size":11.333333015441895},{"label":"Shusaku Nishikawa","x":727.420166015625,"y":656.2659301757812,"id":"651","attributes":{"Eigenvector Centrality":"0.31718153777834773","Betweenness Centrality":"0.0","Appearances":"13","No":"12","Country":"Japan","Club Country":"Japan","Club":"Urawa Red Diamonds","Weighted Degree":"22.0","Modularity Class":"27","Date of birth / Age":"18 June 1986 (aged 27)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3107822410147992"},"color":"rgb(67,100,229)","size":10.0},{"label":"Andrea Barzagli","x":109.97048950195312,"y":937.1626586914062,"id":"45","attributes":{"Eigenvector Centrality":"0.5455496050511397","Betweenness Centrality":"0.0016215443882875223","Appearances":"47","No":"15","Country":"Italy","Club Country":"Italy","Club":"Juventus","Weighted Degree":"28.0","Modularity Class":"3","Date of birth / Age":"8 May 1981 (aged 33)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(197,229,67)","size":18.0},{"label":"Oliver Zelenika","x":-310.13934326171875,"y":653.3941040039062,"id":"542","attributes":{"Eigenvector Centrality":"0.34443939620173625","Betweenness Centrality":"0.0","Appearances":"0","No":"12","Country":"Croatia","Club Country":"Croatia","Club":"Lokomotiva","Weighted Degree":"22.0","Modularity Class":"25","Date of birth / Age":"14 May 1993 (aged 21)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.29178245335450576"},"color":"rgb(132,67,229)","size":10.0},{"label":"Alan Pulido","x":-2016.3092041015625,"y":442.1366271972656,"id":"17","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"6","No":"11","Country":"Mexico","Club Country":"Mexico","Club":"UANL","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"8 March 1991 (aged 23)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Ivica Olic","x":-356.2250061035156,"y":503.7689208984375,"id":"301","attributes":{"Eigenvector Centrality":"0.4414842289662269","Betweenness Centrality":"0.0021210911790253153","Appearances":"92","No":"18","Country":"Croatia","Club Country":"Germany","Club":"VfL Wolfsburg","Weighted Degree":"27.0","Modularity Class":"25","Date of birth / Age":"14 September 1979 (aged 34)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.317083692838654"},"color":"rgb(132,67,229)","size":16.666667938232422},{"label":"Divock Origi","x":-634.9317016601562,"y":-895.1273803710938,"id":"172","attributes":{"Eigenvector Centrality":"0.567406470826805","Betweenness Centrality":"0.002778667740909008","Appearances":"2","No":"17","Country":"Belgium","Club Country":"France","Club":"Lille","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"18 April 1995 (aged 19)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3383977900552486"},"color":"rgb(67,229,132)","size":14.0},{"label":"Han Kook-young","x":1158.830810546875,"y":1599.3704833984375,"id":"269","attributes":{"Eigenvector Centrality":"0.2315255949886878","Betweenness Centrality":"0.0","Appearances":"10","No":"14","Country":"South Korea","Club Country":"Japan","Club":"Kashiwa Reysol","Weighted Degree":"22.0","Modularity Class":"10","Date of birth / Age":"19 April 1990 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.24614869390488947"},"color":"rgb(229,67,164)","size":10.0},{"label":"Tommy Oar","x":2165.022705078125,"y":-713.5425415039062,"id":"686","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"15","No":"11","Country":"Australia","Club Country":"Netherlands","Club":"Utrecht","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"10 December 1991 (aged 22)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Raúl Jiménez","x":-2167.43408203125,"y":400.8553161621094,"id":"592","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"25","No":"9","Country":"Mexico","Club Country":"Mexico","Club":"América","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"5 May 1991 (aged 23)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Luka Modric","x":-410.41796875,"y":416.6111145019531,"id":"432","attributes":{"Eigenvector Centrality":"0.6315855500081669","Betweenness Centrality":"0.005842271062684167","Appearances":"75","No":"10","Country":"Croatia","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"33.0","Modularity Class":"25","Date of birth / Age":"9 September 1985 (aged 28)","Degree":"33","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3262316910785619"},"color":"rgb(132,67,229)","size":24.666667938232422},{"label":"Georginio Wijnaldum","x":874.0654907226562,"y":135.7948455810547,"id":"244","attributes":{"Eigenvector Centrality":"0.36016990192205894","Betweenness Centrality":"0.005645297467686556","Appearances":"5","No":"20","Country":"Netherlands","Club Country":"Netherlands","Club":"PSV","Weighted Degree":"24.0","Modularity Class":"22","Date of birth / Age":"11 November 1990 (aged 23)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3273942093541203"},"color":"rgb(197,67,229)","size":12.666666984558105},{"label":"Alfredo Talavera","x":-1995.7100830078125,"y":401.94842529296875,"id":"34","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"14","No":"12","Country":"Mexico","Club Country":"Mexico","Club":"Toluca","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"18 September 1982 (aged 31)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Esteban Paredes","x":-262.22747802734375,"y":1531.853271484375,"id":"207","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"35","No":"22","Country":"Chile","Club Country":"Chile","Club":"Colo-Colo","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"1 August 1980 (aged 33)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Enzo Pérez","x":-1057.39599609375,"y":279.5024719238281,"id":"202","attributes":{"Eigenvector Centrality":"0.5249878217996955","Betweenness Centrality":"8.46487079105798E-4","Appearances":"7","No":"8","Country":"Argentina","Club Country":"Portugal","Club":"Benfica","Weighted Degree":"25.0","Modularity Class":"19","Date of birth / Age":"22 February 1986 (aged 28)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3084347461183382"},"color":"rgb(67,229,229)","size":14.0},{"label":"Martín Cáceres","x":-21.211044311523438,"y":343.7950439453125,"id":"461","attributes":{"Eigenvector Centrality":"0.5969418716202328","Betweenness Centrality":"0.009327834149799673","Appearances":"57","No":"22","Country":"Uruguay","Club Country":"Italy","Club":"Juventus","Weighted Degree":"33.0","Modularity Class":"6","Date of birth / Age":"7 April 1987 (aged 27)","Degree":"33","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33731069297843047"},"color":"rgb(229,197,67)","size":24.666667938232422},{"label":"Thomas Vermaelen","x":-482.7641296386719,"y":-771.1542358398438,"id":"679","attributes":{"Eigenvector Centrality":"0.7319614548533502","Betweenness Centrality":"0.0031592253025152935","Appearances":"47","No":"3","Country":"Belgium","Club Country":"England","Club":"Arsenal","Weighted Degree":"31.0","Modularity Class":"28","Date of birth / Age":"14 November 1985 (aged 28)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33731069297843047"},"color":"rgb(67,229,132)","size":22.0},{"label":"Matt Besler","x":861.9520874023438,"y":-1604.162841796875,"id":"476","attributes":{"Eigenvector Centrality":"0.2718151842935107","Betweenness Centrality":"0.0","Appearances":"17","No":"5","Country":"United States","Club Country":"United States","Club":"Sporting Kansas City","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"11 February 1987 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Benjamin Moukandjo","x":415.3848876953125,"y":99.65612030029297,"id":"83","attributes":{"Eigenvector Centrality":"0.3227718779440804","Betweenness Centrality":"0.0","Appearances":"17","No":"8","Country":"Cameroon","Club Country":"France","Club":"Nancy","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"12 November 1988 (aged 25)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"David Ospina","x":-821.8875122070312,"y":1214.61767578125,"id":"153","attributes":{"Eigenvector Centrality":"0.3139492510789159","Betweenness Centrality":"0.0","Appearances":"44","No":"1","Country":"Colombia","Club Country":"France","Club":"Nice","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"31 August 1988 (aged 25)","Degree":"22","Position":"GK","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Felipe Caicedo","x":-1726.1597900390625,"y":-587.7854614257812,"id":"222","attributes":{"Eigenvector Centrality":"0.3623062182068215","Betweenness Centrality":"0.0","Appearances":"50","No":"11","Country":"Ecuador","Club Country":"United Arab Emirates","Club":"Al-Jazira","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"5 September 1988 (aged 25)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Kevin Großkreutz","x":553.7317504882812,"y":-380.0992126464844,"id":"385","attributes":{"Eigenvector Centrality":"0.500680986024227","Betweenness Centrality":"0.008472576600609625","Appearances":"5","No":"2","Country":"Germany","Club Country":"Germany","Club":"Borussia Dortmund","Weighted Degree":"24.0","Modularity Class":"13","Date of birth / Age":"19 July 1988 (aged 25)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.310126582278481"},"color":"rgb(67,229,164)","size":12.666666984558105},{"label":"Jô","x":-470.48614501953125,"y":-271.3874816894531,"id":"331","attributes":{"Eigenvector Centrality":"0.5425650576268322","Betweenness Centrality":"0.0","Appearances":"17","No":"21","Country":"Brazil","Club Country":"Brazil","Club":"Atlético Mineiro","Weighted Degree":"22.0","Modularity Class":"23","Date of birth / Age":"20 March 1987 (aged 27)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3158573270305114"},"color":"rgb(229,67,197)","size":10.0},{"label":"Pavel Mogilevets","x":-1357.9305419921875,"y":-1289.38330078125,"id":"568","attributes":{"Eigenvector Centrality":"0.2784495406871368","Betweenness Centrality":"0.0019868644316807485","Appearances":"1","No":"15","Country":"Russia","Club Country":"Russia","Club":"Rubin Kazan","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"25 January 1993 (aged 21)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.256186824677588"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Raïs M\u0027Bolhi","x":-1459.36083984375,"y":1229.281982421875,"id":"585","attributes":{"Eigenvector Centrality":"0.2958935568628797","Betweenness Centrality":"0.0","Appearances":"28","No":"23","Country":"Algeria","Club Country":"Bulgaria","Club":"CSKA Sofia","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"25 April 1986 (aged 28)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Henrique","x":-572.6226806640625,"y":-84.16056823730469,"id":"279","attributes":{"Eigenvector Centrality":"0.8111998945620833","Betweenness Centrality":"0.00493020854872855","Appearances":"5","No":"15","Country":"Brazil","Club Country":"Italy","Club":"Napoli","Weighted Degree":"33.0","Modularity Class":"23","Date of birth / Age":"14 October 1986 (aged 27)","Degree":"33","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3458823529411765"},"color":"rgb(229,67,197)","size":24.666667938232422},{"label":"Daryl Janmaat","x":832.5292358398438,"y":28.84025001525879,"id":"149","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"16","No":"7","Country":"Netherlands","Club Country":"Netherlands","Club":"Feyenoord","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"22 July 1989 (aged 24)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"Álvaro González","x":13.41373348236084,"y":-43.777435302734375,"id":"38","attributes":{"Eigenvector Centrality":"0.4846353390672056","Betweenness Centrality":"0.006932977102729991","Appearances":"43","No":"20","Country":"Uruguay","Club Country":"Italy","Club":"Lazio","Weighted Degree":"28.0","Modularity Class":"6","Date of birth / Age":"29 October 1984 (aged 29)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34507042253521125"},"color":"rgb(229,197,67)","size":18.0},{"label":"Essaïd Belkalem","x":-1238.16552734375,"y":1250.7357177734375,"id":"205","attributes":{"Eigenvector Centrality":"0.30611433682396827","Betweenness Centrality":"0.005838443339718533","Appearances":"13","No":"4","Country":"Algeria","Club Country":"England","Club":"Watford","Weighted Degree":"23.0","Modularity Class":"24","Date of birth / Age":"1 January 1989 (aged 25)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.29388244702119154"},"color":"rgb(67,164,229)","size":11.333333015441895},{"label":"Adrián Ramos","x":-712.1338500976562,"y":1053.31591796875,"id":"10","attributes":{"Eigenvector Centrality":"0.3252993880084764","Betweenness Centrality":"0.003909094271768691","Appearances":"26","No":"19","Country":"Colombia","Club Country":"Germany","Club":"Hertha BSC","Weighted Degree":"23.0","Modularity Class":"11","Date of birth / Age":"22 January 1986 (aged 28)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.3080469404861693"},"color":"rgb(67,67,229)","size":11.333333015441895},{"label":"José Miguel Cubero","x":2268.583740234375,"y":346.56884765625,"id":"360","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"35","No":"22","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Herediano","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"14 February 1987 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Yuto Nagatomo","x":395.0039367675781,"y":607.56591796875,"id":"734","attributes":{"Eigenvector Centrality":"0.44967087937585604","Betweenness Centrality":"0.011059526851986908","Appearances":"70","No":"5","Country":"Japan","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"29.0","Modularity Class":"27","Date of birth / Age":"12 September 1986 (aged 27)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33731069297843047"},"color":"rgb(67,100,229)","size":19.333332061767578},{"label":"Hassan Yebda","x":-1303.48681640625,"y":1254.45166015625,"id":"274","attributes":{"Eigenvector Centrality":"0.30778242364802144","Betweenness Centrality":"0.0021251327211181483","Appearances":"25","No":"7","Country":"Algeria","Club Country":"Italy","Club":"Udinese","Weighted Degree":"23.0","Modularity Class":"24","Date of birth / Age":"14 May 1984 (aged 30)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2980535279805353"},"color":"rgb(67,164,229)","size":11.333333015441895},{"label":"Mensur Mujdža","x":1039.0458984375,"y":-418.0989685058594,"id":"497","attributes":{"Eigenvector Centrality":"0.3323231211056512","Betweenness Centrality":"0.006714488569703231","Appearances":"24","No":"13","Country":"Bosnia and Herzegovina","Club Country":"Germany","Club":"SC Freiburg","Weighted Degree":"25.0","Modularity Class":"20","Date of birth / Age":"28 March 1984 (aged 30)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(132,229,67)","size":14.0},{"label":"Matt McKay","x":2090.569580078125,"y":-687.9733276367188,"id":"477","attributes":{"Eigenvector Centrality":"0.2213229433005502","Betweenness Centrality":"0.0","Appearances":"47","No":"17","Country":"Australia","Club Country":"Australia","Club":"Brisbane Roar","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"11 January 1983 (aged 31)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Dany Nounkeu","x":382.61639404296875,"y":41.81476974487305,"id":"146","attributes":{"Eigenvector Centrality":"0.3503932506862968","Betweenness Centrality":"0.003969104553989964","Appearances":"16","No":"5","Country":"Cameroon","Club Country":"Turkey","Club":"Be?ikta?","Weighted Degree":"24.0","Modularity Class":"17","Date of birth / Age":"11 April 1986 (aged 28)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3272484416740873"},"color":"rgb(67,132,229)","size":12.666666984558105},{"label":"Toshihiro Aoyama","x":774.469970703125,"y":733.8078002929688,"id":"689","attributes":{"Eigenvector Centrality":"0.327417913267161","Betweenness Centrality":"0.0034073119067962805","Appearances":"6","No":"14","Country":"Japan","Club Country":"Japan","Club":"Sanfrecce Hiroshima","Weighted Degree":"23.0","Modularity Class":"27","Date of birth / Age":"22 February 1986 (aged 28)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.315450643776824"},"color":"rgb(67,100,229)","size":11.333333015441895},{"label":"Pablo Zabaleta","x":-933.6387939453125,"y":24.648056030273438,"id":"555","attributes":{"Eigenvector Centrality":"0.6398902783818313","Betweenness Centrality":"0.003598075368399343","Appearances":"36","No":"4","Country":"Argentina","Club Country":"England","Club":"Manchester City","Weighted Degree":"29.0","Modularity Class":"19","Date of birth / Age":"16 January 1985 (aged 29)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3316787003610108"},"color":"rgb(67,229,229)","size":19.333332061767578},{"label":"Luis Saritama","x":-1546.898681640625,"y":-441.077392578125,"id":"429","attributes":{"Eigenvector Centrality":"0.7525405481416904","Betweenness Centrality":"0.006691544296226193","Appearances":"49","No":"19","Country":"Ecuador","Club Country":"Ecuador","Club":"Barcelona","Weighted Degree":"35.0","Modularity Class":"4","Date of birth / Age":"20 October 1983 (aged 30)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(229,67,132)","size":27.33333396911621},{"label":"Orestis Karnezis","x":1393.8565673828125,"y":576.5565795898438,"id":"545","attributes":{"Eigenvector Centrality":"0.28385897578556757","Betweenness Centrality":"0.01153344916312804","Appearances":"19","No":"1","Country":"Greece","Club Country":"Spain","Club":"Granada","Weighted Degree":"24.0","Modularity Class":"15","Date of birth / Age":"11 July 1985 (aged 28)","Degree":"24","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.30624999999999997"},"color":"rgb(229,67,100)","size":12.666666984558105},{"label":"Abel Aguilar","x":-660.8257446289062,"y":1009.1897583007812,"id":"2","attributes":{"Eigenvector Centrality":"0.33885801794641307","Betweenness Centrality":"0.004574685606976985","Appearances":"49","No":"8","Country":"Colombia","Club Country":"France","Club":"Toulouse","Weighted Degree":"24.0","Modularity Class":"11","Date of birth / Age":"6 January 1985 (aged 29)","Degree":"24","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(67,67,229)","size":12.666666984558105},{"label":"Panagiotis Glykos","x":1575.4261474609375,"y":522.7161865234375,"id":"556","attributes":{"Eigenvector Centrality":"0.2581333696341679","Betweenness Centrality":"0.0","Appearances":"2","No":"12","Country":"Greece","Club Country":"Greece","Club":"PAOK","Weighted Degree":"22.0","Modularity Class":"15","Date of birth / Age":"3 June 1986 (aged 28)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2760045061960195"},"color":"rgb(229,67,100)","size":10.0},{"label":"José Juan Vázquez","x":-2102.5595703125,"y":434.6721496582031,"id":"357","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"5","No":"23","Country":"Mexico","Club Country":"Mexico","Club":"León","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"14 March 1988 (aged 26)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Vincent Kompany (c)","x":-575.3739013671875,"y":-726.921630859375,"id":"707","attributes":{"Eigenvector Centrality":"0.7270895604312667","Betweenness Centrality":"0.008072864238933854","Appearances":"59","No":"4","Country":"Belgium","Club Country":"England","Club":"Manchester City","Weighted Degree":"31.0","Modularity Class":"28","Date of birth / Age":"10 April 1986 (aged 28)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3506679389312977"},"color":"rgb(67,229,132)","size":22.0},{"label":"Mehrdad Pouladi","x":1894.86376953125,"y":1109.2691650390625,"id":"495","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"20","No":"23","Country":"Iran","Club Country":"Iran","Club":"Persepolis","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"26 February 1987 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Marcelo Brozovic","x":-406.1941833496094,"y":695.7294311523438,"id":"444","attributes":{"Eigenvector Centrality":"0.35648846045640376","Betweenness Centrality":"0.0013005076523818384","Appearances":"1","No":"14","Country":"Croatia","Club Country":"Croatia","Club":"Dinamo Zagreb","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"16 October 1992 (aged 21)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30209617755856966"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Laurent Ciman","x":-542.019287109375,"y":-660.8407592773438,"id":"408","attributes":{"Eigenvector Centrality":"0.5473733076826977","Betweenness Centrality":"0.004841485029495745","Appearances":"8","No":"23","Country":"Belgium","Club Country":"Belgium","Club":"Standard Liège","Weighted Degree":"24.0","Modularity Class":"28","Date of birth / Age":"5 August 1985 (aged 28)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3359232175502742"},"color":"rgb(67,229,132)","size":12.666666984558105},{"label":"Isaác Brizuela","x":-2104.457275390625,"y":342.27984619140625,"id":"295","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"7","No":"17","Country":"Mexico","Club Country":"Mexico","Club":"Toluca","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"28 August 1990 (aged 23)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Mario Yepes (c)","x":-719.3209838867188,"y":1256.8892822265625,"id":"457","attributes":{"Eigenvector Centrality":"0.326518739989132","Betweenness Centrality":"0.0018851206504077599","Appearances":"98","No":"3","Country":"Colombia","Club Country":"Italy","Club":"Atalanta","Weighted Degree":"23.0","Modularity Class":"11","Date of birth / Age":"13 January 1976 (aged 38)","Degree":"23","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2995110024449878"},"color":"rgb(67,67,229)","size":11.333333015441895},{"label":"Ramires","x":-481.0262451171875,"y":-469.7139587402344,"id":"586","attributes":{"Eigenvector Centrality":"0.7525362816963487","Betweenness Centrality":"0.002196566654268722","Appearances":"42","No":"16","Country":"Brazil","Club Country":"England","Club":"Chelsea","Weighted Degree":"30.0","Modularity Class":"23","Date of birth / Age":"24 March 1987 (aged 27)","Degree":"30","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3471894189891356"},"color":"rgb(229,67,197)","size":20.666667938232422},{"label":"Cédric Djeugoué","x":458.0302734375,"y":113.75821685791016,"id":"107","attributes":{"Eigenvector Centrality":"0.32277187794408035","Betweenness Centrality":"0.0","Appearances":"3","No":"4","Country":"Cameroon","Club Country":"Cameroon","Club":"Coton Sport","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"28 August 1992 (aged 21)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"Igor Denisov","x":-1478.451904296875,"y":-1427.125244140625,"id":"293","attributes":{"Eigenvector Centrality":"0.28166227463506127","Betweenness Centrality":"6.368705012250895E-4","Appearances":"43","No":"7","Country":"Russia","Club Country":"Russia","Club":"Dynamo Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"17 May 1984 (aged 30)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.25538568450312715"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Marco Fabián","x":-2042.7996826171875,"y":288.5499267578125,"id":"446","attributes":{"Eigenvector Centrality":"0.29131873163694544","Betweenness Centrality":"0.0012783129193471678","Appearances":"15","No":"8","Country":"Mexico","Club Country":"Mexico","Club":"Cruz Azul","Weighted Degree":"23.0","Modularity Class":"21","Date of birth / Age":"21 July 1989 (aged 24)","Degree":"23","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.2744585511575803"},"color":"rgb(67,229,67)","size":11.333333015441895},{"label":"Kevin-Prince Boateng","x":528.2719116210938,"y":1086.7677001953125,"id":"387","attributes":{"Eigenvector Centrality":"0.3920782711719237","Betweenness Centrality":"0.013927046623876642","Appearances":"13","No":"9","Country":"Ghana","Club Country":"Germany","Club":"Schalke \u002704","Weighted Degree":"28.0","Modularity Class":"5","Date of birth / Age":"6 March 1987 (aged 27)","Degree":"28","Position":"FW","Eccentricity":"4.0","Closeness Centrality":"0.3287119856887299"},"color":"rgb(67,229,197)","size":18.0},{"label":"Shola Ameobi","x":18.68687629699707,"y":-1408.741943359375,"id":"649","attributes":{"Eigenvector Centrality":"0.39186636186315155","Betweenness Centrality":"0.004728167800452107","Appearances":"7","No":"23","Country":"Nigeria","Club Country":"England","Club":"Newcastle United","Weighted Degree":"27.0","Modularity Class":"14","Date of birth / Age":"12 October 1981 (aged 32)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.31873373807458805"},"color":"rgb(67,229,100)","size":16.666667938232422},{"label":"Oribe Peralta","x":-2123.54345703125,"y":394.2029113769531,"id":"546","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"33","No":"19","Country":"Mexico","Club Country":"Mexico","Club":"Santos Laguna","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"12 January 1984 (aged 30)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Marouane Fellaini","x":-655.5911865234375,"y":-756.7737426757812,"id":"460","attributes":{"Eigenvector Centrality":"0.8465738555476342","Betweenness Centrality":"0.005671820760248386","Appearances":"50","No":"8","Country":"Belgium","Club Country":"England","Club":"Manchester United","Weighted Degree":"34.0","Modularity Class":"28","Date of birth / Age":"22 November 1987 (aged 26)","Degree":"34","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3554158607350097"},"color":"rgb(67,229,132)","size":26.0},{"label":"Mark Bresciano","x":2122.005615234375,"y":-604.5106811523438,"id":"458","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"74","No":"23","Country":"Australia","Club Country":"Qatar","Club":"Al-Gharafa","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"11 February 1980 (aged 34)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Juan Pablo Montes","x":1592.6820068359375,"y":-1250.384033203125,"id":"372","attributes":{"Eigenvector Centrality":"0.23664887946331797","Betweenness Centrality":"0.0","Appearances":"11","No":"4","Country":"Honduras","Club Country":"Honduras","Club":"Motagua","Weighted Degree":"22.0","Modularity Class":"7","Date of birth / Age":"26 October 1985 (aged 28)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.26344086021505375"},"color":"rgb(100,67,229)","size":10.0},{"label":"Sokratis Papastathopoulos","x":1506.5098876953125,"y":339.672119140625,"id":"656","attributes":{"Eigenvector Centrality":"0.34048353254028174","Betweenness Centrality":"0.015463773824795727","Appearances":"47","No":"19","Country":"Greece","Club Country":"Germany","Club":"Borussia Dortmund","Weighted Degree":"27.0","Modularity Class":"15","Date of birth / Age":"9 June 1988 (aged 26)","Degree":"27","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.29178245335450576"},"color":"rgb(229,67,100)","size":16.666667938232422},{"label":"Blerim Džemaili","x":-243.03868103027344,"y":290.1379699707031,"id":"88","attributes":{"Eigenvector Centrality":"0.6153709092825856","Betweenness Centrality":"0.004199284588766183","Appearances":"34","No":"15","Country":"Switzerland","Club Country":"Italy","Club":"Napoli","Weighted Degree":"31.0","Modularity Class":"0","Date of birth / Age":"12 April 1986 (aged 28)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3331822302810517"},"color":"rgb(164,229,67)","size":22.0},{"label":"Mario Balotelli","x":253.78076171875,"y":886.2698364257812,"id":"452","attributes":{"Eigenvector Centrality":"0.49991402097095833","Betweenness Centrality":"0.003073405743850096","Appearances":"30","No":"9","Country":"Italy","Club Country":"Italy","Club":"Milan","Weighted Degree":"27.0","Modularity Class":"3","Date of birth / Age":"12 August 1990 (aged 23)","Degree":"27","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.31928757602085145"},"color":"rgb(197,229,67)","size":16.666667938232422},{"label":"Ivan Rakitic","x":-359.27825927734375,"y":645.7860717773438,"id":"300","attributes":{"Eigenvector Centrality":"0.38837093893822316","Betweenness Centrality":"0.003900575726937713","Appearances":"62","No":"7","Country":"Croatia","Club Country":"Spain","Club":"Sevilla","Weighted Degree":"25.0","Modularity Class":"25","Date of birth / Age":"10 March 1988 (aged 26)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31873373807458805"},"color":"rgb(132,67,229)","size":14.0},{"label":"Denis Glushakov","x":-1381.390869140625,"y":-1518.66748046875,"id":"158","attributes":{"Eigenvector Centrality":"0.26569304291819806","Betweenness Centrality":"0.0","Appearances":"26","No":"8","Country":"Russia","Club Country":"Russia","Club":"Spartak Moscow","Weighted Degree":"22.0","Modularity Class":"2","Date of birth / Age":"27 January 1987 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.23244781783681215"},"color":"rgb(229,67,67)","size":10.0},{"label":"Alexander Mejía","x":-761.3262329101562,"y":1152.329833984375,"id":"31","attributes":{"Eigenvector Centrality":"0.31394925107891597","Betweenness Centrality":"0.0","Appearances":"8","No":"15","Country":"Colombia","Club Country":"Colombia","Club":"Atlético Nacional","Weighted Degree":"22.0","Modularity Class":"11","Date of birth / Age":"11 July 1988 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.29329608938547486"},"color":"rgb(67,67,229)","size":10.0},{"label":"Iker Casillas (c)","x":-800.6239624023438,"y":-169.28741455078125,"id":"294","attributes":{"Eigenvector Centrality":"0.9040112595591265","Betweenness Centrality":"0.001687861941424018","Appearances":"154","No":"1","Country":"Spain","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"31.0","Modularity Class":"23","Date of birth / Age":"20 May 1981 (aged 33)","Degree":"31","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3350045578851413"},"color":"rgb(229,67,197)","size":22.0},{"label":"Bastian Schweinsteiger","x":244.85414123535156,"y":-373.9827575683594,"id":"79","attributes":{"Eigenvector Centrality":"0.6585766805388439","Betweenness Centrality":"0.0026429368589338613","Appearances":"102","No":"7","Country":"Germany","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"1 August 1984 (aged 29)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3390221402214022"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Héctor Moreno","x":-1943.870849609375,"y":364.6249694824219,"id":"276","attributes":{"Eigenvector Centrality":"0.2913525846132968","Betweenness Centrality":"0.0014244038755752933","Appearances":"53","No":"15","Country":"Mexico","Club Country":"Spain","Club":"Espanyol","Weighted Degree":"23.0","Modularity Class":"21","Date of birth / Age":"17 January 1988 (aged 26)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.2797868290826037"},"color":"rgb(67,229,67)","size":11.333333015441895},{"label":"Enner Valencia","x":-1712.62646484375,"y":-633.4451293945312,"id":"201","attributes":{"Eigenvector Centrality":"0.3623062182068215","Betweenness Centrality":"0.0","Appearances":"10","No":"13","Country":"Ecuador","Club Country":"Mexico","Club":"Pachuca","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"11 April 1989 (aged 25)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Miiko Albornoz","x":-282.7862243652344,"y":1583.49462890625,"id":"512","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"2","No":"3","Country":"Chile","Club Country":"Sweden","Club":"Malmö FF","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"30 November 1990 (aged 23)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Nigel de Jong","x":764.1231689453125,"y":266.0992126464844,"id":"534","attributes":{"Eigenvector Centrality":"0.4525178607313098","Betweenness Centrality":"0.007743435699427788","Appearances":"71","No":"6","Country":"Netherlands","Club Country":"Italy","Club":"Milan","Weighted Degree":"29.0","Modularity Class":"22","Date of birth / Age":"13 November 1984 (aged 29)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3300404131118096"},"color":"rgb(197,67,229)","size":19.333332061767578},{"label":"Diego Forlán","x":22.54448699951172,"y":32.10325241088867,"id":"165","attributes":{"Eigenvector Centrality":"0.40103485022538","Betweenness Centrality":"0.0023543724845431786","Appearances":"110","No":"10","Country":"Uruguay","Club Country":"Japan","Club":"Cerezo Osaka","Weighted Degree":"24.0","Modularity Class":"6","Date of birth / Age":"19 May 1979 (aged 35)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3220858895705521"},"color":"rgb(229,197,67)","size":12.666666984558105},{"label":"Marco Verratti","x":74.62252044677734,"y":597.4002075195312,"id":"449","attributes":{"Eigenvector Centrality":"0.577944433296703","Betweenness Centrality":"0.001710601263663759","Appearances":"6","No":"23","Country":"Italy","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"29.0","Modularity Class":"3","Date of birth / Age":"5 November 1992 (aged 21)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3166738474795347"},"color":"rgb(197,229,67)","size":19.333332061767578},{"label":"Joe Hart","x":-212.69390869140625,"y":-704.6478271484375,"id":"335","attributes":{"Eigenvector Centrality":"0.7015324384017536","Betweenness Centrality":"0.003652191896387035","Appearances":"41","No":"1","Country":"England","Club Country":"England","Club":"Manchester City","Weighted Degree":"30.0","Modularity Class":"28","Date of birth / Age":"19 May 1987 (aged 27)","Degree":"30","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3316787003610108"},"color":"rgb(67,229,132)","size":20.666667938232422},{"label":"Loïc Feudjou","x":464.741943359375,"y":157.33299255371094,"id":"420","attributes":{"Eigenvector Centrality":"0.3227718779440803","Betweenness Centrality":"0.0","Appearances":"2","No":"1","Country":"Cameroon","Club Country":"Cameroon","Club":"Coton Sport","Weighted Degree":"22.0","Modularity Class":"17","Date of birth / Age":"14 April 1992 (aged 22)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(67,132,229)","size":10.0},{"label":"Wakaso Mubarak","x":209.4365234375,"y":1057.447998046875,"id":"709","attributes":{"Eigenvector Centrality":"0.32387682859035066","Betweenness Centrality":"0.009270286480100764","Appearances":"17","No":"22","Country":"Ghana","Club Country":"Russia","Club":"Rubin Kazan","Weighted Degree":"25.0","Modularity Class":"5","Date of birth / Age":"25 July 1990 (aged 23)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2897122585731179"},"color":"rgb(67,229,197)","size":14.0},{"label":"Alexander Domínguez","x":-1643.0283203125,"y":-689.7501831054688,"id":"30","attributes":{"Eigenvector Centrality":"0.3623062182068214","Betweenness Centrality":"0.0","Appearances":"18","No":"22","Country":"Ecuador","Club Country":"Ecuador","Club":"LDU Quito","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"5 June 1987 (aged 27)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Camilo Vargas","x":-870.7738037109375,"y":1102.7423095703125,"id":"96","attributes":{"Eigenvector Centrality":"0.32771831640802235","Betweenness Centrality":"0.0031253464825959647","Appearances":"0","No":"12","Country":"Colombia","Club Country":"Colombia","Club":"Santa Fe","Weighted Degree":"23.0","Modularity Class":"11","Date of birth / Age":"9 March 1989 (aged 25)","Degree":"23","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.3046000828843763"},"color":"rgb(67,67,229)","size":11.333333015441895},{"label":"Gordon Schildenfeld","x":-217.73817443847656,"y":655.733154296875,"id":"263","attributes":{"Eigenvector Centrality":"0.35596191653510817","Betweenness Centrality":"0.00248185018192758","Appearances":"21","No":"13","Country":"Croatia","Club Country":"Greece","Club":"Panathinaikos","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"18 March 1985 (aged 29)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30676126878130217"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Miguel Ángel Ponce","x":-2068.725830078125,"y":475.1539306640625,"id":"509","attributes":{"Eigenvector Centrality":"0.2771264523867947","Betweenness Centrality":"0.0","Appearances":"8","No":"16","Country":"Mexico","Club Country":"Mexico","Club":"Toluca","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"12 April 1989 (aged 25)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Klaas-Jan Huntelaar","x":809.1665649414062,"y":91.84487915039062,"id":"396","attributes":{"Eigenvector Centrality":"0.4358139473318699","Betweenness Centrality":"0.00591887145222094","Appearances":"62","No":"19","Country":"Netherlands","Club Country":"Germany","Club":"Schalke \u002704","Weighted Degree":"28.0","Modularity Class":"22","Date of birth / Age":"12 August 1983 (aged 30)","Degree":"28","Position":"FW","Eccentricity":"4.0","Closeness Centrality":"0.34106728538283065"},"color":"rgb(197,67,229)","size":18.0},{"label":"Adam Lallana","x":-133.68426513671875,"y":-732.5047607421875,"id":"5","attributes":{"Eigenvector Centrality":"0.5904515327423898","Betweenness Centrality":"0.0016054547217210155","Appearances":"6","No":"20","Country":"England","Club Country":"England","Club":"Southampton","Weighted Degree":"26.0","Modularity Class":"28","Date of birth / Age":"10 May 1988 (aged 26)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.32407407407407407"},"color":"rgb(67,229,132)","size":15.333333969116211},{"label":"Ognjen Vranješ","x":1242.7872314453125,"y":-442.58514404296875,"id":"538","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"13","No":"6","Country":"Bosnia and Herzegovina","Club Country":"Turkey","Club":"Elaz??spor","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"24 October 1989 (aged 24)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Nabil Bentaleb","x":-1282.9583740234375,"y":861.7017822265625,"id":"525","attributes":{"Eigenvector Centrality":"0.3967886399693337","Betweenness Centrality":"0.0057727171211353545","Appearances":"3","No":"14","Country":"Algeria","Club Country":"England","Club":"Tottenham Hotspur","Weighted Degree":"27.0","Modularity Class":"24","Date of birth / Age":"24 November 1994 (aged 19)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3127659574468085"},"color":"rgb(67,164,229)","size":16.666667938232422},{"label":"Christian Stuani","x":-159.97439575195312,"y":40.9938850402832,"id":"121","attributes":{"Eigenvector Centrality":"0.38716306457328087","Betweenness Centrality":"0.002173292405131628","Appearances":"10","No":"11","Country":"Uruguay","Club Country":"Spain","Club":"Espanyol","Weighted Degree":"23.0","Modularity Class":"6","Date of birth / Age":"12 October 1986 (aged 27)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3169469598965071"},"color":"rgb(229,197,67)","size":11.333333015441895},{"label":"Wayne Rooney","x":-356.8543395996094,"y":-834.0883178710938,"id":"713","attributes":{"Eigenvector Centrality":"0.7938188270448313","Betweenness Centrality":"0.0038886080479693477","Appearances":"92","No":"10","Country":"England","Club Country":"England","Club":"Manchester United","Weighted Degree":"32.0","Modularity Class":"28","Date of birth / Age":"24 October 1985 (aged 28)","Degree":"32","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3393351800554017"},"color":"rgb(67,229,132)","size":23.33333396911621},{"label":"Víctor Ibarbo","x":-760.33837890625,"y":1293.089111328125,"id":"701","attributes":{"Eigenvector Centrality":"0.32651873998913206","Betweenness Centrality":"0.0018851206504077605","Appearances":"9","No":"14","Country":"Colombia","Club Country":"Italy","Club":"Cagliari","Weighted Degree":"23.0","Modularity Class":"11","Date of birth / Age":"19 May 1990 (aged 24)","Degree":"23","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.2995110024449878"},"color":"rgb(67,67,229)","size":11.333333015441895},{"label":"Stephan Lichtsteiner","x":67.66877746582031,"y":456.6788330078125,"id":"661","attributes":{"Eigenvector Centrality":"0.6056758151342643","Betweenness Centrality":"0.009695316861352839","Appearances":"63","No":"2","Country":"Switzerland","Club Country":"Italy","Club":"Juventus","Weighted Degree":"33.0","Modularity Class":"0","Date of birth / Age":"16 January 1984 (aged 30)","Degree":"33","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3272484416740873"},"color":"rgb(164,229,67)","size":24.666667938232422},{"label":"Stefanos Kapino","x":1427.728271484375,"y":531.8199462890625,"id":"660","attributes":{"Eigenvector Centrality":"0.28485567017526575","Betweenness Centrality":"0.005086946710578289","Appearances":"2","No":"13","Country":"Greece","Club Country":"Greece","Club":"Panathinaikos","Weighted Degree":"24.0","Modularity Class":"15","Date of birth / Age":"18 March 1994 (aged 20)","Degree":"24","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.29108910891089107"},"color":"rgb(229,67,100)","size":12.666666984558105},{"label":"Daley Blind","x":865.136962890625,"y":-4.895512104034424,"id":"133","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"12","No":"5","Country":"Netherlands","Club Country":"Netherlands","Club":"Ajax","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"9 March 1990 (aged 24)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"Domagoj Vida","x":-257.2379455566406,"y":568.6809692382812,"id":"175","attributes":{"Eigenvector Centrality":"0.3750066769920371","Betweenness Centrality":"0.0014678886642237275","Appearances":"23","No":"21","Country":"Croatia","Club Country":"Ukraine","Club":"Dynamo Kyiv","Weighted Degree":"24.0","Modularity Class":"25","Date of birth / Age":"29 April 1989 (aged 25)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31450577663671375"},"color":"rgb(132,67,229)","size":12.666666984558105},{"label":"DaMarcus Beasley","x":860.4318237304688,"y":-1509.4605712890625,"id":"134","attributes":{"Eigenvector Centrality":"0.2718151842935107","Betweenness Centrality":"0.0","Appearances":"116","No":"7","Country":"United States","Club Country":"Mexico","Club":"Puebla","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"24 May 1982 (aged 32)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Guillermo Ochoa","x":-2012.4979248046875,"y":495.5871276855469,"id":"267","attributes":{"Eigenvector Centrality":"0.2891264231632272","Betweenness Centrality":"0.0013552426869013025","Appearances":"59","No":"13","Country":"Mexico","Club Country":"France","Club":"Ajaccio","Weighted Degree":"23.0","Modularity Class":"21","Date of birth / Age":"13 July 1985 (aged 28)","Degree":"23","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.2753840389659048"},"color":"rgb(67,229,67)","size":11.333333015441895},{"label":"Gonzalo Jara","x":-235.43576049804688,"y":1571.703369140625,"id":"262","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"65","No":"18","Country":"Chile","Club Country":"England","Club":"Nottingham Forest","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"29 August 1985 (aged 28)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Julian Draxler","x":528.5164184570312,"y":-263.5556335449219,"id":"374","attributes":{"Eigenvector Centrality":"0.5529715553555452","Betweenness Centrality":"0.006227653676219969","Appearances":"11","No":"14","Country":"Germany","Club Country":"Germany","Club":"Schalke \u002704","Weighted Degree":"27.0","Modularity Class":"13","Date of birth / Age":"20 September 1993 (aged 20)","Degree":"27","Position":"MF","Eccentricity":"4.0","Closeness Centrality":"0.3353102189781022"},"color":"rgb(67,229,164)","size":16.666667938232422},{"label":"André Almeida","x":-733.0572509765625,"y":266.98699951171875,"id":"42","attributes":{"Eigenvector Centrality":"0.4623139362600412","Betweenness Centrality":"0.0011159545915913598","Appearances":"5","No":"19","Country":"Portugal","Club Country":"Portugal","Club":"Benfica","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"10 September 1990 (aged 23)","Degree":"25","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.31722054380664655"},"color":"rgb(229,164,67)","size":14.0},{"label":"Aleksandr Kokorin","x":-1414.3739013671875,"y":-1377.2596435546875,"id":"22","attributes":{"Eigenvector Centrality":"0.2816622746350614","Betweenness Centrality":"6.368705012250895E-4","Appearances":"21","No":"9","Country":"Russia","Club Country":"Russia","Club":"Dynamo Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"19 March 1991 (aged 23)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.25538568450312715"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Felipe Gutiérrez","x":-184.13504028320312,"y":1490.4881591796875,"id":"223","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"18","No":"16","Country":"Chile","Club Country":"Netherlands","Club":"Twente","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"8 October 1990 (aged 23)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Simon Mignolet","x":-491.4549255371094,"y":-919.83154296875,"id":"654","attributes":{"Eigenvector Centrality":"0.7087966227214388","Betweenness Centrality":"0.004200915543181152","Appearances":"14","No":"12","Country":"Belgium","Club Country":"England","Club":"Liverpool","Weighted Degree":"31.0","Modularity Class":"28","Date of birth / Age":"6 August 1988 (aged 25)","Degree":"31","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.34329752452125173"},"color":"rgb(67,229,132)","size":22.0},{"label":"Maxwell","x":-388.1637878417969,"y":-99.59259033203125,"id":"490","attributes":{"Eigenvector Centrality":"0.7136149540335622","Betweenness Centrality":"0.0035076449501830744","Appearances":"9","No":"14","Country":"Brazil","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"30.0","Modularity Class":"23","Date of birth / Age":"27 August 1981 (aged 32)","Degree":"30","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3336359509759419"},"color":"rgb(229,67,197)","size":20.666667938232422},{"label":"Mohamed Zemmamouche","x":-1405.252685546875,"y":1223.2103271484375,"id":"519","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"7","No":"16","Country":"Algeria","Club Country":"Algeria","Club":"USM Alger","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"19 March 1985 (aged 29)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Ciro Immobile","x":317.4281921386719,"y":794.2503662109375,"id":"123","attributes":{"Eigenvector Centrality":"0.43196054419267377","Betweenness Centrality":"0.0018820457212751422","Appearances":"2","No":"17","Country":"Italy","Club Country":"Italy","Club":"Torino","Weighted Degree":"23.0","Modularity Class":"3","Date of birth / Age":"20 February 1990 (aged 24)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30497925311203317"},"color":"rgb(197,229,67)","size":11.333333015441895},{"label":"Stipe Pletikosa","x":-333.28179931640625,"y":696.1630249023438,"id":"669","attributes":{"Eigenvector Centrality":"0.34443939620173625","Betweenness Centrality":"0.0","Appearances":"111","No":"1","Country":"Croatia","Club Country":"Russia","Club":"Rostov","Weighted Degree":"22.0","Modularity Class":"25","Date of birth / Age":"8 January 1979 (aged 35)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.29178245335450576"},"color":"rgb(132,67,229)","size":10.0},{"label":"Ismaël Diomandé","x":445.3325500488281,"y":-874.9510498046875,"id":"297","attributes":{"Eigenvector Centrality":"0.3273739867705004","Betweenness Centrality":"5.067313329973086E-4","Appearances":"2","No":"14","Country":"Ivory Coast","Club Country":"France","Club":"Saint-Étienne","Weighted Degree":"23.0","Modularity Class":"9","Date of birth / Age":"28 August 1992 (aged 21)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30548628428927677"},"color":"rgb(164,67,229)","size":11.333333015441895},{"label":"Roger Espinoza","x":1525.8236083984375,"y":-1042.1474609375,"id":"609","attributes":{"Eigenvector Centrality":"0.24958708367603963","Betweenness Centrality":"0.00224748146417088","Appearances":"42","No":"15","Country":"Honduras","Club Country":"England","Club":"Wigan Athletic","Weighted Degree":"23.0","Modularity Class":"7","Date of birth / Age":"25 October 1986 (aged 27)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,67,229)","size":11.333333015441895},{"label":"Júnior Díaz","x":2052.333251953125,"y":457.9170837402344,"id":"378","attributes":{"Eigenvector Centrality":"0.2858658445617843","Betweenness Centrality":"0.019511326160720172","Appearances":"62","No":"15","Country":"Costa Rica","Club Country":"Germany","Club":"Mainz 05","Weighted Degree":"26.0","Modularity Class":"29","Date of birth / Age":"12 September 1983 (aged 30)","Degree":"26","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2916666666666667"},"color":"rgb(229,229,67)","size":15.333333969116211},{"label":"Diego Pérez","x":71.02754211425781,"y":37.87593078613281,"id":"168","attributes":{"Eigenvector Centrality":"0.3977686122666346","Betweenness Centrality":"0.008159853566079373","Appearances":"89","No":"15","Country":"Uruguay","Club Country":"Italy","Club":"Bologna","Weighted Degree":"24.0","Modularity Class":"6","Date of birth / Age":"18 May 1980 (aged 34)","Degree":"24","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.32637655417406747"},"color":"rgb(229,197,67)","size":12.666666984558105},{"label":"Danijel Subašic","x":-426.1968078613281,"y":636.2631225585938,"id":"143","attributes":{"Eigenvector Centrality":"0.39279324564134416","Betweenness Centrality":"0.002055537854408172","Appearances":"6","No":"23","Country":"Croatia","Club Country":"France","Club":"AS Monaco","Weighted Degree":"25.0","Modularity Class":"25","Date of birth / Age":"27 October 1984 (aged 29)","Degree":"25","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3150450064294899"},"color":"rgb(132,67,229)","size":14.0},{"label":"Luis Suárez","x":-100.21392822265625,"y":-246.3746795654297,"id":"430","attributes":{"Eigenvector Centrality":"0.5668349766194245","Betweenness Centrality":"0.005273786093229346","Appearances":"77","No":"9","Country":"Uruguay","Club Country":"England","Club":"Liverpool","Weighted Degree":"31.0","Modularity Class":"6","Date of birth / Age":"24 January 1987 (aged 27)","Degree":"31","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3365384615384615"},"color":"rgb(229,197,67)","size":22.0},{"label":"Marvin Chávez","x":1429.798828125,"y":-1179.989501953125,"id":"464","attributes":{"Eigenvector Centrality":"0.25036259885703577","Betweenness Centrality":"0.004810204715637005","Appearances":"42","No":"23","Country":"Honduras","Club Country":"United States","Club":"Chivas USA","Weighted Degree":"23.0","Modularity Class":"7","Date of birth / Age":"3 November 1983 (aged 30)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28171713300114987"},"color":"rgb(100,67,229)","size":11.333333015441895},{"label":"Allan Nyom","x":381.5302734375,"y":285.7757568359375,"id":"37","attributes":{"Eigenvector Centrality":"0.3467862797568034","Betweenness Centrality":"0.00587663072397192","Appearances":"10","No":"22","Country":"Cameroon","Club Country":"Spain","Club":"Granada","Weighted Degree":"24.0","Modularity Class":"17","Date of birth / Age":"10 May 1988 (aged 26)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3328804347826087"},"color":"rgb(67,132,229)","size":12.666666984558105},{"label":"Santiago Arias","x":-524.8426513671875,"y":1069.8533935546875,"id":"630","attributes":{"Eigenvector Centrality":"0.35261132545784823","Betweenness Centrality":"0.01168806541697648","Appearances":"6","No":"4","Country":"Colombia","Club Country":"Netherlands","Club":"PSV","Weighted Degree":"25.0","Modularity Class":"11","Date of birth / Age":"13 January 1992 (aged 22)","Degree":"25","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.3168103448275862"},"color":"rgb(67,67,229)","size":14.0},{"label":"Óscar Duarte","x":2292.369873046875,"y":190.4766845703125,"id":"550","attributes":{"Eigenvector Centrality":"0.2448400755989879","Betweenness Centrality":"0.004512594233796394","Appearances":"11","No":"6","Country":"Costa Rica","Club Country":"Belgium","Club":"Club Brugge","Weighted Degree":"23.0","Modularity Class":"29","Date of birth / Age":"3 June 1989 (aged 25)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2558301427079708"},"color":"rgb(229,229,67)","size":11.333333015441895},{"label":"Abdelmoumene Djabou","x":-1392.5499267578125,"y":1124.161376953125,"id":"1","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"8","No":"18","Country":"Algeria","Club Country":"Tunisia","Club":"Club Africain","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"31 January 1987 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Juwon Oshaniwa","x":-3.99511456489563,"y":-1656.1483154296875,"id":"379","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"10","No":"13","Country":"Nigeria","Club Country":"Israel","Club":"Ashdod","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"14 September 1990 (aged 23)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Francisco Silva","x":-207.91714477539062,"y":1451.440673828125,"id":"230","attributes":{"Eigenvector Centrality":"0.316119262177923","Betweenness Centrality":"0.0","Appearances":"12","No":"5","Country":"Chile","Club Country":"Spain","Club":"Osasuna","Weighted Degree":"22.0","Modularity Class":"18","Date of birth / Age":"11 February 1986 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2737430167597765"},"color":"rgb(229,132,67)","size":10.0},{"label":"Jason Davidson","x":2027.00927734375,"y":-621.2344360351562,"id":"313","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"7","No":"3","Country":"Australia","Club Country":"Netherlands","Club":"Heracles Almelo","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"29 June 1991 (aged 22)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Mousa Dembélé","x":-780.701416015625,"y":-765.0794067382812,"id":"522","attributes":{"Eigenvector Centrality":"0.5781054780643133","Betweenness Centrality":"0.0013899483715746057","Appearances":"57","No":"19","Country":"Belgium","Club Country":"England","Club":"Tottenham Hotspur","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"16 July 1987 (aged 26)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33638443935926776"},"color":"rgb(67,229,132)","size":14.0},{"label":"David de Gea","x":-916.8024291992188,"y":-469.9519348144531,"id":"150","attributes":{"Eigenvector Centrality":"1.0","Betweenness Centrality":"0.005194225936839837","Appearances":"1","No":"12","Country":"Spain","Club Country":"England","Club":"Manchester United","Weighted Degree":"34.0","Modularity Class":"23","Date of birth / Age":"7 November 1990 (aged 23)","Degree":"34","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3478466635115949"},"color":"rgb(229,67,197)","size":26.0},{"label":"Tim Cahill","x":2114.5048828125,"y":-511.01007080078125,"id":"680","attributes":{"Eigenvector Centrality":"0.2315995769978224","Betweenness Centrality":"0.0038336165219305914","Appearances":"69","No":"4","Country":"Australia","Club Country":"United States","Club":"New York Red Bulls","Weighted Degree":"23.0","Modularity Class":"12","Date of birth / Age":"6 December 1979 (aged 34)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.23535062439961577"},"color":"rgb(229,100,67)","size":11.333333015441895},{"label":"Dimitris Salpingidis","x":1578.1973876953125,"y":570.6368408203125,"id":"170","attributes":{"Eigenvector Centrality":"0.2581333696341679","Betweenness Centrality":"0.0","Appearances":"76","No":"14","Country":"Greece","Club Country":"Greece","Club":"PAOK","Weighted Degree":"22.0","Modularity Class":"15","Date of birth / Age":"18 August 1981 (aged 32)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2760045061960195"},"color":"rgb(229,67,100)","size":10.0},{"label":"Arturo Vidal","x":-116.50799560546875,"y":1233.550048828125,"id":"64","attributes":{"Eigenvector Centrality":"0.5204561062047255","Betweenness Centrality":"0.00860736609402208","Appearances":"54","No":"8","Country":"Chile","Club Country":"Italy","Club":"Juventus","Weighted Degree":"32.0","Modularity Class":"18","Date of birth / Age":"22 May 1987 (aged 27)","Degree":"32","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.31599312123817713"},"color":"rgb(229,132,67)","size":23.33333396911621},{"label":"Andy Najar","x":1494.201416015625,"y":-1172.4866943359375,"id":"52","attributes":{"Eigenvector Centrality":"0.25486924877772427","Betweenness Centrality":"0.0055302334935236706","Appearances":"17","No":"17","Country":"Honduras","Club Country":"Belgium","Club":"Anderlecht","Weighted Degree":"23.0","Modularity Class":"7","Date of birth / Age":"16 March 1993 (aged 21)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.28880157170923376"},"color":"rgb(100,67,229)","size":11.333333015441895},{"label":"Alex Song","x":-256.0782775878906,"y":56.99077224731445,"id":"28","attributes":{"Eigenvector Centrality":"0.764223422109595","Betweenness Centrality":"0.016336622858350185","Appearances":"47","No":"6","Country":"Cameroon","Club Country":"Spain","Club":"Barcelona","Weighted Degree":"37.0","Modularity Class":"17","Date of birth / Age":"9 September 1987 (aged 26)","Degree":"37","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34106728538283065"},"color":"rgb(67,132,229)","size":30.0},{"label":"Georgi Shchennikov","x":-1330.42041015625,"y":-1544.396240234375,"id":"243","attributes":{"Eigenvector Centrality":"0.279753045029421","Betweenness Centrality":"8.329697214751982E-4","Appearances":"4","No":"3","Country":"Russia","Club Country":"Russia","Club":"CSKA Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"27 April 1991 (aged 23)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.2544132917964694"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Mathew Leckie","x":2138.549072265625,"y":-562.8361206054688,"id":"470","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"8","No":"7","Country":"Australia","Club Country":"Germany","Club":"FSV Frankfurt","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"4 February 1991 (aged 23)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"James Holland","x":2105.74951171875,"y":-645.3329467773438,"id":"307","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"14","No":"16","Country":"Australia","Club Country":"Austria","Club":"Austria Wien","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"15 May 1989 (aged 25)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Stéphane Ruffier","x":44.78597640991211,"y":-265.3774108886719,"id":"663","attributes":{"Eigenvector Centrality":"0.5087837777709764","Betweenness Centrality":"0.0017249059427091587","Appearances":"2","No":"16","Country":"France","Club Country":"France","Club":"Saint-Étienne","Weighted Degree":"24.0","Modularity Class":"16","Date of birth / Age":"27 September 1986 (aged 27)","Degree":"24","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.3164012053379251"},"color":"rgb(229,67,229)","size":12.666666984558105},{"label":"Salvatore Sirigu","x":133.34747314453125,"y":646.74609375,"id":"622","attributes":{"Eigenvector Centrality":"0.5779444332967031","Betweenness Centrality":"0.001710601263663759","Appearances":"8","No":"12","Country":"Italy","Club Country":"France","Club":"Paris Saint-Germain","Weighted Degree":"29.0","Modularity Class":"3","Date of birth / Age":"12 January 1987 (aged 27)","Degree":"29","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3166738474795347"},"color":"rgb(197,229,67)","size":19.333332061767578},{"label":"Rashid Sumaila","x":457.3916015625,"y":1442.739013671875,"id":"590","attributes":{"Eigenvector Centrality":"0.2902743690727881","Betweenness Centrality":"0.0","Appearances":"6","No":"15","Country":"Ghana","Club Country":"South Africa","Club":"Mamelodi Sundowns","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"18 December 1992 (aged 21)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Panagiotis Tachtsidis","x":1428.6138916015625,"y":635.1239013671875,"id":"558","attributes":{"Eigenvector Centrality":"0.3047172931159461","Betweenness Centrality":"0.006160383817594169","Appearances":"6","No":"23","Country":"Greece","Club Country":"Italy","Club":"Torino","Weighted Degree":"25.0","Modularity Class":"15","Date of birth / Age":"15 February 1991 (aged 23)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.29016975917883936"},"color":"rgb(229,67,100)","size":14.0},{"label":"Antonio Valencia (c)","x":-1293.8275146484375,"y":-612.4883422851562,"id":"60","attributes":{"Eigenvector Centrality":"0.7194865947551579","Betweenness Centrality":"0.016480573584016885","Appearances":"71","No":"16","Country":"Ecuador","Club Country":"England","Club":"Manchester United","Weighted Degree":"35.0","Modularity Class":"4","Date of birth / Age":"4 August 1985 (aged 28)","Degree":"35","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33607681755829905"},"color":"rgb(229,67,132)","size":27.33333396911621},{"label":"Hashem Beikzadeh","x":1986.336181640625,"y":1189.6458740234375,"id":"273","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"17","No":"19","Country":"Iran","Club Country":"Iran","Club":"Esteghlal","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"22 January 1984 (aged 30)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Rafa Silva","x":-692.36767578125,"y":355.65155029296875,"id":"580","attributes":{"Eigenvector Centrality":"0.40962360528145025","Betweenness Centrality":"0.0","Appearances":"3","No":"15","Country":"Portugal","Club Country":"Portugal","Club":"Braga","Weighted Degree":"22.0","Modularity Class":"8","Date of birth / Age":"17 May 1993 (aged 21)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30714584203928125"},"color":"rgb(229,164,67)","size":10.0},{"label":"Loïc Rémy","x":73.68376922607422,"y":-313.17633056640625,"id":"421","attributes":{"Eigenvector Centrality":"0.5292224497836601","Betweenness Centrality":"0.0019647591823339743","Appearances":"25","No":"20","Country":"France","Club Country":"England","Club":"Newcastle United","Weighted Degree":"25.0","Modularity Class":"16","Date of birth / Age":"2 January 1987 (aged 27)","Degree":"25","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.3315290933694181"},"color":"rgb(229,67,229)","size":14.0},{"label":"Jean-Daniel Akpa-Akpro","x":413.52197265625,"y":-756.9923706054688,"id":"322","attributes":{"Eigenvector Centrality":"0.32268769768515043","Betweenness Centrality":"0.002014868000803819","Appearances":"1","No":"7","Country":"Ivory Coast","Club Country":"France","Club":"Toulouse","Weighted Degree":"23.0","Modularity Class":"9","Date of birth / Age":"11 October 1992 (aged 21)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30817610062893086"},"color":"rgb(164,67,229)","size":11.333333015441895},{"label":"Giorgos Tzavellas","x":1582.3857421875,"y":615.6647338867188,"id":"255","attributes":{"Eigenvector Centrality":"0.25813336963416794","Betweenness Centrality":"0.0","Appearances":"13","No":"3","Country":"Greece","Club Country":"Greece","Club":"PAOK","Weighted Degree":"22.0","Modularity Class":"15","Date of birth / Age":"26 November 1987 (aged 26)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2760045061960195"},"color":"rgb(229,67,100)","size":10.0},{"label":"Fred","x":-513.3817749023438,"y":-260.2742919921875,"id":"233","attributes":{"Eigenvector Centrality":"0.5425650576268323","Betweenness Centrality":"0.0","Appearances":"33","No":"9","Country":"Brazil","Club Country":"Brazil","Club":"Fluminense","Weighted Degree":"22.0","Modularity Class":"23","Date of birth / Age":"3 October 1983 (aged 30)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3158573270305114"},"color":"rgb(229,67,197)","size":10.0},{"label":"Per Mertesacker","x":261.4919738769531,"y":-532.3377075195312,"id":"573","attributes":{"Eigenvector Centrality":"0.6437896004097902","Betweenness Centrality":"0.002673471053911242","Appearances":"98","No":"17","Country":"Germany","Club Country":"England","Club":"Arsenal","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"29 September 1984 (aged 29)","Degree":"29","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3219448094612352"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Hernanes","x":-528.0017700195312,"y":-15.909561157226562,"id":"280","attributes":{"Eigenvector Centrality":"0.669052616458677","Betweenness Centrality":"0.005981834884331946","Appearances":"24","No":"18","Country":"Brazil","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"29.0","Modularity Class":"23","Date of birth / Age":"29 May 1985 (aged 29)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.34281716417910446"},"color":"rgb(229,67,197)","size":19.333332061767578},{"label":"Máximo Banguera","x":-1488.96337890625,"y":-533.3309326171875,"id":"489","attributes":{"Eigenvector Centrality":"0.7525405481416904","Betweenness Centrality":"0.006691544296226193","Appearances":"25","No":"1","Country":"Ecuador","Club Country":"Ecuador","Club":"Barcelona","Weighted Degree":"35.0","Modularity Class":"4","Date of birth / Age":"16 December 1985 (aged 28)","Degree":"35","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(229,67,132)","size":27.33333396911621},{"label":"Eliaquim Mangala","x":-347.64447021484375,"y":-15.025993347167969,"id":"196","attributes":{"Eigenvector Centrality":"0.6278043521909648","Betweenness Centrality":"0.009092242970245117","Appearances":"3","No":"13","Country":"France","Club Country":"Portugal","Club":"Porto","Weighted Degree":"30.0","Modularity Class":"16","Date of birth / Age":"13 February 1991 (aged 23)","Degree":"30","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.33669262482821805"},"color":"rgb(229,67,229)","size":20.666667938232422},{"label":"Álvaro Pereira","x":-93.80169677734375,"y":34.24333190917969,"id":"39","attributes":{"Eigenvector Centrality":"0.37564528732258246","Betweenness Centrality":"0.0","Appearances":"57","No":"6","Country":"Uruguay","Club Country":"Brazil","Club":"São Paulo","Weighted Degree":"22.0","Modularity Class":"6","Date of birth / Age":"28 November 1985 (aged 28)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3121019108280255"},"color":"rgb(229,197,67)","size":10.0},{"label":"Miguel Veloso","x":-552.1939086914062,"y":364.9159240722656,"id":"511","attributes":{"Eigenvector Centrality":"0.4519394040645381","Betweenness Centrality":"0.0020459479374588265","Appearances":"49","No":"4","Country":"Portugal","Club Country":"Ukraine","Club":"Dynamo Kyiv","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"11 May 1986 (aged 28)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(229,164,67)","size":14.0},{"label":"Saphir Taïder","x":-1233.49755859375,"y":1029.03173828125,"id":"631","attributes":{"Eigenvector Centrality":"0.4289736525122905","Betweenness Centrality":"0.007067153381945787","Appearances":"11","No":"19","Country":"Algeria","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"29.0","Modularity Class":"24","Date of birth / Age":"29 February 1992 (aged 22)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3208206023570493"},"color":"rgb(67,164,229)","size":19.333332061767578},{"label":"Dirk Kuyt","x":698.8324584960938,"y":-15.171172142028809,"id":"171","attributes":{"Eigenvector Centrality":"0.3965357475889929","Betweenness Centrality":"0.004158989584106385","Appearances":"98","No":"15","Country":"Netherlands","Club Country":"Turkey","Club":"Fenerbahçe","Weighted Degree":"26.0","Modularity Class":"22","Date of birth / Age":"22 July 1980 (aged 33)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.329153605015674"},"color":"rgb(197,67,229)","size":15.333333969116211},{"label":"Jorge Guagua","x":-1678.4407958984375,"y":-602.8709716796875,"id":"353","attributes":{"Eigenvector Centrality":"0.3623062182068214","Betweenness Centrality":"0.0","Appearances":"59","No":"2","Country":"Ecuador","Club Country":"Ecuador","Club":"Emelec","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"28 September 1981 (aged 32)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Keisuke Honda","x":610.3965454101562,"y":750.2002563476562,"id":"382","attributes":{"Eigenvector Centrality":"0.4349752953094465","Betweenness Centrality":"0.007469372100698354","Appearances":"56","No":"4","Country":"Japan","Club Country":"Italy","Club":"Milan","Weighted Degree":"29.0","Modularity Class":"27","Date of birth / Age":"13 June 1986 (aged 27)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3309320126069338"},"color":"rgb(67,100,229)","size":19.333332061767578},{"label":"Cédric Si Mohamed","x":-1432.4459228515625,"y":1140.2423095703125,"id":"108","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"1","No":"1","Country":"Algeria","Club Country":"Algeria","Club":"CS Constantine","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"9 January 1985 (aged 29)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"Tino-Sven Sušic","x":1264.1190185546875,"y":-534.239990234375,"id":"684","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"2","No":"14","Country":"Bosnia and Herzegovina","Club Country":"Croatia","Club":"Hajduk Split","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"13 February 1992 (aged 22)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Samuel Eto\u0027o (c)","x":207.89883422851562,"y":-77.14188385009766,"id":"627","attributes":{"Eigenvector Centrality":"0.6120719582915053","Betweenness Centrality":"0.010941183209963411","Appearances":"117","No":"9","Country":"Cameroon","Club Country":"England","Club":"Chelsea","Weighted Degree":"33.0","Modularity Class":"17","Date of birth / Age":"10 March 1981 (aged 33)","Degree":"33","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.34507042253521125"},"color":"rgb(67,132,229)","size":24.666667938232422},{"label":"Karim Ansarifard","x":2030.397705078125,"y":1187.7640380859375,"id":"380","attributes":{"Eigenvector Centrality":"0.2127442934422965","Betweenness Centrality":"0.0","Appearances":"42","No":"10","Country":"Iran","Club Country":"Iran","Club":"Tractor Sazi","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"3 April 1990 (aged 24)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Uche Nwofor","x":-33.313961029052734,"y":-1701.16748046875,"id":"691","attributes":{"Eigenvector Centrality":"0.30581490023520397","Betweenness Centrality":"0.0","Appearances":"6","No":"19","Country":"Nigeria","Club Country":"Netherlands","Club":"Heerenveen","Weighted Degree":"22.0","Modularity Class":"14","Date of birth / Age":"17 September 1991 (aged 22)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.28800940438871475"},"color":"rgb(67,229,100)","size":10.0},{"label":"Michael Umaña","x":2330.072509765625,"y":379.5473937988281,"id":"506","attributes":{"Eigenvector Centrality":"0.23496944760866376","Betweenness Centrality":"0.0","Appearances":"83","No":"4","Country":"Costa Rica","Club Country":"Costa Rica","Club":"Saprissa","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"16 July 1982 (aged 31)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Jordan Ayew","x":418.2088317871094,"y":1351.912841796875,"id":"347","attributes":{"Eigenvector Centrality":"0.29027436907278803","Betweenness Centrality":"0.0","Appearances":"13","No":"13","Country":"Ghana","Club Country":"France","Club":"Sochaux","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"11 September 1991 (aged 22)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Ron Vlaar","x":922.5167236328125,"y":-99.8844985961914,"id":"613","attributes":{"Eigenvector Centrality":"0.3465757821519946","Betweenness Centrality":"0.0018348657473652398","Appearances":"24","No":"2","Country":"Netherlands","Club Country":"England","Club":"Aston Villa","Weighted Degree":"23.0","Modularity Class":"22","Date of birth / Age":"16 February 1985 (aged 29)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3139683895771038"},"color":"rgb(197,67,229)","size":11.333333015441895},{"label":"Aleksandr Samedov","x":-1362.3624267578125,"y":-1347.75,"id":"23","attributes":{"Eigenvector Centrality":"0.2790405449937141","Betweenness Centrality":"0.003584997128855062","Appearances":"17","No":"19","Country":"Russia","Club Country":"Russia","Club":"Lokomotiv Moscow","Weighted Degree":"23.0","Modularity Class":"2","Date of birth / Age":"19 July 1984 (aged 29)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.2573529411764706"},"color":"rgb(229,67,67)","size":11.333333015441895},{"label":"Hugo Almeida","x":-570.7293090820312,"y":230.9239959716797,"id":"286","attributes":{"Eigenvector Centrality":"0.43486864997258184","Betweenness Centrality":"0.00453740780637059","Appearances":"55","No":"9","Country":"Portugal","Club Country":"Turkey","Club":"Be?ikta?","Weighted Degree":"24.0","Modularity Class":"8","Date of birth / Age":"23 May 1984 (aged 30)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3253652058432935"},"color":"rgb(229,164,67)","size":12.666666984558105},{"label":"Federico Fernández","x":-945.4159545898438,"y":329.44189453125,"id":"221","attributes":{"Eigenvector Centrality":"0.7220713713108182","Betweenness Centrality":"0.003097438956551802","Appearances":"26","No":"17","Country":"Argentina","Club Country":"Italy","Club":"Napoli","Weighted Degree":"32.0","Modularity Class":"19","Date of birth / Age":"21 February 1989 (aged 25)","Degree":"32","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3313796212804328"},"color":"rgb(67,229,229)","size":23.33333396911621},{"label":"Edin Džeko","x":747.855712890625,"y":-487.78179931640625,"id":"183","attributes":{"Eigenvector Centrality":"0.4959287278586879","Betweenness Centrality":"0.019893239141010762","Appearances":"62","No":"11","Country":"Bosnia and Herzegovina","Club Country":"England","Club":"Manchester City","Weighted Degree":"31.0","Modularity Class":"20","Date of birth / Age":"17 March 1986 (aged 28)","Degree":"31","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3436185133239832"},"color":"rgb(132,229,67)","size":22.0},{"label":"Fatau Dauda","x":508.3158874511719,"y":1362.838134765625,"id":"220","attributes":{"Eigenvector Centrality":"0.29027436907278803","Betweenness Centrality":"0.0","Appearances":"18","No":"16","Country":"Ghana","Club Country":"South Africa","Club":"Orlando Pirates","Weighted Degree":"22.0","Modularity Class":"5","Date of birth / Age":"6 April 1985 (aged 29)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2849941837921675"},"color":"rgb(67,229,197)","size":10.0},{"label":"Giorgio Chiellini","x":168.96609497070312,"y":898.1615600585938,"id":"252","attributes":{"Eigenvector Centrality":"0.5455496050511397","Betweenness Centrality":"0.0016215443882875223","Appearances":"68","No":"3","Country":"Italy","Club Country":"Italy","Club":"Juventus","Weighted Degree":"28.0","Modularity Class":"3","Date of birth / Age":"14 August 1984 (aged 29)","Degree":"28","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3242170269078077"},"color":"rgb(197,229,67)","size":18.0},{"label":"Éder","x":-652.5069580078125,"y":328.9391174316406,"id":"180","attributes":{"Eigenvector Centrality":"0.4096236052814504","Betweenness Centrality":"0.0","Appearances":"8","No":"11","Country":"Portugal","Club Country":"Portugal","Club":"Braga","Weighted Degree":"22.0","Modularity Class":"8","Date of birth / Age":"22 December 1987 (aged 26)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30714584203928125"},"color":"rgb(229,164,67)","size":10.0},{"label":"Édison Méndez","x":-1680.7288818359375,"y":-523.7875366210938,"id":"186","attributes":{"Eigenvector Centrality":"0.37488664289499546","Betweenness Centrality":"0.003053300601509073","Appearances":"110","No":"8","Country":"Ecuador","Club Country":"Colombia","Club":"Santa Fe","Weighted Degree":"23.0","Modularity Class":"4","Date of birth / Age":"15 March 1979 (aged 35)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3001224989791752"},"color":"rgb(229,67,132)","size":11.333333015441895},{"label":"Hugo Lloris (c)","x":-181.9427032470703,"y":-259.6800842285156,"id":"288","attributes":{"Eigenvector Centrality":"0.579458372910698","Betweenness Centrality":"0.002663127912981995","Appearances":"57","No":"1","Country":"France","Club Country":"England","Club":"Tottenham Hotspur","Weighted Degree":"27.0","Modularity Class":"16","Date of birth / Age":"26 December 1986 (aged 27)","Degree":"27","Position":"GK","Eccentricity":"6.0","Closeness Centrality":"0.32407407407407407"},"color":"rgb(229,67,229)","size":16.666667938232422},{"label":"Ricardo Álvarez","x":-991.7132568359375,"y":419.20452880859375,"id":"600","attributes":{"Eigenvector Centrality":"0.5658107599692682","Betweenness Centrality":"0.0025393109943757006","Appearances":"7","No":"19","Country":"Argentina","Club Country":"Italy","Club":"Internazionale","Weighted Degree":"27.0","Modularity Class":"19","Date of birth / Age":"12 April 1988 (aged 26)","Degree":"27","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3272484416740873"},"color":"rgb(67,229,229)","size":16.666667938232422},{"label":"Sofiane Feghouli","x":-1244.94921875,"y":1115.6298828125,"id":"655","attributes":{"Eigenvector Centrality":"0.3592587866347209","Betweenness Centrality":"0.005117058445342943","Appearances":"19","No":"10","Country":"Algeria","Club Country":"Spain","Club":"Valencia","Weighted Degree":"26.0","Modularity Class":"24","Date of birth / Age":"26 December 1989 (aged 24)","Degree":"26","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.30973451327433627"},"color":"rgb(67,164,229)","size":15.333333969116211},{"label":"Cristiano Ronaldo (c)","x":-705.8994140625,"y":163.7381134033203,"id":"131","attributes":{"Eigenvector Centrality":"0.651122142378051","Betweenness Centrality":"0.002704889595809238","Appearances":"111","No":"7","Country":"Portugal","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"31.0","Modularity Class":"8","Date of birth / Age":"5 February 1985 (aged 29)","Degree":"31","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.33546325878594246"},"color":"rgb(229,164,67)","size":22.0},{"label":"John Obi Mikel","x":-197.90223693847656,"y":-1324.32470703125,"id":"342","attributes":{"Eigenvector Centrality":"0.5955495363924806","Betweenness Centrality":"0.01100579205017528","Appearances":"59","No":"10","Country":"Nigeria","Club Country":"England","Club":"Chelsea","Weighted Degree":"33.0","Modularity Class":"14","Date of birth / Age":"22 April 1987 (aged 27)","Degree":"33","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3295964125560538"},"color":"rgb(67,229,100)","size":24.666667938232422},{"label":"Roy Miller","x":2341.18359375,"y":210.36285400390625,"id":"617","attributes":{"Eigenvector Centrality":"0.2448400755989879","Betweenness Centrality":"0.004512594233796391","Appearances":"48","No":"19","Country":"Costa Rica","Club Country":"United States","Club":"New York Red Bulls","Weighted Degree":"23.0","Modularity Class":"29","Date of birth / Age":"24 November 1984 (aged 29)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2558301427079708"},"color":"rgb(229,229,67)","size":11.333333015441895},{"label":"Kostas Mitroglou","x":1704.1070556640625,"y":623.1121215820312,"id":"402","attributes":{"Eigenvector Centrality":"0.26821419599108537","Betweenness Centrality":"0.011764360515140076","Appearances":"32","No":"9","Country":"Greece","Club Country":"England","Club":"Fulham","Weighted Degree":"23.0","Modularity Class":"15","Date of birth / Age":"12 March 1988 (aged 26)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.2784090909090909"},"color":"rgb(229,67,100)","size":11.333333015441895},{"label":"Daniel Opare","x":399.6513366699219,"y":1199.5255126953125,"id":"138","attributes":{"Eigenvector Centrality":"0.3223336840810573","Betweenness Centrality":"0.004091587855968099","Appearances":"16","No":"4","Country":"Ghana","Club Country":"Belgium","Club":"Standard Liège","Weighted Degree":"24.0","Modularity Class":"5","Date of birth / Age":"18 October 1990 (aged 23)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.30973451327433627"},"color":"rgb(67,229,197)","size":12.666666984558105},{"label":"Jean Beausejour","x":-67.39273834228516,"y":1286.549072265625,"id":"320","attributes":{"Eigenvector Centrality":"0.336908513308338","Betweenness Centrality":"0.005662725175478597","Appearances":"59","No":"15","Country":"Chile","Club Country":"England","Club":"Wigan Athletic","Weighted Degree":"24.0","Modularity Class":"18","Date of birth / Age":"3 June 1984 (aged 30)","Degree":"24","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.28891509433962265"},"color":"rgb(229,132,67)","size":12.666666984558105},{"label":"Erik Durm","x":553.0518188476562,"y":-438.38714599609375,"id":"203","attributes":{"Eigenvector Centrality":"0.500680986024227","Betweenness Centrality":"0.008472576600609625","Appearances":"1","No":"15","Country":"Germany","Club Country":"Germany","Club":"Borussia Dortmund","Weighted Degree":"24.0","Modularity Class":"13","Date of birth / Age":"12 May 1992 (aged 22)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.310126582278481"},"color":"rgb(67,229,164)","size":12.666666984558105},{"label":"Egidio Arévalo Ríos","x":-140.44900512695312,"y":-11.467087745666504,"id":"191","attributes":{"Eigenvector Centrality":"0.3894572111283446","Betweenness Centrality":"0.002989706787662918","Appearances":"55","No":"17","Country":"Uruguay","Club Country":"Mexico","Club":"Morelia","Weighted Degree":"23.0","Modularity Class":"6","Date of birth / Age":"1 January 1982 (aged 32)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31873373807458805"},"color":"rgb(229,197,67)","size":11.333333015441895},{"label":"Raul Meireles","x":-515.27490234375,"y":255.2202911376953,"id":"593","attributes":{"Eigenvector Centrality":"0.45315937558107944","Betweenness Centrality":"0.0029488481093627983","Appearances":"74","No":"16","Country":"Portugal","Club Country":"Turkey","Club":"Fenerbahçe","Weighted Degree":"25.0","Modularity Class":"8","Date of birth / Age":"17 March 1983 (aged 31)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3295964125560538"},"color":"rgb(229,164,67)","size":14.0},{"label":"Maicon","x":-278.0897216796875,"y":-249.45703125,"id":"436","attributes":{"Eigenvector Centrality":"0.6006324446964797","Betweenness Centrality":"0.010333588970217586","Appearances":"72","No":"23","Country":"Brazil","Club Country":"Italy","Club":"Roma","Weighted Degree":"26.0","Modularity Class":"23","Date of birth / Age":"26 July 1981 (aged 32)","Degree":"26","Position":"DF","Eccentricity":"4.0","Closeness Centrality":"0.3475177304964539"},"color":"rgb(229,67,197)","size":15.333333969116211},{"label":"Luke Shaw","x":-92.2292251586914,"y":-688.8857421875,"id":"434","attributes":{"Eigenvector Centrality":"0.5904515327423896","Betweenness Centrality":"0.0016054547217210155","Appearances":"2","No":"23","Country":"England","Club Country":"England","Club":"Southampton","Weighted Degree":"26.0","Modularity Class":"28","Date of birth / Age":"12 July 1995 (aged 18)","Degree":"26","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.32407407407407407"},"color":"rgb(67,229,132)","size":15.333333969116211},{"label":"Toni Kroos","x":364.4765319824219,"y":-371.8941650390625,"id":"687","attributes":{"Eigenvector Centrality":"0.6585766805388439","Betweenness Centrality":"0.0026429368589338613","Appearances":"44","No":"18","Country":"Germany","Club Country":"Germany","Club":"Bayern Munich","Weighted Degree":"29.0","Modularity Class":"13","Date of birth / Age":"4 January 1990 (aged 24)","Degree":"29","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3390221402214022"},"color":"rgb(67,229,164)","size":19.333332061767578},{"label":"Antonio Cassano","x":193.04763793945312,"y":758.9298706054688,"id":"59","attributes":{"Eigenvector Centrality":"0.44952910121457806","Betweenness Centrality":"4.3533065978638123E-4","Appearances":"37","No":"10","Country":"Italy","Club Country":"Italy","Club":"Parma","Weighted Degree":"24.0","Modularity Class":"3","Date of birth / Age":"12 July 1982 (aged 31)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.30714584203928125"},"color":"rgb(197,229,67)","size":12.666666984558105},{"label":"Son Heung-min","x":1048.6976318359375,"y":1445.7691650390625,"id":"658","attributes":{"Eigenvector Centrality":"0.2555712186488899","Betweenness Centrality":"0.010566232255619219","Appearances":"25","No":"9","Country":"South Korea","Club Country":"Germany","Club":"Bayer Leverkusen","Weighted Degree":"24.0","Modularity Class":"10","Date of birth / Age":"8 July 1992 (aged 21)","Degree":"24","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(229,67,164)","size":12.666666984558105},{"label":"Alexandros Tziolis","x":1617.329345703125,"y":542.8191528320312,"id":"32","attributes":{"Eigenvector Centrality":"0.25813336963416794","Betweenness Centrality":"0.0","Appearances":"49","No":"6","Country":"Greece","Club Country":"Turkey","Club":"Kayserispor","Weighted Degree":"22.0","Modularity Class":"15","Date of birth / Age":"13 February 1985 (aged 29)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2760045061960195"},"color":"rgb(229,67,100)","size":10.0},{"label":"Marcelo Díaz","x":-193.8722381591797,"y":1188.14697265625,"id":"445","attributes":{"Eigenvector Centrality":"0.3914962580991112","Betweenness Centrality":"0.007300142578773374","Appearances":"21","No":"21","Country":"Chile","Club Country":"Switzerland","Club":"Basel","Weighted Degree":"27.0","Modularity Class":"18","Date of birth / Age":"30 December 1986 (aged 27)","Degree":"27","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.29902359641985354"},"color":"rgb(229,132,67)","size":16.666667938232422},{"label":"Pepe","x":-652.334228515625,"y":226.08396911621094,"id":"571","attributes":{"Eigenvector Centrality":"0.651122142378051","Betweenness Centrality":"0.002704889595809238","Appearances":"58","No":"3","Country":"Portugal","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"31.0","Modularity Class":"8","Date of birth / Age":"26 February 1983 (aged 31)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33546325878594246"},"color":"rgb(229,164,67)","size":22.0},{"label":"Sayouba Mandé","x":565.8164672851562,"y":-858.4483642578125,"id":"632","attributes":{"Eigenvector Centrality":"0.30966117600400683","Betweenness Centrality":"0.0","Appearances":"1","No":"23","Country":"Ivory Coast","Club Country":"Norway","Club":"Stabæk","Weighted Degree":"22.0","Modularity Class":"9","Date of birth / Age":"15 June 1993 (aged 20)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2929453965723396"},"color":"rgb(164,67,229)","size":10.0},{"label":"Romelu Lukaku","x":-624.7638549804688,"y":-965.3787841796875,"id":"612","attributes":{"Eigenvector Centrality":"0.5945562042887822","Betweenness Centrality":"0.0024227939394388456","Appearances":"29","No":"9","Country":"Belgium","Club Country":"England","Club":"Everton","Weighted Degree":"26.0","Modularity Class":"28","Date of birth / Age":"13 May 1993 (aged 21)","Degree":"26","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3330312641594925"},"color":"rgb(67,229,132)","size":15.333333969116211},{"label":"Carlos Gruezo","x":-1417.1590576171875,"y":-636.35205078125,"id":"102","attributes":{"Eigenvector Centrality":"0.40234260169062663","Betweenness Centrality":"0.012924077143976812","Appearances":"3","No":"23","Country":"Ecuador","Club Country":"Germany","Club":"VfB Stuttgart","Weighted Degree":"25.0","Modularity Class":"4","Date of birth / Age":"19 April 1995 (aged 19)","Degree":"25","Position":"MF","Eccentricity":"4.0","Closeness Centrality":"0.3208206023570493"},"color":"rgb(229,67,132)","size":14.0},{"label":"Boubacar Barry","x":488.794921875,"y":-907.9202880859375,"id":"89","attributes":{"Eigenvector Centrality":"0.3096611760040069","Betweenness Centrality":"0.0","Appearances":"77","No":"1","Country":"Ivory Coast","Club Country":"Belgium","Club":"Lokeren","Weighted Degree":"22.0","Modularity Class":"9","Date of birth / Age":"30 December 1979 (aged 34)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.2929453965723396"},"color":"rgb(164,67,229)","size":10.0},{"label":"Adam Taggart","x":2042.42724609375,"y":-579.6041870117188,"id":"6","attributes":{"Eigenvector Centrality":"0.22132294330055022","Betweenness Centrality":"0.0","Appearances":"5","No":"9","Country":"Australia","Club Country":"Australia","Club":"Newcastle Jets","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"2 June 1993 (aged 21)","Degree":"22","Position":"FW","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Gabriel Achilier","x":-1682.26220703125,"y":-719.3626708984375,"id":"236","attributes":{"Eigenvector Centrality":"0.3623062182068216","Betweenness Centrality":"0.0","Appearances":"23","No":"21","Country":"Ecuador","Club Country":"Ecuador","Club":"Emelec","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"24 March 1985 (aged 29)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Paul Verhaegh","x":949.3831176757812,"y":201.00778198242188,"id":"566","attributes":{"Eigenvector Centrality":"0.35574061516727906","Betweenness Centrality":"0.008783426226424064","Appearances":"2","No":"12","Country":"Netherlands","Club Country":"Germany","Club":"FC Augsburg","Weighted Degree":"24.0","Modularity Class":"22","Date of birth / Age":"1 September 1983 (aged 30)","Degree":"24","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3153153153153153"},"color":"rgb(197,67,229)","size":12.666666984558105},{"label":"Clint Dempsey (c)","x":742.0546264648438,"y":-1547.4185791015625,"id":"126","attributes":{"Eigenvector Centrality":"0.27181518429351065","Betweenness Centrality":"0.0","Appearances":"105","No":"8","Country":"United States","Club Country":"United States","Club":"Seattle Sounders FC","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"9 March 1983 (aged 31)","Degree":"22","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Madjid Bougherra (c)","x":-1470.3363037109375,"y":1180.3843994140625,"id":"435","attributes":{"Eigenvector Centrality":"0.29589355686287977","Betweenness Centrality":"0.0","Appearances":"62","No":"2","Country":"Algeria","Club Country":"Qatar","Club":"Lekhwiya","Weighted Degree":"22.0","Modularity Class":"24","Date of birth / Age":"7 October 1982 (aged 31)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28389339513325607"},"color":"rgb(67,164,229)","size":10.0},{"label":"James Rodríguez","x":-798.67431640625,"y":1094.4688720703125,"id":"309","attributes":{"Eigenvector Centrality":"0.3631125757022638","Betweenness Centrality":"0.002531708436743698","Appearances":"22","No":"10","Country":"Colombia","Club Country":"France","Club":"AS Monaco","Weighted Degree":"25.0","Modularity Class":"11","Date of birth / Age":"12 July 1991 (aged 22)","Degree":"25","Position":"MF","Eccentricity":"6.0","Closeness Centrality":"0.315450643776824"},"color":"rgb(67,67,229)","size":14.0},{"label":"Jeremain Lens","x":718.18798828125,"y":97.26069641113281,"id":"325","attributes":{"Eigenvector Centrality":"0.37953617711875015","Betweenness Centrality":"0.00411799412159424","Appearances":"22","No":"17","Country":"Netherlands","Club Country":"Ukraine","Club":"Dynamo Kyiv","Weighted Degree":"25.0","Modularity Class":"22","Date of birth / Age":"24 November 1987 (aged 26)","Degree":"25","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3255093002657219"},"color":"rgb(197,67,229)","size":14.0},{"label":"Juanfran","x":-888.2894897460938,"y":-365.1721496582031,"id":"373","attributes":{"Eigenvector Centrality":"0.7852248920099726","Betweenness Centrality":"7.220203040676876E-4","Appearances":"8","No":"5","Country":"Spain","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"27.0","Modularity Class":"23","Date of birth / Age":"9 January 1985 (aged 29)","Degree":"27","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3215223097112861"},"color":"rgb(229,67,197)","size":16.666667938232422},{"label":"Amir Hossein Sadeghi","x":1990.185546875,"y":1052.62548828125,"id":"40","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"17","No":"5","Country":"Iran","Club Country":"Iran","Club":"Esteghlal","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"6 September 1981 (aged 32)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Zvjezdan Misimovic","x":1277.4697265625,"y":-479.1226501464844,"id":"736","attributes":{"Eigenvector Centrality":"0.2839695417201138","Betweenness Centrality":"0.0","Appearances":"81","No":"10","Country":"Bosnia and Herzegovina","Club Country":"China","Club":"Guizhou Renhe","Weighted Degree":"22.0","Modularity Class":"20","Date of birth / Age":"5 June 1982 (aged 32)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3077889447236181"},"color":"rgb(132,229,67)","size":10.0},{"label":"Nacer Chadli","x":-730.6295166015625,"y":-798.0245971679688,"id":"527","attributes":{"Eigenvector Centrality":"0.5781054780643133","Betweenness Centrality":"0.0013899483715746057","Appearances":"20","No":"22","Country":"Belgium","Club Country":"England","Club":"Tottenham Hotspur","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"2 October 1989 (aged 24)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.33638443935926776"},"color":"rgb(67,229,132)","size":14.0},{"label":"Michael Arroyo","x":-1730.895751953125,"y":-727.3639526367188,"id":"499","attributes":{"Eigenvector Centrality":"0.3623062182068213","Betweenness Centrality":"0.0","Appearances":"21","No":"15","Country":"Ecuador","Club Country":"Mexico","Club":"Atlante","Weighted Degree":"22.0","Modularity Class":"4","Date of birth / Age":"23 April 1987 (aged 27)","Degree":"22","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.2881223049784398"},"color":"rgb(229,67,132)","size":10.0},{"label":"Valon Behrami","x":-152.94186401367188,"y":233.4356231689453,"id":"693","attributes":{"Eigenvector Centrality":"0.6153709092825856","Betweenness Centrality":"0.004199284588766183","Appearances":"48","No":"11","Country":"Switzerland","Club Country":"Italy","Club":"Napoli","Weighted Degree":"31.0","Modularity Class":"0","Date of birth / Age":"19 April 1985 (aged 29)","Degree":"31","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3331822302810517"},"color":"rgb(164,229,67)","size":22.0},{"label":"Sami Khedira","x":147.37220764160156,"y":-251.9683837890625,"id":"623","attributes":{"Eigenvector Centrality":"0.7584962588500563","Betweenness Centrality":"0.008327156420560313","Appearances":"46","No":"6","Country":"Germany","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"33.0","Modularity Class":"13","Date of birth / Age":"4 April 1987 (aged 27)","Degree":"33","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.32974427994616423"},"color":"rgb(67,229,164)","size":24.666667938232422},{"label":"Admir Mehmedi","x":126.91813659667969,"y":115.84123229980469,"id":"7","attributes":{"Eigenvector Centrality":"0.41564407300864686","Betweenness Centrality":"0.0029131326818128433","Appearances":"21","No":"18","Country":"Switzerland","Club Country":"Germany","Club":"SC Freiburg","Weighted Degree":"24.0","Modularity Class":"0","Date of birth / Age":"16 March 1991 (aged 23)","Degree":"24","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.3150450064294899"},"color":"rgb(164,229,67)","size":12.666666984558105},{"label":"Hong Jeong-ho","x":1189.017578125,"y":1491.9881591796875,"id":"283","attributes":{"Eigenvector Centrality":"0.24502153540109495","Betweenness Centrality":"0.0031284111071300832","Appearances":"25","No":"20","Country":"South Korea","Club Country":"Germany","Club":"FC Augsburg","Weighted Degree":"23.0","Modularity Class":"10","Date of birth / Age":"12 August 1989 (aged 24)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.2726261127596439"},"color":"rgb(229,67,164)","size":11.333333015441895},{"label":"Nikica Jelavic","x":-197.76739501953125,"y":532.7603149414062,"id":"535","attributes":{"Eigenvector Centrality":"0.354839329394506","Betweenness Centrality":"0.005268740805035136","Appearances":"33","No":"9","Country":"Croatia","Club Country":"England","Club":"Hull City","Weighted Degree":"23.0","Modularity Class":"25","Date of birth / Age":"27 August 1985 (aged 28)","Degree":"23","Position":"FW","Eccentricity":"5.0","Closeness Centrality":"0.303970223325062"},"color":"rgb(132,67,229)","size":11.333333015441895},{"label":"Ross Barkley","x":-149.76280212402344,"y":-1043.209228515625,"id":"616","attributes":{"Eigenvector Centrality":"0.5738583419916762","Betweenness Centrality":"0.0013664563333722465","Appearances":"6","No":"21","Country":"England","Club Country":"England","Club":"Everton","Weighted Degree":"25.0","Modularity Class":"28","Date of birth / Age":"5 December 1993 (aged 20)","Degree":"25","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.31183708103521424"},"color":"rgb(67,229,132)","size":14.0},{"label":"Ji Dong-won","x":1240.84521484375,"y":1492.1494140625,"id":"330","attributes":{"Eigenvector Centrality":"0.24502153540109498","Betweenness Centrality":"0.0031284111071300832","Appearances":"28","No":"19","Country":"South Korea","Club Country":"Germany","Club":"FC Augsburg","Weighted Degree":"23.0","Modularity Class":"10","Date of birth / Age":"28 May 1991 (aged 23)","Degree":"23","Position":"FW","Eccentricity":"6.0","Closeness Centrality":"0.2726261127596439"},"color":"rgb(229,67,164)","size":11.333333015441895},{"label":"Nick Rimando","x":864.0869140625,"y":-1556.7880859375,"id":"530","attributes":{"Eigenvector Centrality":"0.27181518429351065","Betweenness Centrality":"0.0","Appearances":"14","No":"22","Country":"United States","Club Country":"United States","Club":"Real Salt Lake","Weighted Degree":"22.0","Modularity Class":"26","Date of birth / Age":"17 June 1979 (aged 34)","Degree":"22","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.28021349599695006"},"color":"rgb(100,229,67)","size":10.0},{"label":"Hwang Seok-ho","x":1138.2103271484375,"y":1544.553466796875,"id":"290","attributes":{"Eigenvector Centrality":"0.2441012483722342","Betweenness Centrality":"0.0022277566561183537","Appearances":"3","No":"6","Country":"South Korea","Club Country":"Japan","Club":"Sanfrecce Hiroshima","Weighted Degree":"23.0","Modularity Class":"10","Date of birth / Age":"27 June 1989 (aged 24)","Degree":"23","Position":"DF","Eccentricity":"6.0","Closeness Centrality":"0.27051895472948106"},"color":"rgb(229,67,164)","size":11.333333015441895},{"label":"André Schürrle","x":130.84710693359375,"y":-528.9302368164062,"id":"44","attributes":{"Eigenvector Centrality":"0.7600410241243024","Betweenness Centrality":"0.006814981026437991","Appearances":"33","No":"9","Country":"Germany","Club Country":"England","Club":"Chelsea","Weighted Degree":"33.0","Modularity Class":"13","Date of birth / Age":"6 November 1990 (aged 23)","Degree":"33","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3343949044585987"},"color":"rgb(67,229,164)","size":24.666667938232422},{"label":"Pepe Reina","x":-850.5621948242188,"y":-89.60556030273438,"id":"572","attributes":{"Eigenvector Centrality":"0.9188656127061582","Betweenness Centrality":"0.004836935094169011","Appearances":"32","No":"23","Country":"Spain","Club Country":"Italy","Club":"Napoli","Weighted Degree":"32.0","Modularity Class":"23","Date of birth / Age":"31 August 1982 (aged 31)","Degree":"32","Position":"GK","Eccentricity":"5.0","Closeness Centrality":"0.34249767008387694"},"color":"rgb(229,67,197)","size":23.33333396911621},{"label":"Maynor Figueroa","x":1528.1024169921875,"y":-1100.3426513671875,"id":"492","attributes":{"Eigenvector Centrality":"0.24997612632443128","Betweenness Centrality":"0.00471069378362544","Appearances":"105","No":"3","Country":"Honduras","Club Country":"England","Club":"Hull City","Weighted Degree":"23.0","Modularity Class":"7","Date of birth / Age":"2 May 1983 (aged 31)","Degree":"23","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.28107074569789675"},"color":"rgb(100,67,229)","size":11.333333015441895},{"label":"Dmitri Kombarov","x":-1369.3797607421875,"y":-1467.8458251953125,"id":"174","attributes":{"Eigenvector Centrality":"0.2656930429181982","Betweenness Centrality":"0.0","Appearances":"22","No":"23","Country":"Russia","Club Country":"Russia","Club":"Spartak Moscow","Weighted Degree":"22.0","Modularity Class":"2","Date of birth / Age":"22 January 1987 (aged 27)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.23244781783681215"},"color":"rgb(229,67,67)","size":10.0},{"label":"Waylon Francis","x":2350.48974609375,"y":280.3184509277344,"id":"712","attributes":{"Eigenvector Centrality":"0.2349694476086638","Betweenness Centrality":"0.0","Appearances":"1","No":"12","Country":"Costa Rica","Club Country":"United States","Club":"Columbus Crew","Weighted Degree":"22.0","Modularity Class":"29","Date of birth / Age":"20 September 1990 (aged 23)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.2515400410677618"},"color":"rgb(229,229,67)","size":10.0},{"label":"Ahmad Alenemeh","x":2028.45654296875,"y":1067.91259765625,"id":"13","attributes":{"Eigenvector Centrality":"0.21274429344229648","Betweenness Centrality":"0.0","Appearances":"9","No":"17","Country":"Iran","Club Country":"Iran","Club":"Naft Tehran","Weighted Degree":"22.0","Modularity Class":"1","Date of birth / Age":"10 October 1982 (aged 31)","Degree":"22","Position":"DF","Eccentricity":"7.0","Closeness Centrality":"0.206809229037704"},"color":"rgb(67,197,229)","size":10.0},{"label":"Fábio Coentrão","x":-620.6026611328125,"y":152.4325408935547,"id":"216","attributes":{"Eigenvector Centrality":"0.6511221423780509","Betweenness Centrality":"0.002704889595809238","Appearances":"45","No":"5","Country":"Portugal","Club Country":"Spain","Club":"Real Madrid","Weighted Degree":"31.0","Modularity Class":"8","Date of birth / Age":"11 March 1988 (aged 26)","Degree":"31","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.33546325878594246"},"color":"rgb(229,164,67)","size":22.0},{"label":"Stefan de Vrij","x":967.5440673828125,"y":46.13400650024414,"id":"659","attributes":{"Eigenvector Centrality":"0.335211163684756","Betweenness Centrality":"0.0","Appearances":"12","No":"3","Country":"Netherlands","Club Country":"Netherlands","Club":"Feyenoord","Weighted Degree":"22.0","Modularity Class":"22","Date of birth / Age":"5 February 1992 (aged 22)","Degree":"22","Position":"DF","Eccentricity":"5.0","Closeness Centrality":"0.3088235294117647"},"color":"rgb(197,67,229)","size":10.0},{"label":"Javier Aquino","x":-2081.5556640625,"y":384.58026123046875,"id":"317","attributes":{"Eigenvector Centrality":"0.27712645238679473","Betweenness Centrality":"0.0","Appearances":"22","No":"20","Country":"Mexico","Club Country":"Spain","Club":"Villarreal","Weighted Degree":"22.0","Modularity Class":"21","Date of birth / Age":"11 February 1990 (aged 24)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.2599929253625752"},"color":"rgb(67,229,67)","size":10.0},{"label":"Mile Jedinak (c)","x":2075.45263671875,"y":-732.8336791992188,"id":"515","attributes":{"Eigenvector Centrality":"0.2213229433005502","Betweenness Centrality":"0.0","Appearances":"44","No":"15","Country":"Australia","Club Country":"England","Club":"Crystal Palace","Weighted Degree":"22.0","Modularity Class":"12","Date of birth / Age":"3 August 1984 (aged 29)","Degree":"22","Position":"MF","Eccentricity":"7.0","Closeness Centrality":"0.22025771651183698"},"color":"rgb(229,100,67)","size":10.0},{"label":"Cristian Rodríguez","x":-272.8934631347656,"y":-76.41095733642578,"id":"129","attributes":{"Eigenvector Centrality":"0.5243629945948548","Betweenness Centrality":"0.0015151368839237088","Appearances":"73","No":"7","Country":"Uruguay","Club Country":"Spain","Club":"Atlético Madrid","Weighted Degree":"28.0","Modularity Class":"6","Date of birth / Age":"30 September 1985 (aged 28)","Degree":"28","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3236459709379128"},"color":"rgb(229,197,67)","size":18.0},{"label":"Jean Makoun","x":430.8337097167969,"y":257.7498474121094,"id":"321","attributes":{"Eigenvector Centrality":"0.3346787587121599","Betweenness Centrality":"0.0017126023775967546","Appearances":"66","No":"11","Country":"Cameroon","Club Country":"France","Club":"Rennes","Weighted Degree":"23.0","Modularity Class":"17","Date of birth / Age":"29 May 1983 (aged 31)","Degree":"23","Position":"MF","Eccentricity":"5.0","Closeness Centrality":"0.3202614379084967"},"color":"rgb(67,132,229)","size":11.333333015441895}]} \ No newline at end of file diff --git a/examples/network/index.html b/examples/network/index.html index 3a555140..5d815172 100644 --- a/examples/network/index.html +++ b/examples/network/index.html @@ -37,6 +37,11 @@

      23_hierarchical_layout.html

      24_hierarchical_layout_userdefined.html

      25_physics_configuration.html

      +

      26_staticSmoothCurves.html

      +

      27_world_cup_network.html

      +

      28_world_cup_network_performance.html

      +

      29_neighbourhood_highlight.html

      +

      30_importing_from_gephi.html

      graphviz_gallery.html

      diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..f89d167a --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,152 @@ +var fs = require('fs'); +var gulp = require('gulp'); +var gutil = require('gulp-util'); +var concat = require('gulp-concat'); +var minifyCSS = require('gulp-minify-css'); +var rename = require("gulp-rename"); +var webpack = require('webpack'); +var uglify = require('uglify-js'); +var rimraf = require('rimraf'); +var merge = require('merge-stream'); +var argv = require('yargs').argv; + +var ENTRY = './index.js'; +var HEADER = './lib/header.js'; +var DIST = './dist'; +var VIS_JS = 'vis.js'; +var VIS_MAP = 'vis.map'; +var VIS_MIN_JS = 'vis.min.js'; +var VIS_CSS = 'vis.css'; +var VIS_MIN_CSS = 'vis.min.css'; + +// generate banner with today's date and correct version +function createBanner() { + var today = gutil.date(new Date(), 'yyyy-mm-dd'); // today, formatted as yyyy-mm-dd + var version = require('./package.json').version; + + return String(fs.readFileSync(HEADER)) + .replace('@@date', today) + .replace('@@version', version); +} + +var bannerPlugin = new webpack.BannerPlugin(createBanner(), { + entryOnly: true, + raw: true +}); + +// TODO: the moment.js language files should be excluded by default (they are quite big) +var webpackConfig = { + entry: ENTRY, + output: { + library: 'vis', + libraryTarget: 'umd', + path: DIST, + filename: VIS_JS, + sourcePrefix: ' ' + }, + // exclude requires of moment.js language files + module: { + wrappedContextRegExp: /$^/ + }, + plugins: [ bannerPlugin ], + cache: true +}; + +var uglifyConfig = { + outSourceMap: VIS_MAP, + output: { + comments: /@license/ + } +}; + +// create a single instance of the compiler to allow caching +var compiler = webpack(webpackConfig); + +// clean the dist/img directory +gulp.task('clean', function (cb) { + rimraf(DIST + '/img', cb); +}); + +gulp.task('bundle-js', ['clean'], function (cb) { + // update the banner contents (has a date in it which should stay up to date) + bannerPlugin.banner = createBanner(); + + compiler.run(function (err, stats) { + if (err) gutil.log(err); + cb(); + }); +}); + +// bundle and minify css +gulp.task('bundle-css', ['clean'], function () { + var files = [ + './lib/timeline/component/css/timeline.css', + './lib/timeline/component/css/panel.css', + './lib/timeline/component/css/labelset.css', + './lib/timeline/component/css/itemset.css', + './lib/timeline/component/css/item.css', + './lib/timeline/component/css/timeaxis.css', + './lib/timeline/component/css/currenttime.css', + './lib/timeline/component/css/customtime.css', + './lib/timeline/component/css/animation.css', + + './lib/timeline/component/css/dataaxis.css', + './lib/timeline/component/css/pathStyles.css', + + './lib/network/css/network-manipulation.css', + './lib/network/css/network-navigation.css' + ]; + + return gulp.src(files) + .pipe(concat(VIS_CSS)) + .pipe(gulp.dest(DIST)) + + // TODO: nicer to put minifying css in a separate task? + .pipe(minifyCSS()) + .pipe(rename(VIS_MIN_CSS)) + .pipe(gulp.dest(DIST)); +}); + +gulp.task('copy', ['clean'], function () { + var network = gulp.src('./lib/network/img/**/*') + .pipe(gulp.dest(DIST + '/img/network')); + + var timeline = gulp.src('./lib/timeline/img/**/*') + .pipe(gulp.dest(DIST + '/img/timeline')); + + return merge(network, timeline); +}); + +gulp.task('minify', ['bundle-js'], function (cb) { + var result = uglify.minify([DIST + '/' + VIS_JS], uglifyConfig); + + fs.writeFileSync(DIST + '/' + VIS_MIN_JS, result.code); + fs.writeFileSync(DIST + '/' + VIS_MAP, result.map); + + cb(); +}); + +gulp.task('bundle', ['bundle-js', 'bundle-css', 'copy']); + +// read command line arguments --bundle and --minify +var bundle = 'bundle' in argv; +var minify = 'minify' in argv; +var watchTasks = []; +if (bundle || minify) { + // do bundling and/or minifying only when specified on the command line + watchTasks = []; + if (bundle) watchTasks.push('bundle'); + if (minify) watchTasks.push('minify'); +} +else { + // by default, do both bundling and minifying + watchTasks = ['bundle', 'minify']; +} + +// The watch task (to automatically rebuild when the source code changes) +gulp.task('watch', watchTasks, function () { + gulp.watch(['index.js', 'lib/**/*'], watchTasks); +}); + +// The default task (called when you run `gulp`) +gulp.task('default', ['clean', 'bundle', 'minify']); diff --git a/index.js b/index.js new file mode 100644 index 00000000..2f4431d6 --- /dev/null +++ b/index.js @@ -0,0 +1,69 @@ +// utils +exports.util = require('./lib/util'); +exports.DOMutil = require('./lib/DOMutil'); + +// data +exports.DataSet = require('./lib/DataSet'); +exports.DataView = require('./lib/DataView'); + +// Graph3d +exports.Graph3d = require('./lib/graph3d/Graph3d'); +exports.graph3d = { + Camera: require('./lib/graph3d/Camera'), + Filter: require('./lib/graph3d/Filter'), + Point2d: require('./lib/graph3d/Point2d'), + Point3d: require('./lib/graph3d/Point3d'), + Slider: require('./lib/graph3d/Slider'), + StepNumber: require('./lib/graph3d/StepNumber') +}; + +// Timeline +exports.Timeline = require('./lib/timeline/Timeline'); +exports.Graph2d = require('./lib/timeline/Graph2d'); +exports.timeline = { + DataStep: require('./lib/timeline/DataStep'), + Range: require('./lib/timeline/Range'), + stack: require('./lib/timeline/Stack'), + TimeStep: require('./lib/timeline/TimeStep'), + + components: { + items: { + Item: require('./lib/timeline/component/item/Item'), + ItemBox: require('./lib/timeline/component/item/ItemBox'), + ItemPoint: require('./lib/timeline/component/item/ItemPoint'), + ItemRange: require('./lib/timeline/component/item/ItemRange') + }, + + Component: require('./lib/timeline/component/Component'), + CurrentTime: require('./lib/timeline/component/CurrentTime'), + CustomTime: require('./lib/timeline/component/CustomTime'), + DataAxis: require('./lib/timeline/component/DataAxis'), + GraphGroup: require('./lib/timeline/component/GraphGroup'), + Group: require('./lib/timeline/component/Group'), + ItemSet: require('./lib/timeline/component/ItemSet'), + Legend: require('./lib/timeline/component/Legend'), + LineGraph: require('./lib/timeline/component/LineGraph'), + TimeAxis: require('./lib/timeline/component/TimeAxis') + } +}; + +// Network +exports.Network = require('./lib/network/Network'); +exports.network = { + Edge: require('./lib/network/Edge'), + Groups: require('./lib/network/Groups'), + Images: require('./lib/network/Images'), + Node: require('./lib/network/Node'), + Popup: require('./lib/network/Popup'), + dotparser: require('./lib/network/dotparser'), + gephiParser: require('./lib/network/gephiParser') +}; + +// Deprecated since v3.0.0 +exports.Graph = function () { + throw new Error('Graph is renamed to Network. Please create a graph as new vis.Network(...)'); +}; + +// bundled external libraries +exports.moment = require('./lib/module/moment'); +exports.hammer = require('./lib/module/hammer'); diff --git a/src/DOMutil.js b/lib/DOMutil.js similarity index 89% rename from src/DOMutil.js rename to lib/DOMutil.js index a7bf81e1..9fc06c9a 100644 --- a/src/DOMutil.js +++ b/lib/DOMutil.js @@ -1,15 +1,11 @@ -/** - * Created by Alex on 6/20/14. - */ - -var DOMutil = {}; +// DOM utility methods /** * this prepares the JSON container for allocating SVG elements * @param JSONcontainer * @private */ -DOMutil.prepareElements = function(JSONcontainer) { +exports.prepareElements = function(JSONcontainer) { // cleanup the redundant svgElements; for (var elementType in JSONcontainer) { if (JSONcontainer.hasOwnProperty(elementType)) { @@ -26,7 +22,7 @@ DOMutil.prepareElements = function(JSONcontainer) { * @param JSONcontainer * @private */ -DOMutil.cleanupElements = function(JSONcontainer) { +exports.cleanupElements = function(JSONcontainer) { // cleanup the redundant svgElements; for (var elementType in JSONcontainer) { if (JSONcontainer.hasOwnProperty(elementType)) { @@ -50,7 +46,7 @@ DOMutil.cleanupElements = function(JSONcontainer) { * @returns {*} * @private */ -DOMutil.getSVGElement = function (elementType, JSONcontainer, svgContainer) { +exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) { var element; // allocate SVG element, if it doesnt yet exist, create one. if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before @@ -86,7 +82,7 @@ DOMutil.getSVGElement = function (elementType, JSONcontainer, svgContainer) { * @returns {*} * @private */ -DOMutil.getDOMElement = function (elementType, JSONcontainer, DOMContainer) { +exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer) { var element; // allocate SVG element, if it doesnt yet exist, create one. if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before @@ -126,17 +122,17 @@ DOMutil.getDOMElement = function (elementType, JSONcontainer, DOMContainer) { * @param svgContainer * @returns {*} */ -DOMutil.drawPoint = function(x, y, group, JSONcontainer, svgContainer) { +exports.drawPoint = function(x, y, group, JSONcontainer, svgContainer) { var point; if (group.options.drawPoints.style == 'circle') { - point = DOMutil.getSVGElement('circle',JSONcontainer,svgContainer); + point = exports.getSVGElement('circle',JSONcontainer,svgContainer); point.setAttributeNS(null, "cx", x); point.setAttributeNS(null, "cy", y); point.setAttributeNS(null, "r", 0.5 * group.options.drawPoints.size); point.setAttributeNS(null, "class", group.className + " point"); } else { - point = DOMutil.getSVGElement('rect',JSONcontainer,svgContainer); + point = exports.getSVGElement('rect',JSONcontainer,svgContainer); point.setAttributeNS(null, "x", x - 0.5*group.options.drawPoints.size); point.setAttributeNS(null, "y", y - 0.5*group.options.drawPoints.size); point.setAttributeNS(null, "width", group.options.drawPoints.size); @@ -153,8 +149,8 @@ DOMutil.drawPoint = function(x, y, group, JSONcontainer, svgContainer) { * @param y * @param className */ -DOMutil.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer) { - var rect = DOMutil.getSVGElement('rect',JSONcontainer, svgContainer); +exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer) { + var rect = exports.getSVGElement('rect',JSONcontainer, svgContainer); rect.setAttributeNS(null, "x", x - 0.5 * width); rect.setAttributeNS(null, "y", y); rect.setAttributeNS(null, "width", width); diff --git a/src/DataSet.js b/lib/DataSet.js similarity index 98% rename from src/DataSet.js rename to lib/DataSet.js index 1ce20953..d22a5c04 100644 --- a/src/DataSet.js +++ b/lib/DataSet.js @@ -1,3 +1,5 @@ +var util = require('./util'); + /** * DataSet * @@ -320,7 +322,8 @@ DataSet.prototype.get = function (args) { // determine the return type var returnType; if (options && options.returnType) { - returnType = (options.returnType == 'DataTable') ? 'DataTable' : 'Array'; + var allowedValues = ["DataTable", "Array", "Object"]; + returnType = allowedValues.indexOf(options.returnType) == -1 ? "Array" : options.returnType; if (data && (returnType != util.getType(data))) { throw new Error('Type of parameter "data" (' + util.getType(data) + ') ' + @@ -399,12 +402,19 @@ DataSet.prototype.get = function (args) { } else { // copy the items to the provided data table - for (i = 0, len = items.length; i < len; i++) { + for (i = 0; i < items.length; i++) { me._appendRow(data, columns, items[i]); } } return data; } + else if (returnType == "Object") { + var result = {}; + for (i = 0; i < items.length; i++) { + result[items[i].id] = items[i]; + } + return result; + } else { // return an array if (id != undefined) { @@ -932,3 +942,5 @@ DataSet.prototype._appendRow = function (dataTable, columns, item) { dataTable.setValue(row, col, item[field]); } }; + +module.exports = DataSet; diff --git a/src/DataView.js b/lib/DataView.js similarity index 98% rename from src/DataView.js rename to lib/DataView.js index 3a934f89..f56e151e 100644 --- a/src/DataView.js +++ b/lib/DataView.js @@ -1,3 +1,6 @@ +var util = require('./util'); +var DataSet = require('./DataSet'); + /** * DataView * @@ -294,3 +297,5 @@ DataView.prototype._trigger = DataSet.prototype._trigger; // TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5) DataView.prototype.subscribe = DataView.prototype.on; DataView.prototype.unsubscribe = DataView.prototype.off; + +module.exports = DataView; \ No newline at end of file diff --git a/lib/graph3d/Camera.js b/lib/graph3d/Camera.js new file mode 100644 index 00000000..d758f6fc --- /dev/null +++ b/lib/graph3d/Camera.js @@ -0,0 +1,135 @@ +var Point3d = require('./Point3d'); + +/** + * @class Camera + * The camera is mounted on a (virtual) camera arm. The camera arm can rotate + * The camera is always looking in the direction of the origin of the arm. + * This way, the camera always rotates around one fixed point, the location + * of the camera arm. + * + * Documentation: + * http://en.wikipedia.org/wiki/3D_projection + */ +Camera = function () { + this.armLocation = new Point3d(); + this.armRotation = {}; + this.armRotation.horizontal = 0; + this.armRotation.vertical = 0; + this.armLength = 1.7; + + this.cameraLocation = new Point3d(); + this.cameraRotation = new Point3d(0.5*Math.PI, 0, 0); + + this.calculateCameraOrientation(); +}; + +/** + * Set the location (origin) of the arm + * @param {Number} x Normalized value of x + * @param {Number} y Normalized value of y + * @param {Number} z Normalized value of z + */ +Camera.prototype.setArmLocation = function(x, y, z) { + this.armLocation.x = x; + this.armLocation.y = y; + this.armLocation.z = z; + + this.calculateCameraOrientation(); +}; + +/** + * Set the rotation of the camera arm + * @param {Number} horizontal The horizontal rotation, between 0 and 2*PI. + * Optional, can be left undefined. + * @param {Number} vertical The vertical rotation, between 0 and 0.5*PI + * if vertical=0.5*PI, the graph is shown from the + * top. Optional, can be left undefined. + */ +Camera.prototype.setArmRotation = function(horizontal, vertical) { + if (horizontal !== undefined) { + this.armRotation.horizontal = horizontal; + } + + if (vertical !== undefined) { + this.armRotation.vertical = vertical; + if (this.armRotation.vertical < 0) this.armRotation.vertical = 0; + if (this.armRotation.vertical > 0.5*Math.PI) this.armRotation.vertical = 0.5*Math.PI; + } + + if (horizontal !== undefined || vertical !== undefined) { + this.calculateCameraOrientation(); + } +}; + +/** + * Retrieve the current arm rotation + * @return {object} An object with parameters horizontal and vertical + */ +Camera.prototype.getArmRotation = function() { + var rot = {}; + rot.horizontal = this.armRotation.horizontal; + rot.vertical = this.armRotation.vertical; + + return rot; +}; + +/** + * Set the (normalized) length of the camera arm. + * @param {Number} length A length between 0.71 and 5.0 + */ +Camera.prototype.setArmLength = function(length) { + if (length === undefined) + return; + + this.armLength = length; + + // Radius must be larger than the corner of the graph, + // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the + // graph + if (this.armLength < 0.71) this.armLength = 0.71; + if (this.armLength > 5.0) this.armLength = 5.0; + + this.calculateCameraOrientation(); +}; + +/** + * Retrieve the arm length + * @return {Number} length + */ +Camera.prototype.getArmLength = function() { + return this.armLength; +}; + +/** + * Retrieve the camera location + * @return {Point3d} cameraLocation + */ +Camera.prototype.getCameraLocation = function() { + return this.cameraLocation; +}; + +/** + * Retrieve the camera rotation + * @return {Point3d} cameraRotation + */ +Camera.prototype.getCameraRotation = function() { + return this.cameraRotation; +}; + +/** + * Calculate the location and rotation of the camera based on the + * position and orientation of the camera arm + */ +Camera.prototype.calculateCameraOrientation = function() { + // calculate location of the camera + this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); + + // calculate rotation of the camera + this.cameraRotation.x = Math.PI/2 - this.armRotation.vertical; + this.cameraRotation.y = 0; + this.cameraRotation.z = -this.armRotation.horizontal; +}; + +module.exports = Camera; \ No newline at end of file diff --git a/lib/graph3d/Filter.js b/lib/graph3d/Filter.js new file mode 100644 index 00000000..2315104c --- /dev/null +++ b/lib/graph3d/Filter.js @@ -0,0 +1,218 @@ +var DataView = require('../DataView'); + +/** + * @class Filter + * + * @param {DataSet} data The google data table + * @param {Number} column The index of the column to be filtered + * @param {Graph} graph The graph + */ +function Filter (data, column, graph) { + this.data = data; + this.column = column; + this.graph = graph; // the parent graph + + this.index = undefined; + this.value = undefined; + + // read all distinct values and select the first one + this.values = graph.getDistinctValues(data.get(), this.column); + + // sort both numeric and string values correctly + this.values.sort(function (a, b) { + return a > b ? 1 : a < b ? -1 : 0; + }); + + if (this.values.length > 0) { + this.selectValue(0); + } + + // create an array with the filtered datapoints. this will be loaded afterwards + this.dataPoints = []; + + this.loaded = false; + this.onLoadCallback = undefined; + + if (graph.animationPreload) { + this.loaded = false; + this.loadInBackground(); + } + else { + this.loaded = true; + } +}; + + +/** + * Return the label + * @return {string} label + */ +Filter.prototype.isLoaded = function() { + return this.loaded; +}; + + +/** + * Return the loaded progress + * @return {Number} percentage between 0 and 100 + */ +Filter.prototype.getLoadedProgress = function() { + var len = this.values.length; + + var i = 0; + while (this.dataPoints[i]) { + i++; + } + + return Math.round(i / len * 100); +}; + + +/** + * Return the label + * @return {string} label + */ +Filter.prototype.getLabel = function() { + return this.graph.filterLabel; +}; + + +/** + * Return the columnIndex of the filter + * @return {Number} columnIndex + */ +Filter.prototype.getColumn = function() { + return this.column; +}; + +/** + * Return the currently selected value. Returns undefined if there is no selection + * @return {*} value + */ +Filter.prototype.getSelectedValue = function() { + if (this.index === undefined) + return undefined; + + return this.values[this.index]; +}; + +/** + * Retrieve all values of the filter + * @return {Array} values + */ +Filter.prototype.getValues = function() { + return this.values; +}; + +/** + * Retrieve one value of the filter + * @param {Number} index + * @return {*} value + */ +Filter.prototype.getValue = function(index) { + if (index >= this.values.length) + throw 'Error: index out of range'; + + return this.values[index]; +}; + + +/** + * Retrieve the (filtered) dataPoints for the currently selected filter index + * @param {Number} [index] (optional) + * @return {Array} dataPoints + */ +Filter.prototype._getDataPoints = function(index) { + if (index === undefined) + index = this.index; + + if (index === undefined) + return []; + + var dataPoints; + if (this.dataPoints[index]) { + dataPoints = this.dataPoints[index]; + } + else { + var f = {}; + f.column = this.column; + f.value = this.values[index]; + + var dataView = new DataView(this.data,{filter: function (item) {return (item[f.column] == f.value);}}).get(); + dataPoints = this.graph._getDataPoints(dataView); + + this.dataPoints[index] = dataPoints; + } + + return dataPoints; +}; + + + +/** + * Set a callback function when the filter is fully loaded. + */ +Filter.prototype.setOnLoadCallback = function(callback) { + this.onLoadCallback = callback; +}; + + +/** + * Add a value to the list with available values for this filter + * No double entries will be created. + * @param {Number} index + */ +Filter.prototype.selectValue = function(index) { + if (index >= this.values.length) + throw 'Error: index out of range'; + + this.index = index; + this.value = this.values[index]; +}; + +/** + * Load all filtered rows in the background one by one + * Start this method without providing an index! + */ +Filter.prototype.loadInBackground = function(index) { + if (index === undefined) + index = 0; + + var frame = this.graph.frame; + + if (index < this.values.length) { + var dataPointsTemp = this._getDataPoints(index); + //this.graph.redrawInfo(); // TODO: not neat + + // create a progress box + if (frame.progress === undefined) { + frame.progress = document.createElement('DIV'); + frame.progress.style.position = 'absolute'; + frame.progress.style.color = 'gray'; + frame.appendChild(frame.progress); + } + var progress = this.getLoadedProgress(); + frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; + // TODO: this is no nice solution... + frame.progress.style.bottom = 60 + 'px'; // TODO: use height of slider + frame.progress.style.left = 10 + 'px'; + + var me = this; + setTimeout(function() {me.loadInBackground(index+1);}, 10); + this.loaded = false; + } + else { + this.loaded = true; + + // remove the progress box + if (frame.progress !== undefined) { + frame.removeChild(frame.progress); + frame.progress = undefined; + } + + if (this.onLoadCallback) + this.onLoadCallback(); + } +}; + +module.exports = Filter; diff --git a/src/graph3d/Graph3d.js b/lib/graph3d/Graph3d.js similarity index 71% rename from src/graph3d/Graph3d.js rename to lib/graph3d/Graph3d.js index 038efe8b..bbc6bdcd 100644 --- a/src/graph3d/Graph3d.js +++ b/lib/graph3d/Graph3d.js @@ -1,3 +1,14 @@ +var Emitter = require('emitter-component'); +var DataSet = require('../DataSet'); +var DataView = require('../DataView'); +var util = require('../util'); +var Point3d = require('./Point3d'); +var Point2d = require('./Point2d'); +var Camera = require('./Camera'); +var Filter = require('./Filter'); +var Slider = require('./Slider'); +var StepNumber = require('./StepNumber'); + /** * @constructor Graph3d * Graph3d displays data in 3d. @@ -40,7 +51,7 @@ function Graph3d(container, data, options) { this.animationInterval = 1000; // milliseconds this.animationPreload = false; - this.camera = new Graph3d.Camera(); + this.camera = new Camera(); this.eye = new Point3d(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window? this.dataTable = null; // The original data table @@ -89,138 +100,6 @@ function Graph3d(container, data, options) { // Extend Graph3d with an Emitter mixin Emitter(Graph3d.prototype); -/** - * @class Camera - * The camera is mounted on a (virtual) camera arm. The camera arm can rotate - * The camera is always looking in the direction of the origin of the arm. - * This way, the camera always rotates around one fixed point, the location - * of the camera arm. - * - * Documentation: - * http://en.wikipedia.org/wiki/3D_projection - */ -Graph3d.Camera = function () { - this.armLocation = new Point3d(); - this.armRotation = {}; - this.armRotation.horizontal = 0; - this.armRotation.vertical = 0; - this.armLength = 1.7; - - this.cameraLocation = new Point3d(); - this.cameraRotation = new Point3d(0.5*Math.PI, 0, 0); - - this.calculateCameraOrientation(); -}; - -/** - * Set the location (origin) of the arm - * @param {Number} x Normalized value of x - * @param {Number} y Normalized value of y - * @param {Number} z Normalized value of z - */ -Graph3d.Camera.prototype.setArmLocation = function(x, y, z) { - this.armLocation.x = x; - this.armLocation.y = y; - this.armLocation.z = z; - - this.calculateCameraOrientation(); -}; - -/** - * Set the rotation of the camera arm - * @param {Number} horizontal The horizontal rotation, between 0 and 2*PI. - * Optional, can be left undefined. - * @param {Number} vertical The vertical rotation, between 0 and 0.5*PI - * if vertical=0.5*PI, the graph is shown from the - * top. Optional, can be left undefined. - */ -Graph3d.Camera.prototype.setArmRotation = function(horizontal, vertical) { - if (horizontal !== undefined) { - this.armRotation.horizontal = horizontal; - } - - if (vertical !== undefined) { - this.armRotation.vertical = vertical; - if (this.armRotation.vertical < 0) this.armRotation.vertical = 0; - if (this.armRotation.vertical > 0.5*Math.PI) this.armRotation.vertical = 0.5*Math.PI; - } - - if (horizontal !== undefined || vertical !== undefined) { - this.calculateCameraOrientation(); - } -}; - -/** - * Retrieve the current arm rotation - * @return {object} An object with parameters horizontal and vertical - */ -Graph3d.Camera.prototype.getArmRotation = function() { - var rot = {}; - rot.horizontal = this.armRotation.horizontal; - rot.vertical = this.armRotation.vertical; - - return rot; -}; - -/** - * Set the (normalized) length of the camera arm. - * @param {Number} length A length between 0.71 and 5.0 - */ -Graph3d.Camera.prototype.setArmLength = function(length) { - if (length === undefined) - return; - - this.armLength = length; - - // Radius must be larger than the corner of the graph, - // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the - // graph - if (this.armLength < 0.71) this.armLength = 0.71; - if (this.armLength > 5.0) this.armLength = 5.0; - - this.calculateCameraOrientation(); -}; - -/** - * Retrieve the arm length - * @return {Number} length - */ -Graph3d.Camera.prototype.getArmLength = function() { - return this.armLength; -}; - -/** - * Retrieve the camera location - * @return {Point3d} cameraLocation - */ -Graph3d.Camera.prototype.getCameraLocation = function() { - return this.cameraLocation; -}; - -/** - * Retrieve the camera rotation - * @return {Point3d} cameraRotation - */ -Graph3d.Camera.prototype.getCameraRotation = function() { - return this.cameraRotation; -}; - -/** - * Calculate the location and rotation of the camera based on the - * position and orientation of the camera arm - */ -Graph3d.Camera.prototype.calculateCameraOrientation = function() { - // calculate location of the camera - this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); - this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); - this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); - - // calculate rotation of the camera - this.cameraRotation.x = Math.PI/2 - this.armRotation.vertical; - this.cameraRotation.y = 0; - this.cameraRotation.z = -this.armRotation.horizontal; -}; - /** * Calculate the scaling values, dependent on the range in x, y, and z direction */ @@ -715,19 +594,6 @@ Graph3d.prototype._getDataPoints = function (data) { return dataPoints; }; - - - -/** - * Append suffix 'px' to provided value x - * @param {int} x An integer value - * @return {string} the string value of x, followed by the suffix 'px' - */ -Graph3d.px = function(x) { - return x + 'px'; -}; - - /** * Create the main frame for the Graph3d. * This function is executed once when a Graph3d object is created. The frame @@ -773,11 +639,11 @@ Graph3d.prototype.create = function () { var ontooltip = function (event) {me._onTooltip(event);}; // TODO: these events are never cleaned up... can give a 'memory leakage' - G3DaddEventListener(this.frame.canvas, 'keydown', onkeydown); - G3DaddEventListener(this.frame.canvas, 'mousedown', onmousedown); - G3DaddEventListener(this.frame.canvas, 'touchstart', ontouchstart); - G3DaddEventListener(this.frame.canvas, 'mousewheel', onmousewheel); - G3DaddEventListener(this.frame.canvas, 'mousemove', ontooltip); + util.addEventListener(this.frame.canvas, 'keydown', onkeydown); + util.addEventListener(this.frame.canvas, 'mousedown', onmousedown); + util.addEventListener(this.frame.canvas, 'touchstart', ontouchstart); + util.addEventListener(this.frame.canvas, 'mousewheel', onmousewheel); + util.addEventListener(this.frame.canvas, 'mousemove', ontooltip); // add the new graph to the container element this.containerElement.appendChild(this.frame); @@ -1992,9 +1858,9 @@ Graph3d.prototype._onMouseDown = function(event) { var me = this; this.onmousemove = function (event) {me._onMouseMove(event);}; this.onmouseup = function (event) {me._onMouseUp(event);}; - G3DaddEventListener(document, 'mousemove', me.onmousemove); - G3DaddEventListener(document, 'mouseup', me.onmouseup); - G3DpreventDefault(event); + util.addEventListener(document, 'mousemove', me.onmousemove); + util.addEventListener(document, 'mouseup', me.onmouseup); + util.preventDefault(event); }; @@ -2040,7 +1906,7 @@ Graph3d.prototype._onMouseMove = function (event) { var parameters = this.getCameraPosition(); this.emit('cameraPositionChange', parameters); - G3DpreventDefault(event); + util.preventDefault(event); }; @@ -2054,9 +1920,9 @@ Graph3d.prototype._onMouseUp = function (event) { this.leftButtonDown = false; // remove event listeners here - G3DremoveEventListener(document, 'mousemove', this.onmousemove); - G3DremoveEventListener(document, 'mouseup', this.onmouseup); - G3DpreventDefault(event); + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); }; /** @@ -2065,8 +1931,8 @@ Graph3d.prototype._onMouseUp = function (event) { */ Graph3d.prototype._onTooltip = function (event) { var delay = 300; // ms - var mouseX = getMouseX(event) - getAbsoluteLeft(this.frame); - var mouseY = getMouseY(event) - getAbsoluteTop(this.frame); + var mouseX = getMouseX(event) - util.getAbsoluteLeft(this.frame); + var mouseY = getMouseY(event) - util.getAbsoluteTop(this.frame); if (!this.showTooltip) { return; @@ -2119,8 +1985,8 @@ Graph3d.prototype._onTouchStart = function(event) { var me = this; this.ontouchmove = function (event) {me._onTouchMove(event);}; this.ontouchend = function (event) {me._onTouchEnd(event);}; - G3DaddEventListener(document, 'touchmove', me.ontouchmove); - G3DaddEventListener(document, 'touchend', me.ontouchend); + util.addEventListener(document, 'touchmove', me.ontouchmove); + util.addEventListener(document, 'touchend', me.ontouchend); this._onMouseDown(event); }; @@ -2138,8 +2004,8 @@ Graph3d.prototype._onTouchMove = function(event) { Graph3d.prototype._onTouchEnd = function(event) { this.touchDown = false; - G3DremoveEventListener(document, 'touchmove', this.ontouchmove); - G3DremoveEventListener(document, 'touchend', this.ontouchend); + util.removeEventListener(document, 'touchmove', this.ontouchmove); + util.removeEventListener(document, 'touchend', this.ontouchend); this._onMouseUp(event); }; @@ -2184,7 +2050,7 @@ Graph3d.prototype._onWheel = function(event) { // Prevent default actions caused by mouse wheel. // That might be ugly, but we handle scrolls somehow // anyway, so don't bother here.. - G3DpreventDefault(event); + util.preventDefault(event); }; /** @@ -2376,918 +2242,9 @@ Graph3d.prototype._hideTooltip = function () { } }; - -/** - * Add and event listener. Works for all browsers - * @param {Element} element An html element - * @param {string} action The action, for example 'click', - * without the prefix 'on' - * @param {function} listener The callback function to be executed - * @param {boolean} useCapture - */ -G3DaddEventListener = function(element, action, listener, useCapture) { - if (element.addEventListener) { - if (useCapture === undefined) - useCapture = false; - - if (action === 'mousewheel' && navigator.userAgent.indexOf('Firefox') >= 0) { - action = 'DOMMouseScroll'; // For Firefox - } - - element.addEventListener(action, listener, useCapture); - } else { - element.attachEvent('on' + action, listener); // IE browsers - } -}; - -/** - * Remove an event listener from an element - * @param {Element} element An html dom element - * @param {string} action The name of the event, for example 'mousedown' - * @param {function} listener The listener function - * @param {boolean} useCapture - */ -G3DremoveEventListener = function(element, action, listener, useCapture) { - if (element.removeEventListener) { - // non-IE browsers - if (useCapture === undefined) - useCapture = false; - - if (action === 'mousewheel' && navigator.userAgent.indexOf('Firefox') >= 0) { - action = 'DOMMouseScroll'; // For Firefox - } - - element.removeEventListener(action, listener, useCapture); - } else { - // IE browsers - element.detachEvent('on' + action, listener); - } -}; - -/** - * Stop event propagation - */ -G3DstopPropagation = function(event) { - if (!event) - event = window.event; - - if (event.stopPropagation) { - event.stopPropagation(); // non-IE browsers - } - else { - event.cancelBubble = true; // IE browsers - } -}; - - -/** - * Cancels the event if it is cancelable, without stopping further propagation of the event. - */ -G3DpreventDefault = function (event) { - if (!event) - event = window.event; - - if (event.preventDefault) { - event.preventDefault(); // non-IE browsers - } - else { - event.returnValue = false; // IE browsers - } -}; - - - -/** - * @prototype Point3d - * @param {Number} x - * @param {Number} y - * @param {Number} z - */ -function Point3d(x, y, z) { - this.x = x !== undefined ? x : 0; - this.y = y !== undefined ? y : 0; - this.z = z !== undefined ? z : 0; -}; - -/** - * Subtract the two provided points, returns a-b - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} a-b - */ -Point3d.subtract = function(a, b) { - var sub = new Point3d(); - sub.x = a.x - b.x; - sub.y = a.y - b.y; - sub.z = a.z - b.z; - return sub; -}; - -/** - * Add the two provided points, returns a+b - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} a+b - */ -Point3d.add = function(a, b) { - var sum = new Point3d(); - sum.x = a.x + b.x; - sum.y = a.y + b.y; - sum.z = a.z + b.z; - return sum; -}; - -/** - * Calculate the average of two 3d points - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} The average, (a+b)/2 - */ -Point3d.avg = function(a, b) { - return new Point3d( - (a.x + b.x) / 2, - (a.y + b.y) / 2, - (a.z + b.z) / 2 - ); -}; - -/** - * Calculate the cross product of the two provided points, returns axb - * Documentation: http://en.wikipedia.org/wiki/Cross_product - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} cross product axb - */ -Point3d.crossProduct = function(a, b) { - var crossproduct = new Point3d(); - - crossproduct.x = a.y * b.z - a.z * b.y; - crossproduct.y = a.z * b.x - a.x * b.z; - crossproduct.z = a.x * b.y - a.y * b.x; - - return crossproduct; -}; - - -/** - * Rtrieve the length of the vector (or the distance from this point to the origin - * @return {Number} length - */ -Point3d.prototype.length = function() { - return Math.sqrt( - this.x * this.x + - this.y * this.y + - this.z * this.z - ); -}; - -/** - * @prototype Point2d - */ -Point2d = function (x, y) { - this.x = x !== undefined ? x : 0; - this.y = y !== undefined ? y : 0; -}; - - -/** - * @class Filter - * - * @param {DataSet} data The google data table - * @param {Number} column The index of the column to be filtered - * @param {Graph} graph The graph - */ -function Filter (data, column, graph) { - this.data = data; - this.column = column; - this.graph = graph; // the parent graph - - this.index = undefined; - this.value = undefined; - - // read all distinct values and select the first one - this.values = graph.getDistinctValues(data.get(), this.column); - - // sort both numeric and string values correctly - this.values.sort(function (a, b) { - return a > b ? 1 : a < b ? -1 : 0; - }); - - if (this.values.length > 0) { - this.selectValue(0); - } - - // create an array with the filtered datapoints. this will be loaded afterwards - this.dataPoints = []; - - this.loaded = false; - this.onLoadCallback = undefined; - - if (graph.animationPreload) { - this.loaded = false; - this.loadInBackground(); - } - else { - this.loaded = true; - } -}; - - -/** - * Return the label - * @return {string} label - */ -Filter.prototype.isLoaded = function() { - return this.loaded; -}; - - -/** - * Return the loaded progress - * @return {Number} percentage between 0 and 100 - */ -Filter.prototype.getLoadedProgress = function() { - var len = this.values.length; - - var i = 0; - while (this.dataPoints[i]) { - i++; - } - - return Math.round(i / len * 100); -}; - - -/** - * Return the label - * @return {string} label - */ -Filter.prototype.getLabel = function() { - return this.graph.filterLabel; -}; - - -/** - * Return the columnIndex of the filter - * @return {Number} columnIndex - */ -Filter.prototype.getColumn = function() { - return this.column; -}; - -/** - * Return the currently selected value. Returns undefined if there is no selection - * @return {*} value - */ -Filter.prototype.getSelectedValue = function() { - if (this.index === undefined) - return undefined; - - return this.values[this.index]; -}; - -/** - * Retrieve all values of the filter - * @return {Array} values - */ -Filter.prototype.getValues = function() { - return this.values; -}; - -/** - * Retrieve one value of the filter - * @param {Number} index - * @return {*} value - */ -Filter.prototype.getValue = function(index) { - if (index >= this.values.length) - throw 'Error: index out of range'; - - return this.values[index]; -}; - - -/** - * Retrieve the (filtered) dataPoints for the currently selected filter index - * @param {Number} [index] (optional) - * @return {Array} dataPoints - */ -Filter.prototype._getDataPoints = function(index) { - if (index === undefined) - index = this.index; - - if (index === undefined) - return []; - - var dataPoints; - if (this.dataPoints[index]) { - dataPoints = this.dataPoints[index]; - } - else { - var f = {}; - f.column = this.column; - f.value = this.values[index]; - - var dataView = new DataView(this.data,{filter: function (item) {return (item[f.column] == f.value);}}).get(); - dataPoints = this.graph._getDataPoints(dataView); - - this.dataPoints[index] = dataPoints; - } - - return dataPoints; -}; - - - -/** - * Set a callback function when the filter is fully loaded. - */ -Filter.prototype.setOnLoadCallback = function(callback) { - this.onLoadCallback = callback; -}; - - -/** - * Add a value to the list with available values for this filter - * No double entries will be created. - * @param {Number} index - */ -Filter.prototype.selectValue = function(index) { - if (index >= this.values.length) - throw 'Error: index out of range'; - - this.index = index; - this.value = this.values[index]; -}; - -/** - * Load all filtered rows in the background one by one - * Start this method without providing an index! - */ -Filter.prototype.loadInBackground = function(index) { - if (index === undefined) - index = 0; - - var frame = this.graph.frame; - - if (index < this.values.length) { - var dataPointsTemp = this._getDataPoints(index); - //this.graph.redrawInfo(); // TODO: not neat - - // create a progress box - if (frame.progress === undefined) { - frame.progress = document.createElement('DIV'); - frame.progress.style.position = 'absolute'; - frame.progress.style.color = 'gray'; - frame.appendChild(frame.progress); - } - var progress = this.getLoadedProgress(); - frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; - // TODO: this is no nice solution... - frame.progress.style.bottom = Graph3d.px(60); // TODO: use height of slider - frame.progress.style.left = Graph3d.px(10); - - var me = this; - setTimeout(function() {me.loadInBackground(index+1);}, 10); - this.loaded = false; - } - else { - this.loaded = true; - - // remove the progress box - if (frame.progress !== undefined) { - frame.removeChild(frame.progress); - frame.progress = undefined; - } - - if (this.onLoadCallback) - this.onLoadCallback(); - } -}; - - - -/** - * @prototype StepNumber - * The class StepNumber is an iterator for Numbers. You provide a start and end - * value, and a best step size. StepNumber itself rounds to fixed values and - * a finds the step that best fits the provided step. - * - * If prettyStep is true, the step size is chosen as close as possible to the - * provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... - * - * Example usage: - * var step = new StepNumber(0, 10, 2.5, true); - * step.start(); - * while (!step.end()) { - * alert(step.getCurrent()); - * step.next(); - * } - * - * Version: 1.0 - * - * @param {Number} start The start value - * @param {Number} end The end value - * @param {Number} step Optional. Step size. Must be a positive value. - * @param {boolean} prettyStep Optional. If true, the step size is rounded - * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ -StepNumber = function (start, end, step, prettyStep) { - // set default values - this._start = 0; - this._end = 0; - this._step = 1; - this.prettyStep = true; - this.precision = 5; - - this._current = 0; - this.setRange(start, end, step, prettyStep); -}; - -/** - * Set a new range: start, end and step. - * - * @param {Number} start The start value - * @param {Number} end The end value - * @param {Number} step Optional. Step size. Must be a positive value. - * @param {boolean} prettyStep Optional. If true, the step size is rounded - * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ -StepNumber.prototype.setRange = function(start, end, step, prettyStep) { - this._start = start ? start : 0; - this._end = end ? end : 0; - - this.setStep(step, prettyStep); -}; - -/** - * Set a new step size - * @param {Number} step New step size. Must be a positive value - * @param {boolean} prettyStep Optional. If true, the provided step is rounded - * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ -StepNumber.prototype.setStep = function(step, prettyStep) { - if (step === undefined || step <= 0) - return; - - if (prettyStep !== undefined) - this.prettyStep = prettyStep; - - if (this.prettyStep === true) - this._step = StepNumber.calculatePrettyStep(step); - else - this._step = step; -}; - -/** - * Calculate a nice step size, closest to the desired step size. - * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an - * integer Number. For example 1, 2, 5, 10, 20, 50, etc... - * @param {Number} step Desired step size - * @return {Number} Nice step size - */ -StepNumber.calculatePrettyStep = function (step) { - var log10 = function (x) {return Math.log(x) / Math.LN10;}; - - // try three steps (multiple of 1, 2, or 5 - var step1 = Math.pow(10, Math.round(log10(step))), - step2 = 2 * Math.pow(10, Math.round(log10(step / 2))), - step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); - - // choose the best step (closest to minimum step) - var prettyStep = step1; - if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2; - if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; - - // for safety - if (prettyStep <= 0) { - prettyStep = 1; - } - - return prettyStep; -}; - -/** - * returns the current value of the step - * @return {Number} current value - */ -StepNumber.prototype.getCurrent = function () { - return parseFloat(this._current.toPrecision(this.precision)); -}; - -/** - * returns the current step size - * @return {Number} current step size - */ -StepNumber.prototype.getStep = function () { - return this._step; -}; - -/** - * Set the current value to the largest value smaller than start, which - * is a multiple of the step size - */ -StepNumber.prototype.start = function() { - this._current = this._start - this._start % this._step; -}; - -/** - * Do a step, add the step size to the current value - */ -StepNumber.prototype.next = function () { - this._current += this._step; -}; - -/** - * Returns true whether the end is reached - * @return {boolean} True if the current value has passed the end value. - */ -StepNumber.prototype.end = function () { - return (this._current > this._end); -}; - - -/** - * @constructor Slider - * - * An html slider control with start/stop/prev/next buttons - * @param {Element} container The element where the slider will be created - * @param {Object} options Available options: - * {boolean} visible If true (default) the - * slider is visible. - */ -function Slider(container, options) { - if (container === undefined) { - throw 'Error: No container element defined'; - } - this.container = container; - this.visible = (options && options.visible != undefined) ? options.visible : true; - - if (this.visible) { - this.frame = document.createElement('DIV'); - //this.frame.style.backgroundColor = '#E5E5E5'; - this.frame.style.width = '100%'; - this.frame.style.position = 'relative'; - this.container.appendChild(this.frame); - - this.frame.prev = document.createElement('INPUT'); - this.frame.prev.type = 'BUTTON'; - this.frame.prev.value = 'Prev'; - this.frame.appendChild(this.frame.prev); - - this.frame.play = document.createElement('INPUT'); - this.frame.play.type = 'BUTTON'; - this.frame.play.value = 'Play'; - this.frame.appendChild(this.frame.play); - - this.frame.next = document.createElement('INPUT'); - this.frame.next.type = 'BUTTON'; - this.frame.next.value = 'Next'; - this.frame.appendChild(this.frame.next); - - this.frame.bar = document.createElement('INPUT'); - this.frame.bar.type = 'BUTTON'; - this.frame.bar.style.position = 'absolute'; - this.frame.bar.style.border = '1px solid red'; - this.frame.bar.style.width = '100px'; - this.frame.bar.style.height = '6px'; - this.frame.bar.style.borderRadius = '2px'; - this.frame.bar.style.MozBorderRadius = '2px'; - this.frame.bar.style.border = '1px solid #7F7F7F'; - this.frame.bar.style.backgroundColor = '#E5E5E5'; - this.frame.appendChild(this.frame.bar); - - this.frame.slide = document.createElement('INPUT'); - this.frame.slide.type = 'BUTTON'; - this.frame.slide.style.margin = '0px'; - this.frame.slide.value = ' '; - this.frame.slide.style.position = 'relative'; - this.frame.slide.style.left = '-100px'; - this.frame.appendChild(this.frame.slide); - - // create events - var me = this; - this.frame.slide.onmousedown = function (event) {me._onMouseDown(event);}; - this.frame.prev.onclick = function (event) {me.prev(event);}; - this.frame.play.onclick = function (event) {me.togglePlay(event);}; - this.frame.next.onclick = function (event) {me.next(event);}; - } - - this.onChangeCallback = undefined; - - this.values = []; - this.index = undefined; - - this.playTimeout = undefined; - this.playInterval = 1000; // milliseconds - this.playLoop = true; -}; - -/** - * Select the previous index - */ -Slider.prototype.prev = function() { - var index = this.getIndex(); - if (index > 0) { - index--; - this.setIndex(index); - } -}; - -/** - * Select the next index - */ -Slider.prototype.next = function() { - var index = this.getIndex(); - if (index < this.values.length - 1) { - index++; - this.setIndex(index); - } -}; - -/** - * Select the next index - */ -Slider.prototype.playNext = function() { - var start = new Date(); - - var index = this.getIndex(); - if (index < this.values.length - 1) { - index++; - this.setIndex(index); - } - else if (this.playLoop) { - // jump to the start - index = 0; - this.setIndex(index); - } - - var end = new Date(); - var diff = (end - start); - - // calculate how much time it to to set the index and to execute the callback - // function. - var interval = Math.max(this.playInterval - diff, 0); - // document.title = diff // TODO: cleanup - - var me = this; - this.playTimeout = setTimeout(function() {me.playNext();}, interval); -}; - -/** - * Toggle start or stop playing - */ -Slider.prototype.togglePlay = function() { - if (this.playTimeout === undefined) { - this.play(); - } else { - this.stop(); - } -}; - -/** - * Start playing - */ -Slider.prototype.play = function() { - // Test whether already playing - if (this.playTimeout) return; - - this.playNext(); - - if (this.frame) { - this.frame.play.value = 'Stop'; - } -}; - -/** - * Stop playing - */ -Slider.prototype.stop = function() { - clearInterval(this.playTimeout); - this.playTimeout = undefined; - - if (this.frame) { - this.frame.play.value = 'Play'; - } -}; - -/** - * Set a callback function which will be triggered when the value of the - * slider bar has changed. - */ -Slider.prototype.setOnChangeCallback = function(callback) { - this.onChangeCallback = callback; -}; - -/** - * Set the interval for playing the list - * @param {Number} interval The interval in milliseconds - */ -Slider.prototype.setPlayInterval = function(interval) { - this.playInterval = interval; -}; - -/** - * Retrieve the current play interval - * @return {Number} interval The interval in milliseconds - */ -Slider.prototype.getPlayInterval = function(interval) { - return this.playInterval; -}; - -/** - * Set looping on or off - * @pararm {boolean} doLoop If true, the slider will jump to the start when - * the end is passed, and will jump to the end - * when the start is passed. - */ -Slider.prototype.setPlayLoop = function(doLoop) { - this.playLoop = doLoop; -}; - - -/** - * Execute the onchange callback function - */ -Slider.prototype.onChange = function() { - if (this.onChangeCallback !== undefined) { - this.onChangeCallback(); - } -}; - -/** - * redraw the slider on the correct place - */ -Slider.prototype.redraw = function() { - if (this.frame) { - // resize the bar - this.frame.bar.style.top = (this.frame.clientHeight/2 - - this.frame.bar.offsetHeight/2) + 'px'; - this.frame.bar.style.width = (this.frame.clientWidth - - this.frame.prev.clientWidth - - this.frame.play.clientWidth - - this.frame.next.clientWidth - 30) + 'px'; - - // position the slider button - var left = this.indexToLeft(this.index); - this.frame.slide.style.left = (left) + 'px'; - } -}; - - -/** - * Set the list with values for the slider - * @param {Array} values A javascript array with values (any type) - */ -Slider.prototype.setValues = function(values) { - this.values = values; - - if (this.values.length > 0) - this.setIndex(0); - else - this.index = undefined; -}; - -/** - * Select a value by its index - * @param {Number} index - */ -Slider.prototype.setIndex = function(index) { - if (index < this.values.length) { - this.index = index; - - this.redraw(); - this.onChange(); - } - else { - throw 'Error: index out of range'; - } -}; - -/** - * retrieve the index of the currently selected vaue - * @return {Number} index - */ -Slider.prototype.getIndex = function() { - return this.index; -}; - - -/** - * retrieve the currently selected value - * @return {*} value - */ -Slider.prototype.get = function() { - return this.values[this.index]; -}; - - -Slider.prototype._onMouseDown = function(event) { - // only react on left mouse button down - var leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); - if (!leftButtonDown) return; - - this.startClientX = event.clientX; - this.startSlideX = parseFloat(this.frame.slide.style.left); - - this.frame.style.cursor = 'move'; - - // add event listeners to handle moving the contents - // we store the function onmousemove and onmouseup in the graph, so we can - // remove the eventlisteners lateron in the function mouseUp() - var me = this; - this.onmousemove = function (event) {me._onMouseMove(event);}; - this.onmouseup = function (event) {me._onMouseUp(event);}; - G3DaddEventListener(document, 'mousemove', this.onmousemove); - G3DaddEventListener(document, 'mouseup', this.onmouseup); - G3DpreventDefault(event); -}; - - -Slider.prototype.leftToIndex = function (left) { - var width = parseFloat(this.frame.bar.style.width) - - this.frame.slide.clientWidth - 10; - var x = left - 3; - - var index = Math.round(x / width * (this.values.length-1)); - if (index < 0) index = 0; - if (index > this.values.length-1) index = this.values.length-1; - - return index; -}; - -Slider.prototype.indexToLeft = function (index) { - var width = parseFloat(this.frame.bar.style.width) - - this.frame.slide.clientWidth - 10; - - var x = index / (this.values.length-1) * width; - var left = x + 3; - - return left; -}; - - - -Slider.prototype._onMouseMove = function (event) { - var diff = event.clientX - this.startClientX; - var x = this.startSlideX + diff; - - var index = this.leftToIndex(x); - - this.setIndex(index); - - G3DpreventDefault(); -}; - - -Slider.prototype._onMouseUp = function (event) { - this.frame.style.cursor = 'auto'; - - // remove event listeners - G3DremoveEventListener(document, 'mousemove', this.onmousemove); - G3DremoveEventListener(document, 'mouseup', this.onmouseup); - - G3DpreventDefault(); -}; - - - /**--------------------------------------------------------------------------**/ - -/** - * Retrieve the absolute left value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {Number} left The absolute left position of this element - * in the browser page. - */ -getAbsoluteLeft = function(elem) { - var left = 0; - while( elem !== null ) { - left += elem.offsetLeft; - left -= elem.scrollLeft; - elem = elem.offsetParent; - } - return left; -}; - -/** - * Retrieve the absolute top value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {Number} top The absolute top position of this element - * in the browser page. - */ -getAbsoluteTop = function(elem) { - var top = 0; - while( elem !== null ) { - top += elem.offsetTop; - top -= elem.scrollTop; - elem = elem.offsetParent; - } - return top; -}; - /** * Get the horizontal mouse position from a mouse event * @param {Event} event @@ -3308,3 +2265,4 @@ getMouseY = function(event) { return event.targetTouches[0] && event.targetTouches[0].clientY || 0; }; +module.exports = Graph3d; diff --git a/lib/graph3d/Point2d.js b/lib/graph3d/Point2d.js new file mode 100644 index 00000000..feec858e --- /dev/null +++ b/lib/graph3d/Point2d.js @@ -0,0 +1,11 @@ +/** + * @prototype Point2d + * @param {Number} [x] + * @param {Number} [y] + */ +Point2d = function (x, y) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; +}; + +module.exports = Point2d; diff --git a/lib/graph3d/Point3d.js b/lib/graph3d/Point3d.js new file mode 100644 index 00000000..0892e693 --- /dev/null +++ b/lib/graph3d/Point3d.js @@ -0,0 +1,85 @@ +/** + * @prototype Point3d + * @param {Number} [x] + * @param {Number} [y] + * @param {Number} [z] + */ +function Point3d(x, y, z) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; + this.z = z !== undefined ? z : 0; +}; + +/** + * Subtract the two provided points, returns a-b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a-b + */ +Point3d.subtract = function(a, b) { + var sub = new Point3d(); + sub.x = a.x - b.x; + sub.y = a.y - b.y; + sub.z = a.z - b.z; + return sub; +}; + +/** + * Add the two provided points, returns a+b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a+b + */ +Point3d.add = function(a, b) { + var sum = new Point3d(); + sum.x = a.x + b.x; + sum.y = a.y + b.y; + sum.z = a.z + b.z; + return sum; +}; + +/** + * Calculate the average of two 3d points + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} The average, (a+b)/2 + */ +Point3d.avg = function(a, b) { + return new Point3d( + (a.x + b.x) / 2, + (a.y + b.y) / 2, + (a.z + b.z) / 2 + ); +}; + +/** + * Calculate the cross product of the two provided points, returns axb + * Documentation: http://en.wikipedia.org/wiki/Cross_product + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} cross product axb + */ +Point3d.crossProduct = function(a, b) { + var crossproduct = new Point3d(); + + crossproduct.x = a.y * b.z - a.z * b.y; + crossproduct.y = a.z * b.x - a.x * b.z; + crossproduct.z = a.x * b.y - a.y * b.x; + + return crossproduct; +}; + + +/** + * Rtrieve the length of the vector (or the distance from this point to the origin + * @return {Number} length + */ +Point3d.prototype.length = function() { + return Math.sqrt( + this.x * this.x + + this.y * this.y + + this.z * this.z + ); +}; + +module.exports = Point3d; diff --git a/lib/graph3d/Slider.js b/lib/graph3d/Slider.js new file mode 100644 index 00000000..dd688e50 --- /dev/null +++ b/lib/graph3d/Slider.js @@ -0,0 +1,346 @@ +var util = require('../util'); + +/** + * @constructor Slider + * + * An html slider control with start/stop/prev/next buttons + * @param {Element} container The element where the slider will be created + * @param {Object} options Available options: + * {boolean} visible If true (default) the + * slider is visible. + */ +function Slider(container, options) { + if (container === undefined) { + throw 'Error: No container element defined'; + } + this.container = container; + this.visible = (options && options.visible != undefined) ? options.visible : true; + + if (this.visible) { + this.frame = document.createElement('DIV'); + //this.frame.style.backgroundColor = '#E5E5E5'; + this.frame.style.width = '100%'; + this.frame.style.position = 'relative'; + this.container.appendChild(this.frame); + + this.frame.prev = document.createElement('INPUT'); + this.frame.prev.type = 'BUTTON'; + this.frame.prev.value = 'Prev'; + this.frame.appendChild(this.frame.prev); + + this.frame.play = document.createElement('INPUT'); + this.frame.play.type = 'BUTTON'; + this.frame.play.value = 'Play'; + this.frame.appendChild(this.frame.play); + + this.frame.next = document.createElement('INPUT'); + this.frame.next.type = 'BUTTON'; + this.frame.next.value = 'Next'; + this.frame.appendChild(this.frame.next); + + this.frame.bar = document.createElement('INPUT'); + this.frame.bar.type = 'BUTTON'; + this.frame.bar.style.position = 'absolute'; + this.frame.bar.style.border = '1px solid red'; + this.frame.bar.style.width = '100px'; + this.frame.bar.style.height = '6px'; + this.frame.bar.style.borderRadius = '2px'; + this.frame.bar.style.MozBorderRadius = '2px'; + this.frame.bar.style.border = '1px solid #7F7F7F'; + this.frame.bar.style.backgroundColor = '#E5E5E5'; + this.frame.appendChild(this.frame.bar); + + this.frame.slide = document.createElement('INPUT'); + this.frame.slide.type = 'BUTTON'; + this.frame.slide.style.margin = '0px'; + this.frame.slide.value = ' '; + this.frame.slide.style.position = 'relative'; + this.frame.slide.style.left = '-100px'; + this.frame.appendChild(this.frame.slide); + + // create events + var me = this; + this.frame.slide.onmousedown = function (event) {me._onMouseDown(event);}; + this.frame.prev.onclick = function (event) {me.prev(event);}; + this.frame.play.onclick = function (event) {me.togglePlay(event);}; + this.frame.next.onclick = function (event) {me.next(event);}; + } + + this.onChangeCallback = undefined; + + this.values = []; + this.index = undefined; + + this.playTimeout = undefined; + this.playInterval = 1000; // milliseconds + this.playLoop = true; +} + +/** + * Select the previous index + */ +Slider.prototype.prev = function() { + var index = this.getIndex(); + if (index > 0) { + index--; + this.setIndex(index); + } +}; + +/** + * Select the next index + */ +Slider.prototype.next = function() { + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } +}; + +/** + * Select the next index + */ +Slider.prototype.playNext = function() { + var start = new Date(); + + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } + else if (this.playLoop) { + // jump to the start + index = 0; + this.setIndex(index); + } + + var end = new Date(); + var diff = (end - start); + + // calculate how much time it to to set the index and to execute the callback + // function. + var interval = Math.max(this.playInterval - diff, 0); + // document.title = diff // TODO: cleanup + + var me = this; + this.playTimeout = setTimeout(function() {me.playNext();}, interval); +}; + +/** + * Toggle start or stop playing + */ +Slider.prototype.togglePlay = function() { + if (this.playTimeout === undefined) { + this.play(); + } else { + this.stop(); + } +}; + +/** + * Start playing + */ +Slider.prototype.play = function() { + // Test whether already playing + if (this.playTimeout) return; + + this.playNext(); + + if (this.frame) { + this.frame.play.value = 'Stop'; + } +}; + +/** + * Stop playing + */ +Slider.prototype.stop = function() { + clearInterval(this.playTimeout); + this.playTimeout = undefined; + + if (this.frame) { + this.frame.play.value = 'Play'; + } +}; + +/** + * Set a callback function which will be triggered when the value of the + * slider bar has changed. + */ +Slider.prototype.setOnChangeCallback = function(callback) { + this.onChangeCallback = callback; +}; + +/** + * Set the interval for playing the list + * @param {Number} interval The interval in milliseconds + */ +Slider.prototype.setPlayInterval = function(interval) { + this.playInterval = interval; +}; + +/** + * Retrieve the current play interval + * @return {Number} interval The interval in milliseconds + */ +Slider.prototype.getPlayInterval = function(interval) { + return this.playInterval; +}; + +/** + * Set looping on or off + * @pararm {boolean} doLoop If true, the slider will jump to the start when + * the end is passed, and will jump to the end + * when the start is passed. + */ +Slider.prototype.setPlayLoop = function(doLoop) { + this.playLoop = doLoop; +}; + + +/** + * Execute the onchange callback function + */ +Slider.prototype.onChange = function() { + if (this.onChangeCallback !== undefined) { + this.onChangeCallback(); + } +}; + +/** + * redraw the slider on the correct place + */ +Slider.prototype.redraw = function() { + if (this.frame) { + // resize the bar + this.frame.bar.style.top = (this.frame.clientHeight/2 - + this.frame.bar.offsetHeight/2) + 'px'; + this.frame.bar.style.width = (this.frame.clientWidth - + this.frame.prev.clientWidth - + this.frame.play.clientWidth - + this.frame.next.clientWidth - 30) + 'px'; + + // position the slider button + var left = this.indexToLeft(this.index); + this.frame.slide.style.left = (left) + 'px'; + } +}; + + +/** + * Set the list with values for the slider + * @param {Array} values A javascript array with values (any type) + */ +Slider.prototype.setValues = function(values) { + this.values = values; + + if (this.values.length > 0) + this.setIndex(0); + else + this.index = undefined; +}; + +/** + * Select a value by its index + * @param {Number} index + */ +Slider.prototype.setIndex = function(index) { + if (index < this.values.length) { + this.index = index; + + this.redraw(); + this.onChange(); + } + else { + throw 'Error: index out of range'; + } +}; + +/** + * retrieve the index of the currently selected vaue + * @return {Number} index + */ +Slider.prototype.getIndex = function() { + return this.index; +}; + + +/** + * retrieve the currently selected value + * @return {*} value + */ +Slider.prototype.get = function() { + return this.values[this.index]; +}; + + +Slider.prototype._onMouseDown = function(event) { + // only react on left mouse button down + var leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); + if (!leftButtonDown) return; + + this.startClientX = event.clientX; + this.startSlideX = parseFloat(this.frame.slide.style.left); + + this.frame.style.cursor = 'move'; + + // add event listeners to handle moving the contents + // we store the function onmousemove and onmouseup in the graph, so we can + // remove the eventlisteners lateron in the function mouseUp() + var me = this; + this.onmousemove = function (event) {me._onMouseMove(event);}; + this.onmouseup = function (event) {me._onMouseUp(event);}; + util.addEventListener(document, 'mousemove', this.onmousemove); + util.addEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); +}; + + +Slider.prototype.leftToIndex = function (left) { + var width = parseFloat(this.frame.bar.style.width) - + this.frame.slide.clientWidth - 10; + var x = left - 3; + + var index = Math.round(x / width * (this.values.length-1)); + if (index < 0) index = 0; + if (index > this.values.length-1) index = this.values.length-1; + + return index; +}; + +Slider.prototype.indexToLeft = function (index) { + var width = parseFloat(this.frame.bar.style.width) - + this.frame.slide.clientWidth - 10; + + var x = index / (this.values.length-1) * width; + var left = x + 3; + + return left; +}; + + + +Slider.prototype._onMouseMove = function (event) { + var diff = event.clientX - this.startClientX; + var x = this.startSlideX + diff; + + var index = this.leftToIndex(x); + + this.setIndex(index); + + util.preventDefault(); +}; + + +Slider.prototype._onMouseUp = function (event) { + this.frame.style.cursor = 'auto'; + + // remove event listeners + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); + + util.preventDefault(); +}; + +module.exports = Slider; diff --git a/lib/graph3d/StepNumber.js b/lib/graph3d/StepNumber.js new file mode 100644 index 00000000..6c11a37c --- /dev/null +++ b/lib/graph3d/StepNumber.js @@ -0,0 +1,140 @@ +/** + * @prototype StepNumber + * The class StepNumber is an iterator for Numbers. You provide a start and end + * value, and a best step size. StepNumber itself rounds to fixed values and + * a finds the step that best fits the provided step. + * + * If prettyStep is true, the step size is chosen as close as possible to the + * provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... + * + * Example usage: + * var step = new StepNumber(0, 10, 2.5, true); + * step.start(); + * while (!step.end()) { + * alert(step.getCurrent()); + * step.next(); + * } + * + * Version: 1.0 + * + * @param {Number} start The start value + * @param {Number} end The end value + * @param {Number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ +function StepNumber(start, end, step, prettyStep) { + // set default values + this._start = 0; + this._end = 0; + this._step = 1; + this.prettyStep = true; + this.precision = 5; + + this._current = 0; + this.setRange(start, end, step, prettyStep); +}; + +/** + * Set a new range: start, end and step. + * + * @param {Number} start The start value + * @param {Number} end The end value + * @param {Number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ +StepNumber.prototype.setRange = function(start, end, step, prettyStep) { + this._start = start ? start : 0; + this._end = end ? end : 0; + + this.setStep(step, prettyStep); +}; + +/** + * Set a new step size + * @param {Number} step New step size. Must be a positive value + * @param {boolean} prettyStep Optional. If true, the provided step is rounded + * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ +StepNumber.prototype.setStep = function(step, prettyStep) { + if (step === undefined || step <= 0) + return; + + if (prettyStep !== undefined) + this.prettyStep = prettyStep; + + if (this.prettyStep === true) + this._step = StepNumber.calculatePrettyStep(step); + else + this._step = step; +}; + +/** + * Calculate a nice step size, closest to the desired step size. + * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an + * integer Number. For example 1, 2, 5, 10, 20, 50, etc... + * @param {Number} step Desired step size + * @return {Number} Nice step size + */ +StepNumber.calculatePrettyStep = function (step) { + var log10 = function (x) {return Math.log(x) / Math.LN10;}; + + // try three steps (multiple of 1, 2, or 5 + var step1 = Math.pow(10, Math.round(log10(step))), + step2 = 2 * Math.pow(10, Math.round(log10(step / 2))), + step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); + + // choose the best step (closest to minimum step) + var prettyStep = step1; + if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2; + if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; + + // for safety + if (prettyStep <= 0) { + prettyStep = 1; + } + + return prettyStep; +}; + +/** + * returns the current value of the step + * @return {Number} current value + */ +StepNumber.prototype.getCurrent = function () { + return parseFloat(this._current.toPrecision(this.precision)); +}; + +/** + * returns the current step size + * @return {Number} current step size + */ +StepNumber.prototype.getStep = function () { + return this._step; +}; + +/** + * Set the current value to the largest value smaller than start, which + * is a multiple of the step size + */ +StepNumber.prototype.start = function() { + this._current = this._start - this._start % this._step; +}; + +/** + * Do a step, add the step size to the current value + */ +StepNumber.prototype.next = function () { + this._current += this._step; +}; + +/** + * Returns true whether the end is reached + * @return {boolean} True if the current value has passed the end value. + */ +StepNumber.prototype.end = function () { + return (this._current > this._end); +}; + +module.exports = StepNumber; diff --git a/lib/hammerUtil.js b/lib/hammerUtil.js new file mode 100644 index 00000000..bf195c0f --- /dev/null +++ b/lib/hammerUtil.js @@ -0,0 +1,28 @@ +var Hammer = require('./module/hammer'); + +/** + * Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent + * @param {Element} element + * @param {Event} event + */ +exports.fakeGesture = function(element, event) { + var eventType = null; + + // for hammer.js 1.0.5 + // var gesture = Hammer.event.collectEventData(this, eventType, event); + + // for hammer.js 1.0.6+ + var touches = Hammer.event.getTouchList(event, eventType); + var gesture = Hammer.event.collectEventData(this, eventType, touches, event); + + // on IE in standards mode, no touches are recognized by hammer.js, + // resulting in NaN values for center.pageX and center.pageY + if (isNaN(gesture.center.pageX)) { + gesture.center.pageX = event.pageX; + } + if (isNaN(gesture.center.pageY)) { + gesture.center.pageY = event.pageY; + } + + return gesture; +}; diff --git a/src/module/header.js b/lib/header.js similarity index 100% rename from src/module/header.js rename to lib/header.js diff --git a/lib/module/hammer.js b/lib/module/hammer.js new file mode 100644 index 00000000..f76b3e39 --- /dev/null +++ b/lib/module/hammer.js @@ -0,0 +1,10 @@ +// Only load hammer.js when in a browser environment +// (loading hammer.js in a node.js environment gives errors) +if (typeof window !== 'undefined') { + module.exports = window['Hammer'] || require('hammerjs'); +} +else { + module.exports = function () { + throw Error('hammer.js is only available in a browser, not in node.js.'); + } +} diff --git a/lib/module/moment.js b/lib/module/moment.js new file mode 100644 index 00000000..7a65f58c --- /dev/null +++ b/lib/module/moment.js @@ -0,0 +1,3 @@ +// first check if moment.js is already loaded in the browser window, if so, +// use this instance. Else, load via commonjs. +module.exports = (typeof window !== 'undefined') && window['moment'] || require('moment'); diff --git a/src/network/Edge.js b/lib/network/Edge.js similarity index 71% rename from src/network/Edge.js rename to lib/network/Edge.js index 305a7fe8..73e2e3a3 100644 --- a/src/network/Edge.js +++ b/lib/network/Edge.js @@ -1,3 +1,6 @@ +var util = require('../util'); +var Node = require('./Node'); + /** * @class Edge * @@ -38,8 +41,10 @@ function Edge (properties, network, constants) { this.customLength = false; this.selected = false; this.hover = false; - this.smooth = constants.smoothCurves; + this.smoothCurves = constants.smoothCurves; + this.dynamicSmoothCurves = constants.dynamicSmoothCurves; this.arrowScaleFactor = constants.edges.arrowScaleFactor; + this.inheritColor = constants.edges.inheritColor; this.from = null; // a node this.to = null; // a node @@ -111,6 +116,8 @@ Edge.prototype.setProperties = function(properties, constants) { // scale the arrow if (properties.arrowScaleFactor !== undefined) {this.arrowScaleFactor = properties.arrowScaleFactor;} + if (properties.inheritColor !== undefined) {this.inheritColor = properties.inheritColor;} + // Added to support dashed lines // David Jordan // 2012-08-08 @@ -218,6 +225,7 @@ Edge.prototype.setValueRange = function(min, max) { if (!this.widthFixed && this.value !== undefined) { var scale = (this.widthMax - this.widthMin) / (max - min); this.width = (this.value - min) * scale + this.widthMin; + this.widthSelected = this.width * this.widthSelectionMultiplier; } }; @@ -255,6 +263,28 @@ Edge.prototype.isOverlappingWith = function(obj) { } }; +Edge.prototype._getColor = function() { + var colorObj = this.color; + if (this.inheritColor == "to") { + colorObj = { + highlight: this.to.color.highlight.border, + hover: this.to.color.hover.border, + color: this.to.color.border + }; + } + else if (this.inheritColor == "from" || this.inheritColor == true) { + colorObj = { + highlight: this.from.color.highlight.border, + hover: this.from.color.hover.border, + color: this.from.color.border + }; + } + + if (this.selected == true) {return colorObj.highlight;} + else if (this.hover == true) {return colorObj.hover;} + else {return colorObj.color;} +} + /** * Redraw a edge as a line @@ -265,21 +295,19 @@ Edge.prototype.isOverlappingWith = function(obj) { */ Edge.prototype._drawLine = function(ctx) { // set style - if (this.selected == true) {ctx.strokeStyle = this.color.highlight;} - else if (this.hover == true) {ctx.strokeStyle = this.color.hover;} - else {ctx.strokeStyle = this.color.color;} - ctx.lineWidth = this._getLineWidth(); + ctx.strokeStyle = this._getColor(); + ctx.lineWidth = this._getLineWidth(); if (this.from != this.to) { // draw line - this._line(ctx); + var via = this._line(ctx); // draw label var point; if (this.label) { - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); point = {x:midpointX, y:midpointY}; } else { @@ -329,6 +357,171 @@ Edge.prototype._getLineWidth = function() { } }; +Edge.prototype._getViaCoordinates = function () { + var xVia = null; + var yVia = null; + var factor = this.smoothCurves.roundness; + var type = this.smoothCurves.type; + + var dx = Math.abs(this.from.x - this.to.x); + var dy = Math.abs(this.from.y - this.to.y); + if (type == 'discrete' || type == 'diagonalCross') { + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dy; + yVia = this.from.y - factor * dy; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dy; + yVia = this.from.y - factor * dy; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dy; + yVia = this.from.y + factor * dy; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dy; + yVia = this.from.y + factor * dy; + } + } + if (type == "discrete") { + xVia = dx < factor * dy ? this.from.x : xVia; + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dx; + yVia = this.from.y - factor * dx; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dx; + yVia = this.from.y - factor * dx; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { + xVia = this.from.x + factor * dx; + yVia = this.from.y + factor * dx; + } + else if (this.from.x > this.to.x) { + xVia = this.from.x - factor * dx; + yVia = this.from.y + factor * dx; + } + } + if (type == "discrete") { + yVia = dy < factor * dx ? this.from.y : yVia; + } + } + } + else if (type == "straightCross") { + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { // up - down + xVia = this.from.x; + if (this.from.y < this.to.y) { + yVia = this.to.y - (1-factor) * dy; + } + else { + yVia = this.to.y + (1-factor) * dy; + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { // left - right + if (this.from.x < this.to.x) { + xVia = this.to.x - (1-factor) * dx; + } + else { + xVia = this.to.x + (1-factor) * dx; + } + yVia = this.from.y; + } + } + else if (type == 'horizontal') { + if (this.from.x < this.to.x) { + xVia = this.to.x - (1-factor) * dx; + } + else { + xVia = this.to.x + (1-factor) * dx; + } + yVia = this.from.y; + } + else if (type == 'vertical') { + xVia = this.from.x; + if (this.from.y < this.to.y) { + yVia = this.to.y - (1-factor) * dy; + } + else { + yVia = this.to.y + (1-factor) * dy; + } + } + else { // continuous + if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { +// console.log(1) + xVia = this.from.x + factor * dy; + yVia = this.from.y - factor * dy; + xVia = this.to.x < xVia ? this.to.x : xVia; + } + else if (this.from.x > this.to.x) { +// console.log(2) + xVia = this.from.x - factor * dy; + yVia = this.from.y - factor * dy; + xVia = this.to.x > xVia ? this.to.x :xVia; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { +// console.log(3) + xVia = this.from.x + factor * dy; + yVia = this.from.y + factor * dy; + xVia = this.to.x < xVia ? this.to.x : xVia; + } + else if (this.from.x > this.to.x) { +// console.log(4, this.from.x, this.to.x) + xVia = this.from.x - factor * dy; + yVia = this.from.y + factor * dy; + xVia = this.to.x > xVia ? this.to.x : xVia; + } + } + } + else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { + if (this.from.y > this.to.y) { + if (this.from.x < this.to.x) { +// console.log(5) + xVia = this.from.x + factor * dx; + yVia = this.from.y - factor * dx; + yVia = this.to.y > yVia ? this.to.y : yVia; + } + else if (this.from.x > this.to.x) { +// console.log(6) + xVia = this.from.x - factor * dx; + yVia = this.from.y - factor * dx; + yVia = this.to.y > yVia ? this.to.y : yVia; + } + } + else if (this.from.y < this.to.y) { + if (this.from.x < this.to.x) { +// console.log(7) + xVia = this.from.x + factor * dx; + yVia = this.from.y + factor * dx; + yVia = this.to.y < yVia ? this.to.y : yVia; + } + else if (this.from.x > this.to.x) { +// console.log(8) + xVia = this.from.x - factor * dx; + yVia = this.from.y + factor * dx; + yVia = this.to.y < yVia ? this.to.y : yVia; + } + } + } + } + + + return {x:xVia, y:yVia}; +} + /** * Draw a line between two nodes * @param {CanvasRenderingContext2D} ctx @@ -338,13 +531,33 @@ Edge.prototype._line = function (ctx) { // draw a straight line ctx.beginPath(); ctx.moveTo(this.from.x, this.from.y); - if (this.smooth == true) { + if (this.smoothCurves.enabled == true) { + if (this.smoothCurves.dynamic == false) { + var via = this._getViaCoordinates(); + if (via.x == null) { + ctx.lineTo(this.to.x, this.to.y); + ctx.stroke(); + return null; + } + else { +// this.via.x = via.x; +// this.via.y = via.y; + ctx.quadraticCurveTo(via.x,via.y,this.to.x, this.to.y); + ctx.stroke(); + return via; + } + } + else { ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y); + ctx.stroke(); + return this.via; + } } else { ctx.lineTo(this.to.x, this.to.y); + ctx.stroke(); + return null; } - ctx.stroke(); }; /** @@ -408,11 +621,9 @@ Edge.prototype._drawDashLine = function(ctx) { ctx.lineWidth = this._getLineWidth(); + var via = null; // only firefox and chrome support this method, else we use the legacy one. if (ctx.mozDash !== undefined || ctx.setLineDash !== undefined) { - ctx.beginPath(); - ctx.moveTo(this.from.x, this.from.y); - // configure the dash pattern var pattern = [0]; if (this.dash.length !== undefined && this.dash.gap !== undefined) { @@ -433,13 +644,7 @@ Edge.prototype._drawDashLine = function(ctx) { } // draw the line - if (this.smooth == true) { - ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y); - } - else { - ctx.lineTo(this.to.x, this.to.y); - } - ctx.stroke(); + via = this._line(ctx); // restore the dash settings. if (typeof ctx.setLineDash !== 'undefined') { //Chrome @@ -476,9 +681,9 @@ Edge.prototype._drawDashLine = function(ctx) { // draw label if (this.label) { var point; - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); point = {x:midpointX, y:midpointY}; } else { @@ -535,14 +740,14 @@ Edge.prototype._drawArrowCenter = function(ctx) { if (this.from != this.to) { // draw line - this._line(ctx); + var via = this._line(ctx); var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x)); var length = (10 + 5 * this.width) * this.arrowScaleFactor; // draw an arrow halfway the line - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); point = {x:midpointX, y:midpointY}; } else { @@ -622,20 +827,27 @@ Edge.prototype._drawArrow = function(ctx) { var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; + var via; + if (this.smoothCurves.dynamic == true && this.smoothCurves.enabled == true ) { + via = this.via; + } + else if (this.smoothCurves.enabled == true) { + via = this._getViaCoordinates(); + } - if (this.smooth == true) { - angle = Math.atan2((this.to.y - this.via.y), (this.to.x - this.via.x)); - dx = (this.to.x - this.via.x); - dy = (this.to.y - this.via.y); + if (this.smoothCurves.enabled == true && via.x != null) { + angle = Math.atan2((this.to.y - via.y), (this.to.x - via.x)); + dx = (this.to.x - via.x); + dy = (this.to.y - via.y); edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); } var toBorderDist = this.to.distanceToBorder(ctx, angle); var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; var xTo,yTo; - if (this.smooth == true) { - xTo = (1 - toBorderPoint) * this.via.x + toBorderPoint * this.to.x; - yTo = (1 - toBorderPoint) * this.via.y + toBorderPoint * this.to.y; + if (this.smoothCurves.enabled == true && via.x != null) { + xTo = (1 - toBorderPoint) * via.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * via.y + toBorderPoint * this.to.y; } else { xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; @@ -644,8 +856,8 @@ Edge.prototype._drawArrow = function(ctx) { ctx.beginPath(); ctx.moveTo(xFrom,yFrom); - if (this.smooth == true) { - ctx.quadraticCurveTo(this.via.x,this.via.y,xTo, yTo); + if (this.smoothCurves.enabled == true && via.x != null) { + ctx.quadraticCurveTo(via.x,via.y,xTo, yTo); } else { ctx.lineTo(xTo, yTo); @@ -661,9 +873,9 @@ Edge.prototype._drawArrow = function(ctx) { // draw label if (this.label) { var point; - if (this.smooth == true) { - var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x)); - var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y)); + if (this.smoothCurves.enabled == true && via != null) { + var midpointX = 0.5*(0.5*(this.from.x + via.x) + 0.5*(this.to.x + via.x)); + var midpointY = 0.5*(0.5*(this.from.y + via.y) + 0.5*(this.to.y + via.y)); point = {x:midpointX, y:midpointY}; } else { @@ -733,44 +945,34 @@ Edge.prototype._drawArrow = function(ctx) { */ Edge.prototype._getDistanceToEdge = function (x1,y1, x2,y2, x3,y3) { // x3,y3 is the point if (this.from != this.to) { - if (this.smooth == true) { + if (this.smoothCurves.enabled == true) { + var xVia, yVia; + if (this.smoothCurves.enabled == true && this.smoothCurves.dynamic == true) { + xVia = this.via.x; + yVia = this.via.y; + } + else { + var via = this._getViaCoordinates(); + xVia = via.x; + yVia = via.y; + } var minDistance = 1e9; - var i,t,x,y,dx,dy; + var distance; + var i,t,x,y, lastX, lastY; for (i = 0; i < 10; i++) { t = 0.1*i; - x = Math.pow(1-t,2)*x1 + (2*t*(1 - t))*this.via.x + Math.pow(t,2)*x2; - y = Math.pow(1-t,2)*y1 + (2*t*(1 - t))*this.via.y + Math.pow(t,2)*y2; - dx = Math.abs(x3-x); - dy = Math.abs(y3-y); - minDistance = Math.min(minDistance,Math.sqrt(dx*dx + dy*dy)); + x = Math.pow(1-t,2)*x1 + (2*t*(1 - t))*xVia + Math.pow(t,2)*x2; + y = Math.pow(1-t,2)*y1 + (2*t*(1 - t))*yVia + Math.pow(t,2)*y2; + if (i > 0) { + distance = this._getDistanceToLine(lastX,lastY,x,y, x3,y3); + minDistance = distance < minDistance ? distance : minDistance; + } + lastX = x; lastY = y; } return minDistance } else { - var px = x2-x1, - py = y2-y1, - something = px*px + py*py, - u = ((x3 - x1) * px + (y3 - y1) * py) / something; - - if (u > 1) { - u = 1; - } - else if (u < 0) { - u = 0; - } - - var x = x1 + u * px, - y = y1 + u * py, - dx = x - x3, - dy = y - y3; - - //# Note: If the actual distance does not matter, - //# if you only want to compare what this function - //# returns to other results of this function, you - //# can just return the squared distance instead - //# (i.e. remove the sqrt) to gain a little performance - - return Math.sqrt(dx*dx + dy*dy); + return this._getDistanceToLine(x1,y1,x2,y2,x3,y3); } } else { @@ -794,7 +996,32 @@ Edge.prototype._getDistanceToEdge = function (x1,y1, x2,y2, x3,y3) { // x3,y3 is } }; +Edge.prototype._getDistanceToLine = function(x1,y1,x2,y2,x3,y3) { + var px = x2-x1, + py = y2-y1, + something = px*px + py*py, + u = ((x3 - x1) * px + (y3 - y1) * py) / something; + + if (u > 1) { + u = 1; + } + else if (u < 0) { + u = 0; + } + + var x = x1 + u * px, + y = y1 + u * py, + dx = x - x3, + dy = y - y3; + + //# Note: If the actual distance does not matter, + //# if you only want to compare what this function + //# returns to other results of this function, you + //# can just return the squared distance instead + //# (i.e. remove the sqrt) to gain a little performance + return Math.sqrt(dx*dx + dy*dy); +} /** * This allows the zoom level of the network to influence the rendering @@ -861,7 +1088,7 @@ Edge.prototype._drawControlNodes = function(ctx) { else { this.controlNodes = {from:null, to:null, positions:{}}; } -} +}; /** * Enable control nodes. @@ -869,7 +1096,7 @@ Edge.prototype._drawControlNodes = function(ctx) { */ Edge.prototype._enableControlNodes = function() { this.controlNodesEnabled = true; -} +}; /** * disable control nodes @@ -877,7 +1104,7 @@ Edge.prototype._enableControlNodes = function() { */ Edge.prototype._disableControlNodes = function() { this.controlNodesEnabled = false; -} +}; /** * This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null. @@ -904,7 +1131,7 @@ Edge.prototype._getSelectedControlNode = function(x,y) { else { return null; } -} +}; /** @@ -922,7 +1149,7 @@ Edge.prototype._restoreControlNodes = function() { this.connectedNode = null; this.controlNodes.to.unselect(); } -} +}; /** * this calculates the position of the control nodes on the edges of the parent nodes. @@ -940,20 +1167,27 @@ Edge.prototype.getControlNodePositions = function(ctx) { var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x; var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y; + var via; + if (this.smoothCurves.dynamic == true && this.smoothCurves.enabled == true) { + via = this.via; + } + else if (this.smoothCurves.enabled == true) { + via = this._getViaCoordinates(); + } - if (this.smooth == true) { - angle = Math.atan2((this.to.y - this.via.y), (this.to.x - this.via.x)); - dx = (this.to.x - this.via.x); - dy = (this.to.y - this.via.y); + if (this.smoothCurves.enabled == true && via.x != null) { + angle = Math.atan2((this.to.y - via.y), (this.to.x - via.x)); + dx = (this.to.x - via.x); + dy = (this.to.y - via.y); edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); } var toBorderDist = this.to.distanceToBorder(ctx, angle); var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; var xTo,yTo; - if (this.smooth == true) { - xTo = (1 - toBorderPoint) * this.via.x + toBorderPoint * this.to.x; - yTo = (1 - toBorderPoint) * this.via.y + toBorderPoint * this.to.y; + if (this.smoothCurves.enabled == true && via.x != null) { + xTo = (1 - toBorderPoint) * via.x + toBorderPoint * this.to.x; + yTo = (1 - toBorderPoint) * via.y + toBorderPoint * this.to.y; } else { xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x; @@ -961,4 +1195,6 @@ Edge.prototype.getControlNodePositions = function(ctx) { } return {from:{x:xFrom,y:yFrom},to:{x:xTo,y:yTo}}; -} +}; + +module.exports = Edge; \ No newline at end of file diff --git a/src/network/Groups.js b/lib/network/Groups.js similarity index 67% rename from src/network/Groups.js rename to lib/network/Groups.js index ee8fc3ae..7eb6c957 100644 --- a/src/network/Groups.js +++ b/lib/network/Groups.js @@ -1,3 +1,5 @@ +var util = require('../util'); + /** * @class Groups * This class can store groups and properties specific for groups. @@ -12,16 +14,16 @@ function Groups() { * default constants for group colors */ Groups.DEFAULT = [ - {border: "#2B7CE9", background: "#97C2FC", highlight: {border: "#2B7CE9", background: "#D2E5FF"}}, // blue - {border: "#FFA500", background: "#FFFF00", highlight: {border: "#FFA500", background: "#FFFFA3"}}, // yellow - {border: "#FA0A10", background: "#FB7E81", highlight: {border: "#FA0A10", background: "#FFAFB1"}}, // red - {border: "#41A906", background: "#7BE141", highlight: {border: "#41A906", background: "#A1EC76"}}, // green - {border: "#E129F0", background: "#EB7DF4", highlight: {border: "#E129F0", background: "#F0B3F5"}}, // magenta - {border: "#7C29F0", background: "#AD85E4", highlight: {border: "#7C29F0", background: "#D3BDF0"}}, // purple - {border: "#C37F00", background: "#FFA807", highlight: {border: "#C37F00", background: "#FFCA66"}}, // orange - {border: "#4220FB", background: "#6E6EFD", highlight: {border: "#4220FB", background: "#9B9BFD"}}, // darkblue - {border: "#FD5A77", background: "#FFC0CB", highlight: {border: "#FD5A77", background: "#FFD1D9"}}, // pink - {border: "#4AD63A", background: "#C2FABC", highlight: {border: "#4AD63A", background: "#E6FFE3"}} // mint + {border: "#2B7CE9", background: "#97C2FC", highlight: {border: "#2B7CE9", background: "#D2E5FF"}, hover: {border: "#2B7CE9", background: "#D2E5FF"}}, // blue + {border: "#FFA500", background: "#FFFF00", highlight: {border: "#FFA500", background: "#FFFFA3"}, hover: {border: "#FFA500", background: "#FFFFA3"}}, // yellow + {border: "#FA0A10", background: "#FB7E81", highlight: {border: "#FA0A10", background: "#FFAFB1"}, hover: {border: "#FA0A10", background: "#FFAFB1"}}, // red + {border: "#41A906", background: "#7BE141", highlight: {border: "#41A906", background: "#A1EC76"}, hover: {border: "#41A906", background: "#A1EC76"}}, // green + {border: "#E129F0", background: "#EB7DF4", highlight: {border: "#E129F0", background: "#F0B3F5"}, hover: {border: "#E129F0", background: "#F0B3F5"}}, // magenta + {border: "#7C29F0", background: "#AD85E4", highlight: {border: "#7C29F0", background: "#D3BDF0"}, hover: {border: "#7C29F0", background: "#D3BDF0"}}, // purple + {border: "#C37F00", background: "#FFA807", highlight: {border: "#C37F00", background: "#FFCA66"}, hover: {border: "#C37F00", background: "#FFCA66"}}, // orange + {border: "#4220FB", background: "#6E6EFD", highlight: {border: "#4220FB", background: "#9B9BFD"}, hover: {border: "#4220FB", background: "#9B9BFD"}}, // darkblue + {border: "#FD5A77", background: "#FFC0CB", highlight: {border: "#FD5A77", background: "#FFD1D9"}, hover: {border: "#FD5A77", background: "#FFD1D9"}}, // pink + {border: "#4AD63A", background: "#C2FABC", highlight: {border: "#4AD63A", background: "#E6FFE3"}, hover: {border: "#4AD63A", background: "#E6FFE3"}} // mint ]; @@ -51,7 +53,6 @@ Groups.prototype.clear = function () { */ Groups.prototype.get = function (groupname) { var group = this.groups[groupname]; - if (group == undefined) { // create new group var index = this.defaultIndex % Groups.DEFAULT.length; @@ -78,3 +79,5 @@ Groups.prototype.add = function (groupname, style) { } return style; }; + +module.exports = Groups; diff --git a/src/network/Images.js b/lib/network/Images.js similarity index 96% rename from src/network/Images.js rename to lib/network/Images.js index 0c661b65..266eb491 100644 --- a/src/network/Images.js +++ b/lib/network/Images.js @@ -39,3 +39,5 @@ Images.prototype.load = function(url) { return img; }; + +module.exports = Images; diff --git a/src/network/Network.js b/lib/network/Network.js similarity index 93% rename from src/network/Network.js rename to lib/network/Network.js index 462ee806..4fe22eeb 100644 --- a/src/network/Network.js +++ b/lib/network/Network.js @@ -1,3 +1,22 @@ +var Emitter = require('emitter-component'); +var Hammer = require('../module/hammer'); +var mousetrap = require('mousetrap'); +var util = require('../util'); +var hammerUtil = require('../hammerUtil'); +var DataSet = require('../DataSet'); +var DataView = require('../DataView'); +var dotparser = require('./dotparser'); +var gephiParser = require('./gephiParser'); +var Groups = require('./Groups'); +var Images = require('./Images'); +var Node = require('./Node'); +var Edge = require('./Edge'); +var Popup = require('./Popup'); +var MixinLoader = require('./mixins/MixinLoader'); + +// Load custom shapes into CanvasRenderingContext2D +require('./shapes'); + /** * @constructor Network * Create a network visualization, displaying nodes and edges. @@ -39,9 +58,9 @@ function Network (container, data, options) { // set constant values this.constants = { nodes: { - radiusMin: 5, - radiusMax: 20, - radius: 5, + radiusMin: 10, + radiusMax: 30, + radius: 10, shape: 'ellipse', image: undefined, widthMin: 16, // px @@ -66,7 +85,8 @@ function Network (container, data, options) { borderColor: '#2B7CE9', backgroundColor: '#97C2FC', highlightColor: '#D2E5FF', - group: undefined + group: undefined, + borderWidth: 1 }, edges: { widthMin: 1, @@ -89,7 +109,8 @@ function Network (container, data, options) { length: 10, gap: 5, altLength: undefined - } + }, + inheritColor: "from" // to, from, false, true (== from) }, configurePhysics:false, physics: { @@ -103,7 +124,7 @@ function Network (container, data, options) { damping: 0.09 }, repulsion: { - centralGravity: 0.1, + centralGravity: 0.0, springLength: 200, springConstant: 0.05, nodeDistance: 100, @@ -111,10 +132,10 @@ function Network (container, data, options) { }, hierarchicalRepulsion: { enabled: false, - centralGravity: 0.5, - springLength: 150, + centralGravity: 0.0, + springLength: 100, springConstant: 0.01, - nodeDistance: 60, + nodeDistance: 150, damping: 0.09 }, damping: null, @@ -161,8 +182,14 @@ function Network (container, data, options) { direction: "UD" // UD, DU, LR, RL }, freezeForStabilization: false, - smoothCurves: true, - maxVelocity: 10, + smoothCurves: { + enabled: true, + dynamic: true, + type: "continuous", + roundness: 0.5 + }, + dynamicSmoothCurves: true, + maxVelocity: 30, minVelocity: 0.1, // px/s stabilizationIterations: 1000, // maximum number of iteration to stabilize labels:{ @@ -196,10 +223,12 @@ function Network (container, data, options) { dragNetwork: true, dragNodes: true, zoomable: true, - hover: false + hover: false, + hideEdgesOnDrag: false, + hideNodesOnDrag: false }; this.hoverObj = {nodes:{},edges:{}}; - + this.controlNodesActive = false; // Node variables var network = this; @@ -475,6 +504,7 @@ Network.prototype._updateNodeIndexList = function() { * {Array | DataSet | DataView} [nodes] Array with nodes * {Array | DataSet | DataView} [edges] Array with edges * {String} [dot] String containing data in DOT format + * {String} [gephi] String containing data in gephi JSON format * {Options} [options] Object with options * @param {Boolean} [disableStart] | optional: disable the calling of the start function. */ @@ -495,18 +525,25 @@ Network.prototype.setData = function(data, disableStart) { if (data && data.dot) { // parse DOT file if(data && data.dot) { - var dotData = vis.util.DOTToGraph(data.dot); + var dotData = dotparser.DOTToGraph(data.dot); this.setData(dotData); return; } } + else if (data && data.gephi) { + // parse DOT file + if(data && data.gephi) { + var gephiData = gephiParser.parseGephi(data.gephi); + this.setData(gephiData); + return; + } + } else { this._setNodes(data && data.nodes); this._setEdges(data && data.edges); } this._putDataInSector(); - if (!disableStart) { // find a stable position or start animating to a stable position if (this.stabilize) { @@ -532,7 +569,6 @@ Network.prototype.setOptions = function (options) { if (options.height !== undefined) {this.height = options.height;} if (options.stabilize !== undefined) {this.stabilize = options.stabilize;} if (options.selectable !== undefined) {this.selectable = options.selectable;} - if (options.smoothCurves !== undefined) {this.constants.smoothCurves = options.smoothCurves;} if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;} if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;} if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;} @@ -540,6 +576,8 @@ Network.prototype.setOptions = function (options) { if (options.dragNodes !== undefined) {this.constants.dragNodes = options.dragNodes;} if (options.zoomable !== undefined) {this.constants.zoomable = options.zoomable;} if (options.hover !== undefined) {this.constants.hover = options.hover;} + if (options.hideEdgesOnDrag !== undefined) {this.constants.hideEdgesOnDrag = options.hideEdgesOnDrag;} + if (options.hideNodesOnDrag !== undefined) {this.constants.hideNodesOnDrag = options.hideNodesOnDrag;} // TODO: deprecated since version 3.0.0. Cleanup some day if (options.dragGraph !== undefined) { @@ -605,6 +643,20 @@ Network.prototype.setOptions = function (options) { } } + if (options.smoothCurves !== undefined) { + if (typeof options.smoothCurves == 'boolean') { + this.constants.smoothCurves.enabled = options.smoothCurves; + } + else { + this.constants.smoothCurves.enabled = true; + for (prop in options.smoothCurves) { + if (options.smoothCurves.hasOwnProperty(prop)) { + this.constants.smoothCurves[prop] = options.smoothCurves[prop]; + } + } + } + } + if (options.hierarchicalLayout) { this.constants.hierarchicalLayout.enabled = true; for (prop in options.hierarchicalLayout) { @@ -676,7 +728,6 @@ Network.prototype.setOptions = function (options) { } } - if (options.edges.color !== undefined) { if (util.isString(options.edges.color)) { this.constants.edges.color = {}; @@ -874,8 +925,8 @@ Network.prototype._createKeyBinds = function() { */ Network.prototype._getPointer = function (touch) { return { - x: touch.pageX - vis.util.getAbsoluteLeft(this.frame.canvas), - y: touch.pageY - vis.util.getAbsoluteTop(this.frame.canvas) + x: touch.pageX - util.getAbsoluteLeft(this.frame.canvas), + y: touch.pageY - util.getAbsoluteTop(this.frame.canvas) }; }; @@ -971,13 +1022,13 @@ Network.prototype._handleOnDrag = function(event) { var pointer = this._getPointer(event.gesture.center); - var me = this, - drag = this.drag, - selection = drag.selection; + var me = this; + var drag = this.drag; + var selection = drag.selection; if (selection && selection.length && this.constants.dragNodes == true) { // calculate delta's and new location - var deltaX = pointer.x - drag.pointer.x, - deltaY = pointer.y - drag.pointer.y; + var deltaX = pointer.x - drag.pointer.x; + var deltaY = pointer.y - drag.pointer.y; // update position of all selected nodes selection.forEach(function (s) { @@ -992,6 +1043,7 @@ Network.prototype._handleOnDrag = function(event) { } }); + // start _animationStep if not yet running if (!this.moving) { this.moving = true; @@ -1006,10 +1058,11 @@ Network.prototype._handleOnDrag = function(event) { this._setTranslation( this.drag.translation.x + diffX, - this.drag.translation.y + diffY); + this.drag.translation.y + diffY + ); this._redraw(); - this.moving = true; - this.start(); +// this.moving = true; +// this.start(); } } }; @@ -1021,13 +1074,19 @@ Network.prototype._handleOnDrag = function(event) { Network.prototype._onDragEnd = function () { this.drag.dragging = false; var selection = this.drag.selection; - if (selection) { + if (selection && selection.length) { selection.forEach(function (s) { // restore original xFixed and yFixed s.node.xFixed = s.xFixed; s.node.yFixed = s.yFixed; }); + this.moving = true; + this.start(); } + else { + this._redraw(); + } + }; /** @@ -1106,6 +1165,13 @@ Network.prototype._zoom = function(scale, pointer) { if (scale > 10) { scale = 10; } + + var preScaleDragPointer = null; + if (this.drag !== undefined) { + if (this.drag.dragging == true) { + preScaleDragPointer = this.DOMtoCanvas(this.drag.pointer); + } + } // + this.frame.canvas.clientHeight / 2 var translation = this._getTranslation(); @@ -1119,6 +1185,13 @@ Network.prototype._zoom = function(scale, pointer) { this._setScale(scale); this._setTranslation(tx, ty); this.updateClustersDefault(); + + if (preScaleDragPointer != null) { + var postScaleDragPointer = this.canvasToDOM(preScaleDragPointer); + this.drag.pointer.x = postScaleDragPointer.x; + this.drag.pointer.y = postScaleDragPointer.y; + } + this._redraw(); if (scaleOld < scale) { @@ -1165,7 +1238,7 @@ Network.prototype._onMouseWheel = function(event) { scale *= (1 + zoom); // calculate the pointer location - var gesture = util.fakeGesture(this, event); + var gesture = hammerUtil.fakeGesture(this, event); var pointer = this._getPointer(gesture.center); // apply the new scale @@ -1183,7 +1256,7 @@ Network.prototype._onMouseWheel = function(event) { * @private */ Network.prototype._onMouseMoveTitle = function (event) { - var gesture = util.fakeGesture(this, event); + var gesture = hammerUtil.fakeGesture(this, event); var pointer = this._getPointer(gesture.center); // check if the previously selected node is still selected @@ -1723,10 +1796,19 @@ Network.prototype._redraw = function() { "y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight) }; + this._doInAllSectors("_drawAllSectorNodes",ctx); - this._doInAllSectors("_drawEdges",ctx); - this._doInAllSectors("_drawNodes",ctx,false); - this._doInAllSectors("_drawControlNodes",ctx); + if (this.drag.dragging == false || this.drag.dragging === undefined || this.constants.hideEdgesOnDrag == false) { + this._doInAllSectors("_drawEdges",ctx); + } + + if (this.drag.dragging == false || this.drag.dragging === undefined || this.constants.hideNodesOnDrag == false) { + this._doInAllSectors("_drawNodes",ctx,false); + } + + if (this.controlNodesActive == true) { + this._doInAllSectors("_drawControlNodes",ctx); + } // this._doInSupportSector("_drawNodes",ctx,true); // this._drawTree(ctx,"#F00F0F"); @@ -2039,6 +2121,11 @@ Network.prototype._discreteStepNodes = function() { } else { this.moving = this._isMoving(vminCorrected); + if (this.moving == false) { + this.emit("stabilized",{iterations:null}); + } + this.moving = this.moving || this.configurePhysics; + } } }; @@ -2050,10 +2137,10 @@ Network.prototype._discreteStepNodes = function() { */ Network.prototype._physicsTick = function() { if (!this.freezeSimulation) { - if (this.moving) { + if (this.moving == true) { this._doInAllActiveSectors("_initializeForceCalculation"); this._doInAllActiveSectors("_discreteStepNodes"); - if (this.constants.smoothCurves) { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { this._doInSupportSector("_discreteStepNodes"); } this._findCenter(this._getRange()) @@ -2091,6 +2178,7 @@ Network.prototype._animationStep = function() { var renderTime = Date.now(); this._redraw(); this.renderTime = Date.now() - renderTime; + }; if (typeof window !== 'undefined') { @@ -2102,7 +2190,7 @@ if (typeof window !== 'undefined') { * Schedule a animation step with the refreshrate interval. */ Network.prototype.start = function() { - if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { + if (this.moving == true || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { if (!this.timer) { var ua = navigator.userAgent.toLowerCase(); @@ -2174,9 +2262,16 @@ Network.prototype._configureSmoothCurves = function(disableStart) { if (disableStart === undefined) { disableStart = true; } - - if (this.constants.smoothCurves == true) { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { this._createBezierNodes(); + // cleanup unused support nodes + for (var nodeId in this.sectors['support']['nodes']) { + if (this.sectors['support']['nodes'].hasOwnProperty(nodeId)) { + if (this.edges[this.sectors['support']['nodes'][nodeId]] === undefined) { + delete this.sectors['support']['nodes'][nodeId]; + } + } + } } else { // delete the support nodes @@ -2188,6 +2283,8 @@ Network.prototype._configureSmoothCurves = function(disableStart) { } } } + + this._updateCalculationNodes(); if (!disableStart) { this.moving = true; @@ -2203,7 +2300,7 @@ Network.prototype._configureSmoothCurves = function(disableStart) { * @private */ Network.prototype._createBezierNodes = function() { - if (this.constants.smoothCurves == true) { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { for (var edgeId in this.edges) { if (this.edges.hasOwnProperty(edgeId)) { var edge = this.edges[edgeId]; @@ -2232,9 +2329,9 @@ Network.prototype._createBezierNodes = function() { * @private */ Network.prototype._initializeMixinLoaders = function () { - for (var mixinFunction in networkMixinLoaders) { - if (networkMixinLoaders.hasOwnProperty(mixinFunction)) { - Network.prototype[mixinFunction] = networkMixinLoaders[mixinFunction]; + for (var mixin in MixinLoader) { + if (MixinLoader.hasOwnProperty(mixin)) { + Network.prototype[mixin] = MixinLoader[mixin]; } } }; @@ -2289,11 +2386,4 @@ Network.prototype.focusOnNode = function (nodeId, zoomLevel) { } }; - - - - - - - - +module.exports = Network; diff --git a/src/network/Node.js b/lib/network/Node.js similarity index 91% rename from src/network/Node.js rename to lib/network/Node.js index 1de217d0..60b84e74 100644 --- a/src/network/Node.js +++ b/lib/network/Node.js @@ -1,3 +1,5 @@ +var util = require('../util'); + /** * @class Node * A node. A node can be connected to other nodes via one or multiple edges. @@ -56,6 +58,8 @@ function Node(properties, imagelist, grouplist, constants) { this.radiusMax = constants.nodes.radiusMax; this.level = -1; this.preassignedLevel = false; + this.borderWidth = constants.nodes.borderWidth; + this.borderWidthSelected = constants.nodes.borderWidthSelected; this.imagelist = imagelist; @@ -71,6 +75,7 @@ function Node(properties, imagelist, grouplist, constants) { this.mass = 1; // kg this.fixedData = {x:null,y:null}; + this.setProperties(properties, constants); // creating the variables for clustering @@ -150,7 +155,8 @@ Node.prototype.setProperties = function(properties, constants) { if (properties.y !== undefined) {this.y = properties.y;} if (properties.value !== undefined) {this.value = properties.value;} if (properties.level !== undefined) {this.level = properties.level; this.preassignedLevel = true;} - + if (properties.borderWidth !== undefined) {this.borderWidth = properties.borderWidth;} + if (properties.borderWidthSelected !== undefined) {this.borderWidthSelected = properties.borderWidthSelected;} // physics if (properties.mass !== undefined) {this.mass = properties.mass;} @@ -165,7 +171,7 @@ Node.prototype.setProperties = function(properties, constants) { } // copy group properties - if (this.group) { + if (this.group !== undefined && this.group != "") { var groupObj = this.grouplist.get(this.group); for (var prop in groupObj) { if (groupObj.hasOwnProperty(prop)) { @@ -177,7 +183,7 @@ Node.prototype.setProperties = function(properties, constants) { // individual shape properties if (properties.shape !== undefined) {this.shape = properties.shape;} if (properties.image !== undefined) {this.image = properties.image;} - if (properties.radius !== undefined) {this.radius = properties.radius;} + if (properties.radius !== undefined) {this.radius = properties.radius; this.baseRadiusValue = this.radius;} if (properties.color !== undefined) {this.color = util.parseColor(properties.color);} if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} @@ -568,22 +574,23 @@ Node.prototype._drawBox = function (ctx) { this.top = this.y - this.height / 2; var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; // draw the outer border if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.roundRect(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth, this.radius); ctx.stroke(); } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background; @@ -617,22 +624,23 @@ Node.prototype._drawDatabase = function (ctx) { this.top = this.y - this.height / 2; var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; // draw the outer border if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.database(this.x - this.width/2 - 2*ctx.lineWidth, this.y - this.height*0.5 - 2*ctx.lineWidth, this.width + 4*ctx.lineWidth, this.height + 4*ctx.lineWidth); ctx.stroke(); } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; ctx.database(this.x - this.width/2, this.y - this.height*0.5, this.width, this.height); @@ -667,22 +675,23 @@ Node.prototype._drawCircle = function (ctx) { this.top = this.y - this.height / 2; var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; // draw the outer border if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.circle(this.x, this.y, this.radius+2*ctx.lineWidth); ctx.stroke(); } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; ctx.circle(this.x, this.y, this.radius); @@ -717,22 +726,23 @@ Node.prototype._drawEllipse = function (ctx) { this.top = this.y - this.height / 2; var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; ctx.strokeStyle = this.selected ? this.color.highlight.border : this.hover ? this.color.hover.border : this.color.border; // draw the outer border if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.ellipse(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth); ctx.stroke(); } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; @@ -784,7 +794,8 @@ Node.prototype._drawShape = function (ctx, shape) { this.top = this.y - this.height / 2; var clusterLineWidth = 2.5; - var selectionLineWidth = 2; + var borderWidth = this.borderWidth; + var selectionLineWidth = this.borderWidthSelected || 2 * this.borderWidth; var radiusMultiplier = 2; // choose draw method depending on the shape @@ -800,16 +811,16 @@ Node.prototype._drawShape = function (ctx, shape) { // draw the outer border if (this.clusterSize > 1) { - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx[shape](this.x, this.y, this.radius + radiusMultiplier * ctx.lineWidth); ctx.stroke(); } - ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); + ctx.lineWidth = (this.selected ? selectionLineWidth : borderWidth) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0); ctx.lineWidth *= this.networkScaleInv; - ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth); + ctx.lineWidth = Math.min(this.width,ctx.lineWidth); ctx.fillStyle = this.selected ? this.color.highlight.background : this.hover ? this.color.hover.background : this.color.background; ctx[shape](this.x, this.y, this.radius); @@ -967,3 +978,4 @@ Node.prototype.updateVelocity = function(massBeforeClustering) { this.vy = Math.sqrt(energyBefore/this.mass); }; +module.exports = Node; diff --git a/src/network/Popup.js b/lib/network/Popup.js similarity index 99% rename from src/network/Popup.js rename to lib/network/Popup.js index 2dd20404..072d90d8 100644 --- a/src/network/Popup.js +++ b/lib/network/Popup.js @@ -130,3 +130,5 @@ Popup.prototype.show = function (show) { Popup.prototype.hide = function () { this.frame.style.visibility = "hidden"; }; + +module.exports = Popup; diff --git a/src/network/css/network-manipulation.css b/lib/network/css/network-manipulation.css similarity index 100% rename from src/network/css/network-manipulation.css rename to lib/network/css/network-manipulation.css diff --git a/src/network/css/network-navigation.css b/lib/network/css/network-navigation.css similarity index 100% rename from src/network/css/network-navigation.css rename to lib/network/css/network-navigation.css diff --git a/lib/network/dotparser.js b/lib/network/dotparser.js new file mode 100644 index 00000000..d395a36c --- /dev/null +++ b/lib/network/dotparser.js @@ -0,0 +1,826 @@ +/** + * Parse a text source containing data in DOT language into a JSON object. + * The object contains two lists: one with nodes and one with edges. + * + * DOT language reference: http://www.graphviz.org/doc/info/lang.html + * + * @param {String} data Text containing a graph in DOT-notation + * @return {Object} graph An object containing two parameters: + * {Object[]} nodes + * {Object[]} edges + */ +function parseDOT (data) { + dot = data; + return parseGraph(); +} + +// token types enumeration +var TOKENTYPE = { + NULL : 0, + DELIMITER : 1, + IDENTIFIER: 2, + UNKNOWN : 3 +}; + +// map with all delimiters +var DELIMITERS = { + '{': true, + '}': true, + '[': true, + ']': true, + ';': true, + '=': true, + ',': true, + + '->': true, + '--': true +}; + +var dot = ''; // current dot file +var index = 0; // current index in dot file +var c = ''; // current token character in expr +var token = ''; // current token +var tokenType = TOKENTYPE.NULL; // type of the token + +/** + * Get the first character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. + */ +function first() { + index = 0; + c = dot.charAt(0); +} + +/** + * Get the next character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. + */ +function next() { + index++; + c = dot.charAt(index); +} + +/** + * Preview the next character from the dot file. + * @return {String} cNext + */ +function nextPreview() { + return dot.charAt(index + 1); +} + +/** + * Test whether given character is alphabetic or numeric + * @param {String} c + * @return {Boolean} isAlphaNumeric + */ +var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; +function isAlphaNumeric(c) { + return regexAlphaNumeric.test(c); +} + +/** + * Merge all properties of object b into object b + * @param {Object} a + * @param {Object} b + * @return {Object} a + */ +function merge (a, b) { + if (!a) { + a = {}; + } + + if (b) { + for (var name in b) { + if (b.hasOwnProperty(name)) { + a[name] = b[name]; + } + } + } + return a; +} + +/** + * Set a value in an object, where the provided parameter name can be a + * path with nested parameters. For example: + * + * var obj = {a: 2}; + * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} + * + * @param {Object} obj + * @param {String} path A parameter name or dot-separated parameter path, + * like "color.highlight.border". + * @param {*} value + */ +function setValue(obj, path, value) { + var keys = path.split('.'); + var o = obj; + while (keys.length) { + var key = keys.shift(); + if (keys.length) { + // this isn't the end point + if (!o[key]) { + o[key] = {}; + } + o = o[key]; + } + else { + // this is the end point + o[key] = value; + } + } +} + +/** + * Add a node to a graph object. If there is already a node with + * the same id, their attributes will be merged. + * @param {Object} graph + * @param {Object} node + */ +function addNode(graph, node) { + var i, len; + var current = null; + + // find root graph (in case of subgraph) + var graphs = [graph]; // list with all graphs from current graph to root graph + var root = graph; + while (root.parent) { + graphs.push(root.parent); + root = root.parent; + } + + // find existing node (at root level) by its id + if (root.nodes) { + for (i = 0, len = root.nodes.length; i < len; i++) { + if (node.id === root.nodes[i].id) { + current = root.nodes[i]; + break; + } + } + } + + if (!current) { + // this is a new node + current = { + id: node.id + }; + if (graph.node) { + // clone default attributes + current.attr = merge(current.attr, graph.node); + } + } + + // add node to this (sub)graph and all its parent graphs + for (i = graphs.length - 1; i >= 0; i--) { + var g = graphs[i]; + + if (!g.nodes) { + g.nodes = []; + } + if (g.nodes.indexOf(current) == -1) { + g.nodes.push(current); + } + } + + // merge attributes + if (node.attr) { + current.attr = merge(current.attr, node.attr); + } +} + +/** + * Add an edge to a graph object + * @param {Object} graph + * @param {Object} edge + */ +function addEdge(graph, edge) { + if (!graph.edges) { + graph.edges = []; + } + graph.edges.push(edge); + if (graph.edge) { + var attr = merge({}, graph.edge); // clone default attributes + edge.attr = merge(attr, edge.attr); // merge attributes + } +} + +/** + * Create an edge to a graph object + * @param {Object} graph + * @param {String | Number | Object} from + * @param {String | Number | Object} to + * @param {String} type + * @param {Object | null} attr + * @return {Object} edge + */ +function createEdge(graph, from, to, type, attr) { + var edge = { + from: from, + to: to, + type: type + }; + + if (graph.edge) { + edge.attr = merge({}, graph.edge); // clone default attributes + } + edge.attr = merge(edge.attr || {}, attr); // merge attributes + + return edge; +} + +/** + * Get next token in the current dot file. + * The token and token type are available as token and tokenType + */ +function getToken() { + tokenType = TOKENTYPE.NULL; + token = ''; + + // skip over whitespaces + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter + next(); + } + + do { + var isComment = false; + + // skip comment + if (c == '#') { + // find the previous non-space character + var i = index - 1; + while (dot.charAt(i) == ' ' || dot.charAt(i) == '\t') { + i--; + } + if (dot.charAt(i) == '\n' || dot.charAt(i) == '') { + // the # is at the start of a line, this is indeed a line comment + while (c != '' && c != '\n') { + next(); + } + isComment = true; + } + } + if (c == '/' && nextPreview() == '/') { + // skip line comment + while (c != '' && c != '\n') { + next(); + } + isComment = true; + } + if (c == '/' && nextPreview() == '*') { + // skip block comment + while (c != '') { + if (c == '*' && nextPreview() == '/') { + // end of block comment found. skip these last two characters + next(); + next(); + break; + } + else { + next(); + } + } + isComment = true; + } + + // skip over whitespaces + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter + next(); + } + } + while (isComment); + + // check for end of dot file + if (c == '') { + // token is still empty + tokenType = TOKENTYPE.DELIMITER; + return; + } + + // check for delimiters consisting of 2 characters + var c2 = c + nextPreview(); + if (DELIMITERS[c2]) { + tokenType = TOKENTYPE.DELIMITER; + token = c2; + next(); + next(); + return; + } + + // check for delimiters consisting of 1 character + if (DELIMITERS[c]) { + tokenType = TOKENTYPE.DELIMITER; + token = c; + next(); + return; + } + + // check for an identifier (number or string) + // TODO: more precise parsing of numbers/strings (and the port separator ':') + if (isAlphaNumeric(c) || c == '-') { + token += c; + next(); + + while (isAlphaNumeric(c)) { + token += c; + next(); + } + if (token == 'false') { + token = false; // convert to boolean + } + else if (token == 'true') { + token = true; // convert to boolean + } + else if (!isNaN(Number(token))) { + token = Number(token); // convert to number + } + tokenType = TOKENTYPE.IDENTIFIER; + return; + } + + // check for a string enclosed by double quotes + if (c == '"') { + next(); + while (c != '' && (c != '"' || (c == '"' && nextPreview() == '"'))) { + token += c; + if (c == '"') { // skip the escape character + next(); + } + next(); + } + if (c != '"') { + throw newSyntaxError('End of string " expected'); + } + next(); + tokenType = TOKENTYPE.IDENTIFIER; + return; + } + + // something unknown is found, wrong characters, a syntax error + tokenType = TOKENTYPE.UNKNOWN; + while (c != '') { + token += c; + next(); + } + throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"'); +} + +/** + * Parse a graph. + * @returns {Object} graph + */ +function parseGraph() { + var graph = {}; + + first(); + getToken(); + + // optional strict keyword + if (token == 'strict') { + graph.strict = true; + getToken(); + } + + // graph or digraph keyword + if (token == 'graph' || token == 'digraph') { + graph.type = token; + getToken(); + } + + // optional graph id + if (tokenType == TOKENTYPE.IDENTIFIER) { + graph.id = token; + getToken(); + } + + // open angle bracket + if (token != '{') { + throw newSyntaxError('Angle bracket { expected'); + } + getToken(); + + // statements + parseStatements(graph); + + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); + } + getToken(); + + // end of file + if (token !== '') { + throw newSyntaxError('End of file expected'); + } + getToken(); + + // remove temporary default properties + delete graph.node; + delete graph.edge; + delete graph.graph; + + return graph; +} + +/** + * Parse a list with statements. + * @param {Object} graph + */ +function parseStatements (graph) { + while (token !== '' && token != '}') { + parseStatement(graph); + if (token == ';') { + getToken(); + } + } +} + +/** + * Parse a single statement. Can be a an attribute statement, node + * statement, a series of node statements and edge statements, or a + * parameter. + * @param {Object} graph + */ +function parseStatement(graph) { + // parse subgraph + var subgraph = parseSubgraph(graph); + if (subgraph) { + // edge statements + parseEdge(graph, subgraph); + + return; + } + + // parse an attribute statement + var attr = parseAttributeStatement(graph); + if (attr) { + return; + } + + // parse node + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); + } + var id = token; // id can be a string or a number + getToken(); + + if (token == '=') { + // id statement + getToken(); + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); + } + graph[id] = token; + getToken(); + // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " + } + else { + parseNodeStatement(graph, id); + } +} + +/** + * Parse a subgraph + * @param {Object} graph parent graph object + * @return {Object | null} subgraph + */ +function parseSubgraph (graph) { + var subgraph = null; + + // optional subgraph keyword + if (token == 'subgraph') { + subgraph = {}; + subgraph.type = 'subgraph'; + getToken(); + + // optional graph id + if (tokenType == TOKENTYPE.IDENTIFIER) { + subgraph.id = token; + getToken(); + } + } + + // open angle bracket + if (token == '{') { + getToken(); + + if (!subgraph) { + subgraph = {}; + } + subgraph.parent = graph; + subgraph.node = graph.node; + subgraph.edge = graph.edge; + subgraph.graph = graph.graph; + + // statements + parseStatements(subgraph); + + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); + } + getToken(); + + // remove temporary default properties + delete subgraph.node; + delete subgraph.edge; + delete subgraph.graph; + delete subgraph.parent; + + // register at the parent graph + if (!graph.subgraphs) { + graph.subgraphs = []; + } + graph.subgraphs.push(subgraph); + } + + return subgraph; +} + +/** + * parse an attribute statement like "node [shape=circle fontSize=16]". + * Available keywords are 'node', 'edge', 'graph'. + * The previous list with default attributes will be replaced + * @param {Object} graph + * @returns {String | null} keyword Returns the name of the parsed attribute + * (node, edge, graph), or null if nothing + * is parsed. + */ +function parseAttributeStatement (graph) { + // attribute statements + if (token == 'node') { + getToken(); + + // node attributes + graph.node = parseAttributeList(); + return 'node'; + } + else if (token == 'edge') { + getToken(); + + // edge attributes + graph.edge = parseAttributeList(); + return 'edge'; + } + else if (token == 'graph') { + getToken(); + + // graph attributes + graph.graph = parseAttributeList(); + return 'graph'; + } + + return null; +} + +/** + * parse a node statement + * @param {Object} graph + * @param {String | Number} id + */ +function parseNodeStatement(graph, id) { + // node statement + var node = { + id: id + }; + var attr = parseAttributeList(); + if (attr) { + node.attr = attr; + } + addNode(graph, node); + + // edge statements + parseEdge(graph, id); +} + +/** + * Parse an edge or a series of edges + * @param {Object} graph + * @param {String | Number} from Id of the from node + */ +function parseEdge(graph, from) { + while (token == '->' || token == '--') { + var to; + var type = token; + getToken(); + + var subgraph = parseSubgraph(graph); + if (subgraph) { + to = subgraph; + } + else { + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier or subgraph expected'); + } + to = token; + addNode(graph, { + id: to + }); + getToken(); + } + + // parse edge attributes + var attr = parseAttributeList(); + + // create edge + var edge = createEdge(graph, from, to, type, attr); + addEdge(graph, edge); + + from = to; + } +} + +/** + * Parse a set with attributes, + * for example [label="1.000", shape=solid] + * @return {Object | null} attr + */ +function parseAttributeList() { + var attr = null; + + while (token == '[') { + getToken(); + attr = {}; + while (token !== '' && token != ']') { + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute name expected'); + } + var name = token; + + getToken(); + if (token != '=') { + throw newSyntaxError('Equal sign = expected'); + } + getToken(); + + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute value expected'); + } + var value = token; + setValue(attr, name, value); // name can be a path + + getToken(); + if (token ==',') { + getToken(); + } + } + + if (token != ']') { + throw newSyntaxError('Bracket ] expected'); + } + getToken(); + } + + return attr; +} + +/** + * Create a syntax error with extra information on current token and index. + * @param {String} message + * @returns {SyntaxError} err + */ +function newSyntaxError(message) { + return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')'); +} + +/** + * Chop off text after a maximum length + * @param {String} text + * @param {Number} maxLength + * @returns {String} + */ +function chop (text, maxLength) { + return (text.length <= maxLength) ? text : (text.substr(0, 27) + '...'); +} + +/** + * Execute a function fn for each pair of elements in two arrays + * @param {Array | *} array1 + * @param {Array | *} array2 + * @param {function} fn + */ +function forEach2(array1, array2, fn) { + if (array1 instanceof Array) { + array1.forEach(function (elem1) { + if (array2 instanceof Array) { + array2.forEach(function (elem2) { + fn(elem1, elem2); + }); + } + else { + fn(elem1, array2); + } + }); + } + else { + if (array2 instanceof Array) { + array2.forEach(function (elem2) { + fn(array1, elem2); + }); + } + else { + fn(array1, array2); + } + } +} + +/** + * Convert a string containing a graph in DOT language into a map containing + * with nodes and edges in the format of graph. + * @param {String} data Text containing a graph in DOT-notation + * @return {Object} graphData + */ +function DOTToGraph (data) { + // parse the DOT file + var dotData = parseDOT(data); + var graphData = { + nodes: [], + edges: [], + options: {} + }; + + // copy the nodes + if (dotData.nodes) { + dotData.nodes.forEach(function (dotNode) { + var graphNode = { + id: dotNode.id, + label: String(dotNode.label || dotNode.id) + }; + merge(graphNode, dotNode.attr); + if (graphNode.image) { + graphNode.shape = 'image'; + } + graphData.nodes.push(graphNode); + }); + } + + // copy the edges + if (dotData.edges) { + /** + * Convert an edge in DOT format to an edge with VisGraph format + * @param {Object} dotEdge + * @returns {Object} graphEdge + */ + function convertEdge(dotEdge) { + var graphEdge = { + from: dotEdge.from, + to: dotEdge.to + }; + merge(graphEdge, dotEdge.attr); + graphEdge.style = (dotEdge.type == '->') ? 'arrow' : 'line'; + return graphEdge; + } + + dotData.edges.forEach(function (dotEdge) { + var from, to; + if (dotEdge.from instanceof Object) { + from = dotEdge.from.nodes; + } + else { + from = { + id: dotEdge.from + } + } + + if (dotEdge.to instanceof Object) { + to = dotEdge.to.nodes; + } + else { + to = { + id: dotEdge.to + } + } + + if (dotEdge.from instanceof Object && dotEdge.from.edges) { + dotEdge.from.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + } + + forEach2(from, to, function (from, to) { + var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr); + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + + if (dotEdge.to instanceof Object && dotEdge.to.edges) { + dotEdge.to.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + } + }); + } + + // copy the options + if (dotData.attr) { + graphData.options = dotData.attr; + } + + return graphData; +} + +// exports +exports.parseDOT = parseDOT; +exports.DOTToGraph = DOTToGraph; diff --git a/lib/network/gephiParser.js b/lib/network/gephiParser.js new file mode 100644 index 00000000..ed44ea72 --- /dev/null +++ b/lib/network/gephiParser.js @@ -0,0 +1,60 @@ + +function parseGephi(gephiJSON, options) { + var edges = []; + var nodes = []; + this.options = { + edges: { + inheritColor: true + }, + nodes: { + allowedToMove: false, + parseColor: false + } + }; + + if (options !== undefined) { + this.options.nodes['allowedToMove'] = options.allowedToMove | false; + this.options.nodes['parseColor'] = options.parseColor | false; + this.options.edges['inheritColor'] = options.inheritColor | true; + } + + var gEdges = gephiJSON.edges; + var gNodes = gephiJSON.nodes; + for (var i = 0; i < gEdges.length; i++) { + var edge = {}; + var gEdge = gEdges[i]; + edge['id'] = gEdge.id; + edge['from'] = gEdge.source; + edge['to'] = gEdge.target; + edge['attributes'] = gEdge.attributes; +// edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined; +// edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size; + edge['color'] = gEdge.color; + edge['inheritColor'] = edge['color'] !== undefined ? false : this.options.inheritColor; + edges.push(edge); + } + + for (var i = 0; i < gNodes.length; i++) { + var node = {}; + var gNode = gNodes[i]; + node['id'] = gNode.id; + node['attributes'] = gNode.attributes; + node['x'] = gNode.x; + node['y'] = gNode.y; + node['label'] = gNode.label; + if (this.options.nodes.parseColor == true) { + node['color'] = gNode.color; + } + else { + node['color'] = gNode.color !== undefined ? {background:gNode.color, border:gNode.color} : undefined; + } + node['radius'] = gNode.size; + node['allowedToMoveX'] = this.options.nodes.allowedToMove; + node['allowedToMoveY'] = this.options.nodes.allowedToMove; + nodes.push(node); + } + + return {nodes:nodes, edges:edges}; +} + +exports.parseGephi = parseGephi; \ No newline at end of file diff --git a/src/network/img/acceptDeleteIcon.png b/lib/network/img/acceptDeleteIcon.png similarity index 100% rename from src/network/img/acceptDeleteIcon.png rename to lib/network/img/acceptDeleteIcon.png diff --git a/src/network/img/addNodeIcon.png b/lib/network/img/addNodeIcon.png similarity index 100% rename from src/network/img/addNodeIcon.png rename to lib/network/img/addNodeIcon.png diff --git a/src/network/img/backIcon.png b/lib/network/img/backIcon.png similarity index 100% rename from src/network/img/backIcon.png rename to lib/network/img/backIcon.png diff --git a/src/network/img/connectIcon.png b/lib/network/img/connectIcon.png similarity index 100% rename from src/network/img/connectIcon.png rename to lib/network/img/connectIcon.png diff --git a/src/network/img/cross.png b/lib/network/img/cross.png similarity index 100% rename from src/network/img/cross.png rename to lib/network/img/cross.png diff --git a/src/network/img/cross2.png b/lib/network/img/cross2.png similarity index 100% rename from src/network/img/cross2.png rename to lib/network/img/cross2.png diff --git a/src/network/img/deleteIcon.png b/lib/network/img/deleteIcon.png similarity index 100% rename from src/network/img/deleteIcon.png rename to lib/network/img/deleteIcon.png diff --git a/src/network/img/downArrow.png b/lib/network/img/downArrow.png similarity index 100% rename from src/network/img/downArrow.png rename to lib/network/img/downArrow.png diff --git a/src/network/img/editIcon.png b/lib/network/img/editIcon.png similarity index 100% rename from src/network/img/editIcon.png rename to lib/network/img/editIcon.png diff --git a/src/network/img/leftArrow.png b/lib/network/img/leftArrow.png similarity index 100% rename from src/network/img/leftArrow.png rename to lib/network/img/leftArrow.png diff --git a/src/network/img/minus.png b/lib/network/img/minus.png similarity index 100% rename from src/network/img/minus.png rename to lib/network/img/minus.png diff --git a/src/network/img/plus.png b/lib/network/img/plus.png similarity index 100% rename from src/network/img/plus.png rename to lib/network/img/plus.png diff --git a/src/network/img/rightArrow.png b/lib/network/img/rightArrow.png similarity index 100% rename from src/network/img/rightArrow.png rename to lib/network/img/rightArrow.png diff --git a/src/network/img/upArrow.png b/lib/network/img/upArrow.png similarity index 100% rename from src/network/img/upArrow.png rename to lib/network/img/upArrow.png diff --git a/src/network/img/zoomExtends.png b/lib/network/img/zoomExtends.png similarity index 100% rename from src/network/img/zoomExtends.png rename to lib/network/img/zoomExtends.png diff --git a/lib/network/mixins/ClusterMixin.js b/lib/network/mixins/ClusterMixin.js new file mode 100644 index 00000000..f9db6e86 --- /dev/null +++ b/lib/network/mixins/ClusterMixin.js @@ -0,0 +1,1137 @@ +/** + * Creation of the ClusterMixin var. + * + * This contains all the functions the Network object can use to employ clustering + */ + +/** +* This is only called in the constructor of the network object +* +*/ +exports.startWithClustering = function() { + // cluster if the data set is big + this.clusterToFit(this.constants.clustering.initialMaxNodes, true); + + // updates the lables after clustering + this.updateLabels(); + + // this is called here because if clusterin is disabled, the start and stabilize are called in + // the setData function. + if (this.stabilize) { + this._stabilize(); + } + this.start(); +}; + +/** + * This function clusters until the initialMaxNodes has been reached + * + * @param {Number} maxNumberOfNodes + * @param {Boolean} reposition + */ +exports.clusterToFit = function(maxNumberOfNodes, reposition) { + var numberOfNodes = this.nodeIndices.length; + + var maxLevels = 50; + var level = 0; + + // we first cluster the hubs, then we pull in the outliers, repeat + while (numberOfNodes > maxNumberOfNodes && level < maxLevels) { + if (level % 3 == 0) { + this.forceAggregateHubs(true); + this.normalizeClusterLevels(); + } + else { + this.increaseClusterLevel(); // this also includes a cluster normalization + } + + numberOfNodes = this.nodeIndices.length; + level += 1; + } + + // after the clustering we reposition the nodes to reduce the initial chaos + if (level > 0 && reposition == true) { + this.repositionNodes(); + } + this._updateCalculationNodes(); +}; + +/** + * This function can be called to open up a specific cluster. It is only called by + * It will unpack the cluster back one level. + * + * @param node | Node object: cluster to open. + */ +exports.openCluster = function(node) { + var isMovingBeforeClustering = this.moving; + if (node.clusterSize > this.constants.clustering.sectorThreshold && this._nodeInActiveArea(node) && + !(this._sector() == "default" && this.nodeIndices.length == 1)) { + // this loads a new sector, loads the nodes and edges and nodeIndices of it. + this._addSector(node); + var level = 0; + + // we decluster until we reach a decent number of nodes + while ((this.nodeIndices.length < this.constants.clustering.initialMaxNodes) && (level < 10)) { + this.decreaseClusterLevel(); + level += 1; + } + + } + else { + this._expandClusterNode(node,false,true); + + // update the index list, dynamic edges and labels + this._updateNodeIndexList(); + this._updateDynamicEdges(); + this._updateCalculationNodes(); + this.updateLabels(); + } + + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } +}; + + +/** + * This calls the updateClustes with default arguments + */ +exports.updateClustersDefault = function() { + if (this.constants.clustering.enabled == true) { + this.updateClusters(0,false,false); + } +}; + + +/** + * This function can be called to increase the cluster level. This means that the nodes with only one edge connection will + * be clustered with their connected node. This can be repeated as many times as needed. + * This can be called externally (by a keybind for instance) to reduce the complexity of big datasets. + */ +exports.increaseClusterLevel = function() { + this.updateClusters(-1,false,true); +}; + + +/** + * This function can be called to decrease the cluster level. This means that the nodes with only one edge connection will + * be unpacked if they are a cluster. This can be repeated as many times as needed. + * This can be called externally (by a key-bind for instance) to look into clusters without zooming. + */ +exports.decreaseClusterLevel = function() { + this.updateClusters(1,false,true); +}; + + +/** + * This is the main clustering function. It clusters and declusters on zoom or forced + * This function clusters on zoom, it can be called with a predefined zoom direction + * If out, check if we can form clusters, if in, check if we can open clusters. + * This function is only called from _zoom() + * + * @param {Number} zoomDirection | -1 / 0 / +1 for zoomOut / determineByZoom / zoomIn + * @param {Boolean} recursive | enabled or disable recursive calling of the opening of clusters + * @param {Boolean} force | enabled or disable forcing + * @param {Boolean} doNotStart | if true do not call start + * + */ +exports.updateClusters = function(zoomDirection,recursive,force,doNotStart) { + var isMovingBeforeClustering = this.moving; + var amountOfNodes = this.nodeIndices.length; + + // on zoom out collapse the sector if the scale is at the level the sector was made + if (this.previousScale > this.scale && zoomDirection == 0) { + this._collapseSector(); + } + + // check if we zoom in or out + if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out + // forming clusters when forced pulls outliers in. When not forced, the edge length of the + // outer nodes determines if it is being clustered + this._formClusters(force); + } + else if (this.previousScale < this.scale || zoomDirection == 1) { // zoom in + if (force == true) { + // _openClusters checks for each node if the formationScale of the cluster is smaller than + // the current scale and if so, declusters. When forced, all clusters are reduced by one step + this._openClusters(recursive,force); + } + else { + // if a cluster takes up a set percentage of the active window + this._openClustersBySize(); + } + } + this._updateNodeIndexList(); + + // if a cluster was NOT formed and the user zoomed out, we try clustering by hubs + if (this.nodeIndices.length == amountOfNodes && (this.previousScale > this.scale || zoomDirection == -1)) { + this._aggregateHubs(force); + this._updateNodeIndexList(); + } + + // we now reduce chains. + if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out + this.handleChains(); + this._updateNodeIndexList(); + } + + this.previousScale = this.scale; + + // rest of the update the index list, dynamic edges and labels + this._updateDynamicEdges(); + this.updateLabels(); + + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length < amountOfNodes) { // this means a clustering operation has taken place + this.clusterSession += 1; + // if clusters have been made, we normalize the cluster level + this.normalizeClusterLevels(); + } + + if (doNotStart == false || doNotStart === undefined) { + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + } + + this._updateCalculationNodes(); +}; + +/** + * This function handles the chains. It is called on every updateClusters(). + */ +exports.handleChains = function() { + // after clustering we check how many chains there are + var chainPercentage = this._getChainFraction(); + if (chainPercentage > this.constants.clustering.chainThreshold) { + this._reduceAmountOfChains(1 - this.constants.clustering.chainThreshold / chainPercentage) + + } +}; + +/** + * this functions starts clustering by hubs + * The minimum hub threshold is set globally + * + * @private + */ +exports._aggregateHubs = function(force) { + this._getHubSize(); + this._formClustersByHub(force,false); +}; + + +/** + * This function is fired by keypress. It forces hubs to form. + * + */ +exports.forceAggregateHubs = function(doNotStart) { + var isMovingBeforeClustering = this.moving; + var amountOfNodes = this.nodeIndices.length; + + this._aggregateHubs(true); + + // update the index list, dynamic edges and labels + this._updateNodeIndexList(); + this._updateDynamicEdges(); + this.updateLabels(); + + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length != amountOfNodes) { + this.clusterSession += 1; + } + + if (doNotStart == false || doNotStart === undefined) { + // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded + if (this.moving != isMovingBeforeClustering) { + this.start(); + } + } +}; + +/** + * If a cluster takes up more than a set percentage of the screen, open the cluster + * + * @private + */ +exports._openClustersBySize = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.inView() == true) { + if ((node.width*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || + (node.height*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { + this.openCluster(node); + } + } + } + } +}; + + +/** + * This function loops over all nodes in the nodeIndices list. For each node it checks if it is a cluster and if it + * has to be opened based on the current zoom level. + * + * @private + */ +exports._openClusters = function(recursive,force) { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + this._expandClusterNode(node,recursive,force); + this._updateCalculationNodes(); + } +}; + +/** + * This function checks if a node has to be opened. This is done by checking the zoom level. + * If the node contains child nodes, this function is recursively called on the child nodes as well. + * This recursive behaviour is optional and can be set by the recursive argument. + * + * @param {Node} parentNode | to check for cluster and expand + * @param {Boolean} recursive | enabled or disable recursive calling + * @param {Boolean} force | enabled or disable forcing + * @param {Boolean} [openAll] | This will recursively force all nodes in the parent to be released + * @private + */ +exports._expandClusterNode = function(parentNode, recursive, force, openAll) { + // first check if node is a cluster + if (parentNode.clusterSize > 1) { + // this means that on a double tap event or a zoom event, the cluster fully unpacks if it is smaller than 20 + if (parentNode.clusterSize < this.constants.clustering.sectorThreshold) { + openAll = true; + } + recursive = openAll ? true : recursive; + + // if the last child has been added on a smaller scale than current scale decluster + if (parentNode.formationScale < this.scale || force == true) { + // we will check if any of the contained child nodes should be removed from the cluster + for (var containedNodeId in parentNode.containedNodes) { + if (parentNode.containedNodes.hasOwnProperty(containedNodeId)) { + var childNode = parentNode.containedNodes[containedNodeId]; + + // force expand will expand the largest cluster size clusters. Since we cluster from outside in, we assume that + // the largest cluster is the one that comes from outside + if (force == true) { + if (childNode.clusterSession == parentNode.clusterSessions[parentNode.clusterSessions.length-1] + || openAll) { + this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); + } + } + else { + if (this._nodeInActiveArea(parentNode)) { + this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); + } + } + } + } + } + } +}; + +/** + * ONLY CALLED FROM _expandClusterNode + * + * This function will expel a child_node from a parent_node. This is to de-cluster the node. This function will remove + * the child node from the parent contained_node object and put it back into the global nodes object. + * The same holds for the edge that was connected to the child node. It is moved back into the global edges object. + * + * @param {Node} parentNode | the parent node + * @param {String} containedNodeId | child_node id as it is contained in the containedNodes object of the parent node + * @param {Boolean} recursive | This will also check if the child needs to be expanded. + * With force and recursive both true, the entire cluster is unpacked + * @param {Boolean} force | This will disregard the zoom level and will expel this child from the parent + * @param {Boolean} openAll | This will recursively force all nodes in the parent to be released + * @private + */ +exports._expelChildFromParent = function(parentNode, containedNodeId, recursive, force, openAll) { + var childNode = parentNode.containedNodes[containedNodeId]; + + // if child node has been added on smaller scale than current, kick out + if (childNode.formationScale < this.scale || force == true) { + // unselect all selected items + this._unselectAll(); + + // put the child node back in the global nodes object + this.nodes[containedNodeId] = childNode; + + // release the contained edges from this childNode back into the global edges + this._releaseContainedEdges(parentNode,childNode); + + // reconnect rerouted edges to the childNode + this._connectEdgeBackToChild(parentNode,childNode); + + // validate all edges in dynamicEdges + this._validateEdges(parentNode); + + // undo the changes from the clustering operation on the parent node + parentNode.mass -= childNode.mass; + parentNode.clusterSize -= childNode.clusterSize; + parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); + parentNode.dynamicEdgesLength = parentNode.dynamicEdges.length; + + // place the child node near the parent, not at the exact same location to avoid chaos in the system + childNode.x = parentNode.x + parentNode.growthIndicator * (0.5 - Math.random()); + childNode.y = parentNode.y + parentNode.growthIndicator * (0.5 - Math.random()); + + // remove node from the list + delete parentNode.containedNodes[containedNodeId]; + + // check if there are other childs with this clusterSession in the parent. + var othersPresent = false; + for (var childNodeId in parentNode.containedNodes) { + if (parentNode.containedNodes.hasOwnProperty(childNodeId)) { + if (parentNode.containedNodes[childNodeId].clusterSession == childNode.clusterSession) { + othersPresent = true; + break; + } + } + } + // if there are no others, remove the cluster session from the list + if (othersPresent == false) { + parentNode.clusterSessions.pop(); + } + + this._repositionBezierNodes(childNode); +// this._repositionBezierNodes(parentNode); + + // remove the clusterSession from the child node + childNode.clusterSession = 0; + + // recalculate the size of the node on the next time the node is rendered + parentNode.clearSizeCache(); + + // restart the simulation to reorganise all nodes + this.moving = true; + } + + // check if a further expansion step is possible if recursivity is enabled + if (recursive == true) { + this._expandClusterNode(childNode,recursive,force,openAll); + } +}; + + +/** + * position the bezier nodes at the center of the edges + * + * @param node + * @private + */ +exports._repositionBezierNodes = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + node.dynamicEdges[i].positionBezierNode(); + } +}; + + +/** + * This function checks if any nodes at the end of their trees have edges below a threshold length + * This function is called only from updateClusters() + * forceLevelCollapse ignores the length of the edge and collapses one level + * This means that a node with only one edge will be clustered with its connected node + * + * @private + * @param {Boolean} force + */ +exports._formClusters = function(force) { + if (force == false) { + this._formClustersByZoom(); + } + else { + this._forceClustersByZoom(); + } +}; + + +/** + * This function handles the clustering by zooming out, this is based on a minimum edge distance + * + * @private + */ +exports._formClustersByZoom = function() { + var dx,dy,length, + minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; + + // check if any edges are shorter than minLength and start the clustering + // the clustering favours the node with the larger mass + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + var edge = this.edges[edgeId]; + if (edge.connected) { + if (edge.toId != edge.fromId) { + dx = (edge.to.x - edge.from.x); + dy = (edge.to.y - edge.from.y); + length = Math.sqrt(dx * dx + dy * dy); + + + if (length < minLength) { + // first check which node is larger + var parentNode = edge.from; + var childNode = edge.to; + if (edge.to.mass > edge.from.mass) { + parentNode = edge.to; + childNode = edge.from; + } + + if (childNode.dynamicEdgesLength == 1) { + this._addToCluster(parentNode,childNode,false); + } + else if (parentNode.dynamicEdgesLength == 1) { + this._addToCluster(childNode,parentNode,false); + } + } + } + } + } + } +}; + +/** + * This function forces the network to cluster all nodes with only one connecting edge to their + * connected node. + * + * @private + */ +exports._forceClustersByZoom = function() { + for (var nodeId in this.nodes) { + // another node could have absorbed this child. + if (this.nodes.hasOwnProperty(nodeId)) { + var childNode = this.nodes[nodeId]; + + // the edges can be swallowed by another decrease + if (childNode.dynamicEdgesLength == 1 && childNode.dynamicEdges.length != 0) { + var edge = childNode.dynamicEdges[0]; + var parentNode = (edge.toId == childNode.id) ? this.nodes[edge.fromId] : this.nodes[edge.toId]; + + // group to the largest node + if (childNode.id != parentNode.id) { + if (parentNode.mass > childNode.mass) { + this._addToCluster(parentNode,childNode,true); + } + else { + this._addToCluster(childNode,parentNode,true); + } + } + } + } + } +}; + + +/** + * To keep the nodes of roughly equal size we normalize the cluster levels. + * This function clusters a node to its smallest connected neighbour. + * + * @param node + * @private + */ +exports._clusterToSmallestNeighbour = function(node) { + var smallestNeighbour = -1; + var smallestNeighbourNode = null; + for (var i = 0; i < node.dynamicEdges.length; i++) { + if (node.dynamicEdges[i] !== undefined) { + var neighbour = null; + if (node.dynamicEdges[i].fromId != node.id) { + neighbour = node.dynamicEdges[i].from; + } + else if (node.dynamicEdges[i].toId != node.id) { + neighbour = node.dynamicEdges[i].to; + } + + + if (neighbour != null && smallestNeighbour > neighbour.clusterSessions.length) { + smallestNeighbour = neighbour.clusterSessions.length; + smallestNeighbourNode = neighbour; + } + } + } + + if (neighbour != null && this.nodes[neighbour.id] !== undefined) { + this._addToCluster(neighbour, node, true); + } +}; + + +/** + * This function forms clusters from hubs, it loops over all nodes + * + * @param {Boolean} force | Disregard zoom level + * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges + * @private + */ +exports._formClustersByHub = function(force, onlyEqual) { + // we loop over all nodes in the list + for (var nodeId in this.nodes) { + // we check if it is still available since it can be used by the clustering in this loop + if (this.nodes.hasOwnProperty(nodeId)) { + this._formClusterFromHub(this.nodes[nodeId],force,onlyEqual); + } + } +}; + +/** + * This function forms a cluster from a specific preselected hub node + * + * @param {Node} hubNode | the node we will cluster as a hub + * @param {Boolean} force | Disregard zoom level + * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges + * @param {Number} [absorptionSizeOffset] | + * @private + */ +exports._formClusterFromHub = function(hubNode, force, onlyEqual, absorptionSizeOffset) { + if (absorptionSizeOffset === undefined) { + absorptionSizeOffset = 0; + } + // we decide if the node is a hub + if ((hubNode.dynamicEdgesLength >= this.hubThreshold && onlyEqual == false) || + (hubNode.dynamicEdgesLength == this.hubThreshold && onlyEqual == true)) { + // initialize variables + var dx,dy,length; + var minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; + var allowCluster = false; + + // we create a list of edges because the dynamicEdges change over the course of this loop + var edgesIdarray = []; + var amountOfInitialEdges = hubNode.dynamicEdges.length; + for (var j = 0; j < amountOfInitialEdges; j++) { + edgesIdarray.push(hubNode.dynamicEdges[j].id); + } + + // if the hub clustering is not forces, we check if one of the edges connected + // to a cluster is small enough based on the constants.clustering.clusterEdgeThreshold + if (force == false) { + allowCluster = false; + for (j = 0; j < amountOfInitialEdges; j++) { + var edge = this.edges[edgesIdarray[j]]; + if (edge !== undefined) { + if (edge.connected) { + if (edge.toId != edge.fromId) { + dx = (edge.to.x - edge.from.x); + dy = (edge.to.y - edge.from.y); + length = Math.sqrt(dx * dx + dy * dy); + + if (length < minLength) { + allowCluster = true; + break; + } + } + } + } + } + } + + // start the clustering if allowed + if ((!force && allowCluster) || force) { + // we loop over all edges INITIALLY connected to this hub + for (j = 0; j < amountOfInitialEdges; j++) { + edge = this.edges[edgesIdarray[j]]; + // the edge can be clustered by this function in a previous loop + if (edge !== undefined) { + var childNode = this.nodes[(edge.fromId == hubNode.id) ? edge.toId : edge.fromId]; + // we do not want hubs to merge with other hubs nor do we want to cluster itself. + if ((childNode.dynamicEdges.length <= (this.hubThreshold + absorptionSizeOffset)) && + (childNode.id != hubNode.id)) { + this._addToCluster(hubNode,childNode,force); + } + } + } + } + } +}; + + + +/** + * This function adds the child node to the parent node, creating a cluster if it is not already. + * + * @param {Node} parentNode | this is the node that will house the child node + * @param {Node} childNode | this node will be deleted from the global this.nodes and stored in the parent node + * @param {Boolean} force | true will only update the remainingEdges at the very end of the clustering, ensuring single level collapse + * @private + */ +exports._addToCluster = function(parentNode, childNode, force) { + // join child node in the parent node + parentNode.containedNodes[childNode.id] = childNode; + + // manage all the edges connected to the child and parent nodes + for (var i = 0; i < childNode.dynamicEdges.length; i++) { + var edge = childNode.dynamicEdges[i]; + if (edge.toId == parentNode.id || edge.fromId == parentNode.id) { // edge connected to parentNode + this._addToContainedEdges(parentNode,childNode,edge); + } + else { + this._connectEdgeToCluster(parentNode,childNode,edge); + } + } + // a contained node has no dynamic edges. + childNode.dynamicEdges = []; + + // remove circular edges from clusters + this._containCircularEdgesFromNode(parentNode,childNode); + + + // remove the childNode from the global nodes object + delete this.nodes[childNode.id]; + + // update the properties of the child and parent + var massBefore = parentNode.mass; + childNode.clusterSession = this.clusterSession; + parentNode.mass += childNode.mass; + parentNode.clusterSize += childNode.clusterSize; + parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); + + // keep track of the clustersessions so we can open the cluster up as it has been formed. + if (parentNode.clusterSessions[parentNode.clusterSessions.length - 1] != this.clusterSession) { + parentNode.clusterSessions.push(this.clusterSession); + } + + // forced clusters only open from screen size and double tap + if (force == true) { + // parentNode.formationScale = Math.pow(1 - (1.0/11.0),this.clusterSession+3); + parentNode.formationScale = 0; + } + else { + parentNode.formationScale = this.scale; // The latest child has been added on this scale + } + + // recalculate the size of the node on the next time the node is rendered + parentNode.clearSizeCache(); + + // set the pop-out scale for the childnode + parentNode.containedNodes[childNode.id].formationScale = parentNode.formationScale; + + // nullify the movement velocity of the child, this is to avoid hectic behaviour + childNode.clearVelocity(); + + // the mass has altered, preservation of energy dictates the velocity to be updated + parentNode.updateVelocity(massBefore); + + // restart the simulation to reorganise all nodes + this.moving = true; +}; + + +/** + * This function will apply the changes made to the remainingEdges during the formation of the clusters. + * This is a seperate function to allow for level-wise collapsing of the node barnesHutTree. + * It has to be called if a level is collapsed. It is called by _formClusters(). + * @private + */ +exports._updateDynamicEdges = function() { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + node.dynamicEdgesLength = node.dynamicEdges.length; + + // this corrects for multiple edges pointing at the same other node + var correction = 0; + if (node.dynamicEdgesLength > 1) { + for (var j = 0; j < node.dynamicEdgesLength - 1; j++) { + var edgeToId = node.dynamicEdges[j].toId; + var edgeFromId = node.dynamicEdges[j].fromId; + for (var k = j+1; k < node.dynamicEdgesLength; k++) { + if ((node.dynamicEdges[k].toId == edgeToId && node.dynamicEdges[k].fromId == edgeFromId) || + (node.dynamicEdges[k].fromId == edgeToId && node.dynamicEdges[k].toId == edgeFromId)) { + correction += 1; + } + } + } + } + node.dynamicEdgesLength -= correction; + } +}; + + +/** + * This adds an edge from the childNode to the contained edges of the parent node + * + * @param parentNode | Node object + * @param childNode | Node object + * @param edge | Edge object + * @private + */ +exports._addToContainedEdges = function(parentNode, childNode, edge) { + // create an array object if it does not yet exist for this childNode + if (!(parentNode.containedEdges.hasOwnProperty(childNode.id))) { + parentNode.containedEdges[childNode.id] = [] + } + // add this edge to the list + parentNode.containedEdges[childNode.id].push(edge); + + // remove the edge from the global edges object + delete this.edges[edge.id]; + + // remove the edge from the parent object + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + if (parentNode.dynamicEdges[i].id == edge.id) { + parentNode.dynamicEdges.splice(i,1); + break; + } + } +}; + +/** + * This function connects an edge that was connected to a child node to the parent node. + * It keeps track of which nodes it has been connected to with the originalId array. + * + * @param {Node} parentNode | Node object + * @param {Node} childNode | Node object + * @param {Edge} edge | Edge object + * @private + */ +exports._connectEdgeToCluster = function(parentNode, childNode, edge) { + // handle circular edges + if (edge.toId == edge.fromId) { + this._addToContainedEdges(parentNode, childNode, edge); + } + else { + if (edge.toId == childNode.id) { // edge connected to other node on the "to" side + edge.originalToId.push(childNode.id); + edge.to = parentNode; + edge.toId = parentNode.id; + } + else { // edge connected to other node with the "from" side + + edge.originalFromId.push(childNode.id); + edge.from = parentNode; + edge.fromId = parentNode.id; + } + + this._addToReroutedEdges(parentNode,childNode,edge); + } +}; + + +/** + * If a node is connected to itself, a circular edge is drawn. When clustering we want to contain + * these edges inside of the cluster. + * + * @param parentNode + * @param childNode + * @private + */ +exports._containCircularEdgesFromNode = function(parentNode, childNode) { + // manage all the edges connected to the child and parent nodes + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + var edge = parentNode.dynamicEdges[i]; + // handle circular edges + if (edge.toId == edge.fromId) { + this._addToContainedEdges(parentNode, childNode, edge); + } + } +}; + + +/** + * This adds an edge from the childNode to the rerouted edges of the parent node + * + * @param parentNode | Node object + * @param childNode | Node object + * @param edge | Edge object + * @private + */ +exports._addToReroutedEdges = function(parentNode, childNode, edge) { + // create an array object if it does not yet exist for this childNode + // we store the edge in the rerouted edges so we can restore it when the cluster pops open + if (!(parentNode.reroutedEdges.hasOwnProperty(childNode.id))) { + parentNode.reroutedEdges[childNode.id] = []; + } + parentNode.reroutedEdges[childNode.id].push(edge); + + // this edge becomes part of the dynamicEdges of the cluster node + parentNode.dynamicEdges.push(edge); + }; + + + +/** + * This function connects an edge that was connected to a cluster node back to the child node. + * + * @param parentNode | Node object + * @param childNode | Node object + * @private + */ +exports._connectEdgeBackToChild = function(parentNode, childNode) { + if (parentNode.reroutedEdges.hasOwnProperty(childNode.id)) { + for (var i = 0; i < parentNode.reroutedEdges[childNode.id].length; i++) { + var edge = parentNode.reroutedEdges[childNode.id][i]; + if (edge.originalFromId[edge.originalFromId.length-1] == childNode.id) { + edge.originalFromId.pop(); + edge.fromId = childNode.id; + edge.from = childNode; + } + else { + edge.originalToId.pop(); + edge.toId = childNode.id; + edge.to = childNode; + } + + // append this edge to the list of edges connecting to the childnode + childNode.dynamicEdges.push(edge); + + // remove the edge from the parent object + for (var j = 0; j < parentNode.dynamicEdges.length; j++) { + if (parentNode.dynamicEdges[j].id == edge.id) { + parentNode.dynamicEdges.splice(j,1); + break; + } + } + } + // remove the entry from the rerouted edges + delete parentNode.reroutedEdges[childNode.id]; + } +}; + + +/** + * When loops are clustered, an edge can be both in the rerouted array and the contained array. + * This function is called last to verify that all edges in dynamicEdges are in fact connected to the + * parentNode + * + * @param parentNode | Node object + * @private + */ +exports._validateEdges = function(parentNode) { + for (var i = 0; i < parentNode.dynamicEdges.length; i++) { + var edge = parentNode.dynamicEdges[i]; + if (parentNode.id != edge.toId && parentNode.id != edge.fromId) { + parentNode.dynamicEdges.splice(i,1); + } + } +}; + + +/** + * This function released the contained edges back into the global domain and puts them back into the + * dynamic edges of both parent and child. + * + * @param {Node} parentNode | + * @param {Node} childNode | + * @private + */ +exports._releaseContainedEdges = function(parentNode, childNode) { + for (var i = 0; i < parentNode.containedEdges[childNode.id].length; i++) { + var edge = parentNode.containedEdges[childNode.id][i]; + + // put the edge back in the global edges object + this.edges[edge.id] = edge; + + // put the edge back in the dynamic edges of the child and parent + childNode.dynamicEdges.push(edge); + parentNode.dynamicEdges.push(edge); + } + // remove the entry from the contained edges + delete parentNode.containedEdges[childNode.id]; + +}; + + + + +// ------------------- UTILITY FUNCTIONS ---------------------------- // + + +/** + * This updates the node labels for all nodes (for debugging purposes) + */ +exports.updateLabels = function() { + var nodeId; + // update node labels + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.clusterSize > 1) { + node.label = "[".concat(String(node.clusterSize),"]"); + } + } + } + + // update node labels + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.clusterSize == 1) { + if (node.originalLabel !== undefined) { + node.label = node.originalLabel; + } + else { + node.label = String(node.id); + } + } + } + } + +// /* Debug Override */ +// for (nodeId in this.nodes) { +// if (this.nodes.hasOwnProperty(nodeId)) { +// node = this.nodes[nodeId]; +// node.label = String(node.level); +// } +// } + +}; + + +/** + * We want to keep the cluster level distribution rather small. This means we do not want unclustered nodes + * if the rest of the nodes are already a few cluster levels in. + * To fix this we use this function. It determines the min and max cluster level and sends nodes that have not + * clustered enough to the clusterToSmallestNeighbours function. + */ +exports.normalizeClusterLevels = function() { + var maxLevel = 0; + var minLevel = 1e9; + var clusterLevel = 0; + var nodeId; + + // we loop over all nodes in the list + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + clusterLevel = this.nodes[nodeId].clusterSessions.length; + if (maxLevel < clusterLevel) {maxLevel = clusterLevel;} + if (minLevel > clusterLevel) {minLevel = clusterLevel;} + } + } + + if (maxLevel - minLevel > this.constants.clustering.clusterLevelDifference) { + var amountOfNodes = this.nodeIndices.length; + var targetLevel = maxLevel - this.constants.clustering.clusterLevelDifference; + // we loop over all nodes in the list + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].clusterSessions.length < targetLevel) { + this._clusterToSmallestNeighbour(this.nodes[nodeId]); + } + } + } + this._updateNodeIndexList(); + this._updateDynamicEdges(); + // if a cluster was formed, we increase the clusterSession + if (this.nodeIndices.length != amountOfNodes) { + this.clusterSession += 1; + } + } +}; + + + +/** + * This function determines if the cluster we want to decluster is in the active area + * this means around the zoom center + * + * @param {Node} node + * @returns {boolean} + * @private + */ +exports._nodeInActiveArea = function(node) { + return ( + Math.abs(node.x - this.areaCenter.x) <= this.constants.clustering.activeAreaBoxSize/this.scale + && + Math.abs(node.y - this.areaCenter.y) <= this.constants.clustering.activeAreaBoxSize/this.scale + ) +}; + + +/** + * This is an adaptation of the original repositioning function. This is called if the system is clustered initially + * It puts large clusters away from the center and randomizes the order. + * + */ +exports.repositionNodes = function() { + for (var i = 0; i < this.nodeIndices.length; i++) { + var node = this.nodes[this.nodeIndices[i]]; + if ((node.xFixed == false || node.yFixed == false)) { + var radius = 10 * 0.1*this.nodeIndices.length * Math.min(100,node.mass); + var angle = 2 * Math.PI * Math.random(); + if (node.xFixed == false) {node.x = radius * Math.cos(angle);} + if (node.yFixed == false) {node.y = radius * Math.sin(angle);} + this._repositionBezierNodes(node); + } + } +}; + + +/** + * We determine how many connections denote an important hub. + * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) + * + * @private + */ +exports._getHubSize = function() { + var average = 0; + var averageSquared = 0; + var hubCounter = 0; + var largestHub = 0; + + for (var i = 0; i < this.nodeIndices.length; i++) { + + var node = this.nodes[this.nodeIndices[i]]; + if (node.dynamicEdgesLength > largestHub) { + largestHub = node.dynamicEdgesLength; + } + average += node.dynamicEdgesLength; + averageSquared += Math.pow(node.dynamicEdgesLength,2); + hubCounter += 1; + } + average = average / hubCounter; + averageSquared = averageSquared / hubCounter; + + var variance = averageSquared - Math.pow(average,2); + + var standardDeviation = Math.sqrt(variance); + + this.hubThreshold = Math.floor(average + 2*standardDeviation); + + // always have at least one to cluster + if (this.hubThreshold > largestHub) { + this.hubThreshold = largestHub; + } + +// console.log("average",average,"averageSQ",averageSquared,"var",variance,"std",standardDeviation); +// console.log("hubThreshold:",this.hubThreshold); +}; + + +/** + * We reduce the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods + * with this amount we can cluster specifically on these chains. + * + * @param {Number} fraction | between 0 and 1, the percentage of chains to reduce + * @private + */ +exports._reduceAmountOfChains = function(fraction) { + this.hubThreshold = 2; + var reduceAmount = Math.floor(this.nodeIndices.length * fraction); + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { + if (reduceAmount > 0) { + this._formClusterFromHub(this.nodes[nodeId],true,true,1); + reduceAmount -= 1; + } + } + } + } +}; + +/** + * We get the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods + * with this amount we can cluster specifically on these chains. + * + * @private + */ +exports._getChainFraction = function() { + var chains = 0; + var total = 0; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { + chains += 1; + } + total += 1; + } + } + return chains/total; +}; diff --git a/lib/network/mixins/HierarchicalLayoutMixin.js b/lib/network/mixins/HierarchicalLayoutMixin.js new file mode 100644 index 00000000..b866774d --- /dev/null +++ b/lib/network/mixins/HierarchicalLayoutMixin.js @@ -0,0 +1,322 @@ +exports._resetLevels = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + var node = this.nodes[nodeId]; + if (node.preassignedLevel == false) { + node.level = -1; + } + } + } +}; + +/** + * This is the main function to layout the nodes in a hierarchical way. + * It checks if the node details are supplied correctly + * + * @private + */ +exports._setupHierarchicalLayout = function() { + if (this.constants.hierarchicalLayout.enabled == true && this.nodeIndices.length > 0) { + if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "DU") { + this.constants.hierarchicalLayout.levelSeparation *= -1; + } + else { + this.constants.hierarchicalLayout.levelSeparation = Math.abs(this.constants.hierarchicalLayout.levelSeparation); + } + + if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "LR") { + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.type = "vertical"; + } + } + else { + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.type = "horizontal"; + } + } + // get the size of the largest hubs and check if the user has defined a level for a node. + var hubsize = 0; + var node, nodeId; + var definedLevel = false; + var undefinedLevel = false; + + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.level != -1) { + definedLevel = true; + } + else { + undefinedLevel = true; + } + if (hubsize < node.edges.length) { + hubsize = node.edges.length; + } + } + } + + // if the user defined some levels but not all, alert and run without hierarchical layout + if (undefinedLevel == true && definedLevel == true) { + alert("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes."); + this.zoomExtent(true,this.constants.clustering.enabled); + if (!this.constants.clustering.enabled) { + this.start(); + } + } + else { + // setup the system to use hierarchical method. + this._changeConstants(); + + // define levels if undefined by the users. Based on hubsize + if (undefinedLevel == true) { + this._determineLevels(hubsize); + } + // check the distribution of the nodes per level. + var distribution = this._getDistribution(); + + // place the nodes on the canvas. This also stablilizes the system. + this._placeNodesByHierarchy(distribution); + + // start the simulation. + this.start(); + } + } +}; + + +/** + * This function places the nodes on the canvas based on the hierarchial distribution. + * + * @param {Object} distribution | obtained by the function this._getDistribution() + * @private + */ +exports._placeNodesByHierarchy = function(distribution) { + var nodeId, node; + + // start placing all the level 0 nodes first. Then recursively position their branches. + for (var level in distribution) { + if (distribution.hasOwnProperty(level)) { + + for (nodeId in distribution[level].nodes) { + if (distribution[level].nodes.hasOwnProperty(nodeId)) { + node = distribution[level].nodes[nodeId]; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + if (node.xFixed) { + node.x = distribution[level].minPos; + node.xFixed = false; + + distribution[level].minPos += distribution[level].nodeSpacing; + } + } + else { + if (node.yFixed) { + node.y = distribution[level].minPos; + node.yFixed = false; + + distribution[level].minPos += distribution[level].nodeSpacing; + } + } + this._placeBranchNodes(node.edges,node.id,distribution,node.level); + } + } + } + } + + // stabilize the system after positioning. This function calls zoomExtent. + this._stabilize(); +}; + + +/** + * This function get the distribution of levels based on hubsize + * + * @returns {Object} + * @private + */ +exports._getDistribution = function() { + var distribution = {}; + var nodeId, node, level; + + // we fix Y because the hierarchy is vertical, we fix X so we do not give a node an x position for a second time. + // the fix of X is removed after the x value has been set. + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + node.xFixed = true; + node.yFixed = true; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + node.y = this.constants.hierarchicalLayout.levelSeparation*node.level; + } + else { + node.x = this.constants.hierarchicalLayout.levelSeparation*node.level; + } + if (distribution[node.level] === undefined) { + distribution[node.level] = {amount: 0, nodes: {}, minPos:0, nodeSpacing:0}; + } + distribution[node.level].amount += 1; + distribution[node.level].nodes[nodeId] = node; + } + } + + // determine the largest amount of nodes of all levels + var maxCount = 0; + for (level in distribution) { + if (distribution.hasOwnProperty(level)) { + if (maxCount < distribution[level].amount) { + maxCount = distribution[level].amount; + } + } + } + + // set the initial position and spacing of each nodes accordingly + for (level in distribution) { + if (distribution.hasOwnProperty(level)) { + distribution[level].nodeSpacing = (maxCount + 1) * this.constants.hierarchicalLayout.nodeSpacing; + distribution[level].nodeSpacing /= (distribution[level].amount + 1); + distribution[level].minPos = distribution[level].nodeSpacing - (0.5 * (distribution[level].amount + 1) * distribution[level].nodeSpacing); + } + } + + return distribution; +}; + + +/** + * this function allocates nodes in levels based on the recursive branching from the largest hubs. + * + * @param hubsize + * @private + */ +exports._determineLevels = function(hubsize) { + var nodeId, node; + + // determine hubs + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.edges.length == hubsize) { + node.level = 0; + } + } + } + + // branch from hubs + for (nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + if (node.level == 0) { + this._setLevel(1,node.edges,node.id); + } + } + } +}; + + +/** + * Since hierarchical layout does not support: + * - smooth curves (based on the physics), + * - clustering (based on dynamic node counts) + * + * We disable both features so there will be no problems. + * + * @private + */ +exports._changeConstants = function() { + this.constants.clustering.enabled = false; + this.constants.physics.barnesHut.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this._loadSelectedForceSolver(); + if (this.constants.smoothCurves.enabled == true) { + this.constants.smoothCurves.dynamic = false; + } + this._configureSmoothCurves(); +}; + + +/** + * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes + * on a X position that ensures there will be no overlap. + * + * @param edges + * @param parentId + * @param distribution + * @param parentLevel + * @private + */ +exports._placeBranchNodes = function(edges, parentId, distribution, parentLevel) { + for (var i = 0; i < edges.length; i++) { + var childNode = null; + if (edges[i].toId == parentId) { + childNode = edges[i].from; + } + else { + childNode = edges[i].to; + } + + // if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here. + var nodeMoved = false; + if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { + if (childNode.xFixed && childNode.level > parentLevel) { + childNode.xFixed = false; + childNode.x = distribution[childNode.level].minPos; + nodeMoved = true; + } + } + else { + if (childNode.yFixed && childNode.level > parentLevel) { + childNode.yFixed = false; + childNode.y = distribution[childNode.level].minPos; + nodeMoved = true; + } + } + + if (nodeMoved == true) { + distribution[childNode.level].minPos += distribution[childNode.level].nodeSpacing; + if (childNode.edges.length > 1) { + this._placeBranchNodes(childNode.edges,childNode.id,distribution,childNode.level); + } + } + } +}; + + +/** + * this function is called recursively to enumerate the barnches of the largest hubs and give each node a level. + * + * @param level + * @param edges + * @param parentId + * @private + */ +exports._setLevel = function(level, edges, parentId) { + for (var i = 0; i < edges.length; i++) { + var childNode = null; + if (edges[i].toId == parentId) { + childNode = edges[i].from; + } + else { + childNode = edges[i].to; + } + if (childNode.level == -1 || childNode.level > level) { + childNode.level = level; + if (edges.length > 1) { + this._setLevel(level+1, childNode.edges, childNode.id); + } + } + } +}; + + +/** + * Unfix nodes + * + * @private + */ +exports._restoreNodes = function() { + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.nodes[nodeId].xFixed = false; + this.nodes[nodeId].yFixed = false; + } + } +}; diff --git a/lib/network/mixins/ManipulationMixin.js b/lib/network/mixins/ManipulationMixin.js new file mode 100644 index 00000000..be34011a --- /dev/null +++ b/lib/network/mixins/ManipulationMixin.js @@ -0,0 +1,576 @@ +var util = require('../../util'); +var Node = require('../Node'); +var Edge = require('../Edge'); + +/** + * clears the toolbar div element of children + * + * @private + */ +exports._clearManipulatorBar = function() { + while (this.manipulationDiv.hasChildNodes()) { + this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); + } +}; + +/** + * Manipulation UI temporarily overloads certain functions to extend or replace them. To be able to restore + * these functions to their original functionality, we saved them in this.cachedFunctions. + * This function restores these functions to their original function. + * + * @private + */ +exports._restoreOverloadedFunctions = function() { + for (var functionName in this.cachedFunctions) { + if (this.cachedFunctions.hasOwnProperty(functionName)) { + this[functionName] = this.cachedFunctions[functionName]; + } + } +}; + +/** + * Enable or disable edit-mode. + * + * @private + */ +exports._toggleEditMode = function() { + this.editMode = !this.editMode; + var toolbar = document.getElementById("network-manipulationDiv"); + var closeDiv = document.getElementById("network-manipulation-closeDiv"); + var editModeDiv = document.getElementById("network-manipulation-editMode"); + if (this.editMode == true) { + toolbar.style.display="block"; + closeDiv.style.display="block"; + editModeDiv.style.display="none"; + closeDiv.onclick = this._toggleEditMode.bind(this); + } + else { + toolbar.style.display="none"; + closeDiv.style.display="none"; + editModeDiv.style.display="block"; + closeDiv.onclick = null; + } + this._createManipulatorBar() +}; + +/** + * main function, creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. + * + * @private + */ +exports._createManipulatorBar = function() { + // remove bound functions + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + if (this.edgeBeingEdited !== undefined) { + this.edgeBeingEdited._disableControlNodes(); + this.edgeBeingEdited = undefined; + this.selectedControlNode = null; + this.controlNodesActive = false; + } + + // restore overloaded functions + this._restoreOverloadedFunctions(); + + // resume calculation + this.freezeSimulation = false; + + // reset global variables + this.blockConnectingEdgeSelection = false; + this.forceAppendSelection = false; + + if (this.editMode == true) { + while (this.manipulationDiv.hasChildNodes()) { + this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); + } + // add the icons to the manipulator div + this.manipulationDiv.innerHTML = "" + + "" + + ""+this.constants.labels['add'] +"" + + "
      " + + "" + + ""+this.constants.labels['link'] +""; + if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { + this.manipulationDiv.innerHTML += "" + + "
      " + + "" + + ""+this.constants.labels['editNode'] +""; + } + else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { + this.manipulationDiv.innerHTML += "" + + "
      " + + "" + + ""+this.constants.labels['editEdge'] +""; + } + if (this._selectionIsEmpty() == false) { + this.manipulationDiv.innerHTML += "" + + "
      " + + "" + + ""+this.constants.labels['del'] +""; + } + + + // bind the icons + var addNodeButton = document.getElementById("network-manipulate-addNode"); + addNodeButton.onclick = this._createAddNodeToolbar.bind(this); + var addEdgeButton = document.getElementById("network-manipulate-connectNode"); + addEdgeButton.onclick = this._createAddEdgeToolbar.bind(this); + if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { + var editButton = document.getElementById("network-manipulate-editNode"); + editButton.onclick = this._editNode.bind(this); + } + else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { + var editButton = document.getElementById("network-manipulate-editEdge"); + editButton.onclick = this._createEditEdgeToolbar.bind(this); + } + if (this._selectionIsEmpty() == false) { + var deleteButton = document.getElementById("network-manipulate-delete"); + deleteButton.onclick = this._deleteSelected.bind(this); + } + var closeDiv = document.getElementById("network-manipulation-closeDiv"); + closeDiv.onclick = this._toggleEditMode.bind(this); + + this.boundFunction = this._createManipulatorBar.bind(this); + this.on('select', this.boundFunction); + } + else { + this.editModeDiv.innerHTML = "" + + "" + + "" + this.constants.labels['edit'] + ""; + var editModeButton = document.getElementById("network-manipulate-editModeButton"); + editModeButton.onclick = this._toggleEditMode.bind(this); + } +}; + + + +/** + * Create the toolbar for adding Nodes + * + * @private + */ +exports._createAddNodeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + // create the toolbar contents + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
      " + + "" + + "" + this.constants.labels['addDescription'] + ""; + + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); + + // we use the boundFunction so we can reference it when we unbind it from the "select" event. + this.boundFunction = this._addNode.bind(this); + this.on('select', this.boundFunction); +}; + + +/** + * create the toolbar to connect nodes + * + * @private + */ +exports._createAddEdgeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + this._unselectAll(true); + this.freezeSimulation = true; + + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + this._unselectAll(); + this.forceAppendSelection = false; + this.blockConnectingEdgeSelection = true; + + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
      " + + "" + + "" + this.constants.labels['linkDescription'] + ""; + + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); + + // we use the boundFunction so we can reference it when we unbind it from the "select" event. + this.boundFunction = this._handleConnect.bind(this); + this.on('select', this.boundFunction); + + // temporarily overload functions + this.cachedFunctions["_handleTouch"] = this._handleTouch; + this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; + this._handleTouch = this._handleConnect; + this._handleOnRelease = this._finishConnect; + + // redraw to show the unselect + this._redraw(); +}; + +/** + * create the toolbar to edit edges + * + * @private + */ +exports._createEditEdgeToolbar = function() { + // clear the toolbar + this._clearManipulatorBar(); + this.controlNodesActive = true; + + if (this.boundFunction) { + this.off('select', this.boundFunction); + } + + this.edgeBeingEdited = this._getSelectedEdge(); + this.edgeBeingEdited._enableControlNodes(); + + this.manipulationDiv.innerHTML = "" + + "" + + "" + this.constants.labels['back'] + " " + + "
      " + + "" + + "" + this.constants.labels['editEdgeDescription'] + ""; + + // bind the icon + var backButton = document.getElementById("network-manipulate-back"); + backButton.onclick = this._createManipulatorBar.bind(this); + + // temporarily overload functions + this.cachedFunctions["_handleTouch"] = this._handleTouch; + this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; + this.cachedFunctions["_handleTap"] = this._handleTap; + this.cachedFunctions["_handleDragStart"] = this._handleDragStart; + this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + this._handleTouch = this._selectControlNode; + this._handleTap = function () {}; + this._handleOnDrag = this._controlNodeDrag; + this._handleDragStart = function () {} + this._handleOnRelease = this._releaseControlNode; + + // redraw to show the unselect + this._redraw(); +}; + + + + + +/** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ +exports._selectControlNode = function(pointer) { + this.edgeBeingEdited.controlNodes.from.unselect(); + this.edgeBeingEdited.controlNodes.to.unselect(); + this.selectedControlNode = this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(pointer.x),this._YconvertDOMtoCanvas(pointer.y)); + if (this.selectedControlNode !== null) { + this.selectedControlNode.select(); + this.freezeSimulation = true; + } + this._redraw(); +}; + +/** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ +exports._controlNodeDrag = function(event) { + var pointer = this._getPointer(event.gesture.center); + if (this.selectedControlNode !== null && this.selectedControlNode !== undefined) { + this.selectedControlNode.x = this._XconvertDOMtoCanvas(pointer.x); + this.selectedControlNode.y = this._YconvertDOMtoCanvas(pointer.y); + } + this._redraw(); +}; + +exports._releaseControlNode = function(pointer) { + var newNode = this._getNodeAt(pointer); + if (newNode != null) { + if (this.edgeBeingEdited.controlNodes.from.selected == true) { + this._editEdge(newNode.id, this.edgeBeingEdited.to.id); + this.edgeBeingEdited.controlNodes.from.unselect(); + } + if (this.edgeBeingEdited.controlNodes.to.selected == true) { + this._editEdge(this.edgeBeingEdited.from.id, newNode.id); + this.edgeBeingEdited.controlNodes.to.unselect(); + } + } + else { + this.edgeBeingEdited._restoreControlNodes(); + } + this.freezeSimulation = false; + this._redraw(); +}; + +/** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @private + */ +exports._handleConnect = function(pointer) { + if (this._getSelectedNodeCount() == 0) { + var node = this._getNodeAt(pointer); + if (node != null) { + if (node.clusterSize > 1) { + alert("Cannot create edges to a cluster.") + } + else { + this._selectObject(node,false); + // create a node the temporary line can look at + this.sectors['support']['nodes']['targetNode'] = new Node({id:'targetNode'},{},{},this.constants); + this.sectors['support']['nodes']['targetNode'].x = node.x; + this.sectors['support']['nodes']['targetNode'].y = node.y; + this.sectors['support']['nodes']['targetViaNode'] = new Node({id:'targetViaNode'},{},{},this.constants); + this.sectors['support']['nodes']['targetViaNode'].x = node.x; + this.sectors['support']['nodes']['targetViaNode'].y = node.y; + this.sectors['support']['nodes']['targetViaNode'].parentEdgeId = "connectionEdge"; + + // create a temporary edge + this.edges['connectionEdge'] = new Edge({id:"connectionEdge",from:node.id,to:this.sectors['support']['nodes']['targetNode'].id}, this, this.constants); + this.edges['connectionEdge'].from = node; + this.edges['connectionEdge'].connected = true; + this.edges['connectionEdge'].smooth = true; + this.edges['connectionEdge'].selected = true; + this.edges['connectionEdge'].to = this.sectors['support']['nodes']['targetNode']; + this.edges['connectionEdge'].via = this.sectors['support']['nodes']['targetViaNode']; + + this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; + this._handleOnDrag = function(event) { + var pointer = this._getPointer(event.gesture.center); + this.sectors['support']['nodes']['targetNode'].x = this._XconvertDOMtoCanvas(pointer.x); + this.sectors['support']['nodes']['targetNode'].y = this._YconvertDOMtoCanvas(pointer.y); + this.sectors['support']['nodes']['targetViaNode'].x = 0.5 * (this._XconvertDOMtoCanvas(pointer.x) + this.edges['connectionEdge'].from.x); + this.sectors['support']['nodes']['targetViaNode'].y = this._YconvertDOMtoCanvas(pointer.y); + }; + + this.moving = true; + this.start(); + } + } + } +}; + +exports._finishConnect = function(pointer) { + if (this._getSelectedNodeCount() == 1) { + + // restore the drag function + this._handleOnDrag = this.cachedFunctions["_handleOnDrag"]; + delete this.cachedFunctions["_handleOnDrag"]; + + // remember the edge id + var connectFromId = this.edges['connectionEdge'].fromId; + + // remove the temporary nodes and edge + delete this.edges['connectionEdge']; + delete this.sectors['support']['nodes']['targetNode']; + delete this.sectors['support']['nodes']['targetViaNode']; + + var node = this._getNodeAt(pointer); + if (node != null) { + if (node.clusterSize > 1) { + alert("Cannot create edges to a cluster.") + } + else { + this._createEdge(connectFromId,node.id); + this._createManipulatorBar(); + } + } + this._unselectAll(); + } +}; + + +/** + * Adds a node on the specified location + */ +exports._addNode = function() { + if (this._selectionIsEmpty() && this.editMode == true) { + var positionObject = this._pointerToPositionObject(this.pointerPosition); + var defaultData = {id:util.randomUUID(),x:positionObject.left,y:positionObject.top,label:"new",allowedToMoveX:true,allowedToMoveY:true}; + if (this.triggerFunctions.add) { + if (this.triggerFunctions.add.length == 2) { + var me = this; + this.triggerFunctions.add(defaultData, function(finalizedData) { + me.nodesData.add(finalizedData); + me._createManipulatorBar(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels['addError']); + this._createManipulatorBar(); + this.moving = true; + this.start(); + } + } + else { + this.nodesData.add(defaultData); + this._createManipulatorBar(); + this.moving = true; + this.start(); + } + } +}; + + +/** + * connect two nodes with a new edge. + * + * @private + */ +exports._createEdge = function(sourceNodeId,targetNodeId) { + if (this.editMode == true) { + var defaultData = {from:sourceNodeId, to:targetNodeId}; + if (this.triggerFunctions.connect) { + if (this.triggerFunctions.connect.length == 2) { + var me = this; + this.triggerFunctions.connect(defaultData, function(finalizedData) { + me.edgesData.add(finalizedData); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["linkError"]); + this.moving = true; + this.start(); + } + } + else { + this.edgesData.add(defaultData); + this.moving = true; + this.start(); + } + } +}; + +/** + * connect two nodes with a new edge. + * + * @private + */ +exports._editEdge = function(sourceNodeId,targetNodeId) { + if (this.editMode == true) { + var defaultData = {id: this.edgeBeingEdited.id, from:sourceNodeId, to:targetNodeId}; + if (this.triggerFunctions.editEdge) { + if (this.triggerFunctions.editEdge.length == 2) { + var me = this; + this.triggerFunctions.editEdge(defaultData, function(finalizedData) { + me.edgesData.update(finalizedData); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["linkError"]); + this.moving = true; + this.start(); + } + } + else { + this.edgesData.update(defaultData); + this.moving = true; + this.start(); + } + } +}; + +/** + * Create the toolbar to edit the selected node. The label and the color can be changed. Other colors are derived from the chosen color. + * + * @private + */ +exports._editNode = function() { + if (this.triggerFunctions.edit && this.editMode == true) { + var node = this._getSelectedNode(); + var data = {id:node.id, + label: node.label, + group: node.group, + shape: node.shape, + color: { + background:node.color.background, + border:node.color.border, + highlight: { + background:node.color.highlight.background, + border:node.color.highlight.border + } + }}; + if (this.triggerFunctions.edit.length == 2) { + var me = this; + this.triggerFunctions.edit(data, function (finalizedData) { + me.nodesData.update(finalizedData); + me._createManipulatorBar(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["editError"]); + } + } + else { + alert(this.constants.labels["editBoundError"]); + } +}; + + + + +/** + * delete everything in the selection + * + * @private + */ +exports._deleteSelected = function() { + if (!this._selectionIsEmpty() && this.editMode == true) { + if (!this._clusterInSelection()) { + var selectedNodes = this.getSelectedNodes(); + var selectedEdges = this.getSelectedEdges(); + if (this.triggerFunctions.del) { + var me = this; + var data = {nodes: selectedNodes, edges: selectedEdges}; + if (this.triggerFunctions.del.length = 2) { + this.triggerFunctions.del(data, function (finalizedData) { + me.edgesData.remove(finalizedData.edges); + me.nodesData.remove(finalizedData.nodes); + me._unselectAll(); + me.moving = true; + me.start(); + }); + } + else { + alert(this.constants.labels["deleteError"]) + } + } + else { + this.edgesData.remove(selectedEdges); + this.nodesData.remove(selectedNodes); + this._unselectAll(); + this.moving = true; + this.start(); + } + } + else { + alert(this.constants.labels["deleteClusterError"]); + } + } +}; diff --git a/lib/network/mixins/MixinLoader.js b/lib/network/mixins/MixinLoader.js new file mode 100644 index 00000000..f6970030 --- /dev/null +++ b/lib/network/mixins/MixinLoader.js @@ -0,0 +1,198 @@ +var PhysicsMixin = require('./physics/PhysicsMixin'); +var ClusterMixin = require('./ClusterMixin'); +var SectorsMixin = require('./SectorsMixin'); +var SelectionMixin = require('./SelectionMixin'); +var ManipulationMixin = require('./ManipulationMixin'); +var NavigationMixin = require('./NavigationMixin'); +var HierarchicalLayoutMixin = require('./HierarchicalLayoutMixin'); + +/** + * Load a mixin into the network object + * + * @param {Object} sourceVariable | this object has to contain functions. + * @private + */ +exports._loadMixin = function (sourceVariable) { + for (var mixinFunction in sourceVariable) { + if (sourceVariable.hasOwnProperty(mixinFunction)) { + this[mixinFunction] = sourceVariable[mixinFunction]; + } + } +}; + + +/** + * removes a mixin from the network object. + * + * @param {Object} sourceVariable | this object has to contain functions. + * @private + */ +exports._clearMixin = function (sourceVariable) { + for (var mixinFunction in sourceVariable) { + if (sourceVariable.hasOwnProperty(mixinFunction)) { + this[mixinFunction] = undefined; + } + } +}; + + +/** + * Mixin the physics system and initialize the parameters required. + * + * @private + */ +exports._loadPhysicsSystem = function () { + this._loadMixin(PhysicsMixin); + this._loadSelectedForceSolver(); + if (this.constants.configurePhysics == true) { + this._loadPhysicsConfiguration(); + } +}; + + +/** + * Mixin the cluster system and initialize the parameters required. + * + * @private + */ +exports._loadClusterSystem = function () { + this.clusterSession = 0; + this.hubThreshold = 5; + this._loadMixin(ClusterMixin); +}; + + +/** + * Mixin the sector system and initialize the parameters required + * + * @private + */ +exports._loadSectorSystem = function () { + this.sectors = {}; + this.activeSector = ["default"]; + this.sectors["active"] = {}; + this.sectors["active"]["default"] = {"nodes": {}, + "edges": {}, + "nodeIndices": [], + "formationScale": 1.0, + "drawingNode": undefined }; + this.sectors["frozen"] = {}; + this.sectors["support"] = {"nodes": {}, + "edges": {}, + "nodeIndices": [], + "formationScale": 1.0, + "drawingNode": undefined }; + + this.nodeIndices = this.sectors["active"]["default"]["nodeIndices"]; // the node indices list is used to speed up the computation of the repulsion fields + + this._loadMixin(SectorsMixin); +}; + + +/** + * Mixin the selection system and initialize the parameters required + * + * @private + */ +exports._loadSelectionSystem = function () { + this.selectionObj = {nodes: {}, edges: {}}; + + this._loadMixin(SelectionMixin); +}; + + +/** + * Mixin the navigationUI (User Interface) system and initialize the parameters required + * + * @private + */ +exports._loadManipulationSystem = function () { + // reset global variables -- these are used by the selection of nodes and edges. + this.blockConnectingEdgeSelection = false; + this.forceAppendSelection = false; + + if (this.constants.dataManipulation.enabled == true) { + // load the manipulator HTML elements. All styling done in css. + if (this.manipulationDiv === undefined) { + this.manipulationDiv = document.createElement('div'); + this.manipulationDiv.className = 'network-manipulationDiv'; + this.manipulationDiv.id = 'network-manipulationDiv'; + if (this.editMode == true) { + this.manipulationDiv.style.display = "block"; + } + else { + this.manipulationDiv.style.display = "none"; + } + this.containerElement.insertBefore(this.manipulationDiv, this.frame); + } + + if (this.editModeDiv === undefined) { + this.editModeDiv = document.createElement('div'); + this.editModeDiv.className = 'network-manipulation-editMode'; + this.editModeDiv.id = 'network-manipulation-editMode'; + if (this.editMode == true) { + this.editModeDiv.style.display = "none"; + } + else { + this.editModeDiv.style.display = "block"; + } + this.containerElement.insertBefore(this.editModeDiv, this.frame); + } + + if (this.closeDiv === undefined) { + this.closeDiv = document.createElement('div'); + this.closeDiv.className = 'network-manipulation-closeDiv'; + this.closeDiv.id = 'network-manipulation-closeDiv'; + this.closeDiv.style.display = this.manipulationDiv.style.display; + this.containerElement.insertBefore(this.closeDiv, this.frame); + } + + // load the manipulation functions + this._loadMixin(ManipulationMixin); + + // create the manipulator toolbar + this._createManipulatorBar(); + } + else { + if (this.manipulationDiv !== undefined) { + // removes all the bindings and overloads + this._createManipulatorBar(); + // remove the manipulation divs + this.containerElement.removeChild(this.manipulationDiv); + this.containerElement.removeChild(this.editModeDiv); + this.containerElement.removeChild(this.closeDiv); + + this.manipulationDiv = undefined; + this.editModeDiv = undefined; + this.closeDiv = undefined; + // remove the mixin functions + this._clearMixin(ManipulationMixin); + } + } +}; + + +/** + * Mixin the navigation (User Interface) system and initialize the parameters required + * + * @private + */ +exports._loadNavigationControls = function () { + this._loadMixin(NavigationMixin); + + // the clean function removes the button divs, this is done to remove the bindings. + this._cleanNavigation(); + if (this.constants.navigation.enabled == true) { + this._loadNavigationElements(); + } +}; + + +/** + * Mixin the hierarchical layout system. + * + * @private + */ +exports._loadHierarchySystem = function () { + this._loadMixin(HierarchicalLayoutMixin); +}; diff --git a/lib/network/mixins/NavigationMixin.js b/lib/network/mixins/NavigationMixin.js new file mode 100644 index 00000000..24ca4195 --- /dev/null +++ b/lib/network/mixins/NavigationMixin.js @@ -0,0 +1,181 @@ +var util = require('../../util'); + +exports._cleanNavigation = function() { + // clean up previous navigation items + var wrapper = document.getElementById('network-navigation_wrapper'); + if (wrapper != null) { + this.containerElement.removeChild(wrapper); + } + document.onmouseup = null; +}; + +/** + * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation + * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent + * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. + * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. + * + * @private + */ +exports._loadNavigationElements = function() { + this._cleanNavigation(); + + this.navigationDivs = {}; + var navigationDivs = ['up','down','left','right','zoomIn','zoomOut','zoomExtends']; + var navigationDivActions = ['_moveUp','_moveDown','_moveLeft','_moveRight','_zoomIn','_zoomOut','zoomExtent']; + + this.navigationDivs['wrapper'] = document.createElement('div'); + this.navigationDivs['wrapper'].id = "network-navigation_wrapper"; + this.navigationDivs['wrapper'].style.position = "absolute"; + this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; + this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; + this.containerElement.insertBefore(this.navigationDivs['wrapper'],this.frame); + + for (var i = 0; i < navigationDivs.length; i++) { + this.navigationDivs[navigationDivs[i]] = document.createElement('div'); + this.navigationDivs[navigationDivs[i]].id = "network-navigation_" + navigationDivs[i]; + this.navigationDivs[navigationDivs[i]].className = "network-navigation " + navigationDivs[i]; + this.navigationDivs['wrapper'].appendChild(this.navigationDivs[navigationDivs[i]]); + this.navigationDivs[navigationDivs[i]].onmousedown = this[navigationDivActions[i]].bind(this); + } + + document.onmouseup = this._stopMovement.bind(this); +}; + +/** + * this stops all movement induced by the navigation buttons + * + * @private + */ +exports._stopMovement = function() { + this._xStopMoving(); + this._yStopMoving(); + this._stopZoom(); +}; + + +/** + * move the screen up + * By using the increments, instead of adding a fixed number to the translation, we keep fluent and + * instant movement. The onKeypress event triggers immediately, then pauses, then triggers frequently + * To avoid this behaviour, we do the translation in the start loop. + * + * @private + */ +exports._moveUp = function(event) { + this.yIncrement = this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['up'].className += " active"; + } +}; + + +/** + * move the screen down + * @private + */ +exports._moveDown = function(event) { + this.yIncrement = -this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['down'].className += " active"; + } +}; + + +/** + * move the screen left + * @private + */ +exports._moveLeft = function(event) { + this.xIncrement = this.constants.keyboard.speed.x; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['left'].className += " active"; + } +}; + + +/** + * move the screen right + * @private + */ +exports._moveRight = function(event) { + this.xIncrement = -this.constants.keyboard.speed.y; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['right'].className += " active"; + } +}; + + +/** + * Zoom in, using the same method as the movement. + * @private + */ +exports._zoomIn = function(event) { + this.zoomIncrement = this.constants.keyboard.speed.zoom; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['zoomIn'].className += " active"; + } +}; + + +/** + * Zoom out + * @private + */ +exports._zoomOut = function() { + this.zoomIncrement = -this.constants.keyboard.speed.zoom; + this.start(); // if there is no node movement, the calculation wont be done + util.preventDefault(event); + if (this.navigationDivs) { + this.navigationDivs['zoomOut'].className += " active"; + } +}; + + +/** + * Stop zooming and unhighlight the zoom controls + * @private + */ +exports._stopZoom = function() { + this.zoomIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['zoomIn'].className = this.navigationDivs['zoomIn'].className.replace(" active",""); + this.navigationDivs['zoomOut'].className = this.navigationDivs['zoomOut'].className.replace(" active",""); + } +}; + + +/** + * Stop moving in the Y direction and unHighlight the up and down + * @private + */ +exports._yStopMoving = function() { + this.yIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['up'].className = this.navigationDivs['up'].className.replace(" active",""); + this.navigationDivs['down'].className = this.navigationDivs['down'].className.replace(" active",""); + } +}; + + +/** + * Stop moving in the X direction and unHighlight left and right. + * @private + */ +exports._xStopMoving = function() { + this.xIncrement = 0; + if (this.navigationDivs) { + this.navigationDivs['left'].className = this.navigationDivs['left'].className.replace(" active",""); + this.navigationDivs['right'].className = this.navigationDivs['right'].className.replace(" active",""); + } +}; diff --git a/lib/network/mixins/SectorsMixin.js b/lib/network/mixins/SectorsMixin.js new file mode 100644 index 00000000..03e0075a --- /dev/null +++ b/lib/network/mixins/SectorsMixin.js @@ -0,0 +1,548 @@ +var util = require('../../util'); + +/** + * Creation of the SectorMixin var. + * + * This contains all the functions the Network object can use to employ the sector system. + * The sector system is always used by Network, though the benefits only apply to the use of clustering. + * If clustering is not used, there is no overhead except for a duplicate object with references to nodes and edges. + */ + +/** + * This function is only called by the setData function of the Network object. + * This loads the global references into the active sector. This initializes the sector. + * + * @private + */ +exports._putDataInSector = function() { + this.sectors["active"][this._sector()].nodes = this.nodes; + this.sectors["active"][this._sector()].edges = this.edges; + this.sectors["active"][this._sector()].nodeIndices = this.nodeIndices; +}; + + +/** + * /** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied (active) sector. If a type is defined, do the specific type + * + * @param {String} sectorId + * @param {String} [sectorType] | "active" or "frozen" + * @private + */ +exports._switchToSector = function(sectorId, sectorType) { + if (sectorType === undefined || sectorType == "active") { + this._switchToActiveSector(sectorId); + } + else { + this._switchToFrozenSector(sectorId); + } +}; + + +/** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied active sector. + * + * @param sectorId + * @private + */ +exports._switchToActiveSector = function(sectorId) { + this.nodeIndices = this.sectors["active"][sectorId]["nodeIndices"]; + this.nodes = this.sectors["active"][sectorId]["nodes"]; + this.edges = this.sectors["active"][sectorId]["edges"]; +}; + + +/** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied active sector. + * + * @private + */ +exports._switchToSupportSector = function() { + this.nodeIndices = this.sectors["support"]["nodeIndices"]; + this.nodes = this.sectors["support"]["nodes"]; + this.edges = this.sectors["support"]["edges"]; +}; + + +/** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the supplied frozen sector. + * + * @param sectorId + * @private + */ +exports._switchToFrozenSector = function(sectorId) { + this.nodeIndices = this.sectors["frozen"][sectorId]["nodeIndices"]; + this.nodes = this.sectors["frozen"][sectorId]["nodes"]; + this.edges = this.sectors["frozen"][sectorId]["edges"]; +}; + + +/** + * This function sets the global references to nodes, edges and nodeIndices back to + * those of the currently active sector. + * + * @private + */ +exports._loadLatestSector = function() { + this._switchToSector(this._sector()); +}; + + +/** + * This function returns the currently active sector Id + * + * @returns {String} + * @private + */ +exports._sector = function() { + return this.activeSector[this.activeSector.length-1]; +}; + + +/** + * This function returns the previously active sector Id + * + * @returns {String} + * @private + */ +exports._previousSector = function() { + if (this.activeSector.length > 1) { + return this.activeSector[this.activeSector.length-2]; + } + else { + throw new TypeError('there are not enough sectors in the this.activeSector array.'); + } +}; + + +/** + * We add the active sector at the end of the this.activeSector array + * This ensures it is the currently active sector returned by _sector() and it reaches the top + * of the activeSector stack. When we reverse our steps we move from the end to the beginning of this stack. + * + * @param newId + * @private + */ +exports._setActiveSector = function(newId) { + this.activeSector.push(newId); +}; + + +/** + * We remove the currently active sector id from the active sector stack. This happens when + * we reactivate the previously active sector + * + * @private + */ +exports._forgetLastSector = function() { + this.activeSector.pop(); +}; + + +/** + * This function creates a new active sector with the supplied newId. This newId + * is the expanding node id. + * + * @param {String} newId | Id of the new active sector + * @private + */ +exports._createNewSector = function(newId) { + // create the new sector + this.sectors["active"][newId] = {"nodes":{}, + "edges":{}, + "nodeIndices":[], + "formationScale": this.scale, + "drawingNode": undefined}; + + // create the new sector render node. This gives visual feedback that you are in a new sector. + this.sectors["active"][newId]['drawingNode'] = new Node( + {id:newId, + color: { + background: "#eaefef", + border: "495c5e" + } + },{},{},this.constants); + this.sectors["active"][newId]['drawingNode'].clusterSize = 2; +}; + + +/** + * This function removes the currently active sector. This is called when we create a new + * active sector. + * + * @param {String} sectorId | Id of the active sector that will be removed + * @private + */ +exports._deleteActiveSector = function(sectorId) { + delete this.sectors["active"][sectorId]; +}; + + +/** + * This function removes the currently active sector. This is called when we reactivate + * the previously active sector. + * + * @param {String} sectorId | Id of the active sector that will be removed + * @private + */ +exports._deleteFrozenSector = function(sectorId) { + delete this.sectors["frozen"][sectorId]; +}; + + +/** + * Freezing an active sector means moving it from the "active" object to the "frozen" object. + * We copy the references, then delete the active entree. + * + * @param sectorId + * @private + */ +exports._freezeSector = function(sectorId) { + // we move the set references from the active to the frozen stack. + this.sectors["frozen"][sectorId] = this.sectors["active"][sectorId]; + + // we have moved the sector data into the frozen set, we now remove it from the active set + this._deleteActiveSector(sectorId); +}; + + +/** + * This is the reverse operation of _freezeSector. Activating means moving the sector from the "frozen" + * object to the "active" object. + * + * @param sectorId + * @private + */ +exports._activateSector = function(sectorId) { + // we move the set references from the frozen to the active stack. + this.sectors["active"][sectorId] = this.sectors["frozen"][sectorId]; + + // we have moved the sector data into the active set, we now remove it from the frozen stack + this._deleteFrozenSector(sectorId); +}; + + +/** + * This function merges the data from the currently active sector with a frozen sector. This is used + * in the process of reverting back to the previously active sector. + * The data that is placed in the frozen (the previously active) sector is the node that has been removed from it + * upon the creation of a new active sector. + * + * @param sectorId + * @private + */ +exports._mergeThisWithFrozen = function(sectorId) { + // copy all nodes + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.sectors["frozen"][sectorId]["nodes"][nodeId] = this.nodes[nodeId]; + } + } + + // copy all edges (if not fully clustered, else there are no edges) + for (var edgeId in this.edges) { + if (this.edges.hasOwnProperty(edgeId)) { + this.sectors["frozen"][sectorId]["edges"][edgeId] = this.edges[edgeId]; + } + } + + // merge the nodeIndices + for (var i = 0; i < this.nodeIndices.length; i++) { + this.sectors["frozen"][sectorId]["nodeIndices"].push(this.nodeIndices[i]); + } +}; + + +/** + * This clusters the sector to one cluster. It was a single cluster before this process started so + * we revert to that state. The clusterToFit function with a maximum size of 1 node does this. + * + * @private + */ +exports._collapseThisToSingleCluster = function() { + this.clusterToFit(1,false); +}; + + +/** + * We create a new active sector from the node that we want to open. + * + * @param node + * @private + */ +exports._addSector = function(node) { + // this is the currently active sector + var sector = this._sector(); + +// // this should allow me to select nodes from a frozen set. +// if (this.sectors['active'][sector]["nodes"].hasOwnProperty(node.id)) { +// console.log("the node is part of the active sector"); +// } +// else { +// console.log("I dont know what the fuck happened!!"); +// } + + // when we switch to a new sector, we remove the node that will be expanded from the current nodes list. + delete this.nodes[node.id]; + + var unqiueIdentifier = util.randomUUID(); + + // we fully freeze the currently active sector + this._freezeSector(sector); + + // we create a new active sector. This sector has the Id of the node to ensure uniqueness + this._createNewSector(unqiueIdentifier); + + // we add the active sector to the sectors array to be able to revert these steps later on + this._setActiveSector(unqiueIdentifier); + + // we redirect the global references to the new sector's references. this._sector() now returns unqiueIdentifier + this._switchToSector(this._sector()); + + // finally we add the node we removed from our previous active sector to the new active sector + this.nodes[node.id] = node; +}; + + +/** + * We close the sector that is currently open and revert back to the one before. + * If the active sector is the "default" sector, nothing happens. + * + * @private + */ +exports._collapseSector = function() { + // the currently active sector + var sector = this._sector(); + + // we cannot collapse the default sector + if (sector != "default") { + if ((this.nodeIndices.length == 1) || + (this.sectors["active"][sector]["drawingNode"].width*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || + (this.sectors["active"][sector]["drawingNode"].height*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { + var previousSector = this._previousSector(); + + // we collapse the sector back to a single cluster + this._collapseThisToSingleCluster(); + + // we move the remaining nodes, edges and nodeIndices to the previous sector. + // This previous sector is the one we will reactivate + this._mergeThisWithFrozen(previousSector); + + // the previously active (frozen) sector now has all the data from the currently active sector. + // we can now delete the active sector. + this._deleteActiveSector(sector); + + // we activate the previously active (and currently frozen) sector. + this._activateSector(previousSector); + + // we load the references from the newly active sector into the global references + this._switchToSector(previousSector); + + // we forget the previously active sector because we reverted to the one before + this._forgetLastSector(); + + // finally, we update the node index list. + this._updateNodeIndexList(); + + // we refresh the list with calulation nodes and calculation node indices. + this._updateCalculationNodes(); + } + } +}; + + +/** + * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we dont pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ +exports._doInAllActiveSectors = function(runFunction,argument) { + if (argument === undefined) { + for (var sector in this.sectors["active"]) { + if (this.sectors["active"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToActiveSector(sector); + this[runFunction](); + } + } + } + else { + for (var sector in this.sectors["active"]) { + if (this.sectors["active"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToActiveSector(sector); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } + } + } + } + // we revert the global references back to our active sector + this._loadLatestSector(); +}; + + +/** + * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we dont pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ +exports._doInSupportSector = function(runFunction,argument) { + if (argument === undefined) { + this._switchToSupportSector(); + this[runFunction](); + } + else { + this._switchToSupportSector(); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } + } + // we revert the global references back to our active sector + this._loadLatestSector(); +}; + + +/** + * This runs a function in all frozen sectors. This is used in the _redraw(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we don't pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ +exports._doInAllFrozenSectors = function(runFunction,argument) { + if (argument === undefined) { + for (var sector in this.sectors["frozen"]) { + if (this.sectors["frozen"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToFrozenSector(sector); + this[runFunction](); + } + } + } + else { + for (var sector in this.sectors["frozen"]) { + if (this.sectors["frozen"].hasOwnProperty(sector)) { + // switch the global references to those of this sector + this._switchToFrozenSector(sector); + var args = Array.prototype.splice.call(arguments, 1); + if (args.length > 1) { + this[runFunction](args[0],args[1]); + } + else { + this[runFunction](argument); + } + } + } + } + this._loadLatestSector(); +}; + + +/** + * This runs a function in all sectors. This is used in the _redraw(). + * + * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors + * | we don't pass the function itself because then the "this" is the window object + * | instead of the Network object + * @param {*} [argument] | Optional: arguments to pass to the runFunction + * @private + */ +exports._doInAllSectors = function(runFunction,argument) { + var args = Array.prototype.splice.call(arguments, 1); + if (argument === undefined) { + this._doInAllActiveSectors(runFunction); + this._doInAllFrozenSectors(runFunction); + } + else { + if (args.length > 1) { + this._doInAllActiveSectors(runFunction,args[0],args[1]); + this._doInAllFrozenSectors(runFunction,args[0],args[1]); + } + else { + this._doInAllActiveSectors(runFunction,argument); + this._doInAllFrozenSectors(runFunction,argument); + } + } +}; + + +/** + * This clears the nodeIndices list. We cannot use this.nodeIndices = [] because we would break the link with the + * active sector. Thus we clear the nodeIndices in the active sector, then reconnect the this.nodeIndices to it. + * + * @private + */ +exports._clearNodeIndexList = function() { + var sector = this._sector(); + this.sectors["active"][sector]["nodeIndices"] = []; + this.nodeIndices = this.sectors["active"][sector]["nodeIndices"]; +}; + + +/** + * Draw the encompassing sector node + * + * @param ctx + * @param sectorType + * @private + */ +exports._drawSectorNodes = function(ctx,sectorType) { + var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; + for (var sector in this.sectors[sectorType]) { + if (this.sectors[sectorType].hasOwnProperty(sector)) { + if (this.sectors[sectorType][sector]["drawingNode"] !== undefined) { + + this._switchToSector(sector,sectorType); + + minY = 1e9; maxY = -1e9; minX = 1e9; maxX = -1e9; + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + node = this.nodes[nodeId]; + node.resize(ctx); + if (minX > node.x - 0.5 * node.width) {minX = node.x - 0.5 * node.width;} + if (maxX < node.x + 0.5 * node.width) {maxX = node.x + 0.5 * node.width;} + if (minY > node.y - 0.5 * node.height) {minY = node.y - 0.5 * node.height;} + if (maxY < node.y + 0.5 * node.height) {maxY = node.y + 0.5 * node.height;} + } + } + node = this.sectors[sectorType][sector]["drawingNode"]; + node.x = 0.5 * (maxX + minX); + node.y = 0.5 * (maxY + minY); + node.width = 2 * (node.x - minX); + node.height = 2 * (node.y - minY); + node.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2)); + node.setScale(this.scale); + node._drawCircle(ctx); + } + } + } +}; + +exports._drawAllSectorNodes = function(ctx) { + this._drawSectorNodes(ctx,"frozen"); + this._drawSectorNodes(ctx,"active"); + this._loadLatestSector(); +}; diff --git a/lib/network/mixins/SelectionMixin.js b/lib/network/mixins/SelectionMixin.js new file mode 100644 index 00000000..0a02d238 --- /dev/null +++ b/lib/network/mixins/SelectionMixin.js @@ -0,0 +1,705 @@ +var Node = require('../Node'); + +/** + * This function can be called from the _doInAllSectors function + * + * @param object + * @param overlappingNodes + * @private + */ +exports._getNodesOverlappingWith = function(object, overlappingNodes) { + var nodes = this.nodes; + for (var nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + if (nodes[nodeId].isOverlappingWith(object)) { + overlappingNodes.push(nodeId); + } + } + } +}; + +/** + * retrieve all nodes overlapping with given object + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ +exports._getAllNodesOverlappingWith = function (object) { + var overlappingNodes = []; + this._doInAllActiveSectors("_getNodesOverlappingWith",object,overlappingNodes); + return overlappingNodes; +}; + + +/** + * Return a position object in canvasspace from a single point in screenspace + * + * @param pointer + * @returns {{left: number, top: number, right: number, bottom: number}} + * @private + */ +exports._pointerToPositionObject = function(pointer) { + var x = this._XconvertDOMtoCanvas(pointer.x); + var y = this._YconvertDOMtoCanvas(pointer.y); + + return { + left: x, + top: y, + right: x, + bottom: y + }; +}; + + +/** + * Get the top node at the a specific point (like a click) + * + * @param {{x: Number, y: Number}} pointer + * @return {Node | null} node + * @private + */ +exports._getNodeAt = function (pointer) { + // we first check if this is an navigation controls element + var positionObject = this._pointerToPositionObject(pointer); + var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); + + // if there are overlapping nodes, select the last one, this is the + // one which is drawn on top of the others + if (overlappingNodes.length > 0) { + return this.nodes[overlappingNodes[overlappingNodes.length - 1]]; + } + else { + return null; + } +}; + + +/** + * retrieve all edges overlapping with given object, selector is around center + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ +exports._getEdgesOverlappingWith = function (object, overlappingEdges) { + var edges = this.edges; + for (var edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + if (edges[edgeId].isOverlappingWith(object)) { + overlappingEdges.push(edgeId); + } + } + } +}; + + +/** + * retrieve all nodes overlapping with given object + * @param {Object} object An object with parameters left, top, right, bottom + * @return {Number[]} An array with id's of the overlapping nodes + * @private + */ +exports._getAllEdgesOverlappingWith = function (object) { + var overlappingEdges = []; + this._doInAllActiveSectors("_getEdgesOverlappingWith",object,overlappingEdges); + return overlappingEdges; +}; + +/** + * Place holder. To implement change the _getNodeAt to a _getObjectAt. Have the _getObjectAt call + * _getNodeAt and _getEdgesAt, then priortize the selection to user preferences. + * + * @param pointer + * @returns {null} + * @private + */ +exports._getEdgeAt = function(pointer) { + var positionObject = this._pointerToPositionObject(pointer); + var overlappingEdges = this._getAllEdgesOverlappingWith(positionObject); + + if (overlappingEdges.length > 0) { + return this.edges[overlappingEdges[overlappingEdges.length - 1]]; + } + else { + return null; + } +}; + + +/** + * Add object to the selection array. + * + * @param obj + * @private + */ +exports._addToSelection = function(obj) { + if (obj instanceof Node) { + this.selectionObj.nodes[obj.id] = obj; + } + else { + this.selectionObj.edges[obj.id] = obj; + } +}; + +/** + * Add object to the selection array. + * + * @param obj + * @private + */ +exports._addToHover = function(obj) { + if (obj instanceof Node) { + this.hoverObj.nodes[obj.id] = obj; + } + else { + this.hoverObj.edges[obj.id] = obj; + } +}; + + +/** + * Remove a single option from selection. + * + * @param {Object} obj + * @private + */ +exports._removeFromSelection = function(obj) { + if (obj instanceof Node) { + delete this.selectionObj.nodes[obj.id]; + } + else { + delete this.selectionObj.edges[obj.id]; + } +}; + +/** + * Unselect all. The selectionObj is useful for this. + * + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ +exports._unselectAll = function(doNotTrigger) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + this.selectionObj.nodes[nodeId].unselect(); + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + this.selectionObj.edges[edgeId].unselect(); + } + } + + this.selectionObj = {nodes:{},edges:{}}; + + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } +}; + +/** + * Unselect all clusters. The selectionObj is useful for this. + * + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ +exports._unselectClusters = function(doNotTrigger) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (this.selectionObj.nodes[nodeId].clusterSize > 1) { + this.selectionObj.nodes[nodeId].unselect(); + this._removeFromSelection(this.selectionObj.nodes[nodeId]); + } + } + } + + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } +}; + + +/** + * return the number of selected nodes + * + * @returns {number} + * @private + */ +exports._getSelectedNodeCount = function() { + var count = 0; + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + return count; +}; + +/** + * return the selected node + * + * @returns {number} + * @private + */ +exports._getSelectedNode = function() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return this.selectionObj.nodes[nodeId]; + } + } + return null; +}; + +/** + * return the selected edge + * + * @returns {number} + * @private + */ +exports._getSelectedEdge = function() { + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + return this.selectionObj.edges[edgeId]; + } + } + return null; +}; + + +/** + * return the number of selected edges + * + * @returns {number} + * @private + */ +exports._getSelectedEdgeCount = function() { + var count = 0; + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; +}; + + +/** + * return the number of selected objects. + * + * @returns {number} + * @private + */ +exports._getSelectedObjectCount = function() { + var count = 0; + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; +}; + +/** + * Check if anything is selected + * + * @returns {boolean} + * @private + */ +exports._selectionIsEmpty = function() { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return false; + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + return false; + } + } + return true; +}; + + +/** + * check if one of the selected nodes is a cluster. + * + * @returns {boolean} + * @private + */ +exports._clusterInSelection = function() { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (this.selectionObj.nodes[nodeId].clusterSize > 1) { + return true; + } + } + } + return false; +}; + +/** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ +exports._selectConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.select(); + this._addToSelection(edge); + } +}; + +/** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ +exports._hoverConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.hover = true; + this._addToHover(edge); + } +}; + + +/** + * unselect the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ +exports._unselectConnectedEdges = function(node) { + for (var i = 0; i < node.dynamicEdges.length; i++) { + var edge = node.dynamicEdges[i]; + edge.unselect(); + this._removeFromSelection(edge); + } +}; + + + + +/** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @param {Boolean} append + * @param {Boolean} [doNotTrigger] | ignore trigger + * @private + */ +exports._selectObject = function(object, append, doNotTrigger, highlightEdges) { + if (doNotTrigger === undefined) { + doNotTrigger = false; + } + if (highlightEdges === undefined) { + highlightEdges = true; + } + + if (this._selectionIsEmpty() == false && append == false && this.forceAppendSelection == false) { + this._unselectAll(true); + } + + if (object.selected == false) { + object.select(); + this._addToSelection(object); + if (object instanceof Node && this.blockConnectingEdgeSelection == false && highlightEdges == true) { + this._selectConnectedEdges(object); + } + } + else { + object.unselect(); + this._removeFromSelection(object); + } + + if (doNotTrigger == false) { + this.emit('select', this.getSelection()); + } +}; + + +/** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @private + */ +exports._blurObject = function(object) { + if (object.hover == true) { + object.hover = false; + this.emit("blurNode",{node:object.id}); + } +}; + +/** + * This is called when someone clicks on a node. either select or deselect it. + * If there is an existing selection and we don't want to append to it, clear the existing selection + * + * @param {Node || Edge} object + * @private + */ +exports._hoverObject = function(object) { + if (object.hover == false) { + object.hover = true; + this._addToHover(object); + if (object instanceof Node) { + this.emit("hoverNode",{node:object.id}); + } + } + if (object instanceof Node) { + this._hoverConnectedEdges(object); + } +}; + + +/** + * handles the selection part of the touch, only for navigation controls elements; + * Touch is triggered before tap, also before hold. Hold triggers after a while. + * This is the most responsive solution + * + * @param {Object} pointer + * @private + */ +exports._handleTouch = function(pointer) { +}; + + +/** + * handles the selection part of the tap; + * + * @param {Object} pointer + * @private + */ +exports._handleTap = function(pointer) { + var node = this._getNodeAt(pointer); + if (node != null) { + this._selectObject(node,false); + } + else { + var edge = this._getEdgeAt(pointer); + if (edge != null) { + this._selectObject(edge,false); + } + else { + this._unselectAll(); + } + } + this.emit("click", this.getSelection()); + this._redraw(); +}; + + +/** + * handles the selection part of the double tap and opens a cluster if needed + * + * @param {Object} pointer + * @private + */ +exports._handleDoubleTap = function(pointer) { + var node = this._getNodeAt(pointer); + if (node != null && node !== undefined) { + // we reset the areaCenter here so the opening of the node will occur + this.areaCenter = {"x" : this._XconvertDOMtoCanvas(pointer.x), + "y" : this._YconvertDOMtoCanvas(pointer.y)}; + this.openCluster(node); + } + this.emit("doubleClick", this.getSelection()); +}; + + +/** + * Handle the onHold selection part + * + * @param pointer + * @private + */ +exports._handleOnHold = function(pointer) { + var node = this._getNodeAt(pointer); + if (node != null) { + this._selectObject(node,true); + } + else { + var edge = this._getEdgeAt(pointer); + if (edge != null) { + this._selectObject(edge,true); + } + } + this._redraw(); +}; + + +/** + * handle the onRelease event. These functions are here for the navigation controls module. + * + * @private + */ +exports._handleOnRelease = function(pointer) { + +}; + + + +/** + * + * retrieve the currently selected objects + * @return {{nodes: Array., edges: Array.}} selection + */ +exports.getSelection = function() { + var nodeIds = this.getSelectedNodes(); + var edgeIds = this.getSelectedEdges(); + return {nodes:nodeIds, edges:edgeIds}; +}; + +/** + * + * retrieve the currently selected nodes + * @return {String[]} selection An array with the ids of the + * selected nodes. + */ +exports.getSelectedNodes = function() { + var idArray = []; + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + idArray.push(nodeId); + } + } + return idArray +}; + +/** + * + * retrieve the currently selected edges + * @return {Array} selection An array with the ids of the + * selected nodes. + */ +exports.getSelectedEdges = function() { + var idArray = []; + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + idArray.push(edgeId); + } + } + return idArray; +}; + + +/** + * select zero or more nodes + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + */ +exports.setSelection = function(selection) { + var i, iMax, id; + + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; + + // first unselect any selected node + this._unselectAll(true); + + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; + + var node = this.nodes[id]; + if (!node) { + throw new RangeError('Node with id "' + id + '" not found'); + } + this._selectObject(node,true,true); + } + + console.log("setSelection is deprecated. Please use selectNodes instead.") + + this.redraw(); +}; + + +/** + * select zero or more nodes with the option to highlight edges + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + * @param {boolean} [highlightEdges] + */ +exports.selectNodes = function(selection, highlightEdges) { + var i, iMax, id; + + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; + + // first unselect any selected node + this._unselectAll(true); + + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; + + var node = this.nodes[id]; + if (!node) { + throw new RangeError('Node with id "' + id + '" not found'); + } + this._selectObject(node,true,true,highlightEdges); + } + this.redraw(); +}; + + +/** + * select zero or more edges + * @param {Number[] | String[]} selection An array with the ids of the + * selected nodes. + */ +exports.selectEdges = function(selection) { + var i, iMax, id; + + if (!selection || (selection.length == undefined)) + throw 'Selection must be an array with ids'; + + // first unselect any selected node + this._unselectAll(true); + + for (i = 0, iMax = selection.length; i < iMax; i++) { + id = selection[i]; + + var edge = this.edges[id]; + if (!edge) { + throw new RangeError('Edge with id "' + id + '" not found'); + } + this._selectObject(edge,true,true,highlightEdges); + } + this.redraw(); +}; + +/** + * Validate the selection: remove ids of nodes which no longer exist + * @private + */ +exports._updateSelection = function () { + for(var nodeId in this.selectionObj.nodes) { + if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (!this.nodes.hasOwnProperty(nodeId)) { + delete this.selectionObj.nodes[nodeId]; + } + } + } + for(var edgeId in this.selectionObj.edges) { + if(this.selectionObj.edges.hasOwnProperty(edgeId)) { + if (!this.edges.hasOwnProperty(edgeId)) { + delete this.selectionObj.edges[edgeId]; + } + } + } +}; diff --git a/lib/network/mixins/physics/BarnesHutMixin.js b/lib/network/mixins/physics/BarnesHutMixin.js new file mode 100644 index 00000000..f1e11a9a --- /dev/null +++ b/lib/network/mixins/physics/BarnesHutMixin.js @@ -0,0 +1,393 @@ +/** + * This function calculates the forces the nodes apply on eachother based on a gravitational model. + * The Barnes Hut method is used to speed up this N-body simulation. + * + * @private + */ +exports._calculateNodeForces = function() { + if (this.constants.physics.barnesHut.gravitationalConstant != 0) { + var node; + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + var nodeCount = nodeIndices.length; + + this._formBarnesHutTree(nodes,nodeIndices); + + var barnesHutTree = this.barnesHutTree; + + // place the nodes one by one recursively + for (var i = 0; i < nodeCount; i++) { + node = nodes[nodeIndices[i]]; + // starting with root is irrelevant, it never passes the BarnesHut condition + this._getForceContribution(barnesHutTree.root.children.NW,node); + this._getForceContribution(barnesHutTree.root.children.NE,node); + this._getForceContribution(barnesHutTree.root.children.SW,node); + this._getForceContribution(barnesHutTree.root.children.SE,node); + } + } +}; + + +/** + * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. + * If a region contains a single node, we check if it is not itself, then we apply the force. + * + * @param parentBranch + * @param node + * @private + */ +exports._getForceContribution = function(parentBranch,node) { + // we get no force contribution from an empty region + if (parentBranch.childrenCount > 0) { + var dx,dy,distance; + + // get the distance from the center of mass to the node. + dx = parentBranch.centerOfMass.x - node.x; + dy = parentBranch.centerOfMass.y - node.y; + distance = Math.sqrt(dx * dx + dy * dy); + + // BarnesHut condition + // original condition : s/d < theta = passed === d/s > 1/theta = passed + // calcSize = 1/s --> d * 1/s > 1/theta = passed + if (distance * parentBranch.calcSize > this.constants.physics.barnesHut.theta) { + // duplicate code to reduce function calls to speed up program + if (distance == 0) { + distance = 0.1*Math.random(); + dx = distance; + } + var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); + var fx = dx * gravityForce; + var fy = dy * gravityForce; + node.fx += fx; + node.fy += fy; + } + else { + // Did not pass the condition, go into children if available + if (parentBranch.childrenCount == 4) { + this._getForceContribution(parentBranch.children.NW,node); + this._getForceContribution(parentBranch.children.NE,node); + this._getForceContribution(parentBranch.children.SW,node); + this._getForceContribution(parentBranch.children.SE,node); + } + else { // parentBranch must have only one node, if it was empty we wouldnt be here + if (parentBranch.children.data.id != node.id) { // if it is not self + // duplicate code to reduce function calls to speed up program + if (distance == 0) { + distance = 0.5*Math.random(); + dx = distance; + } + var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); + var fx = dx * gravityForce; + var fy = dy * gravityForce; + node.fx += fx; + node.fy += fy; + } + } + } + } +}; + +/** + * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. + * + * @param nodes + * @param nodeIndices + * @private + */ +exports._formBarnesHutTree = function(nodes,nodeIndices) { + var node; + var nodeCount = nodeIndices.length; + + var minX = Number.MAX_VALUE, + minY = Number.MAX_VALUE, + maxX =-Number.MAX_VALUE, + maxY =-Number.MAX_VALUE; + + // get the range of the nodes + for (var i = 0; i < nodeCount; i++) { + var x = nodes[nodeIndices[i]].x; + var y = nodes[nodeIndices[i]].y; + if (x < minX) { minX = x; } + if (x > maxX) { maxX = x; } + if (y < minY) { minY = y; } + if (y > maxY) { maxY = y; } + } + // make the range a square + var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y + if (sizeDiff > 0) {minY -= 0.5 * sizeDiff; maxY += 0.5 * sizeDiff;} // xSize > ySize + else {minX += 0.5 * sizeDiff; maxX -= 0.5 * sizeDiff;} // xSize < ySize + + + var minimumTreeSize = 1e-5; + var rootSize = Math.max(minimumTreeSize,Math.abs(maxX - minX)); + var halfRootSize = 0.5 * rootSize; + var centerX = 0.5 * (minX + maxX), centerY = 0.5 * (minY + maxY); + + // construct the barnesHutTree + var barnesHutTree = { + root:{ + centerOfMass: {x:0, y:0}, + mass:0, + range: { + minX: centerX-halfRootSize,maxX:centerX+halfRootSize, + minY: centerY-halfRootSize,maxY:centerY+halfRootSize + }, + size: rootSize, + calcSize: 1 / rootSize, + children: { data:null}, + maxWidth: 0, + level: 0, + childrenCount: 4 + } + }; + this._splitBranch(barnesHutTree.root); + + // place the nodes one by one recursively + for (i = 0; i < nodeCount; i++) { + node = nodes[nodeIndices[i]]; + this._placeInTree(barnesHutTree.root,node); + } + + // make global + this.barnesHutTree = barnesHutTree +}; + + +/** + * this updates the mass of a branch. this is increased by adding a node. + * + * @param parentBranch + * @param node + * @private + */ +exports._updateBranchMass = function(parentBranch, node) { + var totalMass = parentBranch.mass + node.mass; + var totalMassInv = 1/totalMass; + + parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.mass; + parentBranch.centerOfMass.x *= totalMassInv; + + parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.mass; + parentBranch.centerOfMass.y *= totalMassInv; + + parentBranch.mass = totalMass; + var biggestSize = Math.max(Math.max(node.height,node.radius),node.width); + parentBranch.maxWidth = (parentBranch.maxWidth < biggestSize) ? biggestSize : parentBranch.maxWidth; + +}; + + +/** + * determine in which branch the node will be placed. + * + * @param parentBranch + * @param node + * @param skipMassUpdate + * @private + */ +exports._placeInTree = function(parentBranch,node,skipMassUpdate) { + if (skipMassUpdate != true || skipMassUpdate === undefined) { + // update the mass of the branch. + this._updateBranchMass(parentBranch,node); + } + + if (parentBranch.children.NW.range.maxX > node.x) { // in NW or SW + if (parentBranch.children.NW.range.maxY > node.y) { // in NW + this._placeInRegion(parentBranch,node,"NW"); + } + else { // in SW + this._placeInRegion(parentBranch,node,"SW"); + } + } + else { // in NE or SE + if (parentBranch.children.NW.range.maxY > node.y) { // in NE + this._placeInRegion(parentBranch,node,"NE"); + } + else { // in SE + this._placeInRegion(parentBranch,node,"SE"); + } + } +}; + + +/** + * actually place the node in a region (or branch) + * + * @param parentBranch + * @param node + * @param region + * @private + */ +exports._placeInRegion = function(parentBranch,node,region) { + switch (parentBranch.children[region].childrenCount) { + case 0: // place node here + parentBranch.children[region].children.data = node; + parentBranch.children[region].childrenCount = 1; + this._updateBranchMass(parentBranch.children[region],node); + break; + case 1: // convert into children + // if there are two nodes exactly overlapping (on init, on opening of cluster etc.) + // we move one node a pixel and we do not put it in the tree. + if (parentBranch.children[region].children.data.x == node.x && + parentBranch.children[region].children.data.y == node.y) { + node.x += Math.random(); + node.y += Math.random(); + } + else { + this._splitBranch(parentBranch.children[region]); + this._placeInTree(parentBranch.children[region],node); + } + break; + case 4: // place in branch + this._placeInTree(parentBranch.children[region],node); + break; + } +}; + + +/** + * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch + * after the split is complete. + * + * @param parentBranch + * @private + */ +exports._splitBranch = function(parentBranch) { + // if the branch is shaded with a node, replace the node in the new subset. + var containedNode = null; + if (parentBranch.childrenCount == 1) { + containedNode = parentBranch.children.data; + parentBranch.mass = 0; parentBranch.centerOfMass.x = 0; parentBranch.centerOfMass.y = 0; + } + parentBranch.childrenCount = 4; + parentBranch.children.data = null; + this._insertRegion(parentBranch,"NW"); + this._insertRegion(parentBranch,"NE"); + this._insertRegion(parentBranch,"SW"); + this._insertRegion(parentBranch,"SE"); + + if (containedNode != null) { + this._placeInTree(parentBranch,containedNode); + } +}; + + +/** + * This function subdivides the region into four new segments. + * Specifically, this inserts a single new segment. + * It fills the children section of the parentBranch + * + * @param parentBranch + * @param region + * @param parentRange + * @private + */ +exports._insertRegion = function(parentBranch, region) { + var minX,maxX,minY,maxY; + var childSize = 0.5 * parentBranch.size; + switch (region) { + case "NW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "NE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "SW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; + case "SE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; + } + + + parentBranch.children[region] = { + centerOfMass:{x:0,y:0}, + mass:0, + range:{minX:minX,maxX:maxX,minY:minY,maxY:maxY}, + size: 0.5 * parentBranch.size, + calcSize: 2 * parentBranch.calcSize, + children: {data:null}, + maxWidth: 0, + level: parentBranch.level+1, + childrenCount: 0 + }; +}; + + +/** + * This function is for debugging purposed, it draws the tree. + * + * @param ctx + * @param color + * @private + */ +exports._drawTree = function(ctx,color) { + if (this.barnesHutTree !== undefined) { + + ctx.lineWidth = 1; + + this._drawBranch(this.barnesHutTree.root,ctx,color); + } +}; + + +/** + * This function is for debugging purposes. It draws the branches recursively. + * + * @param branch + * @param ctx + * @param color + * @private + */ +exports._drawBranch = function(branch,ctx,color) { + if (color === undefined) { + color = "#FF0000"; + } + + if (branch.childrenCount == 4) { + this._drawBranch(branch.children.NW,ctx); + this._drawBranch(branch.children.NE,ctx); + this._drawBranch(branch.children.SE,ctx); + this._drawBranch(branch.children.SW,ctx); + } + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(branch.range.minX,branch.range.minY); + ctx.lineTo(branch.range.maxX,branch.range.minY); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(branch.range.maxX,branch.range.minY); + ctx.lineTo(branch.range.maxX,branch.range.maxY); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(branch.range.maxX,branch.range.maxY); + ctx.lineTo(branch.range.minX,branch.range.maxY); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(branch.range.minX,branch.range.maxY); + ctx.lineTo(branch.range.minX,branch.range.minY); + ctx.stroke(); + + /* + if (branch.mass > 0) { + ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass); + ctx.stroke(); + } + */ +}; diff --git a/lib/network/mixins/physics/HierarchialRepulsionMixin.js b/lib/network/mixins/physics/HierarchialRepulsionMixin.js new file mode 100644 index 00000000..2b57e024 --- /dev/null +++ b/lib/network/mixins/physics/HierarchialRepulsionMixin.js @@ -0,0 +1,154 @@ +/** + * Calculate the forces the nodes apply on eachother based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ +exports._calculateNodeForces = function () { + var dx, dy, distance, fx, fy, + repulsingForce, node1, node2, i, j; + + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + + // repulsing forces between nodes + var nodeDistance = this.constants.physics.hierarchicalRepulsion.nodeDistance; + + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j + for (i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; + + // nodes only affect nodes on their level + if (node1.level == node2.level) { + + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); + + + var steepness = 0.05; + if (distance < nodeDistance) { + repulsingForce = -Math.pow(steepness*distance,2) + Math.pow(steepness*nodeDistance,2); + } + else { + repulsingForce = 0; + } + // normalize force with + if (distance == 0) { + distance = 0.01; + } + else { + repulsingForce = repulsingForce / distance; + } + fx = dx * repulsingForce; + fy = dy * repulsingForce; + + node1.fx -= fx; + node1.fy -= fy; + node2.fx += fx; + node2.fy += fy; + } + } + } +}; + + +/** + * this function calculates the effects of the springs in the case of unsmooth curves. + * + * @private + */ +exports._calculateHierarchicalSpringForces = function () { + var edgeLength, edge, edgeId; + var dx, dy, fx, fy, springForce, distance; + var edges = this.edges; + + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + + + for (var i = 0; i < nodeIndices.length; i++) { + var node1 = nodes[nodeIndices[i]]; + node1.springFx = 0; + node1.springFy = 0; + } + + + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + // this implies that the edges between big clusters are longer + edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; + + dx = (edge.from.x - edge.to.x); + dy = (edge.from.y - edge.to.y); + distance = Math.sqrt(dx * dx + dy * dy); + + if (distance == 0) { + distance = 0.01; + } + + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + + fx = dx * springForce; + fy = dy * springForce; + + + + if (edge.to.level != edge.from.level) { + edge.to.springFx -= fx; + edge.to.springFy -= fy; + edge.from.springFx += fx; + edge.from.springFy += fy; + } + else { + var factor = 0.5; + edge.to.fx -= factor*fx; + edge.to.fy -= factor*fy; + edge.from.fx += factor*fx; + edge.from.fy += factor*fy; + } + } + } + } + } + + // normalize spring forces + var springForce = 1; + var springFx, springFy; + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + springFx = Math.min(springForce,Math.max(-springForce,node.springFx)); + springFy = Math.min(springForce,Math.max(-springForce,node.springFy)); + + node.fx += springFx; + node.fy += springFy; + } + + // retain energy balance + var totalFx = 0; + var totalFy = 0; + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + totalFx += node.fx; + totalFy += node.fy; + } + var correctionFx = totalFx / nodeIndices.length; + var correctionFy = totalFy / nodeIndices.length; + + for (i = 0; i < nodeIndices.length; i++) { + var node = nodes[nodeIndices[i]]; + node.fx -= correctionFx; + node.fy -= correctionFy; + } + +}; \ No newline at end of file diff --git a/lib/network/mixins/physics/PhysicsMixin.js b/lib/network/mixins/physics/PhysicsMixin.js new file mode 100644 index 00000000..520f1bcf --- /dev/null +++ b/lib/network/mixins/physics/PhysicsMixin.js @@ -0,0 +1,708 @@ +var util = require('../../../util'); +var RepulsionMixin = require('./RepulsionMixin'); +var HierarchialRepulsionMixin = require('./HierarchialRepulsionMixin'); +var BarnesHutMixin = require('./BarnesHutMixin'); + +/** + * Toggling barnes Hut calculation on and off. + * + * @private + */ +exports._toggleBarnesHut = function () { + this.constants.physics.barnesHut.enabled = !this.constants.physics.barnesHut.enabled; + this._loadSelectedForceSolver(); + this.moving = true; + this.start(); +}; + + +/** + * This loads the node force solver based on the barnes hut or repulsion algorithm + * + * @private + */ +exports._loadSelectedForceSolver = function () { + // this overloads the this._calculateNodeForces + if (this.constants.physics.barnesHut.enabled == true) { + this._clearMixin(RepulsionMixin); + this._clearMixin(HierarchialRepulsionMixin); + + this.constants.physics.centralGravity = this.constants.physics.barnesHut.centralGravity; + this.constants.physics.springLength = this.constants.physics.barnesHut.springLength; + this.constants.physics.springConstant = this.constants.physics.barnesHut.springConstant; + this.constants.physics.damping = this.constants.physics.barnesHut.damping; + + this._loadMixin(BarnesHutMixin); + } + else if (this.constants.physics.hierarchicalRepulsion.enabled == true) { + this._clearMixin(BarnesHutMixin); + this._clearMixin(RepulsionMixin); + + this.constants.physics.centralGravity = this.constants.physics.hierarchicalRepulsion.centralGravity; + this.constants.physics.springLength = this.constants.physics.hierarchicalRepulsion.springLength; + this.constants.physics.springConstant = this.constants.physics.hierarchicalRepulsion.springConstant; + this.constants.physics.damping = this.constants.physics.hierarchicalRepulsion.damping; + + this._loadMixin(HierarchialRepulsionMixin); + } + else { + this._clearMixin(BarnesHutMixin); + this._clearMixin(HierarchialRepulsionMixin); + this.barnesHutTree = undefined; + + this.constants.physics.centralGravity = this.constants.physics.repulsion.centralGravity; + this.constants.physics.springLength = this.constants.physics.repulsion.springLength; + this.constants.physics.springConstant = this.constants.physics.repulsion.springConstant; + this.constants.physics.damping = this.constants.physics.repulsion.damping; + + this._loadMixin(RepulsionMixin); + } +}; + +/** + * Before calculating the forces, we check if we need to cluster to keep up performance and we check + * if there is more than one node. If it is just one node, we dont calculate anything. + * + * @private + */ +exports._initializeForceCalculation = function () { + // stop calculation if there is only one node + if (this.nodeIndices.length == 1) { + this.nodes[this.nodeIndices[0]]._setForce(0, 0); + } + else { + // if there are too many nodes on screen, we cluster without repositioning + if (this.nodeIndices.length > this.constants.clustering.clusterThreshold && this.constants.clustering.enabled == true) { + this.clusterToFit(this.constants.clustering.reduceToNodes, false); + } + + // we now start the force calculation + this._calculateForces(); + } +}; + + +/** + * Calculate the external forces acting on the nodes + * Forces are caused by: edges, repulsing forces between nodes, gravity + * @private + */ +exports._calculateForces = function () { + // Gravity is required to keep separated groups from floating off + // the forces are reset to zero in this loop by using _setForce instead + // of _addForce + + this._calculateGravitationalForces(); + this._calculateNodeForces(); + + if (this.constants.physics.springConstant > 0) { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this._calculateSpringForcesWithSupport(); + } + else { + if (this.constants.physics.hierarchicalRepulsion.enabled == true) { + this._calculateHierarchicalSpringForces(); + } + else { + this._calculateSpringForces(); + } + } + } +}; + + +/** + * Smooth curves are created by adding invisible nodes in the center of the edges. These nodes are also + * handled in the calculateForces function. We then use a quadratic curve with the center node as control. + * This function joins the datanodes and invisible (called support) nodes into one object. + * We do this so we do not contaminate this.nodes with the support nodes. + * + * @private + */ +exports._updateCalculationNodes = function () { + if (this.constants.smoothCurves.enabled == true && this.constants.smoothCurves.dynamic == true) { + this.calculationNodes = {}; + this.calculationNodeIndices = []; + + for (var nodeId in this.nodes) { + if (this.nodes.hasOwnProperty(nodeId)) { + this.calculationNodes[nodeId] = this.nodes[nodeId]; + } + } + var supportNodes = this.sectors['support']['nodes']; + for (var supportNodeId in supportNodes) { + if (supportNodes.hasOwnProperty(supportNodeId)) { + if (this.edges.hasOwnProperty(supportNodes[supportNodeId].parentEdgeId)) { + this.calculationNodes[supportNodeId] = supportNodes[supportNodeId]; + } + else { + supportNodes[supportNodeId]._setForce(0, 0); + } + } + } + + for (var idx in this.calculationNodes) { + if (this.calculationNodes.hasOwnProperty(idx)) { + this.calculationNodeIndices.push(idx); + } + } + } + else { + this.calculationNodes = this.nodes; + this.calculationNodeIndices = this.nodeIndices; + } +}; + + +/** + * this function applies the central gravity effect to keep groups from floating off + * + * @private + */ +exports._calculateGravitationalForces = function () { + var dx, dy, distance, node, i; + var nodes = this.calculationNodes; + var gravity = this.constants.physics.centralGravity; + var gravityForce = 0; + + for (i = 0; i < this.calculationNodeIndices.length; i++) { + node = nodes[this.calculationNodeIndices[i]]; + node.damping = this.constants.physics.damping; // possibly add function to alter damping properties of clusters. + // gravity does not apply when we are in a pocket sector + if (this._sector() == "default" && gravity != 0) { + dx = -node.x; + dy = -node.y; + distance = Math.sqrt(dx * dx + dy * dy); + + gravityForce = (distance == 0) ? 0 : (gravity / distance); + node.fx = dx * gravityForce; + node.fy = dy * gravityForce; + } + else { + node.fx = 0; + node.fy = 0; + } + } +}; + + + + +/** + * this function calculates the effects of the springs in the case of unsmooth curves. + * + * @private + */ +exports._calculateSpringForces = function () { + var edgeLength, edge, edgeId; + var dx, dy, fx, fy, springForce, distance; + var edges = this.edges; + + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + // this implies that the edges between big clusters are longer + edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; + + dx = (edge.from.x - edge.to.x); + dy = (edge.from.y - edge.to.y); + distance = Math.sqrt(dx * dx + dy * dy); + + if (distance == 0) { + distance = 0.01; + } + + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + + fx = dx * springForce; + fy = dy * springForce; + + edge.from.fx += fx; + edge.from.fy += fy; + edge.to.fx -= fx; + edge.to.fy -= fy; + } + } + } + } +}; + + + + +/** + * This function calculates the springforces on the nodes, accounting for the support nodes. + * + * @private + */ +exports._calculateSpringForcesWithSupport = function () { + var edgeLength, edge, edgeId, combinedClusterSize; + var edges = this.edges; + + // forces caused by the edges, modelled as springs + for (edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + edge = edges[edgeId]; + if (edge.connected) { + // only calculate forces if nodes are in the same sector + if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { + if (edge.via != null) { + var node1 = edge.to; + var node2 = edge.via; + var node3 = edge.from; + + edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; + + combinedClusterSize = node1.clusterSize + node3.clusterSize - 2; + + // this implies that the edges between big clusters are longer + edgeLength += combinedClusterSize * this.constants.clustering.edgeGrowth; + this._calculateSpringForce(node1, node2, 0.5 * edgeLength); + this._calculateSpringForce(node2, node3, 0.5 * edgeLength); + } + } + } + } + } +}; + + +/** + * This is the code actually performing the calculation for the function above. It is split out to avoid repetition. + * + * @param node1 + * @param node2 + * @param edgeLength + * @private + */ +exports._calculateSpringForce = function (node1, node2, edgeLength) { + var dx, dy, fx, fy, springForce, distance; + + dx = (node1.x - node2.x); + dy = (node1.y - node2.y); + distance = Math.sqrt(dx * dx + dy * dy); + + if (distance == 0) { + distance = 0.01; + } + + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; + + fx = dx * springForce; + fy = dy * springForce; + + node1.fx += fx; + node1.fy += fy; + node2.fx -= fx; + node2.fy -= fy; +}; + + +/** + * Load the HTML for the physics config and bind it + * @private + */ +exports._loadPhysicsConfiguration = function () { + if (this.physicsConfiguration === undefined) { + this.backupConstants = {}; + util.deepExtend(this.backupConstants,this.constants); + + var hierarchicalLayoutDirections = ["LR", "RL", "UD", "DU"]; + this.physicsConfiguration = document.createElement('div'); + this.physicsConfiguration.className = "PhysicsConfiguration"; + this.physicsConfiguration.innerHTML = '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
      Simulation Mode:
      Barnes HutRepulsionHierarchical
      ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
      Options:
      ' + this.containerElement.parentElement.insertBefore(this.physicsConfiguration, this.containerElement); + this.optionsDiv = document.createElement("div"); + this.optionsDiv.style.fontSize = "14px"; + this.optionsDiv.style.fontFamily = "verdana"; + this.containerElement.parentElement.insertBefore(this.optionsDiv, this.containerElement); + + var rangeElement; + rangeElement = document.getElementById('graph_BH_gc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_gc', -1, "physics_barnesHut_gravitationalConstant"); + rangeElement = document.getElementById('graph_BH_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_BH_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_BH_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_BH_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_damp', 1, "physics_damping"); + + rangeElement = document.getElementById('graph_R_nd'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_nd', 1, "physics_repulsion_nodeDistance"); + rangeElement = document.getElementById('graph_R_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_R_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_R_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_R_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_damp', 1, "physics_damping"); + + rangeElement = document.getElementById('graph_H_nd'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); + rangeElement = document.getElementById('graph_H_cg'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_cg', 1, "physics_centralGravity"); + rangeElement = document.getElementById('graph_H_sc'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sc', 1, "physics_springConstant"); + rangeElement = document.getElementById('graph_H_sl'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sl', 1, "physics_springLength"); + rangeElement = document.getElementById('graph_H_damp'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_damp', 1, "physics_damping"); + rangeElement = document.getElementById('graph_H_direction'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_direction', hierarchicalLayoutDirections, "hierarchicalLayout_direction"); + rangeElement = document.getElementById('graph_H_levsep'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_levsep', 1, "hierarchicalLayout_levelSeparation"); + rangeElement = document.getElementById('graph_H_nspac'); + rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nspac', 1, "hierarchicalLayout_nodeSpacing"); + + var radioButton1 = document.getElementById("graph_physicsMethod1"); + var radioButton2 = document.getElementById("graph_physicsMethod2"); + var radioButton3 = document.getElementById("graph_physicsMethod3"); + radioButton2.checked = true; + if (this.constants.physics.barnesHut.enabled) { + radioButton1.checked = true; + } + if (this.constants.hierarchicalLayout.enabled) { + radioButton3.checked = true; + } + + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + var graph_repositionNodes = document.getElementById("graph_repositionNodes"); + var graph_generateOptions = document.getElementById("graph_generateOptions"); + + graph_toggleSmooth.onclick = graphToggleSmoothCurves.bind(this); + graph_repositionNodes.onclick = graphRepositionNodes.bind(this); + graph_generateOptions.onclick = graphGenerateOptions.bind(this); + if (this.constants.smoothCurves == true && this.constants.dynamicSmoothCurves == false) { + graph_toggleSmooth.style.background = "#A4FF56"; + } + else { + graph_toggleSmooth.style.background = "#FF8532"; + } + + + switchConfigurations.apply(this); + + radioButton1.onchange = switchConfigurations.bind(this); + radioButton2.onchange = switchConfigurations.bind(this); + radioButton3.onchange = switchConfigurations.bind(this); + } +}; + +/** + * This overwrites the this.constants. + * + * @param constantsVariableName + * @param value + * @private + */ +exports._overWriteGraphConstants = function (constantsVariableName, value) { + var nameArray = constantsVariableName.split("_"); + if (nameArray.length == 1) { + this.constants[nameArray[0]] = value; + } + else if (nameArray.length == 2) { + this.constants[nameArray[0]][nameArray[1]] = value; + } + else if (nameArray.length == 3) { + this.constants[nameArray[0]][nameArray[1]][nameArray[2]] = value; + } +}; + + +/** + * this function is bound to the toggle smooth curves button. That is also why it is not in the prototype. + */ +function graphToggleSmoothCurves () { + this.constants.smoothCurves.enabled = !this.constants.smoothCurves.enabled; + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + if (this.constants.smoothCurves.enabled == true) {graph_toggleSmooth.style.background = "#A4FF56";} + else {graph_toggleSmooth.style.background = "#FF8532";} + + this._configureSmoothCurves(false); +} + +/** + * this function is used to scramble the nodes + * + */ +function graphRepositionNodes () { + for (var nodeId in this.calculationNodes) { + if (this.calculationNodes.hasOwnProperty(nodeId)) { + this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0; + this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0; + } + } + if (this.constants.hierarchicalLayout.enabled == true) { + this._setupHierarchicalLayout(); + showValueOfRange.call(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); + showValueOfRange.call(this, 'graph_H_cg', 1, "physics_centralGravity"); + showValueOfRange.call(this, 'graph_H_sc', 1, "physics_springConstant"); + showValueOfRange.call(this, 'graph_H_sl', 1, "physics_springLength"); + showValueOfRange.call(this, 'graph_H_damp', 1, "physics_damping"); + } + else { + this.repositionNodes(); + } + this.moving = true; + this.start(); +} + +/** + * this is used to generate an options file from the playing with physics system. + */ +function graphGenerateOptions () { + var options = "No options are required, default values used."; + var optionsSpecific = []; + var radioButton1 = document.getElementById("graph_physicsMethod1"); + var radioButton2 = document.getElementById("graph_physicsMethod2"); + if (radioButton1.checked == true) { + if (this.constants.physics.barnesHut.gravitationalConstant != this.backupConstants.physics.barnesHut.gravitationalConstant) {optionsSpecific.push("gravitationalConstant: " + this.constants.physics.barnesHut.gravitationalConstant);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.barnesHut.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.barnesHut.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.barnesHut.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.barnesHut.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options = "var options = {"; + options += "physics: {barnesHut: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}}' + } + if (this.constants.smoothCurves.enabled != this.backupConstants.smoothCurves.enabled) { + if (optionsSpecific.length == 0) {options = "var options = {";} + else {options += ", "} + options += "smoothCurves: " + this.constants.smoothCurves.enabled; + } + if (options != "No options are required, default values used.") { + options += '};' + } + } + else if (radioButton2.checked == true) { + options = "var options = {"; + options += "physics: {barnesHut: {enabled: false}"; + if (this.constants.physics.repulsion.nodeDistance != this.backupConstants.physics.repulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.repulsion.nodeDistance);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.repulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.repulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.repulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.repulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options += ", repulsion: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}}' + } + if (optionsSpecific.length == 0) {options += "}"} + if (this.constants.smoothCurves != this.backupConstants.smoothCurves) { + options += ", smoothCurves: " + this.constants.smoothCurves; + } + options += '};' + } + else { + options = "var options = {"; + if (this.constants.physics.hierarchicalRepulsion.nodeDistance != this.backupConstants.physics.hierarchicalRepulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.hierarchicalRepulsion.nodeDistance);} + if (this.constants.physics.centralGravity != this.backupConstants.physics.hierarchicalRepulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} + if (this.constants.physics.springLength != this.backupConstants.physics.hierarchicalRepulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} + if (this.constants.physics.springConstant != this.backupConstants.physics.hierarchicalRepulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} + if (this.constants.physics.damping != this.backupConstants.physics.hierarchicalRepulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} + if (optionsSpecific.length != 0) { + options += "physics: {hierarchicalRepulsion: {"; + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", "; + } + } + options += '}},'; + } + options += 'hierarchicalLayout: {'; + optionsSpecific = []; + if (this.constants.hierarchicalLayout.direction != this.backupConstants.hierarchicalLayout.direction) {optionsSpecific.push("direction: " + this.constants.hierarchicalLayout.direction);} + if (Math.abs(this.constants.hierarchicalLayout.levelSeparation) != this.backupConstants.hierarchicalLayout.levelSeparation) {optionsSpecific.push("levelSeparation: " + this.constants.hierarchicalLayout.levelSeparation);} + if (this.constants.hierarchicalLayout.nodeSpacing != this.backupConstants.hierarchicalLayout.nodeSpacing) {optionsSpecific.push("nodeSpacing: " + this.constants.hierarchicalLayout.nodeSpacing);} + if (optionsSpecific.length != 0) { + for (var i = 0; i < optionsSpecific.length; i++) { + options += optionsSpecific[i]; + if (i < optionsSpecific.length - 1) { + options += ", " + } + } + options += '}' + } + else { + options += "enabled:true}"; + } + options += '};' + } + + + this.optionsDiv.innerHTML = options; +} + +/** + * this is used to switch between barnesHut, repulsion and hierarchical. + * + */ +function switchConfigurations () { + var ids = ["graph_BH_table", "graph_R_table", "graph_H_table"]; + var radioButton = document.querySelector('input[name="graph_physicsMethod"]:checked').value; + var tableId = "graph_" + radioButton + "_table"; + var table = document.getElementById(tableId); + table.style.display = "block"; + for (var i = 0; i < ids.length; i++) { + if (ids[i] != tableId) { + table = document.getElementById(ids[i]); + table.style.display = "none"; + } + } + this._restoreNodes(); + if (radioButton == "R") { + this.constants.hierarchicalLayout.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = false; + this.constants.physics.barnesHut.enabled = false; + } + else if (radioButton == "H") { + if (this.constants.hierarchicalLayout.enabled == false) { + this.constants.hierarchicalLayout.enabled = true; + this.constants.physics.hierarchicalRepulsion.enabled = true; + this.constants.physics.barnesHut.enabled = false; + this.constants.smoothCurves.enabled = false; + this._setupHierarchicalLayout(); + } + } + else { + this.constants.hierarchicalLayout.enabled = false; + this.constants.physics.hierarchicalRepulsion.enabled = false; + this.constants.physics.barnesHut.enabled = true; + } + this._loadSelectedForceSolver(); + var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); + if (this.constants.smoothCurves.enabled == true) {graph_toggleSmooth.style.background = "#A4FF56";} + else {graph_toggleSmooth.style.background = "#FF8532";} + this.moving = true; + this.start(); +} + + +/** + * this generates the ranges depending on the iniital values. + * + * @param id + * @param map + * @param constantsVariableName + */ +function showValueOfRange (id,map,constantsVariableName) { + var valueId = id + "_value"; + var rangeValue = document.getElementById(id).value; + + if (map instanceof Array) { + document.getElementById(valueId).value = map[parseInt(rangeValue)]; + this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]); + } + else { + document.getElementById(valueId).value = parseInt(map) * parseFloat(rangeValue); + this._overWriteGraphConstants(constantsVariableName, parseInt(map) * parseFloat(rangeValue)); + } + + if (constantsVariableName == "hierarchicalLayout_direction" || + constantsVariableName == "hierarchicalLayout_levelSeparation" || + constantsVariableName == "hierarchicalLayout_nodeSpacing") { + this._setupHierarchicalLayout(); + } + this.moving = true; + this.start(); +} diff --git a/lib/network/mixins/physics/RepulsionMixin.js b/lib/network/mixins/physics/RepulsionMixin.js new file mode 100644 index 00000000..06b5ff22 --- /dev/null +++ b/lib/network/mixins/physics/RepulsionMixin.js @@ -0,0 +1,58 @@ +/** + * Calculate the forces the nodes apply on each other based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ +exports._calculateNodeForces = function () { + var dx, dy, angle, distance, fx, fy, combinedClusterSize, + repulsingForce, node1, node2, i, j; + + var nodes = this.calculationNodes; + var nodeIndices = this.calculationNodeIndices; + + // approximation constants + var a_base = -2 / 3; + var b = 4 / 3; + + // repulsing forces between nodes + var nodeDistance = this.constants.physics.repulsion.nodeDistance; + var minimumDistance = nodeDistance; + + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j + for (i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; + combinedClusterSize = node1.clusterSize + node2.clusterSize - 2; + + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); + + minimumDistance = (combinedClusterSize == 0) ? nodeDistance : (nodeDistance * (1 + combinedClusterSize * this.constants.clustering.distanceAmplification)); + var a = a_base / minimumDistance; + if (distance < 2 * minimumDistance) { + if (distance < 0.5 * minimumDistance) { + repulsingForce = 1.0; + } + else { + repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / minimumDistance - 1) * steepness)) + } + + // amplify the repulsion for clusters. + repulsingForce *= (combinedClusterSize == 0) ? 1 : 1 + combinedClusterSize * this.constants.clustering.forceAmplification; + repulsingForce = repulsingForce / distance; + + fx = dx * repulsingForce; + fy = dy * repulsingForce; + + node1.fx -= fx; + node1.fy -= fy; + node2.fx += fx; + node2.fy += fy; + } + } + } +}; diff --git a/src/network/shapes.js b/lib/network/shapes.js similarity index 100% rename from src/network/shapes.js rename to lib/network/shapes.js diff --git a/src/timeline/DataStep.js b/lib/timeline/DataStep.js similarity index 97% rename from src/timeline/DataStep.js rename to lib/timeline/DataStep.js index e57062cd..85793fc9 100644 --- a/src/timeline/DataStep.js +++ b/lib/timeline/DataStep.js @@ -58,6 +58,11 @@ DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight, this._start = start; this._end = end; + if (start == end) { + this._start = start - 0.75; + this._end = end + 1; + } + if (this.autoScale) { this.setMinimumStep(minimumStep, containerHeight, forcedStepSize); } @@ -172,7 +177,7 @@ DataStep.prototype.previous = function() { /** * Get the current datetime - * @return {Number} current The current date + * @return {String} current The current date */ DataStep.prototype.getCurrent = function() { var toPrecision = '' + Number(this.current).toPrecision(5); @@ -189,7 +194,6 @@ DataStep.prototype.getCurrent = function() { } } - return toPrecision; }; @@ -213,3 +217,5 @@ DataStep.prototype.snap = function(date) { DataStep.prototype.isMajor = function() { return (this.current % (this.scale * this.majorSteps[this.stepIndex]) == 0); }; + +module.exports = DataStep; diff --git a/src/timeline/Graph2d.js b/lib/timeline/Graph2d.js similarity index 98% rename from src/timeline/Graph2d.js rename to lib/timeline/Graph2d.js index 39ffbb07..e6015bcb 100644 --- a/src/timeline/Graph2d.js +++ b/lib/timeline/Graph2d.js @@ -1,3 +1,14 @@ +var Emitter = require('emitter-component'); +var Hammer = require('../module/hammer'); +var util = require('../util'); +var DataSet = require('../DataSet'); +var DataView = require('../DataView'); +var Range = require('./Range'); +var TimeAxis = require('./component/TimeAxis'); +var CurrentTime = require('./component/CurrentTime'); +var CustomTime = require('./component/CustomTime'); +var LineGraph = require('./component/LineGraph'); + /** * Create a timeline visualization * @param {HTMLElement} container @@ -868,3 +879,5 @@ Graph2d.prototype._updateScrollTop = function () { Graph2d.prototype._getScrollTop = function () { return this.props.scrollTop; }; + +module.exports = Graph2d; diff --git a/src/timeline/Range.js b/lib/timeline/Range.js similarity index 97% rename from src/timeline/Range.js rename to lib/timeline/Range.js index 8f878541..20e9abff 100644 --- a/src/timeline/Range.js +++ b/lib/timeline/Range.js @@ -1,3 +1,8 @@ +var util = require('../util'); +var hammerUtil = require('../hammerUtil'); +var moment = require('../module/moment'); +var Component = require('./component/Component'); + /** * @constructor Range * A Range controls a numeric range with a start and end value. @@ -370,7 +375,7 @@ Range.prototype._onMouseWheel = function(event) { } // calculate center, the date to zoom around - var gesture = util.fakeGesture(this, event), + var gesture = hammerUtil.fakeGesture(this, event), pointer = getPointer(gesture.center, this.body.dom.center), pointerDate = this._pointerToDate(pointer); @@ -462,8 +467,8 @@ Range.prototype._pointerToDate = function (pointer) { */ function getPointer (touch, element) { return { - x: touch.pageX - vis.util.getAbsoluteLeft(element), - y: touch.pageY - vis.util.getAbsoluteTop(element) + x: touch.pageX - util.getAbsoluteLeft(element), + y: touch.pageY - util.getAbsoluteTop(element) }; } @@ -525,3 +530,5 @@ Range.prototype.moveTo = function(moveTo) { this.setRange(newStart, newEnd); }; + +module.exports = Range; diff --git a/src/timeline/Stack.js b/lib/timeline/Stack.js similarity index 68% rename from src/timeline/Stack.js rename to lib/timeline/Stack.js index b3aa5d1a..35cc90e9 100644 --- a/src/timeline/Stack.js +++ b/lib/timeline/Stack.js @@ -1,13 +1,11 @@ -/** - * Utility functions for ordering and stacking of items - */ -var stack = {}; +// Utility functions for ordering and stacking of items +var EPSILON = 0.001; // used when checking collisions, to prevent round-off errors /** * Order items by their start data * @param {Item[]} items */ -stack.orderByStart = function(items) { +exports.orderByStart = function(items) { items.sort(function (a, b) { return a.data.start - b.data.start; }); @@ -18,7 +16,7 @@ stack.orderByStart = function(items) { * is used. * @param {Item[]} items */ -stack.orderByEnd = function(items) { +exports.orderByEnd = function(items) { items.sort(function (a, b) { var aTime = ('end' in a.data) ? a.data.end : a.data.start, bTime = ('end' in b.data) ? b.data.end : b.data.start; @@ -32,13 +30,13 @@ stack.orderByEnd = function(items) { * other. * @param {Item[]} items * All visible items - * @param {{item: number, axis: number}} margin + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin * Margins between items and between items and the axis. * @param {boolean} [force=false] * If true, all items will be repositioned. If false (default), only * items having a top===null will be re-stacked */ -stack.stack = function(items, margin, force) { +exports.stack = function(items, margin, force) { var i, iMax; if (force) { @@ -61,7 +59,7 @@ stack.stack = function(items, margin, force) { var collidingItem = null; for (var j = 0, jj = items.length; j < jj; j++) { var other = items[j]; - if (other.top !== null && other !== item && stack.collision(item, other, margin.item)) { + if (other.top !== null && other !== item && exports.collision(item, other, margin.item)) { collidingItem = other; break; } @@ -69,7 +67,7 @@ stack.stack = function(items, margin, force) { if (collidingItem != null) { // There is a collision. Reposition the items above the colliding element - item.top = collidingItem.top + collidingItem.height + margin.item; + item.top = collidingItem.top + collidingItem.height + margin.item.vertical; } } while (collidingItem); } @@ -80,10 +78,10 @@ stack.stack = function(items, margin, force) { * Adjust vertical positions of the items without stacking them * @param {Item[]} items * All visible items - * @param {{item: number, axis: number}} margin + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin * Margins between items and between items and the axis. */ -stack.nostack = function(items, margin) { +exports.nostack = function(items, margin) { var i, iMax; // reset top position of all items @@ -97,16 +95,14 @@ stack.nostack = function(items, margin) { * The items must have parameters left, width, top, and height. * @param {Item} a The first item * @param {Item} b The second item - * @param {Number} margin A minimum required margin. - * If margin is provided, the two items will be - * marked colliding when they overlap or - * when the margin between the two is smaller than - * the requested margin. + * @param {{horizontal: number, vertical: number}} margin + * An object containing a horizontal and vertical + * minimum required margin. * @return {boolean} true if a and b collide, else false */ -stack.collision = function(a, b, margin) { - return ((a.left - margin) < (b.left + b.width) && - (a.left + a.width + margin) > b.left && - (a.top - margin) < (b.top + b.height) && - (a.top + a.height + margin) > b.top); +exports.collision = function(a, b, margin) { + return ((a.left - margin.horizontal + EPSILON) < (b.left + b.width) && + (a.left + a.width + margin.horizontal - EPSILON) > b.left && + (a.top - margin.vertical + EPSILON) < (b.top + b.height) && + (a.top + a.height + margin.vertical - EPSILON) > b.top); }; diff --git a/src/timeline/TimeStep.js b/lib/timeline/TimeStep.js similarity index 99% rename from src/timeline/TimeStep.js rename to lib/timeline/TimeStep.js index febe04fc..e477e6a3 100644 --- a/src/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -1,3 +1,5 @@ +var moment = require('../module/moment'); + /** * @constructor TimeStep * The class TimeStep is an iterator for dates. You provide a start date and an @@ -464,3 +466,5 @@ TimeStep.prototype.getLabelMajor = function(date) { default: return ''; } }; + +module.exports = TimeStep; diff --git a/src/timeline/Timeline.js b/lib/timeline/Timeline.js similarity index 97% rename from src/timeline/Timeline.js rename to lib/timeline/Timeline.js index 64b1652d..874b8b67 100644 --- a/src/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -1,3 +1,14 @@ +var Emitter = require('emitter-component'); +var Hammer = require('../module/hammer'); +var util = require('../util'); +var DataSet = require('../DataSet'); +var DataView = require('../DataView'); +var Range = require('./Range'); +var TimeAxis = require('./component/TimeAxis'); +var CurrentTime = require('./component/CurrentTime'); +var CustomTime = require('./component/CustomTime'); +var ItemSet = require('./component/ItemSet'); + /** * Create a timeline visualization * @param {HTMLElement} container @@ -359,6 +370,15 @@ Timeline.prototype.setItems = function(items) { } }; +/** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ +Timeline.prototype.getVisibleItems = function() { + return this.itemSet && this.itemSet.getVisibleItems() || []; +}; + + /** * Set groups * @param {vis.DataSet | Array | google.visualization.DataTable} groups @@ -885,3 +905,5 @@ Timeline.prototype._updateScrollTop = function () { Timeline.prototype._getScrollTop = function () { return this.props.scrollTop; }; + +module.exports = Timeline; diff --git a/src/timeline/component/Component.js b/lib/timeline/component/Component.js similarity index 97% rename from src/timeline/component/Component.js rename to lib/timeline/component/Component.js index bddccf0d..5f211b8d 100644 --- a/src/timeline/component/Component.js +++ b/lib/timeline/component/Component.js @@ -50,3 +50,5 @@ Component.prototype._isResized = function() { return resized; }; + +module.exports = Component; diff --git a/src/timeline/component/CurrentTime.js b/lib/timeline/component/CurrentTime.js similarity index 96% rename from src/timeline/component/CurrentTime.js rename to lib/timeline/component/CurrentTime.js index 3b067280..e3735b7f 100644 --- a/src/timeline/component/CurrentTime.js +++ b/lib/timeline/component/CurrentTime.js @@ -1,3 +1,6 @@ +var util = require('../../util'); +var Component = require('./Component'); + /** * A current time bar * @param {{range: Range, dom: Object, domProps: Object}} body @@ -6,7 +9,6 @@ * @constructor CurrentTime * @extends Component */ - function CurrentTime (body, options) { this.body = body; @@ -126,3 +128,5 @@ CurrentTime.prototype.stop = function() { delete this.currentTimeTimer; } }; + +module.exports = CurrentTime; diff --git a/src/timeline/component/CustomTime.js b/lib/timeline/component/CustomTime.js similarity index 96% rename from src/timeline/component/CustomTime.js rename to lib/timeline/component/CustomTime.js index 21c86e8b..985dc11e 100644 --- a/src/timeline/component/CustomTime.js +++ b/lib/timeline/component/CustomTime.js @@ -1,3 +1,7 @@ +var Hammer = require('../../module/hammer'); +var util = require('../../util'); +var Component = require('./Component'); + /** * A custom time bar * @param {{range: Range, dom: Object}} body @@ -180,3 +184,5 @@ CustomTime.prototype._onDragEnd = function (event) { event.stopPropagation(); event.preventDefault(); }; + +module.exports = CustomTime; diff --git a/src/timeline/component/DataAxis.js b/lib/timeline/component/DataAxis.js similarity index 98% rename from src/timeline/component/DataAxis.js rename to lib/timeline/component/DataAxis.js index 81ea5cb6..e5af2c9c 100644 --- a/src/timeline/component/DataAxis.js +++ b/lib/timeline/component/DataAxis.js @@ -1,3 +1,8 @@ +var util = require('../../util'); +var DOMutil = require('../../DOMutil'); +var Component = require('./Component'); +var DataStep = require('../DataStep'); + /** * A horizontal time axis * @param {Object} [options] See DataAxis.setOptions for the available @@ -466,3 +471,5 @@ DataAxis.prototype._calculateCharSize = function () { DataAxis.prototype.snap = function(date) { return this.step.snap(date); }; + +module.exports = DataAxis; diff --git a/src/timeline/component/GraphGroup.js b/lib/timeline/component/GraphGroup.js similarity index 97% rename from src/timeline/component/GraphGroup.js rename to lib/timeline/component/GraphGroup.js index 0da3d235..e15d113b 100644 --- a/src/timeline/component/GraphGroup.js +++ b/lib/timeline/component/GraphGroup.js @@ -1,3 +1,6 @@ +var util = require('../../util'); +var DOMutil = require('../../DOMutil'); + /** * @constructor Group * @param {Number | String} groupId @@ -28,11 +31,11 @@ GraphGroup.prototype.setItems = function(items) { else { this.itemsData = []; } -} +}; GraphGroup.prototype.setZeroPosition = function(pos) { this.zeroPosition = pos; -} +}; GraphGroup.prototype.setOptions = function(options) { if (options !== undefined) { @@ -113,4 +116,6 @@ GraphGroup.prototype.drawIcon = function(x, y, JSONcontainer, SVGcontainer, icon DOMutil.drawBar(x + 0.5*barWidth + offset , y + fillHeight - bar1Height - 1, barWidth, bar1Height, this.className + ' bar', JSONcontainer, SVGcontainer); DOMutil.drawBar(x + 1.5*barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, this.className + ' bar', JSONcontainer, SVGcontainer); } -} +}; + +module.exports = GraphGroup; diff --git a/src/timeline/component/Group.js b/lib/timeline/component/Group.js similarity index 97% rename from src/timeline/component/Group.js rename to lib/timeline/component/Group.js index bfc63e71..e23d8f06 100644 --- a/src/timeline/component/Group.js +++ b/lib/timeline/component/Group.js @@ -1,3 +1,7 @@ +var util = require('../../util'); +var stack = require('../Stack'); +var ItemRange = require('./item/ItemRange'); + /** * @constructor Group * @param {Number | String} groupId @@ -119,7 +123,7 @@ Group.prototype.getLabelWidth = function() { /** * Repaint this group * @param {{start: number, end: number}} range - * @param {{item: number, axis: number}} margin + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin * @param {boolean} [restack=false] Force restacking of all items * @return {boolean} Returns true if the group is resized */ @@ -168,10 +172,10 @@ Group.prototype.redraw = function(range, margin, restack) { item.top -= offset; }); } - height = max + margin.item / 2; + height = max + margin.item.vertical / 2; } else { - height = margin.axis + margin.item; + height = margin.axis + margin.item.vertical; } height = Math.max(height, this.props.label.height); @@ -389,6 +393,7 @@ Group.prototype._checkIfInvisible = function(item, visibleItems, range) { return false; } else { + if (item.displayed) item.hide(); return true; } }; @@ -415,3 +420,5 @@ Group.prototype._checkIfVisible = function(item, visibleItems, range) { if (item.displayed) item.hide(); } }; + +module.exports = Group; diff --git a/src/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js similarity index 92% rename from src/timeline/component/ItemSet.js rename to lib/timeline/component/ItemSet.js index 1a5171cd..bc542ab3 100644 --- a/src/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1,3 +1,14 @@ +var Hammer = require('../../module/hammer'); +var util = require('../../util'); +var DataSet = require('../../DataSet'); +var DataView = require('../../DataView'); +var Component = require('./Component'); +var Group = require('./Group'); +var ItemBox = require('./item/ItemBox'); +var ItemPoint = require('./item/ItemPoint'); +var ItemRange = require('./item/ItemRange'); + + var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items /** @@ -41,7 +52,10 @@ function ItemSet(body, options) { }, margin: { - item: 10, + item: { + horizontal: 10, + vertical: 10 + }, axis: 20 }, padding: 5 @@ -200,8 +214,15 @@ ItemSet.prototype._create = function(){ * {Number} margin.axis * Margin between the axis and the items in pixels. * Default is 20. + * {Number} margin.item.horizontal + * Horizontal margin between items in pixels. + * Default is 10. + * {Number} margin.item.vertical + * Vertical Margin between items in pixels. + * Default is 10. * {Number} margin.item - * Margin between items in pixels. Default is 10. + * Margin between items in pixels in both horizontal + * and vertical direction. Default is 10. * {Number} margin * Set margin for both axis and items in pixels. * {Number} padding @@ -243,10 +264,20 @@ ItemSet.prototype.setOptions = function(options) { if ('margin' in options) { if (typeof options.margin === 'number') { this.options.margin.axis = options.margin; - this.options.margin.item = options.margin; + this.options.margin.item.horizontal = options.margin; + this.options.margin.item.vertical = options.margin; } - else if (typeof options.margin === 'object'){ - util.selectiveExtend(['axis', 'item'], this.options.margin, options.margin); + else if (typeof options.margin === 'object') { + util.selectiveExtend(['axis'], this.options.margin, options.margin); + if ('item' in options.margin) { + if (typeof options.margin.item === 'number') { + this.options.margin.item.horizontal = options.margin.item; + this.options.margin.item.vertical = options.margin.item; + } + else if (typeof options.margin.item === 'object') { + util.selectiveExtend(['horizontal', 'vertical'], this.options.margin.item, options.margin.item); + } + } } } @@ -266,7 +297,7 @@ ItemSet.prototype.setOptions = function(options) { var addCallback = (function (name) { if (name in options) { var fn = options[name]; - if (!(fn instanceof Function) || fn.length != 2) { + if (!(fn instanceof Function)) { throw new Error('option ' + name + ' must be a function ' + name + '(item, callback)'); } this.options[name] = fn; @@ -385,6 +416,36 @@ ItemSet.prototype.getSelection = function() { return this.selection.concat([]); }; +/** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ +ItemSet.prototype.getVisibleItems = function() { + var range = this.body.range.getRange(); + var left = this.body.util.toScreen(range.start); + var right = this.body.util.toScreen(range.end); + + var ids = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + var rawVisibleItems = group.visibleItems; + + // filter the "raw" set with visibleItems into a set which is really + // visible by pixels + for (var i = 0; i < rawVisibleItems.length; i++) { + var item = rawVisibleItems[i]; + // TODO: also check whether visible vertically + if ((item.left < right) && (item.left + item.width > left)) { + ids.push(item.id); + } + } + } + } + + return ids; +}; + /** * Deselect a selected item * @param {String | Number} id @@ -437,10 +498,10 @@ ItemSet.prototype.redraw = function() { }, nonFirstMargin = { item: margin.item, - axis: margin.item / 2 + axis: margin.item.vertical / 2 }, height = 0, - minHeight = margin.axis + margin.item; + minHeight = margin.axis + margin.item.vertical; util.forEach(this.groups, function (group) { var groupMargin = (group == firstGroup) ? firstMargin : nonFirstMargin; var groupResized = group.redraw(range, groupMargin, restack); @@ -1200,7 +1261,7 @@ ItemSet.prototype._onAddItem = function (event) { } else { // add item - var xAbs = vis.util.getAbsoluteLeft(this.dom.frame); + var xAbs = util.getAbsoluteLeft(this.dom.frame); var x = event.gesture.center.pageX - xAbs; var start = this.body.util.toTime(x); var newItem = { @@ -1318,3 +1379,4 @@ ItemSet.itemSetFromTarget = function(event) { return null; }; +module.exports = ItemSet; diff --git a/src/timeline/component/Legend.js b/lib/timeline/component/Legend.js similarity index 95% rename from src/timeline/component/Legend.js rename to lib/timeline/component/Legend.js index d879d0de..6cd32fed 100644 --- a/src/timeline/component/Legend.js +++ b/lib/timeline/component/Legend.js @@ -1,5 +1,9 @@ +var util = require('../../util'); +var DOMutil = require('../../DOMutil'); +var Component = require('./Component'); + /** - * Created by Alex on 6/17/14. + * Legend for Graph2d */ function Legend(body, options, side) { this.body = body; @@ -27,7 +31,7 @@ function Legend(body, options, side) { this._create(); this.setOptions(options); -}; +} Legend.prototype = new Component(); @@ -69,7 +73,7 @@ Legend.prototype._create = function() { this.dom.frame.appendChild(this.svg); this.dom.frame.appendChild(this.dom.textArea); -} +}; /** * Hide the component from the DOM @@ -95,7 +99,7 @@ Legend.prototype.show = function() { Legend.prototype.setOptions = function(options) { var fields = ['enabled','orientation','icons','left','right']; util.selectiveDeepExtend(fields, this.options, options); -} +}; Legend.prototype.redraw = function() { if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false) { @@ -142,7 +146,7 @@ Legend.prototype.redraw = function() { this.drawLegendIcons(); } - var content = ""; + var content = ''; for (var groupId in this.groups) { if (this.groups.hasOwnProperty(groupId)) { content += this.groups[groupId].content + '
      '; @@ -151,13 +155,13 @@ Legend.prototype.redraw = function() { this.dom.textArea.innerHTML = content; this.dom.textArea.style.lineHeight = ((0.75 * this.options.iconSize) + this.options.iconSpacing) + 'px'; } -} +}; Legend.prototype.drawLegendIcons = function() { if (this.dom.frame.parentNode) { DOMutil.prepareElements(this.svgElements); var padding = window.getComputedStyle(this.dom.frame).paddingTop; - var iconOffset = Number(padding.replace("px",'')); + var iconOffset = Number(padding.replace('px','')); var x = iconOffset; var iconWidth = this.options.iconSize; var iconHeight = 0.75 * this.options.iconSize; @@ -174,4 +178,6 @@ Legend.prototype.drawLegendIcons = function() { DOMutil.cleanupElements(this.svgElements); } -} \ No newline at end of file +}; + +module.exports = Legend; diff --git a/src/timeline/component/LineGraph.js b/lib/timeline/component/LineGraph.js similarity index 98% rename from src/timeline/component/LineGraph.js rename to lib/timeline/component/LineGraph.js index 6ffed716..07b0f973 100644 --- a/src/timeline/component/LineGraph.js +++ b/lib/timeline/component/LineGraph.js @@ -1,3 +1,12 @@ +var util = require('../../util'); +var DOMutil = require('../../DOMutil'); +var DataSet = require('../../DataSet'); +var DataView = require('../../DataView'); +var Component = require('./Component'); +var DataAxis = require('./DataAxis'); +var GraphGroup = require('./GraphGroup'); +var Legend = require('./Legend'); + var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items /** @@ -1059,7 +1068,4 @@ LineGraph.prototype._linear = function(data) { return d; }; - - - - +module.exports = LineGraph; diff --git a/src/timeline/component/TimeAxis.js b/lib/timeline/component/TimeAxis.js similarity index 98% rename from src/timeline/component/TimeAxis.js rename to lib/timeline/component/TimeAxis.js index c244c0ce..e26259a2 100644 --- a/src/timeline/component/TimeAxis.js +++ b/lib/timeline/component/TimeAxis.js @@ -1,3 +1,7 @@ +var util = require('../../util'); +var Component = require('./Component'); +var TimeStep = require('../TimeStep'); + /** * A horizontal time axis * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body @@ -387,3 +391,5 @@ TimeAxis.prototype._calculateCharSize = function () { TimeAxis.prototype.snap = function(date) { return this.step.snap(date); }; + +module.exports = TimeAxis; diff --git a/src/timeline/component/css/animation.css b/lib/timeline/component/css/animation.css similarity index 100% rename from src/timeline/component/css/animation.css rename to lib/timeline/component/css/animation.css diff --git a/src/timeline/component/css/currenttime.css b/lib/timeline/component/css/currenttime.css similarity index 100% rename from src/timeline/component/css/currenttime.css rename to lib/timeline/component/css/currenttime.css diff --git a/src/timeline/component/css/customtime.css b/lib/timeline/component/css/customtime.css similarity index 100% rename from src/timeline/component/css/customtime.css rename to lib/timeline/component/css/customtime.css diff --git a/src/timeline/component/css/dataaxis.css b/lib/timeline/component/css/dataaxis.css similarity index 100% rename from src/timeline/component/css/dataaxis.css rename to lib/timeline/component/css/dataaxis.css diff --git a/src/timeline/component/css/item.css b/lib/timeline/component/css/item.css similarity index 100% rename from src/timeline/component/css/item.css rename to lib/timeline/component/css/item.css diff --git a/src/timeline/component/css/itemset.css b/lib/timeline/component/css/itemset.css similarity index 100% rename from src/timeline/component/css/itemset.css rename to lib/timeline/component/css/itemset.css diff --git a/src/timeline/component/css/labelset.css b/lib/timeline/component/css/labelset.css similarity index 100% rename from src/timeline/component/css/labelset.css rename to lib/timeline/component/css/labelset.css diff --git a/src/timeline/component/css/panel.css b/lib/timeline/component/css/panel.css similarity index 100% rename from src/timeline/component/css/panel.css rename to lib/timeline/component/css/panel.css diff --git a/src/timeline/component/css/pathStyles.css b/lib/timeline/component/css/pathStyles.css similarity index 100% rename from src/timeline/component/css/pathStyles.css rename to lib/timeline/component/css/pathStyles.css diff --git a/src/timeline/component/css/timeaxis.css b/lib/timeline/component/css/timeaxis.css similarity index 100% rename from src/timeline/component/css/timeaxis.css rename to lib/timeline/component/css/timeaxis.css diff --git a/src/timeline/component/css/timeline.css b/lib/timeline/component/css/timeline.css similarity index 100% rename from src/timeline/component/css/timeline.css rename to lib/timeline/component/css/timeline.css diff --git a/src/timeline/component/item/Item.js b/lib/timeline/component/item/Item.js similarity index 97% rename from src/timeline/component/item/Item.js rename to lib/timeline/component/item/Item.js index 998f3bf8..cfb1aa29 100644 --- a/src/timeline/component/item/Item.js +++ b/lib/timeline/component/item/Item.js @@ -1,3 +1,5 @@ +var Hammer = require('../../../module/hammer'); + /** * @constructor Item * @param {Object} data Object containing (optional) parameters type, @@ -137,3 +139,5 @@ Item.prototype._repaintDeleteButton = function (anchor) { this.dom.deleteButton = null; } }; + +module.exports = Item; diff --git a/src/timeline/component/item/ItemBox.js b/lib/timeline/component/item/ItemBox.js similarity index 99% rename from src/timeline/component/item/ItemBox.js rename to lib/timeline/component/item/ItemBox.js index 04c94439..64abbbd2 100644 --- a/src/timeline/component/item/ItemBox.js +++ b/lib/timeline/component/item/ItemBox.js @@ -1,3 +1,5 @@ +var Item = require('./Item'); + /** * @constructor ItemBox * @extends Item @@ -234,3 +236,5 @@ ItemBox.prototype.repositionY = function() { dot.style.top = (-this.props.dot.height / 2) + 'px'; }; + +module.exports = ItemBox; diff --git a/src/timeline/component/item/ItemPoint.js b/lib/timeline/component/item/ItemPoint.js similarity index 98% rename from src/timeline/component/item/ItemPoint.js rename to lib/timeline/component/item/ItemPoint.js index bd6fd09f..7f87665e 100644 --- a/src/timeline/component/item/ItemPoint.js +++ b/lib/timeline/component/item/ItemPoint.js @@ -1,3 +1,5 @@ +var Item = require('./Item'); + /** * @constructor ItemPoint * @extends Item @@ -194,3 +196,5 @@ ItemPoint.prototype.repositionY = function() { point.style.top = (this.parent.height - this.top - this.height) + 'px'; } }; + +module.exports = ItemPoint; diff --git a/src/timeline/component/item/ItemRange.js b/lib/timeline/component/item/ItemRange.js similarity index 98% rename from src/timeline/component/item/ItemRange.js rename to lib/timeline/component/item/ItemRange.js index b6bc2572..664db2d7 100644 --- a/src/timeline/component/item/ItemRange.js +++ b/lib/timeline/component/item/ItemRange.js @@ -1,3 +1,6 @@ +var Hammer = require('../../../module/hammer'); +var Item = require('./Item'); + /** * @constructor ItemRange * @extends Item @@ -284,3 +287,5 @@ ItemRange.prototype._repaintDragRight = function () { this.dom.dragRight = null; } }; + +module.exports = ItemRange; diff --git a/src/timeline/img/delete.png b/lib/timeline/img/delete.png similarity index 100% rename from src/timeline/img/delete.png rename to lib/timeline/img/delete.png diff --git a/src/util.js b/lib/util.js similarity index 76% rename from src/util.js rename to lib/util.js index abf577f2..34b2f124 100644 --- a/src/util.js +++ b/lib/util.js @@ -1,14 +1,15 @@ -/** - * utility functions - */ -var util = {}; +// utility functions + +// first check if moment.js is already loaded in the browser window, if so, +// use this instance. Else, load via commonjs. +var moment = require('./module/moment'); /** * Test whether given object is a number * @param {*} object * @return {Boolean} isNumber */ -util.isNumber = function(object) { +exports.isNumber = function(object) { return (object instanceof Number || typeof object == 'number'); }; @@ -17,7 +18,7 @@ util.isNumber = function(object) { * @param {*} object * @return {Boolean} isString */ -util.isString = function(object) { +exports.isString = function(object) { return (object instanceof String || typeof object == 'string'); }; @@ -26,11 +27,11 @@ util.isString = function(object) { * @param {Date | String} object * @return {Boolean} isDate */ -util.isDate = function(object) { +exports.isDate = function(object) { if (object instanceof Date) { return true; } - else if (util.isString(object)) { + else if (exports.isString(object)) { // test whether this string contains a date var match = ASPDateRegex.exec(object); if (match) { @@ -49,7 +50,7 @@ util.isDate = function(object) { * @param {*} object * @return {Boolean} isDataTable */ -util.isDataTable = function(object) { +exports.isDataTable = function(object) { return (typeof (google) !== 'undefined') && (google.visualization) && (google.visualization.DataTable) && @@ -61,7 +62,7 @@ util.isDataTable = function(object) { * source: http://stackoverflow.com/a/105074/1262753 * @return {String} uuid */ -util.randomUUID = function() { +exports.randomUUID = function() { var S4 = function () { return Math.floor( Math.random() * 0x10000 /* 65536 */ @@ -84,7 +85,7 @@ util.randomUUID = function() { * @param {... Object} b * @return {Object} a */ -util.extend = function (a, b) { +exports.extend = function (a, b) { for (var i = 1, len = arguments.length; i < len; i++) { var other = arguments[i]; for (var prop in other) { @@ -105,7 +106,7 @@ util.extend = function (a, b) { * @param {... Object} b * @return {Object} a */ -util.selectiveExtend = function (props, a, b) { +exports.selectiveExtend = function (props, a, b) { if (!Array.isArray(props)) { throw new Error('Array with property names expected as first argument'); } @@ -131,7 +132,7 @@ util.selectiveExtend = function (props, a, b) { * @param {... Object} b * @return {Object} a */ -util.selectiveDeepExtend = function (props, a, b) { +exports.selectiveDeepExtend = function (props, a, b) { // TODO: add support for Arrays to deepExtend if (Array.isArray(b)) { throw new TypeError('Arrays are not supported by deepExtend'); @@ -146,7 +147,7 @@ util.selectiveDeepExtend = function (props, a, b) { a[prop] = {}; } if (a[prop].constructor === Object) { - util.deepExtend(a[prop], b[prop]); + exports.deepExtend(a[prop], b[prop]); } else { a[prop] = b[prop]; @@ -169,7 +170,7 @@ util.selectiveDeepExtend = function (props, a, b) { * @param {Object} b * @returns {Object} */ -util.deepExtend = function(a, b) { +exports.deepExtend = function(a, b) { // TODO: add support for Arrays to deepExtend if (Array.isArray(b)) { throw new TypeError('Arrays are not supported by deepExtend'); @@ -182,7 +183,7 @@ util.deepExtend = function(a, b) { a[prop] = {}; } if (a[prop].constructor === Object) { - util.deepExtend(a[prop], b[prop]); + exports.deepExtend(a[prop], b[prop]); } else { a[prop] = b[prop]; @@ -204,7 +205,7 @@ util.deepExtend = function(a, b) { * @return {boolean} Returns true if both arrays have the same length and same * elements. */ -util.equalArray = function (a, b) { +exports.equalArray = function (a, b) { if (a.length != b.length) return false; for (var i = 0, len = a.length; i < len; i++) { @@ -223,7 +224,7 @@ util.equalArray = function (a, b) { * @return {*} object * @throws Error */ -util.convert = function(object, type) { +exports.convert = function(object, type) { var match; if (object === undefined) { @@ -255,7 +256,7 @@ util.convert = function(object, type) { return String(object); case 'Date': - if (util.isNumber(object)) { + if (exports.isNumber(object)) { return new Date(object); } if (object instanceof Date) { @@ -264,7 +265,7 @@ util.convert = function(object, type) { else if (moment.isMoment(object)) { return new Date(object.valueOf()); } - if (util.isString(object)) { + if (exports.isString(object)) { match = ASPDateRegex.exec(object); if (match) { // object is an ASP date @@ -276,12 +277,12 @@ util.convert = function(object, type) { } else { throw new Error( - 'Cannot convert object of type ' + util.getType(object) + + 'Cannot convert object of type ' + exports.getType(object) + ' to type Date'); } case 'Moment': - if (util.isNumber(object)) { + if (exports.isNumber(object)) { return moment(object); } if (object instanceof Date) { @@ -290,7 +291,7 @@ util.convert = function(object, type) { else if (moment.isMoment(object)) { return moment(object); } - if (util.isString(object)) { + if (exports.isString(object)) { match = ASPDateRegex.exec(object); if (match) { // object is an ASP date @@ -302,12 +303,12 @@ util.convert = function(object, type) { } else { throw new Error( - 'Cannot convert object of type ' + util.getType(object) + + 'Cannot convert object of type ' + exports.getType(object) + ' to type Date'); } case 'ISODate': - if (util.isNumber(object)) { + if (exports.isNumber(object)) { return new Date(object); } else if (object instanceof Date) { @@ -316,7 +317,7 @@ util.convert = function(object, type) { else if (moment.isMoment(object)) { return object.toDate().toISOString(); } - else if (util.isString(object)) { + else if (exports.isString(object)) { match = ASPDateRegex.exec(object); if (match) { // object is an ASP date @@ -328,18 +329,18 @@ util.convert = function(object, type) { } else { throw new Error( - 'Cannot convert object of type ' + util.getType(object) + + 'Cannot convert object of type ' + exports.getType(object) + ' to type ISODate'); } case 'ASPDate': - if (util.isNumber(object)) { + if (exports.isNumber(object)) { return '/Date(' + object + ')/'; } else if (object instanceof Date) { return '/Date(' + object.valueOf() + ')/'; } - else if (util.isString(object)) { + else if (exports.isString(object)) { match = ASPDateRegex.exec(object); var value; if (match) { @@ -353,7 +354,7 @@ util.convert = function(object, type) { } else { throw new Error( - 'Cannot convert object of type ' + util.getType(object) + + 'Cannot convert object of type ' + exports.getType(object) + ' to type ASPDate'); } @@ -368,11 +369,11 @@ util.convert = function(object, type) { var ASPDateRegex = /^\/?Date\((\-?\d+)/i; /** - * Get the type of an object, for example util.getType([]) returns 'Array' + * Get the type of an object, for example exports.getType([]) returns 'Array' * @param {*} object * @return {String} type */ -util.getType = function(object) { +exports.getType = function(object) { var type = typeof object; if (type == 'object') { @@ -415,18 +416,8 @@ util.getType = function(object) { * @return {number} left The absolute left position of this element * in the browser page. */ -util.getAbsoluteLeft = function(elem) { - var doc = document.documentElement; - var body = document.body; - - var left = elem.offsetLeft; - var e = elem.offsetParent; - while (e != null && e != body && e != doc) { - left += e.offsetLeft; - left -= e.scrollLeft; - e = e.offsetParent; - } - return left; +exports.getAbsoluteLeft = function(elem) { + return elem.getBoundingClientRect().left + window.pageXOffset; }; /** @@ -435,70 +426,8 @@ util.getAbsoluteLeft = function(elem) { * @return {number} top The absolute top position of this element * in the browser page. */ -util.getAbsoluteTop = function(elem) { - var doc = document.documentElement; - var body = document.body; - - var top = elem.offsetTop; - var e = elem.offsetParent; - while (e != null && e != body && e != doc) { - top += e.offsetTop; - top -= e.scrollTop; - e = e.offsetParent; - } - return top; -}; - -/** - * Get the absolute, vertical mouse position from an event. - * @param {Event} event - * @return {Number} pageY - */ -util.getPageY = function(event) { - if ('pageY' in event) { - return event.pageY; - } - else { - var clientY; - if (('targetTouches' in event) && event.targetTouches.length) { - clientY = event.targetTouches[0].clientY; - } - else { - clientY = event.clientY; - } - - var doc = document.documentElement; - var body = document.body; - return clientY + - ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } -}; - -/** - * Get the absolute, horizontal mouse position from an event. - * @param {Event} event - * @return {Number} pageX - */ -util.getPageX = function(event) { - if ('pageY' in event) { - return event.pageX; - } - else { - var clientX; - if (('targetTouches' in event) && event.targetTouches.length) { - clientX = event.targetTouches[0].clientX; - } - else { - clientX = event.clientX; - } - - var doc = document.documentElement; - var body = document.body; - return clientX + - ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - } +exports.getAbsoluteTop = function(elem) { + return elem.getBoundingClientRect().top + window.pageYOffset; }; /** @@ -506,7 +435,7 @@ util.getPageX = function(event) { * @param {Element} elem * @param {String} className */ -util.addClassName = function(elem, className) { +exports.addClassName = function(elem, className) { var classes = elem.className.split(' '); if (classes.indexOf(className) == -1) { classes.push(className); // add the class to the array @@ -519,7 +448,7 @@ util.addClassName = function(elem, className) { * @param {Element} elem * @param {String} className */ -util.removeClassName = function(elem, className) { +exports.removeClassName = function(elem, className) { var classes = elem.className.split(' '); var index = classes.indexOf(className); if (index != -1) { @@ -537,7 +466,7 @@ util.removeClassName = function(elem, className) { * the object or array with three parameters: * callback(value, index, object) */ -util.forEach = function(object, callback) { +exports.forEach = function(object, callback) { var i, len; if (object instanceof Array) { @@ -562,7 +491,7 @@ util.forEach = function(object, callback) { * @param {Object} object * @param {Array} array */ -util.toArray = function(object) { +exports.toArray = function(object) { var array = []; for (var prop in object) { @@ -579,7 +508,7 @@ util.toArray = function(object) { * @param {*} value * @return {Boolean} changed */ -util.updateProperty = function(object, key, value) { +exports.updateProperty = function(object, key, value) { if (object[key] !== value) { object[key] = value; return true; @@ -597,7 +526,7 @@ util.updateProperty = function(object, key, value) { * @param {function} listener The callback function to be executed * @param {boolean} [useCapture] */ -util.addEventListener = function(element, action, listener, useCapture) { +exports.addEventListener = function(element, action, listener, useCapture) { if (element.addEventListener) { if (useCapture === undefined) useCapture = false; @@ -619,7 +548,7 @@ util.addEventListener = function(element, action, listener, useCapture) { * @param {function} listener The listener function * @param {boolean} [useCapture] */ -util.removeEventListener = function(element, action, listener, useCapture) { +exports.removeEventListener = function(element, action, listener, useCapture) { if (element.removeEventListener) { // non-IE browsers if (useCapture === undefined) @@ -636,13 +565,27 @@ util.removeEventListener = function(element, action, listener, useCapture) { } }; +/** + * Cancels the event if it is cancelable, without stopping further propagation of the event. + */ +exports.preventDefault = function (event) { + if (!event) + event = window.event; + + if (event.preventDefault) { + event.preventDefault(); // non-IE browsers + } + else { + event.returnValue = false; // IE browsers + } +}; /** * Get HTML element which is the target of the event * @param {Event} event * @return {Element} target element */ -util.getTarget = function(event) { +exports.getTarget = function(event) { // code from http://www.quirksmode.org/js/events_properties.html if (!event) { event = window.event; @@ -665,34 +608,7 @@ util.getTarget = function(event) { return target; }; -/** - * Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent - * @param {Element} element - * @param {Event} event - */ -util.fakeGesture = function(element, event) { - var eventType = null; - - // for hammer.js 1.0.5 - var gesture = Hammer.event.collectEventData(this, eventType, event); - - // for hammer.js 1.0.6 - //var touches = Hammer.event.getTouchList(event, eventType); - // var gesture = Hammer.event.collectEventData(this, eventType, touches, event); - - // on IE in standards mode, no touches are recognized by hammer.js, - // resulting in NaN values for center.pageX and center.pageY - if (isNaN(gesture.center.pageX)) { - gesture.center.pageX = event.pageX; - } - if (isNaN(gesture.center.pageY)) { - gesture.center.pageY = event.pageY; - } - - return gesture; -}; - -util.option = {}; +exports.option = {}; /** * Convert a value into a boolean @@ -700,7 +616,7 @@ util.option = {}; * @param {Boolean} [defaultValue] * @returns {Boolean} bool */ -util.option.asBoolean = function (value, defaultValue) { +exports.option.asBoolean = function (value, defaultValue) { if (typeof value == 'function') { value = value(); } @@ -718,7 +634,7 @@ util.option.asBoolean = function (value, defaultValue) { * @param {Number} [defaultValue] * @returns {Number} number */ -util.option.asNumber = function (value, defaultValue) { +exports.option.asNumber = function (value, defaultValue) { if (typeof value == 'function') { value = value(); } @@ -736,7 +652,7 @@ util.option.asNumber = function (value, defaultValue) { * @param {String} [defaultValue] * @returns {String} str */ -util.option.asString = function (value, defaultValue) { +exports.option.asString = function (value, defaultValue) { if (typeof value == 'function') { value = value(); } @@ -754,15 +670,15 @@ util.option.asString = function (value, defaultValue) { * @param {String} [defaultValue] * @returns {String} size */ -util.option.asSize = function (value, defaultValue) { +exports.option.asSize = function (value, defaultValue) { if (typeof value == 'function') { value = value(); } - if (util.isString(value)) { + if (exports.isString(value)) { return value; } - else if (util.isNumber(value)) { + else if (exports.isNumber(value)) { return value + 'px'; } else { @@ -776,7 +692,7 @@ util.option.asSize = function (value, defaultValue) { * @param {HTMLElement} [defaultValue] * @returns {HTMLElement | null} dom */ -util.option.asElement = function (value, defaultValue) { +exports.option.asElement = function (value, defaultValue) { if (typeof value == 'function') { value = value(); } @@ -786,7 +702,7 @@ util.option.asElement = function (value, defaultValue) { -util.GiveDec = function(Hex) { +exports.GiveDec = function(Hex) { var Value; if (Hex == "A") @@ -807,7 +723,7 @@ util.GiveDec = function(Hex) { return Value; }; -util.GiveHex = function(Dec) { +exports.GiveHex = function(Dec) { var Value; if(Dec == 10) @@ -834,15 +750,19 @@ util.GiveHex = function(Dec) { * @param {Object | String} color * @return {Object} colorObject */ -util.parseColor = function(color) { +exports.parseColor = function(color) { var c; - if (util.isString(color)) { - if (util.isValidHex(color)) { - var hsv = util.hexToHSV(color); + if (exports.isString(color)) { + if (exports.isValidRGB(color)) { + var rgb = color.substr(4).substr(0,color.length-5).split(','); + color = exports.RGBToHex(rgb[0],rgb[1],rgb[2]); + } + if (exports.isValidHex(color)) { + var hsv = exports.hexToHSV(color); var lighterColorHSV = {h:hsv.h,s:hsv.s * 0.45,v:Math.min(1,hsv.v * 1.05)}; var darkerColorHSV = {h:hsv.h,s:Math.min(1,hsv.v * 1.25),v:hsv.v*0.6}; - var darkerColorHex = util.HSVToHex(darkerColorHSV.h ,darkerColorHSV.h ,darkerColorHSV.v); - var lighterColorHex = util.HSVToHex(lighterColorHSV.h,lighterColorHSV.s,lighterColorHSV.v); + var darkerColorHex = exports.HSVToHex(darkerColorHSV.h ,darkerColorHSV.h ,darkerColorHSV.v); + var lighterColorHex = exports.HSVToHex(lighterColorHSV.h,lighterColorHSV.s,lighterColorHSV.v); c = { background: color, @@ -877,7 +797,7 @@ util.parseColor = function(color) { c.background = color.background || 'white'; c.border = color.border || c.background; - if (util.isString(color.highlight)) { + if (exports.isString(color.highlight)) { c.highlight = { border: color.highlight, background: color.highlight @@ -889,7 +809,7 @@ util.parseColor = function(color) { c.highlight.border = color.highlight && color.highlight.border || c.border; } - if (util.isString(color.hover)) { + if (exports.isString(color.hover)) { c.hover = { border: color.hover, background: color.hover @@ -911,15 +831,15 @@ util.parseColor = function(color) { * @param {String} hex * @returns {{r: *, g: *, b: *}} */ -util.hexToRGB = function(hex) { +exports.hexToRGB = function(hex) { hex = hex.replace("#","").toUpperCase(); - var a = util.GiveDec(hex.substring(0, 1)); - var b = util.GiveDec(hex.substring(1, 2)); - var c = util.GiveDec(hex.substring(2, 3)); - var d = util.GiveDec(hex.substring(3, 4)); - var e = util.GiveDec(hex.substring(4, 5)); - var f = util.GiveDec(hex.substring(5, 6)); + var a = exports.GiveDec(hex.substring(0, 1)); + var b = exports.GiveDec(hex.substring(1, 2)); + var c = exports.GiveDec(hex.substring(2, 3)); + var d = exports.GiveDec(hex.substring(3, 4)); + var e = exports.GiveDec(hex.substring(4, 5)); + var f = exports.GiveDec(hex.substring(5, 6)); var r = (a * 16) + b; var g = (c * 16) + d; @@ -928,13 +848,13 @@ util.hexToRGB = function(hex) { return {r:r,g:g,b:b}; }; -util.RGBToHex = function(red,green,blue) { - var a = util.GiveHex(Math.floor(red / 16)); - var b = util.GiveHex(red % 16); - var c = util.GiveHex(Math.floor(green / 16)); - var d = util.GiveHex(green % 16); - var e = util.GiveHex(Math.floor(blue / 16)); - var f = util.GiveHex(blue % 16); +exports.RGBToHex = function(red,green,blue) { + var a = exports.GiveHex(Math.floor(red / 16)); + var b = exports.GiveHex(red % 16); + var c = exports.GiveHex(Math.floor(green / 16)); + var d = exports.GiveHex(green % 16); + var e = exports.GiveHex(Math.floor(blue / 16)); + var f = exports.GiveHex(blue % 16); var hex = a + b + c + d + e + f; return "#" + hex; @@ -950,7 +870,7 @@ util.RGBToHex = function(red,green,blue) { * @returns {*} * @constructor */ -util.RGBToHSV = function(red,green,blue) { +exports.RGBToHSV = function(red,green,blue) { red=red/255; green=green/255; blue=blue/255; var minRGB = Math.min(red,Math.min(green,blue)); var maxRGB = Math.max(red,Math.max(green,blue)); @@ -972,13 +892,13 @@ util.RGBToHSV = function(red,green,blue) { /** * https://gist.github.com/mjijackson/5311256 - * @param hue - * @param saturation - * @param value + * @param h + * @param s + * @param v * @returns {{r: number, g: number, b: number}} * @constructor */ -util.HSVToRGB = function(h, s, v) { +exports.HSVToRGB = function(h, s, v) { var r, g, b; var i = Math.floor(h * 6); @@ -999,21 +919,26 @@ util.HSVToRGB = function(h, s, v) { return {r:Math.floor(r * 255), g:Math.floor(g * 255), b:Math.floor(b * 255) }; }; -util.HSVToHex = function(h, s, v) { - var rgb = util.HSVToRGB(h, s, v); - return util.RGBToHex(rgb.r, rgb.g, rgb.b); +exports.HSVToHex = function(h, s, v) { + var rgb = exports.HSVToRGB(h, s, v); + return exports.RGBToHex(rgb.r, rgb.g, rgb.b); }; -util.hexToHSV = function(hex) { - var rgb = util.hexToRGB(hex); - return util.RGBToHSV(rgb.r, rgb.g, rgb.b); +exports.hexToHSV = function(hex) { + var rgb = exports.hexToRGB(hex); + return exports.RGBToHSV(rgb.r, rgb.g, rgb.b); }; -util.isValidHex = function(hex) { +exports.isValidHex = function(hex) { var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); return isOk; }; +exports.isValidRGB = function(rgb) { + rgb = rgb.replace(" ",""); + var isOk = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(rgb); + return isOk; +} /** * This recursively redirects the prototype of JSON objects to the referenceObject @@ -1022,13 +947,13 @@ util.isValidHex = function(hex) { * @param referenceObject * @returns {*} */ -util.selectiveBridgeObject = function(fields, referenceObject) { +exports.selectiveBridgeObject = function(fields, referenceObject) { if (typeof referenceObject == "object") { var objectTo = Object.create(referenceObject); for (var i = 0; i < fields.length; i++) { if (referenceObject.hasOwnProperty(fields[i])) { if (typeof referenceObject[fields[i]] == "object") { - objectTo[fields[i]] = util.bridgeObject(referenceObject[fields[i]]); + objectTo[fields[i]] = exports.bridgeObject(referenceObject[fields[i]]); } } } @@ -1046,13 +971,13 @@ util.selectiveBridgeObject = function(fields, referenceObject) { * @param referenceObject * @returns {*} */ -util.bridgeObject = function(referenceObject) { +exports.bridgeObject = function(referenceObject) { if (typeof referenceObject == "object") { var objectTo = Object.create(referenceObject); for (var i in referenceObject) { if (referenceObject.hasOwnProperty(i)) { if (typeof referenceObject[i] == "object") { - objectTo[i] = util.bridgeObject(referenceObject[i]); + objectTo[i] = exports.bridgeObject(referenceObject[i]); } } } @@ -1073,7 +998,7 @@ util.bridgeObject = function(referenceObject) { * @param [String] option | this is the option key in the options argument * @private */ -util.mergeOptions = function (mergeTarget, options, option) { +exports.mergeOptions = function (mergeTarget, options, option) { if (options[option] !== undefined) { if (typeof options[option] == 'boolean') { mergeTarget[option].enabled = options[option]; @@ -1099,7 +1024,7 @@ util.mergeOptions = function (mergeTarget, options, option) { * @param [String] option | this is the option key in the options argument * @private */ -util.mergeOptions = function (mergeTarget, options, option) { +exports.mergeOptions = function (mergeTarget, options, option) { if (options[option] !== undefined) { if (typeof options[option] == 'boolean') { mergeTarget[option].enabled = options[option]; @@ -1128,27 +1053,31 @@ util.mergeOptions = function (mergeTarget, options, option) { * before and after the current range is handled by simply checking if it was in view before and if it is again. For all the rest, * either the start OR end time has to be in the range. * - * @param {{byStart: Item[], byEnd: Item[]}} orderedItems + * @param {Item[]} orderedItems Items ordered by start * @param {{start: number, end: number}} range - * @param {Boolean} byEnd + * @param {String} field + * @param {String} field2 * @returns {number} * @private */ -util.binarySearch = function(orderedItems, range, field, field2) { +exports.binarySearch = function(orderedItems, range, field, field2) { var array = orderedItems; - var interval = range.end - range.start; + var maxIterations = 10000; + var iteration = 0; var found = false; var low = 0; var high = array.length; + var newLow = low; + var newHigh = high; var guess = Math.floor(0.5*(high+low)); - var newGuess; var value; - if (high == 0) {guess = -1;} + if (high == 0) { + guess = -1; + } else if (high == 1) { - value = field2 === undefined ? array[guess][field] : array[guess][field][field2]; - if ((value > range.start - interval) && (value < range.end)) { + if (array[guess].isVisible(range)) { guess = 0; } else { @@ -1157,28 +1086,34 @@ util.binarySearch = function(orderedItems, range, field, field2) { } else { high -= 1; - while (found == false) { + + while (found == false && iteration < maxIterations) { value = field2 === undefined ? array[guess][field] : array[guess][field][field2]; - if ((value > range.start - interval) && (value < range.end)) { + + if (array[guess].isVisible(range)) { found = true; } else { - if (value < range.start - interval) { // it is too small --> increase low - low = Math.floor(0.5*(high+low)); + if (value < range.start) { // it is too small --> increase low + newLow = Math.floor(0.5*(high+low)); } else { // it is too big --> decrease high - high = Math.floor(0.5*(high+low)); + newHigh = Math.floor(0.5*(high+low)); } - newGuess = Math.floor(0.5*(high+low)); // not in list; - if (guess == newGuess) { + if (low == newLow && high == newHigh) { guess = -1; found = true; } else { - guess = newGuess; + high = newHigh; low = newLow; + guess = Math.floor(0.5*(high+low)); } } + iteration++; + } + if (iteration >= maxIterations) { + console.log("BinarySearch too many iterations. Aborting."); } } return guess; @@ -1196,15 +1131,20 @@ util.binarySearch = function(orderedItems, range, field, field2) { * * @param {Array} orderedItems * @param {{start: number, end: number}} target - * @param {Boolean} byEnd + * @param {String} field + * @param {String} sidePreference 'before' or 'after' * @returns {number} * @private */ -util.binarySearchGeneric = function(orderedItems, target, field, sidePreference) { +exports.binarySearchGeneric = function(orderedItems, target, field, sidePreference) { + var maxIterations = 10000; + var iteration = 0; var array = orderedItems; var found = false; var low = 0; var high = array.length; + var newLow = low; + var newHigh = high; var guess = Math.floor(0.5*(high+low)); var newGuess; var prevValue, value, nextValue; @@ -1221,7 +1161,7 @@ util.binarySearchGeneric = function(orderedItems, target, field, sidePreference) } else { high -= 1; - while (found == false) { + while (found == false && iteration < maxIterations) { prevValue = array[Math.max(0,guess - 1)][field]; value = array[guess][field]; nextValue = array[Math.min(array.length-1,guess + 1)][field]; @@ -1243,21 +1183,26 @@ util.binarySearchGeneric = function(orderedItems, target, field, sidePreference) } else { if (value < target) { // it is too small --> increase low - low = Math.floor(0.5*(high+low)); + newLow = Math.floor(0.5*(high+low)); } else { // it is too big --> decrease high - high = Math.floor(0.5*(high+low)); + newHigh = Math.floor(0.5*(high+low)); } newGuess = Math.floor(0.5*(high+low)); // not in list; - if (guess == newGuess) { - guess = -2; + if (low == newLow && high == newHigh) { + guess = -1; found = true; } else { - guess = newGuess; + high = newHigh; low = newLow; + guess = Math.floor(0.5*(high+low)); } } + iteration++; + } + if (iteration >= maxIterations) { + console.log("BinarySearch too many iterations. Aborting."); } } return guess; diff --git a/misc/how_to_publish.md b/misc/how_to_publish.md index b7b4414c..84dde94b 100644 --- a/misc/how_to_publish.md +++ b/misc/how_to_publish.md @@ -31,7 +31,7 @@ This generates the vis.js library in the folder `./dist`. - Push the branches to github - Create a version tag (with the new version number) and push it to github: - git tag v0.3.0 + git tag v3.1.0 git push --tags diff --git a/package.json b/package.json index d4a877c3..909b5239 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vis", - "version": "3.0.0", + "version": "3.1.0", "description": "A dynamic, browser-based visualization library.", "homepage": "http://visjs.org/", "repository": { @@ -20,21 +20,32 @@ "network", "browser" ], + "main": "./index", "scripts": { - "test": "jake test --trace", - "build": "jake --trace" + "test": "mocha", + "build": "gulp", + "watch": "gulp watch", + "watch-dev": "gulp watch --bundle" + }, + "dependencies": { + "emitter-component": "^1.1.1", + "hammerjs": "^1.1.0", + "moment": "^2.7.0", + "mousetrap": "0.0.1" }, - "dependencies": {}, "devDependencies": { - "jake": "latest", - "jake-utils": "latest", "clean-css": "latest", - "browserify": "3.22", + "gulp": "^3.8.5", + "gulp-concat": "^2.2.0", + "gulp-minify-css": "^0.3.6", + "gulp-rename": "^1.2.0", + "gulp-util": "^2.2.19", + "merge-stream": "^0.1.5", + "mocha": "^1.20.1", + "rimraf": "^2.2.8", + "uglify-js": "^2.4.14", + "webpack": "^1.3.1-beta7", "wrench": "latest", - "moment": "latest", - "hammerjs": "1.0.5", - "mousetrap": "latest", - "emitter-component": "latest", - "node-watch": "latest" + "yargs": "^1.2.6" } } diff --git a/src/module/exports.js b/src/module/exports.js deleted file mode 100644 index 076e04cf..00000000 --- a/src/module/exports.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * vis.js module exports - */ -var vis = { - moment: moment, - - util: util, - DOMutil: DOMutil, - - DataSet: DataSet, - DataView: DataView, - - Timeline: Timeline, - Graph2d: Graph2d, - timeline: { - DataStep: DataStep, - Range: Range, - stack: stack, - TimeStep: TimeStep, - - components: { - items: { - Item: Item, - ItemBox: ItemBox, - ItemPoint: ItemPoint, - ItemRange: ItemRange - }, - - Component: Component, - CurrentTime: CurrentTime, - CustomTime: CustomTime, - DataAxis: DataAxis, - GraphGroup: GraphGroup, - Group: Group, - ItemSet: ItemSet, - Legend: Legend, - LineGraph: LineGraph, - TimeAxis: TimeAxis - } - }, - - Network: Network, - network: { - Edge: Edge, - Groups: Groups, - Images: Images, - Node: Node, - Popup: Popup - }, - - // Deprecated since v3.0.0 - Graph: function () { - throw new Error('Graph is renamed to Network. Please create a graph as new vis.Network(...)'); - }, - - Graph3d: Graph3d -}; - -/** - * CommonJS module exports - */ -if (typeof exports !== 'undefined') { - exports = vis; -} -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = vis; -} - -/** - * AMD module exports - */ -if (typeof(define) === 'function') { - define(function () { - return vis; - }); -} - -/** - * Window exports - */ -if (typeof window !== 'undefined') { - // attach the module to the window, load as a regular javascript file - window['vis'] = vis; -} diff --git a/src/module/imports.js b/src/module/imports.js deleted file mode 100644 index bda6f792..00000000 --- a/src/module/imports.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * vis.js module imports - */ - -// Try to load dependencies from the global window object. -// If not available there, load via require. - -var moment = (typeof window !== 'undefined') && window['moment'] || require('moment'); -var Emitter = require('emitter-component'); - -var Hammer; -if (typeof window !== 'undefined') { - // load hammer.js only when running in a browser (where window is available) - Hammer = window['Hammer'] || require('hammerjs'); -} -else { - Hammer = function () { - throw Error('hammer.js is only available in a browser, not in node.js.'); - } -} - -var mousetrap; -if (typeof window !== 'undefined') { - // load mousetrap.js only when running in a browser (where window is available) - mousetrap = window['mousetrap'] || require('mousetrap'); -} -else { - mousetrap = function () { - throw Error('mouseTrap is only available in a browser, not in node.js.'); - } -} diff --git a/src/network/dotparser.js b/src/network/dotparser.js deleted file mode 100644 index 71576079..00000000 --- a/src/network/dotparser.js +++ /dev/null @@ -1,829 +0,0 @@ -(function(exports) { - /** - * Parse a text source containing data in DOT language into a JSON object. - * The object contains two lists: one with nodes and one with edges. - * - * DOT language reference: http://www.graphviz.org/doc/info/lang.html - * - * @param {String} data Text containing a graph in DOT-notation - * @return {Object} graph An object containing two parameters: - * {Object[]} nodes - * {Object[]} edges - */ - function parseDOT (data) { - dot = data; - return parseGraph(); - } - - // token types enumeration - var TOKENTYPE = { - NULL : 0, - DELIMITER : 1, - IDENTIFIER: 2, - UNKNOWN : 3 - }; - - // map with all delimiters - var DELIMITERS = { - '{': true, - '}': true, - '[': true, - ']': true, - ';': true, - '=': true, - ',': true, - - '->': true, - '--': true - }; - - var dot = ''; // current dot file - var index = 0; // current index in dot file - var c = ''; // current token character in expr - var token = ''; // current token - var tokenType = TOKENTYPE.NULL; // type of the token - - /** - * Get the first character from the dot file. - * The character is stored into the char c. If the end of the dot file is - * reached, the function puts an empty string in c. - */ - function first() { - index = 0; - c = dot.charAt(0); - } - - /** - * Get the next character from the dot file. - * The character is stored into the char c. If the end of the dot file is - * reached, the function puts an empty string in c. - */ - function next() { - index++; - c = dot.charAt(index); - } - - /** - * Preview the next character from the dot file. - * @return {String} cNext - */ - function nextPreview() { - return dot.charAt(index + 1); - } - - /** - * Test whether given character is alphabetic or numeric - * @param {String} c - * @return {Boolean} isAlphaNumeric - */ - var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; - function isAlphaNumeric(c) { - return regexAlphaNumeric.test(c); - } - - /** - * Merge all properties of object b into object b - * @param {Object} a - * @param {Object} b - * @return {Object} a - */ - function merge (a, b) { - if (!a) { - a = {}; - } - - if (b) { - for (var name in b) { - if (b.hasOwnProperty(name)) { - a[name] = b[name]; - } - } - } - return a; - } - - /** - * Set a value in an object, where the provided parameter name can be a - * path with nested parameters. For example: - * - * var obj = {a: 2}; - * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} - * - * @param {Object} obj - * @param {String} path A parameter name or dot-separated parameter path, - * like "color.highlight.border". - * @param {*} value - */ - function setValue(obj, path, value) { - var keys = path.split('.'); - var o = obj; - while (keys.length) { - var key = keys.shift(); - if (keys.length) { - // this isn't the end point - if (!o[key]) { - o[key] = {}; - } - o = o[key]; - } - else { - // this is the end point - o[key] = value; - } - } - } - - /** - * Add a node to a graph object. If there is already a node with - * the same id, their attributes will be merged. - * @param {Object} graph - * @param {Object} node - */ - function addNode(graph, node) { - var i, len; - var current = null; - - // find root graph (in case of subgraph) - var graphs = [graph]; // list with all graphs from current graph to root graph - var root = graph; - while (root.parent) { - graphs.push(root.parent); - root = root.parent; - } - - // find existing node (at root level) by its id - if (root.nodes) { - for (i = 0, len = root.nodes.length; i < len; i++) { - if (node.id === root.nodes[i].id) { - current = root.nodes[i]; - break; - } - } - } - - if (!current) { - // this is a new node - current = { - id: node.id - }; - if (graph.node) { - // clone default attributes - current.attr = merge(current.attr, graph.node); - } - } - - // add node to this (sub)graph and all its parent graphs - for (i = graphs.length - 1; i >= 0; i--) { - var g = graphs[i]; - - if (!g.nodes) { - g.nodes = []; - } - if (g.nodes.indexOf(current) == -1) { - g.nodes.push(current); - } - } - - // merge attributes - if (node.attr) { - current.attr = merge(current.attr, node.attr); - } - } - - /** - * Add an edge to a graph object - * @param {Object} graph - * @param {Object} edge - */ - function addEdge(graph, edge) { - if (!graph.edges) { - graph.edges = []; - } - graph.edges.push(edge); - if (graph.edge) { - var attr = merge({}, graph.edge); // clone default attributes - edge.attr = merge(attr, edge.attr); // merge attributes - } - } - - /** - * Create an edge to a graph object - * @param {Object} graph - * @param {String | Number | Object} from - * @param {String | Number | Object} to - * @param {String} type - * @param {Object | null} attr - * @return {Object} edge - */ - function createEdge(graph, from, to, type, attr) { - var edge = { - from: from, - to: to, - type: type - }; - - if (graph.edge) { - edge.attr = merge({}, graph.edge); // clone default attributes - } - edge.attr = merge(edge.attr || {}, attr); // merge attributes - - return edge; - } - - /** - * Get next token in the current dot file. - * The token and token type are available as token and tokenType - */ - function getToken() { - tokenType = TOKENTYPE.NULL; - token = ''; - - // skip over whitespaces - while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter - next(); - } - - do { - var isComment = false; - - // skip comment - if (c == '#') { - // find the previous non-space character - var i = index - 1; - while (dot.charAt(i) == ' ' || dot.charAt(i) == '\t') { - i--; - } - if (dot.charAt(i) == '\n' || dot.charAt(i) == '') { - // the # is at the start of a line, this is indeed a line comment - while (c != '' && c != '\n') { - next(); - } - isComment = true; - } - } - if (c == '/' && nextPreview() == '/') { - // skip line comment - while (c != '' && c != '\n') { - next(); - } - isComment = true; - } - if (c == '/' && nextPreview() == '*') { - // skip block comment - while (c != '') { - if (c == '*' && nextPreview() == '/') { - // end of block comment found. skip these last two characters - next(); - next(); - break; - } - else { - next(); - } - } - isComment = true; - } - - // skip over whitespaces - while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter - next(); - } - } - while (isComment); - - // check for end of dot file - if (c == '') { - // token is still empty - tokenType = TOKENTYPE.DELIMITER; - return; - } - - // check for delimiters consisting of 2 characters - var c2 = c + nextPreview(); - if (DELIMITERS[c2]) { - tokenType = TOKENTYPE.DELIMITER; - token = c2; - next(); - next(); - return; - } - - // check for delimiters consisting of 1 character - if (DELIMITERS[c]) { - tokenType = TOKENTYPE.DELIMITER; - token = c; - next(); - return; - } - - // check for an identifier (number or string) - // TODO: more precise parsing of numbers/strings (and the port separator ':') - if (isAlphaNumeric(c) || c == '-') { - token += c; - next(); - - while (isAlphaNumeric(c)) { - token += c; - next(); - } - if (token == 'false') { - token = false; // convert to boolean - } - else if (token == 'true') { - token = true; // convert to boolean - } - else if (!isNaN(Number(token))) { - token = Number(token); // convert to number - } - tokenType = TOKENTYPE.IDENTIFIER; - return; - } - - // check for a string enclosed by double quotes - if (c == '"') { - next(); - while (c != '' && (c != '"' || (c == '"' && nextPreview() == '"'))) { - token += c; - if (c == '"') { // skip the escape character - next(); - } - next(); - } - if (c != '"') { - throw newSyntaxError('End of string " expected'); - } - next(); - tokenType = TOKENTYPE.IDENTIFIER; - return; - } - - // something unknown is found, wrong characters, a syntax error - tokenType = TOKENTYPE.UNKNOWN; - while (c != '') { - token += c; - next(); - } - throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"'); - } - - /** - * Parse a graph. - * @returns {Object} graph - */ - function parseGraph() { - var graph = {}; - - first(); - getToken(); - - // optional strict keyword - if (token == 'strict') { - graph.strict = true; - getToken(); - } - - // graph or digraph keyword - if (token == 'graph' || token == 'digraph') { - graph.type = token; - getToken(); - } - - // optional graph id - if (tokenType == TOKENTYPE.IDENTIFIER) { - graph.id = token; - getToken(); - } - - // open angle bracket - if (token != '{') { - throw newSyntaxError('Angle bracket { expected'); - } - getToken(); - - // statements - parseStatements(graph); - - // close angle bracket - if (token != '}') { - throw newSyntaxError('Angle bracket } expected'); - } - getToken(); - - // end of file - if (token !== '') { - throw newSyntaxError('End of file expected'); - } - getToken(); - - // remove temporary default properties - delete graph.node; - delete graph.edge; - delete graph.graph; - - return graph; - } - - /** - * Parse a list with statements. - * @param {Object} graph - */ - function parseStatements (graph) { - while (token !== '' && token != '}') { - parseStatement(graph); - if (token == ';') { - getToken(); - } - } - } - - /** - * Parse a single statement. Can be a an attribute statement, node - * statement, a series of node statements and edge statements, or a - * parameter. - * @param {Object} graph - */ - function parseStatement(graph) { - // parse subgraph - var subgraph = parseSubgraph(graph); - if (subgraph) { - // edge statements - parseEdge(graph, subgraph); - - return; - } - - // parse an attribute statement - var attr = parseAttributeStatement(graph); - if (attr) { - return; - } - - // parse node - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier expected'); - } - var id = token; // id can be a string or a number - getToken(); - - if (token == '=') { - // id statement - getToken(); - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier expected'); - } - graph[id] = token; - getToken(); - // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " - } - else { - parseNodeStatement(graph, id); - } - } - - /** - * Parse a subgraph - * @param {Object} graph parent graph object - * @return {Object | null} subgraph - */ - function parseSubgraph (graph) { - var subgraph = null; - - // optional subgraph keyword - if (token == 'subgraph') { - subgraph = {}; - subgraph.type = 'subgraph'; - getToken(); - - // optional graph id - if (tokenType == TOKENTYPE.IDENTIFIER) { - subgraph.id = token; - getToken(); - } - } - - // open angle bracket - if (token == '{') { - getToken(); - - if (!subgraph) { - subgraph = {}; - } - subgraph.parent = graph; - subgraph.node = graph.node; - subgraph.edge = graph.edge; - subgraph.graph = graph.graph; - - // statements - parseStatements(subgraph); - - // close angle bracket - if (token != '}') { - throw newSyntaxError('Angle bracket } expected'); - } - getToken(); - - // remove temporary default properties - delete subgraph.node; - delete subgraph.edge; - delete subgraph.graph; - delete subgraph.parent; - - // register at the parent graph - if (!graph.subgraphs) { - graph.subgraphs = []; - } - graph.subgraphs.push(subgraph); - } - - return subgraph; - } - - /** - * parse an attribute statement like "node [shape=circle fontSize=16]". - * Available keywords are 'node', 'edge', 'graph'. - * The previous list with default attributes will be replaced - * @param {Object} graph - * @returns {String | null} keyword Returns the name of the parsed attribute - * (node, edge, graph), or null if nothing - * is parsed. - */ - function parseAttributeStatement (graph) { - // attribute statements - if (token == 'node') { - getToken(); - - // node attributes - graph.node = parseAttributeList(); - return 'node'; - } - else if (token == 'edge') { - getToken(); - - // edge attributes - graph.edge = parseAttributeList(); - return 'edge'; - } - else if (token == 'graph') { - getToken(); - - // graph attributes - graph.graph = parseAttributeList(); - return 'graph'; - } - - return null; - } - - /** - * parse a node statement - * @param {Object} graph - * @param {String | Number} id - */ - function parseNodeStatement(graph, id) { - // node statement - var node = { - id: id - }; - var attr = parseAttributeList(); - if (attr) { - node.attr = attr; - } - addNode(graph, node); - - // edge statements - parseEdge(graph, id); - } - - /** - * Parse an edge or a series of edges - * @param {Object} graph - * @param {String | Number} from Id of the from node - */ - function parseEdge(graph, from) { - while (token == '->' || token == '--') { - var to; - var type = token; - getToken(); - - var subgraph = parseSubgraph(graph); - if (subgraph) { - to = subgraph; - } - else { - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier or subgraph expected'); - } - to = token; - addNode(graph, { - id: to - }); - getToken(); - } - - // parse edge attributes - var attr = parseAttributeList(); - - // create edge - var edge = createEdge(graph, from, to, type, attr); - addEdge(graph, edge); - - from = to; - } - } - - /** - * Parse a set with attributes, - * for example [label="1.000", shape=solid] - * @return {Object | null} attr - */ - function parseAttributeList() { - var attr = null; - - while (token == '[') { - getToken(); - attr = {}; - while (token !== '' && token != ']') { - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Attribute name expected'); - } - var name = token; - - getToken(); - if (token != '=') { - throw newSyntaxError('Equal sign = expected'); - } - getToken(); - - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Attribute value expected'); - } - var value = token; - setValue(attr, name, value); // name can be a path - - getToken(); - if (token ==',') { - getToken(); - } - } - - if (token != ']') { - throw newSyntaxError('Bracket ] expected'); - } - getToken(); - } - - return attr; - } - - /** - * Create a syntax error with extra information on current token and index. - * @param {String} message - * @returns {SyntaxError} err - */ - function newSyntaxError(message) { - return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')'); - } - - /** - * Chop off text after a maximum length - * @param {String} text - * @param {Number} maxLength - * @returns {String} - */ - function chop (text, maxLength) { - return (text.length <= maxLength) ? text : (text.substr(0, 27) + '...'); - } - - /** - * Execute a function fn for each pair of elements in two arrays - * @param {Array | *} array1 - * @param {Array | *} array2 - * @param {function} fn - */ - function forEach2(array1, array2, fn) { - if (array1 instanceof Array) { - array1.forEach(function (elem1) { - if (array2 instanceof Array) { - array2.forEach(function (elem2) { - fn(elem1, elem2); - }); - } - else { - fn(elem1, array2); - } - }); - } - else { - if (array2 instanceof Array) { - array2.forEach(function (elem2) { - fn(array1, elem2); - }); - } - else { - fn(array1, array2); - } - } - } - - /** - * Convert a string containing a graph in DOT language into a map containing - * with nodes and edges in the format of graph. - * @param {String} data Text containing a graph in DOT-notation - * @return {Object} graphData - */ - function DOTToGraph (data) { - // parse the DOT file - var dotData = parseDOT(data); - var graphData = { - nodes: [], - edges: [], - options: {} - }; - - // copy the nodes - if (dotData.nodes) { - dotData.nodes.forEach(function (dotNode) { - var graphNode = { - id: dotNode.id, - label: String(dotNode.label || dotNode.id) - }; - merge(graphNode, dotNode.attr); - if (graphNode.image) { - graphNode.shape = 'image'; - } - graphData.nodes.push(graphNode); - }); - } - - // copy the edges - if (dotData.edges) { - /** - * Convert an edge in DOT format to an edge with VisGraph format - * @param {Object} dotEdge - * @returns {Object} graphEdge - */ - function convertEdge(dotEdge) { - var graphEdge = { - from: dotEdge.from, - to: dotEdge.to - }; - merge(graphEdge, dotEdge.attr); - graphEdge.style = (dotEdge.type == '->') ? 'arrow' : 'line'; - return graphEdge; - } - - dotData.edges.forEach(function (dotEdge) { - var from, to; - if (dotEdge.from instanceof Object) { - from = dotEdge.from.nodes; - } - else { - from = { - id: dotEdge.from - } - } - - if (dotEdge.to instanceof Object) { - to = dotEdge.to.nodes; - } - else { - to = { - id: dotEdge.to - } - } - - if (dotEdge.from instanceof Object && dotEdge.from.edges) { - dotEdge.from.edges.forEach(function (subEdge) { - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); - } - - forEach2(from, to, function (from, to) { - var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr); - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); - - if (dotEdge.to instanceof Object && dotEdge.to.edges) { - dotEdge.to.edges.forEach(function (subEdge) { - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); - } - }); - } - - // copy the options - if (dotData.attr) { - graphData.options = dotData.attr; - } - - return graphData; - } - - // exports - exports.parseDOT = parseDOT; - exports.DOTToGraph = DOTToGraph; - -})(typeof util !== 'undefined' ? util : exports); diff --git a/src/network/networkMixins/ClusterMixin.js b/src/network/networkMixins/ClusterMixin.js deleted file mode 100644 index 512ceb2a..00000000 --- a/src/network/networkMixins/ClusterMixin.js +++ /dev/null @@ -1,1143 +0,0 @@ -/** - * Creation of the ClusterMixin var. - * - * This contains all the functions the Network object can use to employ clustering - * - * Alex de Mulder - * 21-01-2013 - */ -var ClusterMixin = { - - /** - * This is only called in the constructor of the network object - * - */ - startWithClustering : function() { - // cluster if the data set is big - this.clusterToFit(this.constants.clustering.initialMaxNodes, true); - - // updates the lables after clustering - this.updateLabels(); - - // this is called here because if clusterin is disabled, the start and stabilize are called in - // the setData function. - if (this.stabilize) { - this._stabilize(); - } - this.start(); - }, - - /** - * This function clusters until the initialMaxNodes has been reached - * - * @param {Number} maxNumberOfNodes - * @param {Boolean} reposition - */ - clusterToFit : function(maxNumberOfNodes, reposition) { - var numberOfNodes = this.nodeIndices.length; - - var maxLevels = 50; - var level = 0; - - // we first cluster the hubs, then we pull in the outliers, repeat - while (numberOfNodes > maxNumberOfNodes && level < maxLevels) { - if (level % 3 == 0) { - this.forceAggregateHubs(true); - this.normalizeClusterLevels(); - } - else { - this.increaseClusterLevel(); // this also includes a cluster normalization - } - - numberOfNodes = this.nodeIndices.length; - level += 1; - } - - // after the clustering we reposition the nodes to reduce the initial chaos - if (level > 0 && reposition == true) { - this.repositionNodes(); - } - this._updateCalculationNodes(); - }, - - /** - * This function can be called to open up a specific cluster. It is only called by - * It will unpack the cluster back one level. - * - * @param node | Node object: cluster to open. - */ - openCluster : function(node) { - var isMovingBeforeClustering = this.moving; - if (node.clusterSize > this.constants.clustering.sectorThreshold && this._nodeInActiveArea(node) && - !(this._sector() == "default" && this.nodeIndices.length == 1)) { - // this loads a new sector, loads the nodes and edges and nodeIndices of it. - this._addSector(node); - var level = 0; - - // we decluster until we reach a decent number of nodes - while ((this.nodeIndices.length < this.constants.clustering.initialMaxNodes) && (level < 10)) { - this.decreaseClusterLevel(); - level += 1; - } - - } - else { - this._expandClusterNode(node,false,true); - - // update the index list, dynamic edges and labels - this._updateNodeIndexList(); - this._updateDynamicEdges(); - this._updateCalculationNodes(); - this.updateLabels(); - } - - // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded - if (this.moving != isMovingBeforeClustering) { - this.start(); - } - }, - - - /** - * This calls the updateClustes with default arguments - */ - updateClustersDefault : function() { - if (this.constants.clustering.enabled == true) { - this.updateClusters(0,false,false); - } - }, - - - /** - * This function can be called to increase the cluster level. This means that the nodes with only one edge connection will - * be clustered with their connected node. This can be repeated as many times as needed. - * This can be called externally (by a keybind for instance) to reduce the complexity of big datasets. - */ - increaseClusterLevel : function() { - this.updateClusters(-1,false,true); - }, - - - /** - * This function can be called to decrease the cluster level. This means that the nodes with only one edge connection will - * be unpacked if they are a cluster. This can be repeated as many times as needed. - * This can be called externally (by a key-bind for instance) to look into clusters without zooming. - */ - decreaseClusterLevel : function() { - this.updateClusters(1,false,true); - }, - - - /** - * This is the main clustering function. It clusters and declusters on zoom or forced - * This function clusters on zoom, it can be called with a predefined zoom direction - * If out, check if we can form clusters, if in, check if we can open clusters. - * This function is only called from _zoom() - * - * @param {Number} zoomDirection | -1 / 0 / +1 for zoomOut / determineByZoom / zoomIn - * @param {Boolean} recursive | enabled or disable recursive calling of the opening of clusters - * @param {Boolean} force | enabled or disable forcing - * @param {Boolean} doNotStart | if true do not call start - * - */ - updateClusters : function(zoomDirection,recursive,force,doNotStart) { - var isMovingBeforeClustering = this.moving; - var amountOfNodes = this.nodeIndices.length; - - // on zoom out collapse the sector if the scale is at the level the sector was made - if (this.previousScale > this.scale && zoomDirection == 0) { - this._collapseSector(); - } - - // check if we zoom in or out - if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out - // forming clusters when forced pulls outliers in. When not forced, the edge length of the - // outer nodes determines if it is being clustered - this._formClusters(force); - } - else if (this.previousScale < this.scale || zoomDirection == 1) { // zoom in - if (force == true) { - // _openClusters checks for each node if the formationScale of the cluster is smaller than - // the current scale and if so, declusters. When forced, all clusters are reduced by one step - this._openClusters(recursive,force); - } - else { - // if a cluster takes up a set percentage of the active window - this._openClustersBySize(); - } - } - this._updateNodeIndexList(); - - // if a cluster was NOT formed and the user zoomed out, we try clustering by hubs - if (this.nodeIndices.length == amountOfNodes && (this.previousScale > this.scale || zoomDirection == -1)) { - this._aggregateHubs(force); - this._updateNodeIndexList(); - } - - // we now reduce chains. - if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out - this.handleChains(); - this._updateNodeIndexList(); - } - - this.previousScale = this.scale; - - // rest of the update the index list, dynamic edges and labels - this._updateDynamicEdges(); - this.updateLabels(); - - // if a cluster was formed, we increase the clusterSession - if (this.nodeIndices.length < amountOfNodes) { // this means a clustering operation has taken place - this.clusterSession += 1; - // if clusters have been made, we normalize the cluster level - this.normalizeClusterLevels(); - } - - if (doNotStart == false || doNotStart === undefined) { - // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded - if (this.moving != isMovingBeforeClustering) { - this.start(); - } - } - - this._updateCalculationNodes(); - }, - - /** - * This function handles the chains. It is called on every updateClusters(). - */ - handleChains : function() { - // after clustering we check how many chains there are - var chainPercentage = this._getChainFraction(); - if (chainPercentage > this.constants.clustering.chainThreshold) { - this._reduceAmountOfChains(1 - this.constants.clustering.chainThreshold / chainPercentage) - - } - }, - - /** - * this functions starts clustering by hubs - * The minimum hub threshold is set globally - * - * @private - */ - _aggregateHubs : function(force) { - this._getHubSize(); - this._formClustersByHub(force,false); - }, - - - /** - * This function is fired by keypress. It forces hubs to form. - * - */ - forceAggregateHubs : function(doNotStart) { - var isMovingBeforeClustering = this.moving; - var amountOfNodes = this.nodeIndices.length; - - this._aggregateHubs(true); - - // update the index list, dynamic edges and labels - this._updateNodeIndexList(); - this._updateDynamicEdges(); - this.updateLabels(); - - // if a cluster was formed, we increase the clusterSession - if (this.nodeIndices.length != amountOfNodes) { - this.clusterSession += 1; - } - - if (doNotStart == false || doNotStart === undefined) { - // if the simulation was settled, we restart the simulation if a cluster has been formed or expanded - if (this.moving != isMovingBeforeClustering) { - this.start(); - } - } - }, - - /** - * If a cluster takes up more than a set percentage of the screen, open the cluster - * - * @private - */ - _openClustersBySize : function() { - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - var node = this.nodes[nodeId]; - if (node.inView() == true) { - if ((node.width*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || - (node.height*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { - this.openCluster(node); - } - } - } - } - }, - - - /** - * This function loops over all nodes in the nodeIndices list. For each node it checks if it is a cluster and if it - * has to be opened based on the current zoom level. - * - * @private - */ - _openClusters : function(recursive,force) { - for (var i = 0; i < this.nodeIndices.length; i++) { - var node = this.nodes[this.nodeIndices[i]]; - this._expandClusterNode(node,recursive,force); - this._updateCalculationNodes(); - } - }, - - /** - * This function checks if a node has to be opened. This is done by checking the zoom level. - * If the node contains child nodes, this function is recursively called on the child nodes as well. - * This recursive behaviour is optional and can be set by the recursive argument. - * - * @param {Node} parentNode | to check for cluster and expand - * @param {Boolean} recursive | enabled or disable recursive calling - * @param {Boolean} force | enabled or disable forcing - * @param {Boolean} [openAll] | This will recursively force all nodes in the parent to be released - * @private - */ - _expandClusterNode : function(parentNode, recursive, force, openAll) { - // first check if node is a cluster - if (parentNode.clusterSize > 1) { - // this means that on a double tap event or a zoom event, the cluster fully unpacks if it is smaller than 20 - if (parentNode.clusterSize < this.constants.clustering.sectorThreshold) { - openAll = true; - } - recursive = openAll ? true : recursive; - - // if the last child has been added on a smaller scale than current scale decluster - if (parentNode.formationScale < this.scale || force == true) { - // we will check if any of the contained child nodes should be removed from the cluster - for (var containedNodeId in parentNode.containedNodes) { - if (parentNode.containedNodes.hasOwnProperty(containedNodeId)) { - var childNode = parentNode.containedNodes[containedNodeId]; - - // force expand will expand the largest cluster size clusters. Since we cluster from outside in, we assume that - // the largest cluster is the one that comes from outside - if (force == true) { - if (childNode.clusterSession == parentNode.clusterSessions[parentNode.clusterSessions.length-1] - || openAll) { - this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); - } - } - else { - if (this._nodeInActiveArea(parentNode)) { - this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll); - } - } - } - } - } - } - }, - - /** - * ONLY CALLED FROM _expandClusterNode - * - * This function will expel a child_node from a parent_node. This is to de-cluster the node. This function will remove - * the child node from the parent contained_node object and put it back into the global nodes object. - * The same holds for the edge that was connected to the child node. It is moved back into the global edges object. - * - * @param {Node} parentNode | the parent node - * @param {String} containedNodeId | child_node id as it is contained in the containedNodes object of the parent node - * @param {Boolean} recursive | This will also check if the child needs to be expanded. - * With force and recursive both true, the entire cluster is unpacked - * @param {Boolean} force | This will disregard the zoom level and will expel this child from the parent - * @param {Boolean} openAll | This will recursively force all nodes in the parent to be released - * @private - */ - _expelChildFromParent : function(parentNode, containedNodeId, recursive, force, openAll) { - var childNode = parentNode.containedNodes[containedNodeId]; - - // if child node has been added on smaller scale than current, kick out - if (childNode.formationScale < this.scale || force == true) { - // unselect all selected items - this._unselectAll(); - - // put the child node back in the global nodes object - this.nodes[containedNodeId] = childNode; - - // release the contained edges from this childNode back into the global edges - this._releaseContainedEdges(parentNode,childNode); - - // reconnect rerouted edges to the childNode - this._connectEdgeBackToChild(parentNode,childNode); - - // validate all edges in dynamicEdges - this._validateEdges(parentNode); - - // undo the changes from the clustering operation on the parent node - parentNode.mass -= childNode.mass; - parentNode.clusterSize -= childNode.clusterSize; - parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); - parentNode.dynamicEdgesLength = parentNode.dynamicEdges.length; - - // place the child node near the parent, not at the exact same location to avoid chaos in the system - childNode.x = parentNode.x + parentNode.growthIndicator * (0.5 - Math.random()); - childNode.y = parentNode.y + parentNode.growthIndicator * (0.5 - Math.random()); - - // remove node from the list - delete parentNode.containedNodes[containedNodeId]; - - // check if there are other childs with this clusterSession in the parent. - var othersPresent = false; - for (var childNodeId in parentNode.containedNodes) { - if (parentNode.containedNodes.hasOwnProperty(childNodeId)) { - if (parentNode.containedNodes[childNodeId].clusterSession == childNode.clusterSession) { - othersPresent = true; - break; - } - } - } - // if there are no others, remove the cluster session from the list - if (othersPresent == false) { - parentNode.clusterSessions.pop(); - } - - this._repositionBezierNodes(childNode); -// this._repositionBezierNodes(parentNode); - - // remove the clusterSession from the child node - childNode.clusterSession = 0; - - // recalculate the size of the node on the next time the node is rendered - parentNode.clearSizeCache(); - - // restart the simulation to reorganise all nodes - this.moving = true; - } - - // check if a further expansion step is possible if recursivity is enabled - if (recursive == true) { - this._expandClusterNode(childNode,recursive,force,openAll); - } - }, - - - /** - * position the bezier nodes at the center of the edges - * - * @param node - * @private - */ - _repositionBezierNodes : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - node.dynamicEdges[i].positionBezierNode(); - } - }, - - - /** - * This function checks if any nodes at the end of their trees have edges below a threshold length - * This function is called only from updateClusters() - * forceLevelCollapse ignores the length of the edge and collapses one level - * This means that a node with only one edge will be clustered with its connected node - * - * @private - * @param {Boolean} force - */ - _formClusters : function(force) { - if (force == false) { - this._formClustersByZoom(); - } - else { - this._forceClustersByZoom(); - } - }, - - - /** - * This function handles the clustering by zooming out, this is based on a minimum edge distance - * - * @private - */ - _formClustersByZoom : function() { - var dx,dy,length, - minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; - - // check if any edges are shorter than minLength and start the clustering - // the clustering favours the node with the larger mass - for (var edgeId in this.edges) { - if (this.edges.hasOwnProperty(edgeId)) { - var edge = this.edges[edgeId]; - if (edge.connected) { - if (edge.toId != edge.fromId) { - dx = (edge.to.x - edge.from.x); - dy = (edge.to.y - edge.from.y); - length = Math.sqrt(dx * dx + dy * dy); - - - if (length < minLength) { - // first check which node is larger - var parentNode = edge.from; - var childNode = edge.to; - if (edge.to.mass > edge.from.mass) { - parentNode = edge.to; - childNode = edge.from; - } - - if (childNode.dynamicEdgesLength == 1) { - this._addToCluster(parentNode,childNode,false); - } - else if (parentNode.dynamicEdgesLength == 1) { - this._addToCluster(childNode,parentNode,false); - } - } - } - } - } - } - }, - - /** - * This function forces the network to cluster all nodes with only one connecting edge to their - * connected node. - * - * @private - */ - _forceClustersByZoom : function() { - for (var nodeId in this.nodes) { - // another node could have absorbed this child. - if (this.nodes.hasOwnProperty(nodeId)) { - var childNode = this.nodes[nodeId]; - - // the edges can be swallowed by another decrease - if (childNode.dynamicEdgesLength == 1 && childNode.dynamicEdges.length != 0) { - var edge = childNode.dynamicEdges[0]; - var parentNode = (edge.toId == childNode.id) ? this.nodes[edge.fromId] : this.nodes[edge.toId]; - - // group to the largest node - if (childNode.id != parentNode.id) { - if (parentNode.mass > childNode.mass) { - this._addToCluster(parentNode,childNode,true); - } - else { - this._addToCluster(childNode,parentNode,true); - } - } - } - } - } - }, - - - /** - * To keep the nodes of roughly equal size we normalize the cluster levels. - * This function clusters a node to its smallest connected neighbour. - * - * @param node - * @private - */ - _clusterToSmallestNeighbour : function(node) { - var smallestNeighbour = -1; - var smallestNeighbourNode = null; - for (var i = 0; i < node.dynamicEdges.length; i++) { - if (node.dynamicEdges[i] !== undefined) { - var neighbour = null; - if (node.dynamicEdges[i].fromId != node.id) { - neighbour = node.dynamicEdges[i].from; - } - else if (node.dynamicEdges[i].toId != node.id) { - neighbour = node.dynamicEdges[i].to; - } - - - if (neighbour != null && smallestNeighbour > neighbour.clusterSessions.length) { - smallestNeighbour = neighbour.clusterSessions.length; - smallestNeighbourNode = neighbour; - } - } - } - - if (neighbour != null && this.nodes[neighbour.id] !== undefined) { - this._addToCluster(neighbour, node, true); - } - }, - - - /** - * This function forms clusters from hubs, it loops over all nodes - * - * @param {Boolean} force | Disregard zoom level - * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges - * @private - */ - _formClustersByHub : function(force, onlyEqual) { - // we loop over all nodes in the list - for (var nodeId in this.nodes) { - // we check if it is still available since it can be used by the clustering in this loop - if (this.nodes.hasOwnProperty(nodeId)) { - this._formClusterFromHub(this.nodes[nodeId],force,onlyEqual); - } - } - }, - - /** - * This function forms a cluster from a specific preselected hub node - * - * @param {Node} hubNode | the node we will cluster as a hub - * @param {Boolean} force | Disregard zoom level - * @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges - * @param {Number} [absorptionSizeOffset] | - * @private - */ - _formClusterFromHub : function(hubNode, force, onlyEqual, absorptionSizeOffset) { - if (absorptionSizeOffset === undefined) { - absorptionSizeOffset = 0; - } - // we decide if the node is a hub - if ((hubNode.dynamicEdgesLength >= this.hubThreshold && onlyEqual == false) || - (hubNode.dynamicEdgesLength == this.hubThreshold && onlyEqual == true)) { - // initialize variables - var dx,dy,length; - var minLength = this.constants.clustering.clusterEdgeThreshold/this.scale; - var allowCluster = false; - - // we create a list of edges because the dynamicEdges change over the course of this loop - var edgesIdarray = []; - var amountOfInitialEdges = hubNode.dynamicEdges.length; - for (var j = 0; j < amountOfInitialEdges; j++) { - edgesIdarray.push(hubNode.dynamicEdges[j].id); - } - - // if the hub clustering is not forces, we check if one of the edges connected - // to a cluster is small enough based on the constants.clustering.clusterEdgeThreshold - if (force == false) { - allowCluster = false; - for (j = 0; j < amountOfInitialEdges; j++) { - var edge = this.edges[edgesIdarray[j]]; - if (edge !== undefined) { - if (edge.connected) { - if (edge.toId != edge.fromId) { - dx = (edge.to.x - edge.from.x); - dy = (edge.to.y - edge.from.y); - length = Math.sqrt(dx * dx + dy * dy); - - if (length < minLength) { - allowCluster = true; - break; - } - } - } - } - } - } - - // start the clustering if allowed - if ((!force && allowCluster) || force) { - // we loop over all edges INITIALLY connected to this hub - for (j = 0; j < amountOfInitialEdges; j++) { - edge = this.edges[edgesIdarray[j]]; - // the edge can be clustered by this function in a previous loop - if (edge !== undefined) { - var childNode = this.nodes[(edge.fromId == hubNode.id) ? edge.toId : edge.fromId]; - // we do not want hubs to merge with other hubs nor do we want to cluster itself. - if ((childNode.dynamicEdges.length <= (this.hubThreshold + absorptionSizeOffset)) && - (childNode.id != hubNode.id)) { - this._addToCluster(hubNode,childNode,force); - } - } - } - } - } - }, - - - - /** - * This function adds the child node to the parent node, creating a cluster if it is not already. - * - * @param {Node} parentNode | this is the node that will house the child node - * @param {Node} childNode | this node will be deleted from the global this.nodes and stored in the parent node - * @param {Boolean} force | true will only update the remainingEdges at the very end of the clustering, ensuring single level collapse - * @private - */ - _addToCluster : function(parentNode, childNode, force) { - // join child node in the parent node - parentNode.containedNodes[childNode.id] = childNode; - - // manage all the edges connected to the child and parent nodes - for (var i = 0; i < childNode.dynamicEdges.length; i++) { - var edge = childNode.dynamicEdges[i]; - if (edge.toId == parentNode.id || edge.fromId == parentNode.id) { // edge connected to parentNode - this._addToContainedEdges(parentNode,childNode,edge); - } - else { - this._connectEdgeToCluster(parentNode,childNode,edge); - } - } - // a contained node has no dynamic edges. - childNode.dynamicEdges = []; - - // remove circular edges from clusters - this._containCircularEdgesFromNode(parentNode,childNode); - - - // remove the childNode from the global nodes object - delete this.nodes[childNode.id]; - - // update the properties of the child and parent - var massBefore = parentNode.mass; - childNode.clusterSession = this.clusterSession; - parentNode.mass += childNode.mass; - parentNode.clusterSize += childNode.clusterSize; - parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize); - - // keep track of the clustersessions so we can open the cluster up as it has been formed. - if (parentNode.clusterSessions[parentNode.clusterSessions.length - 1] != this.clusterSession) { - parentNode.clusterSessions.push(this.clusterSession); - } - - // forced clusters only open from screen size and double tap - if (force == true) { - // parentNode.formationScale = Math.pow(1 - (1.0/11.0),this.clusterSession+3); - parentNode.formationScale = 0; - } - else { - parentNode.formationScale = this.scale; // The latest child has been added on this scale - } - - // recalculate the size of the node on the next time the node is rendered - parentNode.clearSizeCache(); - - // set the pop-out scale for the childnode - parentNode.containedNodes[childNode.id].formationScale = parentNode.formationScale; - - // nullify the movement velocity of the child, this is to avoid hectic behaviour - childNode.clearVelocity(); - - // the mass has altered, preservation of energy dictates the velocity to be updated - parentNode.updateVelocity(massBefore); - - // restart the simulation to reorganise all nodes - this.moving = true; - }, - - - /** - * This function will apply the changes made to the remainingEdges during the formation of the clusters. - * This is a seperate function to allow for level-wise collapsing of the node barnesHutTree. - * It has to be called if a level is collapsed. It is called by _formClusters(). - * @private - */ - _updateDynamicEdges : function() { - for (var i = 0; i < this.nodeIndices.length; i++) { - var node = this.nodes[this.nodeIndices[i]]; - node.dynamicEdgesLength = node.dynamicEdges.length; - - // this corrects for multiple edges pointing at the same other node - var correction = 0; - if (node.dynamicEdgesLength > 1) { - for (var j = 0; j < node.dynamicEdgesLength - 1; j++) { - var edgeToId = node.dynamicEdges[j].toId; - var edgeFromId = node.dynamicEdges[j].fromId; - for (var k = j+1; k < node.dynamicEdgesLength; k++) { - if ((node.dynamicEdges[k].toId == edgeToId && node.dynamicEdges[k].fromId == edgeFromId) || - (node.dynamicEdges[k].fromId == edgeToId && node.dynamicEdges[k].toId == edgeFromId)) { - correction += 1; - } - } - } - } - node.dynamicEdgesLength -= correction; - } - }, - - - /** - * This adds an edge from the childNode to the contained edges of the parent node - * - * @param parentNode | Node object - * @param childNode | Node object - * @param edge | Edge object - * @private - */ - _addToContainedEdges : function(parentNode, childNode, edge) { - // create an array object if it does not yet exist for this childNode - if (!(parentNode.containedEdges.hasOwnProperty(childNode.id))) { - parentNode.containedEdges[childNode.id] = [] - } - // add this edge to the list - parentNode.containedEdges[childNode.id].push(edge); - - // remove the edge from the global edges object - delete this.edges[edge.id]; - - // remove the edge from the parent object - for (var i = 0; i < parentNode.dynamicEdges.length; i++) { - if (parentNode.dynamicEdges[i].id == edge.id) { - parentNode.dynamicEdges.splice(i,1); - break; - } - } - }, - - /** - * This function connects an edge that was connected to a child node to the parent node. - * It keeps track of which nodes it has been connected to with the originalId array. - * - * @param {Node} parentNode | Node object - * @param {Node} childNode | Node object - * @param {Edge} edge | Edge object - * @private - */ - _connectEdgeToCluster : function(parentNode, childNode, edge) { - // handle circular edges - if (edge.toId == edge.fromId) { - this._addToContainedEdges(parentNode, childNode, edge); - } - else { - if (edge.toId == childNode.id) { // edge connected to other node on the "to" side - edge.originalToId.push(childNode.id); - edge.to = parentNode; - edge.toId = parentNode.id; - } - else { // edge connected to other node with the "from" side - - edge.originalFromId.push(childNode.id); - edge.from = parentNode; - edge.fromId = parentNode.id; - } - - this._addToReroutedEdges(parentNode,childNode,edge); - } - }, - - - /** - * If a node is connected to itself, a circular edge is drawn. When clustering we want to contain - * these edges inside of the cluster. - * - * @param parentNode - * @param childNode - * @private - */ - _containCircularEdgesFromNode : function(parentNode, childNode) { - // manage all the edges connected to the child and parent nodes - for (var i = 0; i < parentNode.dynamicEdges.length; i++) { - var edge = parentNode.dynamicEdges[i]; - // handle circular edges - if (edge.toId == edge.fromId) { - this._addToContainedEdges(parentNode, childNode, edge); - } - } - }, - - - /** - * This adds an edge from the childNode to the rerouted edges of the parent node - * - * @param parentNode | Node object - * @param childNode | Node object - * @param edge | Edge object - * @private - */ - _addToReroutedEdges : function(parentNode, childNode, edge) { - // create an array object if it does not yet exist for this childNode - // we store the edge in the rerouted edges so we can restore it when the cluster pops open - if (!(parentNode.reroutedEdges.hasOwnProperty(childNode.id))) { - parentNode.reroutedEdges[childNode.id] = []; - } - parentNode.reroutedEdges[childNode.id].push(edge); - - // this edge becomes part of the dynamicEdges of the cluster node - parentNode.dynamicEdges.push(edge); - }, - - - - /** - * This function connects an edge that was connected to a cluster node back to the child node. - * - * @param parentNode | Node object - * @param childNode | Node object - * @private - */ - _connectEdgeBackToChild : function(parentNode, childNode) { - if (parentNode.reroutedEdges.hasOwnProperty(childNode.id)) { - for (var i = 0; i < parentNode.reroutedEdges[childNode.id].length; i++) { - var edge = parentNode.reroutedEdges[childNode.id][i]; - if (edge.originalFromId[edge.originalFromId.length-1] == childNode.id) { - edge.originalFromId.pop(); - edge.fromId = childNode.id; - edge.from = childNode; - } - else { - edge.originalToId.pop(); - edge.toId = childNode.id; - edge.to = childNode; - } - - // append this edge to the list of edges connecting to the childnode - childNode.dynamicEdges.push(edge); - - // remove the edge from the parent object - for (var j = 0; j < parentNode.dynamicEdges.length; j++) { - if (parentNode.dynamicEdges[j].id == edge.id) { - parentNode.dynamicEdges.splice(j,1); - break; - } - } - } - // remove the entry from the rerouted edges - delete parentNode.reroutedEdges[childNode.id]; - } - }, - - - /** - * When loops are clustered, an edge can be both in the rerouted array and the contained array. - * This function is called last to verify that all edges in dynamicEdges are in fact connected to the - * parentNode - * - * @param parentNode | Node object - * @private - */ - _validateEdges : function(parentNode) { - for (var i = 0; i < parentNode.dynamicEdges.length; i++) { - var edge = parentNode.dynamicEdges[i]; - if (parentNode.id != edge.toId && parentNode.id != edge.fromId) { - parentNode.dynamicEdges.splice(i,1); - } - } - }, - - - /** - * This function released the contained edges back into the global domain and puts them back into the - * dynamic edges of both parent and child. - * - * @param {Node} parentNode | - * @param {Node} childNode | - * @private - */ - _releaseContainedEdges : function(parentNode, childNode) { - for (var i = 0; i < parentNode.containedEdges[childNode.id].length; i++) { - var edge = parentNode.containedEdges[childNode.id][i]; - - // put the edge back in the global edges object - this.edges[edge.id] = edge; - - // put the edge back in the dynamic edges of the child and parent - childNode.dynamicEdges.push(edge); - parentNode.dynamicEdges.push(edge); - } - // remove the entry from the contained edges - delete parentNode.containedEdges[childNode.id]; - - }, - - - - - // ------------------- UTILITY FUNCTIONS ---------------------------- // - - - /** - * This updates the node labels for all nodes (for debugging purposes) - */ - updateLabels : function() { - var nodeId; - // update node labels - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - var node = this.nodes[nodeId]; - if (node.clusterSize > 1) { - node.label = "[".concat(String(node.clusterSize),"]"); - } - } - } - - // update node labels - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.clusterSize == 1) { - if (node.originalLabel !== undefined) { - node.label = node.originalLabel; - } - else { - node.label = String(node.id); - } - } - } - } - -// /* Debug Override */ -// for (nodeId in this.nodes) { -// if (this.nodes.hasOwnProperty(nodeId)) { -// node = this.nodes[nodeId]; -// node.label = String(node.level); -// } -// } - - }, - - - /** - * We want to keep the cluster level distribution rather small. This means we do not want unclustered nodes - * if the rest of the nodes are already a few cluster levels in. - * To fix this we use this function. It determines the min and max cluster level and sends nodes that have not - * clustered enough to the clusterToSmallestNeighbours function. - */ - normalizeClusterLevels : function() { - var maxLevel = 0; - var minLevel = 1e9; - var clusterLevel = 0; - var nodeId; - - // we loop over all nodes in the list - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - clusterLevel = this.nodes[nodeId].clusterSessions.length; - if (maxLevel < clusterLevel) {maxLevel = clusterLevel;} - if (minLevel > clusterLevel) {minLevel = clusterLevel;} - } - } - - if (maxLevel - minLevel > this.constants.clustering.clusterLevelDifference) { - var amountOfNodes = this.nodeIndices.length; - var targetLevel = maxLevel - this.constants.clustering.clusterLevelDifference; - // we loop over all nodes in the list - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - if (this.nodes[nodeId].clusterSessions.length < targetLevel) { - this._clusterToSmallestNeighbour(this.nodes[nodeId]); - } - } - } - this._updateNodeIndexList(); - this._updateDynamicEdges(); - // if a cluster was formed, we increase the clusterSession - if (this.nodeIndices.length != amountOfNodes) { - this.clusterSession += 1; - } - } - }, - - - - /** - * This function determines if the cluster we want to decluster is in the active area - * this means around the zoom center - * - * @param {Node} node - * @returns {boolean} - * @private - */ - _nodeInActiveArea : function(node) { - return ( - Math.abs(node.x - this.areaCenter.x) <= this.constants.clustering.activeAreaBoxSize/this.scale - && - Math.abs(node.y - this.areaCenter.y) <= this.constants.clustering.activeAreaBoxSize/this.scale - ) - }, - - - /** - * This is an adaptation of the original repositioning function. This is called if the system is clustered initially - * It puts large clusters away from the center and randomizes the order. - * - */ - repositionNodes : function() { - for (var i = 0; i < this.nodeIndices.length; i++) { - var node = this.nodes[this.nodeIndices[i]]; - if ((node.xFixed == false || node.yFixed == false)) { - var radius = 10 * 0.1*this.nodeIndices.length * Math.min(100,node.mass); - var angle = 2 * Math.PI * Math.random(); - if (node.xFixed == false) {node.x = radius * Math.cos(angle);} - if (node.yFixed == false) {node.y = radius * Math.sin(angle);} - this._repositionBezierNodes(node); - } - } - }, - - - /** - * We determine how many connections denote an important hub. - * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) - * - * @private - */ - _getHubSize : function() { - var average = 0; - var averageSquared = 0; - var hubCounter = 0; - var largestHub = 0; - - for (var i = 0; i < this.nodeIndices.length; i++) { - - var node = this.nodes[this.nodeIndices[i]]; - if (node.dynamicEdgesLength > largestHub) { - largestHub = node.dynamicEdgesLength; - } - average += node.dynamicEdgesLength; - averageSquared += Math.pow(node.dynamicEdgesLength,2); - hubCounter += 1; - } - average = average / hubCounter; - averageSquared = averageSquared / hubCounter; - - var variance = averageSquared - Math.pow(average,2); - - var standardDeviation = Math.sqrt(variance); - - this.hubThreshold = Math.floor(average + 2*standardDeviation); - - // always have at least one to cluster - if (this.hubThreshold > largestHub) { - this.hubThreshold = largestHub; - } - - // console.log("average",average,"averageSQ",averageSquared,"var",variance,"std",standardDeviation); - // console.log("hubThreshold:",this.hubThreshold); - }, - - - /** - * We reduce the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods - * with this amount we can cluster specifically on these chains. - * - * @param {Number} fraction | between 0 and 1, the percentage of chains to reduce - * @private - */ - _reduceAmountOfChains : function(fraction) { - this.hubThreshold = 2; - var reduceAmount = Math.floor(this.nodeIndices.length * fraction); - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { - if (reduceAmount > 0) { - this._formClusterFromHub(this.nodes[nodeId],true,true,1); - reduceAmount -= 1; - } - } - } - } - }, - - /** - * We get the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods - * with this amount we can cluster specifically on these chains. - * - * @private - */ - _getChainFraction : function() { - var chains = 0; - var total = 0; - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) { - chains += 1; - } - total += 1; - } - } - return chains/total; - } - -}; diff --git a/src/network/networkMixins/HierarchicalLayoutMixin.js b/src/network/networkMixins/HierarchicalLayoutMixin.js deleted file mode 100644 index 6a7c4706..00000000 --- a/src/network/networkMixins/HierarchicalLayoutMixin.js +++ /dev/null @@ -1,311 +0,0 @@ -var HierarchicalLayoutMixin = { - - - - _resetLevels : function() { - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - var node = this.nodes[nodeId]; - if (node.preassignedLevel == false) { - node.level = -1; - } - } - } - }, - - /** - * This is the main function to layout the nodes in a hierarchical way. - * It checks if the node details are supplied correctly - * - * @private - */ - _setupHierarchicalLayout : function() { - if (this.constants.hierarchicalLayout.enabled == true && this.nodeIndices.length > 0) { - if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "DU") { - this.constants.hierarchicalLayout.levelSeparation *= -1; - } - else { - this.constants.hierarchicalLayout.levelSeparation = Math.abs(this.constants.hierarchicalLayout.levelSeparation); - } - // get the size of the largest hubs and check if the user has defined a level for a node. - var hubsize = 0; - var node, nodeId; - var definedLevel = false; - var undefinedLevel = false; - - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.level != -1) { - definedLevel = true; - } - else { - undefinedLevel = true; - } - if (hubsize < node.edges.length) { - hubsize = node.edges.length; - } - } - } - - // if the user defined some levels but not all, alert and run without hierarchical layout - if (undefinedLevel == true && definedLevel == true) { - alert("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes."); - this.zoomExtent(true,this.constants.clustering.enabled); - if (!this.constants.clustering.enabled) { - this.start(); - } - } - else { - // setup the system to use hierarchical method. - this._changeConstants(); - - // define levels if undefined by the users. Based on hubsize - if (undefinedLevel == true) { - this._determineLevels(hubsize); - } - // check the distribution of the nodes per level. - var distribution = this._getDistribution(); - - // place the nodes on the canvas. This also stablilizes the system. - this._placeNodesByHierarchy(distribution); - - // start the simulation. - this.start(); - } - } - }, - - - /** - * This function places the nodes on the canvas based on the hierarchial distribution. - * - * @param {Object} distribution | obtained by the function this._getDistribution() - * @private - */ - _placeNodesByHierarchy : function(distribution) { - var nodeId, node; - - // start placing all the level 0 nodes first. Then recursively position their branches. - for (nodeId in distribution[0].nodes) { - if (distribution[0].nodes.hasOwnProperty(nodeId)) { - node = distribution[0].nodes[nodeId]; - if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { - if (node.xFixed) { - node.x = distribution[0].minPos; - node.xFixed = false; - - distribution[0].minPos += distribution[0].nodeSpacing; - } - } - else { - if (node.yFixed) { - node.y = distribution[0].minPos; - node.yFixed = false; - - distribution[0].minPos += distribution[0].nodeSpacing; - } - } - this._placeBranchNodes(node.edges,node.id,distribution,node.level); - } - } - - // stabilize the system after positioning. This function calls zoomExtent. - this._stabilize(); - }, - - - /** - * This function get the distribution of levels based on hubsize - * - * @returns {Object} - * @private - */ - _getDistribution : function() { - var distribution = {}; - var nodeId, node, level; - - // we fix Y because the hierarchy is vertical, we fix X so we do not give a node an x position for a second time. - // the fix of X is removed after the x value has been set. - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - node.xFixed = true; - node.yFixed = true; - if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { - node.y = this.constants.hierarchicalLayout.levelSeparation*node.level; - } - else { - node.x = this.constants.hierarchicalLayout.levelSeparation*node.level; - } - if (!distribution.hasOwnProperty(node.level)) { - distribution[node.level] = {amount: 0, nodes: {}, minPos:0, nodeSpacing:0}; - } - distribution[node.level].amount += 1; - distribution[node.level].nodes[node.id] = node; - } - } - - // determine the largest amount of nodes of all levels - var maxCount = 0; - for (level in distribution) { - if (distribution.hasOwnProperty(level)) { - if (maxCount < distribution[level].amount) { - maxCount = distribution[level].amount; - } - } - } - - // set the initial position and spacing of each nodes accordingly - for (level in distribution) { - if (distribution.hasOwnProperty(level)) { - distribution[level].nodeSpacing = (maxCount + 1) * this.constants.hierarchicalLayout.nodeSpacing; - distribution[level].nodeSpacing /= (distribution[level].amount + 1); - distribution[level].minPos = distribution[level].nodeSpacing - (0.5 * (distribution[level].amount + 1) * distribution[level].nodeSpacing); - } - } - - return distribution; - }, - - - /** - * this function allocates nodes in levels based on the recursive branching from the largest hubs. - * - * @param hubsize - * @private - */ - _determineLevels : function(hubsize) { - var nodeId, node; - - // determine hubs - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.edges.length == hubsize) { - node.level = 0; - } - } - } - - // branch from hubs - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - if (node.level == 0) { - this._setLevel(1,node.edges,node.id); - } - } - } - }, - - - /** - * Since hierarchical layout does not support: - * - smooth curves (based on the physics), - * - clustering (based on dynamic node counts) - * - * We disable both features so there will be no problems. - * - * @private - */ - _changeConstants : function() { - this.constants.clustering.enabled = false; - this.constants.physics.barnesHut.enabled = false; - this.constants.physics.hierarchicalRepulsion.enabled = true; - this._loadSelectedForceSolver(); - this.constants.smoothCurves = false; - this._configureSmoothCurves(); - }, - - - /** - * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes - * on a X position that ensures there will be no overlap. - * - * @param edges - * @param parentId - * @param distribution - * @param parentLevel - * @private - */ - _placeBranchNodes : function(edges, parentId, distribution, parentLevel) { - for (var i = 0; i < edges.length; i++) { - var childNode = null; - if (edges[i].toId == parentId) { - childNode = edges[i].from; - } - else { - childNode = edges[i].to; - } - - // if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here. - var nodeMoved = false; - if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") { - if (childNode.xFixed && childNode.level > parentLevel) { - childNode.xFixed = false; - childNode.x = distribution[childNode.level].minPos; - nodeMoved = true; - } - } - else { - if (childNode.yFixed && childNode.level > parentLevel) { - childNode.yFixed = false; - childNode.y = distribution[childNode.level].minPos; - nodeMoved = true; - } - } - - if (nodeMoved == true) { - distribution[childNode.level].minPos += distribution[childNode.level].nodeSpacing; - if (childNode.edges.length > 1) { - this._placeBranchNodes(childNode.edges,childNode.id,distribution,childNode.level); - } - } - } - }, - - - /** - * this function is called recursively to enumerate the barnches of the largest hubs and give each node a level. - * - * @param level - * @param edges - * @param parentId - * @private - */ - _setLevel : function(level, edges, parentId) { - for (var i = 0; i < edges.length; i++) { - var childNode = null; - if (edges[i].toId == parentId) { - childNode = edges[i].from; - } - else { - childNode = edges[i].to; - } - if (childNode.level == -1 || childNode.level > level) { - childNode.level = level; - if (edges.length > 1) { - this._setLevel(level+1, childNode.edges, childNode.id); - } - } - } - }, - - - /** - * Unfix nodes - * - * @private - */ - _restoreNodes : function() { - for (nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - this.nodes[nodeId].xFixed = false; - this.nodes[nodeId].yFixed = false; - } - } - } - - -}; \ No newline at end of file diff --git a/src/network/networkMixins/ManipulationMixin.js b/src/network/networkMixins/ManipulationMixin.js deleted file mode 100644 index 83947515..00000000 --- a/src/network/networkMixins/ManipulationMixin.js +++ /dev/null @@ -1,576 +0,0 @@ -/** - * Created by Alex on 2/4/14. - */ - -var manipulationMixin = { - - /** - * clears the toolbar div element of children - * - * @private - */ - _clearManipulatorBar : function() { - while (this.manipulationDiv.hasChildNodes()) { - this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); - } - }, - - /** - * Manipulation UI temporarily overloads certain functions to extend or replace them. To be able to restore - * these functions to their original functionality, we saved them in this.cachedFunctions. - * This function restores these functions to their original function. - * - * @private - */ - _restoreOverloadedFunctions : function() { - for (var functionName in this.cachedFunctions) { - if (this.cachedFunctions.hasOwnProperty(functionName)) { - this[functionName] = this.cachedFunctions[functionName]; - } - } - }, - - /** - * Enable or disable edit-mode. - * - * @private - */ - _toggleEditMode : function() { - this.editMode = !this.editMode; - var toolbar = document.getElementById("network-manipulationDiv"); - var closeDiv = document.getElementById("network-manipulation-closeDiv"); - var editModeDiv = document.getElementById("network-manipulation-editMode"); - if (this.editMode == true) { - toolbar.style.display="block"; - closeDiv.style.display="block"; - editModeDiv.style.display="none"; - closeDiv.onclick = this._toggleEditMode.bind(this); - } - else { - toolbar.style.display="none"; - closeDiv.style.display="none"; - editModeDiv.style.display="block"; - closeDiv.onclick = null; - } - this._createManipulatorBar() - }, - - /** - * main function, creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. - * - * @private - */ - _createManipulatorBar : function() { - // remove bound functions - if (this.boundFunction) { - this.off('select', this.boundFunction); - } - if (this.edgeBeingEdited !== undefined) { - this.edgeBeingEdited._disableControlNodes(); - this.edgeBeingEdited = undefined; - this.selectedControlNode = null; - } - - // restore overloaded functions - this._restoreOverloadedFunctions(); - - // resume calculation - this.freezeSimulation = false; - - // reset global variables - this.blockConnectingEdgeSelection = false; - this.forceAppendSelection = false; - - if (this.editMode == true) { - while (this.manipulationDiv.hasChildNodes()) { - this.manipulationDiv.removeChild(this.manipulationDiv.firstChild); - } - // add the icons to the manipulator div - this.manipulationDiv.innerHTML = "" + - "" + - ""+this.constants.labels['add'] +"" + - "
      " + - "" + - ""+this.constants.labels['link'] +""; - if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { - this.manipulationDiv.innerHTML += "" + - "
      " + - "" + - ""+this.constants.labels['editNode'] +""; - } - else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { - this.manipulationDiv.innerHTML += "" + - "
      " + - "" + - ""+this.constants.labels['editEdge'] +""; - } - if (this._selectionIsEmpty() == false) { - this.manipulationDiv.innerHTML += "" + - "
      " + - "" + - ""+this.constants.labels['del'] +""; - } - - - // bind the icons - var addNodeButton = document.getElementById("network-manipulate-addNode"); - addNodeButton.onclick = this._createAddNodeToolbar.bind(this); - var addEdgeButton = document.getElementById("network-manipulate-connectNode"); - addEdgeButton.onclick = this._createAddEdgeToolbar.bind(this); - if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) { - var editButton = document.getElementById("network-manipulate-editNode"); - editButton.onclick = this._editNode.bind(this); - } - else if (this._getSelectedEdgeCount() == 1 && this._getSelectedNodeCount() == 0) { - var editButton = document.getElementById("network-manipulate-editEdge"); - editButton.onclick = this._createEditEdgeToolbar.bind(this); - } - if (this._selectionIsEmpty() == false) { - var deleteButton = document.getElementById("network-manipulate-delete"); - deleteButton.onclick = this._deleteSelected.bind(this); - } - var closeDiv = document.getElementById("network-manipulation-closeDiv"); - closeDiv.onclick = this._toggleEditMode.bind(this); - - this.boundFunction = this._createManipulatorBar.bind(this); - this.on('select', this.boundFunction); - } - else { - this.editModeDiv.innerHTML = "" + - "" + - "" + this.constants.labels['edit'] + ""; - var editModeButton = document.getElementById("network-manipulate-editModeButton"); - editModeButton.onclick = this._toggleEditMode.bind(this); - } - }, - - - - /** - * Create the toolbar for adding Nodes - * - * @private - */ - _createAddNodeToolbar : function() { - // clear the toolbar - this._clearManipulatorBar(); - if (this.boundFunction) { - this.off('select', this.boundFunction); - } - - // create the toolbar contents - this.manipulationDiv.innerHTML = "" + - "" + - "" + this.constants.labels['back'] + " " + - "
      " + - "" + - "" + this.constants.labels['addDescription'] + ""; - - // bind the icon - var backButton = document.getElementById("network-manipulate-back"); - backButton.onclick = this._createManipulatorBar.bind(this); - - // we use the boundFunction so we can reference it when we unbind it from the "select" event. - this.boundFunction = this._addNode.bind(this); - this.on('select', this.boundFunction); - }, - - - /** - * create the toolbar to connect nodes - * - * @private - */ - _createAddEdgeToolbar : function() { - // clear the toolbar - this._clearManipulatorBar(); - this._unselectAll(true); - this.freezeSimulation = true; - - if (this.boundFunction) { - this.off('select', this.boundFunction); - } - - this._unselectAll(); - this.forceAppendSelection = false; - this.blockConnectingEdgeSelection = true; - - this.manipulationDiv.innerHTML = "" + - "" + - "" + this.constants.labels['back'] + " " + - "
      " + - "" + - "" + this.constants.labels['linkDescription'] + ""; - - // bind the icon - var backButton = document.getElementById("network-manipulate-back"); - backButton.onclick = this._createManipulatorBar.bind(this); - - // we use the boundFunction so we can reference it when we unbind it from the "select" event. - this.boundFunction = this._handleConnect.bind(this); - this.on('select', this.boundFunction); - - // temporarily overload functions - this.cachedFunctions["_handleTouch"] = this._handleTouch; - this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; - this._handleTouch = this._handleConnect; - this._handleOnRelease = this._finishConnect; - - // redraw to show the unselect - this._redraw(); - }, - - /** - * create the toolbar to edit edges - * - * @private - */ - _createEditEdgeToolbar : function() { - // clear the toolbar - this._clearManipulatorBar(); - - if (this.boundFunction) { - this.off('select', this.boundFunction); - } - - this.edgeBeingEdited = this._getSelectedEdge(); - this.edgeBeingEdited._enableControlNodes(); - - this.manipulationDiv.innerHTML = "" + - "" + - "" + this.constants.labels['back'] + " " + - "
      " + - "" + - "" + this.constants.labels['editEdgeDescription'] + ""; - - // bind the icon - var backButton = document.getElementById("network-manipulate-back"); - backButton.onclick = this._createManipulatorBar.bind(this); - - // temporarily overload functions - this.cachedFunctions["_handleTouch"] = this._handleTouch; - this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease; - this.cachedFunctions["_handleTap"] = this._handleTap; - this.cachedFunctions["_handleDragStart"] = this._handleDragStart; - this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; - this._handleTouch = this._selectControlNode; - this._handleTap = function () {}; - this._handleOnDrag = this._controlNodeDrag; - this._handleDragStart = function () {} - this._handleOnRelease = this._releaseControlNode; - - // redraw to show the unselect - this._redraw(); - }, - - - - - - /** - * the function bound to the selection event. It checks if you want to connect a cluster and changes the description - * to walk the user through the process. - * - * @private - */ - _selectControlNode : function(pointer) { - this.edgeBeingEdited.controlNodes.from.unselect(); - this.edgeBeingEdited.controlNodes.to.unselect(); - this.selectedControlNode = this.edgeBeingEdited._getSelectedControlNode(this._XconvertDOMtoCanvas(pointer.x),this._YconvertDOMtoCanvas(pointer.y)); - if (this.selectedControlNode !== null) { - this.selectedControlNode.select(); - this.freezeSimulation = true; - } - this._redraw(); - }, - - /** - * the function bound to the selection event. It checks if you want to connect a cluster and changes the description - * to walk the user through the process. - * - * @private - */ - _controlNodeDrag : function(event) { - var pointer = this._getPointer(event.gesture.center); - if (this.selectedControlNode !== null && this.selectedControlNode !== undefined) { - this.selectedControlNode.x = this._XconvertDOMtoCanvas(pointer.x); - this.selectedControlNode.y = this._YconvertDOMtoCanvas(pointer.y); - } - this._redraw(); - }, - - _releaseControlNode : function(pointer) { - var newNode = this._getNodeAt(pointer); - if (newNode != null) { - if (this.edgeBeingEdited.controlNodes.from.selected == true) { - this._editEdge(newNode.id, this.edgeBeingEdited.to.id); - this.edgeBeingEdited.controlNodes.from.unselect(); - } - if (this.edgeBeingEdited.controlNodes.to.selected == true) { - this._editEdge(this.edgeBeingEdited.from.id, newNode.id); - this.edgeBeingEdited.controlNodes.to.unselect(); - } - } - else { - this.edgeBeingEdited._restoreControlNodes(); - } - this.freezeSimulation = false; - this._redraw(); - }, - - /** - * the function bound to the selection event. It checks if you want to connect a cluster and changes the description - * to walk the user through the process. - * - * @private - */ - _handleConnect : function(pointer) { - if (this._getSelectedNodeCount() == 0) { - var node = this._getNodeAt(pointer); - if (node != null) { - if (node.clusterSize > 1) { - alert("Cannot create edges to a cluster.") - } - else { - this._selectObject(node,false); - // create a node the temporary line can look at - this.sectors['support']['nodes']['targetNode'] = new Node({id:'targetNode'},{},{},this.constants); - this.sectors['support']['nodes']['targetNode'].x = node.x; - this.sectors['support']['nodes']['targetNode'].y = node.y; - this.sectors['support']['nodes']['targetViaNode'] = new Node({id:'targetViaNode'},{},{},this.constants); - this.sectors['support']['nodes']['targetViaNode'].x = node.x; - this.sectors['support']['nodes']['targetViaNode'].y = node.y; - this.sectors['support']['nodes']['targetViaNode'].parentEdgeId = "connectionEdge"; - - // create a temporary edge - this.edges['connectionEdge'] = new Edge({id:"connectionEdge",from:node.id,to:this.sectors['support']['nodes']['targetNode'].id}, this, this.constants); - this.edges['connectionEdge'].from = node; - this.edges['connectionEdge'].connected = true; - this.edges['connectionEdge'].smooth = true; - this.edges['connectionEdge'].selected = true; - this.edges['connectionEdge'].to = this.sectors['support']['nodes']['targetNode']; - this.edges['connectionEdge'].via = this.sectors['support']['nodes']['targetViaNode']; - - this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag; - this._handleOnDrag = function(event) { - var pointer = this._getPointer(event.gesture.center); - this.sectors['support']['nodes']['targetNode'].x = this._XconvertDOMtoCanvas(pointer.x); - this.sectors['support']['nodes']['targetNode'].y = this._YconvertDOMtoCanvas(pointer.y); - this.sectors['support']['nodes']['targetViaNode'].x = 0.5 * (this._XconvertDOMtoCanvas(pointer.x) + this.edges['connectionEdge'].from.x); - this.sectors['support']['nodes']['targetViaNode'].y = this._YconvertDOMtoCanvas(pointer.y); - }; - - this.moving = true; - this.start(); - } - } - } - }, - - _finishConnect : function(pointer) { - if (this._getSelectedNodeCount() == 1) { - - // restore the drag function - this._handleOnDrag = this.cachedFunctions["_handleOnDrag"]; - delete this.cachedFunctions["_handleOnDrag"]; - - // remember the edge id - var connectFromId = this.edges['connectionEdge'].fromId; - - // remove the temporary nodes and edge - delete this.edges['connectionEdge']; - delete this.sectors['support']['nodes']['targetNode']; - delete this.sectors['support']['nodes']['targetViaNode']; - - var node = this._getNodeAt(pointer); - if (node != null) { - if (node.clusterSize > 1) { - alert("Cannot create edges to a cluster.") - } - else { - this._createEdge(connectFromId,node.id); - this._createManipulatorBar(); - } - } - this._unselectAll(); - } - }, - - - /** - * Adds a node on the specified location - */ - _addNode : function() { - if (this._selectionIsEmpty() && this.editMode == true) { - var positionObject = this._pointerToPositionObject(this.pointerPosition); - var defaultData = {id:util.randomUUID(),x:positionObject.left,y:positionObject.top,label:"new",allowedToMoveX:true,allowedToMoveY:true}; - if (this.triggerFunctions.add) { - if (this.triggerFunctions.add.length == 2) { - var me = this; - this.triggerFunctions.add(defaultData, function(finalizedData) { - me.nodesData.add(finalizedData); - me._createManipulatorBar(); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels['addError']); - this._createManipulatorBar(); - this.moving = true; - this.start(); - } - } - else { - this.nodesData.add(defaultData); - this._createManipulatorBar(); - this.moving = true; - this.start(); - } - } - }, - - - /** - * connect two nodes with a new edge. - * - * @private - */ - _createEdge : function(sourceNodeId,targetNodeId) { - if (this.editMode == true) { - var defaultData = {from:sourceNodeId, to:targetNodeId}; - if (this.triggerFunctions.connect) { - if (this.triggerFunctions.connect.length == 2) { - var me = this; - this.triggerFunctions.connect(defaultData, function(finalizedData) { - me.edgesData.add(finalizedData); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["linkError"]); - this.moving = true; - this.start(); - } - } - else { - this.edgesData.add(defaultData); - this.moving = true; - this.start(); - } - } - }, - - /** - * connect two nodes with a new edge. - * - * @private - */ - _editEdge : function(sourceNodeId,targetNodeId) { - if (this.editMode == true) { - var defaultData = {id: this.edgeBeingEdited.id, from:sourceNodeId, to:targetNodeId}; - if (this.triggerFunctions.editEdge) { - if (this.triggerFunctions.editEdge.length == 2) { - var me = this; - this.triggerFunctions.editEdge(defaultData, function(finalizedData) { - me.edgesData.update(finalizedData); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["linkError"]); - this.moving = true; - this.start(); - } - } - else { - this.edgesData.update(defaultData); - this.moving = true; - this.start(); - } - } - }, - - /** - * Create the toolbar to edit the selected node. The label and the color can be changed. Other colors are derived from the chosen color. - * - * @private - */ - _editNode : function() { - if (this.triggerFunctions.edit && this.editMode == true) { - var node = this._getSelectedNode(); - var data = {id:node.id, - label: node.label, - group: node.group, - shape: node.shape, - color: { - background:node.color.background, - border:node.color.border, - highlight: { - background:node.color.highlight.background, - border:node.color.highlight.border - } - }}; - if (this.triggerFunctions.edit.length == 2) { - var me = this; - this.triggerFunctions.edit(data, function (finalizedData) { - me.nodesData.update(finalizedData); - me._createManipulatorBar(); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["editError"]); - } - } - else { - alert(this.constants.labels["editBoundError"]); - } - }, - - - - - /** - * delete everything in the selection - * - * @private - */ - _deleteSelected : function() { - if (!this._selectionIsEmpty() && this.editMode == true) { - if (!this._clusterInSelection()) { - var selectedNodes = this.getSelectedNodes(); - var selectedEdges = this.getSelectedEdges(); - if (this.triggerFunctions.del) { - var me = this; - var data = {nodes: selectedNodes, edges: selectedEdges}; - if (this.triggerFunctions.del.length = 2) { - this.triggerFunctions.del(data, function (finalizedData) { - me.edgesData.remove(finalizedData.edges); - me.nodesData.remove(finalizedData.nodes); - me._unselectAll(); - me.moving = true; - me.start(); - }); - } - else { - alert(this.constants.labels["deleteError"]) - } - } - else { - this.edgesData.remove(selectedEdges); - this.nodesData.remove(selectedNodes); - this._unselectAll(); - this.moving = true; - this.start(); - } - } - else { - alert(this.constants.labels["deleteClusterError"]); - } - } - } -}; \ No newline at end of file diff --git a/src/network/networkMixins/MixinLoader.js b/src/network/networkMixins/MixinLoader.js deleted file mode 100644 index d3b31f4e..00000000 --- a/src/network/networkMixins/MixinLoader.js +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Created by Alex on 2/10/14. - */ - - -var networkMixinLoaders = { - - /** - * Load a mixin into the network object - * - * @param {Object} sourceVariable | this object has to contain functions. - * @private - */ - _loadMixin: function (sourceVariable) { - for (var mixinFunction in sourceVariable) { - if (sourceVariable.hasOwnProperty(mixinFunction)) { - Network.prototype[mixinFunction] = sourceVariable[mixinFunction]; - } - } - }, - - - /** - * removes a mixin from the network object. - * - * @param {Object} sourceVariable | this object has to contain functions. - * @private - */ - _clearMixin: function (sourceVariable) { - for (var mixinFunction in sourceVariable) { - if (sourceVariable.hasOwnProperty(mixinFunction)) { - Network.prototype[mixinFunction] = undefined; - } - } - }, - - - /** - * Mixin the physics system and initialize the parameters required. - * - * @private - */ - _loadPhysicsSystem: function () { - this._loadMixin(physicsMixin); - this._loadSelectedForceSolver(); - if (this.constants.configurePhysics == true) { - this._loadPhysicsConfiguration(); - } - }, - - - /** - * Mixin the cluster system and initialize the parameters required. - * - * @private - */ - _loadClusterSystem: function () { - this.clusterSession = 0; - this.hubThreshold = 5; - this._loadMixin(ClusterMixin); - }, - - - /** - * Mixin the sector system and initialize the parameters required - * - * @private - */ - _loadSectorSystem: function () { - this.sectors = {}; - this.activeSector = ["default"]; - this.sectors["active"] = {}; - this.sectors["active"]["default"] = {"nodes": {}, - "edges": {}, - "nodeIndices": [], - "formationScale": 1.0, - "drawingNode": undefined }; - this.sectors["frozen"] = {}; - this.sectors["support"] = {"nodes": {}, - "edges": {}, - "nodeIndices": [], - "formationScale": 1.0, - "drawingNode": undefined }; - - this.nodeIndices = this.sectors["active"]["default"]["nodeIndices"]; // the node indices list is used to speed up the computation of the repulsion fields - - this._loadMixin(SectorMixin); - }, - - - /** - * Mixin the selection system and initialize the parameters required - * - * @private - */ - _loadSelectionSystem: function () { - this.selectionObj = {nodes: {}, edges: {}}; - - this._loadMixin(SelectionMixin); - }, - - - /** - * Mixin the navigationUI (User Interface) system and initialize the parameters required - * - * @private - */ - _loadManipulationSystem: function () { - // reset global variables -- these are used by the selection of nodes and edges. - this.blockConnectingEdgeSelection = false; - this.forceAppendSelection = false; - - if (this.constants.dataManipulation.enabled == true) { - // load the manipulator HTML elements. All styling done in css. - if (this.manipulationDiv === undefined) { - this.manipulationDiv = document.createElement('div'); - this.manipulationDiv.className = 'network-manipulationDiv'; - this.manipulationDiv.id = 'network-manipulationDiv'; - if (this.editMode == true) { - this.manipulationDiv.style.display = "block"; - } - else { - this.manipulationDiv.style.display = "none"; - } - this.containerElement.insertBefore(this.manipulationDiv, this.frame); - } - - if (this.editModeDiv === undefined) { - this.editModeDiv = document.createElement('div'); - this.editModeDiv.className = 'network-manipulation-editMode'; - this.editModeDiv.id = 'network-manipulation-editMode'; - if (this.editMode == true) { - this.editModeDiv.style.display = "none"; - } - else { - this.editModeDiv.style.display = "block"; - } - this.containerElement.insertBefore(this.editModeDiv, this.frame); - } - - if (this.closeDiv === undefined) { - this.closeDiv = document.createElement('div'); - this.closeDiv.className = 'network-manipulation-closeDiv'; - this.closeDiv.id = 'network-manipulation-closeDiv'; - this.closeDiv.style.display = this.manipulationDiv.style.display; - this.containerElement.insertBefore(this.closeDiv, this.frame); - } - - // load the manipulation functions - this._loadMixin(manipulationMixin); - - // create the manipulator toolbar - this._createManipulatorBar(); - } - else { - if (this.manipulationDiv !== undefined) { - // removes all the bindings and overloads - this._createManipulatorBar(); - // remove the manipulation divs - this.containerElement.removeChild(this.manipulationDiv); - this.containerElement.removeChild(this.editModeDiv); - this.containerElement.removeChild(this.closeDiv); - - this.manipulationDiv = undefined; - this.editModeDiv = undefined; - this.closeDiv = undefined; - // remove the mixin functions - this._clearMixin(manipulationMixin); - } - } - }, - - - /** - * Mixin the navigation (User Interface) system and initialize the parameters required - * - * @private - */ - _loadNavigationControls: function () { - this._loadMixin(NavigationMixin); - - // the clean function removes the button divs, this is done to remove the bindings. - this._cleanNavigation(); - if (this.constants.navigation.enabled == true) { - this._loadNavigationElements(); - } - }, - - - /** - * Mixin the hierarchical layout system. - * - * @private - */ - _loadHierarchySystem: function () { - this._loadMixin(HierarchicalLayoutMixin); - } - -}; diff --git a/src/network/networkMixins/NavigationMixin.js b/src/network/networkMixins/NavigationMixin.js deleted file mode 100644 index 375daf5e..00000000 --- a/src/network/networkMixins/NavigationMixin.js +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Created by Alex on 1/22/14. - */ - -var NavigationMixin = { - - _cleanNavigation : function() { - // clean up previosu navigation items - var wrapper = document.getElementById('network-navigation_wrapper'); - if (wrapper != null) { - this.containerElement.removeChild(wrapper); - } - document.onmouseup = null; - }, - - /** - * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation - * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent - * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. - * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. - * - * @private - */ - _loadNavigationElements : function() { - this._cleanNavigation(); - - this.navigationDivs = {}; - var navigationDivs = ['up','down','left','right','zoomIn','zoomOut','zoomExtends']; - var navigationDivActions = ['_moveUp','_moveDown','_moveLeft','_moveRight','_zoomIn','_zoomOut','zoomExtent']; - - this.navigationDivs['wrapper'] = document.createElement('div'); - this.navigationDivs['wrapper'].id = "network-navigation_wrapper"; - this.navigationDivs['wrapper'].style.position = "absolute"; - this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; - this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; - this.containerElement.insertBefore(this.navigationDivs['wrapper'],this.frame); - - for (var i = 0; i < navigationDivs.length; i++) { - this.navigationDivs[navigationDivs[i]] = document.createElement('div'); - this.navigationDivs[navigationDivs[i]].id = "network-navigation_" + navigationDivs[i]; - this.navigationDivs[navigationDivs[i]].className = "network-navigation " + navigationDivs[i]; - this.navigationDivs['wrapper'].appendChild(this.navigationDivs[navigationDivs[i]]); - this.navigationDivs[navigationDivs[i]].onmousedown = this[navigationDivActions[i]].bind(this); - } - - document.onmouseup = this._stopMovement.bind(this); - }, - - /** - * this stops all movement induced by the navigation buttons - * - * @private - */ - _stopMovement : function() { - this._xStopMoving(); - this._yStopMoving(); - this._stopZoom(); - }, - - - /** - * stops the actions performed by page up and down etc. - * - * @param event - * @private - */ - _preventDefault : function(event) { - if (event !== undefined) { - if (event.preventDefault) { - event.preventDefault(); - } else { - event.returnValue = false; - } - } - }, - - - /** - * move the screen up - * By using the increments, instead of adding a fixed number to the translation, we keep fluent and - * instant movement. The onKeypress event triggers immediately, then pauses, then triggers frequently - * To avoid this behaviour, we do the translation in the start loop. - * - * @private - */ - _moveUp : function(event) { - this.yIncrement = this.constants.keyboard.speed.y; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['up'].className += " active"; - } - }, - - - /** - * move the screen down - * @private - */ - _moveDown : function(event) { - this.yIncrement = -this.constants.keyboard.speed.y; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['down'].className += " active"; - } - }, - - - /** - * move the screen left - * @private - */ - _moveLeft : function(event) { - this.xIncrement = this.constants.keyboard.speed.x; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['left'].className += " active"; - } - }, - - - /** - * move the screen right - * @private - */ - _moveRight : function(event) { - this.xIncrement = -this.constants.keyboard.speed.y; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['right'].className += " active"; - } - }, - - - /** - * Zoom in, using the same method as the movement. - * @private - */ - _zoomIn : function(event) { - this.zoomIncrement = this.constants.keyboard.speed.zoom; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['zoomIn'].className += " active"; - } - }, - - - /** - * Zoom out - * @private - */ - _zoomOut : function() { - this.zoomIncrement = -this.constants.keyboard.speed.zoom; - this.start(); // if there is no node movement, the calculation wont be done - this._preventDefault(event); - if (this.navigationDivs) { - this.navigationDivs['zoomOut'].className += " active"; - } - }, - - - /** - * Stop zooming and unhighlight the zoom controls - * @private - */ - _stopZoom : function() { - this.zoomIncrement = 0; - if (this.navigationDivs) { - this.navigationDivs['zoomIn'].className = this.navigationDivs['zoomIn'].className.replace(" active",""); - this.navigationDivs['zoomOut'].className = this.navigationDivs['zoomOut'].className.replace(" active",""); - } - }, - - - /** - * Stop moving in the Y direction and unHighlight the up and down - * @private - */ - _yStopMoving : function() { - this.yIncrement = 0; - if (this.navigationDivs) { - this.navigationDivs['up'].className = this.navigationDivs['up'].className.replace(" active",""); - this.navigationDivs['down'].className = this.navigationDivs['down'].className.replace(" active",""); - } - }, - - - /** - * Stop moving in the X direction and unHighlight left and right. - * @private - */ - _xStopMoving : function() { - this.xIncrement = 0; - if (this.navigationDivs) { - this.navigationDivs['left'].className = this.navigationDivs['left'].className.replace(" active",""); - this.navigationDivs['right'].className = this.navigationDivs['right'].className.replace(" active",""); - } - } - - -}; diff --git a/src/network/networkMixins/SectorsMixin.js b/src/network/networkMixins/SectorsMixin.js deleted file mode 100644 index b23bc584..00000000 --- a/src/network/networkMixins/SectorsMixin.js +++ /dev/null @@ -1,552 +0,0 @@ -/** - * Creation of the SectorMixin var. - * - * This contains all the functions the Network object can use to employ the sector system. - * The sector system is always used by Network, though the benefits only apply to the use of clustering. - * If clustering is not used, there is no overhead except for a duplicate object with references to nodes and edges. - * - * Alex de Mulder - * 21-01-2013 - */ -var SectorMixin = { - - /** - * This function is only called by the setData function of the Network object. - * This loads the global references into the active sector. This initializes the sector. - * - * @private - */ - _putDataInSector : function() { - this.sectors["active"][this._sector()].nodes = this.nodes; - this.sectors["active"][this._sector()].edges = this.edges; - this.sectors["active"][this._sector()].nodeIndices = this.nodeIndices; - }, - - - /** - * /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied (active) sector. If a type is defined, do the specific type - * - * @param {String} sectorId - * @param {String} [sectorType] | "active" or "frozen" - * @private - */ - _switchToSector : function(sectorId, sectorType) { - if (sectorType === undefined || sectorType == "active") { - this._switchToActiveSector(sectorId); - } - else { - this._switchToFrozenSector(sectorId); - } - }, - - - /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied active sector. - * - * @param sectorId - * @private - */ - _switchToActiveSector : function(sectorId) { - this.nodeIndices = this.sectors["active"][sectorId]["nodeIndices"]; - this.nodes = this.sectors["active"][sectorId]["nodes"]; - this.edges = this.sectors["active"][sectorId]["edges"]; - }, - - - /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied active sector. - * - * @param sectorId - * @private - */ - _switchToSupportSector : function() { - this.nodeIndices = this.sectors["support"]["nodeIndices"]; - this.nodes = this.sectors["support"]["nodes"]; - this.edges = this.sectors["support"]["edges"]; - }, - - - /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the supplied frozen sector. - * - * @param sectorId - * @private - */ - _switchToFrozenSector : function(sectorId) { - this.nodeIndices = this.sectors["frozen"][sectorId]["nodeIndices"]; - this.nodes = this.sectors["frozen"][sectorId]["nodes"]; - this.edges = this.sectors["frozen"][sectorId]["edges"]; - }, - - - /** - * This function sets the global references to nodes, edges and nodeIndices back to - * those of the currently active sector. - * - * @private - */ - _loadLatestSector : function() { - this._switchToSector(this._sector()); - }, - - - /** - * This function returns the currently active sector Id - * - * @returns {String} - * @private - */ - _sector : function() { - return this.activeSector[this.activeSector.length-1]; - }, - - - /** - * This function returns the previously active sector Id - * - * @returns {String} - * @private - */ - _previousSector : function() { - if (this.activeSector.length > 1) { - return this.activeSector[this.activeSector.length-2]; - } - else { - throw new TypeError('there are not enough sectors in the this.activeSector array.'); - } - }, - - - /** - * We add the active sector at the end of the this.activeSector array - * This ensures it is the currently active sector returned by _sector() and it reaches the top - * of the activeSector stack. When we reverse our steps we move from the end to the beginning of this stack. - * - * @param newId - * @private - */ - _setActiveSector : function(newId) { - this.activeSector.push(newId); - }, - - - /** - * We remove the currently active sector id from the active sector stack. This happens when - * we reactivate the previously active sector - * - * @private - */ - _forgetLastSector : function() { - this.activeSector.pop(); - }, - - - /** - * This function creates a new active sector with the supplied newId. This newId - * is the expanding node id. - * - * @param {String} newId | Id of the new active sector - * @private - */ - _createNewSector : function(newId) { - // create the new sector - this.sectors["active"][newId] = {"nodes":{}, - "edges":{}, - "nodeIndices":[], - "formationScale": this.scale, - "drawingNode": undefined}; - - // create the new sector render node. This gives visual feedback that you are in a new sector. - this.sectors["active"][newId]['drawingNode'] = new Node( - {id:newId, - color: { - background: "#eaefef", - border: "495c5e" - } - },{},{},this.constants); - this.sectors["active"][newId]['drawingNode'].clusterSize = 2; - }, - - - /** - * This function removes the currently active sector. This is called when we create a new - * active sector. - * - * @param {String} sectorId | Id of the active sector that will be removed - * @private - */ - _deleteActiveSector : function(sectorId) { - delete this.sectors["active"][sectorId]; - }, - - - /** - * This function removes the currently active sector. This is called when we reactivate - * the previously active sector. - * - * @param {String} sectorId | Id of the active sector that will be removed - * @private - */ - _deleteFrozenSector : function(sectorId) { - delete this.sectors["frozen"][sectorId]; - }, - - - /** - * Freezing an active sector means moving it from the "active" object to the "frozen" object. - * We copy the references, then delete the active entree. - * - * @param sectorId - * @private - */ - _freezeSector : function(sectorId) { - // we move the set references from the active to the frozen stack. - this.sectors["frozen"][sectorId] = this.sectors["active"][sectorId]; - - // we have moved the sector data into the frozen set, we now remove it from the active set - this._deleteActiveSector(sectorId); - }, - - - /** - * This is the reverse operation of _freezeSector. Activating means moving the sector from the "frozen" - * object to the "active" object. - * - * @param sectorId - * @private - */ - _activateSector : function(sectorId) { - // we move the set references from the frozen to the active stack. - this.sectors["active"][sectorId] = this.sectors["frozen"][sectorId]; - - // we have moved the sector data into the active set, we now remove it from the frozen stack - this._deleteFrozenSector(sectorId); - }, - - - /** - * This function merges the data from the currently active sector with a frozen sector. This is used - * in the process of reverting back to the previously active sector. - * The data that is placed in the frozen (the previously active) sector is the node that has been removed from it - * upon the creation of a new active sector. - * - * @param sectorId - * @private - */ - _mergeThisWithFrozen : function(sectorId) { - // copy all nodes - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - this.sectors["frozen"][sectorId]["nodes"][nodeId] = this.nodes[nodeId]; - } - } - - // copy all edges (if not fully clustered, else there are no edges) - for (var edgeId in this.edges) { - if (this.edges.hasOwnProperty(edgeId)) { - this.sectors["frozen"][sectorId]["edges"][edgeId] = this.edges[edgeId]; - } - } - - // merge the nodeIndices - for (var i = 0; i < this.nodeIndices.length; i++) { - this.sectors["frozen"][sectorId]["nodeIndices"].push(this.nodeIndices[i]); - } - }, - - - /** - * This clusters the sector to one cluster. It was a single cluster before this process started so - * we revert to that state. The clusterToFit function with a maximum size of 1 node does this. - * - * @private - */ - _collapseThisToSingleCluster : function() { - this.clusterToFit(1,false); - }, - - - /** - * We create a new active sector from the node that we want to open. - * - * @param node - * @private - */ - _addSector : function(node) { - // this is the currently active sector - var sector = this._sector(); - -// // this should allow me to select nodes from a frozen set. -// if (this.sectors['active'][sector]["nodes"].hasOwnProperty(node.id)) { -// console.log("the node is part of the active sector"); -// } -// else { -// console.log("I dont know what happened!!"); -// } - - // when we switch to a new sector, we remove the node that will be expanded from the current nodes list. - delete this.nodes[node.id]; - - var unqiueIdentifier = util.randomUUID(); - - // we fully freeze the currently active sector - this._freezeSector(sector); - - // we create a new active sector. This sector has the Id of the node to ensure uniqueness - this._createNewSector(unqiueIdentifier); - - // we add the active sector to the sectors array to be able to revert these steps later on - this._setActiveSector(unqiueIdentifier); - - // we redirect the global references to the new sector's references. this._sector() now returns unqiueIdentifier - this._switchToSector(this._sector()); - - // finally we add the node we removed from our previous active sector to the new active sector - this.nodes[node.id] = node; - }, - - - /** - * We close the sector that is currently open and revert back to the one before. - * If the active sector is the "default" sector, nothing happens. - * - * @private - */ - _collapseSector : function() { - // the currently active sector - var sector = this._sector(); - - // we cannot collapse the default sector - if (sector != "default") { - if ((this.nodeIndices.length == 1) || - (this.sectors["active"][sector]["drawingNode"].width*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) || - (this.sectors["active"][sector]["drawingNode"].height*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) { - var previousSector = this._previousSector(); - - // we collapse the sector back to a single cluster - this._collapseThisToSingleCluster(); - - // we move the remaining nodes, edges and nodeIndices to the previous sector. - // This previous sector is the one we will reactivate - this._mergeThisWithFrozen(previousSector); - - // the previously active (frozen) sector now has all the data from the currently active sector. - // we can now delete the active sector. - this._deleteActiveSector(sector); - - // we activate the previously active (and currently frozen) sector. - this._activateSector(previousSector); - - // we load the references from the newly active sector into the global references - this._switchToSector(previousSector); - - // we forget the previously active sector because we reverted to the one before - this._forgetLastSector(); - - // finally, we update the node index list. - this._updateNodeIndexList(); - - // we refresh the list with calulation nodes and calculation node indices. - this._updateCalculationNodes(); - } - } - }, - - - /** - * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we dont pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction - * @private - */ - _doInAllActiveSectors : function(runFunction,argument) { - if (argument === undefined) { - for (var sector in this.sectors["active"]) { - if (this.sectors["active"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToActiveSector(sector); - this[runFunction](); - } - } - } - else { - for (var sector in this.sectors["active"]) { - if (this.sectors["active"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToActiveSector(sector); - var args = Array.prototype.splice.call(arguments, 1); - if (args.length > 1) { - this[runFunction](args[0],args[1]); - } - else { - this[runFunction](argument); - } - } - } - } - // we revert the global references back to our active sector - this._loadLatestSector(); - }, - - - /** - * This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we dont pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction - * @private - */ - _doInSupportSector : function(runFunction,argument) { - if (argument === undefined) { - this._switchToSupportSector(); - this[runFunction](); - } - else { - this._switchToSupportSector(); - var args = Array.prototype.splice.call(arguments, 1); - if (args.length > 1) { - this[runFunction](args[0],args[1]); - } - else { - this[runFunction](argument); - } - } - // we revert the global references back to our active sector - this._loadLatestSector(); - }, - - - /** - * This runs a function in all frozen sectors. This is used in the _redraw(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we don't pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction - * @private - */ - _doInAllFrozenSectors : function(runFunction,argument) { - if (argument === undefined) { - for (var sector in this.sectors["frozen"]) { - if (this.sectors["frozen"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToFrozenSector(sector); - this[runFunction](); - } - } - } - else { - for (var sector in this.sectors["frozen"]) { - if (this.sectors["frozen"].hasOwnProperty(sector)) { - // switch the global references to those of this sector - this._switchToFrozenSector(sector); - var args = Array.prototype.splice.call(arguments, 1); - if (args.length > 1) { - this[runFunction](args[0],args[1]); - } - else { - this[runFunction](argument); - } - } - } - } - this._loadLatestSector(); - }, - - - /** - * This runs a function in all sectors. This is used in the _redraw(). - * - * @param {String} runFunction | This is the NAME of a function we want to call in all active sectors - * | we don't pass the function itself because then the "this" is the window object - * | instead of the Network object - * @param {*} [argument] | Optional: arguments to pass to the runFunction - * @private - */ - _doInAllSectors : function(runFunction,argument) { - var args = Array.prototype.splice.call(arguments, 1); - if (argument === undefined) { - this._doInAllActiveSectors(runFunction); - this._doInAllFrozenSectors(runFunction); - } - else { - if (args.length > 1) { - this._doInAllActiveSectors(runFunction,args[0],args[1]); - this._doInAllFrozenSectors(runFunction,args[0],args[1]); - } - else { - this._doInAllActiveSectors(runFunction,argument); - this._doInAllFrozenSectors(runFunction,argument); - } - } - }, - - - /** - * This clears the nodeIndices list. We cannot use this.nodeIndices = [] because we would break the link with the - * active sector. Thus we clear the nodeIndices in the active sector, then reconnect the this.nodeIndices to it. - * - * @private - */ - _clearNodeIndexList : function() { - var sector = this._sector(); - this.sectors["active"][sector]["nodeIndices"] = []; - this.nodeIndices = this.sectors["active"][sector]["nodeIndices"]; - }, - - - /** - * Draw the encompassing sector node - * - * @param ctx - * @param sectorType - * @private - */ - _drawSectorNodes : function(ctx,sectorType) { - var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; - for (var sector in this.sectors[sectorType]) { - if (this.sectors[sectorType].hasOwnProperty(sector)) { - if (this.sectors[sectorType][sector]["drawingNode"] !== undefined) { - - this._switchToSector(sector,sectorType); - - minY = 1e9; maxY = -1e9; minX = 1e9; maxX = -1e9; - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - node = this.nodes[nodeId]; - node.resize(ctx); - if (minX > node.x - 0.5 * node.width) {minX = node.x - 0.5 * node.width;} - if (maxX < node.x + 0.5 * node.width) {maxX = node.x + 0.5 * node.width;} - if (minY > node.y - 0.5 * node.height) {minY = node.y - 0.5 * node.height;} - if (maxY < node.y + 0.5 * node.height) {maxY = node.y + 0.5 * node.height;} - } - } - node = this.sectors[sectorType][sector]["drawingNode"]; - node.x = 0.5 * (maxX + minX); - node.y = 0.5 * (maxY + minY); - node.width = 2 * (node.x - minX); - node.height = 2 * (node.y - minY); - node.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2)); - node.setScale(this.scale); - node._drawCircle(ctx); - } - } - } - }, - - _drawAllSectorNodes : function(ctx) { - this._drawSectorNodes(ctx,"frozen"); - this._drawSectorNodes(ctx,"active"); - this._loadLatestSector(); - } -}; diff --git a/src/network/networkMixins/SelectionMixin.js b/src/network/networkMixins/SelectionMixin.js deleted file mode 100644 index 8acb29c6..00000000 --- a/src/network/networkMixins/SelectionMixin.js +++ /dev/null @@ -1,708 +0,0 @@ - -var SelectionMixin = { - - /** - * This function can be called from the _doInAllSectors function - * - * @param object - * @param overlappingNodes - * @private - */ - _getNodesOverlappingWith : function(object, overlappingNodes) { - var nodes = this.nodes; - for (var nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - if (nodes[nodeId].isOverlappingWith(object)) { - overlappingNodes.push(nodeId); - } - } - } - }, - - /** - * retrieve all nodes overlapping with given object - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private - */ - _getAllNodesOverlappingWith : function (object) { - var overlappingNodes = []; - this._doInAllActiveSectors("_getNodesOverlappingWith",object,overlappingNodes); - return overlappingNodes; - }, - - - /** - * Return a position object in canvasspace from a single point in screenspace - * - * @param pointer - * @returns {{left: number, top: number, right: number, bottom: number}} - * @private - */ - _pointerToPositionObject : function(pointer) { - var x = this._XconvertDOMtoCanvas(pointer.x); - var y = this._YconvertDOMtoCanvas(pointer.y); - - return {left: x, - top: y, - right: x, - bottom: y}; - }, - - - /** - * Get the top node at the a specific point (like a click) - * - * @param {{x: Number, y: Number}} pointer - * @return {Node | null} node - * @private - */ - _getNodeAt : function (pointer) { - // we first check if this is an navigation controls element - var positionObject = this._pointerToPositionObject(pointer); - var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); - - // if there are overlapping nodes, select the last one, this is the - // one which is drawn on top of the others - if (overlappingNodes.length > 0) { - return this.nodes[overlappingNodes[overlappingNodes.length - 1]]; - } - else { - return null; - } - }, - - - /** - * retrieve all edges overlapping with given object, selector is around center - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private - */ - _getEdgesOverlappingWith : function (object, overlappingEdges) { - var edges = this.edges; - for (var edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - if (edges[edgeId].isOverlappingWith(object)) { - overlappingEdges.push(edgeId); - } - } - } - }, - - - /** - * retrieve all nodes overlapping with given object - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private - */ - _getAllEdgesOverlappingWith : function (object) { - var overlappingEdges = []; - this._doInAllActiveSectors("_getEdgesOverlappingWith",object,overlappingEdges); - return overlappingEdges; - }, - - /** - * Place holder. To implement change the _getNodeAt to a _getObjectAt. Have the _getObjectAt call - * _getNodeAt and _getEdgesAt, then priortize the selection to user preferences. - * - * @param pointer - * @returns {null} - * @private - */ - _getEdgeAt : function(pointer) { - var positionObject = this._pointerToPositionObject(pointer); - var overlappingEdges = this._getAllEdgesOverlappingWith(positionObject); - - if (overlappingEdges.length > 0) { - return this.edges[overlappingEdges[overlappingEdges.length - 1]]; - } - else { - return null; - } - }, - - - /** - * Add object to the selection array. - * - * @param obj - * @private - */ - _addToSelection : function(obj) { - if (obj instanceof Node) { - this.selectionObj.nodes[obj.id] = obj; - } - else { - this.selectionObj.edges[obj.id] = obj; - } - }, - - /** - * Add object to the selection array. - * - * @param obj - * @private - */ - _addToHover : function(obj) { - if (obj instanceof Node) { - this.hoverObj.nodes[obj.id] = obj; - } - else { - this.hoverObj.edges[obj.id] = obj; - } - }, - - - /** - * Remove a single option from selection. - * - * @param {Object} obj - * @private - */ - _removeFromSelection : function(obj) { - if (obj instanceof Node) { - delete this.selectionObj.nodes[obj.id]; - } - else { - delete this.selectionObj.edges[obj.id]; - } - }, - - /** - * Unselect all. The selectionObj is useful for this. - * - * @param {Boolean} [doNotTrigger] | ignore trigger - * @private - */ - _unselectAll : function(doNotTrigger) { - if (doNotTrigger === undefined) { - doNotTrigger = false; - } - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - this.selectionObj.nodes[nodeId].unselect(); - } - } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - this.selectionObj.edges[edgeId].unselect(); - } - } - - this.selectionObj = {nodes:{},edges:{}}; - - if (doNotTrigger == false) { - this.emit('select', this.getSelection()); - } - }, - - /** - * Unselect all clusters. The selectionObj is useful for this. - * - * @param {Boolean} [doNotTrigger] | ignore trigger - * @private - */ - _unselectClusters : function(doNotTrigger) { - if (doNotTrigger === undefined) { - doNotTrigger = false; - } - - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (this.selectionObj.nodes[nodeId].clusterSize > 1) { - this.selectionObj.nodes[nodeId].unselect(); - this._removeFromSelection(this.selectionObj.nodes[nodeId]); - } - } - } - - if (doNotTrigger == false) { - this.emit('select', this.getSelection()); - } - }, - - - /** - * return the number of selected nodes - * - * @returns {number} - * @private - */ - _getSelectedNodeCount : function() { - var count = 0; - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - count += 1; - } - } - return count; - }, - - /** - * return the selected node - * - * @returns {number} - * @private - */ - _getSelectedNode : function() { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - return this.selectionObj.nodes[nodeId]; - } - } - return null; - }, - - /** - * return the selected edge - * - * @returns {number} - * @private - */ - _getSelectedEdge : function() { - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - return this.selectionObj.edges[edgeId]; - } - } - return null; - }, - - - /** - * return the number of selected edges - * - * @returns {number} - * @private - */ - _getSelectedEdgeCount : function() { - var count = 0; - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - count += 1; - } - } - return count; - }, - - - /** - * return the number of selected objects. - * - * @returns {number} - * @private - */ - _getSelectedObjectCount : function() { - var count = 0; - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - count += 1; - } - } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - count += 1; - } - } - return count; - }, - - /** - * Check if anything is selected - * - * @returns {boolean} - * @private - */ - _selectionIsEmpty : function() { - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - return false; - } - } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - return false; - } - } - return true; - }, - - - /** - * check if one of the selected nodes is a cluster. - * - * @returns {boolean} - * @private - */ - _clusterInSelection : function() { - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (this.selectionObj.nodes[nodeId].clusterSize > 1) { - return true; - } - } - } - return false; - }, - - /** - * select the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ - _selectConnectedEdges : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - var edge = node.dynamicEdges[i]; - edge.select(); - this._addToSelection(edge); - } - }, - - /** - * select the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ - _hoverConnectedEdges : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - var edge = node.dynamicEdges[i]; - edge.hover = true; - this._addToHover(edge); - } - }, - - - /** - * unselect the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ - _unselectConnectedEdges : function(node) { - for (var i = 0; i < node.dynamicEdges.length; i++) { - var edge = node.dynamicEdges[i]; - edge.unselect(); - this._removeFromSelection(edge); - } - }, - - - - - /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @param {Boolean} append - * @param {Boolean} [doNotTrigger] | ignore trigger - * @private - */ - _selectObject : function(object, append, doNotTrigger, highlightEdges) { - if (doNotTrigger === undefined) { - doNotTrigger = false; - } - if (highlightEdges === undefined) { - highlightEdges = true; - } - - if (this._selectionIsEmpty() == false && append == false && this.forceAppendSelection == false) { - this._unselectAll(true); - } - - if (object.selected == false) { - object.select(); - this._addToSelection(object); - if (object instanceof Node && this.blockConnectingEdgeSelection == false && highlightEdges == true) { - this._selectConnectedEdges(object); - } - } - else { - object.unselect(); - this._removeFromSelection(object); - } - - if (doNotTrigger == false) { - this.emit('select', this.getSelection()); - } - }, - - - /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @private - */ - _blurObject : function(object) { - if (object.hover == true) { - object.hover = false; - this.emit("blurNode",{node:object.id}); - } - }, - - /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @private - */ - _hoverObject : function(object) { - if (object.hover == false) { - object.hover = true; - this._addToHover(object); - if (object instanceof Node) { - this.emit("hoverNode",{node:object.id}); - } - } - if (object instanceof Node) { - this._hoverConnectedEdges(object); - } - }, - - - /** - * handles the selection part of the touch, only for navigation controls elements; - * Touch is triggered before tap, also before hold. Hold triggers after a while. - * This is the most responsive solution - * - * @param {Object} pointer - * @private - */ - _handleTouch : function(pointer) { - }, - - - /** - * handles the selection part of the tap; - * - * @param {Object} pointer - * @private - */ - _handleTap : function(pointer) { - var node = this._getNodeAt(pointer); - if (node != null) { - this._selectObject(node,false); - } - else { - var edge = this._getEdgeAt(pointer); - if (edge != null) { - this._selectObject(edge,false); - } - else { - this._unselectAll(); - } - } - this.emit("click", this.getSelection()); - this._redraw(); - }, - - - /** - * handles the selection part of the double tap and opens a cluster if needed - * - * @param {Object} pointer - * @private - */ - _handleDoubleTap : function(pointer) { - var node = this._getNodeAt(pointer); - if (node != null && node !== undefined) { - // we reset the areaCenter here so the opening of the node will occur - this.areaCenter = {"x" : this._XconvertDOMtoCanvas(pointer.x), - "y" : this._YconvertDOMtoCanvas(pointer.y)}; - this.openCluster(node); - } - this.emit("doubleClick", this.getSelection()); - }, - - - /** - * Handle the onHold selection part - * - * @param pointer - * @private - */ - _handleOnHold : function(pointer) { - var node = this._getNodeAt(pointer); - if (node != null) { - this._selectObject(node,true); - } - else { - var edge = this._getEdgeAt(pointer); - if (edge != null) { - this._selectObject(edge,true); - } - } - this._redraw(); - }, - - - /** - * handle the onRelease event. These functions are here for the navigation controls module. - * - * @private - */ - _handleOnRelease : function(pointer) { - - }, - - - - /** - * - * retrieve the currently selected objects - * @return {Number[] | String[]} selection An array with the ids of the - * selected nodes. - */ - getSelection : function() { - var nodeIds = this.getSelectedNodes(); - var edgeIds = this.getSelectedEdges(); - return {nodes:nodeIds, edges:edgeIds}; - }, - - /** - * - * retrieve the currently selected nodes - * @return {String} selection An array with the ids of the - * selected nodes. - */ - getSelectedNodes : function() { - var idArray = []; - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - idArray.push(nodeId); - } - } - return idArray - }, - - /** - * - * retrieve the currently selected edges - * @return {Array} selection An array with the ids of the - * selected nodes. - */ - getSelectedEdges : function() { - var idArray = []; - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - idArray.push(edgeId); - } - } - return idArray; - }, - - - /** - * select zero or more nodes - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - */ - setSelection : function(selection) { - var i, iMax, id; - - if (!selection || (selection.length == undefined)) - throw 'Selection must be an array with ids'; - - // first unselect any selected node - this._unselectAll(true); - - for (i = 0, iMax = selection.length; i < iMax; i++) { - id = selection[i]; - - var node = this.nodes[id]; - if (!node) { - throw new RangeError('Node with id "' + id + '" not found'); - } - this._selectObject(node,true,true); - } - - console.log("setSelection is deprecated. Please use selectNodes instead.") - - this.redraw(); - }, - - - /** - * select zero or more nodes with the option to highlight edges - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - * @param {boolean} [highlightEdges] - */ - selectNodes : function(selection, highlightEdges) { - var i, iMax, id; - - if (!selection || (selection.length == undefined)) - throw 'Selection must be an array with ids'; - - // first unselect any selected node - this._unselectAll(true); - - for (i = 0, iMax = selection.length; i < iMax; i++) { - id = selection[i]; - - var node = this.nodes[id]; - if (!node) { - throw new RangeError('Node with id "' + id + '" not found'); - } - this._selectObject(node,true,true,highlightEdges); - } - this.redraw(); - }, - - - /** - * select zero or more edges - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - */ - selectEdges : function(selection) { - var i, iMax, id; - - if (!selection || (selection.length == undefined)) - throw 'Selection must be an array with ids'; - - // first unselect any selected node - this._unselectAll(true); - - for (i = 0, iMax = selection.length; i < iMax; i++) { - id = selection[i]; - - var edge = this.edges[id]; - if (!edge) { - throw new RangeError('Edge with id "' + id + '" not found'); - } - this._selectObject(edge,true,true,highlightEdges); - } - this.redraw(); - }, - - /** - * Validate the selection: remove ids of nodes which no longer exist - * @private - */ - _updateSelection : function () { - for(var nodeId in this.selectionObj.nodes) { - if(this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (!this.nodes.hasOwnProperty(nodeId)) { - delete this.selectionObj.nodes[nodeId]; - } - } - } - for(var edgeId in this.selectionObj.edges) { - if(this.selectionObj.edges.hasOwnProperty(edgeId)) { - if (!this.edges.hasOwnProperty(edgeId)) { - delete this.selectionObj.edges[edgeId]; - } - } - } - } -}; - - diff --git a/src/network/networkMixins/physics/BarnesHut.js b/src/network/networkMixins/physics/BarnesHut.js deleted file mode 100644 index d0c5f8da..00000000 --- a/src/network/networkMixins/physics/BarnesHut.js +++ /dev/null @@ -1,398 +0,0 @@ -/** - * Created by Alex on 2/10/14. - */ - -var barnesHutMixin = { - - /** - * This function calculates the forces the nodes apply on eachother based on a gravitational model. - * The Barnes Hut method is used to speed up this N-body simulation. - * - * @private - */ - _calculateNodeForces : function() { - if (this.constants.physics.barnesHut.gravitationalConstant != 0) { - var node; - var nodes = this.calculationNodes; - var nodeIndices = this.calculationNodeIndices; - var nodeCount = nodeIndices.length; - - this._formBarnesHutTree(nodes,nodeIndices); - - var barnesHutTree = this.barnesHutTree; - - // place the nodes one by one recursively - for (var i = 0; i < nodeCount; i++) { - node = nodes[nodeIndices[i]]; - // starting with root is irrelevant, it never passes the BarnesHut condition - this._getForceContribution(barnesHutTree.root.children.NW,node); - this._getForceContribution(barnesHutTree.root.children.NE,node); - this._getForceContribution(barnesHutTree.root.children.SW,node); - this._getForceContribution(barnesHutTree.root.children.SE,node); - } - } - }, - - - /** - * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. - * If a region contains a single node, we check if it is not itself, then we apply the force. - * - * @param parentBranch - * @param node - * @private - */ - _getForceContribution : function(parentBranch,node) { - // we get no force contribution from an empty region - if (parentBranch.childrenCount > 0) { - var dx,dy,distance; - - // get the distance from the center of mass to the node. - dx = parentBranch.centerOfMass.x - node.x; - dy = parentBranch.centerOfMass.y - node.y; - distance = Math.sqrt(dx * dx + dy * dy); - - // BarnesHut condition - // original condition : s/d < theta = passed === d/s > 1/theta = passed - // calcSize = 1/s --> d * 1/s > 1/theta = passed - if (distance * parentBranch.calcSize > this.constants.physics.barnesHut.theta) { - // duplicate code to reduce function calls to speed up program - if (distance == 0) { - distance = 0.1*Math.random(); - dx = distance; - } - var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); - var fx = dx * gravityForce; - var fy = dy * gravityForce; - node.fx += fx; - node.fy += fy; - } - else { - // Did not pass the condition, go into children if available - if (parentBranch.childrenCount == 4) { - this._getForceContribution(parentBranch.children.NW,node); - this._getForceContribution(parentBranch.children.NE,node); - this._getForceContribution(parentBranch.children.SW,node); - this._getForceContribution(parentBranch.children.SE,node); - } - else { // parentBranch must have only one node, if it was empty we wouldnt be here - if (parentBranch.children.data.id != node.id) { // if it is not self - // duplicate code to reduce function calls to speed up program - if (distance == 0) { - distance = 0.5*Math.random(); - dx = distance; - } - var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance); - var fx = dx * gravityForce; - var fy = dy * gravityForce; - node.fx += fx; - node.fy += fy; - } - } - } - } - }, - - /** - * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. - * - * @param nodes - * @param nodeIndices - * @private - */ - _formBarnesHutTree : function(nodes,nodeIndices) { - var node; - var nodeCount = nodeIndices.length; - - var minX = Number.MAX_VALUE, - minY = Number.MAX_VALUE, - maxX =-Number.MAX_VALUE, - maxY =-Number.MAX_VALUE; - - // get the range of the nodes - for (var i = 0; i < nodeCount; i++) { - var x = nodes[nodeIndices[i]].x; - var y = nodes[nodeIndices[i]].y; - if (x < minX) { minX = x; } - if (x > maxX) { maxX = x; } - if (y < minY) { minY = y; } - if (y > maxY) { maxY = y; } - } - // make the range a square - var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y - if (sizeDiff > 0) {minY -= 0.5 * sizeDiff; maxY += 0.5 * sizeDiff;} // xSize > ySize - else {minX += 0.5 * sizeDiff; maxX -= 0.5 * sizeDiff;} // xSize < ySize - - - var minimumTreeSize = 1e-5; - var rootSize = Math.max(minimumTreeSize,Math.abs(maxX - minX)); - var halfRootSize = 0.5 * rootSize; - var centerX = 0.5 * (minX + maxX), centerY = 0.5 * (minY + maxY); - - // construct the barnesHutTree - var barnesHutTree = {root:{ - centerOfMass:{x:0,y:0}, // Center of Mass - mass:0, - range: {minX:centerX-halfRootSize,maxX:centerX+halfRootSize, - minY:centerY-halfRootSize,maxY:centerY+halfRootSize}, - - size: rootSize, - calcSize: 1 / rootSize, - children: {data:null}, - maxWidth: 0, - level: 0, - childrenCount: 4 - }}; - this._splitBranch(barnesHutTree.root); - - // place the nodes one by one recursively - for (i = 0; i < nodeCount; i++) { - node = nodes[nodeIndices[i]]; - this._placeInTree(barnesHutTree.root,node); - } - - // make global - this.barnesHutTree = barnesHutTree - }, - - - /** - * this updates the mass of a branch. this is increased by adding a node. - * - * @param parentBranch - * @param node - * @private - */ - _updateBranchMass : function(parentBranch, node) { - var totalMass = parentBranch.mass + node.mass; - var totalMassInv = 1/totalMass; - - parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.mass; - parentBranch.centerOfMass.x *= totalMassInv; - - parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.mass; - parentBranch.centerOfMass.y *= totalMassInv; - - parentBranch.mass = totalMass; - var biggestSize = Math.max(Math.max(node.height,node.radius),node.width); - parentBranch.maxWidth = (parentBranch.maxWidth < biggestSize) ? biggestSize : parentBranch.maxWidth; - - }, - - - /** - * determine in which branch the node will be placed. - * - * @param parentBranch - * @param node - * @param skipMassUpdate - * @private - */ - _placeInTree : function(parentBranch,node,skipMassUpdate) { - if (skipMassUpdate != true || skipMassUpdate === undefined) { - // update the mass of the branch. - this._updateBranchMass(parentBranch,node); - } - - if (parentBranch.children.NW.range.maxX > node.x) { // in NW or SW - if (parentBranch.children.NW.range.maxY > node.y) { // in NW - this._placeInRegion(parentBranch,node,"NW"); - } - else { // in SW - this._placeInRegion(parentBranch,node,"SW"); - } - } - else { // in NE or SE - if (parentBranch.children.NW.range.maxY > node.y) { // in NE - this._placeInRegion(parentBranch,node,"NE"); - } - else { // in SE - this._placeInRegion(parentBranch,node,"SE"); - } - } - }, - - - /** - * actually place the node in a region (or branch) - * - * @param parentBranch - * @param node - * @param region - * @private - */ - _placeInRegion : function(parentBranch,node,region) { - switch (parentBranch.children[region].childrenCount) { - case 0: // place node here - parentBranch.children[region].children.data = node; - parentBranch.children[region].childrenCount = 1; - this._updateBranchMass(parentBranch.children[region],node); - break; - case 1: // convert into children - // if there are two nodes exactly overlapping (on init, on opening of cluster etc.) - // we move one node a pixel and we do not put it in the tree. - if (parentBranch.children[region].children.data.x == node.x && - parentBranch.children[region].children.data.y == node.y) { - node.x += Math.random(); - node.y += Math.random(); - } - else { - this._splitBranch(parentBranch.children[region]); - this._placeInTree(parentBranch.children[region],node); - } - break; - case 4: // place in branch - this._placeInTree(parentBranch.children[region],node); - break; - } - }, - - - /** - * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch - * after the split is complete. - * - * @param parentBranch - * @private - */ - _splitBranch : function(parentBranch) { - // if the branch is shaded with a node, replace the node in the new subset. - var containedNode = null; - if (parentBranch.childrenCount == 1) { - containedNode = parentBranch.children.data; - parentBranch.mass = 0; parentBranch.centerOfMass.x = 0; parentBranch.centerOfMass.y = 0; - } - parentBranch.childrenCount = 4; - parentBranch.children.data = null; - this._insertRegion(parentBranch,"NW"); - this._insertRegion(parentBranch,"NE"); - this._insertRegion(parentBranch,"SW"); - this._insertRegion(parentBranch,"SE"); - - if (containedNode != null) { - this._placeInTree(parentBranch,containedNode); - } - }, - - - /** - * This function subdivides the region into four new segments. - * Specifically, this inserts a single new segment. - * It fills the children section of the parentBranch - * - * @param parentBranch - * @param region - * @param parentRange - * @private - */ - _insertRegion : function(parentBranch, region) { - var minX,maxX,minY,maxY; - var childSize = 0.5 * parentBranch.size; - switch (region) { - case "NW": - minX = parentBranch.range.minX; - maxX = parentBranch.range.minX + childSize; - minY = parentBranch.range.minY; - maxY = parentBranch.range.minY + childSize; - break; - case "NE": - minX = parentBranch.range.minX + childSize; - maxX = parentBranch.range.maxX; - minY = parentBranch.range.minY; - maxY = parentBranch.range.minY + childSize; - break; - case "SW": - minX = parentBranch.range.minX; - maxX = parentBranch.range.minX + childSize; - minY = parentBranch.range.minY + childSize; - maxY = parentBranch.range.maxY; - break; - case "SE": - minX = parentBranch.range.minX + childSize; - maxX = parentBranch.range.maxX; - minY = parentBranch.range.minY + childSize; - maxY = parentBranch.range.maxY; - break; - } - - - parentBranch.children[region] = { - centerOfMass:{x:0,y:0}, - mass:0, - range:{minX:minX,maxX:maxX,minY:minY,maxY:maxY}, - size: 0.5 * parentBranch.size, - calcSize: 2 * parentBranch.calcSize, - children: {data:null}, - maxWidth: 0, - level: parentBranch.level+1, - childrenCount: 0 - }; - }, - - - /** - * This function is for debugging purposed, it draws the tree. - * - * @param ctx - * @param color - * @private - */ - _drawTree : function(ctx,color) { - if (this.barnesHutTree !== undefined) { - - ctx.lineWidth = 1; - - this._drawBranch(this.barnesHutTree.root,ctx,color); - } - }, - - - /** - * This function is for debugging purposes. It draws the branches recursively. - * - * @param branch - * @param ctx - * @param color - * @private - */ - _drawBranch : function(branch,ctx,color) { - if (color === undefined) { - color = "#FF0000"; - } - - if (branch.childrenCount == 4) { - this._drawBranch(branch.children.NW,ctx); - this._drawBranch(branch.children.NE,ctx); - this._drawBranch(branch.children.SE,ctx); - this._drawBranch(branch.children.SW,ctx); - } - ctx.strokeStyle = color; - ctx.beginPath(); - ctx.moveTo(branch.range.minX,branch.range.minY); - ctx.lineTo(branch.range.maxX,branch.range.minY); - ctx.stroke(); - - ctx.beginPath(); - ctx.moveTo(branch.range.maxX,branch.range.minY); - ctx.lineTo(branch.range.maxX,branch.range.maxY); - ctx.stroke(); - - ctx.beginPath(); - ctx.moveTo(branch.range.maxX,branch.range.maxY); - ctx.lineTo(branch.range.minX,branch.range.maxY); - ctx.stroke(); - - ctx.beginPath(); - ctx.moveTo(branch.range.minX,branch.range.maxY); - ctx.lineTo(branch.range.minX,branch.range.minY); - ctx.stroke(); - - /* - if (branch.mass > 0) { - ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass); - ctx.stroke(); - } - */ - } - -}; \ No newline at end of file diff --git a/src/network/networkMixins/physics/HierarchialRepulsion.js b/src/network/networkMixins/physics/HierarchialRepulsion.js deleted file mode 100644 index 6cc39b55..00000000 --- a/src/network/networkMixins/physics/HierarchialRepulsion.js +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Created by Alex on 2/10/14. - */ - -var hierarchalRepulsionMixin = { - - - /** - * Calculate the forces the nodes apply on eachother based on a repulsion field. - * This field is linearly approximated. - * - * @private - */ - _calculateNodeForces: function () { - var dx, dy, distance, fx, fy, combinedClusterSize, - repulsingForce, node1, node2, i, j; - - var nodes = this.calculationNodes; - var nodeIndices = this.calculationNodeIndices; - - // approximation constants - var b = 5; - var a_base = 0.5 * -b; - - - // repulsing forces between nodes - var nodeDistance = this.constants.physics.hierarchicalRepulsion.nodeDistance; - var minimumDistance = nodeDistance; - var a = a_base / minimumDistance; - - // we loop from i over all but the last entree in the array - // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j - for (i = 0; i < nodeIndices.length - 1; i++) { - - node1 = nodes[nodeIndices[i]]; - for (j = i + 1; j < nodeIndices.length; j++) { - node2 = nodes[nodeIndices[j]]; - if (node1.level == node2.level) { - - dx = node2.x - node1.x; - dy = node2.y - node1.y; - distance = Math.sqrt(dx * dx + dy * dy); - - - if (distance < 2 * minimumDistance) { - repulsingForce = a * distance + b; - var c = 0.05; - var d = 2 * minimumDistance * 2 * c; - repulsingForce = c * Math.pow(distance,2) - d * distance + d*d/(4*c); - - // normalize force with - if (distance == 0) { - distance = 0.01; - } - else { - repulsingForce = repulsingForce / distance; - } - fx = dx * repulsingForce; - fy = dy * repulsingForce; - - node1.fx -= fx; - node1.fy -= fy; - node2.fx += fx; - node2.fy += fy; - } - } - } - } - }, - - - /** - * this function calculates the effects of the springs in the case of unsmooth curves. - * - * @private - */ - _calculateHierarchicalSpringForces: function () { - var edgeLength, edge, edgeId; - var dx, dy, fx, fy, springForce, distance; - var edges = this.edges; - - // forces caused by the edges, modelled as springs - for (edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - edge = edges[edgeId]; - if (edge.connected) { - // only calculate forces if nodes are in the same sector - if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { - edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; - // this implies that the edges between big clusters are longer - edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; - - dx = (edge.from.x - edge.to.x); - dy = (edge.from.y - edge.to.y); - distance = Math.sqrt(dx * dx + dy * dy); - - if (distance == 0) { - distance = 0.01; - } - - distance = Math.max(0.8*edgeLength,Math.min(5*edgeLength, distance)); - - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; - - fx = dx * springForce; - fy = dy * springForce; - - edge.to.fx -= fx; - edge.to.fy -= fy; - edge.from.fx += fx; - edge.from.fy += fy; - - - var factor = 5; - if (distance > edgeLength) { - factor = 25; - } - - if (edge.from.level > edge.to.level) { - edge.to.fx -= factor*fx; - edge.to.fy -= factor*fy; - } - else if (edge.from.level < edge.to.level) { - edge.from.fx += factor*fx; - edge.from.fy += factor*fy; - } - } - } - } - } - } -}; \ No newline at end of file diff --git a/src/network/networkMixins/physics/PhysicsMixin.js b/src/network/networkMixins/physics/PhysicsMixin.js deleted file mode 100644 index b492b462..00000000 --- a/src/network/networkMixins/physics/PhysicsMixin.js +++ /dev/null @@ -1,706 +0,0 @@ -/** - * Created by Alex on 2/6/14. - */ - - -var physicsMixin = { - - /** - * Toggling barnes Hut calculation on and off. - * - * @private - */ - _toggleBarnesHut: function () { - this.constants.physics.barnesHut.enabled = !this.constants.physics.barnesHut.enabled; - this._loadSelectedForceSolver(); - this.moving = true; - this.start(); - }, - - - /** - * This loads the node force solver based on the barnes hut or repulsion algorithm - * - * @private - */ - _loadSelectedForceSolver: function () { - // this overloads the this._calculateNodeForces - if (this.constants.physics.barnesHut.enabled == true) { - this._clearMixin(repulsionMixin); - this._clearMixin(hierarchalRepulsionMixin); - - this.constants.physics.centralGravity = this.constants.physics.barnesHut.centralGravity; - this.constants.physics.springLength = this.constants.physics.barnesHut.springLength; - this.constants.physics.springConstant = this.constants.physics.barnesHut.springConstant; - this.constants.physics.damping = this.constants.physics.barnesHut.damping; - - this._loadMixin(barnesHutMixin); - } - else if (this.constants.physics.hierarchicalRepulsion.enabled == true) { - this._clearMixin(barnesHutMixin); - this._clearMixin(repulsionMixin); - - this.constants.physics.centralGravity = this.constants.physics.hierarchicalRepulsion.centralGravity; - this.constants.physics.springLength = this.constants.physics.hierarchicalRepulsion.springLength; - this.constants.physics.springConstant = this.constants.physics.hierarchicalRepulsion.springConstant; - this.constants.physics.damping = this.constants.physics.hierarchicalRepulsion.damping; - - this._loadMixin(hierarchalRepulsionMixin); - } - else { - this._clearMixin(barnesHutMixin); - this._clearMixin(hierarchalRepulsionMixin); - this.barnesHutTree = undefined; - - this.constants.physics.centralGravity = this.constants.physics.repulsion.centralGravity; - this.constants.physics.springLength = this.constants.physics.repulsion.springLength; - this.constants.physics.springConstant = this.constants.physics.repulsion.springConstant; - this.constants.physics.damping = this.constants.physics.repulsion.damping; - - this._loadMixin(repulsionMixin); - } - }, - - /** - * Before calculating the forces, we check if we need to cluster to keep up performance and we check - * if there is more than one node. If it is just one node, we dont calculate anything. - * - * @private - */ - _initializeForceCalculation: function () { - // stop calculation if there is only one node - if (this.nodeIndices.length == 1) { - this.nodes[this.nodeIndices[0]]._setForce(0, 0); - } - else { - // if there are too many nodes on screen, we cluster without repositioning - if (this.nodeIndices.length > this.constants.clustering.clusterThreshold && this.constants.clustering.enabled == true) { - this.clusterToFit(this.constants.clustering.reduceToNodes, false); - } - - // we now start the force calculation - this._calculateForces(); - } - }, - - - /** - * Calculate the external forces acting on the nodes - * Forces are caused by: edges, repulsing forces between nodes, gravity - * @private - */ - _calculateForces: function () { - // Gravity is required to keep separated groups from floating off - // the forces are reset to zero in this loop by using _setForce instead - // of _addForce - - this._calculateGravitationalForces(); - this._calculateNodeForces(); - - if (this.constants.smoothCurves == true) { - this._calculateSpringForcesWithSupport(); - } - else { - if (this.constants.physics.hierarchicalRepulsion.enabled == true) { - this._calculateHierarchicalSpringForces(); - } - else { - this._calculateSpringForces(); - } - } - }, - - - /** - * Smooth curves are created by adding invisible nodes in the center of the edges. These nodes are also - * handled in the calculateForces function. We then use a quadratic curve with the center node as control. - * This function joins the datanodes and invisible (called support) nodes into one object. - * We do this so we do not contaminate this.nodes with the support nodes. - * - * @private - */ - _updateCalculationNodes: function () { - if (this.constants.smoothCurves == true) { - this.calculationNodes = {}; - this.calculationNodeIndices = []; - - for (var nodeId in this.nodes) { - if (this.nodes.hasOwnProperty(nodeId)) { - this.calculationNodes[nodeId] = this.nodes[nodeId]; - } - } - var supportNodes = this.sectors['support']['nodes']; - for (var supportNodeId in supportNodes) { - if (supportNodes.hasOwnProperty(supportNodeId)) { - if (this.edges.hasOwnProperty(supportNodes[supportNodeId].parentEdgeId)) { - this.calculationNodes[supportNodeId] = supportNodes[supportNodeId]; - } - else { - supportNodes[supportNodeId]._setForce(0, 0); - } - } - } - - for (var idx in this.calculationNodes) { - if (this.calculationNodes.hasOwnProperty(idx)) { - this.calculationNodeIndices.push(idx); - } - } - } - else { - this.calculationNodes = this.nodes; - this.calculationNodeIndices = this.nodeIndices; - } - }, - - - /** - * this function applies the central gravity effect to keep groups from floating off - * - * @private - */ - _calculateGravitationalForces: function () { - var dx, dy, distance, node, i; - var nodes = this.calculationNodes; - var gravity = this.constants.physics.centralGravity; - var gravityForce = 0; - - for (i = 0; i < this.calculationNodeIndices.length; i++) { - node = nodes[this.calculationNodeIndices[i]]; - node.damping = this.constants.physics.damping; // possibly add function to alter damping properties of clusters. - // gravity does not apply when we are in a pocket sector - if (this._sector() == "default" && gravity != 0) { - dx = -node.x; - dy = -node.y; - distance = Math.sqrt(dx * dx + dy * dy); - - gravityForce = (distance == 0) ? 0 : (gravity / distance); - node.fx = dx * gravityForce; - node.fy = dy * gravityForce; - } - else { - node.fx = 0; - node.fy = 0; - } - } - }, - - - - - /** - * this function calculates the effects of the springs in the case of unsmooth curves. - * - * @private - */ - _calculateSpringForces: function () { - var edgeLength, edge, edgeId; - var dx, dy, fx, fy, springForce, distance; - var edges = this.edges; - - // forces caused by the edges, modelled as springs - for (edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - edge = edges[edgeId]; - if (edge.connected) { - // only calculate forces if nodes are in the same sector - if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { - edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; - // this implies that the edges between big clusters are longer - edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth; - - dx = (edge.from.x - edge.to.x); - dy = (edge.from.y - edge.to.y); - distance = Math.sqrt(dx * dx + dy * dy); - - if (distance == 0) { - distance = 0.01; - } - - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; - - fx = dx * springForce; - fy = dy * springForce; - - edge.from.fx += fx; - edge.from.fy += fy; - edge.to.fx -= fx; - edge.to.fy -= fy; - } - } - } - } - }, - - - - - /** - * This function calculates the springforces on the nodes, accounting for the support nodes. - * - * @private - */ - _calculateSpringForcesWithSupport: function () { - var edgeLength, edge, edgeId, combinedClusterSize; - var edges = this.edges; - - // forces caused by the edges, modelled as springs - for (edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - edge = edges[edgeId]; - if (edge.connected) { - // only calculate forces if nodes are in the same sector - if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) { - if (edge.via != null) { - var node1 = edge.to; - var node2 = edge.via; - var node3 = edge.from; - - edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength; - - combinedClusterSize = node1.clusterSize + node3.clusterSize - 2; - - // this implies that the edges between big clusters are longer - edgeLength += combinedClusterSize * this.constants.clustering.edgeGrowth; - this._calculateSpringForce(node1, node2, 0.5 * edgeLength); - this._calculateSpringForce(node2, node3, 0.5 * edgeLength); - } - } - } - } - } - }, - - - /** - * This is the code actually performing the calculation for the function above. It is split out to avoid repetition. - * - * @param node1 - * @param node2 - * @param edgeLength - * @private - */ - _calculateSpringForce: function (node1, node2, edgeLength) { - var dx, dy, fx, fy, springForce, distance; - - dx = (node1.x - node2.x); - dy = (node1.y - node2.y); - distance = Math.sqrt(dx * dx + dy * dy); - - if (distance == 0) { - distance = 0.01; - } - - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance; - - fx = dx * springForce; - fy = dy * springForce; - - node1.fx += fx; - node1.fy += fy; - node2.fx -= fx; - node2.fy -= fy; - }, - - - /** - * Load the HTML for the physics config and bind it - * @private - */ - _loadPhysicsConfiguration: function () { - if (this.physicsConfiguration === undefined) { - this.backupConstants = {}; - util.deepExtend(this.backupConstants,this.constants); - - var hierarchicalLayoutDirections = ["LR", "RL", "UD", "DU"]; - this.physicsConfiguration = document.createElement('div'); - this.physicsConfiguration.className = "PhysicsConfiguration"; - this.physicsConfiguration.innerHTML = '' + - '' + - '' + - '' + - '' + - '' + - '' + - '
      Simulation Mode:
      Barnes HutRepulsionHierarchical
      ' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '
      Options:
      ' - this.containerElement.parentElement.insertBefore(this.physicsConfiguration, this.containerElement); - this.optionsDiv = document.createElement("div"); - this.optionsDiv.style.fontSize = "14px"; - this.optionsDiv.style.fontFamily = "verdana"; - this.containerElement.parentElement.insertBefore(this.optionsDiv, this.containerElement); - - var rangeElement; - rangeElement = document.getElementById('graph_BH_gc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_gc', -1, "physics_barnesHut_gravitationalConstant"); - rangeElement = document.getElementById('graph_BH_cg'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_cg', 1, "physics_centralGravity"); - rangeElement = document.getElementById('graph_BH_sc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sc', 1, "physics_springConstant"); - rangeElement = document.getElementById('graph_BH_sl'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sl', 1, "physics_springLength"); - rangeElement = document.getElementById('graph_BH_damp'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_damp', 1, "physics_damping"); - - rangeElement = document.getElementById('graph_R_nd'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_nd', 1, "physics_repulsion_nodeDistance"); - rangeElement = document.getElementById('graph_R_cg'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_cg', 1, "physics_centralGravity"); - rangeElement = document.getElementById('graph_R_sc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sc', 1, "physics_springConstant"); - rangeElement = document.getElementById('graph_R_sl'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sl', 1, "physics_springLength"); - rangeElement = document.getElementById('graph_R_damp'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_damp', 1, "physics_damping"); - - rangeElement = document.getElementById('graph_H_nd'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance"); - rangeElement = document.getElementById('graph_H_cg'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_cg', 1, "physics_centralGravity"); - rangeElement = document.getElementById('graph_H_sc'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sc', 1, "physics_springConstant"); - rangeElement = document.getElementById('graph_H_sl'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sl', 1, "physics_springLength"); - rangeElement = document.getElementById('graph_H_damp'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_damp', 1, "physics_damping"); - rangeElement = document.getElementById('graph_H_direction'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_direction', hierarchicalLayoutDirections, "hierarchicalLayout_direction"); - rangeElement = document.getElementById('graph_H_levsep'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_levsep', 1, "hierarchicalLayout_levelSeparation"); - rangeElement = document.getElementById('graph_H_nspac'); - rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nspac', 1, "hierarchicalLayout_nodeSpacing"); - - var radioButton1 = document.getElementById("graph_physicsMethod1"); - var radioButton2 = document.getElementById("graph_physicsMethod2"); - var radioButton3 = document.getElementById("graph_physicsMethod3"); - radioButton2.checked = true; - if (this.constants.physics.barnesHut.enabled) { - radioButton1.checked = true; - } - if (this.constants.hierarchicalLayout.enabled) { - radioButton3.checked = true; - } - - var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); - var graph_repositionNodes = document.getElementById("graph_repositionNodes"); - var graph_generateOptions = document.getElementById("graph_generateOptions"); - - graph_toggleSmooth.onclick = graphToggleSmoothCurves.bind(this); - graph_repositionNodes.onclick = graphRepositionNodes.bind(this); - graph_generateOptions.onclick = graphGenerateOptions.bind(this); - if (this.constants.smoothCurves == true) { - graph_toggleSmooth.style.background = "#A4FF56"; - } - else { - graph_toggleSmooth.style.background = "#FF8532"; - } - - - switchConfigurations.apply(this); - - radioButton1.onchange = switchConfigurations.bind(this); - radioButton2.onchange = switchConfigurations.bind(this); - radioButton3.onchange = switchConfigurations.bind(this); - } - }, - - /** - * This overwrites the this.constants. - * - * @param constantsVariableName - * @param value - * @private - */ - _overWriteGraphConstants: function (constantsVariableName, value) { - var nameArray = constantsVariableName.split("_"); - if (nameArray.length == 1) { - this.constants[nameArray[0]] = value; - } - else if (nameArray.length == 2) { - this.constants[nameArray[0]][nameArray[1]] = value; - } - else if (nameArray.length == 3) { - this.constants[nameArray[0]][nameArray[1]][nameArray[2]] = value; - } - } -}; - -/** - * this function is bound to the toggle smooth curves button. That is also why it is not in the prototype. - */ -function graphToggleSmoothCurves () { - this.constants.smoothCurves = !this.constants.smoothCurves; - var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); - if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";} - else {graph_toggleSmooth.style.background = "#FF8532";} - - this._configureSmoothCurves(false); -}; - -/** - * this function is used to scramble the nodes - * - */ -function graphRepositionNodes () { - for (var nodeId in this.calculationNodes) { - if (this.calculationNodes.hasOwnProperty(nodeId)) { - this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0; - this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0; - } - } - if (this.constants.hierarchicalLayout.enabled == true) { - this._setupHierarchicalLayout(); - } - else { - this.repositionNodes(); - } - this.moving = true; - this.start(); -}; - -/** - * this is used to generate an options file from the playing with physics system. - */ -function graphGenerateOptions () { - var options = "No options are required, default values used."; - var optionsSpecific = []; - var radioButton1 = document.getElementById("graph_physicsMethod1"); - var radioButton2 = document.getElementById("graph_physicsMethod2"); - if (radioButton1.checked == true) { - if (this.constants.physics.barnesHut.gravitationalConstant != this.backupConstants.physics.barnesHut.gravitationalConstant) {optionsSpecific.push("gravitationalConstant: " + this.constants.physics.barnesHut.gravitationalConstant);} - if (this.constants.physics.centralGravity != this.backupConstants.physics.barnesHut.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} - if (this.constants.physics.springLength != this.backupConstants.physics.barnesHut.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} - if (this.constants.physics.springConstant != this.backupConstants.physics.barnesHut.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} - if (this.constants.physics.damping != this.backupConstants.physics.barnesHut.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} - if (optionsSpecific.length != 0) { - options = "var options = {"; - options += "physics: {barnesHut: {"; - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", " - } - } - options += '}}' - } - if (this.constants.smoothCurves != this.backupConstants.smoothCurves) { - if (optionsSpecific.length == 0) {options = "var options = {";} - else {options += ", "} - options += "smoothCurves: " + this.constants.smoothCurves; - } - if (options != "No options are required, default values used.") { - options += '};' - } - } - else if (radioButton2.checked == true) { - options = "var options = {"; - options += "physics: {barnesHut: {enabled: false}"; - if (this.constants.physics.repulsion.nodeDistance != this.backupConstants.physics.repulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.repulsion.nodeDistance);} - if (this.constants.physics.centralGravity != this.backupConstants.physics.repulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} - if (this.constants.physics.springLength != this.backupConstants.physics.repulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} - if (this.constants.physics.springConstant != this.backupConstants.physics.repulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} - if (this.constants.physics.damping != this.backupConstants.physics.repulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} - if (optionsSpecific.length != 0) { - options += ", repulsion: {"; - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", " - } - } - options += '}}' - } - if (optionsSpecific.length == 0) {options += "}"} - if (this.constants.smoothCurves != this.backupConstants.smoothCurves) { - options += ", smoothCurves: " + this.constants.smoothCurves; - } - options += '};' - } - else { - options = "var options = {"; - if (this.constants.physics.hierarchicalRepulsion.nodeDistance != this.backupConstants.physics.hierarchicalRepulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.hierarchicalRepulsion.nodeDistance);} - if (this.constants.physics.centralGravity != this.backupConstants.physics.hierarchicalRepulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);} - if (this.constants.physics.springLength != this.backupConstants.physics.hierarchicalRepulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);} - if (this.constants.physics.springConstant != this.backupConstants.physics.hierarchicalRepulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);} - if (this.constants.physics.damping != this.backupConstants.physics.hierarchicalRepulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);} - if (optionsSpecific.length != 0) { - options += "physics: {hierarchicalRepulsion: {"; - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", "; - } - } - options += '}},'; - } - options += 'hierarchicalLayout: {'; - optionsSpecific = []; - if (this.constants.hierarchicalLayout.direction != this.backupConstants.hierarchicalLayout.direction) {optionsSpecific.push("direction: " + this.constants.hierarchicalLayout.direction);} - if (Math.abs(this.constants.hierarchicalLayout.levelSeparation) != this.backupConstants.hierarchicalLayout.levelSeparation) {optionsSpecific.push("levelSeparation: " + this.constants.hierarchicalLayout.levelSeparation);} - if (this.constants.hierarchicalLayout.nodeSpacing != this.backupConstants.hierarchicalLayout.nodeSpacing) {optionsSpecific.push("nodeSpacing: " + this.constants.hierarchicalLayout.nodeSpacing);} - if (optionsSpecific.length != 0) { - for (var i = 0; i < optionsSpecific.length; i++) { - options += optionsSpecific[i]; - if (i < optionsSpecific.length - 1) { - options += ", " - } - } - options += '}' - } - else { - options += "enabled:true}"; - } - options += '};' - } - - - this.optionsDiv.innerHTML = options; - -}; - -/** - * this is used to switch between barnesHut, repulsion and hierarchical. - * - */ -function switchConfigurations () { - var ids = ["graph_BH_table", "graph_R_table", "graph_H_table"]; - var radioButton = document.querySelector('input[name="graph_physicsMethod"]:checked').value; - var tableId = "graph_" + radioButton + "_table"; - var table = document.getElementById(tableId); - table.style.display = "block"; - for (var i = 0; i < ids.length; i++) { - if (ids[i] != tableId) { - table = document.getElementById(ids[i]); - table.style.display = "none"; - } - } - this._restoreNodes(); - if (radioButton == "R") { - this.constants.hierarchicalLayout.enabled = false; - this.constants.physics.hierarchicalRepulsion.enabled = false; - this.constants.physics.barnesHut.enabled = false; - } - else if (radioButton == "H") { - if (this.constants.hierarchicalLayout.enabled == false) { - this.constants.hierarchicalLayout.enabled = true; - this.constants.physics.hierarchicalRepulsion.enabled = true; - this.constants.physics.barnesHut.enabled = false; - this._setupHierarchicalLayout(); - } - } - else { - this.constants.hierarchicalLayout.enabled = false; - this.constants.physics.hierarchicalRepulsion.enabled = false; - this.constants.physics.barnesHut.enabled = true; - } - this._loadSelectedForceSolver(); - var graph_toggleSmooth = document.getElementById("graph_toggleSmooth"); - if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";} - else {graph_toggleSmooth.style.background = "#FF8532";} - this.moving = true; - this.start(); - -} - - -/** - * this generates the ranges depending on the iniital values. - * - * @param id - * @param map - * @param constantsVariableName - */ -function showValueOfRange (id,map,constantsVariableName) { - var valueId = id + "_value"; - var rangeValue = document.getElementById(id).value; - - if (map instanceof Array) { - document.getElementById(valueId).value = map[parseInt(rangeValue)]; - this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]); - } - else { - document.getElementById(valueId).value = parseInt(map) * parseFloat(rangeValue); - this._overWriteGraphConstants(constantsVariableName, parseInt(map) * parseFloat(rangeValue)); - } - - if (constantsVariableName == "hierarchicalLayout_direction" || - constantsVariableName == "hierarchicalLayout_levelSeparation" || - constantsVariableName == "hierarchicalLayout_nodeSpacing") { - this._setupHierarchicalLayout(); - } - this.moving = true; - this.start(); -}; - - diff --git a/src/network/networkMixins/physics/Repulsion.js b/src/network/networkMixins/physics/Repulsion.js deleted file mode 100644 index 71a9994b..00000000 --- a/src/network/networkMixins/physics/Repulsion.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Created by Alex on 2/10/14. - */ - -var repulsionMixin = { - - - /** - * Calculate the forces the nodes apply on eachother based on a repulsion field. - * This field is linearly approximated. - * - * @private - */ - _calculateNodeForces: function () { - var dx, dy, angle, distance, fx, fy, combinedClusterSize, - repulsingForce, node1, node2, i, j; - - var nodes = this.calculationNodes; - var nodeIndices = this.calculationNodeIndices; - - // approximation constants - var a_base = -2 / 3; - var b = 4 / 3; - - // repulsing forces between nodes - var nodeDistance = this.constants.physics.repulsion.nodeDistance; - var minimumDistance = nodeDistance; - - // we loop from i over all but the last entree in the array - // j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j - for (i = 0; i < nodeIndices.length - 1; i++) { - node1 = nodes[nodeIndices[i]]; - for (j = i + 1; j < nodeIndices.length; j++) { - node2 = nodes[nodeIndices[j]]; - combinedClusterSize = node1.clusterSize + node2.clusterSize - 2; - - dx = node2.x - node1.x; - dy = node2.y - node1.y; - distance = Math.sqrt(dx * dx + dy * dy); - - minimumDistance = (combinedClusterSize == 0) ? nodeDistance : (nodeDistance * (1 + combinedClusterSize * this.constants.clustering.distanceAmplification)); - var a = a_base / minimumDistance; - if (distance < 2 * minimumDistance) { - if (distance < 0.5 * minimumDistance) { - repulsingForce = 1.0; - } - else { - repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / minimumDistance - 1) * steepness)) - } - - // amplify the repulsion for clusters. - repulsingForce *= (combinedClusterSize == 0) ? 1 : 1 + combinedClusterSize * this.constants.clustering.forceAmplification; - repulsingForce = repulsingForce / distance; - - fx = dx * repulsingForce; - fy = dy * repulsingForce; - - node1.fx -= fx; - node1.fy -= fy; - node2.fx += fx; - node2.fy += fy; - } - } - } - } -}; \ No newline at end of file diff --git a/src/shim.js b/src/shim.js deleted file mode 100644 index b7b71691..00000000 --- a/src/shim.js +++ /dev/null @@ -1,252 +0,0 @@ - -// Internet Explorer 8 and older does not support Array.indexOf, so we define -// it here in that case. -// http://soledadpenades.com/2007/05/17/arrayindexof-in-internet-explorer/ -if(!Array.prototype.indexOf) { - Array.prototype.indexOf = function(obj){ - for(var i = 0; i < this.length; i++){ - if(this[i] == obj){ - return i; - } - } - return -1; - }; - - try { - console.log("Warning: Ancient browser detected. Please update your browser"); - } - catch (err) { - } -} - -// Internet Explorer 8 and older does not support Array.forEach, so we define -// it here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach -if (!Array.prototype.forEach) { - Array.prototype.forEach = function(fn, scope) { - for(var i = 0, len = this.length; i < len; ++i) { - fn.call(scope || this, this[i], i, this); - } - } -} - -// Internet Explorer 8 and older does not support Array.map, so we define it -// here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map -// Production steps of ECMA-262, Edition 5, 15.4.4.19 -// Reference: http://es5.github.com/#x15.4.4.19 -if (!Array.prototype.map) { - Array.prototype.map = function(callback, thisArg) { - - var T, A, k; - - if (this == null) { - throw new TypeError(" this is null or not defined"); - } - - // 1. Let O be the result of calling ToObject passing the |this| value as the argument. - var O = Object(this); - - // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". - // 3. Let len be ToUint32(lenValue). - var len = O.length >>> 0; - - // 4. If IsCallable(callback) is false, throw a TypeError exception. - // See: http://es5.github.com/#x9.11 - if (typeof callback !== "function") { - throw new TypeError(callback + " is not a function"); - } - - // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. - if (thisArg) { - T = thisArg; - } - - // 6. Let A be a new array created as if by the expression new Array(len) where Array is - // the standard built-in constructor with that name and len is the value of len. - A = new Array(len); - - // 7. Let k be 0 - k = 0; - - // 8. Repeat, while k < len - while(k < len) { - - var kValue, mappedValue; - - // a. Let Pk be ToString(k). - // This is implicit for LHS operands of the in operator - // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. - // This step can be combined with c - // c. If kPresent is true, then - if (k in O) { - - // i. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[ k ]; - - // ii. Let mappedValue be the result of calling the Call internal method of callback - // with T as the this value and argument list containing kValue, k, and O. - mappedValue = callback.call(T, kValue, k, O); - - // iii. Call the DefineOwnProperty internal method of A with arguments - // Pk, Property Descriptor {Value: mappedValue, : true, Enumerable: true, Configurable: true}, - // and false. - - // In browsers that support Object.defineProperty, use the following: - // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true }); - - // For best browser support, use the following: - A[ k ] = mappedValue; - } - // d. Increase k by 1. - k++; - } - - // 9. return A - return A; - }; -} - -// Internet Explorer 8 and older does not support Array.filter, so we define it -// here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter -if (!Array.prototype.filter) { - Array.prototype.filter = function(fun /*, thisp */) { - "use strict"; - - if (this == null) { - throw new TypeError(); - } - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun != "function") { - throw new TypeError(); - } - - var res = []; - var thisp = arguments[1]; - for (var i = 0; i < len; i++) { - if (i in t) { - var val = t[i]; // in case fun mutates this - if (fun.call(thisp, val, i, t)) - res.push(val); - } - } - - return res; - }; -} - - -// Internet Explorer 8 and older does not support Object.keys, so we define it -// here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys -if (!Object.keys) { - Object.keys = (function () { - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), - dontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ], - dontEnumsLength = dontEnums.length; - - return function (obj) { - if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) { - throw new TypeError('Object.keys called on non-object'); - } - - var result = []; - - for (var prop in obj) { - if (hasOwnProperty.call(obj, prop)) result.push(prop); - } - - if (hasDontEnumBug) { - for (var i=0; i < dontEnumsLength; i++) { - if (hasOwnProperty.call(obj, dontEnums[i])) result.push(dontEnums[i]); - } - } - return result; - } - })() -} - -// Internet Explorer 8 and older does not support Array.isArray, -// so we define it here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray -if(!Array.isArray) { - Array.isArray = function (vArg) { - return Object.prototype.toString.call(vArg) === "[object Array]"; - }; -} - -// Internet Explorer 8 and older does not support Function.bind, -// so we define it here in that case. -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} - -// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create -if (!Object.create) { - Object.create = function (o) { - if (arguments.length > 1) { - throw new Error('Object.create implementation only accepts the first parameter.'); - } - function F() {} - F.prototype = o; - return new F(); - }; -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} diff --git a/test/DataSet.test.js b/test/DataSet.test.js new file mode 100644 index 00000000..374faad0 --- /dev/null +++ b/test/DataSet.test.js @@ -0,0 +1,177 @@ +var assert = require('assert'); +var moment = require('moment'); +var DataSet = require('../lib/DataSet'); + +var now = new Date(); + +// TODO: improve DataSet tests, split up in one test per function +describe('DataSet', function () { + it('should work', function () { + + var data = new DataSet({ + type: { + start: 'Date', + end: 'Date' + } + }); + + // add single items with different date types + data.add({id: 1, content: 'Item 1', start: new Date(now.valueOf())}); + data.add({id: 2, content: 'Item 2', start: now.toISOString()}); + data.add([ + //{id: 3, content: 'Item 3', start: moment(now)}, // TODO: moment fails, not the same instance + {id: 3, content: 'Item 3', start: now}, + {id: 4, content: 'Item 4', start: '/Date(' + now.valueOf() + ')/'} + ]); + + var items = data.get(); + assert.equal(items.length, 4); + items.forEach(function (item) { + assert.ok(item.start instanceof Date); + }); + + // get filtered fields only + var sort = function (a, b) { + return a.id > b.id; + }; + + assert.deepEqual(data.get({ + fields: ['id', 'content'] + }).sort(sort), [ + {id: 1, content: 'Item 1'}, + {id: 2, content: 'Item 2'}, + {id: 3, content: 'Item 3'}, + {id: 4, content: 'Item 4'} + ]); + + + // convert dates + assert.deepEqual(data.get({ + fields: ['id', 'start'], + type: {start: 'Number'} + }).sort(sort), [ + {id: 1, start: now.valueOf()}, + {id: 2, start: now.valueOf()}, + {id: 3, start: now.valueOf()}, + {id: 4, start: now.valueOf()} + ]); + + + // get a single item + assert.deepEqual(data.get(1, { + fields: ['id', 'start'], + type: {start: 'ISODate'} + }), { + id: 1, + start: now.toISOString() + }); + + // remove an item + data.remove(2); + assert.deepEqual(data.get({ + fields: ['id'] + }).sort(sort), [ + {id: 1}, + {id: 3}, + {id: 4} + ]); + + // add an item + data.add({id: 5, content: 'Item 5', start: now.valueOf()}); + assert.deepEqual(data.get({ + fields: ['id'] + }).sort(sort), [ + {id: 1}, + {id: 3}, + {id: 4}, + {id: 5} + ]); + + // update an item + data.update({id: 5, content: 'changed!'}); // update item (extend existing fields) + data.remove(3); // remove existing item + data.add({id: 3, other: 'bla'}); // add new item + data.update({id: 6, content: 'created!', start: now.valueOf()}); // this item is not yet existing, create it + assert.deepEqual(data.get().sort(sort), [ + {id: 1, content: 'Item 1', start: now}, + {id: 3, other: 'bla'}, + {id: 4, content: 'Item 4', start: now}, + {id: 5, content: 'changed!', start: now}, + {id: 6, content: 'created!', start: now} + ]); + + data.clear(); + + assert.equal(data.get().length, 0); + + + // test filtering and sorting + data = new DataSet(); + data.add([ + {id: 1, age: 30, group: 2}, + {id: 2, age: 25, group: 4}, + {id: 3, age: 17, group: 2}, + {id: 4, age: 27, group: 3} + ]); + + assert.deepEqual(data.get({order: 'age'}), [ + {id: 3, age: 17, group: 2}, + {id: 2, age: 25, group: 4}, + {id: 4, age: 27, group: 3}, + {id: 1, age: 30, group: 2} + ]); + assert.deepEqual(data.getIds({order: 'age'}), [3, 2, 4, 1]); + + assert.deepEqual(data.get({order: 'age', fields: ['id']}), [ + {id: 3}, + {id: 2}, + {id: 4}, + {id: 1} + ]); + + assert.deepEqual(data.get({ + order: 'age', + filter: function (item) { + return item.group == 2; + }, + fields: ['id'] + }), [ + {id: 3}, + {id: 1} + ]); + assert.deepEqual(data.getIds({ + order: 'age', + filter: function (item) { + return (item.group == 2); + } + }), [3, 1]); + + + data.clear(); + + + // test if the setting of the showInternalIds works locally for a single get request + data.add({content: 'Item 1'}); + data.add({content: 'Item 2'}); + + assert.notStrictEqual(data.get()[0].id, undefined); + + // create a dataset with initial data + var data = new DataSet([ + {id: 1, content: 'Item 1', start: new Date(now.valueOf())}, + {id: 2, content: 'Item 2', start: now.toISOString()} + ]); + assert.deepEqual(data.getIds(), [1, 2]); + + // create a dataset with initial data and options + var data = new DataSet([ + {_id: 1, content: 'Item 1', start: new Date(now.valueOf())}, + {_id: 2, content: 'Item 2', start: now.toISOString()} + ], {fieldId: '_id'}); + assert.deepEqual(data.getIds(), [1, 2]); + + // TODO: extensively test DataSet + // TODO: test subscribing to events + + }); +}); \ No newline at end of file diff --git a/test/DataView.test.js b/test/DataView.test.js new file mode 100644 index 00000000..b0afbf62 --- /dev/null +++ b/test/DataView.test.js @@ -0,0 +1,69 @@ +var assert = require('assert'); +var moment = require('moment'); +var DataSet = require('../lib/DataSet'); +var DataView = require('../lib/DataView'); + +// TODO: improve DataView tests, split up in one test per function +describe('DataView', function () { + it('should work', function () { + var groups = new DataSet(); + +// add items with different groups + groups.add([ + {id: 1, content: 'Item 1', group: 1}, + {id: 2, content: 'Item 2', group: 2}, + {id: 3, content: 'Item 3', group: 2}, + {id: 4, content: 'Item 4', group: 1}, + {id: 5, content: 'Item 5', group: 3} + ]); + + var group2 = new DataView(groups, { + filter: function (item) { + return item.group == 2; + } + }); + +// test getting the filtered data + assert.deepEqual(group2.get(), [ + {id: 2, content: 'Item 2', group: 2}, + {id: 3, content: 'Item 3', group: 2} + ]); + +// test filtering the view contents + assert.deepEqual(group2.get({ + filter: function (item) { + return item.id > 2; + } + }), [ + {id: 3, content: 'Item 3', group: 2} + ]); + +// test event subscription + var groupsTriggerCount = 0; + groups.on('*', function () { + groupsTriggerCount++; + }); + var group2TriggerCount = 0; + group2.on('*', function () { + group2TriggerCount++; + }); + + groups.update({id:2, content: 'Item 2 (changed)'}); + assert.equal(groupsTriggerCount, 1); + assert.equal(group2TriggerCount, 1); + + groups.update({id:5, content: 'Item 5 (changed)'}); + assert.equal(groupsTriggerCount, 2); + assert.equal(group2TriggerCount, 1); + +// detach the view from groups + group2.setData(null); + assert.equal(groupsTriggerCount, 2); + assert.equal(group2TriggerCount, 2); + + groups.update({id:2, content: 'Item 2 (changed again)'}); + assert.equal(groupsTriggerCount, 3); + assert.equal(group2TriggerCount, 2); + }); + +}); diff --git a/test/dataset.js b/test/dataset.js deleted file mode 100644 index 3e18923c..00000000 --- a/test/dataset.js +++ /dev/null @@ -1,172 +0,0 @@ -var assert = require('assert'), - moment = require('moment'), - vis = require('../dist/vis.js'), - DataSet = vis.DataSet; - -var now = new Date(); - -var data = new DataSet({ - type: { - start: 'Date', - end: 'Date' - } -}); - -// add single items with different date types -data.add({id: 1, content: 'Item 1', start: new Date(now.valueOf())}); -data.add({id: 2, content: 'Item 2', start: now.toISOString()}); -data.add([ - //{id: 3, content: 'Item 3', start: moment(now)}, // TODO: moment fails, not the same instance - {id: 3, content: 'Item 3', start: now}, - {id: 4, content: 'Item 4', start: '/Date(' + now.valueOf() + ')/'} -]); - -var items = data.get(); -assert.equal(items.length, 4); -items.forEach(function (item) { - assert.ok(item.start instanceof Date); -}); - -// get filtered fields only -var sort = function (a, b) { - return a.id > b.id; -}; - -assert.deepEqual(data.get({ - fields: ['id', 'content'] -}).sort(sort), [ - {id: 1, content: 'Item 1'}, - {id: 2, content: 'Item 2'}, - {id: 3, content: 'Item 3'}, - {id: 4, content: 'Item 4'} -]); - - -// convert dates -assert.deepEqual(data.get({ - fields: ['id', 'start'], - type: {start: 'Number'} -}).sort(sort), [ - {id: 1, start: now.valueOf()}, - {id: 2, start: now.valueOf()}, - {id: 3, start: now.valueOf()}, - {id: 4, start: now.valueOf()} -]); - - -// get a single item -assert.deepEqual(data.get(1, { - fields: ['id', 'start'], - type: {start: 'ISODate'} -}), { - id: 1, - start: now.toISOString() -}); - -// remove an item -data.remove(2); -assert.deepEqual(data.get({ - fields: ['id'] -}).sort(sort), [ - {id: 1}, - {id: 3}, - {id: 4} -]); - -// add an item -data.add({id: 5, content: 'Item 5', start: now.valueOf()}); -assert.deepEqual(data.get({ - fields: ['id'] -}).sort(sort), [ - {id: 1}, - {id: 3}, - {id: 4}, - {id: 5} -]); - -// update an item -data.update({id: 5, content: 'changed!'}); // update item (extend existing fields) -data.remove(3); // remove existing item -data.add({id: 3, other: 'bla'}); // add new item -data.update({id: 6, content: 'created!', start: now.valueOf()}); // this item is not yet existing, create it -assert.deepEqual(data.get().sort(sort), [ - {id: 1, content: 'Item 1', start: now}, - {id: 3, other: 'bla'}, - {id: 4, content: 'Item 4', start: now}, - {id: 5, content: 'changed!', start: now}, - {id: 6, content: 'created!', start: now} -]); - -data.clear(); - -assert.equal(data.get().length, 0); - - -// test filtering and sorting -data = new vis.DataSet(); -data.add([ - {id:1, age: 30, group: 2}, - {id:2, age: 25, group: 4}, - {id:3, age: 17, group: 2}, - {id:4, age: 27, group: 3} -]); - -assert.deepEqual(data.get({order: 'age'}), [ - {id:3, age: 17, group: 2}, - {id:2, age: 25, group: 4}, - {id:4, age: 27, group: 3}, - {id:1, age: 30, group: 2} -]); -assert.deepEqual(data.getIds({order: 'age'}), [3,2,4,1]); - -assert.deepEqual(data.get({order: 'age', fields: ['id']}), [ - {id:3}, - {id:2}, - {id:4}, - {id:1} -]); - -assert.deepEqual(data.get({ - order: 'age', - filter: function (item) { - return item.group == 2; - }, - fields: ['id'] -}), [ - {id:3}, - {id:1} -]); -assert.deepEqual(data.getIds({ - order: 'age', - filter: function (item) { - return (item.group == 2); - } -}), [3,1]); - - -data.clear(); - - -// test if the setting of the showInternalIds works locally for a single get request -data.add({content: 'Item 1'}); -data.add({content: 'Item 2'}); - -assert.notStrictEqual(data.get()[0].id, undefined); - -// create a dataset with initial data -var data = new DataSet([ - {id: 1, content: 'Item 1', start: new Date(now.valueOf())}, - {id: 2, content: 'Item 2', start: now.toISOString()} -]); -assert.deepEqual(data.getIds(), [1, 2]); - -// create a dataset with initial data and options -var data = new DataSet([ - {_id: 1, content: 'Item 1', start: new Date(now.valueOf())}, - {_id: 2, content: 'Item 2', start: now.toISOString()} -], {fieldId: '_id'}); -assert.deepEqual(data.getIds(), [1, 2]); - - -// TODO: extensively test DataSet -// TODO: test subscribing to events \ No newline at end of file diff --git a/test/dataview.js b/test/dataview.js deleted file mode 100644 index 1329454c..00000000 --- a/test/dataview.js +++ /dev/null @@ -1,65 +0,0 @@ -var assert = require('assert'), - moment = require('moment'), - vis = require('../dist/vis.js'), - DataSet = vis.DataSet, - DataView = vis.DataView; - - -var groups = new DataSet(); - -// add items with different groups -groups.add([ - {id: 1, content: 'Item 1', group: 1}, - {id: 2, content: 'Item 2', group: 2}, - {id: 3, content: 'Item 3', group: 2}, - {id: 4, content: 'Item 4', group: 1}, - {id: 5, content: 'Item 5', group: 3} -]); - -var group2 = new DataView(groups, { - filter: function (item) { - return item.group == 2; - } -}); - -// test getting the filtered data -assert.deepEqual(group2.get(), [ - {id: 2, content: 'Item 2', group: 2}, - {id: 3, content: 'Item 3', group: 2} -]); - -// test filtering the view contents -assert.deepEqual(group2.get({ - filter: function (item) { - return item.id > 2; - } -}), [ - {id: 3, content: 'Item 3', group: 2} -]); - -// test event subscription -var groupsTriggerCount = 0; -groups.on('*', function () { - groupsTriggerCount++; -}); -var group2TriggerCount = 0; -group2.on('*', function () { - group2TriggerCount++; -}); - -groups.update({id:2, content: 'Item 2 (changed)'}); -assert.equal(groupsTriggerCount, 1); -assert.equal(group2TriggerCount, 1); - -groups.update({id:5, content: 'Item 5 (changed)'}); -assert.equal(groupsTriggerCount, 2); -assert.equal(group2TriggerCount, 1); - -// detach the view from groups -group2.setData(null); -assert.equal(groupsTriggerCount, 2); -assert.equal(group2TriggerCount, 2); - -groups.update({id:2, content: 'Item 2 (changed again)'}); -assert.equal(groupsTriggerCount, 3); -assert.equal(group2TriggerCount, 2); diff --git a/test/dotparser.js b/test/dotparser.js deleted file mode 100644 index 48832813..00000000 --- a/test/dotparser.js +++ /dev/null @@ -1,179 +0,0 @@ -var assert = require('assert'), - fs = require('fs'), - dot = require('../src/network/dotparser.js'); - -fs.readFile('test/dot.txt', function (err, data) { - data = String(data); - - var graph = dot.parseDOT(data); - - assert.deepEqual(graph, { - "type": "digraph", - "id": "test_graph", - "rankdir": "LR", - "size": "8,5", - "font": "arial", - "nodes": [ - { - "id": "node1", - "attr": { - "shape": "doublecircle" - } - }, - { - "id": "node2", - "attr": { - "shape": "doublecircle" - } - }, - { - "id": "node3", - "attr": { - "shape": "doublecircle" - } - }, - { - "id": "node4", - "attr": { - "shape": "diamond", - "color": "red" - } - }, - { - "id": "node5", - "attr": { - "shape": "square", - "color": "blue", - "width": 3 - } - }, - { - "id": 6, - "attr": { - "shape": "circle" - } - }, - { - "id": "A", - "attr": { - "shape": "circle" - } - }, - { - "id": "B", - "attr": { - "shape": "circle" - } - }, - { - "id": "C", - "attr": { - "shape": "circle" - } - } - ], - "edges": [ - { - "from": "node1", - "to": "node1", - "type": "->", - "attr": { - "length": 170, - "fontSize": 12, - "label": "a" - } - }, - { - "from": "node2", - "to": "node3", - "type": "->", - "attr": { - "length": 170, - "fontSize": 12, - "label": "b" - } - }, - { - "from": "node1", - "to": "node4", - "type": "--", - "attr": { - "length": 170, - "fontSize": 12, - "label": "c" - } - }, - { - "from": "node3", - "to": "node4", - "type": "->", - "attr": { - "length": 170, - "fontSize": 12, - "label": "d" - } - }, - { - "from": "node4", - "to": "node5", - "type": "->", - "attr": { - "length": 170, - "fontSize": 12 - } - }, - { - "from": "node5", - "to": 6, - "type": "->", - "attr": { - "length": 170, - "fontSize": 12 - } - }, - { - "from": "A", - "to": { - "nodes": [ - { - "id": "B", - "attr": { - "shape": "circle" - } - }, - { - "id": "C", - "attr": { - "shape": "circle" - } - } - ] - }, - "type": "->", - "attr": { - "length": 170, - "fontSize": 12 - } - } - ], - "subgraphs": [ - { - "nodes": [ - { - "id": "B", - "attr": { - "shape": "circle" - } - }, - { - "id": "C", - "attr": { - "shape": "circle" - } - } - ] - } - ] - }); -}); - diff --git a/test/dotparser.test.js b/test/dotparser.test.js new file mode 100644 index 00000000..da951f26 --- /dev/null +++ b/test/dotparser.test.js @@ -0,0 +1,186 @@ +var assert = require('assert'), + fs = require('fs'), + dot = require('../lib/network/dotparser.js'); + +describe('dotparser', function () { + + it('should parse a DOT file into JSON', function (done) { + fs.readFile('test/dot.txt', function (err, data) { + data = String(data); + + var graph = dot.parseDOT(data); + + assert.deepEqual(graph, { + "type": "digraph", + "id": "test_graph", + "rankdir": "LR", + "size": "8,5", + "font": "arial", + "nodes": [ + { + "id": "node1", + "attr": { + "shape": "doublecircle" + } + }, + { + "id": "node2", + "attr": { + "shape": "doublecircle" + } + }, + { + "id": "node3", + "attr": { + "shape": "doublecircle" + } + }, + { + "id": "node4", + "attr": { + "shape": "diamond", + "color": "red" + } + }, + { + "id": "node5", + "attr": { + "shape": "square", + "color": "blue", + "width": 3 + } + }, + { + "id": 6, + "attr": { + "shape": "circle" + } + }, + { + "id": "A", + "attr": { + "shape": "circle" + } + }, + { + "id": "B", + "attr": { + "shape": "circle" + } + }, + { + "id": "C", + "attr": { + "shape": "circle" + } + } + ], + "edges": [ + { + "from": "node1", + "to": "node1", + "type": "->", + "attr": { + "length": 170, + "fontSize": 12, + "label": "a" + } + }, + { + "from": "node2", + "to": "node3", + "type": "->", + "attr": { + "length": 170, + "fontSize": 12, + "label": "b" + } + }, + { + "from": "node1", + "to": "node4", + "type": "--", + "attr": { + "length": 170, + "fontSize": 12, + "label": "c" + } + }, + { + "from": "node3", + "to": "node4", + "type": "->", + "attr": { + "length": 170, + "fontSize": 12, + "label": "d" + } + }, + { + "from": "node4", + "to": "node5", + "type": "->", + "attr": { + "length": 170, + "fontSize": 12 + } + }, + { + "from": "node5", + "to": 6, + "type": "->", + "attr": { + "length": 170, + "fontSize": 12 + } + }, + { + "from": "A", + "to": { + "nodes": [ + { + "id": "B", + "attr": { + "shape": "circle" + } + }, + { + "id": "C", + "attr": { + "shape": "circle" + } + } + ] + }, + "type": "->", + "attr": { + "length": 170, + "fontSize": 12 + } + } + ], + "subgraphs": [ + { + "nodes": [ + { + "id": "B", + "attr": { + "shape": "circle" + } + }, + { + "id": "C", + "attr": { + "shape": "circle" + } + } + ] + } + ] + }); + + done(); + }); + }); + +}); diff --git a/test/timeline.html b/test/timeline.html index 94607b91..556eeda2 100644 --- a/test/timeline.html +++ b/test/timeline.html @@ -3,6 +3,10 @@ + + @@ -66,7 +70,7 @@ }); items.add([ {_id: 0, content: 'item 0', start: now.clone().add('days', 3).toDate(), title: 'hello title!'}, - {_id: 1, content: 'item 1
      start', start: now.clone().add('days', 4).toDate()}, + {_id: '1', content: 'item 1
      start', start: now.clone().add('days', 4).toDate()}, {_id: 2, content: 'item 2', start: now.clone().add('days', -2).toDate() }, {_id: 3, content: 'item 3', start: now.clone().add('days', 2).toDate()}, { diff --git a/tools/watch.js b/tools/watch.js deleted file mode 100644 index 79c99a9c..00000000 --- a/tools/watch.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Watch for changes in the sourcecode, and rebuild vis.js on change - * - * Usage: - * cd vis - * node tools/watch.js - */ - -var watch = require('node-watch'), - child_process = require('child_process'); - -// constants -var WATCH_FOLDER = './src'; -var BUILD_COMMAND = 'jake build'; - -// rebuilt vis.js on change of code -function rebuild() { - var start = +new Date(); - child_process.exec(BUILD_COMMAND, function () { - var end = +new Date(); - console.log('rebuilt in ' + (end - start) + ' ms'); - }); -} - -// watch for changes in the code, rebuilt vis.js automatically -watch(WATCH_FOLDER, function(filename) { - console.log(filename + ' changed'); - rebuild(); -}); - -rebuild(); - -console.log('watching for changes in the source code...');