diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..e4b4ce7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,10 @@ + +Please make sure to **read the following list** before creating a new issue: + +* This issue tracker is not supposed to be used for questions on how to use visjs. It is intended to be used for bug reports and feature requests! In case you face yourself with a usage question, then post your question e.g. on [stackoverflow](https://stackoverflow.com/questions/tagged/vis.js) tagged with "vis.js". +* Have you already used the [github search](https://github.com/almende/vis/issues), read the [documentation](http://visjs.org/) and looked at the [examples](https://github.com/almende/vis/tree/develop/examples)? +* Make sure to mention which vis-component (network, timeline, graph2D, graph3d) you are referring to. +* Make sure to use the [latest version of vis.js](https://cdnjs.com/libraries/vis) for bug reports. +* Make sure to mention which browser and OS you are using when creating a bug report. +* Please provide a minimal code example that demonstrates your issue. We recommend using [jsbin](jsbin.com) for that. +* Delete this list from the actual issue. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..1a43ae70 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +**Thank you for contributing to vis.js!!** + +Please make sure to check the following requirements before creating a pull request: + +* [ ] All pull requests must be to the [develop branch](https://github.com/almende/vis/tree/develop). Pull requests to the `master` branch will be closed! +* [ ] Make sure your changes are based on the latest version of the [develop branch](https://github.com/almende/vis/tree/develop). (Use e.g. `git fetch && git rebase origin develop` to update you feature branch). +* [ ] Provide an additional or update an example to demonstrate your changes or new features. +* [ ] Update the documentation if you introduced new behavior or changed existing behavior. +* [ ] Reference issue numbers of issues that your pull request addresses. (If you write something like `fixes #1781` in your git commit message this issue gets closed automatically by merging your pull request). +* [ ] Expect review comments and change requests by reviewer. +* [ ] Delete this checklist from your pull request. diff --git a/HISTORY.md b/HISTORY.md index 98831743..23e8c72f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,77 @@ # vis.js history http://visjs.org +## 2017-03-19, version 4.19.1 + +### General + +* FIX: #2685 Fixed babel dependencies (#2875) + +### Timeline / Graph2D + +* FIX #2809: Fix docs typo in "showNested" (#2879) +* FIX #2594: Fixes for removing and adding items to subgroups (#2821) +* FIX: Allow nested groups to be removed (#2852) + + +## 2017-03-18, version 4.19.0 + +### General + +- FIX: Fix eslint problem on Travis. (#2744) +- added support for eslint (#2695) +- Trivial typo fix in how_to_help doc. (#2714) +- add link to a mentioned example (#2709) +- FEAT: use babel preset2015 for custom builds (#2678) +- FIX: use babel version compatible with webpack@1.14 (#2693) +- FEAT: run mocha tests in travis ci (#2687) +- Add note that PRs should be submitted against the `develop` branch (#2623) +- FIX: Fixes instanceof Object statements for objects from other windows and iFrames. (#2631) +- removed google-analytics from all examples (#2670) +- do not ignore test folder (#2648) +- updated dependencies and devDependencies (#2649) +- general improvements (#2652) + +### Network + +- FEAT: Improve the performance of the network layout engine (#2729) +- FEAT: Allow for image nodes to have a selected or broken image (#2601) + +### Timeline / Graph2D + +- FIX #2842: Prevent redirect to blank after drag and drop in FF (#2871) +- FIX #2810: Nested groups do not use "groupOrder" (#2817) +- FIX #2795: fix date for custom format function (#2826) +- FIX #2689: Add animation options for zoomIn/zoomOut funtions (#2830) +- FIX #2800: Removed all "Object.assign" from examples (#2829) +- FIX #2725: Background items positioning when orientation: top (#2831) +- FEAT: Added data as argument to the template function (#2802) +- FIX #2827: Update "progress bar" example to reflect values (#2828) +- FIX #2672: Item events original event (#2704) +- FIX #2696: Update serialization example to use ISOString dates (#2789) +- FIX #2790: Update examples to use ISOString format (#2791) +- FEAT: Added support to supply an end-time to bar charts to have them scale (#2760) +- FIX #1982, #1417: Modify redraw logic to treat scroll as needing restack (#2774) +- FEAT: Initial tests for timeline ItemSet (#2750) +- FIX #2720: Problems with option editable (#2743, #2796, #2806) +- FIX: Range.js "event" is undeclared (#2749) +- FEAT: added new locales for french and espanol (#2723) +- FIX: fixes timestep next issue (#2732) +- FEAT: #2647 Dynamic rolling mode option (#2705) +- FIX #2679: TypeError: Cannot read property 'hasOwnProperty' of null (#2735) +- Add initial tests for Timeline PointItem (#2716) +- FIX #778: Tooltip does not work with background items in timeline (#2703) +- FIX #2598: Flickering onUpdateTimeTooltip (#2702) +- FEAT: refactor tooltip to only use one dom-element (#2662) +- FEAT: Change setCustomTimeTitle title parameter to be a string or a function (#2611) + +### Graph3D + +- FEAT #2769: Graph3d tooltip styling (#2780) +- FEAT #2540: Adjusted graph3d doc for autoscaling (#2812) +- FIX #2536: 3d bar graph data array unsorted (#2803) +- FEAT: Added showX(YZ)Axis options to Graph3d (#2686) + ## 2017-01-29, version 4.18.1 diff --git a/docs/graph2d/index.html b/docs/graph2d/index.html index 66a488f0..7683d82d 100644 --- a/docs/graph2d/index.html +++ b/docs/graph2d/index.html @@ -297,7 +297,13 @@ var items = [ label Object no - A label object which will be displayed near to the item. A label object has one requirement - a content property. In addition you can set the xOffset, yOffset and className for further appearance customisations + A label object which will be displayed near to the item. A label object has one requirement - a content property. In addition you can set the xOffset, yOffset and className for further appearance customisations. + + + end + Date + no + A location on the x-axis that when supplied will have the bar stretch to the end point and ignore the barChart.width property. diff --git a/docs/graph3d/index.html b/docs/graph3d/index.html index fd9ba49a..85829ad1 100644 --- a/docs/graph3d/index.html +++ b/docs/graph3d/index.html @@ -498,6 +498,38 @@ var options = { + + tooltipStyle + Object + +
+{ 
+  content: {
+    padding: '10px',
+    border: '1px solid #4d4d4d',
+    color: '#1a1a1a',
+    background: 'rgba(255,255,255,0.7)',
+    borderRadius: '2px',
+    boxShadow: '5px 5px 10px rgba(128,128,128,0.5)'
+  },
+  line: {
+    height: '40px',
+    width: '0',
+    borderLeft: '1px solid #4d4d4d'
+  },
+  dot: {
+    height: '0',
+    width: '0',
+    border: '5px solid #4d4d4d',
+    borderRadius: '5px'
+  }
+}
+ + Tooltip style properties. + Provided properties will be merged with the default object. + + + valueMax number @@ -532,8 +564,8 @@ var options = { xBarWidth number none - The width of bars in x direction. By default, the width is equal to the distance - between the data points, such that bars adjoin each other. + The width of bars in x direction. By default, the width is equal to the smallest distance + between the data points. Only applicable for styles 'bar' and 'bar-color'. @@ -547,14 +579,18 @@ var options = { xMax number - none - The maximum value for the x-axis. + from data + The maximum value for the x-axis. + If not set, the largest value for x in the data set is used. + xMin number - none - The minimum value for the x-axis. + from data + The minimum value for the x-axis. + If not set, the smallest value for x in the data set is used. + xStep @@ -575,8 +611,8 @@ var options = { yBarWidth number none - The width of bars in y direction. By default, the width is equal to the distance - between the data points, such that bars adjoin each other. + The width of bars in y direction. By default, the width is equal to the smallest distance + between the data points. Only applicable for styles 'bar' and 'bar-color'. @@ -590,14 +626,18 @@ var options = { yMax number - none - The maximum value for the y-axis. + from data + The maximum value for the y-axis. + If not set, the largest value for y in the data set is used. + yMin number - none - The minimum value for the y-axis. + from data + The minimum value for the y-axis. + If not set, the smallest value for y in the data set is used. + yStep @@ -615,16 +655,20 @@ var options = { - zMin + zMax number - none - The minimum value for the z-axis. + from data + The maximum value for the z-axis. + If not set, the largest value for z in the data set is used. + - zMax + zMin number - none - The maximum value for the z-axis. + from data + The minimum value for the z-axis. + If not set, the smallest value for z in the data set is used. + zStep diff --git a/docs/timeline/index.html b/docs/timeline/index.html index 7ec093ae..3bcd44fe 100644 --- a/docs/timeline/index.html +++ b/docs/timeline/index.html @@ -357,7 +357,7 @@ var items = new vis.DataSet([ editable.updateTime boolean no - If true, items can be dragged to another moment int time. See section Editing Items for a detailed explanation. + If true, items can be dragged to another moment in time. See section Editing Items for a detailed explanation. @@ -468,10 +468,10 @@ var groups = [ Array of group ids nested in the group. Nested groups will appear under this nesting group. - showNestedGroups + showNested Boolean no - Assuming the group has nested groups, this will set the initial state of the group - shown or collapsed. The showNestedGroups is defaulted to true. + Assuming the group has nested groups, this will set the initial state of the group - shown or collapsed. The showNested is defaulted to true. @@ -1044,7 +1044,7 @@ function (option, path) { template function none - A template function used to generate the contents of the items. The function is called by the Timeline with an items' data as the first argument and the item element as the second, and must return HTML code, a string or a template as result. When the option template is specified, the items do not need to have a field content. See section Templates for a detailed explanation. + A template function used to generate the contents of the items. The function is called by the Timeline with an items' data as the first argument, the item element as the second argument and the edited data as the third argument, and must return HTML code, a string or a template as result. When the option template is specified, the items do not need to have a field content. See section Templates for a detailed explanation. @@ -1439,15 +1439,21 @@ document.getElementById('myTimeline').onclick = function (event) { - zoomIn(percentage) + zoomIn(percentage [, options]) none - Zoom in the current visible window. The parameter percentage can be a Number and must be between 0 and 1. If the parameter value of percentage is null, the window will be left unchanged. + Zoom in the current visible window. The parameter percentage can be a Number and must be between 0 and 1. If the parameter value of percentage is null, the window will be left unchanged. Available options: + - zoomOut(percentage) + zoomOut(percentage [, options]) none - Zoom out the current visible window. The parameter percentage can be a Number and must be between 0 and 1. If the parameter value of percentage is null, the window will be left unchanged. + Zoom out the current visible window. The parameter percentage can be a Number and must be between 0 and 1. If the parameter value of percentage is null, the window will be left unchanged. Available options: + @@ -1698,6 +1704,14 @@ var items = new vis.DataSet([ ]); +

+ Individual manipulation actions (updateTime, updateGroup and remove) can also be set on individual items. If any of the item-level + actions are specified (and overrideItems is not false) then that takes precedence over the settings at the timeline level. Current behavior is + that if any of the item-level actions are not specified, those items get undefined value (rather than inheriting from the timeline level). This may change + in future major releases, and code that specifies all item level values will handle major release changes better. That is, instead of using + editable: {updateTime : true}, use editable: {updateTime : true, updateGroup: false, remove: false}. +

+

One can specify callback functions to validate changes made by the user. There are a number of callback functions for this purpose:

@@ -1743,11 +1757,11 @@ var items = new vis.DataSet([

Templates

- Timeline supports templates to format item contents. Any template engine (such as handlebars or mustache) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an item's data as argument, and outputs formatted HTML: + Timeline supports templates to format item contents. Any template engine (such as handlebars or mustache) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an item's data as the first argument, the item element as the second argument and the edited data as the third argument, and outputs formatted HTML:

var options = {
-  template: function (item) {
+  template: function (item, element, data) {
     var html = ... // generate HTML markup for this item
     return html;
   }
@@ -1759,8 +1773,11 @@ var items = new vis.DataSet([
   The HTML for an item can be created manually:
 
 
var options = {
-  template: function (item) {
-    return '<h1>' + item.header + '</h1><p>' + item.description + '</p>';
+  template: function (item, element, data) {
+    return '<h1>' + item.header + data.moving?' '+ data.start:'' + '</h1><p>' + item.description + '</p>';
+  },
+  onMoving: function (item, callback) {
+    item.moving = true;
   }
 };
 
@@ -1795,7 +1812,7 @@ var template = Handlebars.compile(source); You can use a React component for the templates by rendering them to the templates' element directly:
-  template: function (item, element) {
+  template: function (item, element, data) {
     return ReactDOM.render(<b>{item.content}</b>, element);
   },
 
@@ -1814,7 +1831,7 @@ var templates = { }; var options = { - template: function (item) { + template: function (item, element, data) { var template = templates[item.template]; // choose the right template return template(item); // execute the template } diff --git a/examples/graph2d/21_barsWithEnd.html b/examples/graph2d/21_barsWithEnd.html new file mode 100644 index 00000000..c5d131ff --- /dev/null +++ b/examples/graph2d/21_barsWithEnd.html @@ -0,0 +1,51 @@ + + + + Graph2d | Bar Graph Example + + + + + + + +

Graph2d | Bar Graph With End Example

+
+ This example shows how you can plot a bar chart and supply an end value to have it fill. +
+
+ +
+ + + + \ No newline at end of file diff --git a/examples/graph3d/11_tooltips.html b/examples/graph3d/11_tooltips.html index 67d84443..d2821071 100644 --- a/examples/graph3d/11_tooltips.html +++ b/examples/graph3d/11_tooltips.html @@ -64,12 +64,26 @@ showShadow: false, // Option tooltip can be true, false, or a function returning a string with HTML contents - //tooltip: true, tooltip: function (point) { // parameter point contains properties x, y, z, and data // data is the original object passed to the point constructor return 'value: ' + point.z + '
' + point.data.extra; }, + + // Tooltip default styling can be overridden + tooltipStyle: { + content: { + background : 'rgba(255, 255, 255, 0.7)', + padding : '10px', + borderRadius : '10px' + }, + line: { + borderLeft : '1px dotted rgba(0, 0, 0, 0.5)' + }, + dot: { + border : '5px solid rgba(0, 0, 0, 0.5)' + } + }, keepAspectRatio: true, verticalRatio: 0.5 diff --git a/examples/network/layout/demo.jsonp b/examples/network/layout/demo.jsonp new file mode 100644 index 00000000..727db6fc --- /dev/null +++ b/examples/network/layout/demo.jsonp @@ -0,0 +1,1894 @@ +p( { + "nodes": [ + { + "level": 0, + "id": "0", + "label": "0" + }, + { + "level": 1, + "id": "1", + "label": "1" + }, + { + "level": 2, + "id": "2", + "label": "2" + }, + { + "level": 3, + "id": "3", + "label": "3" + }, + { + "level": 4, + "id": "4", + "label": "4" + }, + { + "level": 5, + "id": "5", + "label": "5" + }, + { + "level": 6, + "id": "6", + "label": "6" + }, + { + "level": 7, + "id": "7", + "label": "7" + }, + { + "level": 8, + "id": "8", + "label": "8" + }, + { + "level": 0, + "id": "9", + "label": "9" + }, + { + "level": 9, + "id": "10", + "label": "10" + }, + { + "level": 10, + "id": "11", + "label": "11" + }, + { + "level": 11, + "id": "12", + "label": "12" + }, + { + "level": 12, + "id": "13", + "label": "13" + }, + { + "level": 13, + "id": "14", + "label": "14" + }, + { + "level": 13, + "id": "15", + "label": "15" + }, + { + "level": 14, + "id": "16", + "label": "16" + }, + { + "level": 15, + "id": "17", + "label": "17" + }, + { + "level": 16, + "id": "18", + "label": "18" + }, + { + "level": 17, + "id": "19", + "label": "19" + }, + { + "level": 18, + "id": "20", + "label": "20" + }, + { + "level": 19, + "id": "21", + "label": "21" + }, + { + "level": 20, + "id": "22", + "label": "22" + }, + { + "level": 21, + "id": "23", + "label": "23" + }, + { + "level": 22, + "id": "24", + "label": "24" + }, + { + "level": 23, + "id": "25", + "label": "25" + }, + { + "level": 24, + "id": "26", + "label": "26" + }, + { + "level": 25, + "id": "27", + "label": "27" + }, + { + "level": 26, + "id": "28", + "label": "28" + }, + { + "level": 27, + "id": "29", + "label": "29" + }, + { + "level": 28, + "id": "30", + "label": "30" + }, + { + "level": 29, + "id": "31", + "label": "31" + }, + { + "level": 30, + "id": "32", + "label": "32" + }, + { + "level": 31, + "id": "33", + "label": "33" + }, + { + "level": 32, + "id": "34", + "label": "34" + }, + { + "level": 32, + "id": "35", + "label": "35" + }, + { + "level": 33, + "id": "36", + "label": "36" + }, + { + "level": 32, + "id": "37", + "label": "37" + }, + { + "level": 34, + "id": "38", + "label": "38" + }, + { + "level": 35, + "id": "39", + "label": "39" + }, + { + "level": 36, + "id": "40", + "label": "40" + }, + { + "level": 37, + "id": "41", + "label": "41" + }, + { + "level": 38, + "id": "42", + "label": "42" + }, + { + "level": 33, + "id": "43", + "label": "43" + }, + { + "level": 39, + "id": "44", + "label": "44" + }, + { + "level": 40, + "id": "45", + "label": "45" + }, + { + "level": 41, + "id": "46", + "label": "46" + }, + { + "level": 42, + "id": "47", + "label": "47" + }, + { + "level": 43, + "id": "48", + "label": "48" + }, + { + "level": 44, + "id": "49", + "label": "49" + }, + { + "level": 45, + "id": "50", + "label": "50" + }, + { + "level": 46, + "id": "51", + "label": "51" + }, + { + "level": 47, + "id": "52", + "label": "52" + }, + { + "level": 48, + "id": "53", + "label": "53" + }, + { + "level": 49, + "id": "54", + "label": "54" + }, + { + "level": 50, + "id": "55", + "label": "55" + }, + { + "level": 51, + "id": "56", + "label": "56" + }, + { + "level": 52, + "id": "57", + "label": "57" + }, + { + "level": 53, + "id": "58", + "label": "58" + }, + { + "level": 54, + "id": "59", + "label": "59" + }, + { + "level": 55, + "id": "60", + "label": "60" + }, + { + "level": 56, + "id": "61", + "label": "61" + }, + { + "level": 57, + "id": "62", + "label": "62" + }, + { + "level": 58, + "id": "63", + "label": "63" + }, + { + "level": 59, + "id": "64", + "label": "64" + }, + { + "level": 55, + "id": "65", + "label": "65" + }, + { + "level": 60, + "id": "66", + "label": "66" + }, + { + "level": 61, + "id": "67", + "label": "67" + }, + { + "level": 62, + "id": "68", + "label": "68" + }, + { + "level": 63, + "id": "69", + "label": "69" + }, + { + "level": 64, + "id": "70", + "label": "70" + }, + { + "level": 65, + "id": "71", + "label": "71" + }, + { + "level": 66, + "id": "72", + "label": "72" + }, + { + "level": 67, + "id": "73", + "label": "73" + }, + { + "level": 68, + "id": "74", + "label": "74" + }, + { + "level": 69, + "id": "75", + "label": "75" + }, + { + "level": 70, + "id": "76", + "label": "76" + }, + { + "level": 71, + "id": "77", + "label": "77" + }, + { + "level": 72, + "id": "78", + "label": "78" + }, + { + "level": 73, + "id": "79", + "label": "79" + }, + { + "level": 74, + "id": "80", + "label": "80" + }, + { + "level": 75, + "id": "81", + "label": "81" + }, + { + "level": 76, + "id": "82", + "label": "82" + }, + { + "level": 77, + "id": "83", + "label": "83" + }, + { + "level": 78, + "id": "84", + "label": "84" + }, + { + "level": 79, + "id": "85", + "label": "85" + }, + { + "level": 80, + "id": "86", + "label": "86" + }, + { + "level": 81, + "id": "87", + "label": "87" + }, + { + "level": 82, + "id": "88", + "label": "88" + }, + { + "level": 83, + "id": "89", + "label": "89" + }, + { + "level": 84, + "id": "90", + "label": "90" + }, + { + "level": 80, + "id": "91", + "label": "91" + }, + { + "level": 85, + "id": "92", + "label": "92" + }, + { + "level": 86, + "id": "93", + "label": "93" + }, + { + "level": 87, + "id": "94", + "label": "94" + }, + { + "level": 88, + "id": "95", + "label": "95" + }, + { + "level": 89, + "id": "96", + "label": "96" + }, + { + "level": 90, + "id": "97", + "label": "97" + }, + { + "level": 91, + "id": "98", + "label": "98" + }, + { + "level": 92, + "id": "99", + "label": "99" + }, + { + "level": 93, + "id": "100", + "label": "100" + }, + { + "level": 94, + "id": "101", + "label": "101" + }, + { + "level": 95, + "id": "102", + "label": "102" + }, + { + "level": 96, + "id": "103", + "label": "103" + }, + { + "level": 97, + "id": "104", + "label": "104" + }, + { + "level": 98, + "id": "105", + "label": "105" + }, + { + "level": 99, + "id": "106", + "label": "106" + }, + { + "level": 100, + "id": "107", + "label": "107" + }, + { + "level": 101, + "id": "108", + "label": "108" + }, + { + "level": 102, + "id": "109", + "label": "109" + }, + { + "level": 103, + "id": "110", + "label": "110" + }, + { + "level": 104, + "id": "111", + "label": "111" + }, + { + "level": 105, + "id": "112", + "label": "112" + }, + { + "level": 106, + "id": "113", + "label": "113" + }, + { + "level": 107, + "id": "114", + "label": "114" + }, + { + "level": 108, + "id": "115", + "label": "115" + }, + { + "level": 109, + "id": "116", + "label": "116" + }, + { + "level": 110, + "id": "117", + "label": "117" + }, + { + "level": 111, + "id": "118", + "label": "118" + }, + { + "level": 112, + "id": "119", + "label": "119" + }, + { + "level": 113, + "id": "120", + "label": "120" + }, + { + "level": 114, + "id": "121", + "label": "121" + }, + { + "level": 115, + "id": "122", + "label": "122" + }, + { + "level": 116, + "id": "123", + "label": "123" + }, + { + "level": 117, + "id": "124", + "label": "124" + }, + { + "level": 118, + "id": "125", + "label": "125" + }, + { + "level": 119, + "id": "126", + "label": "126" + }, + { + "level": 120, + "id": "127", + "label": "127" + }, + { + "level": 121, + "id": "128", + "label": "128" + }, + { + "level": 122, + "id": "129", + "label": "129" + }, + { + "level": 123, + "id": "130", + "label": "130" + }, + { + "level": 124, + "id": "131", + "label": "131" + }, + { + "level": 125, + "id": "132", + "label": "132" + }, + { + "level": 126, + "id": "133", + "label": "133" + }, + { + "level": 126, + "id": "134", + "label": "134" + }, + { + "level": 127, + "id": "135", + "label": "135" + }, + { + "level": 128, + "id": "136", + "label": "136" + }, + { + "level": 129, + "id": "137", + "label": "137" + }, + { + "level": 130, + "id": "138", + "label": "138" + }, + { + "level": 131, + "id": "139", + "label": "139" + }, + { + "level": 131, + "id": "140", + "label": "140" + }, + { + "level": 132, + "id": "141", + "label": "141" + }, + { + "level": 133, + "id": "142", + "label": "142" + }, + { + "level": 134, + "id": "143", + "label": "143" + }, + { + "level": 135, + "id": "144", + "label": "144" + }, + { + "level": 136, + "id": "145", + "label": "145" + }, + { + "level": 137, + "id": "146", + "label": "146" + }, + { + "level": 138, + "id": "147", + "label": "147" + }, + { + "level": 139, + "id": "148", + "label": "148" + }, + { + "level": 140, + "id": "149", + "label": "149" + }, + { + "level": 141, + "id": "150", + "label": "150" + }, + { + "level": 142, + "id": "151", + "label": "151" + }, + { + "level": 143, + "id": "152", + "label": "152" + }, + { + "level": 144, + "id": "153", + "label": "153" + }, + { + "level": 145, + "id": "154", + "label": "154" + }, + { + "level": 146, + "id": "155", + "label": "155" + }, + { + "level": 147, + "id": "156", + "label": "156" + }, + { + "level": 147, + "id": "157", + "label": "157" + }, + { + "level": 148, + "id": "158", + "label": "158" + }, + { + "level": 149, + "id": "159", + "label": "159" + }, + { + "level": 150, + "id": "160", + "label": "160" + }, + { + "level": 151, + "id": "161", + "label": "161" + }, + { + "level": 150, + "id": "162", + "label": "162" + }, + { + "level": 152, + "id": "163", + "label": "163" + }, + { + "level": 151, + "id": "164", + "label": "164" + }, + { + "level": 153, + "id": "165", + "label": "165" + }, + { + "level": 154, + "id": "166", + "label": "166" + }, + { + "level": 155, + "id": "167", + "label": "167" + }, + { + "level": 156, + "id": "168", + "label": "168" + }, + { + "level": 157, + "id": "169", + "label": "169" + }, + { + "level": 157, + "id": "170", + "label": "170" + }, + { + "level": 158, + "id": "171", + "label": "171" + }, + { + "level": 159, + "id": "172", + "label": "172" + }, + { + "level": 160, + "id": "173", + "label": "173" + }, + { + "level": 161, + "id": "174", + "label": "174" + }, + { + "level": 162, + "id": "175", + "label": "175" + }, + { + "level": 163, + "id": "176", + "label": "176" + }, + { + "level": 164, + "id": "177", + "label": "177" + }, + { + "level": 165, + "id": "178", + "label": "178" + }, + { + "level": 166, + "id": "179", + "label": "179" + }, + { + "level": 166, + "id": "180", + "label": "180" + }, + { + "level": 167, + "id": "181", + "label": "181" + }, + { + "level": 168, + "id": "182", + "label": "182" + }, + { + "level": 168, + "id": "183", + "label": "183" + }, + { + "level": 169, + "id": "184", + "label": "184" + }, + { + "level": 170, + "id": "185", + "label": "185" + }, + { + "level": 170, + "id": "186", + "label": "186" + }, + { + "level": 171, + "id": "187", + "label": "187" + }, + { + "level": 172, + "id": "188", + "label": "188" + }, + { + "level": 172, + "id": "189", + "label": "189" + }, + { + "level": 173, + "id": "190", + "label": "190" + }, + { + "level": 174, + "id": "191", + "label": "191" + }, + { + "level": 175, + "id": "192", + "label": "192" + }, + { + "level": 176, + "id": "193", + "label": "193" + }, + { + "level": 177, + "id": "194", + "label": "194" + }, + { + "level": 178, + "id": "195", + "label": "195" + }, + { + "level": 179, + "id": "196", + "label": "196" + }, + { + "level": 179, + "id": "197", + "label": "197" + }, + { + "level": 180, + "id": "198", + "label": "198" + }, + { + "level": 181, + "id": "199", + "label": "199" + } + ], + "edges": [ + { + "to": "0", + "from": "1" + }, + { + "to": "1", + "from": "2" + }, + { + "to": "2", + "from": "3" + }, + { + "to": "3", + "from": "4" + }, + { + "to": "4", + "from": "5" + }, + { + "to": "5", + "from": "6" + }, + { + "to": "6", + "from": "7" + }, + { + "to": "7", + "from": "8" + }, + { + "to": "8", + "from": "10" + }, + { + "to": "9", + "from": "11" + }, + { + "to": "10", + "from": "11" + }, + { + "to": "11", + "from": "12" + }, + { + "to": "12", + "from": "13" + }, + { + "to": "13", + "from": "15" + }, + { + "to": "13", + "from": "14" + }, + { + "to": "14", + "from": "16" + }, + { + "to": "15", + "from": "16" + }, + { + "to": "16", + "from": "17" + }, + { + "to": "17", + "from": "18" + }, + { + "to": "18", + "from": "19" + }, + { + "to": "19", + "from": "20" + }, + { + "to": "20", + "from": "21" + }, + { + "to": "21", + "from": "22" + }, + { + "to": "22", + "from": "23" + }, + { + "to": "23", + "from": "24" + }, + { + "to": "24", + "from": "25" + }, + { + "to": "25", + "from": "26" + }, + { + "to": "26", + "from": "27" + }, + { + "to": "27", + "from": "28" + }, + { + "to": "28", + "from": "29" + }, + { + "to": "29", + "from": "30" + }, + { + "to": "30", + "from": "31" + }, + { + "to": "31", + "from": "32" + }, + { + "to": "32", + "from": "33" + }, + { + "to": "33", + "from": "34" + }, + { + "to": "33", + "from": "35" + }, + { + "to": "33", + "from": "37" + }, + { + "to": "34", + "from": "36" + }, + { + "to": "34", + "from": "43" + }, + { + "to": "35", + "from": "36" + }, + { + "to": "35", + "from": "43" + }, + { + "to": "36", + "from": "38" + }, + { + "to": "37", + "from": "39" + }, + { + "to": "37", + "from": "43" + }, + { + "to": "38", + "from": "39" + }, + { + "to": "39", + "from": "40" + }, + { + "to": "40", + "from": "41" + }, + { + "to": "41", + "from": "42" + }, + { + "to": "42", + "from": "44" + }, + { + "to": "43", + "from": "45" + }, + { + "to": "44", + "from": "45" + }, + { + "to": "45", + "from": "46" + }, + { + "to": "46", + "from": "47" + }, + { + "to": "47", + "from": "48" + }, + { + "to": "48", + "from": "49" + }, + { + "to": "49", + "from": "50" + }, + { + "to": "50", + "from": "51" + }, + { + "to": "51", + "from": "52" + }, + { + "to": "52", + "from": "53" + }, + { + "to": "53", + "from": "54" + }, + { + "to": "54", + "from": "55" + }, + { + "to": "55", + "from": "56" + }, + { + "to": "56", + "from": "57" + }, + { + "to": "57", + "from": "58" + }, + { + "to": "58", + "from": "59" + }, + { + "to": "59", + "from": "60" + }, + { + "to": "59", + "from": "65" + }, + { + "to": "60", + "from": "61" + }, + { + "to": "61", + "from": "62" + }, + { + "to": "62", + "from": "63" + }, + { + "to": "63", + "from": "64" + }, + { + "to": "64", + "from": "66" + }, + { + "to": "65", + "from": "67" + }, + { + "to": "65", + "from": "124" + }, + { + "to": "66", + "from": "67" + }, + { + "to": "67", + "from": "68" + }, + { + "to": "68", + "from": "69" + }, + { + "to": "69", + "from": "70" + }, + { + "to": "70", + "from": "71" + }, + { + "to": "71", + "from": "72" + }, + { + "to": "72", + "from": "73" + }, + { + "to": "73", + "from": "74" + }, + { + "to": "74", + "from": "75" + }, + { + "to": "75", + "from": "76" + }, + { + "to": "76", + "from": "77" + }, + { + "to": "77", + "from": "78" + }, + { + "to": "78", + "from": "79" + }, + { + "to": "79", + "from": "80" + }, + { + "to": "80", + "from": "81" + }, + { + "to": "81", + "from": "82" + }, + { + "to": "82", + "from": "83" + }, + { + "to": "83", + "from": "84" + }, + { + "to": "84", + "from": "85" + }, + { + "to": "85", + "from": "91" + }, + { + "to": "85", + "from": "86" + }, + { + "to": "86", + "from": "87" + }, + { + "to": "87", + "from": "88" + }, + { + "to": "88", + "from": "89" + }, + { + "to": "89", + "from": "90" + }, + { + "to": "90", + "from": "92" + }, + { + "to": "91", + "from": "195" + }, + { + "to": "91", + "from": "93" + }, + { + "to": "91", + "from": "125" + }, + { + "to": "92", + "from": "93" + }, + { + "to": "93", + "from": "94" + }, + { + "to": "94", + "from": "95" + }, + { + "to": "95", + "from": "96" + }, + { + "to": "96", + "from": "97" + }, + { + "to": "97", + "from": "98" + }, + { + "to": "98", + "from": "99" + }, + { + "to": "99", + "from": "100" + }, + { + "to": "100", + "from": "101" + }, + { + "to": "101", + "from": "102" + }, + { + "to": "102", + "from": "103" + }, + { + "to": "103", + "from": "104" + }, + { + "to": "104", + "from": "105" + }, + { + "to": "105", + "from": "106" + }, + { + "to": "106", + "from": "107" + }, + { + "to": "107", + "from": "108" + }, + { + "to": "108", + "from": "109" + }, + { + "to": "109", + "from": "110" + }, + { + "to": "110", + "from": "111" + }, + { + "to": "111", + "from": "112" + }, + { + "to": "112", + "from": "113" + }, + { + "to": "113", + "from": "114" + }, + { + "to": "114", + "from": "115" + }, + { + "to": "115", + "from": "116" + }, + { + "to": "116", + "from": "117" + }, + { + "to": "117", + "from": "118" + }, + { + "to": "118", + "from": "119" + }, + { + "to": "119", + "from": "120" + }, + { + "to": "120", + "from": "121" + }, + { + "to": "121", + "from": "122" + }, + { + "to": "122", + "from": "123" + }, + { + "to": "123", + "from": "124" + }, + { + "to": "124", + "from": "125" + }, + { + "to": "125", + "from": "126" + }, + { + "to": "126", + "from": "127" + }, + { + "to": "127", + "from": "128" + }, + { + "to": "128", + "from": "129" + }, + { + "to": "129", + "from": "130" + }, + { + "to": "130", + "from": "131" + }, + { + "to": "131", + "from": "132" + }, + { + "to": "132", + "from": "134" + }, + { + "to": "132", + "from": "133" + }, + { + "to": "133", + "from": "135" + }, + { + "to": "134", + "from": "135" + }, + { + "to": "135", + "from": "136" + }, + { + "to": "136", + "from": "137" + }, + { + "to": "137", + "from": "138" + }, + { + "to": "138", + "from": "139" + }, + { + "to": "138", + "from": "140" + }, + { + "to": "139", + "from": "141" + }, + { + "to": "140", + "from": "141" + }, + { + "to": "141", + "from": "142" + }, + { + "to": "142", + "from": "143" + }, + { + "to": "143", + "from": "144" + }, + { + "to": "144", + "from": "145" + }, + { + "to": "145", + "from": "146" + }, + { + "to": "146", + "from": "147" + }, + { + "to": "147", + "from": "148" + }, + { + "to": "148", + "from": "149" + }, + { + "to": "149", + "from": "150" + }, + { + "to": "150", + "from": "151" + }, + { + "to": "151", + "from": "152" + }, + { + "to": "152", + "from": "153" + }, + { + "to": "153", + "from": "154" + }, + { + "to": "154", + "from": "155" + }, + { + "to": "155", + "from": "157" + }, + { + "to": "155", + "from": "156" + }, + { + "to": "156", + "from": "158" + }, + { + "to": "157", + "from": "158" + }, + { + "to": "158", + "from": "159" + }, + { + "to": "159", + "from": "162" + }, + { + "to": "159", + "from": "160" + }, + { + "to": "160", + "from": "164" + }, + { + "to": "160", + "from": "161" + }, + { + "to": "161", + "from": "163" + }, + { + "to": "162", + "from": "164" + }, + { + "to": "163", + "from": "165" + }, + { + "to": "164", + "from": "166" + }, + { + "to": "165", + "from": "166" + }, + { + "to": "166", + "from": "167" + }, + { + "to": "167", + "from": "168" + }, + { + "to": "168", + "from": "170" + }, + { + "to": "168", + "from": "169" + }, + { + "to": "169", + "from": "171" + }, + { + "to": "170", + "from": "171" + }, + { + "to": "171", + "from": "172" + }, + { + "to": "172", + "from": "173" + }, + { + "to": "173", + "from": "174" + }, + { + "to": "174", + "from": "175" + }, + { + "to": "175", + "from": "176" + }, + { + "to": "176", + "from": "177" + }, + { + "to": "177", + "from": "178" + }, + { + "to": "178", + "from": "180" + }, + { + "to": "178", + "from": "179" + }, + { + "to": "179", + "from": "181" + }, + { + "to": "180", + "from": "181" + }, + { + "to": "181", + "from": "183" + }, + { + "to": "181", + "from": "182" + }, + { + "to": "182", + "from": "184" + }, + { + "to": "183", + "from": "184" + }, + { + "to": "184", + "from": "186" + }, + { + "to": "184", + "from": "185" + }, + { + "to": "185", + "from": "187" + }, + { + "to": "186", + "from": "189" + }, + { + "to": "186", + "from": "188" + }, + { + "to": "187", + "from": "188" + }, + { + "to": "187", + "from": "189" + }, + { + "to": "188", + "from": "190" + }, + { + "to": "189", + "from": "191" + }, + { + "to": "190", + "from": "191" + }, + { + "to": "191", + "from": "192" + }, + { + "to": "192", + "from": "193" + }, + { + "to": "193", + "from": "194" + }, + { + "to": "194", + "from": "195" + }, + { + "to": "195", + "from": "197" + }, + { + "to": "195", + "from": "196" + }, + { + "to": "196", + "from": "198" + }, + { + "to": "197", + "from": "198" + }, + { + "to": "198", + "from": "199" + } + ] +} ); diff --git a/examples/network/layout/demo_big.jsonp b/examples/network/layout/demo_big.jsonp new file mode 100644 index 00000000..e9f2c0b9 --- /dev/null +++ b/examples/network/layout/demo_big.jsonp @@ -0,0 +1,3762 @@ +p( { + "nodes": [ + { + "level": 0, + "id": "0", + "label": "0" + }, + { + "level": 1, + "id": "1", + "label": "1" + }, + { + "level": 2, + "id": "2", + "label": "2" + }, + { + "level": 3, + "id": "3", + "label": "3" + }, + { + "level": 4, + "id": "4", + "label": "4" + }, + { + "level": 5, + "id": "5", + "label": "5" + }, + { + "level": 6, + "id": "6", + "label": "6" + }, + { + "level": 7, + "id": "7", + "label": "7" + }, + { + "level": 8, + "id": "8", + "label": "8" + }, + { + "level": 0, + "id": "9", + "label": "9" + }, + { + "level": 9, + "id": "10", + "label": "10" + }, + { + "level": 10, + "id": "11", + "label": "11" + }, + { + "level": 11, + "id": "12", + "label": "12" + }, + { + "level": 12, + "id": "13", + "label": "13" + }, + { + "level": 13, + "id": "14", + "label": "14" + }, + { + "level": 13, + "id": "15", + "label": "15" + }, + { + "level": 14, + "id": "16", + "label": "16" + }, + { + "level": 15, + "id": "17", + "label": "17" + }, + { + "level": 16, + "id": "18", + "label": "18" + }, + { + "level": 17, + "id": "19", + "label": "19" + }, + { + "level": 18, + "id": "20", + "label": "20" + }, + { + "level": 19, + "id": "21", + "label": "21" + }, + { + "level": 20, + "id": "22", + "label": "22" + }, + { + "level": 21, + "id": "23", + "label": "23" + }, + { + "level": 22, + "id": "24", + "label": "24" + }, + { + "level": 23, + "id": "25", + "label": "25" + }, + { + "level": 24, + "id": "26", + "label": "26" + }, + { + "level": 25, + "id": "27", + "label": "27" + }, + { + "level": 26, + "id": "28", + "label": "28" + }, + { + "level": 27, + "id": "29", + "label": "29" + }, + { + "level": 28, + "id": "30", + "label": "30" + }, + { + "level": 29, + "id": "31", + "label": "31" + }, + { + "level": 30, + "id": "32", + "label": "32" + }, + { + "level": 31, + "id": "33", + "label": "33" + }, + { + "level": 32, + "id": "34", + "label": "34" + }, + { + "level": 32, + "id": "35", + "label": "35" + }, + { + "level": 33, + "id": "36", + "label": "36" + }, + { + "level": 32, + "id": "37", + "label": "37" + }, + { + "level": 34, + "id": "38", + "label": "38" + }, + { + "level": 35, + "id": "39", + "label": "39" + }, + { + "level": 36, + "id": "40", + "label": "40" + }, + { + "level": 37, + "id": "41", + "label": "41" + }, + { + "level": 38, + "id": "42", + "label": "42" + }, + { + "level": 33, + "id": "43", + "label": "43" + }, + { + "level": 39, + "id": "44", + "label": "44" + }, + { + "level": 40, + "id": "45", + "label": "45" + }, + { + "level": 41, + "id": "46", + "label": "46" + }, + { + "level": 42, + "id": "47", + "label": "47" + }, + { + "level": 43, + "id": "48", + "label": "48" + }, + { + "level": 44, + "id": "49", + "label": "49" + }, + { + "level": 45, + "id": "50", + "label": "50" + }, + { + "level": 46, + "id": "51", + "label": "51" + }, + { + "level": 47, + "id": "52", + "label": "52" + }, + { + "level": 48, + "id": "53", + "label": "53" + }, + { + "level": 49, + "id": "54", + "label": "54" + }, + { + "level": 50, + "id": "55", + "label": "55" + }, + { + "level": 51, + "id": "56", + "label": "56" + }, + { + "level": 52, + "id": "57", + "label": "57" + }, + { + "level": 53, + "id": "58", + "label": "58" + }, + { + "level": 54, + "id": "59", + "label": "59" + }, + { + "level": 55, + "id": "60", + "label": "60" + }, + { + "level": 56, + "id": "61", + "label": "61" + }, + { + "level": 57, + "id": "62", + "label": "62" + }, + { + "level": 58, + "id": "63", + "label": "63" + }, + { + "level": 59, + "id": "64", + "label": "64" + }, + { + "level": 55, + "id": "65", + "label": "65" + }, + { + "level": 60, + "id": "66", + "label": "66" + }, + { + "level": 61, + "id": "67", + "label": "67" + }, + { + "level": 62, + "id": "68", + "label": "68" + }, + { + "level": 63, + "id": "69", + "label": "69" + }, + { + "level": 64, + "id": "70", + "label": "70" + }, + { + "level": 65, + "id": "71", + "label": "71" + }, + { + "level": 66, + "id": "72", + "label": "72" + }, + { + "level": 67, + "id": "73", + "label": "73" + }, + { + "level": 68, + "id": "74", + "label": "74" + }, + { + "level": 69, + "id": "75", + "label": "75" + }, + { + "level": 70, + "id": "76", + "label": "76" + }, + { + "level": 71, + "id": "77", + "label": "77" + }, + { + "level": 72, + "id": "78", + "label": "78" + }, + { + "level": 73, + "id": "79", + "label": "79" + }, + { + "level": 74, + "id": "80", + "label": "80" + }, + { + "level": 75, + "id": "81", + "label": "81" + }, + { + "level": 76, + "id": "82", + "label": "82" + }, + { + "level": 77, + "id": "83", + "label": "83" + }, + { + "level": 78, + "id": "84", + "label": "84" + }, + { + "level": 79, + "id": "85", + "label": "85" + }, + { + "level": 80, + "id": "86", + "label": "86" + }, + { + "level": 81, + "id": "87", + "label": "87" + }, + { + "level": 82, + "id": "88", + "label": "88" + }, + { + "level": 83, + "id": "89", + "label": "89" + }, + { + "level": 84, + "id": "90", + "label": "90" + }, + { + "level": 80, + "id": "91", + "label": "91" + }, + { + "level": 85, + "id": "92", + "label": "92" + }, + { + "level": 86, + "id": "93", + "label": "93" + }, + { + "level": 87, + "id": "94", + "label": "94" + }, + { + "level": 88, + "id": "95", + "label": "95" + }, + { + "level": 89, + "id": "96", + "label": "96" + }, + { + "level": 90, + "id": "97", + "label": "97" + }, + { + "level": 91, + "id": "98", + "label": "98" + }, + { + "level": 92, + "id": "99", + "label": "99" + }, + { + "level": 93, + "id": "100", + "label": "100" + }, + { + "level": 94, + "id": "101", + "label": "101" + }, + { + "level": 95, + "id": "102", + "label": "102" + }, + { + "level": 96, + "id": "103", + "label": "103" + }, + { + "level": 97, + "id": "104", + "label": "104" + }, + { + "level": 98, + "id": "105", + "label": "105" + }, + { + "level": 99, + "id": "106", + "label": "106" + }, + { + "level": 100, + "id": "107", + "label": "107" + }, + { + "level": 101, + "id": "108", + "label": "108" + }, + { + "level": 102, + "id": "109", + "label": "109" + }, + { + "level": 103, + "id": "110", + "label": "110" + }, + { + "level": 104, + "id": "111", + "label": "111" + }, + { + "level": 105, + "id": "112", + "label": "112" + }, + { + "level": 106, + "id": "113", + "label": "113" + }, + { + "level": 107, + "id": "114", + "label": "114" + }, + { + "level": 108, + "id": "115", + "label": "115" + }, + { + "level": 109, + "id": "116", + "label": "116" + }, + { + "level": 110, + "id": "117", + "label": "117" + }, + { + "level": 111, + "id": "118", + "label": "118" + }, + { + "level": 112, + "id": "119", + "label": "119" + }, + { + "level": 113, + "id": "120", + "label": "120" + }, + { + "level": 114, + "id": "121", + "label": "121" + }, + { + "level": 115, + "id": "122", + "label": "122" + }, + { + "level": 116, + "id": "123", + "label": "123" + }, + { + "level": 117, + "id": "124", + "label": "124" + }, + { + "level": 118, + "id": "125", + "label": "125" + }, + { + "level": 119, + "id": "126", + "label": "126" + }, + { + "level": 120, + "id": "127", + "label": "127" + }, + { + "level": 121, + "id": "128", + "label": "128" + }, + { + "level": 122, + "id": "129", + "label": "129" + }, + { + "level": 123, + "id": "130", + "label": "130" + }, + { + "level": 124, + "id": "131", + "label": "131" + }, + { + "level": 125, + "id": "132", + "label": "132" + }, + { + "level": 126, + "id": "133", + "label": "133" + }, + { + "level": 126, + "id": "134", + "label": "134" + }, + { + "level": 127, + "id": "135", + "label": "135" + }, + { + "level": 128, + "id": "136", + "label": "136" + }, + { + "level": 129, + "id": "137", + "label": "137" + }, + { + "level": 130, + "id": "138", + "label": "138" + }, + { + "level": 131, + "id": "139", + "label": "139" + }, + { + "level": 131, + "id": "140", + "label": "140" + }, + { + "level": 132, + "id": "141", + "label": "141" + }, + { + "level": 133, + "id": "142", + "label": "142" + }, + { + "level": 134, + "id": "143", + "label": "143" + }, + { + "level": 135, + "id": "144", + "label": "144" + }, + { + "level": 136, + "id": "145", + "label": "145" + }, + { + "level": 137, + "id": "146", + "label": "146" + }, + { + "level": 138, + "id": "147", + "label": "147" + }, + { + "level": 139, + "id": "148", + "label": "148" + }, + { + "level": 140, + "id": "149", + "label": "149" + }, + { + "level": 141, + "id": "150", + "label": "150" + }, + { + "level": 142, + "id": "151", + "label": "151" + }, + { + "level": 143, + "id": "152", + "label": "152" + }, + { + "level": 144, + "id": "153", + "label": "153" + }, + { + "level": 145, + "id": "154", + "label": "154" + }, + { + "level": 146, + "id": "155", + "label": "155" + }, + { + "level": 147, + "id": "156", + "label": "156" + }, + { + "level": 147, + "id": "157", + "label": "157" + }, + { + "level": 148, + "id": "158", + "label": "158" + }, + { + "level": 149, + "id": "159", + "label": "159" + }, + { + "level": 150, + "id": "160", + "label": "160" + }, + { + "level": 151, + "id": "161", + "label": "161" + }, + { + "level": 150, + "id": "162", + "label": "162" + }, + { + "level": 152, + "id": "163", + "label": "163" + }, + { + "level": 151, + "id": "164", + "label": "164" + }, + { + "level": 153, + "id": "165", + "label": "165" + }, + { + "level": 154, + "id": "166", + "label": "166" + }, + { + "level": 155, + "id": "167", + "label": "167" + }, + { + "level": 156, + "id": "168", + "label": "168" + }, + { + "level": 157, + "id": "169", + "label": "169" + }, + { + "level": 157, + "id": "170", + "label": "170" + }, + { + "level": 158, + "id": "171", + "label": "171" + }, + { + "level": 159, + "id": "172", + "label": "172" + }, + { + "level": 160, + "id": "173", + "label": "173" + }, + { + "level": 161, + "id": "174", + "label": "174" + }, + { + "level": 162, + "id": "175", + "label": "175" + }, + { + "level": 163, + "id": "176", + "label": "176" + }, + { + "level": 164, + "id": "177", + "label": "177" + }, + { + "level": 165, + "id": "178", + "label": "178" + }, + { + "level": 166, + "id": "179", + "label": "179" + }, + { + "level": 166, + "id": "180", + "label": "180" + }, + { + "level": 167, + "id": "181", + "label": "181" + }, + { + "level": 168, + "id": "182", + "label": "182" + }, + { + "level": 168, + "id": "183", + "label": "183" + }, + { + "level": 169, + "id": "184", + "label": "184" + }, + { + "level": 170, + "id": "185", + "label": "185" + }, + { + "level": 170, + "id": "186", + "label": "186" + }, + { + "level": 171, + "id": "187", + "label": "187" + }, + { + "level": 172, + "id": "188", + "label": "188" + }, + { + "level": 172, + "id": "189", + "label": "189" + }, + { + "level": 173, + "id": "190", + "label": "190" + }, + { + "level": 174, + "id": "191", + "label": "191" + }, + { + "level": 175, + "id": "192", + "label": "192" + }, + { + "level": 176, + "id": "193", + "label": "193" + }, + { + "level": 177, + "id": "194", + "label": "194" + }, + { + "level": 178, + "id": "195", + "label": "195" + }, + { + "level": 179, + "id": "196", + "label": "196" + }, + { + "level": 179, + "id": "197", + "label": "197" + }, + { + "level": 180, + "id": "198", + "label": "198" + }, + { + "level": 181, + "id": "199", + "label": "199" + }, + { + "level": 182, + "id": "200", + "label": "200" + }, + { + "level": 183, + "id": "201", + "label": "201" + }, + { + "level": 184, + "id": "202", + "label": "202" + }, + { + "level": 185, + "id": "203", + "label": "203" + }, + { + "level": 186, + "id": "204", + "label": "204" + }, + { + "level": 187, + "id": "205", + "label": "205" + }, + { + "level": 188, + "id": "206", + "label": "206" + }, + { + "level": 189, + "id": "207", + "label": "207" + }, + { + "level": 190, + "id": "208", + "label": "208" + }, + { + "level": 191, + "id": "209", + "label": "209" + }, + { + "level": 192, + "id": "210", + "label": "210" + }, + { + "level": 193, + "id": "211", + "label": "211" + }, + { + "level": 194, + "id": "212", + "label": "212" + }, + { + "level": 195, + "id": "213", + "label": "213" + }, + { + "level": 196, + "id": "214", + "label": "214" + }, + { + "level": 197, + "id": "215", + "label": "215" + }, + { + "level": 198, + "id": "216", + "label": "216" + }, + { + "level": 199, + "id": "217", + "label": "217" + }, + { + "level": 200, + "id": "218", + "label": "218" + }, + { + "level": 201, + "id": "219", + "label": "219" + }, + { + "level": 202, + "id": "220", + "label": "220" + }, + { + "level": 203, + "id": "221", + "label": "221" + }, + { + "level": 204, + "id": "222", + "label": "222" + }, + { + "level": 205, + "id": "223", + "label": "223" + }, + { + "level": 206, + "id": "224", + "label": "224" + }, + { + "level": 207, + "id": "225", + "label": "225" + }, + { + "level": 208, + "id": "226", + "label": "226" + }, + { + "level": 209, + "id": "227", + "label": "227" + }, + { + "level": 210, + "id": "228", + "label": "228" + }, + { + "level": 211, + "id": "229", + "label": "229" + }, + { + "level": 212, + "id": "230", + "label": "230" + }, + { + "level": 213, + "id": "231", + "label": "231" + }, + { + "level": 214, + "id": "232", + "label": "232" + }, + { + "level": 215, + "id": "233", + "label": "233" + }, + { + "level": 216, + "id": "234", + "label": "234" + }, + { + "level": 217, + "id": "235", + "label": "235" + }, + { + "level": 218, + "id": "236", + "label": "236" + }, + { + "level": 219, + "id": "237", + "label": "237" + }, + { + "level": 220, + "id": "238", + "label": "238" + }, + { + "level": 221, + "id": "239", + "label": "239" + }, + { + "level": 222, + "id": "240", + "label": "240" + }, + { + "level": 223, + "id": "241", + "label": "241" + }, + { + "level": 212, + "id": "242", + "label": "242" + }, + { + "level": 213, + "id": "243", + "label": "243" + }, + { + "level": 214, + "id": "244", + "label": "244" + }, + { + "level": 215, + "id": "245", + "label": "245" + }, + { + "level": 215, + "id": "246", + "label": "246" + }, + { + "level": 216, + "id": "247", + "label": "247" + }, + { + "level": 217, + "id": "248", + "label": "248" + }, + { + "level": 218, + "id": "249", + "label": "249" + }, + { + "level": 219, + "id": "250", + "label": "250" + }, + { + "level": 220, + "id": "251", + "label": "251" + }, + { + "level": 221, + "id": "252", + "label": "252" + }, + { + "level": 222, + "id": "253", + "label": "253" + }, + { + "level": 223, + "id": "254", + "label": "254" + }, + { + "level": 223, + "id": "255", + "label": "255" + }, + { + "level": 224, + "id": "256", + "label": "256" + }, + { + "level": 225, + "id": "257", + "label": "257" + }, + { + "level": 226, + "id": "258", + "label": "258" + }, + { + "level": 227, + "id": "259", + "label": "259" + }, + { + "level": 228, + "id": "260", + "label": "260" + }, + { + "level": 229, + "id": "261", + "label": "261" + }, + { + "level": 230, + "id": "262", + "label": "262" + }, + { + "level": 231, + "id": "263", + "label": "263" + }, + { + "level": 232, + "id": "264", + "label": "264" + }, + { + "level": 233, + "id": "265", + "label": "265" + }, + { + "level": 234, + "id": "266", + "label": "266" + }, + { + "level": 235, + "id": "267", + "label": "267" + }, + { + "level": 234, + "id": "268", + "label": "268" + }, + { + "level": 236, + "id": "269", + "label": "269" + }, + { + "level": 237, + "id": "270", + "label": "270" + }, + { + "level": 238, + "id": "271", + "label": "271" + }, + { + "level": 239, + "id": "272", + "label": "272" + }, + { + "level": 240, + "id": "273", + "label": "273" + }, + { + "level": 241, + "id": "274", + "label": "274" + }, + { + "level": 242, + "id": "275", + "label": "275" + }, + { + "level": 243, + "id": "276", + "label": "276" + }, + { + "level": 244, + "id": "277", + "label": "277" + }, + { + "level": 245, + "id": "278", + "label": "278" + }, + { + "level": 246, + "id": "279", + "label": "279" + }, + { + "level": 246, + "id": "280", + "label": "280" + }, + { + "level": 247, + "id": "281", + "label": "281" + }, + { + "level": 247, + "id": "282", + "label": "282" + }, + { + "level": 248, + "id": "283", + "label": "283" + }, + { + "level": 248, + "id": "284", + "label": "284" + }, + { + "level": 249, + "id": "285", + "label": "285" + }, + { + "level": 249, + "id": "286", + "label": "286" + }, + { + "level": 250, + "id": "287", + "label": "287" + }, + { + "level": 251, + "id": "288", + "label": "288" + }, + { + "level": 252, + "id": "289", + "label": "289" + }, + { + "level": 253, + "id": "290", + "label": "290" + }, + { + "level": 254, + "id": "291", + "label": "291" + }, + { + "level": 255, + "id": "292", + "label": "292" + }, + { + "level": 256, + "id": "293", + "label": "293" + }, + { + "level": 257, + "id": "294", + "label": "294" + }, + { + "level": 258, + "id": "295", + "label": "295" + }, + { + "level": 259, + "id": "296", + "label": "296" + }, + { + "level": 260, + "id": "297", + "label": "297" + }, + { + "level": 261, + "id": "298", + "label": "298" + }, + { + "level": 262, + "id": "299", + "label": "299" + }, + { + "level": 263, + "id": "300", + "label": "300" + }, + { + "level": 264, + "id": "301", + "label": "301" + }, + { + "level": 265, + "id": "302", + "label": "302" + }, + { + "level": 266, + "id": "303", + "label": "303" + }, + { + "level": 267, + "id": "304", + "label": "304" + }, + { + "level": 268, + "id": "305", + "label": "305" + }, + { + "level": 269, + "id": "306", + "label": "306" + }, + { + "level": 270, + "id": "307", + "label": "307" + }, + { + "level": 271, + "id": "308", + "label": "308" + }, + { + "level": 272, + "id": "309", + "label": "309" + }, + { + "level": 273, + "id": "310", + "label": "310" + }, + { + "level": 274, + "id": "311", + "label": "311" + }, + { + "level": 275, + "id": "312", + "label": "312" + }, + { + "level": 276, + "id": "313", + "label": "313" + }, + { + "level": 277, + "id": "314", + "label": "314" + }, + { + "level": 278, + "id": "315", + "label": "315" + }, + { + "level": 279, + "id": "316", + "label": "316" + }, + { + "level": 280, + "id": "317", + "label": "317" + }, + { + "level": 280, + "id": "318", + "label": "318" + }, + { + "level": 281, + "id": "319", + "label": "319" + }, + { + "level": 282, + "id": "320", + "label": "320" + }, + { + "level": 283, + "id": "321", + "label": "321" + }, + { + "level": 284, + "id": "322", + "label": "322" + }, + { + "level": 285, + "id": "323", + "label": "323" + }, + { + "level": 286, + "id": "324", + "label": "324" + }, + { + "level": 287, + "id": "325", + "label": "325" + }, + { + "level": 288, + "id": "326", + "label": "326" + }, + { + "level": 289, + "id": "327", + "label": "327" + }, + { + "level": 290, + "id": "328", + "label": "328" + }, + { + "level": 291, + "id": "329", + "label": "329" + }, + { + "level": 292, + "id": "330", + "label": "330" + }, + { + "level": 293, + "id": "331", + "label": "331" + }, + { + "level": 281, + "id": "332", + "label": "332" + }, + { + "level": 282, + "id": "333", + "label": "333" + }, + { + "level": 283, + "id": "334", + "label": "334" + }, + { + "level": 284, + "id": "335", + "label": "335" + }, + { + "level": 285, + "id": "336", + "label": "336" + }, + { + "level": 286, + "id": "337", + "label": "337" + }, + { + "level": 287, + "id": "338", + "label": "338" + }, + { + "level": 288, + "id": "339", + "label": "339" + }, + { + "level": 289, + "id": "340", + "label": "340" + }, + { + "level": 290, + "id": "341", + "label": "341" + }, + { + "level": 291, + "id": "342", + "label": "342" + }, + { + "level": 292, + "id": "343", + "label": "343" + }, + { + "level": 293, + "id": "344", + "label": "344" + }, + { + "level": 294, + "id": "345", + "label": "345" + }, + { + "level": 295, + "id": "346", + "label": "346" + }, + { + "level": 296, + "id": "347", + "label": "347" + }, + { + "level": 297, + "id": "348", + "label": "348" + }, + { + "level": 298, + "id": "349", + "label": "349" + }, + { + "level": 299, + "id": "350", + "label": "350" + }, + { + "level": 300, + "id": "351", + "label": "351" + }, + { + "level": 301, + "id": "352", + "label": "352" + }, + { + "level": 302, + "id": "353", + "label": "353" + }, + { + "level": 303, + "id": "354", + "label": "354" + }, + { + "level": 304, + "id": "355", + "label": "355" + }, + { + "level": 305, + "id": "356", + "label": "356" + }, + { + "level": 306, + "id": "357", + "label": "357" + }, + { + "level": 307, + "id": "358", + "label": "358" + }, + { + "level": 308, + "id": "359", + "label": "359" + }, + { + "level": 309, + "id": "360", + "label": "360" + }, + { + "level": 310, + "id": "361", + "label": "361" + }, + { + "level": 311, + "id": "362", + "label": "362" + }, + { + "level": 312, + "id": "363", + "label": "363" + }, + { + "level": 313, + "id": "364", + "label": "364" + }, + { + "level": 314, + "id": "365", + "label": "365" + }, + { + "level": 315, + "id": "366", + "label": "366" + }, + { + "level": 316, + "id": "367", + "label": "367" + }, + { + "level": 317, + "id": "368", + "label": "368" + }, + { + "level": 318, + "id": "369", + "label": "369" + }, + { + "level": 319, + "id": "370", + "label": "370" + }, + { + "level": 320, + "id": "371", + "label": "371" + }, + { + "level": 321, + "id": "372", + "label": "372" + }, + { + "level": 322, + "id": "373", + "label": "373" + }, + { + "level": 323, + "id": "374", + "label": "374" + }, + { + "level": 324, + "id": "375", + "label": "375" + }, + { + "level": 325, + "id": "376", + "label": "376" + }, + { + "level": 326, + "id": "377", + "label": "377" + }, + { + "level": 327, + "id": "378", + "label": "378" + }, + { + "level": 328, + "id": "379", + "label": "379" + }, + { + "level": 329, + "id": "380", + "label": "380" + }, + { + "level": 330, + "id": "381", + "label": "381" + }, + { + "level": 331, + "id": "382", + "label": "382" + }, + { + "level": 332, + "id": "383", + "label": "383" + }, + { + "level": 333, + "id": "384", + "label": "384" + }, + { + "level": 334, + "id": "385", + "label": "385" + }, + { + "level": 14, + "id": "386", + "label": "386" + }, + { + "level": 335, + "id": "387", + "label": "387" + }, + { + "level": 15, + "id": "388", + "label": "388" + }, + { + "level": 336, + "id": "389", + "label": "389" + }, + { + "level": 337, + "id": "390", + "label": "390" + }, + { + "level": 338, + "id": "391", + "label": "391" + }, + { + "level": 339, + "id": "392", + "label": "392" + }, + { + "level": 340, + "id": "393", + "label": "393" + }, + { + "level": 341, + "id": "394", + "label": "394" + }, + { + "level": 342, + "id": "395", + "label": "395" + }, + { + "level": 343, + "id": "396", + "label": "396" + }, + { + "level": 344, + "id": "397", + "label": "397" + }, + { + "level": 345, + "id": "398", + "label": "398" + }, + { + "level": 346, + "id": "399", + "label": "399" + } + ], + "edges": [ + { + "to": "0", + "from": "1" + }, + { + "to": "1", + "from": "2" + }, + { + "to": "2", + "from": "3" + }, + { + "to": "3", + "from": "4" + }, + { + "to": "4", + "from": "5" + }, + { + "to": "5", + "from": "6" + }, + { + "to": "6", + "from": "7" + }, + { + "to": "7", + "from": "8" + }, + { + "to": "8", + "from": "10" + }, + { + "to": "9", + "from": "11" + }, + { + "to": "10", + "from": "11" + }, + { + "to": "11", + "from": "12" + }, + { + "to": "12", + "from": "13" + }, + { + "to": "13", + "from": "15" + }, + { + "to": "13", + "from": "14" + }, + { + "to": "14", + "from": "386" + }, + { + "to": "14", + "from": "16" + }, + { + "to": "15", + "from": "386" + }, + { + "to": "15", + "from": "16" + }, + { + "to": "16", + "from": "17" + }, + { + "to": "17", + "from": "18" + }, + { + "to": "18", + "from": "19" + }, + { + "to": "19", + "from": "20" + }, + { + "to": "20", + "from": "21" + }, + { + "to": "21", + "from": "22" + }, + { + "to": "22", + "from": "23" + }, + { + "to": "23", + "from": "24" + }, + { + "to": "24", + "from": "25" + }, + { + "to": "25", + "from": "26" + }, + { + "to": "26", + "from": "27" + }, + { + "to": "27", + "from": "28" + }, + { + "to": "28", + "from": "29" + }, + { + "to": "29", + "from": "30" + }, + { + "to": "30", + "from": "31" + }, + { + "to": "31", + "from": "32" + }, + { + "to": "32", + "from": "33" + }, + { + "to": "33", + "from": "34" + }, + { + "to": "33", + "from": "35" + }, + { + "to": "33", + "from": "37" + }, + { + "to": "34", + "from": "36" + }, + { + "to": "34", + "from": "43" + }, + { + "to": "35", + "from": "36" + }, + { + "to": "35", + "from": "43" + }, + { + "to": "36", + "from": "38" + }, + { + "to": "37", + "from": "39" + }, + { + "to": "37", + "from": "43" + }, + { + "to": "38", + "from": "39" + }, + { + "to": "39", + "from": "40" + }, + { + "to": "40", + "from": "41" + }, + { + "to": "41", + "from": "42" + }, + { + "to": "42", + "from": "44" + }, + { + "to": "43", + "from": "45" + }, + { + "to": "44", + "from": "45" + }, + { + "to": "45", + "from": "46" + }, + { + "to": "46", + "from": "47" + }, + { + "to": "47", + "from": "48" + }, + { + "to": "48", + "from": "49" + }, + { + "to": "49", + "from": "50" + }, + { + "to": "50", + "from": "51" + }, + { + "to": "51", + "from": "52" + }, + { + "to": "52", + "from": "53" + }, + { + "to": "53", + "from": "54" + }, + { + "to": "54", + "from": "55" + }, + { + "to": "55", + "from": "56" + }, + { + "to": "56", + "from": "57" + }, + { + "to": "57", + "from": "58" + }, + { + "to": "58", + "from": "59" + }, + { + "to": "59", + "from": "60" + }, + { + "to": "59", + "from": "65" + }, + { + "to": "60", + "from": "61" + }, + { + "to": "61", + "from": "62" + }, + { + "to": "62", + "from": "63" + }, + { + "to": "63", + "from": "64" + }, + { + "to": "64", + "from": "66" + }, + { + "to": "65", + "from": "67" + }, + { + "to": "65", + "from": "124" + }, + { + "to": "65", + "from": "229" + }, + { + "to": "65", + "from": "322" + }, + { + "to": "65", + "from": "363" + }, + { + "to": "66", + "from": "67" + }, + { + "to": "67", + "from": "68" + }, + { + "to": "68", + "from": "69" + }, + { + "to": "69", + "from": "70" + }, + { + "to": "70", + "from": "71" + }, + { + "to": "71", + "from": "72" + }, + { + "to": "72", + "from": "73" + }, + { + "to": "73", + "from": "74" + }, + { + "to": "74", + "from": "75" + }, + { + "to": "75", + "from": "76" + }, + { + "to": "76", + "from": "77" + }, + { + "to": "77", + "from": "78" + }, + { + "to": "78", + "from": "79" + }, + { + "to": "79", + "from": "80" + }, + { + "to": "80", + "from": "81" + }, + { + "to": "81", + "from": "82" + }, + { + "to": "82", + "from": "83" + }, + { + "to": "83", + "from": "84" + }, + { + "to": "84", + "from": "85" + }, + { + "to": "85", + "from": "91" + }, + { + "to": "85", + "from": "86" + }, + { + "to": "86", + "from": "87" + }, + { + "to": "87", + "from": "88" + }, + { + "to": "88", + "from": "89" + }, + { + "to": "89", + "from": "90" + }, + { + "to": "90", + "from": "92" + }, + { + "to": "91", + "from": "195" + }, + { + "to": "91", + "from": "93" + }, + { + "to": "91", + "from": "397" + }, + { + "to": "91", + "from": "233" + }, + { + "to": "91", + "from": "125" + }, + { + "to": "92", + "from": "93" + }, + { + "to": "93", + "from": "94" + }, + { + "to": "94", + "from": "95" + }, + { + "to": "95", + "from": "96" + }, + { + "to": "96", + "from": "97" + }, + { + "to": "97", + "from": "98" + }, + { + "to": "98", + "from": "99" + }, + { + "to": "99", + "from": "100" + }, + { + "to": "100", + "from": "101" + }, + { + "to": "101", + "from": "102" + }, + { + "to": "102", + "from": "103" + }, + { + "to": "103", + "from": "104" + }, + { + "to": "104", + "from": "105" + }, + { + "to": "105", + "from": "106" + }, + { + "to": "106", + "from": "107" + }, + { + "to": "107", + "from": "108" + }, + { + "to": "108", + "from": "109" + }, + { + "to": "109", + "from": "110" + }, + { + "to": "110", + "from": "111" + }, + { + "to": "111", + "from": "112" + }, + { + "to": "112", + "from": "113" + }, + { + "to": "113", + "from": "114" + }, + { + "to": "114", + "from": "115" + }, + { + "to": "115", + "from": "116" + }, + { + "to": "116", + "from": "117" + }, + { + "to": "117", + "from": "118" + }, + { + "to": "118", + "from": "119" + }, + { + "to": "119", + "from": "120" + }, + { + "to": "120", + "from": "121" + }, + { + "to": "121", + "from": "122" + }, + { + "to": "122", + "from": "123" + }, + { + "to": "123", + "from": "124" + }, + { + "to": "124", + "from": "125" + }, + { + "to": "125", + "from": "126" + }, + { + "to": "126", + "from": "127" + }, + { + "to": "127", + "from": "128" + }, + { + "to": "128", + "from": "129" + }, + { + "to": "129", + "from": "130" + }, + { + "to": "130", + "from": "131" + }, + { + "to": "131", + "from": "132" + }, + { + "to": "132", + "from": "134" + }, + { + "to": "132", + "from": "133" + }, + { + "to": "133", + "from": "135" + }, + { + "to": "134", + "from": "135" + }, + { + "to": "135", + "from": "136" + }, + { + "to": "136", + "from": "137" + }, + { + "to": "137", + "from": "138" + }, + { + "to": "138", + "from": "139" + }, + { + "to": "138", + "from": "140" + }, + { + "to": "139", + "from": "141" + }, + { + "to": "140", + "from": "141" + }, + { + "to": "141", + "from": "142" + }, + { + "to": "142", + "from": "143" + }, + { + "to": "143", + "from": "144" + }, + { + "to": "144", + "from": "145" + }, + { + "to": "145", + "from": "146" + }, + { + "to": "146", + "from": "147" + }, + { + "to": "147", + "from": "148" + }, + { + "to": "148", + "from": "149" + }, + { + "to": "149", + "from": "150" + }, + { + "to": "150", + "from": "151" + }, + { + "to": "151", + "from": "152" + }, + { + "to": "152", + "from": "153" + }, + { + "to": "153", + "from": "154" + }, + { + "to": "154", + "from": "155" + }, + { + "to": "155", + "from": "157" + }, + { + "to": "155", + "from": "156" + }, + { + "to": "156", + "from": "158" + }, + { + "to": "157", + "from": "158" + }, + { + "to": "158", + "from": "159" + }, + { + "to": "159", + "from": "162" + }, + { + "to": "159", + "from": "160" + }, + { + "to": "160", + "from": "164" + }, + { + "to": "160", + "from": "161" + }, + { + "to": "161", + "from": "163" + }, + { + "to": "162", + "from": "164" + }, + { + "to": "163", + "from": "165" + }, + { + "to": "164", + "from": "166" + }, + { + "to": "165", + "from": "166" + }, + { + "to": "166", + "from": "167" + }, + { + "to": "167", + "from": "168" + }, + { + "to": "168", + "from": "170" + }, + { + "to": "168", + "from": "169" + }, + { + "to": "169", + "from": "171" + }, + { + "to": "170", + "from": "171" + }, + { + "to": "171", + "from": "172" + }, + { + "to": "172", + "from": "173" + }, + { + "to": "173", + "from": "174" + }, + { + "to": "174", + "from": "175" + }, + { + "to": "175", + "from": "176" + }, + { + "to": "176", + "from": "177" + }, + { + "to": "177", + "from": "178" + }, + { + "to": "178", + "from": "180" + }, + { + "to": "178", + "from": "179" + }, + { + "to": "179", + "from": "181" + }, + { + "to": "180", + "from": "181" + }, + { + "to": "181", + "from": "183" + }, + { + "to": "181", + "from": "182" + }, + { + "to": "182", + "from": "184" + }, + { + "to": "183", + "from": "184" + }, + { + "to": "184", + "from": "186" + }, + { + "to": "184", + "from": "185" + }, + { + "to": "185", + "from": "187" + }, + { + "to": "186", + "from": "189" + }, + { + "to": "186", + "from": "188" + }, + { + "to": "187", + "from": "188" + }, + { + "to": "187", + "from": "189" + }, + { + "to": "188", + "from": "190" + }, + { + "to": "189", + "from": "191" + }, + { + "to": "190", + "from": "191" + }, + { + "to": "191", + "from": "192" + }, + { + "to": "192", + "from": "193" + }, + { + "to": "193", + "from": "194" + }, + { + "to": "194", + "from": "195" + }, + { + "to": "195", + "from": "197" + }, + { + "to": "195", + "from": "196" + }, + { + "to": "196", + "from": "198" + }, + { + "to": "197", + "from": "198" + }, + { + "to": "198", + "from": "199" + }, + { + "to": "199", + "from": "200" + }, + { + "to": "200", + "from": "201" + }, + { + "to": "201", + "from": "202" + }, + { + "to": "202", + "from": "203" + }, + { + "to": "203", + "from": "204" + }, + { + "to": "204", + "from": "205" + }, + { + "to": "205", + "from": "206" + }, + { + "to": "206", + "from": "207" + }, + { + "to": "207", + "from": "208" + }, + { + "to": "208", + "from": "209" + }, + { + "to": "209", + "from": "210" + }, + { + "to": "210", + "from": "211" + }, + { + "to": "211", + "from": "212" + }, + { + "to": "212", + "from": "213" + }, + { + "to": "213", + "from": "214" + }, + { + "to": "214", + "from": "215" + }, + { + "to": "215", + "from": "216" + }, + { + "to": "216", + "from": "217" + }, + { + "to": "217", + "from": "218" + }, + { + "to": "218", + "from": "219" + }, + { + "to": "219", + "from": "220" + }, + { + "to": "220", + "from": "221" + }, + { + "to": "221", + "from": "222" + }, + { + "to": "222", + "from": "223" + }, + { + "to": "223", + "from": "224" + }, + { + "to": "224", + "from": "225" + }, + { + "to": "225", + "from": "226" + }, + { + "to": "226", + "from": "227" + }, + { + "to": "227", + "from": "228" + }, + { + "to": "228", + "from": "229" + }, + { + "to": "229", + "from": "230" + }, + { + "to": "229", + "from": "242" + }, + { + "to": "230", + "from": "231" + }, + { + "to": "231", + "from": "232" + }, + { + "to": "232", + "from": "233" + }, + { + "to": "233", + "from": "234" + }, + { + "to": "234", + "from": "235" + }, + { + "to": "235", + "from": "236" + }, + { + "to": "236", + "from": "237" + }, + { + "to": "237", + "from": "238" + }, + { + "to": "238", + "from": "239" + }, + { + "to": "239", + "from": "240" + }, + { + "to": "240", + "from": "241" + }, + { + "to": "242", + "from": "243" + }, + { + "to": "243", + "from": "244" + }, + { + "to": "244", + "from": "246" + }, + { + "to": "244", + "from": "245" + }, + { + "to": "245", + "from": "247" + }, + { + "to": "246", + "from": "247" + }, + { + "to": "247", + "from": "248" + }, + { + "to": "248", + "from": "249" + }, + { + "to": "249", + "from": "250" + }, + { + "to": "250", + "from": "251" + }, + { + "to": "251", + "from": "252" + }, + { + "to": "252", + "from": "253" + }, + { + "to": "253", + "from": "254" + }, + { + "to": "253", + "from": "255" + }, + { + "to": "254", + "from": "256" + }, + { + "to": "255", + "from": "256" + }, + { + "to": "256", + "from": "257" + }, + { + "to": "257", + "from": "258" + }, + { + "to": "258", + "from": "259" + }, + { + "to": "259", + "from": "260" + }, + { + "to": "260", + "from": "261" + }, + { + "to": "261", + "from": "262" + }, + { + "to": "262", + "from": "263" + }, + { + "to": "263", + "from": "264" + }, + { + "to": "264", + "from": "265" + }, + { + "to": "265", + "from": "268" + }, + { + "to": "265", + "from": "266" + }, + { + "to": "266", + "from": "267" + }, + { + "to": "267", + "from": "269" + }, + { + "to": "268", + "from": "269" + }, + { + "to": "269", + "from": "270" + }, + { + "to": "270", + "from": "271" + }, + { + "to": "271", + "from": "272" + }, + { + "to": "272", + "from": "273" + }, + { + "to": "273", + "from": "274" + }, + { + "to": "274", + "from": "275" + }, + { + "to": "275", + "from": "276" + }, + { + "to": "276", + "from": "277" + }, + { + "to": "277", + "from": "278" + }, + { + "to": "278", + "from": "280" + }, + { + "to": "278", + "from": "279" + }, + { + "to": "279", + "from": "282" + }, + { + "to": "280", + "from": "281" + }, + { + "to": "280", + "from": "282" + }, + { + "to": "281", + "from": "284" + }, + { + "to": "281", + "from": "283" + }, + { + "to": "282", + "from": "284" + }, + { + "to": "282", + "from": "283" + }, + { + "to": "283", + "from": "286" + }, + { + "to": "283", + "from": "285" + }, + { + "to": "284", + "from": "286" + }, + { + "to": "284", + "from": "285" + }, + { + "to": "285", + "from": "287" + }, + { + "to": "286", + "from": "287" + }, + { + "to": "287", + "from": "288" + }, + { + "to": "288", + "from": "289" + }, + { + "to": "289", + "from": "290" + }, + { + "to": "290", + "from": "291" + }, + { + "to": "291", + "from": "292" + }, + { + "to": "292", + "from": "293" + }, + { + "to": "293", + "from": "294" + }, + { + "to": "294", + "from": "295" + }, + { + "to": "295", + "from": "296" + }, + { + "to": "296", + "from": "297" + }, + { + "to": "297", + "from": "298" + }, + { + "to": "298", + "from": "299" + }, + { + "to": "299", + "from": "300" + }, + { + "to": "300", + "from": "301" + }, + { + "to": "301", + "from": "302" + }, + { + "to": "302", + "from": "303" + }, + { + "to": "303", + "from": "304" + }, + { + "to": "304", + "from": "305" + }, + { + "to": "305", + "from": "306" + }, + { + "to": "306", + "from": "307" + }, + { + "to": "307", + "from": "308" + }, + { + "to": "308", + "from": "309" + }, + { + "to": "309", + "from": "310" + }, + { + "to": "310", + "from": "311" + }, + { + "to": "311", + "from": "312" + }, + { + "to": "312", + "from": "313" + }, + { + "to": "313", + "from": "314" + }, + { + "to": "314", + "from": "315" + }, + { + "to": "315", + "from": "316" + }, + { + "to": "316", + "from": "317" + }, + { + "to": "316", + "from": "318" + }, + { + "to": "317", + "from": "332" + }, + { + "to": "317", + "from": "319" + }, + { + "to": "318", + "from": "319" + }, + { + "to": "319", + "from": "320" + }, + { + "to": "320", + "from": "321" + }, + { + "to": "321", + "from": "322" + }, + { + "to": "322", + "from": "323" + }, + { + "to": "323", + "from": "324" + }, + { + "to": "324", + "from": "325" + }, + { + "to": "325", + "from": "326" + }, + { + "to": "326", + "from": "327" + }, + { + "to": "327", + "from": "328" + }, + { + "to": "328", + "from": "329" + }, + { + "to": "329", + "from": "330" + }, + { + "to": "330", + "from": "331" + }, + { + "to": "332", + "from": "333" + }, + { + "to": "333", + "from": "334" + }, + { + "to": "334", + "from": "335" + }, + { + "to": "335", + "from": "336" + }, + { + "to": "336", + "from": "337" + }, + { + "to": "337", + "from": "338" + }, + { + "to": "338", + "from": "339" + }, + { + "to": "339", + "from": "340" + }, + { + "to": "340", + "from": "341" + }, + { + "to": "341", + "from": "342" + }, + { + "to": "342", + "from": "343" + }, + { + "to": "343", + "from": "344" + }, + { + "to": "344", + "from": "345" + }, + { + "to": "345", + "from": "346" + }, + { + "to": "346", + "from": "347" + }, + { + "to": "347", + "from": "348" + }, + { + "to": "348", + "from": "349" + }, + { + "to": "349", + "from": "350" + }, + { + "to": "350", + "from": "351" + }, + { + "to": "351", + "from": "352" + }, + { + "to": "352", + "from": "353" + }, + { + "to": "353", + "from": "354" + }, + { + "to": "354", + "from": "355" + }, + { + "to": "355", + "from": "356" + }, + { + "to": "356", + "from": "357" + }, + { + "to": "357", + "from": "358" + }, + { + "to": "358", + "from": "359" + }, + { + "to": "359", + "from": "360" + }, + { + "to": "360", + "from": "361" + }, + { + "to": "361", + "from": "362" + }, + { + "to": "362", + "from": "363" + }, + { + "to": "363", + "from": "364" + }, + { + "to": "364", + "from": "365" + }, + { + "to": "365", + "from": "366" + }, + { + "to": "366", + "from": "367" + }, + { + "to": "367", + "from": "368" + }, + { + "to": "368", + "from": "369" + }, + { + "to": "369", + "from": "370" + }, + { + "to": "370", + "from": "371" + }, + { + "to": "371", + "from": "372" + }, + { + "to": "372", + "from": "373" + }, + { + "to": "373", + "from": "374" + }, + { + "to": "374", + "from": "375" + }, + { + "to": "375", + "from": "376" + }, + { + "to": "376", + "from": "377" + }, + { + "to": "377", + "from": "378" + }, + { + "to": "378", + "from": "379" + }, + { + "to": "379", + "from": "380" + }, + { + "to": "380", + "from": "381" + }, + { + "to": "381", + "from": "382" + }, + { + "to": "382", + "from": "383" + }, + { + "to": "383", + "from": "384" + }, + { + "to": "384", + "from": "385" + }, + { + "to": "385", + "from": "387" + }, + { + "to": "386", + "from": "388" + }, + { + "to": "387", + "from": "389" + }, + { + "to": "388", + "from": "390" + }, + { + "to": "389", + "from": "390" + }, + { + "to": "390", + "from": "391" + }, + { + "to": "391", + "from": "392" + }, + { + "to": "392", + "from": "393" + }, + { + "to": "393", + "from": "394" + }, + { + "to": "394", + "from": "395" + }, + { + "to": "395", + "from": "396" + }, + { + "to": "396", + "from": "397" + }, + { + "to": "397", + "from": "398" + }, + { + "to": "398", + "from": "399" + } + ] +} ); diff --git a/examples/network/layout/hierarchicalLayoutBigUserDefined.html b/examples/network/layout/hierarchicalLayoutBigUserDefined.html new file mode 100644 index 00000000..a0ecd356 --- /dev/null +++ b/examples/network/layout/hierarchicalLayoutBigUserDefined.html @@ -0,0 +1,46 @@ + + + + Network | Hierarchical layout + + + + + + + + + + +

Hierarchical Layout

+ +
+ + + + + diff --git a/examples/timeline/dataHandling/dataSerialization.html b/examples/timeline/dataHandling/dataSerialization.html index e1936438..65e8d01b 100644 --- a/examples/timeline/dataHandling/dataSerialization.html +++ b/examples/timeline/dataHandling/dataSerialization.html @@ -35,12 +35,38 @@ diff --git a/examples/timeline/editing/individualEditableItems.html b/examples/timeline/editing/individualEditableItems.html index ef7f0987..095c1574 100644 --- a/examples/timeline/editing/individualEditableItems.html +++ b/examples/timeline/editing/individualEditableItems.html @@ -34,7 +34,7 @@
- \ No newline at end of file + diff --git a/examples/timeline/editing/tooltipOnItemChange.html b/examples/timeline/editing/tooltipOnItemChange.html index dd72fb79..fbdcb33b 100644 --- a/examples/timeline/editing/tooltipOnItemChange.html +++ b/examples/timeline/editing/tooltipOnItemChange.html @@ -2,6 +2,7 @@ Timeline | Tooltip on item onUpdateTime Option + @@ -63,20 +64,20 @@ editable: true }; - var options1 = Object.assign({ + var options1 = jQuery.extend(options, { tooltipOnItemUpdateTime: true - }, options) + }) var container1 = document.getElementById('mytimeline1'); timeline1 = new vis.Timeline(container1, items, null, options1); - var options2 = Object.assign({ + var options2 = jQuery.extend(options, { orientation: 'top', tooltipOnItemUpdateTime: { template: function(item) { return 'html template for tooltip with item.start: ' + item.start; } } - }, options) + }) var container2 = document.getElementById('mytimeline2'); timeline2 = new vis.Timeline(container2, items, null, options2); @@ -117,10 +118,10 @@ } - var options3 = Object.assign({ + var options3 = jQuery.extend(options, { orientation: 'top', tooltipOnItemUpdateTime: true - }, options) + }) var container3 = document.getElementById('mytimeline3'); timeline3 = new vis.Timeline(container3, itemsWithGroups, groups, options3); diff --git a/examples/timeline/groups/subgroups.html b/examples/timeline/groups/subgroups.html index da2670ed..4647d191 100644 --- a/examples/timeline/groups/subgroups.html +++ b/examples/timeline/groups/subgroups.html @@ -51,7 +51,7 @@ {id: 'SG_1_1',start: '2014-01-25', end: '2014-01-27', type: 'background', group:'bar', subgroup:'sg_1', subgroupOrder:0}, {id: 'SG_1_2', start: '2014-01-26', end: '2014-01-27', type: 'background', className: 'positive',group:'bar', subgroup:'sg_1', subgroupOrder:0}, - {id: 1, content: 'subgroup0', start: '2014-01-23 12:00:00', end: '2014-01-26 12:00:00',group:'bar', subgroup:'sg_1', subgroupOrder:0}, + {id: 1, content: 'subgroup0', start: '2014-01-23T12:00:00', end: '2014-01-26T12:00:00',group:'bar', subgroup:'sg_1', subgroupOrder:0}, {id: 'SG_2_1', start: '2014-01-27', end: '2014-01-29', type: 'background', group:'bar', subgroup:'sg_2', subgroupOrder:1}, {id: 'SG_2_2', start: '2014-01-27', end: '2014-01-28', type: 'background', className: 'negative',group:'bar', subgroup:'sg_2', subgroupOrder:1}, {id: 2, content: 'subgroup1', start: '2014-01-27', end: '2014-01-29',group:'bar', subgroup:'sg_2', subgroupOrder:1}, @@ -78,4 +78,4 @@ } - \ No newline at end of file + diff --git a/examples/timeline/interaction/eventListeners.html b/examples/timeline/interaction/eventListeners.html index b88e846b..91bacfb0 100644 --- a/examples/timeline/interaction/eventListeners.html +++ b/examples/timeline/interaction/eventListeners.html @@ -41,9 +41,11 @@ timeline.on('rangechange', function (properties) { logEvent('rangechange', properties); }); + timeline.on('rangechanged', function (properties) { logEvent('rangechanged', properties); }); + timeline.on('select', function (properties) { logEvent('select', properties); }); @@ -52,6 +54,7 @@ logEvent('itemover', properties); setHoveredItem(properties.item); }); + timeline.on('itemout', function (properties) { logEvent('itemout', properties); setHoveredItem('none'); @@ -83,11 +86,23 @@ logEvent(event, properties); }); + function stringifyObject (object) { + if (!object) return; + var replacer = function(key, value) { + if (value && value.tagName) { + return "DOM Element"; + } else { + return value; + } + } + return JSON.stringify(object, replacer) + } + function logEvent(event, properties) { var log = document.getElementById('log'); var msg = document.createElement('div'); msg.innerHTML = 'event=' + JSON.stringify(event) + ', ' + - 'properties=' + JSON.stringify(properties); + 'properties=' + stringifyObject(properties); log.firstChild ? log.insertBefore(msg, log.firstChild) : log.appendChild(msg); } diff --git a/examples/timeline/items/expectedVsActualTimesItems.html b/examples/timeline/items/expectedVsActualTimesItems.html index 8ef427cc..eda66556 100644 --- a/examples/timeline/items/expectedVsActualTimesItems.html +++ b/examples/timeline/items/expectedVsActualTimesItems.html @@ -61,16 +61,16 @@ id: 1, content: 'item 1 (expected time)', className: 'expected', - start: '2014-01-23 12:00:00', - end: '2014-01-26 12:00:00', + start: '2014-01-23T12:00:00', + end: '2014-01-26T12:00:00', group:'group1', subgroup:'sg_1' }, { id: 2, content: 'item 1 (actual time)', - start: '2014-01-24 12:00:00', - end: '2014-01-27 12:00:00', + start: '2014-01-24T12:00:00', + end: '2014-01-27T12:00:00', group:'group1', subgroup:'sg_1' }, @@ -80,16 +80,16 @@ id: 3, content: 'item 2 (expected time)', className: 'expected', - start: '2014-01-13 12:00:00', - end: '2014-01-16 12:00:00', + start: '2014-01-13T12:00:00', + end: '2014-01-16T12:00:00', group:'group1', subgroup:'sg_2' }, { id: 4, content: 'item 2 (actual time)', - start: '2014-01-14 12:00:00', - end: '2014-01-17 12:00:00', + start: '2014-01-14T12:00:00', + end: '2014-01-17T12:00:00', group:'group1', subgroup:'sg_2' } @@ -108,4 +108,4 @@ - \ No newline at end of file + diff --git a/examples/timeline/items/visibleFrameTemplateContent.html b/examples/timeline/items/visibleFrameTemplateContent.html index 67715766..f01d57ed 100644 --- a/examples/timeline/items/visibleFrameTemplateContent.html +++ b/examples/timeline/items/visibleFrameTemplateContent.html @@ -45,18 +45,18 @@ {id: 1, value: 0.2, content: 'item 1', start: '2014-04-20', end: '2014-04-26'}, {id: 2, value: 0.6, content: 'item 2', start: '2014-05-14', end: '2014-05-18'}, {id: 3, type: 'point', content: 'item 3', start: '2014-04-15', end: '2014-05-18'}, - {id: 4, content: 'item 4 with visibleFramTemplate in item', start: '2014-04-16', end: '2014-04-26', visibleFramTemplate: '
' + {id: 4, content: 'item 4 with visibleFrameTemplate in item', start: '2014-04-16', end: '2014-04-26', visibleFrameTemplate: '
' } ]); // Configuration for the Timeline var options = { visibleFrameTemplate: function(item) { - if (item.visibleFramTemplate) { - return item.visibleFramTemplate; + if (item.visibleFrameTemplate) { + return item.visibleFrameTemplate; } var percentage = item.value * 100 + '%'; - return '
'; + return '
'; } }; diff --git a/examples/timeline/other/rtl.html b/examples/timeline/other/rtl.html index b6a33d8b..7939c51c 100644 --- a/examples/timeline/other/rtl.html +++ b/examples/timeline/other/rtl.html @@ -3,6 +3,7 @@ Timeline | RTL example + @@ -39,10 +40,10 @@ height: '300px', }; - var options1 = Object.assign({}, options) + var options1 = jQuery.extend(options, {}) var timeline1 = new vis.Timeline(container1, items, options1); - var options2 = Object.assign({rtl: true}, options) + var options2 = jQuery.extend(options, {rtl: true}) var timeline2 = new vis.Timeline(container2, items, options2); diff --git a/examples/timeline/other/verticalScroll.html b/examples/timeline/other/verticalScroll.html index 3ebec29b..1aebae6f 100644 --- a/examples/timeline/other/verticalScroll.html +++ b/examples/timeline/other/verticalScroll.html @@ -2,6 +2,7 @@ Timeline | Vertical Scroll Option + @@ -75,11 +76,11 @@ zoomKey: 'ctrlKey' // create a Timeline - options1 = Object.assign({}, options) + options1 = jQuery.extend(options, {}); var container1 = document.getElementById('mytimeline1'); timeline1 = new vis.Timeline(container1, items, groups, options1); - options2 = Object.assign({horizontalScroll: true}, options) + options2 = jQuery.extend(options, {horizontalScroll: true}); var container2 = document.getElementById('mytimeline2'); timeline2 = new vis.Timeline(container2, items, groups, options2); diff --git a/examples/timeline/resources/data/wk2014.json b/examples/timeline/resources/data/wk2014.json index 2bcb3d75..519169d3 100644 --- a/examples/timeline/resources/data/wk2014.json +++ b/examples/timeline/resources/data/wk2014.json @@ -7,7 +7,7 @@ "abbr2": "cl", "score2": "1 (2)", "description": "round of 16", - "start": "2014-06-28 13:00" + "start": "2014-06-28T13:00" }, { "player1": "Colombia", @@ -17,7 +17,7 @@ "abbr2": "uy", "score2": 0, "description": "round of 16", - "start": "2014-06-28 17:00" + "start": "2014-06-28T17:00" }, { "player1": "Netherlands", @@ -27,7 +27,7 @@ "abbr2": "mx", "score2": 1, "description": "round of 16", - "start": "2014-06-29 13:00" + "start": "2014-06-29T13:00" }, { "player1": "Costa Rica", @@ -37,7 +37,7 @@ "abbr2": "gr", "score2": "1 (3)", "description": "round of 16", - "start": "2014-06-29 17:00" + "start": "2014-06-29T17:00" }, { "player1": "France", @@ -47,7 +47,7 @@ "abbr2": "ng", "score2": 0, "description": "round of 16", - "start": "2014-06-30 13:00" + "start": "2014-06-30T13:00" }, { "player1": "Germany", @@ -57,7 +57,7 @@ "abbr2": "dz", "score2": 1, "description": "round of 16", - "start": "2014-06-30 17:00" + "start": "2014-06-30T17:00" }, { "player1": "Argentina", @@ -67,7 +67,7 @@ "abbr2": "ch", "score2": 0, "description": "round of 16", - "start": "2014-07-01 13:00" + "start": "2014-07-01T13:00" }, { "player1": "Belgium", @@ -77,7 +77,7 @@ "abbr2": "us", "score2": 1, "description": "round of 16", - "start": "2014-07-01 17:00" + "start": "2014-07-01T17:00" }, { "player1": "France", @@ -87,7 +87,7 @@ "abbr2": "de", "score2": 1, "description": "quarter-finals", - "start": "2014-07-04 13:00" + "start": "2014-07-04T13:00" }, { "player1": "Brazil", @@ -97,7 +97,7 @@ "abbr2": "co", "score2": 1, "description": "quarter-finals", - "start": "2014-07-04 17:00" + "start": "2014-07-04T17:00" }, { "player1": "Argentina", @@ -107,7 +107,7 @@ "abbr2": "be", "score2": 0, "description": "quarter-finals", - "start": "2014-07-05 13:00" + "start": "2014-07-05T13:00" }, { "player1": "Netherlands", @@ -117,7 +117,7 @@ "abbr2": "cr", "score2": "0 (3)", "description": "quarter-finals", - "start": "2014-07-05 17:00" + "start": "2014-07-05T17:00" }, { "player1": "Brazil", @@ -127,7 +127,7 @@ "abbr2": "de", "score2": 7, "description": "semi-finals", - "start": "2014-07-08 17:00" + "start": "2014-07-08T17:00" }, { "player1": "Netherlands", @@ -137,7 +137,7 @@ "abbr2": "ar", "score2": "0 (4)", "description": "semi-finals", - "start": "2014-07-09 17:00" + "start": "2014-07-09T17:00" }, { "player1": "Germany", @@ -147,6 +147,6 @@ "abbr2": "ar", "score2": 0, "description": "final", - "start": "2014-07-13 16:00" + "start": "2014-07-13T16:00" } -] \ No newline at end of file +] diff --git a/examples/timeline/styling/itemTemplates.html b/examples/timeline/styling/itemTemplates.html index 76900d2b..d7df592a 100644 --- a/examples/timeline/styling/itemTemplates.html +++ b/examples/timeline/styling/itemTemplates.html @@ -88,7 +88,7 @@ abbr2: 'cl', score2: '1 (2)', description: 'round of 16', - start: '2014-06-28 13:00' + start: '2014-06-28T13:00:00' }, { player1: 'Colombia', @@ -98,7 +98,7 @@ abbr2: 'uy', score2: 0, description: 'round of 16', - start: '2014-06-28 17:00' + start: '2014-06-28T17:00:00' }, { player1: 'Netherlands', @@ -108,7 +108,7 @@ abbr2: 'mx', score2: 1, description: 'round of 16', - start: '2014-06-29 13:00' + start: '2014-06-29T13:00:00' }, { player1: 'Costa Rica', @@ -118,7 +118,7 @@ abbr2: 'gr', score2: '1 (3)', description: 'round of 16', - start: '2014-06-29 17:00' + start: '2014-06-29T17:00:00' }, { player1: 'France', @@ -128,7 +128,7 @@ abbr2: 'ng', score2: 0, description: 'round of 16', - start: '2014-06-30 13:00' + start: '2014-06-30T13:00:00' }, { player1: 'Germany', @@ -138,7 +138,7 @@ abbr2: 'dz', score2: 1, description: 'round of 16', - start: '2014-06-30 17:00' + start: '2014-06-30T17:00:00' }, { player1: 'Argentina', @@ -148,7 +148,7 @@ abbr2: 'ch', score2: 0, description: 'round of 16', - start: '2014-07-01 13:00' + start: '2014-07-01T13:00:00' }, { player1: 'Belgium', @@ -158,7 +158,7 @@ abbr2: 'us', score2: 1, description: 'round of 16', - start: '2014-07-01 17:00' + start: '2014-07-01T17:00:00' }, // quarter-finals @@ -170,7 +170,7 @@ abbr2: 'de', score2: 1, description: 'quarter-finals', - start: '2014-07-04 13:00' + start: '2014-07-04T13:00:00' }, { player1: 'Brazil', @@ -180,7 +180,7 @@ abbr2: 'co', score2: 1, description: 'quarter-finals', - start: '2014-07-04 17:00' + start: '2014-07-04T17:00:00' }, { player1: 'Argentina', @@ -190,7 +190,7 @@ abbr2: 'be', score2: 0, description: 'quarter-finals', - start: '2014-07-05 13:00' + start: '2014-07-05T13:00:00' }, { player1: 'Netherlands', @@ -200,7 +200,7 @@ abbr2: 'cr', score2: '0 (3)', description: 'quarter-finals', - start: '2014-07-05 17:00' + start: '2014-07-05T17:00:00' }, // semi-finals @@ -212,7 +212,7 @@ abbr2: 'de', score2: 7, description: 'semi-finals', - start: '2014-07-08 17:00' + start: '2014-07-08T17:00:00' }, { player1: 'Netherlands', @@ -222,7 +222,7 @@ abbr2: 'ar', score2: '0 (4)', description: 'semi-finals', - start: '2014-07-09 17:00' + start: '2014-07-09T17:00:00' }, // final @@ -234,7 +234,7 @@ abbr2: 'ar', score2: 0, description: 'final', - start: '2014-07-13 16:00' + start: '2014-07-13T16:00:00' } ]); @@ -248,4 +248,4 @@ var timeline = new vis.Timeline(container, items, options); - \ No newline at end of file + diff --git a/lib/graph3d/Graph3d.js b/lib/graph3d/Graph3d.js index e355c9db..e24ed2e4 100755 --- a/lib/graph3d/Graph3d.js +++ b/lib/graph3d/Graph3d.js @@ -67,6 +67,29 @@ var DEFAULTS = { style : Graph3d.STYLE.DOT, tooltip : false, + + tooltipStyle : { + content : { + padding : '10px', + border : '1px solid #4d4d4d', + color : '#1a1a1a', + background : 'rgba(255,255,255,0.7)', + borderRadius : '2px', + boxShadow : '5px 5px 10px rgba(128,128,128,0.5)' + }, + line : { + height : '40px', + width : '0', + borderLeft : '1px solid #4d4d4d' + }, + dot : { + height : '0', + width : '0', + border : '5px solid #4d4d4d', + borderRadius : '5px' + } + }, + showLegend : autoByDefault, // determined by graph style backgroundColor : autoByDefault, @@ -327,7 +350,34 @@ Graph3d.prototype.getDistinctValues = function(data, column) { distinctValues.push(data[i][column]); } } - return distinctValues; + return distinctValues.sort(function(a,b) { return a - b; }); +} + + +/** + * Determine the smallest difference between the values for given + * column in the passed data set. + * + * @returns {Number|null} Smallest difference value or + * null, if it can't be determined. + */ +Graph3d.prototype.getSmallestDifference = function(data, column) { + var values = this.getDistinctValues(data, column); + var diffs = []; + + // Get all the distinct diffs + // Array values is assumed to be sorted here + var smallest_diff = null; + + for (var i = 1; i < values.length; i++) { + var diff = values[i] - values[i - 1]; + + if (smallest_diff == null || smallest_diff > diff ) { + smallest_diff = diff; + } + } + + return smallest_diff; } @@ -467,16 +517,14 @@ Graph3d.prototype._dataInitialize = function (rawData, style) { this.xBarWidth = this.defaultXBarWidth; } else { - var dataX = this.getDistinctValues(data,this.colX); - this.xBarWidth = (dataX[1] - dataX[0]) || 1; + this.xBarWidth = this.getSmallestDifference(data, this.colX) || 1; } if (this.defaultYBarWidth !== undefined) { this.yBarWidth = this.defaultYBarWidth; } else { - var dataY = this.getDistinctValues(data,this.colY); - this.yBarWidth = (dataY[1] - dataY[0]) || 1; + this.yBarWidth = this.getSmallestDifference(data, this.colY) || 1; } } @@ -2289,26 +2337,16 @@ Graph3d.prototype._showTooltip = function (dataPoint) { if (!this.tooltip) { content = document.createElement('div'); + Object.assign(content.style, {}, this.tooltipStyle.content); 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'); + Object.assign(line.style, {}, this.tooltipStyle.line); line.style.position = 'absolute'; - line.style.height = '40px'; - line.style.width = '0'; - line.style.borderLeft = '1px solid #4d4d4d'; dot = document.createElement('div'); + Object.assign(dot.style, {}, this.tooltipStyle.dot); 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, @@ -2449,4 +2487,4 @@ Graph3d.prototype.setSize = function(width, height) { // ----------------------------------------------------------------------------- -module.exports = Graph3d; \ No newline at end of file +module.exports = Graph3d; diff --git a/lib/graph3d/Settings.js b/lib/graph3d/Settings.js index 75566748..484a40b0 100755 --- a/lib/graph3d/Settings.js +++ b/lib/graph3d/Settings.js @@ -2,6 +2,7 @@ // This modules handles the options for Graph3d. // //////////////////////////////////////////////////////////////////////////////// +var util = require('../util'); var Camera = require('./Camera'); var Point3d = require('./Point3d'); @@ -69,7 +70,7 @@ var OPTIONKEYS = [ 'axisColor', 'gridColor', 'xCenter', - 'yCenter' + 'yCenter', ]; @@ -115,7 +116,6 @@ function isEmpty(obj) { } - /** * Make first letter of parameter upper case. * @@ -241,7 +241,6 @@ function setOptions(options, dst) { throw new Error('DEFAULTS not set for module Settings'); } - // Handle the parameters which can be simply copied over safeCopy(options, dst, OPTIONKEYS); safeCopy(options, dst, PREFIXEDOPTIONKEYS, 'default'); @@ -250,7 +249,6 @@ function setOptions(options, dst) { setSpecialSettings(options, dst); } - /** * Special handling for certain parameters * @@ -274,6 +272,10 @@ function setSpecialSettings(src, dst) { if (src.onclick != undefined) { dst.onclick_callback = src.onclick; } + + if (src.tooltipStyle !== undefined) { + util.selectiveDeepExtend(['tooltipStyle'], dst, src); + } } diff --git a/lib/network/modules/LayoutEngine.js b/lib/network/modules/LayoutEngine.js index 5d3454b4..09468955 100644 --- a/lib/network/modules/LayoutEngine.js +++ b/lib/network/modules/LayoutEngine.js @@ -441,6 +441,9 @@ class LayoutEngine { // get a map of all nodes in this branch let getBranchNodes = (source, map) => { + if (map[source.id]) { + return; + } map[source.id] = true; if (this.hierarchicalChildrenReference[source.id]) { let children = this.hierarchicalChildrenReference[source.id]; @@ -483,16 +486,24 @@ class LayoutEngine { // get the maximum level of a branch. let getMaxLevel = (nodeId) => { - let level = this.hierarchicalLevels[nodeId]; - if (this.hierarchicalChildrenReference[nodeId]) { - let children = this.hierarchicalChildrenReference[nodeId]; - if (children.length > 0) { - for (let i = 0; i < children.length; i++) { - level = Math.max(level,getMaxLevel(children[i])); + let accumulator = {}; + let _getMaxLevel = (nodeId) => { + if (accumulator[nodeId] !== undefined) { + return accumulator[nodeId]; + } + let level = this.hierarchicalLevels[nodeId]; + if (this.hierarchicalChildrenReference[nodeId]) { + let children = this.hierarchicalChildrenReference[nodeId]; + if (children.length > 0) { + for (let i = 0; i < children.length; i++) { + level = Math.max(level,_getMaxLevel(children[i])); + } } } - } - return level; + accumulator[nodeId] = level; + return level; + }; + return _getMaxLevel(nodeId); }; // check what the maximum level is these nodes have in common. @@ -544,8 +555,8 @@ class LayoutEngine { let diffAbs = Math.abs(pos2 - pos1); //console.log("NOW CHEcKING:", node1.id, node2.id, diffAbs); if (diffAbs > this.options.hierarchical.nodeSpacing) { - let branchNodes1 = {}; branchNodes1[node1.id] = true; - let branchNodes2 = {}; branchNodes2[node2.id] = true; + let branchNodes1 = {}; + let branchNodes2 = {}; getBranchNodes(node1, branchNodes1); getBranchNodes(node2, branchNodes2); @@ -651,7 +662,6 @@ class LayoutEngine { // check movable area of the branch if (branches[node.id] === undefined) { let branchNodes = {}; - branchNodes[node.id] = true; getBranchNodes(node, branchNodes); branches[node.id] = branchNodes; } @@ -1250,17 +1260,25 @@ class LayoutEngine { * @private */ _shiftBlock(parentId, diff) { - if (this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU') { - this.body.nodes[parentId].x += diff; - } - else { - this.body.nodes[parentId].y += diff; - } - if (this.hierarchicalChildrenReference[parentId] !== undefined) { - for (let i = 0; i < this.hierarchicalChildrenReference[parentId].length; i++) { - this._shiftBlock(this.hierarchicalChildrenReference[parentId][i], diff); + let progress = {}; + let shifter = (parentId) => { + if (progress[parentId]) { + return; } - } + progress[parentId] = true; + if (this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU') { + this.body.nodes[parentId].x += diff; + } + else { + this.body.nodes[parentId].y += diff; + } + if (this.hierarchicalChildrenReference[parentId] !== undefined) { + for (let i = 0; i < this.hierarchicalChildrenReference[parentId].length; i++) { + shifter(this.hierarchicalChildrenReference[parentId][i]); + } + } + }; + shifter(parentId); } diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js index 0d42edf5..8fbf0e97 100644 --- a/lib/timeline/Core.js +++ b/lib/timeline/Core.js @@ -245,6 +245,9 @@ Core.prototype._create = function (container) { } function handleDrop(event) { + // prevent redirect to blank page - Firefox + if(event.preventDefault) { event.preventDefault(); } + if(event.stopPropagation) { event.stopPropagation(); } // return when dropping non-vis items try { var itemData = JSON.parse(event.dataTransfer.getData("text")) @@ -708,8 +711,15 @@ Core.prototype.getWindow = function() { /** * Zoom in the window such that given time is centered on screen. * @param {Number} percentage - must be between [0..1] + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. */ -Core.prototype.zoomIn = function(percentage) { +Core.prototype.zoomIn = function(percentage, options) { if (!percentage || percentage < 0 || percentage > 1) return var range = this.getWindow(); var start = range.start.valueOf(); @@ -720,17 +730,21 @@ Core.prototype.zoomIn = function(percentage) { var newStart = start + distance; var newEnd = end - distance; - this.setWindow({ - start : newStart, - end : newEnd - }); + this.setWindow(newStart, newEnd, options); }; /** * Zoom out the window such that given time is centered on screen. * @param {Number} percentage - must be between [0..1] + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. */ -Core.prototype.zoomOut = function(percentage) { +Core.prototype.zoomOut = function(percentage, options) { if (!percentage || percentage < 0 || percentage > 1) return var range = this.getWindow(); var start = range.start.valueOf(); @@ -739,10 +753,7 @@ Core.prototype.zoomOut = function(percentage) { var newStart = start - interval * percentage / 2; var newEnd = end + interval * percentage / 2; - this.setWindow({ - start : newStart, - end : newEnd - }); + this.setWindow(newStart, newEnd, options); }; /** diff --git a/lib/timeline/Range.js b/lib/timeline/Range.js index 29fadd28..ced39db8 100644 --- a/lib/timeline/Range.js +++ b/lib/timeline/Range.js @@ -218,7 +218,7 @@ Range.prototype.setRange = function(start, end, animation, byUser, event) { start: new Date(me.start), end: new Date(me.end), byUser:byUser, - event: util.elementsCensor(event) + event: event } if (changed) { @@ -248,7 +248,7 @@ Range.prototype.setRange = function(start, end, animation, byUser, event) { start: new Date(this.start), end: new Date(this.end), byUser:byUser, - event: util.elementsCensor(event) + event: event }; this.body.emitter.emit('rangechange', params); this.body.emitter.emit('rangechanged', params); @@ -532,7 +532,7 @@ Range.prototype._onDrag = function (event) { start: startDate, end: endDate, byUser: true, - event: util.elementsCensor(event) + event: event }); // fire a panmove event @@ -565,7 +565,7 @@ Range.prototype._onDragEnd = function (event) { start: new Date(this.start), end: new Date(this.end), byUser: true, - event: util.elementsCensor(event) + event: event }); }; diff --git a/lib/timeline/TimeStep.js b/lib/timeline/TimeStep.js index 2ea1a4fa..d0f230f6 100644 --- a/lib/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -521,6 +521,9 @@ TimeStep.prototype.getLabelMinor = function(date) { if (date == undefined) { date = this.current; } + if (date instanceof Date) { + date = this.moment(date) + } if (typeof(this.format.minorLabels) === "function") { return this.format.minorLabels(date, this.scale, this.step); @@ -540,7 +543,10 @@ TimeStep.prototype.getLabelMajor = function(date) { if (date == undefined) { date = this.current; } - + if (date instanceof Date) { + date = this.moment(date) + } + if (typeof(this.format.majorLabels) === "function") { return this.format.majorLabels(date, this.scale, this.step); } diff --git a/lib/timeline/component/Group.js b/lib/timeline/component/Group.js index 883d8580..58920dfa 100644 --- a/lib/timeline/component/Group.js +++ b/lib/timeline/component/Group.js @@ -133,21 +133,34 @@ Group.prototype.setData = function(data) { } if (data && data.nestedGroups) { - if (data.showNested == false) { - this.showNested = false; - } else { - this.showNested = true; + if (!this.nestedGroups || this.nestedGroups != data.nestedGroups) { + this.nestedGroups = data.nestedGroups; + } + + if (data.showNested !== undefined || this.showNested === undefined) { + if (data.showNested == false) { + this.showNested = false; + } else { + this.showNested = true; + } } util.addClassName(this.dom.label, 'vis-nesting-group'); + var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed' if (this.showNested) { - util.removeClassName(this.dom.label, 'collapsed'); + util.removeClassName(this.dom.label, collapsedDirClassName); util.addClassName(this.dom.label, 'expanded'); } else { util.removeClassName(this.dom.label, 'expanded'); - var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed' util.addClassName(this.dom.label, collapsedDirClassName); } + } else if (this.nestedGroups) { + this.nestedGroups = null; + + var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed' + util.removeClassName(this.dom.label, collapsedDirClassName); + util.removeClassName(this.dom.label, 'expanded'); + util.removeClassName(this.dom.label, 'vis-nesting-group'); } if (data && data.nestedInGroup) { @@ -425,30 +438,9 @@ Group.prototype.add = function(item) { // add to if (item.data.subgroup !== undefined) { - if (this.subgroups[item.data.subgroup] === undefined) { - this.subgroups[item.data.subgroup] = { - height:0, - top: 0, - start: item.data.start, - end: item.data.end, - visible: false, - index:this.subgroupIndex, - items: [] - }; - this.subgroupIndex++; - } - - - if (new Date(item.data.start) < new Date(this.subgroups[item.data.subgroup].start)) { - this.subgroups[item.data.subgroup].start = item.data.start; - } - if (new Date(item.data.end) > new Date(this.subgroups[item.data.subgroup].end)) { - this.subgroups[item.data.subgroup].end = item.data.end; - } - - this.subgroups[item.data.subgroup].items.push(item); + this._addToSubgroup(item); + this.orderSubgroups(); } - this.orderSubgroups(); if (this.visibleItems.indexOf(item) == -1) { var range = this.itemSet.body.range; // TODO: not nice accessing the range like this @@ -456,6 +448,34 @@ Group.prototype.add = function(item) { } }; + +Group.prototype._addToSubgroup = function(item, subgroupId) { + subgroupId = subgroupId || item.data.subgroup; + if (subgroupId != undefined && this.subgroups[subgroupId] === undefined) { + this.subgroups[subgroupId] = { + height:0, + top: 0, + start: item.data.start, + end: item.data.end, + visible: false, + index:this.subgroupIndex, + items: [] + }; + this.subgroupIndex++; + } + + + if (new Date(item.data.start) < new Date(this.subgroups[subgroupId].start)) { + this.subgroups[subgroupId].start = item.data.start; + } + if (new Date(item.data.end) > new Date(this.subgroups[subgroupId].end)) { + this.subgroups[subgroupId].end = item.data.end; + } + + this.subgroups[subgroupId].items.push(item); + +}; + Group.prototype._updateSubgroupsSizes = function () { var me = this; if (me.subgroups) { @@ -526,22 +546,30 @@ Group.prototype.remove = function(item) { if (index != -1) this.visibleItems.splice(index, 1); if(item.data.subgroup !== undefined){ - var subgroup = this.subgroups[item.data.subgroup]; + this._removeFromSubgroup(item); + this.orderSubgroups(); + } +}; + +Group.prototype._removeFromSubgroup = function(item, subgroupId) { + subgroupId = subgroupId || item.data.subgroup; + if (subgroupId != undefined) { + var subgroup = this.subgroups[subgroupId]; if (subgroup){ var itemIndex = subgroup.items.indexOf(item); - subgroup.items.splice(itemIndex,1); - if (!subgroup.items.length){ - delete this.subgroups[item.data.subgroup]; - this.subgroupIndex--; - } else { - this._updateSubgroupsSizes(); + // Check the item is actually in this subgroup. How should items not in the group be handled? + if (itemIndex >= 0) { + subgroup.items.splice(itemIndex,1); + if (!subgroup.items.length){ + delete this.subgroups[subgroupId]; + } else { + this._updateSubgroupsSizes(); + } } - this.orderSubgroups(); } } }; - /** * Remove an item from the corresponding DataSet * @param {Item} item @@ -722,6 +750,10 @@ Group.prototype._checkIfVisibleWithReference = function(item, visibleItems, visi } }; - +Group.prototype.changeSubgroup = function(item, oldSubgroup, newSubgroup) { + this._removeFromSubgroup(item, oldSubgroup); + this._addToSubgroup(item, newSubgroup); + this.orderSubgroups(); +}; module.exports = Group; diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 972db387..a278fba9 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -616,8 +616,10 @@ ItemSet.prototype.redraw = function() { // 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; + var scrolled = range.start != this.lastRangeStart; + if (zoomed || scrolled) this.stackDirty = true; this.lastVisibleInterval = visibleInterval; + this.lastRangeStart = range.start; this.props.lastWidth = this.props.width; var restack = this.stackDirty; @@ -1155,7 +1157,8 @@ ItemSet.prototype._orderNestedGroups = function(groupIds) { var nestedGroups = this.groupsData.get({ filter: function(nestedGroup) { return nestedGroup.nestedInGroup == groupId; - } + }, + order: this.options.groupOrder }); var nestedGroupIds = nestedGroups.map(function(nestedGroup) { return nestedGroup.id }) newGroupIdsOrder = newGroupIdsOrder.concat(nestedGroupIds); @@ -1196,21 +1199,28 @@ ItemSet.prototype._updateItem = function(item, itemData) { var oldGroupId = item.data.group; var oldSubGroupId = item.data.subgroup; + if (oldGroupId != itemData.group) { + var oldGroup = this.groups[oldGroupId]; + if (oldGroup) oldGroup.remove(item); + } + // update the items data (will redraw the item when displayed) item.setData(itemData); var groupId = this._getGroupId(item.data); - var group = this.groups[groupId]; + var group = this.groups[groupId]; if (!group) { - item.groupShowing = false; + item.groupShowing = false; } else if (group && group.data && group.data.showNested) { - item.groupShowing = true; + item.groupShowing = true; } // update group - if (oldGroupId != item.data.group || oldSubGroupId != item.data.subgroup) { - var oldGroup = this.groups[oldGroupId]; - if (oldGroup) oldGroup.remove(item); - if (group) group.add(item); + if (group) { + if (oldGroupId != item.data.group) { + group.add(item); + } else if (oldSubGroupId != item.data.subgroup) { + group.changeSubgroup(item, oldSubGroupId); + } } }; @@ -1641,7 +1651,7 @@ ItemSet.prototype._onDragEnd = function (event) { ItemSet.prototype._onGroupClick = function (event) { var group = this.groupFromTarget(event); - if (!group.nestedGroups) return; + if (!group || !group.nestedGroups) return; var groupsData = this.groupsData; if (this.groupsData instanceof DataView) { @@ -1874,7 +1884,7 @@ ItemSet.prototype._onSelectItem = function (event) { if (newSelection.length > 0 || oldSelection.length > 0) { this.body.emitter.emit('select', { items: newSelection, - event: util.elementsCensor(event) + event: event }); } }; @@ -1919,7 +1929,7 @@ ItemSet.prototype._onMouseOver = function (event) { this.body.emitter.emit('itemover', { item: item.id, - event: util.elementsCensor(event) + event: event }); }; ItemSet.prototype._onMouseOut = function (event) { @@ -1939,7 +1949,7 @@ ItemSet.prototype._onMouseOut = function (event) { this.body.emitter.emit('itemout', { item: item.id, - event: util.elementsCensor(event) + event: event }); }; ItemSet.prototype._onMouseMove = function (event) { @@ -2143,7 +2153,7 @@ ItemSet.prototype._onMultiSelectItem = function (event) { this.body.emitter.emit('select', { items: this.getSelection(), - event: util.elementsCensor(event) + event: event }); } }; diff --git a/lib/timeline/component/LineGraph.js b/lib/timeline/component/LineGraph.js index fa0934e2..ec797541 100644 --- a/lib/timeline/component/LineGraph.js +++ b/lib/timeline/component/LineGraph.js @@ -487,6 +487,7 @@ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) { //Copy data (because of unmodifiable DataView input. var extended = util.bridgeObject(item); extended.x = util.convert(item.x, 'Date'); + extended.end = util.convert(item.end, 'Date'); extended.orginalY = item.y; //real Y extended.y = Number(item.y); extended[fieldId] = item[fieldId]; @@ -908,10 +909,10 @@ LineGraph.prototype._getYRanges = function (groupIds, groupsData, groupRanges) { // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups. if (options.stack === true && options.style === 'bar') { if (options.yAxisOrientation === 'left') { - combinedDataLeft = combinedDataLeft.concat(group.getItems()); + combinedDataLeft = combinedDataLeft.concat(groupData); } else { - combinedDataRight = combinedDataRight.concat(group.getItems()); + combinedDataRight = combinedDataRight.concat(groupData); } } else { @@ -1064,6 +1065,12 @@ LineGraph.prototype._convertXcoordinates = function (datapoints) { for (var i = 0; i < datapoints.length; i++) { datapoints[i].screen_x = toScreen(datapoints[i].x) + this.props.width; datapoints[i].screen_y = datapoints[i].y; //starting point for range calculations + if (datapoints[i].end != undefined) { + datapoints[i].screen_end = toScreen(datapoints[i].end) + this.props.width; + } + else { + datapoints[i].screen_end = undefined; + } } }; diff --git a/lib/timeline/component/graph2d_types/bar.js b/lib/timeline/component/graph2d_types/bar.js index 32b3d36e..a8db2e24 100644 --- a/lib/timeline/component/graph2d_types/bar.js +++ b/lib/timeline/component/graph2d_types/bar.js @@ -62,8 +62,10 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) { for (j = 0; j < processedGroupData[groupIds[i]].length; j++) { combinedData.push({ screen_x: processedGroupData[groupIds[i]][j].screen_x, + screen_end: processedGroupData[groupIds[i]][j].screen_end, screen_y: processedGroupData[groupIds[i]][j].screen_y, x: processedGroupData[groupIds[i]][j].x, + end: processedGroupData[groupIds[i]][j].end, y: processedGroupData[groupIds[i]][j].y, groupId: groupIds[i], label: processedGroupData[groupIds[i]][j].label @@ -128,7 +130,21 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) { drawData.offset += (intersections[key].resolved) * drawData.width - (0.5 * drawData.width * (intersections[key].amount + 1)); } } - DOMutil.drawBar(combinedData[i].screen_x + drawData.offset, combinedData[i].screen_y - heightOffset, drawData.width, group.zeroPosition - combinedData[i].screen_y, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); + + let dataWidth = drawData.width; + let start = combinedData[i].screen_x; + + // are we drawing explicit boxes? (we supplied an end value) + if (combinedData[i].screen_end != undefined){ + dataWidth = combinedData[i].screen_end - combinedData[i].screen_x; + start += (dataWidth * 0.5); + } + else { + start += drawData.offset + } + + DOMutil.drawBar(start, combinedData[i].screen_y - heightOffset, dataWidth, group.zeroPosition - combinedData[i].screen_y, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); + // draw points if (group.options.drawPoints.enabled === true) { let pointData = { diff --git a/lib/timeline/component/item/BackgroundItem.js b/lib/timeline/component/item/BackgroundItem.js index f0255415..a4ec1bd9 100644 --- a/lib/timeline/component/item/BackgroundItem.js +++ b/lib/timeline/component/item/BackgroundItem.js @@ -143,6 +143,7 @@ BackgroundItem.prototype.repositionX = RangeItem.prototype.repositionX; */ BackgroundItem.prototype.repositionY = function(margin) { var height; + var orientation = this.options.orientation.item; // special positioning for subgroups if (this.data.subgroup !== undefined) { @@ -154,7 +155,6 @@ BackgroundItem.prototype.repositionY = function(margin) { this.dom.box.style.height = this.parent.subgroups[itemSubgroup].height + 'px'; - var orientation = this.options.orientation.item; if (orientation == 'top') { this.dom.box.style.top = this.parent.top + this.parent.subgroups[itemSubgroup].top + 'px'; } else { @@ -170,8 +170,8 @@ BackgroundItem.prototype.repositionY = function(margin) { height = Math.max(this.parent.height, this.parent.itemSet.body.domProps.center.height, this.parent.itemSet.body.domProps.centerContainer.height); + this.dom.box.style.bottom = orientation == 'bottom' ? '0' : ''; this.dom.box.style.top = orientation == 'top' ? '0' : ''; - this.dom.box.style.bottom = orientation == 'top' ? '' : '0'; } else { height = this.parent.height; diff --git a/lib/timeline/component/item/BoxItem.js b/lib/timeline/component/item/BoxItem.js index 25b3e3e4..aa2e1eea 100644 --- a/lib/timeline/component/item/BoxItem.js +++ b/lib/timeline/component/item/BoxItem.js @@ -121,10 +121,7 @@ BoxItem.prototype.redraw = function() { this._updateDataAttributes(this.dom.box); this._updateStyle(this.dom.box); - var editable = (this.options.editable.updateTime || - this.options.editable.updateGroup || - this.editable === true) && - this.editable !== false; + var editable = (this.editable.updateTime || this.editable.updateGroup); // update class var className = (this.data.className? ' ' + this.data.className : '') + diff --git a/lib/timeline/component/item/Item.js b/lib/timeline/component/item/Item.js index b54d9d6d..6713a7ac 100644 --- a/lib/timeline/component/item/Item.js +++ b/lib/timeline/component/item/Item.js @@ -31,19 +31,7 @@ function Item (data, conversion, options) { this.height = null; this.editable = null; - if (this.data && this.data.hasOwnProperty('editable')){ - if(typeof this.data.editable === 'boolean') { - this.editable = { - updateTime: this.data.editable, - updateGroup: this.data.editable, - remove: this.data.editable - } - } - else if(typeof options.editable === 'object') { - this.editable = {}; - util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, options.editable); - }; - } + this._updateEditStatus(); } Item.prototype.stack = true; @@ -77,21 +65,8 @@ Item.prototype.setData = function(data) { this.parent.itemSet._moveToGroup(this, data.group); } - if (data.hasOwnProperty('editable')){ - if (typeof data.editable === 'boolean') { - this.editable = { - updateTime: this.data.editable, - updateGroup: this.data.editable, - remove: this.data.editable - } - } - else if(typeof this.options.editable === 'object') { - this.editable = {}; - util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, data.editable); - } - } - this.data = data; + this._updateEditStatus(); this.dirty = true; if (this.displayed) this.redraw(); }; @@ -367,7 +342,7 @@ Item.prototype._updateContents = function (element) { if (this.options.template) { templateFunction = this.options.template.bind(this); - content = templateFunction(itemData, element); + content = templateFunction(itemData, element, this.data); } else { content = this.data.content; } @@ -461,6 +436,41 @@ Item.prototype._contentToString = function (content) { return content; }; +/** + * Update the editability of this item. + */ +Item.prototype._updateEditStatus = function() { + if (this.options) { + if(typeof this.options.editable === 'boolean') { + this.editable = { + updateTime: this.options.editable, + updateGroup: this.options.editable, + remove: this.options.editable + }; + } else if(typeof this.options.editable === 'object') { + this.editable = {}; + util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.options.editable); + }; + } + // Item data overrides, except if options.editable.overrideItems is set. + if (!this.options || !(this.options.editable) || (this.options.editable.overrideItems !== true)) { + if (this.data) { + if (typeof this.data.editable === 'boolean') { + this.editable = { + updateTime: this.data.editable, + updateGroup: this.data.editable, + remove: this.data.editable + } + } else if (typeof this.data.editable === 'object') { + // TODO: in vis.js 5.0, we should change this to not reset options from the timeline configuration. + // Basically just remove the next line... + this.editable = {}; + util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.data.editable); + } + } + } +}; + /** * Return the width of the item left from its start date * @return {number} diff --git a/lib/timeline/component/item/PointItem.js b/lib/timeline/component/item/PointItem.js index 959d22da..26fb784e 100644 --- a/lib/timeline/component/item/PointItem.js +++ b/lib/timeline/component/item/PointItem.js @@ -99,11 +99,7 @@ PointItem.prototype.redraw = function() { this._updateDataAttributes(this.dom.point); this._updateStyle(this.dom.point); - var editable = (this.options.editable.updateTime || - this.options.editable.updateGroup || - this.editable === true) && - this.editable !== false; - + var editable = (this.editable.updateTime || this.editable.updateGroup); // update class var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + diff --git a/lib/timeline/component/item/RangeItem.js b/lib/timeline/component/item/RangeItem.js index b0d71636..7deaf74c 100644 --- a/lib/timeline/component/item/RangeItem.js +++ b/lib/timeline/component/item/RangeItem.js @@ -103,10 +103,7 @@ RangeItem.prototype.redraw = function() { this._updateDataAttributes(this.dom.box); this._updateStyle(this.dom.box); - var editable = (this.options.editable.updateTime || - this.options.editable.updateGroup || - this.editable === true) && - this.editable !== false; + var editable = (this.editable.updateTime || this.editable.updateGroup); // update class var className = (this.data.className ? (' ' + this.data.className) : '') + diff --git a/lib/util.js b/lib/util.js index 31ca9bb7..cfbfbaf5 100644 --- a/lib/util.js +++ b/lib/util.js @@ -16,23 +16,6 @@ exports.isNumber = function (object) { return (object instanceof Number || typeof object == 'number'); }; -/** - * Censors object elements containing dom elements - * @param {*} object - * @return {Object} object without elements - */ -exports.elementsCensor = function (object) { - if (!object) return; - var replacer = function(key, value) { - if (value instanceof Element) { - return "DOM Element"; - } else { - return value; - } - } - return JSON.parse(JSON.stringify(object, replacer)) -} - /** * Remove everything in the DOM object diff --git a/misc/we_need_help.md b/misc/we_need_help.md index 00287215..7eb941bc 100644 --- a/misc/we_need_help.md +++ b/misc/we_need_help.md @@ -15,3 +15,4 @@ If you have shown some commitment to the project you can ask [@ludost](//github. * [@yotamberk](//github.com/yotamberk) * [@Tooa](//github.com/Tooa) * [@eymiha](//github.com/eymiha) +* [@bradh](//github.com/bradh) diff --git a/package.json b/package.json index bed62546..1c1b30e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vis", - "version": "4.18.1-SNAPSHOT", + "version": "4.19.1-SNAPSHOT", "description": "A dynamic, browser-based visualization library.", "homepage": "http://visjs.org/", "license": "(Apache-2.0 OR MIT)", @@ -28,16 +28,8 @@ "lint": "eslint lib", "watch": "gulp watch", "watch-dev": "gulp watch --bundle" - }, + }, "dependencies": { - "babel-core": "^6.6.5", - "babel-loader": "^6.2.4", - "babel-polyfill": "^6.22.0", - "babel-plugin-transform-es3-member-expression-literals": "^6.22.0", - "babel-plugin-transform-es3-property-literals": "^6.8.0", - "babel-plugin-transform-runtime": "^6.22.0", - "babel-preset-es2015": "^6.6.0", - "babel-runtime": "^6.22.0", "emitter-component": "^1.1.1", "moment": "^2.17.1", "propagating-hammerjs": "^1.4.6", @@ -46,7 +38,15 @@ }, "devDependencies": { "async": "^2.1.4", + "babel-core": "^6.6.5", "babel-eslint": "^7.1.1", + "babel-loader": "^6.2.4", + "babel-polyfill": "^6.22.0", + "babel-plugin-transform-es3-member-expression-literals": "^6.22.0", + "babel-plugin-transform-es3-property-literals": "^6.8.0", + "babel-plugin-transform-runtime": "^6.22.0", + "babel-preset-es2015": "^6.6.0", + "babel-runtime": "^6.22.0", "babelify": "^7.3.0", "clean-css": "^4.0.2", "eslint": "^3.15.0", @@ -56,6 +56,7 @@ "gulp-rename": "^1.2.2", "gulp-util": "^3.0.8", "jsdom": "9.9.1", + "jsdom-global": "^2.1.1", "mocha": "^3.2.0", "mocha-jsdom": "^1.1.0", "rimraf": "^2.5.4", diff --git a/test/PointItem.test.js b/test/PointItem.test.js index 1f88ea38..d7345aa1 100644 --- a/test/PointItem.test.js +++ b/test/PointItem.test.js @@ -10,16 +10,15 @@ var TestSupport = require('./TestSupport'); describe('Timeline PointItem', function () { jsdom(); + var now = moment(); it('should initialize with minimal data', function() { - var now = moment().toDate(); - var pointItem = new PointItem({start: now}, null, null); + var pointItem = new PointItem({start: now.toDate()}, null, null); assert.equal(pointItem.props.content.height, 0); - assert.equal(pointItem.data.start, now); + assert.deepEqual(pointItem.data.start, now.toDate()); }); it('should have a default width of 0', function() { - var now = moment().toDate(); var pointItem = new PointItem({start: now}, null, null); assert.equal(pointItem.getWidthRight(), 0); assert.equal(pointItem.getWidthLeft(), 0); @@ -30,7 +29,6 @@ describe('Timeline PointItem', function () { }); it('should be visible if the range is during', function() { - var now = moment(); var range = new Range(TestSupport.buildSimpleTimelineRangeBody()); range.start = now.clone().add(-1, 'second'); range.end = range.start.clone().add(1, 'hour'); @@ -39,7 +37,6 @@ describe('Timeline PointItem', function () { }); it('should not be visible if the range is after', function() { - var now = moment(); var range = new Range(TestSupport.buildSimpleTimelineRangeBody()); range.start = now.clone().add(1, 'second'); range.end = range.start.clone().add(1, 'hour'); @@ -58,8 +55,214 @@ describe('Timeline PointItem', function () { it('should be visible for a "now" point with a default range', function() { var range = new Range(TestSupport.buildSimpleTimelineRangeBody()); - var now = moment().toDate(); - var pointItem = new PointItem({start: now}, null, null); + var pointItem = new PointItem({start: now.toDate()}, null, null); assert(pointItem.isVisible(range)); }); -}); \ No newline at end of file + + it('should redraw() and then not be dirty', function() { + var pointItem = new PointItem({start: now.toDate()}, null, {editable: false}); + pointItem.setParent(TestSupport.buildMockItemSet()); + assert(pointItem.dirty); + pointItem.redraw(); + assert(!pointItem.dirty); + }); + + it('should redraw() and then have point attached to its parent', function() { + var pointItem = new PointItem({start: now.toDate()}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + assert(!parent.dom.foreground.hasChildNodes()); + pointItem.redraw(); + assert(parent.dom.foreground.hasChildNodes()); + }); + + it('should redraw() and then have the correct classname for a non-editable item', function() { + var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); + }); + + it('should redraw() and then have the correct classname for an editable item (with object option)', function() { + var pointItem = new PointItem({start: now.toDate()}, null, {editable: {updateTime: true, updateGroup: false}}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); + }); + + it('should redraw() and then have the correct classname for an editable item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate()}, null, {editable: true}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); + }); + + it('should redraw() and then have the correct classname for an editable:false override item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: true}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); + }); + + it('should redraw() and then have the correct classname for an editable:true override item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: true}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); + }); + + it('should redraw() and then have the correct classname for an editable:false override item (with object option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: {updateTime: true, updateGroup: false}}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); + }); + + it('should redraw() and then have the correct classname for an editable:false override item (with object option for group change)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: {updateTime: false, updateGroup: true}}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); + }); + + it('should redraw() and then have the correct classname for an editable:true override item (with object option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: true}, null, {editable: {updateTime: false, updateGroup: false}}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); + }); + + it('should redraw() and then have the correct classname for an editable:true non-override item (with object option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: true}, null, {editable: {updateTime: false, updateGroup: false, overrideItems: true}}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); + }); + + it('should redraw() and then have the correct classname for an editable:false non-override item (with object option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: {updateTime: true, updateGroup: false, overrideItems: true}}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); + assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); + }); + + it('should redraw() and then have the correct property for an editable: {updateTime} override item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true}}, null, {editable: true}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, true); + assert.equal(pointItem.editable.updateGroup, undefined); + assert.equal(pointItem.editable.remove, undefined); + }); + + it('should redraw() and then have the correct property for an editable: {updateTime} override item (with boolean option false)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true}}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, true); + assert.equal(pointItem.editable.updateGroup, undefined); + assert.equal(pointItem.editable.remove, undefined); + }); + + it('should redraw() and then have the correct property for an editable: {updateGroup} override item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateGroup: true}}, null, {editable: true}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, undefined); + assert.equal(pointItem.editable.updateGroup, true); + assert.equal(pointItem.editable.remove, undefined); + }); + + it('should redraw() and then have the correct property for an editable: {updateGroup} override item (with boolean option false)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateGroup: true}}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, undefined); + assert.equal(pointItem.editable.updateGroup, true); + assert.equal(pointItem.editable.remove, undefined); + }); + + it('should redraw() and then have the correct property for an editable: {remove} override item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {remove: true}}, null, {editable: true}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, undefined); + assert.equal(pointItem.editable.updateGroup, undefined); + assert.equal(pointItem.editable.remove, true); + }); + + it('should redraw() and then have the correct property for an editable: {remove} override item (with boolean option false)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {remove: true}}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, undefined); + assert.equal(pointItem.editable.updateGroup, undefined); + assert.equal(pointItem.editable.remove, true); + }); + + it('should redraw() and then have the correct property for an editable: {updateTime, remove} override item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, remove: true}}, null, {editable: true}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, true); + assert.equal(pointItem.editable.updateGroup, undefined); + assert.equal(pointItem.editable.remove, true); + }); + + it('should redraw() and then have the correct property for an editable: {updateTime, remove} override item (with boolean option false)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, remove: true}}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, true); + assert.equal(pointItem.editable.updateGroup, undefined); + assert.equal(pointItem.editable.remove, true); + }); + + it('should redraw() and then have the correct property for an editable: {updateTime, updateGroup, remove} override item (with boolean option)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, updateGroup: true, remove: true}}, null, {editable: true}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, true); + assert.equal(pointItem.editable.updateGroup, true); + assert.equal(pointItem.editable.remove, true); + }); + + it('should redraw() and then have the correct property for an editable: {updateTime, updateGroup, remove} override item (with boolean option false)', function() { + var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, updateGroup: true, remove: true}}, null, {editable: false}); + var parent = TestSupport.buildMockItemSet(); + pointItem.setParent(parent); + pointItem.redraw(); + assert.equal(pointItem.editable.updateTime, true); + assert.equal(pointItem.editable.updateGroup, true); + assert.equal(pointItem.editable.remove, true); + }); +}); diff --git a/test/TestSupport.js b/test/TestSupport.js index 06d67852..1de998b6 100644 --- a/test/TestSupport.js +++ b/test/TestSupport.js @@ -1,5 +1,20 @@ +var vis = require('../dist/vis'); +var DataSet = vis.DataSet; module.exports = { + buildMockItemSet: function() { + var itemset = { + dom: { + foreground: document.createElement('div'), + content: document.createElement('div') + }, + itemSet: { + itemsData: new DataSet() + } + }; + return itemset; + }, + buildSimpleTimelineRangeBody: function () { var body = { dom: { @@ -7,7 +22,12 @@ module.exports = { clientWidth: 1000 } }, - domProps: this.props, + domProps: { + centerContainer: { + width: 900, + height: 600 + } + }, emitter: { on: function () {}, off: function () {}, diff --git a/test/TimelineItemSet.test.js b/test/TimelineItemSet.test.js new file mode 100644 index 00000000..8892c49e --- /dev/null +++ b/test/TimelineItemSet.test.js @@ -0,0 +1,108 @@ +var assert = require('assert'); + +describe('Timeline ItemSet', function () { + before(function () { + delete require.cache[require.resolve('../dist/vis')] + this.jsdom = require('jsdom-global')(); + this.vis = require('../dist/vis'); + var TestSupport = require('./TestSupport'); + var rangeBody = TestSupport.buildSimpleTimelineRangeBody(); + this.testrange = new this.vis.timeline.Range(rangeBody); + this.testrange.setRange(new Date(2017, 1, 26, 13, 26, 3, 320), new Date(2017, 1, 26, 13, 26, 4, 320), false, false, null); + this.testitems = new this.vis.DataSet({ + type: { + start: 'Date', + end: 'Date' + } + }); + // add single items with different date types + this.testitems.add({id: 1, content: 'Item 1', start: new Date(2017, 1, 26, 13, 26, 3, 600), type: 'point'}); + this.testitems.add({id: 2, content: 'Item 2', start: new Date(2017, 1, 26, 13, 26, 5, 600), type: 'point'}); + }) + + after(function () { + this.jsdom(); + }) + + var getBasicBody = function() { + var body = { + dom: { + container: document.createElement('div'), + leftContainer: document.createElement('div'), + centerContainer: document.createElement('div'), + top: document.createElement('div'), + left: document.createElement('div'), + center: document.createElement('div'), + backgroundVertical: document.createElement('div') + }, + domProps: { + root: {}, + background: {}, + centerContainer: {}, + leftContainer: {}, + rightContainer: {}, + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + border: {}, + scrollTop: 0, + scrollTopMin: 0 + }, + emitter: { + on: function() {return {};}, + emit: function() {} + }, + util: { + } + } + return body; + }; + + it('should initialise with minimal data', function () { + var body = getBasicBody(); + var itemset = new this.vis.timeline.components.ItemSet(body, {}); + assert(itemset); + }); + + it('should redraw() and have the right classNames', function () { + var body = getBasicBody(); + body.range = this.testrange; + var itemset = new this.vis.timeline.components.ItemSet(body, {}); + itemset.redraw(); + assert.equal(itemset.dom.frame.className, 'vis-itemset'); + assert.equal(itemset.dom.background.className, 'vis-background'); + assert.equal(itemset.dom.foreground.className, 'vis-foreground'); + assert.equal(itemset.dom.axis.className, 'vis-axis'); + assert.equal(itemset.dom.labelSet.className, 'vis-labelset'); + }); + + it('should start with no items', function () { + var body = getBasicBody(); + var itemset = new this.vis.timeline.components.ItemSet(body, {}); + assert.equal(itemset.getItems(), null); + }); + + it('should store items correctly', function() { + var body = getBasicBody(); + body.range = this.testrange; + var DateUtil = this.vis.timeline.DateUtil; + body.util.toScreen = function(time) { + return DateUtil.toScreen({ + body: { + hiddenDates: [] + }, + range: { + conversion: function() { + return {offset: 0, scale: 100}; + } + } + }, time, 900) + }; + var itemset = new this.vis.timeline.components.ItemSet(body, {}); + itemset.setItems(this.testitems); + assert.equal(itemset.getItems().length, 2); + assert.deepEqual(itemset.getItems(), this.testitems); + }); +});