Commit 6d14b35e24ccb6dbd6c05dace876c493b93a2a2e

Authored by root
2 parents 5e9d2f5d b4fdbae2

Merge branch 'master' of http://service.routetopa.eu:7480/WebCompDev/COMPONENTS

Showing 82 changed files with 4570 additions and 480 deletions
controllets/animated-grid-controllet/animated-grid-controllet.html 0 → 100644
  1 +<!--
  2 +Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
  3 +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
  4 +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
  5 +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
  6 +Code distributed by Google as part of the polymer project is also
  7 +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
  8 +-->
  9 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  10 +<link rel="import" href="../../bower_components/paper-styles/paper-styles.html">
  11 +<link rel="import" href="../../bower_components/neon-animation/neon-shared-element-animatable-behavior.html">
  12 +
  13 +<dom-module id="animated-grid-controllet">
  14 +
  15 + <style>
  16 +
  17 + :host {
  18 + display: block;
  19 + /*background: #000;*/
  20 + }
  21 +
  22 + /* clearfix */
  23 + .grid:after
  24 + {
  25 + content: '';
  26 + display: block;
  27 + clear: both;
  28 + }
  29 +
  30 + /* ---- grid-item ---- */
  31 +
  32 +
  33 + ::content .grid-item {float: left;box-sizing: border-box;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;border: 3px solid white;}
  34 + ::content .grid-sizer {width: 200px;}
  35 + ::content .grid-item-w20 {width: 200px;}
  36 + ::content .grid-item-w40 {width: 400px;}
  37 + ::content .grid-item-w60 {width: 600px;}
  38 + ::content .grid-item-w80 {width: 80%;}
  39 + ::content .grid-item-w100 {width: 100%;}
  40 +
  41 + ::content .grid-item-h200 {height: 200px;}
  42 + ::content .grid-item-h400 {height: 400px;}
  43 + ::content .grid-item-h600 {height: 600px;}
  44 + ::content .grid-item-h800 {height: 800px;}
  45 +
  46 + ::content .grid-item-c0 {background-color: #0D47A1;}
  47 + ::content .grid-item-c1 {background-color: #1976D2;}
  48 + ::content .grid-item-c2 {background-color: #2196F3;}
  49 + ::content .grid-item-c3 {background-color: #64B5F6;}
  50 + ::content .grid-item-c4 {background-color: #BBDEFB;}
  51 +
  52 + ::content .room-body {background-color: #BBDEFB;}
  53 +
  54 + ::content .room-subject
  55 + {
  56 + position: absolute;
  57 + width: 100%;
  58 + height: 30px;
  59 + bottom: 20px;
  60 + background-color: rgba(0,0,0,0.6);
  61 + vertical-align: middle;
  62 + color: #FFFFFF;
  63 + }
  64 +
  65 + </style>
  66 +
  67 + <template>
  68 +
  69 + <div id="grid-container" class="grid">
  70 + <!--<template is="dom-repeat" items="{{data}}">
  71 + <div class$="{{item.b}} {{item.w}} {{item.h}} {{item.c}}">{{index}}</div>
  72 + </template>-->
  73 + <content></content>
  74 + </div>
  75 +
  76 + <div class="grid-sizer"></div>
  77 +
  78 + </template>
  79 +
  80 +</dom-module>
  81 +
  82 +<script>
  83 +
  84 + Polymer({
  85 +
  86 + is: 'animated-grid-controllet',
  87 +
  88 + behaviors: [
  89 + Polymer.NeonSharedElementAnimatableBehavior
  90 + ],
  91 +
  92 + properties: {
  93 + animationConfig: {
  94 + type: Object,
  95 + value: function() {
  96 + return {
  97 + 'exit': [{
  98 + name: 'ripple-animation',
  99 + id: 'ripple',
  100 + fromPage: this
  101 + }, {
  102 + name: 'hero-animation',
  103 + id: 'hero',
  104 + fromPage: this
  105 + }]
  106 + }
  107 + }
  108 + }
  109 + },
  110 +
  111 + ready : function()
  112 + {
  113 + /*var randW = 0;
  114 + var randH = 0;
  115 + var randC = 0;
  116 + this.data = [];
  117 +
  118 + for(var i=0; i<100; i++)
  119 + {
  120 + randW = Math.floor(Math.random() * 2);
  121 + randH = Math.floor(Math.random() * 2);//randW;//0;//1;
  122 + randC = Math.floor(Math.random() * 5);
  123 + //html += '<div class="grid-item grid-item-w'+((randW*20)+20)+' grid-item-h'+((randH*200)+200)+' grid-item-c'+randC+'">Topic - '+i+'</div>';
  124 +
  125 + this.push('data', {b: 'grid-item',
  126 + w: 'grid-item-w'+((randW*20)+20),
  127 + h: 'grid-item-h'+((randH*200)+200),
  128 + c: 'grid-item-c'+randC});
  129 +
  130 + }*/
  131 + },
  132 +
  133 + attached : function()
  134 + {
  135 + $('.grid').masonry({
  136 + itemSelector: '.grid-item',
  137 + columnWidth: 200
  138 + });
  139 + },
  140 +
  141 + listeners: {
  142 + click: '_onClick'
  143 + },
  144 +
  145 + _onClick: function(event) {
  146 +
  147 + var target = event.target;
  148 +
  149 + if(target.classList[0] != "grid-item")
  150 + return;
  151 +
  152 + // configure the page animation
  153 + this.sharedElements = {
  154 + 'hero': target,
  155 + 'ripple': target
  156 + };
  157 + this.animationConfig['exit'][0].gesture = {
  158 + x: event.x || event.pageX,
  159 + y: event.y || event.pageY
  160 + };
  161 +
  162 + this.fire('tile-click', {
  163 + tile: target,
  164 + //data: {color: target._templateInstance.item.c}
  165 + data: {color: target.classList[3], id:target.id}
  166 + });
  167 +
  168 + }
  169 +
  170 + });
  171 +
  172 +</script>
... ...
controllets/data-sevc-controllet/colors 0 → 100755
  1 +Dark primary #1976D2; /** OW_Control type:color, key:darkPrimaryColor, section:2. Colors, label:1. Dark primary **/
  2 +
  3 +Primary #2196F3; /** OW_Control type:color, key:primaryColor, section:2. Colors, label:2. Primary **/
  4 +
  5 +Light primary #BBDEFB; /** OW_Control type:color, key:lightPrimaryColor, section:2. Colors, label:3. Light primary **/
  6 +
  7 +Text/Icons #FFFFFF; /** OW_Control type:color, key:textIconsColor, section:2. Colors, label:4. Text/Icons **/
  8 +
  9 +Accent #00BCD4; /** OW_Control type:color, key:accentColor, section:2. Colors, label:5. Accent **/
  10 +
  11 +Primary text #212121; /** OW_Control type:color, section:2. Colors, key:textColor, label:6. Text **/
  12 +
  13 +Secondary text #727272; /** OW_Control type:color, section:2. Colors, key:secondaryTextColor, label:7. Secondary text **/
  14 +
  15 +Divider #B6B6B6; /** OW_Control type:color, section:2. Colors, key:dividerColor, label:8. Divider **/
  16 +
  17 +
  18 +
  19 +
  20 +E0E0E0
  21 +
  22 +9E9E9E 0.87
  23 +
  24 +
  25 +
  26 +00AABF
  27 +
  28 +
  29 +
  30 +
  31 +
  32 +
  33 +
  34 +
  35 +'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif
0 36 \ No newline at end of file
... ...
controllets/data-sevc-controllet/data-sevc-controllet-orig.html 0 → 100755
  1 +<!--
  2 +@license
  3 + The MIT License (MIT)
  4 +
  5 + Copyright (c) 2015 Dipartimento di Informatica - Universit� di Salerno - Italy
  6 +
  7 + Permission is hereby granted, free of charge, to any person obtaining a copy
  8 + of this software and associated documentation files (the "Software"), to deal
  9 + in the Software without restriction, including without limitation the rights
  10 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11 + copies of the Software, and to permit persons to whom the Software is
  12 + furnished to do so, subject to the following conditions:
  13 +
  14 + The above copyright notice and this permission notice shall be included in
  15 + all copies or substantial portions of the Software.
  16 +
  17 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23 + THE SOFTWARE.
  24 +-->
  25 +
  26 +<!--
  27 +* Developed by :
  28 +* ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu
  29 +*
  30 +-->
  31 +
  32 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  33 +<link rel="import" href="../../bower_components/paper-styles/color.html">
  34 +
  35 +<link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">
  36 +<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
  37 +<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  38 +
  39 +<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
  40 +<link rel="import" href="../../bower_components/paper-input/paper-input.html">
  41 +<link rel="import" href="../../bower_components/paper-material/paper-material.html">
  42 +<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
  43 +<link rel="import" href="../../bower_components/paper-button/paper-button.html">
  44 +<link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">
  45 +<link rel="import" href="../../bower_components/paper-tabs/paper-tab.html">
  46 +<link rel="import" href="../../bower_components/iron-pages/iron-pages.html">
  47 +<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
  48 +<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
  49 +<link rel="import" href="../../bower_components/paper-item/paper-item.html">
  50 +<link rel="import" href="../../bower_components/paper-toast/paper-toast.html">
  51 +<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
  52 +<link rel="import" href="../../bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html">
  53 +
  54 +<link rel="import" href="../items-list-controllet/item-list-controllet.html">
  55 +<link rel="import" href="../draggable-element-controllet/draggable-element-controllet.html">
  56 +<link rel="import" href="../tree-view-controllet/tree-view-controllet.html">
  57 +<link rel="import" href="../text-element-controllet/text-element-controllet.html">
  58 +<link rel="import" href="../animated-button-container-controllet/animated-button-container-controllet.html">
  59 +
  60 +<!--
  61 +The `data-sevc-controllet` is a controllet to generate visualization from a dataset accessible through api. A json response is required.
  62 +It's composed by three steps. First, user have to select a datasource to access to a dataset. He can copy and paste/drag and drop an url(an api url with json response) or select
  63 +from select contextual menu an available one. Second, the user selects the fields he want to visualize from a treeview by checking on it. A table preview of selected fields will show
  64 +the currently selected values. Third, the users selects a visualization(datalet) from a slider and drags the previous selected fields in to the input data model fields area. A preview
  65 +is available every time a fields is dragged in the input data model fields area.
  66 +
  67 +Example:
  68 +
  69 + <data-sevc-controllet deep-url="http://192.168.36.128/DatalEts-Ecosystem-Provider/DEEP/"
  70 + datalets-list-url="http://192.168.36.128/DatalEts-Ecosystem-Provider/DEEP/datalets-list"
  71 + datasets='{[{name : 'dataset1', url : dataset1Urls}, ... , {name : 'datasetN', url : datasetNUrls}]'>
  72 + </data-sevc-controllet>
  73 +
  74 +
  75 +@element data-sevc-controllet
  76 +@status beta
  77 +@homepage
  78 +@group controllets
  79 +-->
  80 +
  81 +
  82 +<dom-module id="data-sevc-controllet">
  83 + <template>
  84 + <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  85 +
  86 + <style is="custom-style">
  87 +
  88 + ::content body {
  89 + font-family: 'Roboto', sans-serif;
  90 + }
  91 +
  92 + .flexchild
  93 + {
  94 + @apply(--layout-flex);
  95 + }
  96 +
  97 + .flex2child
  98 + {
  99 + @apply(--layout-flex-2);
  100 + }
  101 +
  102 + .avatar
  103 + {
  104 + display: inline-block;
  105 + height: 2em;
  106 + width: 2em;
  107 + border-radius: 50%;
  108 + background: var(--paper-blue-500);
  109 + color: white;
  110 + line-height: 2em;
  111 + font-size: 1.87em;
  112 + text-align: center;
  113 + }
  114 +
  115 + .title
  116 + {
  117 + position: relative;
  118 + top: 0.60vh;
  119 + margin-left: 20px;
  120 + }
  121 +
  122 + .big
  123 + {
  124 + font-size: 1.37em;
  125 + color: var(--google-grey-500);
  126 + }
  127 +
  128 + .medium
  129 + {
  130 + font-size: 1em;
  131 + padding-bottom: 0.5em;
  132 + color : #000000;
  133 + font-weight: bold;
  134 + }
  135 +
  136 + .small
  137 + {
  138 + font-size: 0.8em;
  139 + padding-top: 10px;
  140 + color: var(--paper-blue-500);
  141 + font-weight: bold;
  142 + }
  143 +
  144 + paper-input
  145 + {
  146 + width: 80%;
  147 + }
  148 +
  149 + paper-dropdown-menu
  150 + {
  151 + text-align: left;
  152 + margin: auto;
  153 + width: 100%;
  154 + }
  155 +
  156 + ::content paper-menu-button
  157 + {
  158 + display: block;
  159 + width: 100%;
  160 + }
  161 +
  162 + #visualization_slider_area
  163 + {
  164 + padding-top: 20px;
  165 + overflow: visible;
  166 + }
  167 +
  168 + #fields_mapping_area
  169 + {
  170 + min-width: 670px;
  171 + min-height: 180px;
  172 + }
  173 +
  174 + #datalet_placeholder
  175 + {
  176 + height: 60vh;
  177 + min-height: 60vh;
  178 + min-width: 45%;
  179 + margin-top:10px;
  180 + }
  181 +
  182 + .datalet_right_container
  183 + {
  184 + width: 100vh;
  185 + }
  186 +
  187 + .field-mapping-card
  188 + {
  189 + width: 50%;
  190 + float: left;
  191 + }
  192 +
  193 + .toolbar_button
  194 + {
  195 + --iron-icon-height: 32px;
  196 + --iron-icon-width: 32px;
  197 + }
  198 +
  199 + #finish_button
  200 + {
  201 + --iron-icon-height: 32px;
  202 + --iron-icon-width: 32px;
  203 + color: var(--paper-blue-500);
  204 + }
  205 +
  206 + .area_container
  207 + {
  208 + overflow: hidden;
  209 + margin : 0.8em;
  210 + padding : 0.8em;
  211 + }
  212 +
  213 + #fields_placeholder{
  214 + width: 40%;
  215 + height: 75vh;
  216 + position: relative;
  217 + float: left;
  218 + overflow: auto;
  219 + }
  220 +
  221 + #table_fields_container{
  222 + height: 75vh;
  223 + width: 55%;
  224 + position: relative;
  225 + float: left;
  226 + overflow: auto;
  227 + }
  228 +
  229 + #idm_fields_main_container{
  230 + position: relative;
  231 + height: 60vh;
  232 + }
  233 +
  234 + #selectedFields_main_container{
  235 + position: relative;
  236 + height: 60vh;
  237 + }
  238 +
  239 + #idm_layout_main_container{
  240 + position: relative;
  241 + height: 50vh;
  242 + }
  243 +
  244 + #comment{
  245 + position: relative;
  246 + width: 35vw;
  247 + }
  248 +
  249 + paper-menu{
  250 + width: 100%;
  251 + }
  252 +
  253 + paper-dialog {
  254 + position: fixed;
  255 + top: 16px;
  256 + width: auto;
  257 + height: auto;
  258 + overflow: auto;
  259 + padding : 30px;
  260 + }
  261 +
  262 + paper-tabs, paper-toolbar
  263 + {
  264 + background-color: var(--paper-blue-500);
  265 + color: #ffffff;
  266 + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.2);
  267 + --paper-tabs-selection-bar-color: var(--google-gray-500);
  268 + }
  269 +
  270 + paper-toolbar paper-tabs
  271 + {
  272 + box-shadow: none;
  273 + }
  274 +
  275 + paper-tabs[noink][no-bar] paper-tab.iron-selected
  276 + {
  277 + background-color: var(--google-gray-500);
  278 + }
  279 +
  280 + paper-tabs[align-bottom]
  281 + {
  282 + box-shadow: 0px -2px 6px rgba(0, 0, 0, 0.15);
  283 + }
  284 + </style>
  285 +
  286 + <iron-ajax
  287 + auto
  288 + id="data_request"
  289 + url={{dataUrl}}
  290 + verbose="true"
  291 + on-response="handleResponseData"
  292 + debounce-duration="300">
  293 + </iron-ajax>
  294 +
  295 + <iron-ajax
  296 + id="datales_list_request"
  297 + auto
  298 + url={{dataletsListUrl}}
  299 + handle-as="json"
  300 + on-response="handleResponseDatalets"
  301 + debounce-duration="300">
  302 + </iron-ajax>
  303 +
  304 + <iron-ajax
  305 + id="selectedDatalet_request"
  306 + url={{deepUrl}}
  307 + verbose="true"
  308 + on-response="handleSelectedDatalet"
  309 + debounce-duration="300">
  310 + </iron-ajax>
  311 +
  312 + <content>
  313 +
  314 + <neon-animated-pages id="pages" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">
  315 +
  316 + <neon-animatable>
  317 +
  318 + <div class="vertical justified layout">
  319 +
  320 + <div class="horizontal layout">
  321 + <div class="avatar" style="margin-left:15px">1</div>
  322 + <div class="title flex">
  323 + <div id="toolbar_title" class="big">Dataset source</div>
  324 + <div id="toolbar_description" class="small">Copy and paste/drag and drop in the textarea the url of datasource</div>
  325 + </div>
  326 + <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  327 + </div>
  328 +
  329 + <paper-material elevation="2" class="area_container">
  330 + <paper-tabs selected="{{DatasourceTabSelected}}">
  331 + <paper-tab>Select data source</paper-tab>
  332 + <paper-tab>Most popular</paper-tab>
  333 + <paper-tab>Search</paper-tab>
  334 + </paper-tabs>
  335 + <iron-pages selected="{{DatasourceTabSelected}}">
  336 + <div>
  337 + <div class="card-content">
  338 + <paper-dropdown-menu id="datasets-sources" name="datasets-sources" label="Available datasets">
  339 + <paper-menu class="dropdown-content">
  340 + <template is="dom-repeat" items="{{datasets}}" as="dataset" index-as="index">
  341 + <paper-item id="{{index}}" on-tap="_datasourceSelected">{{dataset.name}}</paper-item>
  342 + </template>
  343 + </paper-menu>
  344 + </paper-dropdown-menu>
  345 + <paper-icon-button id="infoButton" on-click="_onInfoClick" icon="info-outline" alt="Information about selected dataset" title="info-button" style="color:#9e9e9e;"></paper-icon-button>
  346 + </div>
  347 +
  348 + <div><img src="static/images/or.png" style="position: relative;left: 50%;padding-top:20px"></div>
  349 +
  350 + <div class="card-content">
  351 + <paper-textarea class="custom_textarea" id="data_url" label="Dataset api data url" floatingLabel value="{{dataUrl}}" on-dragover="_handleDatasourceDragOver"></paper-textarea>
  352 + </div>
  353 +
  354 +
  355 + </div>
  356 + <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>
  357 + <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>
  358 + </iron-pages>
  359 + </paper-material>
  360 +
  361 + </div>
  362 +
  363 + </neon-animatable>
  364 +
  365 + <neon-animatable>
  366 +
  367 + <div class="vertical justified layout">
  368 +
  369 + <div class="horizontal layout">
  370 + <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
  371 + <div class="avatar">2</div>
  372 + <div class="title flex">
  373 + <div id="toolbar_title" class="big">Dataset source</div>
  374 + <div id="toolbar_description" class="small">Select the fields you want to use for visualization from tree on the right side. The table on the left side will show you the values related to the selected fields.</div>
  375 + </div>
  376 + <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  377 + </div>
  378 +
  379 + <div class="horizontal layout">
  380 +
  381 + <paper-material elevation="2" id="fields_placeholder" class="area_container flexchild" style="min-width:300px">
  382 + <tree-view-controllet id="fields_treeview" root-name="data" opened-path="result,records"></tree-view-controllet>
  383 + </paper-material>
  384 +
  385 + <paper-material elevation="2" id="table_fields_container" class="area_container flex2child">
  386 + <div id="table_component_place_holder"></div>
  387 + </paper-material>
  388 +
  389 + </div>
  390 +
  391 + </div>
  392 +
  393 + </neon-animatable>
  394 +
  395 + <neon-animatable>
  396 +
  397 + <div class="vertical justified layout">
  398 +
  399 + <div class="horizontal layout">
  400 + <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
  401 + <div class="avatar">3</div>
  402 + <div class="title flex">
  403 + <div id="toolbar_title" class="big">Data mapping</div>
  404 + <div id="toolbar_description" class="small">Select the visualization by clicking on the button(a window will appear with all available visualization).After, drag and drop the selected fields into datalet parameters area. A preview will be shown on the right side.</div>
  405 + </div>
  406 + <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  407 + </div>
  408 +
  409 +
  410 + <div class="horizontal layout">
  411 +
  412 + <div class="">
  413 + <paper-material elevation="0" id="visualization_slider_area"></paper-material>
  414 + <paper-material elevation="2" id="fields_mapping_area" class="area_container">
  415 +
  416 + <div id="selectedFields_main_container" class="field-mapping-card">
  417 + <div class="title">
  418 + <div class="medium">Selected fields</div>
  419 + </div>
  420 + <paper-material elevation="2" id="selectedFields_container" class="area_container"></paper-material>
  421 + </div>
  422 +
  423 + <div id="idm_fields_main_container" class="field-mapping-card">
  424 + <div class="title">
  425 + <div class="medium">Datalet fields</div>
  426 + </div>
  427 + <paper-material elevation="2" id="datalet_idm_fields_container" class="area_container"></paper-material>
  428 + </div>
  429 + </paper-material>
  430 + </div>
  431 +
  432 + <div id="datalet_placeholder"></div>
  433 +
  434 + </div>
  435 +
  436 + </div>
  437 +
  438 + </neon-animatable>
  439 +
  440 + <neon-animatable>
  441 + <div class="vertical justified layout">
  442 +
  443 + <div class="horizontal layout">
  444 + <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
  445 + <div class="avatar">4</div>
  446 + <div class="title flex">
  447 + <div id="toolbar_title" class="big">Finalize visualization</div>
  448 + <div id="toolbar_description" class="small">Assign the values for layout parameters (e.g. title for you visualization) and look at the final visualization. You can also add a comment if you are in the private room. </div>
  449 + </div>
  450 + <paper-icon-button id="finish_button" on-click="_onFinish" icon="add-circle" alt="Conforms the creation" title="finish"></paper-icon-button>
  451 + </div>
  452 +
  453 + <div class="horizontal layout">
  454 + <div style="margin-top: 10px;">
  455 + <div class="title">
  456 + <div class="medium">Layout fields</div>
  457 + </div>
  458 + <paper-material elevation="2" id="idm_layout_main_container" class="area_container">
  459 + <paper-material elevation="2" id="idm_layout_container" class="area_container"></paper-material>
  460 + </paper-material>
  461 +
  462 + <div id="comment">
  463 + <paper-textarea class="custom_textarea" id="commentArea" label="Max 100 characters comment" maxlength="100"></paper-textarea>
  464 + </div>
  465 +
  466 + </div>
  467 +
  468 + <div id="datalet_placeholder_2" style="min-width: 45%;margin-top: 10px;"></div>
  469 +
  470 + </div>
  471 + </div>
  472 +
  473 + </neon-animatable>
  474 +
  475 + </neon-animated-pages>
  476 +
  477 + <paper-toast id="message" text=""></paper-toast>
  478 +
  479 + <paper-dialog id="infoDialog">
  480 + <h2 id="infoDialogTitle"></h2>
  481 + <paper-dialog-scrollable id="infoDialogContent">
  482 + </paper-dialog-scrollable>
  483 + </paper-dialog>
  484 +
  485 + </content>
  486 + </template>
  487 +
  488 + <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  489 + <script src="../../../DEEPCLIENT/js/deepClient.js"></script>
  490 +
  491 + <script>
  492 +
  493 + Polymer({
  494 +
  495 + is : 'data-sevc-controllet',
  496 +
  497 + /**
  498 + * Received when the user selects a datalet from slider.
  499 + *
  500 + * @event items-list-controllet_item-selected
  501 + */
  502 +
  503 + /**
  504 + * Received when the user drags a selected fields in to one of the source input data model field
  505 + *
  506 + * @event draggable-element-controllet_content-dragged
  507 + */
  508 +
  509 + /**
  510 + * Received when the user selects one field from treeview controllet
  511 + *
  512 + * @event treeview-controllet-fileds-selected
  513 + */
  514 +
  515 + /**
  516 + * Received when the user drags a selected fields in to one of the source input data model field
  517 + *
  518 + * @event draggable-element-controllet_content-dragged
  519 + */
  520 +
  521 + /**
  522 + * Received when the user change text value of the selected datalet layout inputs
  523 + *
  524 + * @event text-element-controllet_content-changed
  525 + */
  526 +
  527 + /**
  528 + * Fired when the user press to finish button. At this event are attached all information about the visualization currently created
  529 + *
  530 + * @event data-sevc-controllet.dataletCreated
  531 + */
  532 +
  533 + listeners : {
  534 + 'items-list-controllet_item-selected' : '_dataletSelected',
  535 + 'draggable-element-controllet_content-dragged' : '_fieldsMapped',
  536 + 'tree-view-controllet_selected-fields' : '_fieldsSelected',
  537 + 'text-element-controllet_content-changed' : '_textElementChanged'
  538 + },
  539 +
  540 + properties : {
  541 +
  542 + entryAnimation : {
  543 + type : String,
  544 + value : ""
  545 + },
  546 +
  547 + exitAnimation : {
  548 + type : String,
  549 + value : ""
  550 + },
  551 +
  552 + selected : {
  553 + type : Number,
  554 + value : 0
  555 + },
  556 +
  557 + /**
  558 + * It represents the data url from CKAN api
  559 + *
  560 + * @attribute dataUrl
  561 + * @type string
  562 + * @default 'null'
  563 + */
  564 + dataUrl : {
  565 + type : String,
  566 + value : undefined,
  567 + observer : '_dataUrlChanged'
  568 + },
  569 + /**
  570 + * It represents the DEEP url to get information about the datalets
  571 + *
  572 + * @attribute deepUrl
  573 + * @type string
  574 + * @default 'null'
  575 + */
  576 + deepUrl : {
  577 + type : String,
  578 + value : undefined
  579 + },
  580 + /**
  581 + * It's used to store the list of datalets returned from DEEP
  582 + *
  583 + * @attribute datalets_list
  584 + * @type Array
  585 + * @default empty
  586 + */
  587 + datalets_list : {
  588 + type : Array ,
  589 + value : []
  590 + },
  591 + /**
  592 + * It's used to store the selected datalet. It will be set when the controllet get the event of selection by item slider (items-list-controllet_item-selected)
  593 + *
  594 + * @attribute selectedDatalet
  595 + * @type String
  596 + * @default ''
  597 + */
  598 + selectedDatalet : {
  599 + type : String,
  600 + value : undefined
  601 + },
  602 + /**
  603 + * It's used to store the list of selected fields by user
  604 + *
  605 + * @attribute selectedFields
  606 + * @type Array
  607 + * @default empty
  608 + */
  609 + selectedFields : {
  610 + type : Array,
  611 + value : undefined
  612 + },
  613 + /**
  614 + * It contains all attributes for the datalet preset. It'll be used when the controllet is called to modify an exsting datalet.
  615 + */
  616 + dataletPreset:{
  617 + type: Object,
  618 + value: undefined
  619 + },
  620 + /**
  621 + * It's used to store the params to give to datalet. This kind of params will not processed by selection step
  622 + *
  623 + * @attribute paramsFields
  624 + * @type Object
  625 + * @default empty
  626 + */
  627 + paramsFields:{
  628 + type: Object,
  629 + value: undefined
  630 + },
  631 + /**
  632 + * It's used to store the tab index in the first pass
  633 + *
  634 + * @attribute DatasourceTabSelected
  635 + * @type Number
  636 + * @default 0
  637 + */
  638 + DatasourceTabSelected : {
  639 + type : Number,
  640 + value : 0
  641 + },
  642 + /**
  643 + * It's used to store the datasets to show in the contexual menu
  644 + *
  645 + * @attribute datasets
  646 + * @type Array
  647 + * @default empty
  648 + */
  649 + datasets :
  650 + {
  651 + type : Array,
  652 + value : []
  653 + }
  654 + },
  655 + /**
  656 + * It is called after the element�s template has been stamped and all elements inside the element�s local DOM have been configured (with values bound from parents, deserialized attributes, or else default values) and had their ready method called.
  657 + * In this phase the scrollbar will be initialized
  658 + *
  659 + * @method handleResponseData
  660 + *
  661 + * @param {Event} e
  662 + */
  663 +
  664 + ready : function(){
  665 +
  666 + $(this.$.fields_placeholder).perfectScrollbar();
  667 + $(this.$.selectedFields_main_container).perfectScrollbar();
  668 + $(this.$.idm_fields_main_container).perfectScrollbar();
  669 + $(this.$.idm_layout_main_container).perfectScrollbar();
  670 + $(this.$.table_fields_container).perfectScrollbar();
  671 +
  672 + if(this.dataletPreset != undefined) {
  673 + this.$.data_url.value = this.dataletPreset['data-url'];
  674 + this.selected = 1;
  675 + }
  676 +
  677 + //Fiefox force :O
  678 + var table_params ={
  679 + component : "datatable-datalet",
  680 + params :{
  681 + 'data-url' : this.dataUrl
  682 + },
  683 + fields : [],
  684 + placeHolder : this.$.table_component_place_holder
  685 + };
  686 +
  687 + ComponentService.deep_url = this.deepUrl;
  688 + ComponentService.getComponent(table_params);
  689 + },
  690 + /**
  691 + * Utility function to inject datalet in a placeholder
  692 + */
  693 + injectDatalet: function(place_holder){
  694 +
  695 + var datalet_params ={
  696 + component : this.selectedDatalet,
  697 + params : this.paramsFields,
  698 + fields : this.selectedFields,
  699 + placeHolder : place_holder
  700 + };
  701 + ComponentService.deep_url = this.deepUrl;
  702 + ComponentService.getComponent(datalet_params);
  703 + },
  704 +
  705 + /**
  706 + * Callback to parse the data requested when dataUrl change its value
  707 + *
  708 + * @method handleResponseData
  709 + *
  710 + * @param {Event} e
  711 + */
  712 + handleResponseData : function(e){
  713 + this.$.fields_treeview.setAttribute("json-data", JSON.stringify(e.detail.response));
  714 + this.$.fields_treeview.setAttribute("preselected-fields", JSON.stringify(this.selectedFields));
  715 + this.$.fields_treeview.ready();//chrome
  716 + },
  717 +
  718 + /**
  719 + * Callback to parse the components response object
  720 + *
  721 + * @method handleResponseDatalets
  722 + *
  723 + * @param {Event} e
  724 + */
  725 + handleResponseDatalets : function(e){
  726 + this.datalets_list = new Array();
  727 + for(var i=0;i < e.detail.response.length;i++){
  728 + var datalet_info = { name : e.detail.response[i].name ,
  729 + image : e.detail.response[i].url + e.detail.response[i].name + ".png"
  730 + };
  731 +
  732 + this.datalets_list.push(datalet_info);
  733 + }
  734 +
  735 + if(this.selectedDatalet == undefined)
  736 + this.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +
  737 + '<items-list-controllet' +
  738 + ' replace-string="-datalet"' +
  739 + ' items=\'' + JSON.stringify(this.datalets_list) + '\'>' +
  740 + '</items-list-controllet>' +
  741 + '</animated-button-container-controllet>';
  742 + else
  743 + this.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +
  744 + '<items-list-controllet' +
  745 + ' replace-string="-datalet"' +
  746 + ' selected-card=\'' + this.selectedDatalet + '\'' +
  747 + ' items=\'' + JSON.stringify(this.datalets_list) + '\'>' +
  748 + '</items-list-controllet>' +
  749 + '</animated-button-container-controllet>';
  750 +
  751 + },
  752 + /**
  753 + * Callback to dataset selection from list in the phase three. When a datalet is selected this function will build a bundle of box items, based on the datalet input data model,
  754 + * to allow user to drag the fields, from the selected fields box, and create a new visualization.
  755 + *
  756 + * @method handleSelectedDatalet
  757 + *
  758 + * @param {Event} e
  759 + */
  760 + handleSelectedDatalet : function(e){
  761 +
  762 + var response = e.detail.response;
  763 + this.$.datalet_idm_fields_container.innerHTML = "";
  764 + this.$.idm_layout_container.innerHTML = "";
  765 +
  766 + var input;
  767 + var layouts = jQuery.extend(true, {}, response.idm.inputs.layouts);
  768 +
  769 + if(response.idm.inputs.input.constructor == Object) {
  770 + if(response.idm.inputs.input.selection == "*")
  771 + {
  772 + var fields = this.$.selectedFields_container.querySelectorAll('draggable-element-controllet');
  773 + input = response.idm.inputs.input;
  774 + response.idm.inputs.input = new Array();
  775 + for(var i=0;i<fields.length;i++){
  776 + var newInput = jQuery.extend(true, {}, input);
  777 + newInput.name = input.name + ' ' + (i + 1);
  778 + response.idm.inputs.input.push(newInput);
  779 + }
  780 + }
  781 + }
  782 +
  783 + var heading;
  784 + var id;
  785 +
  786 + for(var i =0; i < response.idm.inputs.input.length; i++) {
  787 + var html = '<draggable-element-controllet is-target="true" ';
  788 + input = response.idm.inputs.input[i];
  789 +
  790 + heading = ' heading="' + input.name + '"';
  791 + id = ' id="' + (i + 1) + '"';
  792 +
  793 + html += heading + id;
  794 + html += ' description="' + input.description + '"' +
  795 + ' number="' + (i + 1) + '"';
  796 +
  797 + if(this.selectedFields != undefined) {
  798 + if(this.selectedFields[i] != undefined) {
  799 + html += ' value="' + this.selectedFields[i] + '"' +
  800 + ' label="' + this.selectedFields[i].split(",")[this.selectedFields[i].split(",").length - 1] + '"';
  801 + }
  802 + }
  803 +
  804 + html += '></draggable-element-controllet>';
  805 + this.$.datalet_idm_fields_container.innerHTML += html;
  806 +
  807 + }
  808 +
  809 + if(layouts.input != undefined) {
  810 + if(layouts.input.constructor == Object){
  811 + layouts.input = new Array(jQuery.extend(true, {}, layouts.input));
  812 + }
  813 +
  814 + html = '<text-element-controllet ';
  815 + for (var i = 0; i < layouts.input.length; i++) {
  816 + html += '<text-element-controllet heading="' + layouts.input[i].name + '" ' +
  817 + 'description="' + layouts.input[i].description + '" ' +
  818 + 'number="' + (i + 1) + '" ';
  819 + if(this.dataletPreset != undefined){
  820 + html += 'value="' + this.dataletPreset[Object.keys(this.dataletPreset)[(i + 1)]] + '"';
  821 + }
  822 +
  823 + html += '></text-element-controllet>';
  824 + }
  825 + this.$.idm_layout_container.innerHTML = html;
  826 + }
  827 +
  828 + if(this.selectedFields != undefined) this.generateDataletPreview();
  829 +
  830 + },
  831 + /**
  832 + * Generate the datalet preview when user mapped fields. it even retrieves the value of layout inputs values.
  833 + *
  834 + * @method generateDataletPreview
  835 + */
  836 + generateDataletPreview : function(){
  837 +
  838 + var input_mapped_fields = this.$.datalet_idm_fields_container.querySelectorAll('draggable-element-controllet[is-target=true]');
  839 + this.selectedFields = Array();
  840 +
  841 + for (var i = 0; i < input_mapped_fields.length; i++) {
  842 + if (input_mapped_fields[i].value != "") {
  843 + this.selectedFields.push(input_mapped_fields[i].value);
  844 + }
  845 + }
  846 +
  847 + var input_layouts_fields = this.$.idm_layout_container.querySelectorAll('text-element-controllet');
  848 + this.paramsFields = {'data-url' : this.dataUrl};
  849 +
  850 + for (var i = 0; i < input_layouts_fields.length; i++) {
  851 + if (input_layouts_fields[i].value != "") {
  852 + this.paramsFields[input_layouts_fields[i].heading] = input_layouts_fields[i].value;
  853 + }
  854 + }
  855 +
  856 + this.injectDatalet(this.$.datalet_placeholder);
  857 +
  858 + },
  859 + /**
  860 + * Validate the current pass in order to access to next one.
  861 + *
  862 + * @method validateCurrentPass
  863 + *
  864 + * @param {Number} next_selected_pass
  865 + */
  866 + validateCurrentPass : function(next_selected_pass){
  867 +
  868 + switch(next_selected_pass){
  869 + case 0:
  870 + this.$.data_url.value = "";
  871 + this.$.fields_treeview.setAttribute("json-data", null);
  872 + this.$.fields_treeview.setAttribute("preselected-fields", null);
  873 + this.$.fields_treeview.ready();//chrome
  874 + return true;
  875 + case 1:
  876 + var x = this.$.fields_treeview.getAttribute("json-data");
  877 + if(this.$.data_url.value == undefined || this.$.fields_treeview.getAttribute('json-data') == "null" || this.$.fields_treeview.getAttribute('json-data') == null){
  878 + this.$.message.text = "You have to select a dataset to access to pass 2. It's possible that the data you selected are not available.";
  879 + this.$.message.show();
  880 + return false;
  881 + }else{
  882 + return true;
  883 + }
  884 +
  885 + case 2:
  886 + if(this.selectedFields == undefined || this.selectedFields.length == 0){
  887 + this.$.message.text = "You have to select a set of fields to access to pass 3.";
  888 + this.$.message.show();
  889 + return false;
  890 + }else{
  891 + this.$.datalet_placeholder_2.innerHTML = "";
  892 + if(this.selectedDatalet != undefined) this.injectDatalet(this.$.datalet_placeholder);
  893 + return true;
  894 + }
  895 + case 3:
  896 + if(this.paramsFields == undefined){
  897 + this.$.message.text = "You have to select a datalet and map the selected fields to datalets fields(by drag and drop) to access to pass 4.";
  898 + this.$.message.show();
  899 + return false;
  900 + }else{
  901 + this.$.datalet_placeholder.innerHTML = "";
  902 + this.injectDatalet(this.$.datalet_placeholder_2);
  903 + return true;
  904 + }
  905 + }
  906 +
  907 + },
  908 + /**
  909 + * Callback for manage the previous pass button
  910 + *
  911 + * @method _onPrevClick
  912 + *
  913 + */
  914 + _onPrevClick : function() {
  915 + if(!this.validateCurrentPass(this.selected === 0 ? 0 : (this.selected - 1))) return;
  916 +
  917 + this.entryAnimation = 'slide-from-left-animation';
  918 + this.exitAnimation = 'slide-right-animation';
  919 + this.selected = this.selected === 0 ? 0 : (this.selected - 1);
  920 + },
  921 + /**
  922 + * Callback to manage the next pass button
  923 + *
  924 + * @method _onNextClick
  925 + *
  926 + */
  927 + _onNextClick : function() {
  928 +
  929 + if(!this.validateCurrentPass(this.selected === 3 ? 3 : (this.selected + 1))) return;
  930 +
  931 + this.entryAnimation = 'slide-from-right-animation';
  932 + this.exitAnimation = 'slide-left-animation';
  933 + this.selected = this.selected === 3 ? 3 : (this.selected + 1);
  934 + },
  935 + /**
  936 + * Callback to manage InfoButton click to give user information about the selected dataset
  937 + *
  938 + */
  939 + _onInfoClick : function(){
  940 +
  941 + this.$.infoDialog.open();
  942 +
  943 + },
  944 + /**
  945 + * Callback related to datasource selection from select menu
  946 + *
  947 + * @method _datasourceSelected
  948 + *
  949 + * @param {Event} e
  950 + */
  951 + _datasourceSelected : function(e){
  952 +
  953 + this.$.data_url.value = this.datasets[parseInt(e.target.id)].url;
  954 + this.$.infoDialogTitle.innerHTML = this.datasets[parseInt(e.target.id)].name;
  955 + this.$.infoDialogContent.innerHTML = this.datasets[parseInt(e.target.id)].description;
  956 +
  957 + },
  958 + /**
  959 + * Callback related to data url change
  960 + *
  961 + * @method _dataUrlChanged
  962 + *
  963 + * @param {Event} e
  964 + */
  965 + _dataUrlChanged : function(newValue, oldValue){
  966 + this.$.data_request.generateRequest();
  967 + },
  968 + /**
  969 + * Callback related to event 'items-slider-controllet_item-selected' fired by items-slider-controllet when the user selects a datalet
  970 + *
  971 + * @method _dataletSelected
  972 + *
  973 + * @param {Event} e
  974 + */
  975 + _dataletSelected : function(e){
  976 + this.selectedDatalet = e.detail.datalet;
  977 + this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet;
  978 + this.$.selectedDatalet_request.generateRequest();
  979 +
  980 + },
  981 + /**
  982 + * Callback related to event 'treeview-controllet-fileds-selected' fired by treeview-controllet when the user selects a field
  983 + *
  984 + * @method _fieldsSelected
  985 + *
  986 + * @param {Event} e
  987 + */
  988 + _fieldsSelected : function(e){
  989 +
  990 + this.selectedFields = e.detail.fields;
  991 + this.$.selectedFields_container.innerHTML = "";
  992 + for(var i=0;i<e.detail.fields.length;i++) {
  993 + this.$.selectedFields_container.innerHTML += '<draggable-element-controllet identifier="' + e.detail.fields[i] +
  994 + '" label="' + e.detail.fields[i].split(",")[e.detail.fields[i].split(",").length -1] +
  995 + '"></draggable-element-controllet><br>';
  996 + }
  997 +
  998 + var table_params ={
  999 + component : "datatable-datalet",
  1000 + params :{
  1001 + 'data-url' : this.dataUrl
  1002 + },
  1003 + fields : e.detail.fields,
  1004 + placeHolder : this.$.table_component_place_holder
  1005 + };
  1006 +
  1007 + ComponentService.deep_url = this.deepUrl;
  1008 + ComponentService.getComponent(table_params);
  1009 +
  1010 +
  1011 + },
  1012 + /**
  1013 + * Callback related to event 'draggable-element-controllet_content-dragged' fired by draggable-element-controllet when the user drags a selected field in to input data model field
  1014 + *
  1015 + * @method _fieldsMapped
  1016 + *
  1017 + * @param {Event} e
  1018 + */
  1019 + _fieldsMapped : function(e){
  1020 +
  1021 + this.generateDataletPreview();
  1022 +
  1023 + },
  1024 + /**
  1025 + * Callback related to event 'text-element-controllet_content-changed' fired by text-element-controllet when the user change the value of text
  1026 + *
  1027 + * @method _textElementChanged
  1028 + *
  1029 + * @param {Event} e
  1030 + */
  1031 + _textElementChanged : function(e){
  1032 + if(this.selected == 3) {
  1033 + this.generateDataletPreview();
  1034 + this.$.datalet_placeholder.innerHTML = "";
  1035 + this.injectDatalet(this.$.datalet_placeholder_2);
  1036 + }
  1037 + },
  1038 + /**
  1039 + * Callback related to the drag operation in the dataUrl input area. It's used to delete previous value.
  1040 + *
  1041 + * @method _handleDatasourceDragOver
  1042 + *
  1043 + * @param {Event} e
  1044 + */
  1045 + _handleDatasourceDragOver : function(e){
  1046 + this.$.data_url.value = "";
  1047 + },
  1048 + /**
  1049 + * Callback related to the finish button.
  1050 + *
  1051 + * @method _onFinish
  1052 + *
  1053 + * @param {Event} e
  1054 + */
  1055 + _onFinish : function(e){
  1056 +
  1057 + if((this.selectedFields.length == 0) || this.selectedDatalet == ""){
  1058 + this.$.message.text = "You have to map the selected fields with datalets fields(by dragging) and select a datalet to export a new visualization.";
  1059 + this.$.message.show();
  1060 + return;
  1061 + }
  1062 +
  1063 + var data = {
  1064 + dataUrl : this.dataUrl,
  1065 + params : this.paramsFields,
  1066 + fields : this.selectedFields,
  1067 + datalet : this.selectedDatalet,
  1068 + comment : this.$.commentArea.value,
  1069 + staticData : JSON.stringify(this.$.datalet_placeholder_2.children[1].behavior.data)
  1070 + }
  1071 +
  1072 + this.fire('data-sevc-controllet.dataletCreated', {data : data});
  1073 +
  1074 + }
  1075 +
  1076 + });
  1077 +
  1078 + </script>
  1079 +
  1080 +</dom-module>
0 1081 \ No newline at end of file
... ...
controllets/data-sevc-controllet/data-sevc-controllet.html
... ... @@ -2,7 +2,7 @@
2 2 @license
3 3 The MIT License (MIT)
4 4  
5   - Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy
  5 + Copyright (c) 2015 Dipartimento di Informatica - Universit� di Salerno - Italy
6 6  
7 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 8 of this software and associated documentation files (the "Software"), to deal
... ... @@ -54,8 +54,10 @@
54 54 <link rel="import" href="../items-list-controllet/item-list-controllet.html">
55 55 <link rel="import" href="../draggable-element-controllet/draggable-element-controllet.html">
56 56 <link rel="import" href="../tree-view-controllet/tree-view-controllet.html">
  57 +<link rel="import" href="../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html">
57 58 <link rel="import" href="../text-element-controllet/text-element-controllet.html">
58 59 <link rel="import" href="../animated-button-container-controllet/animated-button-container-controllet.html">
  60 +<link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">
59 61  
60 62 <!--
61 63 The `data-sevc-controllet` is a controllet to generate visualization from a dataset accessible through api. A json response is required.
... ... @@ -80,409 +82,426 @@ Example:
80 82  
81 83  
82 84 <dom-module id="data-sevc-controllet">
83   - <template>
84   - <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  85 + <template>
  86 + <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
85 87  
86   - <style is="custom-style">
  88 + <style is="custom-style">
87 89  
88   - ::content body {
89   - font-family: 'Roboto', sans-serif;
90   - }
  90 + ::content body {
  91 + font-family: 'Roboto', sans-serif;
  92 + }
91 93  
92   - .flexchild
93   - {
94   - @apply(--layout-flex);
95   - }
  94 + .flexchild
  95 + {
  96 + @apply(--layout-flex);
  97 + }
96 98  
97   - .flex2child
98   - {
99   - @apply(--layout-flex-2);
100   - }
  99 + .flex2child
  100 + {
  101 + @apply(--layout-flex-2);
  102 + }
101 103  
102   - .avatar
103   - {
104   - display: inline-block;
105   - height: 2em;
106   - width: 2em;
107   - border-radius: 50%;
108   - background: var(--paper-blue-500);
109   - color: white;
110   - line-height: 2em;
111   - font-size: 1.87em;
112   - text-align: center;
113   - }
  104 + .avatar
  105 + {
  106 + display: inline-block;
  107 + height: 2em;
  108 + width: 2em;
  109 + border-radius: 50%;
  110 + background: var(--paper-blue-500);
  111 + color: white;
  112 + line-height: 2em;
  113 + font-size: 1.87em;
  114 + text-align: center;
  115 + }
114 116  
115   - .title
116   - {
117   - position: relative;
118   - top: 0.60vh;
119   - margin-left: 20px;
120   - }
  117 + .title
  118 + {
  119 + position: relative;
  120 + top: 0.60vh;
  121 + margin-left: 20px;
  122 + }
121 123  
122   - .big
123   - {
124   - font-size: 1.37em;
125   - color: var(--google-grey-500);
126   - }
  124 + .big
  125 + {
  126 + font-size: 1.37em;
  127 + color: var(--google-grey-500);
  128 + }
127 129  
128   - .medium
129   - {
130   - font-size: 1em;
131   - padding-bottom: 0.5em;
132   - color : #000000;
133   - font-weight: bold;
134   - }
  130 + .medium
  131 + {
  132 + font-size: 1em;
  133 + padding-bottom: 0.5em;
  134 + color : #000000;
  135 + font-weight: bold;
  136 + }
135 137  
136   - .small
137   - {
138   - font-size: 0.8em;
139   - padding-top: 10px;
140   - color: var(--paper-blue-500);
141   - font-weight: bold;
142   - }
  138 + .small
  139 + {
  140 + font-size: 0.8em;
  141 + padding-top: 10px;
  142 + color: var(--paper-blue-500);
  143 + font-weight: bold;
  144 + }
143 145  
144   - paper-input
145   - {
146   - width: 80%;
147   - }
  146 + paper-input
  147 + {
  148 + width: 80%;
  149 + }
148 150  
149   - paper-dropdown-menu
150   - {
151   - text-align: left;
152   - margin: auto;
153   - width: 100%;
154   - }
  151 + paper-dropdown-menu
  152 + {
  153 + text-align: left;
  154 + margin: auto;
  155 + width: 100%;
  156 + }
155 157  
156   - ::content paper-menu-button
157   - {
158   - display: block;
159   - width: 100%;
160   - }
  158 + ::content paper-menu-button
  159 + {
  160 + display: block;
  161 + width: 100%;
  162 + }
161 163  
162   - #visualization_slider_area
163   - {
164   - padding-top: 20px;
165   - overflow: visible;
166   - }
  164 + #visualization_slider_area
  165 + {
  166 + padding-top: 20px;
  167 + overflow: visible;
  168 + }
167 169  
168   - #fields_mapping_area
169   - {
170   - min-width: 670px;
171   - min-height: 180px;
172   - }
  170 + #fields_mapping_area
  171 + {
  172 + min-width: 670px;
  173 + min-height: 180px;
  174 + }
173 175  
174   - #datalet_placeholder
175   - {
176   - height: 60vh;
177   - min-height: 60vh;
178   - min-width: 45%;
179   - margin-top:10px;
180   - }
  176 + #datalet_placeholder
  177 + {
  178 + height: 60vh;
  179 + min-height: 60vh;
  180 + min-width: 45%;
  181 + margin-top:10px;
  182 + }
181 183  
182   - .datalet_right_container
183   - {
184   - width: 100vh;
185   - }
  184 + .datalet_right_container
  185 + {
  186 + width: 100vh;
  187 + }
186 188  
187   - .field-mapping-card
188   - {
189   - width: 50%;
190   - float: left;
191   - }
  189 + .field-mapping-card
  190 + {
  191 + width: 50%;
  192 + float: left;
  193 + }
192 194  
193   - .toolbar_button
194   - {
195   - --iron-icon-height: 32px;
196   - --iron-icon-width: 32px;
197   - }
  195 + .toolbar_button
  196 + {
  197 + --iron-icon-height: 32px;
  198 + --iron-icon-width: 32px;
  199 + }
198 200  
199   - #finish_button
200   - {
201   - --iron-icon-height: 32px;
202   - --iron-icon-width: 32px;
203   - color: var(--paper-blue-500);
204   - }
  201 + #finish_button
  202 + {
  203 + --iron-icon-height: 32px;
  204 + --iron-icon-width: 32px;
  205 + color: var(--paper-blue-500);
  206 + }
205 207  
206   - .area_container
207   - {
208   - overflow: hidden;
209   - margin : 0.8em;
210   - padding : 0.8em;
211   - }
  208 + .area_container
  209 + {
  210 + overflow: hidden;
  211 + margin : 0.8em;
  212 + padding : 0.8em;
  213 + }
212 214  
213   - #fields_placeholder{
214   - width: 40%;
215   - height: 75vh;
216   - position: relative;
217   - float: left;
218   - overflow: auto;
219   - }
  215 + /*#fields_placeholder{*/
  216 + /*width: 40%;*/
  217 + /*height: 75vh;*/
  218 + /*position: relative;*/
  219 + /*float: left;*/
  220 + /*overflow: auto;*/
  221 + /*}*/
  222 +
  223 + #fields_placeholder{
  224 + width: 100%;
  225 + /*height: 75vh;*/
  226 + /*position: relative;*/
  227 + /*float: right;*/
  228 + /*overflow: auto;*/
  229 + }
220 230  
221   - #table_fields_container{
222   - height: 75vh;
223   - width: 55%;
224   - position: relative;
225   - float: left;
226   - overflow: auto;
227   - }
  231 + #table_fields_container{
  232 + height: 75vh;
  233 + width: 55%;
  234 + position: relative;
  235 + float: left;
  236 + overflow: auto;
  237 + }
228 238  
229   - #idm_fields_main_container{
230   - position: relative;
231   - height: 60vh;
232   - }
  239 + #idm_fields_main_container{
  240 + position: relative;
  241 + height: 60vh;
  242 + }
233 243  
234   - #selectedFields_main_container{
235   - position: relative;
236   - height: 60vh;
237   - }
  244 + #selectedFields_main_container{
  245 + position: relative;
  246 + height: 60vh;
  247 + }
238 248  
239   - #idm_layout_main_container{
240   - position: relative;
241   - height: 50vh;
242   - }
  249 + #idm_layout_main_container{
  250 + position: relative;
  251 + height: 50vh;
  252 + }
243 253  
244   - #comment{
245   - position: relative;
246   - width: 35vw;
247   - }
  254 + #comment{
  255 + position: relative;
  256 + width: 35vw;
  257 + }
248 258  
249   - paper-menu{
250   - width: 100%;
251   - }
  259 + paper-menu{
  260 + width: 100%;
  261 + }
252 262  
253   - paper-dialog {
254   - position: fixed;
255   - top: 16px;
256   - width: auto;
257   - height: auto;
258   - overflow: auto;
259   - padding : 30px;
260   - }
  263 + paper-dialog {
  264 + position: fixed;
  265 + top: 16px;
  266 + width: auto;
  267 + height: auto;
  268 + overflow: auto;
  269 + padding : 30px;
  270 + }
261 271  
262   - paper-tabs, paper-toolbar
263   - {
264   - background-color: var(--paper-blue-500);
265   - color: #ffffff;
266   - box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.2);
267   - --paper-tabs-selection-bar-color: var(--google-gray-500);
268   - }
269   -
270   - paper-toolbar paper-tabs
271   - {
272   - box-shadow: none;
273   - }
274   -
275   - paper-tabs[noink][no-bar] paper-tab.iron-selected
276   - {
277   - background-color: var(--google-gray-500);
278   - }
279   -
280   - paper-tabs[align-bottom]
281   - {
282   - box-shadow: 0px -2px 6px rgba(0, 0, 0, 0.15);
283   - }
284   - </style>
285   -
286   - <iron-ajax
287   - auto
288   - id="data_request"
289   - url={{dataUrl}}
290   - verbose="true"
291   - on-response="handleResponseData"
292   - debounce-duration="300">
293   - </iron-ajax>
294   -
295   - <iron-ajax
296   - id="datales_list_request"
297   - auto
298   - url={{dataletsListUrl}}
299   - handle-as="json"
300   - on-response="handleResponseDatalets"
301   - debounce-duration="300">
302   - </iron-ajax>
303   -
304   - <iron-ajax
305   - id="selectedDatalet_request"
306   - url={{deepUrl}}
307   - verbose="true"
308   - on-response="handleSelectedDatalet"
309   - debounce-duration="300">
310   - </iron-ajax>
311   -
312   - <content>
313   -
314   - <neon-animated-pages id="pages" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">
315   -
316   - <neon-animatable>
317   -
318   - <div class="vertical justified layout">
319   -
320   - <div class="horizontal layout">
321   - <div class="avatar" style="margin-left:15px">1</div>
322   - <div class="title flex">
323   - <div id="toolbar_title" class="big">Dataset source</div>
324   - <div id="toolbar_description" class="small">Copy and paste/drag and drop in the textarea the url of datasource</div>
325   - </div>
326   - <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
327   - </div>
  272 + paper-tabs, paper-toolbar
  273 + {
  274 + background-color: var(--paper-blue-500);
  275 + color: #ffffff;
  276 + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.2);
  277 + --paper-tabs-selection-bar-color: var(--google-gray-500);
  278 + }
328 279  
329   - <paper-material elevation="2" class="area_container">
330   - <paper-tabs selected="{{DatasourceTabSelected}}">
331   - <paper-tab>Select data source</paper-tab>
332   - <paper-tab>Most popular</paper-tab>
333   - <paper-tab>Search</paper-tab>
334   - </paper-tabs>
335   - <iron-pages selected="{{DatasourceTabSelected}}">
336   - <div>
337   - <div class="card-content">
338   - <paper-dropdown-menu id="datasets-sources" name="datasets-sources" label="Available datasets">
339   - <paper-menu class="dropdown-content">
340   - <template is="dom-repeat" items="{{datasets}}" as="dataset" index-as="index">
341   - <paper-item id="{{index}}" on-tap="_datasourceSelected">{{dataset.name}}</paper-item>
342   - </template>
343   - </paper-menu>
344   - </paper-dropdown-menu>
345   - <paper-icon-button id="infoButton" on-click="_onInfoClick" icon="info-outline" alt="Information about selected dataset" title="info-button" style="color:#9e9e9e;"></paper-icon-button>
346   - </div>
  280 + paper-toolbar paper-tabs
  281 + {
  282 + box-shadow: none;
  283 + }
347 284  
348   - <div><img src="static/images/or.png" style="position: relative;left: 50%;padding-top:20px"></div>
  285 + paper-tabs[noink][no-bar] paper-tab.iron-selected
  286 + {
  287 + background-color: var(--google-gray-500);
  288 + }
349 289  
350   - <div class="card-content">
351   - <paper-textarea class="custom_textarea" id="data_url" label="Dataset api data url" floatingLabel value="{{dataUrl}}" on-dragover="_handleDatasourceDragOver"></paper-textarea>
352   - </div>
  290 + paper-tabs[align-bottom]
  291 + {
  292 + box-shadow: 0px -2px 6px rgba(0, 0, 0, 0.15);
  293 + }
  294 + </style>
  295 +
  296 + <iron-ajax
  297 + auto
  298 + id="data_request"
  299 + url={{dataUrl}}
  300 + verbose="true"
  301 + on-response="handleResponseData"
  302 + debounce-duration="300">
  303 + </iron-ajax>
  304 +
  305 + <iron-ajax
  306 + id="datales_list_request"
  307 + auto
  308 + url={{dataletsListUrl}}
  309 + handle-as="json"
  310 + on-response="handleResponseDatalets"
  311 + debounce-duration="300">
  312 + </iron-ajax>
  313 +
  314 + <iron-ajax
  315 + id="selectedDatalet_request"
  316 + url={{deepUrl}}
  317 + verbose="true"
  318 + on-response="handleSelectedDatalet"
  319 + debounce-duration="300">
  320 + </iron-ajax>
  321 +
  322 + <content>
  323 +
  324 + <neon-animated-pages id="pages" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">
  325 +
  326 + <neon-animatable>
  327 +
  328 + <div class="vertical justified layout">
  329 +
  330 + <div class="horizontal layout">
  331 + <div class="avatar" style="margin-left:15px">1</div>
  332 + <div class="title flex">
  333 + <div id="toolbar_title" class="big">Dataset source</div>
  334 + <div id="toolbar_description" class="small">Copy and paste/drag and drop in the textarea the url of datasource</div>
  335 + </div>
  336 + <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  337 + </div>
  338 +
  339 + <paper-material elevation="2" class="area_container">
  340 + <paper-tabs selected="{{DatasourceTabSelected}}">
  341 + <paper-tab>Select data source</paper-tab>
  342 + <paper-tab>Tree Map Search</paper-tab>
  343 + <paper-tab>Most popular</paper-tab>
  344 + </paper-tabs>
  345 + <iron-pages selected="{{DatasourceTabSelected}}">
  346 + <div>
  347 + <div class="card-content">
  348 + <paper-dropdown-menu id="datasets-sources" name="datasets-sources" label="Available datasets">
  349 + <paper-menu class="dropdown-content">
  350 + <template is="dom-repeat" items="{{datasets}}" as="dataset" index-as="index">
  351 + <paper-item id="{{index}}" on-tap="_datasourceSelected">{{dataset.name}}</paper-item>
  352 + </template>
  353 + </paper-menu>
  354 + </paper-dropdown-menu>
  355 + <paper-icon-button id="infoButton" on-click="_onInfoClick" icon="info-outline" alt="Information about selected dataset" title="info-button" style="color:#9e9e9e;"></paper-icon-button>
  356 + </div>
353 357  
  358 + <div><img src="static/images/or.png" style="position: relative;left: 50%;padding-top:20px"></div>
354 359  
  360 + <div class="card-content">
  361 + <paper-textarea class="custom_textarea" id="data_url" label="Dataset api data url" floatingLabel value="{{dataUrl}}" on-dragover="_handleDatasourceDragOver"></paper-textarea>
355 362 </div>
356   - <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>
357   - <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>
358   - </iron-pages>
359   - </paper-material>
360 363  
361   - </div>
362 364  
363   - </neon-animatable>
  365 + </div>
  366 + <!--<div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>-->
  367 + <div>
  368 + <datasetexplorer-datalet class="datasetexplorer" data-url="/openwall/api/datasetTree" fields='["result,provider_name","result,organization_name","result,package_name","result,resource_name","result,url","result,w"]'></datasetexplorer-datalet>
  369 + </div>
  370 + <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>
  371 + </iron-pages>
  372 + </paper-material>
364 373  
365   - <neon-animatable>
  374 + </div>
366 375  
367   - <div class="vertical justified layout">
  376 + </neon-animatable>
368 377  
369   - <div class="horizontal layout">
370   - <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
371   - <div class="avatar">2</div>
372   - <div class="title flex">
373   - <div id="toolbar_title" class="big">Dataset source</div>
374   - <div id="toolbar_description" class="small">Select the fields you want to use for visualization from tree on the right side. The table on the left side will show you the values related to the selected fields.</div>
375   - </div>
376   - <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  378 + <neon-animatable>
  379 +
  380 + <div class="vertical justified layout">
  381 +
  382 + <div class="horizontal layout">
  383 + <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
  384 + <div class="avatar">2</div>
  385 + <div class="title flex">
  386 + <div id="toolbar_title" class="big">Dataset source</div>
  387 + <div id="toolbar_description" class="small">Select the fields you want to use for visualization from tree on the right side. The table on the left side will show you the values related to the selected fields.</div>
377 388 </div>
  389 + <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  390 + </div>
378 391  
379   - <div class="horizontal layout">
  392 + <div class="horizontal layout">
380 393  
381   - <paper-material elevation="2" id="fields_placeholder" class="area_container flexchild" style="min-width:300px">
382   - <tree-view-controllet id="fields_treeview" root-name="data" opened-path="result,records"></tree-view-controllet>
383   - </paper-material>
  394 + <!--<paper-material elevation="2" id="fields_placeholder" class="area_container flexchild" style="min-width:300px">-->
  395 + <!--<tree-view-controllet id="fields_treeview" root-name="data" opened-path="result,records"></tree-view-controllet>-->
  396 + <!--</paper-material>-->
384 397  
385   - <paper-material elevation="2" id="table_fields_container" class="area_container flex2child">
386   - <div id="table_component_place_holder"></div>
387   - </paper-material>
  398 + <!--<paper-material elevation="2" id="table_fields_container" class="area_container flex2child">-->
  399 + <!--<div id="table_component_place_holder"></div>-->
  400 + <!--</paper-material>-->
388 401  
  402 + <!--<paper-material elevation="2" id="fields_placeholder" class="area_container flexchild" style="min-width:300px">-->
  403 + <div id="fields_placeholder">
  404 + <tree-view-multi-table-controllet id="fields_treeview" root-name="data" opened-path="result,records" data-url={{dataUrl}}></tree-view-multi-table-controllet>
389 405 </div>
  406 + <!--</paper-material>-->
390 407  
391 408 </div>
392 409  
393   - </neon-animatable>
  410 + </div>
394 411  
395   - <neon-animatable>
  412 + </neon-animatable>
396 413  
397   - <div class="vertical justified layout">
  414 + <neon-animatable>
398 415  
399   - <div class="horizontal layout">
400   - <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
401   - <div class="avatar">3</div>
402   - <div class="title flex">
403   - <div id="toolbar_title" class="big">Data mapping</div>
404   - <div id="toolbar_description" class="small">Select the visualization by clicking on the button(a window will appear with all available visualization).After, drag and drop the selected fields into datalet parameters area. A preview will be shown on the right side.</div>
405   - </div>
406   - <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  416 + <div class="vertical justified layout">
  417 +
  418 + <div class="horizontal layout">
  419 + <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
  420 + <div class="avatar">3</div>
  421 + <div class="title flex">
  422 + <div id="toolbar_title" class="big">Data mapping</div>
  423 + <div id="toolbar_description" class="small">Select the visualization by clicking on the button(a window will appear with all available visualization).After, drag and drop the selected fields into datalet parameters area. A preview will be shown on the right side.</div>
407 424 </div>
  425 + <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>
  426 + </div>
408 427  
409 428  
410   - <div class="horizontal layout">
  429 + <div class="horizontal layout">
411 430  
412   - <div class="">
413   - <paper-material elevation="0" id="visualization_slider_area"></paper-material>
414   - <paper-material elevation="2" id="fields_mapping_area" class="area_container">
  431 + <div class="">
  432 + <paper-material elevation="0" id="visualization_slider_area"></paper-material>
  433 + <paper-material elevation="2" id="fields_mapping_area" class="area_container">
415 434  
416   - <div id="selectedFields_main_container" class="field-mapping-card">
417   - <div class="title">
418   - <div class="medium">Selected fields</div>
419   - </div>
420   - <paper-material elevation="2" id="selectedFields_container" class="area_container"></paper-material>
  435 + <div id="selectedFields_main_container" class="field-mapping-card">
  436 + <div class="title">
  437 + <div class="medium">Selected fields</div>
421 438 </div>
  439 + <paper-material elevation="2" id="selectedFields_container" class="area_container"></paper-material>
  440 + </div>
422 441  
423   - <div id="idm_fields_main_container" class="field-mapping-card">
424   - <div class="title">
425   - <div class="medium">Datalet fields</div>
426   - </div>
427   - <paper-material elevation="2" id="datalet_idm_fields_container" class="area_container"></paper-material>
  442 + <div id="idm_fields_main_container" class="field-mapping-card">
  443 + <div class="title">
  444 + <div class="medium">Datalet fields</div>
428 445 </div>
429   - </paper-material>
430   - </div>
431   -
432   - <div id="datalet_placeholder"></div>
433   -
  446 + <paper-material elevation="2" id="datalet_idm_fields_container" class="area_container"></paper-material>
  447 + </div>
  448 + </paper-material>
434 449 </div>
435 450  
436   - </div>
  451 + <div id="datalet_placeholder"></div>
437 452  
438   - </neon-animatable>
  453 + </div>
439 454  
440   - <neon-animatable>
441   - <div class="vertical justified layout">
  455 + </div>
442 456  
443   - <div class="horizontal layout">
444   - <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
445   - <div class="avatar">4</div>
446   - <div class="title flex">
447   - <div id="toolbar_title" class="big">Finalize visualization</div>
448   - <div id="toolbar_description" class="small">Assign the values for layout parameters (e.g. title for you visualization) and look at the final visualization. You can also add a comment if you are in the private room. </div>
449   - </div>
450   - <paper-icon-button id="finish_button" on-click="_onFinish" icon="add-circle" alt="Conforms the creation" title="finish"></paper-icon-button>
451   - </div>
  457 + </neon-animatable>
452 458  
453   - <div class="horizontal layout">
454   - <div style="margin-top: 10px;">
455   - <div class="title">
456   - <div class="medium">Layout fields</div>
457   - </div>
458   - <paper-material elevation="2" id="idm_layout_main_container" class="area_container">
459   - <paper-material elevation="2" id="idm_layout_container" class="area_container"></paper-material>
460   - </paper-material>
  459 + <neon-animatable>
  460 + <div class="vertical justified layout">
461 461  
462   - <div id="comment">
463   - <paper-textarea class="custom_textarea" id="commentArea" label="Max 100 characters comment" maxlength="100"></paper-textarea>
464   - </div>
  462 + <div class="horizontal layout">
  463 + <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>
  464 + <div class="avatar">4</div>
  465 + <div class="title flex">
  466 + <div id="toolbar_title" class="big">Finalize visualization</div>
  467 + <div id="toolbar_description" class="small">Assign the values for layout parameters (e.g. title for you visualization) and look at the final visualization. You can also add a comment if you are in the private room. </div>
  468 + </div>
  469 + <paper-icon-button id="finish_button" on-click="_onFinish" icon="add-circle" alt="Conforms the creation" title="finish"></paper-icon-button>
  470 + </div>
465 471  
  472 + <div class="horizontal layout">
  473 + <div style="margin-top: 10px;">
  474 + <div class="title">
  475 + <div class="medium">Layout fields</div>
466 476 </div>
  477 + <paper-material elevation="2" id="idm_layout_main_container" class="area_container">
  478 + <paper-material elevation="2" id="idm_layout_container" class="area_container"></paper-material>
  479 + </paper-material>
467 480  
468   - <div id="datalet_placeholder_2" style="min-width: 45%;margin-top: 10px;"></div>
  481 + <div id="comment">
  482 + <paper-textarea class="custom_textarea" id="commentArea" label="Max 100 characters comment" maxlength="100"></paper-textarea>
  483 + </div>
469 484  
470 485 </div>
  486 +
  487 + <div id="datalet_placeholder_2" style="min-width: 45%;margin-top: 10px;"></div>
  488 +
471 489 </div>
  490 + </div>
472 491  
473   - </neon-animatable>
  492 + </neon-animatable>
474 493  
475   - </neon-animated-pages>
  494 + </neon-animated-pages>
476 495  
477   - <paper-toast id="message" text=""></paper-toast>
  496 + <paper-toast id="message" text=""></paper-toast>
478 497  
479   - <paper-dialog id="infoDialog">
480   - <h2 id="infoDialogTitle"></h2>
481   - <paper-dialog-scrollable id="infoDialogContent">
482   - </paper-dialog-scrollable>
483   - </paper-dialog>
  498 + <paper-dialog id="infoDialog">
  499 + <h2 id="infoDialogTitle"></h2>
  500 + <paper-dialog-scrollable id="infoDialogContent">
  501 + </paper-dialog-scrollable>
  502 + </paper-dialog>
484 503  
485   - </content>
  504 + </content>
486 505 </template>
487 506  
488 507 <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
... ... @@ -534,7 +553,8 @@ Example:
534 553 'items-list-controllet_item-selected' : '_dataletSelected',
535 554 'draggable-element-controllet_content-dragged' : '_fieldsMapped',
536 555 'tree-view-controllet_selected-fields' : '_fieldsSelected',
537   - 'text-element-controllet_content-changed' : '_textElementChanged'
  556 + 'text-element-controllet_content-changed' : '_textElementChanged',
  557 + 'datasetexplorer-datalet_data-url': '_selectDataUrl_treeMap'
538 558 },
539 559  
540 560 properties : {
... ... @@ -625,8 +645,8 @@ Example:
625 645 * @default empty
626 646 */
627 647 paramsFields:{
628   - type: Object,
629   - value: undefined
  648 + type: Object,
  649 + value: undefined
630 650 },
631 651 /**
632 652 * It's used to store the tab index in the first pass
... ... @@ -653,7 +673,7 @@ Example:
653 673 }
654 674 },
655 675 /**
656   - * It is called after the element’s template has been stamped and all elements inside the element’s local DOM have been configured (with values bound from parents, deserialized attributes, or else default values) and had their ready method called.
  676 + * It is called after the element�s template has been stamped and all elements inside the element�s local DOM have been configured (with values bound from parents, deserialized attributes, or else default values) and had their ready method called.
657 677 * In this phase the scrollbar will be initialized
658 678 *
659 679 * @method handleResponseData
... ... @@ -663,7 +683,7 @@ Example:
663 683  
664 684 ready : function(){
665 685  
666   - $(this.$.fields_placeholder).perfectScrollbar();
  686 +// $(this.$.fields_placeholder).perfectScrollbar();
667 687 $(this.$.selectedFields_main_container).perfectScrollbar();
668 688 $(this.$.idm_fields_main_container).perfectScrollbar();
669 689 $(this.$.idm_layout_main_container).perfectScrollbar();
... ... @@ -726,19 +746,19 @@ Example:
726 746 this.datalets_list = new Array();
727 747 for(var i=0;i < e.detail.response.length;i++){
728 748 var datalet_info = { name : e.detail.response[i].name ,
729   - image : e.detail.response[i].url + e.detail.response[i].name + ".png"
  749 + image : e.detail.response[i].url + e.detail.response[i].name + ".png"
730 750 };
731 751  
732 752 this.datalets_list.push(datalet_info);
733 753 }
734 754  
735 755 if(this.selectedDatalet == undefined)
736   - this.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +
737   - '<items-list-controllet' +
738   - ' replace-string="-datalet"' +
739   - ' items=\'' + JSON.stringify(this.datalets_list) + '\'>' +
740   - '</items-list-controllet>' +
741   - '</animated-button-container-controllet>';
  756 + this.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +
  757 + '<items-list-controllet' +
  758 + ' replace-string="-datalet"' +
  759 + ' items=\'' + JSON.stringify(this.datalets_list) + '\'>' +
  760 + '</items-list-controllet>' +
  761 + '</animated-button-container-controllet>';
742 762 else
743 763 this.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +
744 764 '<items-list-controllet' +
... ... @@ -759,73 +779,73 @@ Example:
759 779 */
760 780 handleSelectedDatalet : function(e){
761 781  
762   - var response = e.detail.response;
763   - this.$.datalet_idm_fields_container.innerHTML = "";
764   - this.$.idm_layout_container.innerHTML = "";
765   -
766   - var input;
767   - var layouts = jQuery.extend(true, {}, response.idm.inputs.layouts);
768   -
769   - if(response.idm.inputs.input.constructor == Object) {
770   - if(response.idm.inputs.input.selection == "*")
771   - {
772   - var fields = this.$.selectedFields_container.querySelectorAll('draggable-element-controllet');
773   - input = response.idm.inputs.input;
774   - response.idm.inputs.input = new Array();
775   - for(var i=0;i<fields.length;i++){
776   - var newInput = jQuery.extend(true, {}, input);
777   - newInput.name = input.name + ' ' + (i + 1);
778   - response.idm.inputs.input.push(newInput);
779   - }
780   - }
781   - }
782   -
783   - var heading;
784   - var id;
785   -
786   - for(var i =0; i < response.idm.inputs.input.length; i++) {
787   - var html = '<draggable-element-controllet is-target="true" ';
788   - input = response.idm.inputs.input[i];
789   -
790   - heading = ' heading="' + input.name + '"';
791   - id = ' id="' + (i + 1) + '"';
792   -
793   - html += heading + id;
794   - html += ' description="' + input.description + '"' +
795   - ' number="' + (i + 1) + '"';
796   -
797   - if(this.selectedFields != undefined) {
798   - if(this.selectedFields[i] != undefined) {
799   - html += ' value="' + this.selectedFields[i] + '"' +
800   - ' label="' + this.selectedFields[i].split(",")[this.selectedFields[i].split(",").length - 1] + '"';
801   - }
802   - }
803   -
804   - html += '></draggable-element-controllet>';
805   - this.$.datalet_idm_fields_container.innerHTML += html;
806   -
807   - }
808   -
809   - if(layouts.input != undefined) {
810   - if(layouts.input.constructor == Object){
811   - layouts.input = new Array(jQuery.extend(true, {}, layouts.input));
812   - }
813   -
814   - html = '<text-element-controllet ';
815   - for (var i = 0; i < layouts.input.length; i++) {
816   - html += '<text-element-controllet heading="' + layouts.input[i].name + '" ' +
817   - 'description="' + layouts.input[i].description + '" ' +
818   - 'number="' + (i + 1) + '" ';
819   - if(this.dataletPreset != undefined){
820   - html += 'value="' + this.dataletPreset[Object.keys(this.dataletPreset)[(i + 1)]] + '"';
821   - }
822   -
823   - html += '></text-element-controllet>';
824   - }
825   - this.$.idm_layout_container.innerHTML = html;
826   - }
827   -
828   - if(this.selectedFields != undefined) this.generateDataletPreview();
  782 + var response = e.detail.response;
  783 + this.$.datalet_idm_fields_container.innerHTML = "";
  784 + this.$.idm_layout_container.innerHTML = "";
  785 +
  786 + var input;
  787 + var layouts = jQuery.extend(true, {}, response.idm.inputs.layouts);
  788 +
  789 + if(response.idm.inputs.input.constructor == Object) {
  790 + if(response.idm.inputs.input.selection == "*")
  791 + {
  792 + var fields = this.$.selectedFields_container.querySelectorAll('draggable-element-controllet');
  793 + input = response.idm.inputs.input;
  794 + response.idm.inputs.input = new Array();
  795 + for(var i=0;i<fields.length;i++){
  796 + var newInput = jQuery.extend(true, {}, input);
  797 + newInput.name = input.name + ' ' + (i + 1);
  798 + response.idm.inputs.input.push(newInput);
  799 + }
  800 + }
  801 + }
  802 +
  803 + var heading;
  804 + var id;
  805 +
  806 + for(var i =0; i < response.idm.inputs.input.length; i++) {
  807 + var html = '<draggable-element-controllet is-target="true" ';
  808 + input = response.idm.inputs.input[i];
  809 +
  810 + heading = ' heading="' + input.name + '"';
  811 + id = ' id="' + (i + 1) + '"';
  812 +
  813 + html += heading + id;
  814 + html += ' description="' + input.description + '"' +
  815 + ' number="' + (i + 1) + '"';
  816 +
  817 + if(this.selectedFields != undefined) {
  818 + if(this.selectedFields[i] != undefined) {
  819 + html += ' value="' + this.selectedFields[i] + '"' +
  820 + ' label="' + this.selectedFields[i].split(",")[this.selectedFields[i].split(",").length - 1] + '"';
  821 + }
  822 + }
  823 +
  824 + html += '></draggable-element-controllet>';
  825 + this.$.datalet_idm_fields_container.innerHTML += html;
  826 +
  827 + }
  828 +
  829 + if(layouts.input != undefined) {
  830 + if(layouts.input.constructor == Object){
  831 + layouts.input = new Array(jQuery.extend(true, {}, layouts.input));
  832 + }
  833 +
  834 + html = '<text-element-controllet ';
  835 + for (var i = 0; i < layouts.input.length; i++) {
  836 + html += '<text-element-controllet heading="' + layouts.input[i].name + '" ' +
  837 + 'description="' + layouts.input[i].description + '" ' +
  838 + 'number="' + (i + 1) + '" ';
  839 + if(this.dataletPreset != undefined){
  840 + html += 'value="' + this.dataletPreset[Object.keys(this.dataletPreset)[(i + 1)]] + '"';
  841 + }
  842 +
  843 + html += '></text-element-controllet>';
  844 + }
  845 + this.$.idm_layout_container.innerHTML = html;
  846 + }
  847 +
  848 + if(this.selectedFields != undefined) this.generateDataletPreview();
829 849  
830 850 },
831 851 /**
... ... @@ -950,9 +970,9 @@ Example:
950 970 */
951 971 _datasourceSelected : function(e){
952 972  
953   - this.$.data_url.value = this.datasets[parseInt(e.target.id)].url;
954   - this.$.infoDialogTitle.innerHTML = this.datasets[parseInt(e.target.id)].name;
955   - this.$.infoDialogContent.innerHTML = this.datasets[parseInt(e.target.id)].description;
  973 + this.$.data_url.value = this.datasets[parseInt(e.target.id)].url;
  974 + this.$.infoDialogTitle.innerHTML = this.datasets[parseInt(e.target.id)].name;
  975 + this.$.infoDialogContent.innerHTML = this.datasets[parseInt(e.target.id)].description;
956 976  
957 977 },
958 978 /**
... ... @@ -987,25 +1007,25 @@ Example:
987 1007 */
988 1008 _fieldsSelected : function(e){
989 1009  
990   - this.selectedFields = e.detail.fields;
991   - this.$.selectedFields_container.innerHTML = "";
992   - for(var i=0;i<e.detail.fields.length;i++) {
  1010 + this.selectedFields = e.detail.fields;
  1011 + this.$.selectedFields_container.innerHTML = "";
  1012 + for(var i=0;i<e.detail.fields.length;i++) {
993 1013 this.$.selectedFields_container.innerHTML += '<draggable-element-controllet identifier="' + e.detail.fields[i] +
994   - '" label="' + e.detail.fields[i].split(",")[e.detail.fields[i].split(",").length -1] +
995   - '"></draggable-element-controllet><br>';
996   - }
  1014 + '" label="' + e.detail.fields[i].split(",")[e.detail.fields[i].split(",").length -1] +
  1015 + '"></draggable-element-controllet><br>';
  1016 + }
997 1017  
998   - var table_params ={
999   - component : "datatable-datalet",
1000   - params :{
  1018 + var table_params ={
  1019 + component : "datatable-datalet",
  1020 + params :{
1001 1021 'data-url' : this.dataUrl
1002   - },
1003   - fields : e.detail.fields,
1004   - placeHolder : this.$.table_component_place_holder
1005   - };
  1022 + },
  1023 + fields : e.detail.fields,
  1024 + placeHolder : this.$.table_component_place_holder
  1025 + };
1006 1026  
1007   - ComponentService.deep_url = this.deepUrl;
1008   - ComponentService.getComponent(table_params);
  1027 + ComponentService.deep_url = this.deepUrl;
  1028 + ComponentService.getComponent(table_params);
1009 1029  
1010 1030  
1011 1031 },
... ... @@ -1071,7 +1091,23 @@ Example:
1071 1091  
1072 1092 this.fire('data-sevc-controllet.dataletCreated', {data : data});
1073 1093  
1074   - }
  1094 + },
  1095 +
  1096 + //tree map
  1097 + _selectDataUrl_treeMap : function(e){
  1098 + var url = e.detail.url;
  1099 + url = url.split('/');
  1100 + var index = url.indexOf('resource')
  1101 + if (index != -1) { // ckan
  1102 + var resourceId = url[index + 1];
  1103 + url = "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=" + resourceId;
  1104 +
  1105 + } else
  1106 + url = "sorry, data provider not supported yet";
  1107 +
  1108 + this.dataUrl = url;
  1109 + this.DatasourceTabSelected=0;
  1110 + },
1075 1111  
1076 1112 });
1077 1113  
... ...
controllets/data-sevc-controllet/data-sevc-controllet_ddr.html 0 → 100755
  1 +/********************************************************************************************************************************
  2 +<!--<script src="../shared_js/jquery-1.11.2.min.js"></script>-->
  3 +<!--<script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>-->
  4 +<!--<script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>-->
  5 +<!--<link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">-->
  6 +/********************************************************************************************************************************
  7 +
  8 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  9 +
  10 +<link rel="import" href="../page-slider-controllet/page-slider-controllet.html">
  11 +<link rel="import" href="../dataset-selection-controllet/dataset-selection-controllet.html">
  12 +<link rel="import" href="../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html" />
  13 +
  14 +<dom-module id="data-sevc-controllet">
  15 +
  16 + <template>
  17 +
  18 + <page-slider-controllet id="slider">
  19 +
  20 + <neon-animatable>
  21 +
  22 + <dataset-selection-controllet id="dataset_selection" datasets={{datasets}}></dataset-selection-controllet>
  23 +
  24 + </neon-animatable>
  25 +
  26 + <neon-animatable>
  27 +
  28 + <tree-view-multi-table-controllet id="tree_view_multi_table" root-name="data" opened-path="result,records" data-url={{dataUrl}}></tree-view-multi-table-controllet>
  29 +
  30 + </neon-animatable>
  31 +
  32 + <neon-animatable>
  33 + <div class="page" style="background-color: #BBDEFB;"><p>Pagina due</p><p>Page two</p><p>P&aacute;gina dos</p></div>
  34 + </neon-animatable>
  35 +
  36 + </page-slider-controllet>
  37 +
  38 + </template>
  39 +
  40 + <script>
  41 +
  42 + Polymer({
  43 +
  44 + is : 'data-sevc-controllet',
  45 +
  46 + listeners : {
  47 + 'page-slider-controllet_selected' : '_updateSlider',
  48 + 'dataset-selection-controllet_data-url' : '_updateDataUrl'
  49 + },
  50 +
  51 + properties : {
  52 +
  53 + deepUrl : {
  54 + type : String,
  55 + value : undefined
  56 + },
  57 +
  58 + dataletsListUrl : {
  59 + type : String ,
  60 + value : undefined
  61 + },
  62 +
  63 + datasets : {
  64 + type : Array,
  65 + value : undefined
  66 + },
  67 +
  68 + dataUrl : {
  69 + type : String,
  70 + value : undefined
  71 + },
  72 +
  73 + jsonData : {
  74 + type : Object,
  75 + value : undefined
  76 + }
  77 +
  78 + },
  79 +
  80 + ready : function(){
  81 + },
  82 +
  83 + _updateSlider : function(e){
  84 + switch (e.detail.selected) {
  85 + case 0:
  86 + slider.setTitle("SELECT DATASET", "Select, copy and paste or search the url of dataset.");
  87 + slider.chevronLeft(false);
  88 + slider.chevronRight(false);
  89 + this.$.dataset_selection._fireDataUrl();
  90 + http://designpieces.com/palette/google-new-logo-2015-color-palette-hex-and-rgb/
  91 + break;
  92 + case 1:
  93 + slider.setTitle("SELECT FIELDS", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");
  94 + slider.chevronRight(false);
  95 + this.$.tree_view_multi_table.ready();
  96 + break;
  97 + case 2:
  98 + slider.setTitle("SELECT DATALET", "Sbiricuda antani siempre!");
  99 + }
  100 + },
  101 +
  102 + _updateDataUrl : function(e){
  103 + this.dataUrl = e.detail.url;
  104 +
  105 + $.ajax({
  106 + url: e.detail.url,
  107 + dataType: "json",
  108 + success: function(data){
  109 +// this.dataUrl = e.detail.url
  110 +// this.jsonData = JSON.stringify(data);
  111 + slider.chevronRight(true);
  112 + },
  113 + error: function(){
  114 +// this.jsonData = undefined;
  115 + slider.chevronRight(false);
  116 + }
  117 + });
  118 + }
  119 +
  120 + });
  121 +
  122 + </script>
  123 +
  124 +</dom-module>
0 125 \ No newline at end of file
... ...
controllets/data-sevc-controllet/demo/index.html 0 → 100755
  1 +<html>
  2 +
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <script src="../../shared_js/jquery-1.11.2.min.js"></script>
  6 +
  7 + <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  8 +
  9 + <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  10 + <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  11 +
  12 + <link rel="import" href="../data-sevc-controllet_ddr.html" />
  13 +</head>
  14 +
  15 +<body>
  16 +
  17 +<data-sevc-controllet id="dsc" deep-url="http://172.16.15.89/DEEalerProvider/DEEP/" datalets-list-url="http://172.16.15.89/DEEalerProvider/DEEP/datalets-list"></data-sevc-controllet>
  18 +
  19 +<script>
  20 + var description = "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa "+
  21 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  22 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  23 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  24 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  25 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  26 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  27 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  28 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  29 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  30 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  31 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  32 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  33 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  34 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  35 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  36 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa";
  37 +
  38 + var dataset1 = {description: description, name: "Data", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=c3b52992-ba61-4a73-a637-0f2e1ca26aab"};
  39 + var dataset2 = {description: "", name: "Klassen", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=dfd27de5-0790-466c-af59-6a82509e7fbb"};
  40 + var dataset3 = {description: "descrizione bellissima purissima levissima sbiricuda antani", name: "Derelict Sites", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fcbee83e-3d3d-4303-a568-24dd33d02adc"};
  41 + var datasets = [dataset1, dataset2, dataset3];
  42 +
  43 + var dsc = document.getElementById('dsc');
  44 + dsc.setAttribute("datasets", JSON.stringify(datasets));
  45 +</script>
  46 +
  47 +</body>
  48 +
  49 +</html>
0 50 \ No newline at end of file
... ...
controllets/datalet-selection-controllet/datalet-selection-controllet.html 0 → 100755
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html" />
  2 +
  3 +<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
  4 +
  5 +<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
  6 +<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
  7 +<link rel="import" href="../../bower_components/paper-item/paper-item.html">
  8 +
  9 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  10 +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  11 +<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
  12 +
  13 +<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
  14 +
  15 +<link rel="import" href="../../bower_components/paper-button/paper-button.html">
  16 +
  17 +<link rel="import" href="../items-vslider-controllet/items-vslider-controllet.html" />
  18 +
  19 +<link rel="import" href="../../datalets/datatable-datalet/datatable-datalet.html" />
  20 +
  21 +<dom-module id="datalet-selection-controllet">
  22 +
  23 + <template>
  24 +
  25 + <style is="custom-style">
  26 +
  27 + #datalet_selection_container {
  28 + display: flex;
  29 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  30 + font-size: 16px;
  31 + }
  32 +
  33 + #datalet_selection_inputs {
  34 + position: relative;
  35 + height: 100vh;
  36 + margin-left: 32px;
  37 + width: 344px;
  38 + }
  39 +
  40 + #datalet_selection_labels {
  41 + position: relative;
  42 + height: 100vh;
  43 + margin-left: 32px;
  44 + width: 344px;
  45 + }
  46 +
  47 + #datalet_selection_column {
  48 + position: relative;
  49 + width: 100%;
  50 + margin-left: 32px;
  51 + }
  52 +
  53 + #datalet_selection_datalet {
  54 + position: relative;
  55 + height: 100vh;
  56 + width: 100%;
  57 + /*margin-left: 32px;*/
  58 + /*margin-top: 32px;*/
  59 + /*margin-bottom: 32px;*/
  60 + }
  61 +
  62 + #datalet_selection_comment{
  63 + width: 100%;
  64 + margin-bottom: 32px;
  65 + }
  66 +
  67 + #datalet_selection_datalet_placeholder {
  68 + padding: 16px;
  69 + }
  70 +
  71 + .inputs{
  72 + position: relative;
  73 + /*margin-left: 16px;*/
  74 + /*margin-right: 16px;*/
  75 + }
  76 +
  77 + .input_name{
  78 + height: 16px;
  79 + padding: 16px;
  80 + /*background-color: #B6B6B6;*/
  81 +
  82 + background-color: #2196F3;
  83 + color: #FFFFFF;
  84 + font-weight: 700;
  85 + }
  86 +
  87 + .input_header{
  88 + /*height: 16px;*/
  89 + padding: 16px;
  90 + background-color: #B6B6B6;
  91 + text-align: center;
  92 + font-weight: 700;
  93 + }
  94 +
  95 + .info_button {
  96 + position: absolute;
  97 + top: 4px;
  98 + right: 0px;
  99 + }
  100 +
  101 + paper-textarea {
  102 + height: 48px;
  103 + padding: 0px 8px;
  104 + --paper-input-container-focus-color: #2196F3;
  105 + }
  106 +
  107 + paper-dropdown-menu {
  108 + height: 48px;
  109 + padding: 0px 8px;
  110 + --paper-input-container-focus-color: #2196F3;
  111 + }
  112 +
  113 + paper-item.iron-selected {
  114 + background-color: #2196F3;
  115 + color: #FFFFFF;
  116 + }
  117 +
  118 + paper-icon-button {
  119 + /*color: #2196F3;*/
  120 + color: #FFFFFF;
  121 + --paper-icon-button-ink-color: #2196F3;
  122 + /*padding: 0px;*/
  123 + }
  124 +
  125 + paper-button {
  126 + /*display: block;*/
  127 + position: absolute;
  128 + bottom: 16px;
  129 + right: 11px;
  130 +
  131 + /*float: right;*/
  132 + /*margin-right: 11px;*/
  133 +
  134 +
  135 +
  136 +
  137 + height: 48px;
  138 + width: 172px;
  139 + background-color: #00BCD4;
  140 + color: white;
  141 + font-weight: 700;
  142 + padding: 16px;
  143 + }
  144 +
  145 + paper-button:hover {
  146 + background-color: #00AABF;
  147 + }
  148 + </style>
  149 +
  150 + <iron-ajax id="selectedDatalet_request" on-response="handleSelectedDatalet"></iron-ajax>
  151 +
  152 + <div id="datalet_selection_container">
  153 + <items-vslider-controllet datalets-list-url={{dataletsListUrl}}></items-vslider-controllet>
  154 +
  155 +
  156 + <paper-material id="datalet_selection_inputs" elevation="5">
  157 + <div class="input_header">INPUTS</div>
  158 + <template is="dom-repeat" items="{{inputs}}" index-as="index">
  159 + <div class="inputs">
  160 + <div class="input_name">
  161 + {{item.name}}
  162 + <div class="info_button">
  163 + <paper-icon-button id="info_button" on-click="_showInfo" icon="info-outline" title="{{item.name}} info"></paper-icon-button>
  164 + </div>
  165 + </div>
  166 + <paper-dropdown-menu no-label-float label={{item.name}}>
  167 + <paper-menu class="dropdown-content">
  168 + <template is="dom-repeat" items={{fields}}>
  169 + <paper-item id={{index}} on-tap="_loadDatalet">{{item}}</paper-item>
  170 + </template>
  171 + </paper-menu>
  172 + </paper-dropdown-menu>
  173 + </div>
  174 + </template>
  175 + </paper-material>
  176 +
  177 + <paper-material id="datalet_selection_labels" elevation="5">
  178 + <div class="input_header">LABELS</div>
  179 + <template is="dom-repeat" items="{{labels}}" index-as="index">
  180 + <div class="inputs">
  181 + <div class="input_name">
  182 + {{item.name}}
  183 + <div class="info_button">
  184 + <paper-icon-button id="info_button" on-click="_showInfo" icon="info-outline" title="{{item.name}} info"></paper-icon-button>
  185 + </div>
  186 + </div>
  187 + <paper-textarea no-label-float label={{item.name}}></paper-textarea>
  188 + </div>
  189 + </template>
  190 + </paper-material>
  191 +
  192 +
  193 + <div id="datalet_selection_column">
  194 + <paper-material id="datalet_selection_comment" elevation="5">
  195 + <div class="input_header">COMMENT</div>
  196 + <paper-textarea no-label-float label="comment (max 100 characters)"></paper-textarea>
  197 + </paper-material>
  198 +
  199 + <paper-material id="datalet_selection_datalet" elevation="5">
  200 + <div class="input_header">DATALET PREVIEW</div>
  201 + <div id="datalet_selection_datalet_placeholder"></div>
  202 +
  203 + </paper-material>
  204 +
  205 + <paper-button raised>ADD DATALET</paper-button>
  206 +
  207 + </div>
  208 +
  209 + </div>
  210 +
  211 + </template>
  212 +
  213 + <script>
  214 +
  215 + Polymer({
  216 +
  217 + is : 'datalet-selection-controllet',
  218 +
  219 + properties : {
  220 +
  221 + deepUrl : {
  222 + type : String,
  223 + value : undefined
  224 + },
  225 +
  226 + dataletsListUrl : {
  227 + type : String,
  228 + value : undefined
  229 + },
  230 +
  231 + selectedDatalet : {
  232 + type : String,
  233 + value : undefined
  234 + },
  235 +
  236 + inputs : {
  237 + type : Array,
  238 + value : []
  239 + },
  240 +
  241 + labels : {
  242 + type : Array,
  243 + value : []
  244 + },
  245 +
  246 + fields : {
  247 + type : Array,
  248 + value : ["result,records,Lat","result,records,Lng"]
  249 + },
  250 +
  251 + dataUrl : {
  252 + type : String,
  253 + value : " http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&amp;limit=10000"
  254 + }
  255 +
  256 + },
  257 +
  258 + listeners: {
  259 + 'items-vslider-controllet_selected-datalet': '_dataletSelected'
  260 + },
  261 +
  262 + ready : function() {
  263 + this._resize();
  264 + $(this.$.datalet_selection_inputs).perfectScrollbar();
  265 + $(this.$.datalet_selection_labels).perfectScrollbar();
  266 + $(this.$.datalet_selection_datalet).perfectScrollbar();
  267 + },
  268 +
  269 + attached : function() {
  270 + this._resize();
  271 + var that = this;
  272 + window.addEventListener("resize", function() { that._resize(); });
  273 + },
  274 +
  275 + _dataletSelected : function(e){
  276 + this.selectedDatalet = e.detail.datalet;
  277 + if(this.selectedDatalet){
  278 + this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
  279 + this.$.selectedDatalet_request.generateRequest();
  280 + }
  281 + else
  282 + this.inputs = []
  283 + },
  284 +
  285 + handleSelectedDatalet : function(e){
  286 +// console.log(e.detail.response.idm.inputs.layouts.input);
  287 + var inputs = e.detail.response.idm.inputs.input;
  288 + var labels = e.detail.response.idm.inputs.layouts.input;
  289 +
  290 + if(inputs.constructor == Object) {//not Array && inputs.input.selection == "*"
  291 + var name = inputs.name;
  292 + inputs = [];
  293 + for(var i in this.fields)
  294 + inputs.push({name: name + " " + i});
  295 +
  296 + }
  297 +
  298 + this.inputs = inputs;
  299 + this.labels = labels;
  300 + },
  301 +
  302 + _loadDatalet : function(){
  303 +// this.$.datalet_selection_datalet_placeholder.innerHTML = "<datatable-datalet data-url=\""+this.dataUrl+"\" fields='[\"result,records,Lat\",\"result,records,Lng\"]'></datatable-datalet>";
  304 + this.$.datalet_selection_datalet_placeholder.innerHTML = "<datatable-datalet data-url=\"http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&amp;limit=10000\" fields='[\"result,records,Lat\",\"result,records,Lng\"]'>we";
  305 +
  306 +// $("#base_datalet_container").html("");
  307 + $("#base_datalet_container").css('visibility','hidden');
  308 + $("#base_datalet_container").css('padding','0px');
  309 + $("#base_datalet_container").css('height','0px');
  310 +// console.log($("#base_datalet_container"));
  311 +
  312 + },
  313 +
  314 + _resize : function(){
  315 + var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
  316 + h = h - 64 - 8; //height with page scroller
  317 +
  318 + $("#items_vslider_container").height(h);//vslider controllet
  319 +
  320 + $("#datalet_selection_inputs").height(h);
  321 + $("#datalet_selection_labels").height(h);
  322 + $("#datalet_selection_datalet").height(h-132);
  323 + }
  324 +
  325 + });
  326 +
  327 + </script>
  328 +
  329 +</dom-module>
0 330 \ No newline at end of file
... ...
controllets/datalet-selection-controllet/demo/index.html 0 → 100755
  1 +<html>
  2 +
  3 +<head>
  4 + <script src="../../shared_js/jquery-1.11.2.min.js"></script>
  5 +
  6 + <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  7 +
  8 + <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  9 + <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  10 +
  11 + <link rel="import" href="../datalet-selection-controllet.html" />
  12 +</head>
  13 +
  14 +<body>
  15 +
  16 +<datalet-selection-controllet deep-url="http://172.16.15.89/DEEalerProvider/DEEP/" datalets-list-url="http://172.16.15.89/DEEalerProvider/DEEP/datalets-list"></datalet-selection-controllet>
  17 +
  18 +</body>
... ...
controllets/dataset-selection-controllet/dataset-selection-controllet.html 0 → 100755
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  2 +
  3 +<link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">
  4 +<link rel="import" href="../../bower_components/paper-tabs/paper-tab.html">
  5 +
  6 +<link rel="import" href="../../bower_components/neon-animation/neon-animation.html">
  7 +<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
  8 +<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  9 +
  10 +<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
  11 +<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
  12 +<link rel="import" href="../../bower_components/paper-item/paper-item.html">
  13 +
  14 +<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
  15 +
  16 +<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
  17 +
  18 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  19 +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  20 +<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
  21 +
  22 +<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
  23 +<link rel="import" href="../../bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html">
  24 +
  25 +<link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">
  26 +
  27 +<!--<script src="../../datalets/shared_js/d3.js"></script>-->
  28 +
  29 +<dom-module id="dataset-selection-controllet">
  30 +
  31 + <template>
  32 +
  33 + <style is="custom-style">
  34 + paper-tabs {
  35 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  36 + font-size: 16px;
  37 + font-weight: bold;
  38 + --paper-tabs-selection-bar-color: #2196F3;
  39 + }
  40 +
  41 + paper-tab {
  42 + transition: all 1.0s;
  43 + }
  44 +
  45 + paper-tab.iron-selected {
  46 + background-color: #B6B6B6;
  47 + }
  48 +
  49 + paper-tab:hover {
  50 + color: #2196F3;
  51 + }
  52 +
  53 + paper-tab[disabled] {
  54 + color: #B6B6B6;
  55 + }
  56 +
  57 + paper-dropdown-menu {
  58 + width: 45%;
  59 + margin-bottom: 32px;
  60 + --paper-input-container-focus-color: #2196F3;
  61 + }
  62 +
  63 + paper-item.iron-selected {
  64 + background-color: #2196F3;
  65 + color: #FFFFFF;
  66 + }
  67 +
  68 + /*paper-item[focused] {*/
  69 + /*background: #FFFFFF;*/
  70 + /*}*/
  71 +
  72 + paper-textarea {
  73 + width: 90%;
  74 + margin-bottom: 32px;
  75 + --paper-input-container-focus-color: #2196F3;
  76 + }
  77 +
  78 + paper-icon-button {
  79 + color: #2196F3;
  80 + --paper-icon-button-ink-color: #2196F3;
  81 + }
  82 +
  83 + paper-icon-button[disabled] {
  84 + color: #B6B6B6;
  85 + }
  86 +
  87 + #material_container {
  88 + margin-top: 8px;
  89 + /*height: 55vh;*/
  90 + }
  91 +
  92 + #div_selection {
  93 + padding-left: 10%;
  94 + padding-top: 64px;
  95 + /*padding-bottom: 64px;*/
  96 + }
  97 +
  98 + #dialog_info {
  99 + border: 2px solid #2196F3;
  100 + background-color: #E0E0E0;
  101 + position: fixed;
  102 + top: 232px;
  103 + width: 60%;
  104 + height: auto;
  105 + /*overflow: auto;*/
  106 + }
  107 +
  108 + #div_datasetexplorer {
  109 + padding-top: 48px;
  110 + }
  111 + </style>
  112 +
  113 + <paper-material id="material_container" elevation="5">
  114 +
  115 + <paper-tabs selected="{{selected}}" on-tap="_loadTreeMap">
  116 + <paper-tab noink>SELECT DATA SOURCE</paper-tab>
  117 + <paper-tab noink>TREE MAP SEARCH</paper-tab>
  118 + <paper-tab noink disabled>MOST POPULAR</paper-tab>
  119 + </paper-tabs>
  120 +
  121 + <neon-animated-pages selected="{{selected}}" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
  122 +
  123 + <neon-animatable>
  124 +
  125 + <div id="div_selection">
  126 + <paper-dropdown-menu label="Available datasets">
  127 + <paper-menu class="dropdown-content">
  128 + <template is="dom-repeat" items={{datasets}} as="dataset">
  129 + <paper-item id={{index}} on-tap="_selectDataUrl">{{dataset.name}}</paper-item>
  130 + </template>
  131 + </paper-menu>
  132 + </paper-dropdown-menu>
  133 +
  134 + <paper-icon-button id="info_button" disabled on-click="_showInfo" icon="info-outline" title="dataset info"></paper-icon-button>
  135 +
  136 + <paper-textarea id="selected_url" label="Selected url" value={{dataUrl}}></paper-textarea>
  137 +
  138 + <paper-dialog id="dialog_info">
  139 + <h2 id="dialog_name"></h2>
  140 + <p id="dialog_description"></p>
  141 + </paper-dialog>
  142 + </div>
  143 +
  144 + </neon-animatable>
  145 +
  146 + <neon-animatable>
  147 + <div id="div_datasetexplorer">
  148 + <datasetexplorer-datalet class="datasetexplorer" data-url="/oxwall_x.y.z/openwall/api/datasetTree" fields='["result,provider_name","result,organization_name","result,package_name","result,resource_name","result,url","result,w"]'></datasetexplorer-datalet>
  149 + </div>
  150 + </neon-animatable>
  151 +
  152 + <neon-animatable>
  153 + </neon-animatable>
  154 +
  155 + </neon-animated-pages>
  156 +
  157 + </paper-material>
  158 +
  159 + </template>
  160 +
  161 + <script>
  162 +
  163 + Polymer({
  164 +
  165 + is : 'dataset-selection-controllet',
  166 +
  167 + properties : {
  168 +
  169 + selected : {
  170 + type : Number,
  171 + value : 0
  172 + },
  173 +
  174 + datasets : {
  175 + type : Array,
  176 + value : undefined
  177 + },
  178 +
  179 + dataUrl : {
  180 + type : String,
  181 + value : undefined,
  182 + observer : '_fireDataUrl'
  183 + }
  184 +
  185 + },
  186 +
  187 + listeners: {
  188 + 'datasetexplorer-datalet_data-url': '_selectDataUrl_treeMap'
  189 + },
  190 +
  191 + ready : function(){
  192 + $(this.$.dialog_info).perfectScrollbar();
  193 + },
  194 +
  195 + attached : function(){
  196 + this._resize();
  197 + var that = this;
  198 + window.addEventListener("resize", function() { that._resize(); });
  199 + },
  200 +
  201 + _loadTreeMap : function(){
  202 + if(this.selected == 0 && this.$.div_datasetexplorer.innerHTML == "")
  203 + this.$.div_datasetexplorer.innerHTML = "<datasetexplorer-datalet class=\"datasetexplorer\" data-url=\"/oxwall_x.y.z/openwall/api/datasetTree\" fields='[\"result,provider_name\",\"result,organization_name\",\"result,package_name\",\"result,resource_name\",\"result,url\",\"result,w\"]'></datasetexplorer-datalet>";
  204 + },
  205 +
  206 + _selectDataUrl_treeMap : function(e){
  207 + var url = e.detail.url;
  208 + url = url.split('/');
  209 + var index = url.indexOf('resource')
  210 + if (index != -1) { // ckan
  211 + var resourceId = url[index + 1];
  212 + url = "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=" + resourceId;
  213 +
  214 + } else
  215 + url = "sorry, data provider not supported yet";
  216 +
  217 + this.dataUrl = url;
  218 + this.selected=0;
  219 + },
  220 +
  221 + _selectDataUrl : function(e){
  222 + var dataset = this.datasets[parseInt(e.target.id)]
  223 +
  224 + this.dataUrl = dataset.url;
  225 +
  226 + if(dataset.description != ""){
  227 + this.$.info_button.removeAttribute("disabled");
  228 + this.$.dialog_name.innerHTML = dataset.name;
  229 + this.$.dialog_description.innerHTML = dataset.description;
  230 + }
  231 + else
  232 + this.$.info_button.setAttribute("disabled", "true");
  233 + },
  234 +
  235 + _showInfo : function(){
  236 + this.$.dialog_info.open();
  237 + },
  238 +
  239 + _fireDataUrl : function(){
  240 + this.fire('dataset-selection-controllet_data-url', {url: this.dataUrl});
  241 + },
  242 +
  243 + _resize : function(){
  244 + var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
  245 + h = h - 64 - 8; //height with page scroller
  246 + $("#material_container").height(h);
  247 + }
  248 +
  249 + });
  250 +
  251 + </script>
  252 +
  253 +</dom-module>
0 254 \ No newline at end of file
... ...
controllets/dataset-selection-controllet/demo/index.html 0 → 100755
  1 +<html>
  2 +
  3 +<head>
  4 + <script src="../../shared_js/jquery-1.11.2.min.js"></script>
  5 +
  6 + <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  7 +
  8 + <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  9 + <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  10 +
  11 + <link rel="import" href="../dataset-selection-controllet.html" />
  12 +</head>
  13 +
  14 +<body>
  15 +
  16 +<dataset-selection-controllet id="ds"></dataset-selection-controllet>
  17 +
  18 +<script>
  19 + var description = "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa "+
  20 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  21 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  22 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  23 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  24 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  25 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  26 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  27 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  28 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  29 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  30 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  31 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  32 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  33 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  34 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  35 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa";
  36 +
  37 + var dataset1 = {description: description, name: "Data", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=c3b52992-ba61-4a73-a637-0f2e1ca26aab"};
  38 + var dataset2 = {description: "", name: "Klassen", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=dfd27de5-0790-466c-af59-6a82509e7fbb"};
  39 + var dataset3 = {description: "descrizione bellissima purissima levissima sbiricuda antani", name: "Derelict Sites", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fcbee83e-3d3d-4303-a568-24dd33d02adc"};
  40 + var datasets = [dataset1, dataset2, dataset3];
  41 +
  42 + var ds = document.getElementById('ds');
  43 + ds.setAttribute("datasets", JSON.stringify(datasets));
  44 +
  45 +</script>
  46 +
  47 +</body>
  48 +
  49 +</html>
0 50 \ No newline at end of file
... ...
controllets/fullsize-page-with-card-controllet/fullsize-page-with-card-controllet.html 0 → 100644
  1 +<!--
  2 +Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
  3 +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
  4 +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
  5 +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
  6 +Code distributed by Google as part of the polymer project is also
  7 +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
  8 +-->
  9 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  10 +<link rel="import" href="../../bower_components/neon-animation/neon-shared-element-animatable-behavior.html">
  11 +
  12 +<dom-module id="fullsize-page-with-card-controllet">
  13 +
  14 + <style>
  15 +
  16 + :host {
  17 + display: block;
  18 + }
  19 +
  20 + .fixed {
  21 + position: absolute;
  22 + top: 0;
  23 + left: 0;
  24 + height: 100%;
  25 + width: 100vw;
  26 + }
  27 +
  28 + .card {
  29 + position: relative;
  30 + margin: 20px 20px 20px 20px;
  31 + height: 90%;
  32 + }
  33 +
  34 + .grid-item-c0 {background-color: #0D47A1;}
  35 + .grid-item-c1 {background-color: #1976D2;}
  36 + .grid-item-c2 {background-color: #2196F3;}
  37 + .grid-item-c3 {background-color: #64B5F6;}
  38 + .grid-item-c4 {background-color: #BBDEFB;}
  39 +
  40 + .grid-item-c0-l {background-color: #1565C0;}
  41 + .grid-item-c1-l {background-color: #1E88E5;}
  42 + .grid-item-c2-l {background-color: #42A5F5;}
  43 + .grid-item-c3-l {background-color: #90CAF9;}
  44 + .grid-item-c4-l {background-color: #E3F2FD;}
  45 +
  46 + </style>
  47 +
  48 + <template>
  49 +
  50 + <div id="fixed" class$="[[_computeFixedBackgroundClass(color)]]"></div>
  51 + <div id="card" class$="[[_computeCardClass(color)]]">
  52 + <template is="dom-if" if="{{_checkUndefined(publicRoom)}}">
  53 + <iframe id="public_room_iframe" src="/public-room/{{publicRoom}}" width="100%" height="100%"></iframe>
  54 + </template>
  55 + </div>
  56 +
  57 + </template>
  58 +
  59 +</dom-module>
  60 +
  61 +<script>
  62 +
  63 + Polymer({
  64 +
  65 + is: 'fullsize-page-with-card-controllet',
  66 +
  67 + behaviors: [
  68 + Polymer.NeonSharedElementAnimatableBehavior
  69 + ],
  70 +
  71 + properties: {
  72 +
  73 + publicRoom : {
  74 + type: String
  75 + },
  76 +
  77 + color: {
  78 + type: String
  79 + },
  80 +
  81 + sharedElements: {
  82 + type: Object,
  83 + value: function() {
  84 + return {
  85 + 'hero': this.$.card,
  86 + 'ripple': this.$.fixed
  87 + }
  88 + }
  89 + },
  90 +
  91 + animationConfig: {
  92 + type: Object,
  93 + value: function() {
  94 + return {
  95 + 'entry': [{
  96 + name: 'ripple-animation',
  97 + id: 'ripple',
  98 + toPage: this,
  99 + }, {
  100 + name: 'hero-animation',
  101 + id: 'hero',
  102 + toPage: this,
  103 + timing: {
  104 + delay: 150
  105 + }
  106 + }],
  107 + 'exit': [{
  108 + name: 'fade-out-animation',
  109 + node: this.$.fixed
  110 + }, {
  111 + name: 'transform-animation',
  112 + transformFrom: 'none',
  113 + transformTo: 'translate(0px,-200vh) scale(0.9,1)',
  114 + node: this.$.card
  115 + }]
  116 + }
  117 + }
  118 + }
  119 +
  120 + },
  121 +
  122 + _checkUndefined: function(variable)
  123 + {
  124 + if(typeof variable === 'undefined') {
  125 + public_room_iframe.src = "";
  126 + return false;
  127 + }
  128 + return true;
  129 + },
  130 +
  131 + _computeCardClass: function(color) {
  132 + var cls = 'card';
  133 + return cls + ' ' + color;
  134 + },
  135 +
  136 + _computeFixedBackgroundClass: function(color) {
  137 + var cls = 'fixed';
  138 + return cls + ' ' + color + '-l';
  139 + }
  140 +
  141 + });
  142 +
  143 +</script>
... ...
controllets/items-vslider-controllet/demo/index.html 0 → 100755
  1 +<html>
  2 +
  3 +<head>
  4 + <script src="../../shared_js/jquery-1.11.2.min.js"></script>
  5 +
  6 + <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  7 +
  8 + <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  9 + <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  10 +
  11 + <link rel="import" href="../items-vslider-controllet.html" />
  12 +</head>
  13 +
  14 +<body>
  15 +
  16 +<items-vslider-controllet datalets-list-url="http://172.16.15.89/DEEalerProvider/DEEP/datalets-list"></items-vslider-controllet>
  17 +
  18 +</body>
  19 +
  20 +</html>
0 21 \ No newline at end of file
... ...
controllets/items-vslider-controllet/items-vslider-controllet.html 0 → 100755
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html" />
  2 +
  3 +<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
  4 +
  5 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  6 +<link rel="import" href="../../bower_components/iron-icons/hardware-icons.html">
  7 +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  8 +
  9 +<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
  10 +
  11 +<link rel="import" href="../../bower_components/paper-input/paper-input.html">
  12 +
  13 +<dom-module id="items-vslider-controllet">
  14 +
  15 + <template>
  16 +
  17 + <style is="custom-style">
  18 + paper-icon-button{
  19 + color: #FFFFFF;
  20 + height: 48px;
  21 + width: 48px;
  22 + padding: 0px;
  23 + margin: 0px;
  24 + --paper-icon-button-ink-color: white;
  25 + }
  26 +
  27 + #items_vslider_container{
  28 + display: flex;
  29 + flex-direction: column;
  30 + height: 100vh;
  31 + width: 172px;
  32 + background-color: #E0E0E0;
  33 + }
  34 +
  35 + #div_datalets_container {
  36 + position: relative;
  37 + margin-bottom: 16px;
  38 + }
  39 +
  40 + .arrow-up{
  41 + background-color: #2196F3;
  42 + padding-left: 63px;
  43 + }
  44 +
  45 + .arrow-down{
  46 + background-color: #2196F3;
  47 + padding-left: 63px;
  48 + }
  49 +
  50 + .content-card{
  51 + position: relative;
  52 + float: left;/*firefox*/
  53 + /*margin : 16px;*/
  54 + margin : 16px 16px 0px 16px;
  55 + padding: 8px;
  56 + height: 124px;
  57 + width: 124px;
  58 + cursor: pointer;
  59 + background-color: #FFFFFF;
  60 + }
  61 +
  62 + img{
  63 + /*height: 100%;*/
  64 + width: 100%;
  65 + }
  66 +
  67 + .legend {
  68 + position: absolute;
  69 + left: 0;
  70 + bottom: 16px;
  71 + padding: 8px;
  72 + width: 124px;
  73 + background-color: #9E9E9E;
  74 + color: #FFFFFF;
  75 + opacity: 0.87;
  76 + z-index: 1;
  77 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  78 + font-size: 16px;
  79 + }
  80 +
  81 + .legend.selected {
  82 + font-weight: 700;
  83 + background-color: #2196F3;
  84 + opacity: 1;
  85 + }
  86 +
  87 + #items_vslider_search{
  88 + height: 48px;
  89 + padding: 0px 8px;
  90 + background-color: #B6B6B6;
  91 + --paper-input-container-focus-color: #2196F3;
  92 + }
  93 +
  94 + .search{
  95 + color: #FFFFFF
  96 + }
  97 +
  98 + .clear {
  99 + margin-bottom: 3px;
  100 + width: 16px;
  101 + height: 16px;
  102 + color: #2196F3;
  103 + --paper-icon-button-ink-color: #2196F3;
  104 + }
  105 + </style>
  106 +
  107 + <iron-ajax auto handle-as="json" url={{dataletsListUrl}} on-response="_getDatalets"></iron-ajax>
  108 +
  109 + <paper-material id="items_vslider_container" elevation="5">
  110 +
  111 + <paper-input id="items_vslider_search" value={{filter}} no-label-float label="search datalet">
  112 + <iron-icon class="search" icon="search" prefix></iron-icon>
  113 + <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear"></paper-icon-button>
  114 + </paper-input>
  115 +
  116 + <div class="arrow-up">
  117 + <paper-icon-button on-click="_onPrevClick" icon="hardware:keyboard-arrow-up"></paper-icon-button>
  118 + </div>
  119 +
  120 + <div id="div_datalets_container" class="flex">
  121 + <template is="dom-repeat" items="{{filteredDatalets}}">
  122 + <paper-material id={{item.imageName}} elevation="1" class='content-card' on-click="_selectDatalet">
  123 + <div class="legend">{{item.imageName}}</div>
  124 + <div><img src={{item.imageUrl}}></div>
  125 + </paper-material>
  126 + </template>
  127 + </div>
  128 +
  129 + <div class="arrow-down">
  130 + <paper-icon-button on-click="_onNextClick" icon="hardware:keyboard-arrow-down"></paper-icon-button>
  131 + </div>
  132 +
  133 + </paper-material>
  134 +
  135 + </template>
  136 +
  137 + <script>
  138 +
  139 + Polymer({
  140 +
  141 + is : 'items-vslider-controllet',
  142 +
  143 + properties : {
  144 +
  145 + dataletsListUrl : {
  146 + type : String,
  147 + value : undefined
  148 + },
  149 +
  150 + selectedDatalet : {
  151 + type : String,
  152 + value : undefined
  153 + },
  154 +
  155 + datalets : {
  156 + type : Array,
  157 + value : []
  158 + },
  159 +
  160 + filteredDatalets : {
  161 + type : Array,
  162 + value : []
  163 + },
  164 +
  165 + filter : {
  166 + type : String,
  167 + value : "",
  168 + observer : '_filterDatalets'
  169 + }
  170 + },
  171 +
  172 + listeners: {
  173 + 'dom-change': '_onDomChange'
  174 + },
  175 +
  176 + ready : function() {
  177 +// this._resize();
  178 + $(this.$.div_datalets_container).perfectScrollbar();
  179 + },
  180 +
  181 + attached : function() {
  182 +// this._resize();
  183 +// var that = this;
  184 +// window.addEventListener("resize", function() { that._resize(); });
  185 + },
  186 +
  187 + _clearInput : function() {
  188 + this.$.items_vslider_search.value = "";
  189 + },
  190 +
  191 + _getDatalets : function(e){
  192 + var datalets = new Array();
  193 + for(var i=0; i < e.detail.response.length; i++){
  194 + var datalet = { imageName : e.detail.response[i].name.replace("-datalet", ""), imageUrl : e.detail.response[i].url + e.detail.response[i].name + ".png" };
  195 + datalets.push(datalet);
  196 + }
  197 +
  198 + this.datalets = datalets;
  199 + this.filteredDatalets = datalets;
  200 + },
  201 +
  202 + _filterDatalets : function(){
  203 + var datalets = new Array();
  204 + for(var i=0; i < this.datalets.length; i++){
  205 + var datalet = this.datalets[i];
  206 + if(datalet.imageName.indexOf(this.filter) != -1)
  207 + datalets.push(datalet);
  208 + }
  209 +
  210 + this.filteredDatalets = datalets;
  211 +
  212 + $("#div_datalets_container").animate({ scrollTop: 0}, 0);
  213 + },
  214 +
  215 + _onDomChange : function() {
  216 + if(this.selectedDatalet != undefined ){
  217 +
  218 + for(var i=0; i < this.filteredDatalets.length; i++){
  219 + var datalet = this.filteredDatalets[i];
  220 + var dataletCard = document.getElementById(datalet.imageName);
  221 + dataletCard.elevation = "1";
  222 + dataletCard.getElementsByClassName("legend")[0].className = dataletCard.getElementsByClassName("legend")[0].className.replace("selected", "");
  223 + }
  224 +
  225 + if(document.getElementById(this.selectedDatalet) != null){
  226 + var dataletCard = document.getElementById(this.selectedDatalet);
  227 + dataletCard.elevation = "5";
  228 + dataletCard.getElementsByClassName("legend")[0].className = dataletCard.getElementsByClassName("legend")[0].className + " selected";
  229 + }
  230 +
  231 + }
  232 + },
  233 +
  234 + _selectDatalet : function(e){
  235 + if(this.selectedDatalet != undefined && (document.getElementById(this.selectedDatalet) != null)){
  236 + var dataletCard = document.getElementById(this.selectedDatalet);
  237 + dataletCard.elevation = "1";
  238 + dataletCard.getElementsByClassName("legend")[0].className = dataletCard.getElementsByClassName("legend")[0].className.replace(" selected", "");
  239 + }
  240 +
  241 + if(e.currentTarget.id != this.selectedDatalet){
  242 + e.currentTarget.elevation = "5";
  243 + e.currentTarget.getElementsByClassName("legend")[0].className = e.currentTarget.getElementsByClassName("legend")[0].className + " selected";
  244 + this.selectedDatalet = e.currentTarget.id;
  245 + }
  246 + else
  247 + this.selectedDatalet = undefined;
  248 +
  249 + this.fire('items-vslider-controllet_selected-datalet', {datalet: this.selectedDatalet});
  250 + },
  251 +
  252 +
  253 + _getImageUrl : function(index){
  254 + return this.datalets[index].imageUrl;
  255 + },
  256 +
  257 + _onPrevClick : function() {
  258 +
  259 + var container = $("#div_datalets_container");
  260 + var h = container.height();
  261 + var dataletPerPage = parseInt(h/156);
  262 + var scroll = $("#div_datalets_container").scrollTop()-156*dataletPerPage;
  263 + var diff = scroll % 156;
  264 +// scroll += 156-diff;
  265 + scroll -= diff;
  266 + $("#div_datalets_container").animate({ scrollTop: scroll}, 300);
  267 +
  268 + },
  269 +
  270 + _onNextClick : function() {
  271 + var container = $("#div_datalets_container");
  272 + var h = container.height();
  273 + var dataletPerPage = parseInt(h/156);
  274 + var scroll = $("#div_datalets_container").scrollTop()+156*dataletPerPage;
  275 + var diff = scroll % 156;
  276 + scroll -= diff;
  277 + $("#div_datalets_container").animate({ scrollTop: scroll}, 300);
  278 +
  279 + },
  280 +
  281 +// _resize : function(){
  282 +// var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
  283 +// h = h - 64 - 8; //height with page scroller
  284 +// $("#items_vslider_container").height(h);
  285 +// }
  286 +
  287 + });
  288 +
  289 + </script>
  290 +
  291 +</dom-module>
0 292 \ No newline at end of file
... ...
controllets/items-vslider-controllet/items-vslider-controllet2.html 0 → 100755
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html" />
  2 +
  3 +<!--<link rel="import" href="../../bower_components/neon-animation/neon-animation.html">-->
  4 +<link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">
  5 +<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
  6 +<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  7 +
  8 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  9 +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  10 +<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
  11 +
  12 +<link rel="import" href="../../bower_components/paper-material">
  13 +
  14 +<dom-module id="items-vslider-controllet">
  15 +
  16 + <template>
  17 +
  18 + <style is="custom-style">
  19 + paper-icon-button{
  20 + color: #00BCD4;
  21 + height: 48px;
  22 + width: 48px;
  23 + --paper-icon-button-ink-color: #00BCD4;
  24 + }
  25 +
  26 + paper-icon-button:hover{
  27 + }
  28 +
  29 + .header{
  30 + width: 100%;
  31 + /*padding-bottom: 8px;*/
  32 + /*border-bottom: 2px solid #B6B6B6;*/
  33 + }
  34 +
  35 + .chevron-left{
  36 + float: left;
  37 + margin-top: 8px;
  38 + }
  39 +
  40 + .chevron-right{
  41 + float: right;
  42 + margin-top: 8px;
  43 + }
  44 +
  45 + .box{
  46 + overflow: auto;
  47 + }
  48 +
  49 + .avatar {
  50 + display: inline-block;
  51 + height: 64px;
  52 + width: 64px;
  53 + border-radius: 50%;
  54 + background: #2196F3;
  55 + color: #FFFFFF;
  56 + line-height: 64px;
  57 + font-size: 32px;
  58 + vertical-align: middle;
  59 + text-align: center;
  60 + }
  61 +
  62 + .text {
  63 + display: inline-block;
  64 + height: 64px;
  65 + vertical-align: middle;
  66 + padding-left: 20px;
  67 + }
  68 +
  69 + .title {
  70 + font-size: 32px;
  71 + color: #2196F3;
  72 + }
  73 +
  74 + .subtitle {
  75 + font-size: 16px;
  76 + color: #727272;
  77 + }
  78 + </style>
  79 +
  80 + <iron-ajax
  81 + auto
  82 + handle-as="json"
  83 + url={{dataletsListUrl}}
  84 + on-response="getDatalets">
  85 + </iron-ajax>
  86 +
  87 + <div class="header">
  88 + <paper-icon-button class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button>
  89 + <paper-icon-button class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button>
  90 +
  91 + <div class="box">
  92 + <div class="avatar">[[avatar]]</div>
  93 + <div class="text">
  94 + <div class="title">[[title]]</div>
  95 + <div class="subtitle">[[subtitle]]</div>
  96 + </div>
  97 + </div>
  98 + </div>
  99 +
  100 + <paper-material id="material_tree_view" elevation="5">
  101 +
  102 + <neon-animated-pages on-neon-animation-finish="_onNeonAnimationFinish" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">
  103 + <!--<neon-animated-pages on-neon-animation-finish="_onNeonAnimationFinish" selected="[[selected]]" entry-animation="slide-from-bottom-animation" exit-animation="slide-down-animation">-->
  104 +
  105 + <template is="dom-repeat" items="{{pages}}" as="page">
  106 +
  107 + <neon-animatable>
  108 +
  109 + <template is="dom-repeat" items="{{dataletsPerPage}}" as="index">
  110 +
  111 + <!--<span> {{item.name}}</span>-->
  112 + <!--<img src={{getdatalets.image}}>-->
  113 + <img src={{_getImage(page,index)}}>
  114 +
  115 + </template>
  116 + </neon-animatable>
  117 +
  118 + <!--<neon-animated-pages id="neon_animated_pages" class="flex" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">-->
  119 + <!--<template is="dom-repeat" items="{{pages}}" as="page">-->
  120 + <!--<neon-animatable>-->
  121 + <!--<template is="dom-repeat" items="{{dataletsPerPage}}" as="index">-->
  122 + <!--<paper-material elevation="1" class='content-card'>-->
  123 + <!--<div class="legend"><span>sbiricuda siempre!</span></div>-->
  124 + <!--<div class="card-content-image">-->
  125 + <!--<img src="{{_getImageUrl(page,index)}}">-->
  126 + <!--</div>-->
  127 + <!--</paper-material>-->
  128 + <!--</template>-->
  129 + <!--</neon-animatable>-->
  130 + <!--</template>-->
  131 + <!--</neon-animated-pages>-->
  132 +
  133 + </template>
  134 +
  135 + </neon-animated-pages>
  136 +
  137 + </paper-material>
  138 +
  139 + </template>
  140 +
  141 + <script>
  142 +
  143 + Polymer({
  144 +
  145 + is : 'items-vslider-controllet',
  146 +
  147 + properties : {
  148 +
  149 + entryAnimation : {
  150 + type : String,
  151 + value : ""
  152 + },
  153 +
  154 + exitAnimation : {
  155 + type : String,
  156 + value : ""
  157 + },
  158 +
  159 + selected : {
  160 + type : Number,
  161 + value : 0
  162 + },
  163 +
  164 + title : {
  165 + type : String,
  166 + value : ""
  167 + },
  168 +
  169 + subtitle : {
  170 + type : String,
  171 + value : ""
  172 + },
  173 +
  174 + avatar : {
  175 + type : String,
  176 + value : "1"
  177 + },
  178 +
  179 + datalets : {
  180 + type : Array,
  181 + value : []
  182 + },
  183 +
  184 + pages : {
  185 + type : Array,
  186 + value : []
  187 + },
  188 +
  189 + dataletsPerPage : {
  190 + type : Array,
  191 + value : []
  192 + }
  193 +
  194 +
  195 + //dataletsListUrl or datalets as input
  196 + },
  197 +
  198 + getDatalets : function(e){//imageUrllllllllllllllllllllllllllllllllllllllll
  199 + datalets = new Array();
  200 + for(var i=0; i < e.detail.response.length; i++){
  201 + var datalet = { name : e.detail.response[i].name, image : e.detail.response[i].url + e.detail.response[i].name + ".png" };
  202 + datalets.push(datalet);
  203 + }
  204 + this.datalets = datalets;
  205 +
  206 + console.log(this.datalets);
  207 + this.pages = [0,1,2];
  208 + this.dataletsPerPage = [0,1,2];
  209 +
  210 + },
  211 +
  212 +// getName : function(name){
  213 +// return name;
  214 +// },
  215 +//
  216 + _getImage : function(page, index){
  217 + console.log(this.datalets[3*page+index].image);
  218 + return this.datalets[3*page+index].image;
  219 + },
  220 +
  221 + _resize : function(){//da cambiare rispetto al div container!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  222 + var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
  223 + h = h - 64; //height with page scroller
  224 + $("#material_tree_view").height(h);
  225 + },
  226 +
  227 + attached : function() {
  228 +// this.fire('items-vslider-controllet_selected', {selected : this.selected});
  229 + this._resize();
  230 + },
  231 +
  232 + setTitle : function(title, subtitle) {
  233 + this.title = title;
  234 + this.subtitle = subtitle;
  235 + },
  236 +
  237 + setAvatar : function(innerText) {
  238 + this.avatar = innerText;
  239 + },
  240 +
  241 + chevronLeft : function(flag) {
  242 + var buttons = document.getElementsByTagName("paper-icon-button");
  243 + if(flag)
  244 + buttons[0].removeAttribute("disabled");
  245 + else
  246 + buttons[0].setAttribute("disabled", "true");
  247 + },
  248 +
  249 + chevronRight : function(flag) {
  250 + var buttons = document.getElementsByTagName("paper-icon-button");
  251 + if(flag)
  252 + buttons[1].removeAttribute("disabled");
  253 + else
  254 + buttons[1].setAttribute("disabled", "true");
  255 + },
  256 +
  257 + _onPrevClick : function() {
  258 + var buttons = document.getElementsByTagName("paper-icon-button");
  259 + buttons[0].setAttribute("disabled", "true");
  260 + buttons[1].setAttribute("disabled", "true");
  261 +
  262 +// this.entryAnimation = 'slide-from-left-animation';
  263 +// this.exitAnimation = 'slide-right-animation';
  264 +
  265 + this.entryAnimation = '';
  266 + this.exitAnimation = 'slide-up-animation';
  267 +
  268 + this.selected = this.selected === 0 ? (this.pages.length-1) : (this.selected - 1);
  269 + },
  270 +
  271 + _onNextClick : function() {
  272 + var buttons = document.getElementsByTagName("paper-icon-button");
  273 + buttons[0].setAttribute("disabled", "true");
  274 + buttons[1].setAttribute("disabled", "true");
  275 +
  276 +// this.entryAnimation = 'slide-from-right-animation';
  277 +// this.exitAnimation = 'slide-left-animation';
  278 +
  279 + this.entryAnimation = 'slide-down-animation';
  280 + this.exitAnimation = '';
  281 +
  282 + this.selected = this.selected === (this.pages.length-1) ? 0 : (this.selected + 1);
  283 + },
  284 +
  285 + _onNeonAnimationFinish: function() {
  286 + var buttons = document.getElementsByTagName("paper-icon-button");
  287 + buttons[0].removeAttribute("disabled");
  288 + buttons[1].removeAttribute("disabled");
  289 +
  290 + this.avatar = this.selected+1;
  291 +
  292 + this.fire('page-slider-controllet_selected', {selected : this.selected});
  293 + }
  294 +
  295 + });
  296 +
  297 + </script>
  298 +
  299 +</dom-module>
0 300 \ No newline at end of file
... ...
controllets/items-vslider-controllet/items-vslider-controllet3.html 0 → 100755
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html" />
  2 +
  3 +<link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">
  4 +<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
  5 +<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  6 +
  7 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  8 +<link rel="import" href="../../bower_components/iron-icons/hardware-icons.html">
  9 +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  10 +
  11 +<link rel="import" href="../../bower_components/paper-material">
  12 +
  13 +<link rel="import" href="../../bower_components/paper-input/paper-input.html">
  14 +
  15 +<!--<link rel="import" href="../paper-input.html">-->
  16 +<!--<link rel="import" href="../paper-input-container.html">-->
  17 +<!--<link rel="import" href="../paper-input-error.html">-->
  18 +<!--<link rel="import" href="../paper-input-char-counter.html">-->
  19 +<!--<link rel="import" href="../paper-textarea.html">-->
  20 +<!--<link rel="import" href="../../iron-input/iron-input.html">-->
  21 +<!--<link rel="import" href="../../iron-icon/iron-icon.html">-->
  22 +<!--<link rel="import" href="../../iron-icons/iron-icons.html">-->
  23 +<!--<link rel="import" href="../../paper-icon-button/paper-icon-button.html">-->
  24 +
  25 +
  26 +<dom-module id="items-vslider-controllet">
  27 +
  28 + <template>
  29 +
  30 + <style is="custom-style">
  31 + #material_items_vslider{
  32 + display: flex;
  33 + flex-direction: column;
  34 + width: 172px;
  35 + background-color: #E0E0E0;
  36 + }
  37 +
  38 + paper-icon-button{
  39 + color: #FFFFFF;
  40 + /*color: #2196F3;*/
  41 + height: 48px;
  42 + width: 48px;
  43 + padding: 0px;
  44 + margin: 0px;
  45 + --paper-icon-button-ink-color: white;
  46 + /*--paper-icon-button-ink-color: #2196F3;*/
  47 +
  48 + /*margin-left: 63px;*/
  49 + }
  50 +
  51 + paper-icon-button:hover{
  52 + }
  53 +
  54 + .arrow-up{
  55 + background-color: #2196F3;
  56 + /*float: left;*/
  57 + /*margin-top: 8px;*/
  58 + padding-left: 63px;
  59 + }
  60 +
  61 + .arrow-down{
  62 + background-color: #2196F3;
  63 + /*float: right;*/
  64 + /*margin-top: 8px;*/
  65 + padding-left: 63px;
  66 + }
  67 +
  68 + neon-animatable {
  69 + position: relative;
  70 + color: white;
  71 + /*width: 248px;*/
  72 + /*height: 100%;*/
  73 + height: auto;/*???*/
  74 + /*background-color: red;*/
  75 + overflow: hidden;
  76 + }
  77 +
  78 + #div_datalets_container {
  79 + position: relative;
  80 + /*color: white;*/
  81 + /*width: 248px;*/
  82 + /*height: 100%;*/
  83 + /*height: auto;/!*???*!/*/
  84 + /*background-color: red;*/
  85 + /*overflow: hidden;*/
  86 + }
  87 +
  88 + .content-card{
  89 + position: relative;
  90 + /*float: left;*/
  91 + margin : 16px;
  92 + /*width: 80px;*/
  93 + /*height: 72px;*/
  94 + background: #fff;
  95 + padding: 8px;
  96 +
  97 + height: 124px;
  98 + width: 124px;
  99 +
  100 + cursor: pointer;
  101 + }
  102 +
  103 + img{
  104 + height: 100%;
  105 + width: 100%;
  106 + }
  107 +
  108 + .legend {
  109 + position: absolute;
  110 + /*background: rgba(0,0,0,0.8);*/
  111 + background: #9E9E9E;/*#9e9e9e;*/
  112 + color: #FFFFFF;
  113 + /*height: 32px;*/
  114 + /*padding-left: 8px;*/
  115 + /*padding: 0px 8px 0px 8px;*/
  116 + padding: 8px;
  117 + left: 0;
  118 + bottom: 16px;
  119 + z-index: 1;
  120 + opacity: 0.87;
  121 + width: 124px;
  122 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  123 + font-size: 16px;
  124 + }
  125 +
  126 + .legend.selected {
  127 + font-weight: 700;
  128 + background-color: #2196F3;
  129 + opacity: 1;
  130 + }
  131 +
  132 + .legend span{
  133 + /*position: relative;*/
  134 + /*top: 8px;*/
  135 + }
  136 +
  137 + .div_search{
  138 + /*height: 64px;*/
  139 + height: 48px;
  140 + padding: 0px 8px;
  141 + background-color: #B6B6B6;
  142 + --paper-input-container-focus-color: #2196F3;
  143 + }
  144 +
  145 + .search{
  146 + color: #FFFFFF
  147 + /*height: 32px;*/
  148 + }
  149 +
  150 + .clear {
  151 + color: #2196F3;
  152 + --paper-icon-button-ink-color: #2196F3;
  153 + width: 16px; /* 15px + 2*4px for padding */
  154 + height: 16px;
  155 + /*padding: 0px 4px;*/
  156 + margin-bottom: 3px;
  157 + }
  158 +
  159 +
  160 +
  161 + </style>
  162 +
  163 + <iron-ajax auto handle-as="json" url={{dataletsListUrl}} on-response="_getDatalets"></iron-ajax>
  164 +
  165 + <paper-material id="material_items_vslider" elevation="5">
  166 +
  167 + <!--<div class="div_search">-->
  168 + <!--<paper-icon-button class="search" icon="icons:search"></paper-icon-button>-->
  169 +
  170 + <paper-input id="div_search" value={{filter}} class="div_search" no-label-float label="search datalet" id="input_search">
  171 + <iron-icon class="search" icon="search" prefix></iron-icon>
  172 + <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear" ></paper-icon-button><!--tabindex="0"-->
  173 + </paper-input>
  174 +
  175 + <!--</div>-->
  176 +
  177 +
  178 +
  179 + <div class="arrow-up"><paper-icon-button on-click="_onPrevClick" icon="hardware:keyboard-arrow-up"></paper-icon-button></div>
  180 +
  181 + <div id="div_datalets_container" class="flex">
  182 + <template is="dom-repeat" items="{{filteredDatalets}}">
  183 + <paper-material id={{item.imageName}} elevation="1" class='content-card' on-click="_selectDatalet">
  184 + <div class="legend">{{item.imageName}}</div>
  185 + <div class="card-content-image">
  186 + <img src={{item.imageUrl}}>
  187 + </div>
  188 + </paper-material>
  189 + </template>
  190 + </div>
  191 +
  192 + <div class="arrow-down"><paper-icon-button on-click="_onNextClick" icon="hardware:keyboard-arrow-down"></paper-icon-button></div>
  193 +
  194 + </paper-material>
  195 +
  196 + </template>
  197 +
  198 + <script>
  199 +
  200 + Polymer({
  201 +
  202 + is : 'items-vslider-controllet',
  203 +
  204 + properties : {
  205 +
  206 +// entryAnimation : {
  207 +// type : String,
  208 +// value : ""
  209 +// },
  210 +//
  211 +// exitAnimation : {
  212 +// type : String,
  213 +// value : ""
  214 +// },
  215 +
  216 + selectedDatalet : {
  217 + type : String,
  218 + value : undefined
  219 + },
  220 +
  221 +// prevSelectedCard : {
  222 +// type : Object,
  223 +// value : undefined
  224 +// },
  225 +
  226 + datalets : {
  227 + type : Array,
  228 + value : []
  229 + },
  230 +
  231 + filteredDatalets : {
  232 + type : Array,
  233 + value : []
  234 + },
  235 +
  236 + pages : {
  237 + type : Array,
  238 + value : []
  239 + },
  240 +
  241 + dataletsPerPage : {
  242 + type : Array,
  243 + value : []
  244 + },
  245 +
  246 + filter : {
  247 + type : String,
  248 + value : "",
  249 + observer : '_filterDatalets'
  250 + }
  251 + },
  252 +
  253 + listeners: {
  254 + 'dom-change': '_onDomChange'
  255 + },
  256 +
  257 + ready : function() {
  258 + $(this.$.div_datalets_container).perfectScrollbar();
  259 +
  260 + this._resize();
  261 + var that = this;
  262 + window.addEventListener("resize", function() { that._resize(); });
  263 + },
  264 +
  265 + _clearInput : function() {
  266 + this.$.div_search.value = "";
  267 + ///////usa sempre this.$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  268 + ///////usa sempre this.$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  269 + ///////usa sempre this.$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  270 + ///////usa sempre this.$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  271 + },
  272 +// attached : function() {
  273 +// this._resize();
  274 +// var that = this;
  275 +// window.addEventListener("resize", function() { that._resize(); });
  276 +// },
  277 +
  278 + _getDatalets : function(e){
  279 + var datalets = new Array();
  280 + for(var i=0; i < e.detail.response.length; i++){
  281 + var datalet = { imageName : e.detail.response[i].name.replace("-datalet", ""), imageUrl : e.detail.response[i].url + e.detail.response[i].name + ".png" };
  282 + datalets.push(datalet);
  283 +// datalets.push(datalet);
  284 + }
  285 +
  286 + {{}}
  287 + this.pages = [0,1,2];
  288 + this.dataletsPerPage = [0,1,2];
  289 +
  290 + this.datalets = datalets;
  291 + this.filteredDatalets = datalets;
  292 +
  293 +// console.log(this.datalets);
  294 + },
  295 +
  296 + _filterDatalets : function(){//console.log(this.filter);
  297 + var datalets = new Array();
  298 + for(var i=0; i < this.datalets.length; i++){
  299 + var datalet = this.datalets[i];
  300 +// console.log(datalet.imageName.indexOf(this.filter));
  301 +// console.log(datalet.imageName);
  302 + if(datalet.imageName.indexOf(this.filter) != -1){
  303 + datalets.push(datalet);
  304 +// console.log("we");
  305 + }
  306 +
  307 + }
  308 +
  309 +// console.log(datalets);
  310 + this.filteredDatalets = datalets;
  311 +
  312 +
  313 +
  314 + ///////////////
  315 +//
  316 +// console.log(this.selectedDatalet);
  317 +// if(this.selectedDatalet != undefined && (document.getElementById(this.selectedDatalet)) != null ){
  318 +//
  319 +// var datalet = document.getElementById(this.selectedDatalet);
  320 +// console.log(datalet);
  321 +// datalet.elevation = "5";
  322 +// datalet.childNodes[2].className = datalet.childNodes[2].className + " selected";
  323 +// }
  324 +
  325 + //////////////
  326 +
  327 +
  328 + $("#div_datalets_container").animate({ scrollTop: 0}, 0);
  329 +
  330 + },
  331 +
  332 + _onDomChange : function() {
  333 + console.log("dom changed");
  334 + console.log(this.filteredDatalets);
  335 +
  336 + if(this.selectedDatalet != undefined ){
  337 +// console.log(this.selectedDatalet);
  338 +// var datalets = document.getElementsByClassName("content-card");
  339 +// var datalets = document.getElementsByTagName("paper-material");
  340 +
  341 + for(var i=0; i < this.filteredDatalets.length; i++){
  342 + var datalet = this.filteredDatalets[i];
  343 +// console.log(datalet.imageName);
  344 + datalet = document.getElementById(datalet.imageName);//dataletCarDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
  345 + console.log(datalet);
  346 + datalet.elevation = "1";
  347 + datalet.childNodes[2].className = datalet.childNodes[2].className.replace("selected", "");
  348 + }
  349 +//
  350 + if(document.getElementById(this.selectedDatalet) != null ){
  351 +
  352 + var datalet = document.getElementById(this.selectedDatalet);
  353 + console.log(datalet);
  354 + datalet.elevation = "5";
  355 + datalet.childNodes[2].className = datalet.childNodes[2].className + " selected";
  356 + }
  357 +
  358 + }
  359 + },
  360 +
  361 + _selectDatalet : function(e){
  362 +// var dataletId = e.currentTarget.id;
  363 +// console.log(dataletId)
  364 +
  365 + if(this.selectedDatalet != undefined){
  366 + var datalet = document.getElementById(this.selectedDatalet);
  367 + datalet.elevation = "1";
  368 + datalet.childNodes[2].className = datalet.childNodes[2].className.replace("selected", "");
  369 + }
  370 +
  371 + e.currentTarget.elevation = "5";
  372 + e.currentTarget.childNodes[2].className = e.currentTarget.childNodes[2].className + " selected";
  373 +
  374 + console.log("weeeeeeeeeeeeeeeeee");
  375 + this.selectedDatalet = e.currentTarget.id;
  376 + },
  377 +
  378 +// _onCardClick : function(e){//prevSelectedCard-->selectedCard, no selected!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  379 +//
  380 +//// console.log(e.currentTarget);
  381 +//
  382 +//
  383 +// //controlla sul search......................................................................
  384 +//
  385 +//// dai ID alle card e modifica funzione!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  386 +//// disabilita pulsante top o bottom e multiclick
  387 +// if(this.prevSelectedCard != undefined){
  388 +// this.prevSelectedCard.elevation = "1";
  389 +// this.prevSelectedCard.childNodes[2].className = this.prevSelectedCard.childNodes[2].className.replace("selected", "");
  390 +// }
  391 +//
  392 +//
  393 +// e.currentTarget.elevation = "5";
  394 +// e.currentTarget.childNodes[2].className = e.currentTarget.childNodes[2].className + " selected";
  395 +//
  396 +// var b = document.getElementById("barchart");
  397 +//
  398 +//// b.elevation = "5";
  399 +//// b.childNodes[2].className = e.currentTarget.childNodes[2].className + " selected";
  400 +//
  401 +// this.prevSelectedCard = e.currentTarget;
  402 +//
  403 +//// this.fire('items-slider-controllet_item-selected', {datalet: e.currentTarget.id + "-datalet"});
  404 +//
  405 +// },
  406 +
  407 +// _getImageUrl : function(page, index){
  408 +// return this.datalets[3*page+index].imageUrl;
  409 +// },
  410 +
  411 + _getImageUrl : function(index){
  412 + return this.datalets[index].imageUrl;
  413 + },
  414 +
  415 + _onPrevClick : function() {
  416 +
  417 + var container = $("#div_datalets_container");
  418 + var h = container.height();
  419 + var dataletPerPage = parseInt(h/156);
  420 + var scroll = $("#div_datalets_container").scrollTop()-156*dataletPerPage;
  421 + var diff = scroll % 156;
  422 +// scroll += 156-diff;
  423 + scroll -= diff;
  424 + $("#div_datalets_container").animate({ scrollTop: scroll}, 300);
  425 +
  426 +
  427 +// var scroll = $("#div_datalets_container").scrollTop()-156*3;
  428 +// console.log(scroll);
  429 +
  430 +// console.log(scroll);
  431 + },
  432 +
  433 + _onNextClick : function() {
  434 + var container = $("#div_datalets_container");
  435 + var h = container.height();
  436 + var dataletPerPage = parseInt(h/156);
  437 + var scroll = $("#div_datalets_container").scrollTop()+156*dataletPerPage;
  438 + var diff = scroll % 156;
  439 + scroll -= diff;
  440 + $("#div_datalets_container").animate({ scrollTop: scroll}, 300);
  441 +
  442 +// var scroll = $("#div_datalets_container").scrollTop()+156*3;
  443 +//// console.log(scroll);
  444 +// $("#div_datalets_container").animate({ scrollTop: scroll}, 300);
  445 +//// console.log(scroll);
  446 + },
  447 +
  448 + _resize : function(){console.log("we");
  449 + var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
  450 + h = h - 64 - 8; //height with page scroller
  451 + $("#material_items_vslider").height(h);
  452 + }
  453 +
  454 + });
  455 +
  456 + </script>
  457 +
  458 +</dom-module>
0 459 \ No newline at end of file
... ...
controllets/items-vslider-controllet/test.html 0 → 100755
  1 +<!doctype html>
  2 +<!--
  3 +Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
  4 +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
  5 +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
  6 +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
  7 +Code distributed by Google as part of the polymer project is also
  8 +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
  9 +-->
  10 +<html>
  11 +<head>
  12 + <title>neon-animated-pages demo: declarative</title>
  13 +
  14 + <meta charset="utf-8">
  15 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  16 + <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
  17 +
  18 + <script src="../../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  19 +
  20 + <link rel="import" href="../../bower_components/paper-styles/paper-styles.html">
  21 + <link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">
  22 + <link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
  23 + <link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  24 +
  25 + <style>
  26 + body {
  27 + overflow: hidden;
  28 + }
  29 + .toolbar {
  30 + padding: 8px;
  31 + }
  32 + </style>
  33 +
  34 + <style is="custom-style">
  35 + neon-animatable {
  36 + color: white;
  37 + @apply(--layout-horizontal);
  38 + @apply(--layout-center-center);
  39 + @apply(--paper-font-display4);
  40 + }
  41 + neon-animatable:nth-child(1) {
  42 + background: var(--paper-red-500);
  43 + }
  44 + neon-animatable:nth-child(2) {
  45 + background: var(--paper-blue-500);
  46 + }
  47 + neon-animatable:nth-child(3) {
  48 + background: var(--paper-orange-500);
  49 + }
  50 + neon-animatable:nth-child(4) {
  51 + background: var(--paper-green-500);
  52 + }
  53 + neon-animatable:nth-child(5) {
  54 + background: var(--paper-purple-500);
  55 + }
  56 + </style>
  57 +
  58 +</head>
  59 +<body class="fullbleed layout vertical">
  60 +
  61 +<template is="dom-bind">
  62 +
  63 + <div class="toolbar">
  64 + <button on-click="_onPrevClick">&lt;&lt;</button>
  65 + <button on-click="_onNextClick">&gt;&gt;</button>
  66 + </div>
  67 +
  68 + <neon-animated-pages id="pages" class="flex" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">
  69 + <neon-animatable>1</neon-animatable>
  70 + <neon-animatable>2</neon-animatable>
  71 + <neon-animatable>3</neon-animatable>
  72 + <neon-animatable>4</neon-animatable>
  73 + <neon-animatable>5</neon-animatable>
  74 + </neon-animated-pages>
  75 +
  76 +</template>
  77 +
  78 +<script>
  79 + var scope = document.querySelector('template[is="dom-bind"]');
  80 + scope.selected = 0;
  81 + scope._onPrevClick = function() {
  82 + this.entryAnimation = '';
  83 + this.exitAnimation = 'slide-up-animation';
  84 + this.selected = this.selected === 0 ? 4 : (this.selected - 1);
  85 + }
  86 + scope._onNextClick = function() {
  87 + this.entryAnimation = 'slide-down-animation';
  88 + this.exitAnimation = '';
  89 + this.selected = this.selected === 4 ? 0 : (this.selected + 1);
  90 + }
  91 +</script>
  92 +
  93 +</body>
  94 +</html>
0 95 \ No newline at end of file
... ...
controllets/multi-table-controllet/demo/index.html 100644 → 100755
controllets/multi-table-controllet/multi-table-controllet.html 100644 → 100755
... ... @@ -130,7 +130,7 @@
130 130 }
131 131 },
132 132  
133   - _copy : function(o) {//non necessario
  133 + _copy : function(o) {
134 134 var out, v, key;
135 135 out = Array.isArray(o) ? [] : {};
136 136 for (key in o) {
... ...
controllets/page-slider-controllet/demo/index.html 100644 → 100755
controllets/page-slider-controllet/page-slider-controllet.html
... ... @@ -17,15 +17,23 @@
17 17 color: #00BCD4;
18 18 height: 48px;
19 19 width: 48px;
  20 + padding: 0px;
20 21 --paper-icon-button-ink-color: #00BCD4;
21 22 }
22 23  
23 24 paper-icon-button:hover{
  25 + color: #00AABF;
  26 + }
  27 +
  28 + paper-icon-button[disabled]{
  29 + color: #B6B6B6;
24 30 }
25 31  
26 32 .header{
  33 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
27 34 width: 100%;
28   - padding-bottom: 8px;
  35 + /*padding-bottom: 8px;*/
  36 + /*border-bottom: 2px solid #B6B6B6;*/
29 37 }
30 38  
31 39 .chevron-left{
... ... @@ -133,7 +141,7 @@
133 141 avatar : {
134 142 type : String,
135 143 value : "1"
136   - },
  144 + }
137 145  
138 146 },
139 147  
... ...
controllets/tree-view-controllet/demo/index.html
... ... @@ -64,6 +64,7 @@
64 64 </html>
65 65  
66 66 <!--urls:-->
  67 +<!--https://yperdiavgeia.gr/analytics/counts/source:Decision/query:linux/method:count_organization.json-->
67 68 <!--http://dati.lazio.it/catalog/api/action/datastore_search?resource_id=114baf3d-6d4f-42ff-b4af-481beef59ae1-->
68 69 <!--url: 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=5',-->
69 70 <!--url: 'https://data.issy.com/api/records/1.0/search?dataset=liste-des-restaurants-a-issy-les-moulineaux&sort=type&facet=type&facet=terrasse',-->
... ...
controllets/tree-view-multi-table-controllet/demo/index.html 100644 → 100755
1 1 <html>
2 2  
3 3 <head>
  4 + <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  5 +
4 6 <script src="../../shared_js/jquery-1.11.2.min.js"></script>
5 7  
6   - <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  8 + <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  9 + <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
7 10  
8 11 <link rel="import" href="../../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html" />
9 12 </head>
... ...
controllets/tree-view-multi-table-controllet/tree-view-multi-table-controllet.html 100644 → 100755
... ... @@ -5,10 +5,6 @@
5 5 <link rel="import" href="../tree-view-controllet/tree-view-controllet.html" />
6 6 <link rel="import" href="../multi-table-controllet/multi-table-controllet.html" />
7 7  
8   -<script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
9   -<link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
10   -
11   -
12 8 <dom-module id="tree-view-multi-table-controllet">
13 9  
14 10 <style is="custom-style">
... ... @@ -68,7 +64,8 @@
68 64  
69 65 dataUrl : {
70 66 type : String,
71   - value : undefined
  67 + value : undefined,
  68 + observer : '_init'
72 69 }
73 70  
74 71 },
... ... @@ -78,21 +75,19 @@
78 75 },
79 76  
80 77 ready : function() {
81   - var tree = document.getElementById('tree_view');
82   -
83   - $.ajax({
84   - url: this.dataUrl,
85   - dataType: "json",
86   - success: function(data){
87   - tree.setAttribute("json-data", JSON.stringify(data));
88   - tree.ready();
89   - }
90   - });
  78 +// if(this.dataUrl)
  79 +// this._init();
91 80  
92 81 $(this.$.material_tree_view).perfectScrollbar();
93 82 $(this.$.material_multi_table).perfectScrollbar();
94 83 },
95 84  
  85 + attached : function(){
  86 + this._resize();
  87 + var that = this;
  88 + window.addEventListener("resize", function() { that._resize(); });
  89 + },
  90 +
96 91 getFields : function() {
97 92 return this.$.tree_view.getFields();
98 93 },
... ... @@ -101,11 +96,33 @@
101 96 return this.$.tree_view.getFlatFields();
102 97 },
103 98  
  99 + _init : function() {
  100 + var tree = document.getElementById('tree_view');
  101 + var t = this;
  102 +
  103 + $.ajax({
  104 + url: this.dataUrl,
  105 + dataType: "json",
  106 + success: function(data){
  107 + tree.setAttribute("json-data", JSON.stringify(data));
  108 + tree.selectedFields = [];
  109 + t._updateSelectedFields();
  110 + tree.ready();
  111 + }
  112 + });
  113 + },
  114 +
104 115 _updateSelectedFields : function() {
105 116 var fields = this.$.tree_view.getFields();
106 117 this.$.multi_table.setSelectedFields(fields);
107 118 },
108 119  
  120 + _resize : function(){
  121 + var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
  122 + h = h - 64; //height with page scroller
  123 + $("#material_tree_view").height(h);
  124 + }
  125 +
109 126 });
110 127  
111 128 </script>
... ...
datalets/base-ajax-json-jsonpath-datalet/static/js/AjaxJsonJsonPathBehavior.js
... ... @@ -2,7 +2,7 @@
2 2 @license
3 3 The MIT License (MIT)
4 4  
5   - Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy
  5 + Copyright (c) 2015 Dipartimento di Informatica - Universit� di Salerno - Italy
6 6  
7 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 8 of this software and associated documentation files (the "Software"), to deal
... ... @@ -98,7 +98,7 @@ var AjaxJsonJsonPathBehavior = {
98 98 *
99 99 * @method selectData
100 100 */
101   - selectData : function(){
  101 + selectData : function() {
102 102  
103 103 this.data = [];
104 104  
... ... @@ -107,17 +107,27 @@ var AjaxJsonJsonPathBehavior = {
107 107  
108 108 this._component.fields = JSON.parse(this._component.fields);
109 109  
110   - for(var i=0;i < this._component.fields.length; i++){
  110 + for (var i = 0; i < this._component.fields.length; i++) {
111 111 var query = "$";
112 112 var query_elements = this._component.fields[i].split(',');
113   - for(var j=0; j < query_elements.length;j++){
  113 + for (var j = 0; j < query_elements.length; j++) {
114 114 query += "['" + query_elements[j] + "']";
115   - if(this.isFieldArray(query_elements.slice(0,j+1))){
  115 + if (this.isFieldArray(query_elements.slice(0, j + 1))) {
116 116 query += "[*]";
117 117 }
118 118 }
119   - this.data.push({name : query_elements[query_elements.length - 1], data : jsonPath(this.properties.json_results.value, query)});
  119 + this.data.push({
  120 + name: query_elements[query_elements.length - 1],
  121 + data: jsonPath(this.properties.json_results.value, query)
  122 + });
120 123 }
121   - }
  124 + this.deleteWaitImage();
  125 + },
122 126  
  127 + /**
  128 + * Delete a image after loading a datalet
  129 + */
  130 + deleteWaitImage : function() {
  131 + $("img[src$='spin.svg']").remove();
  132 + }
123 133 };
124 134 \ No newline at end of file
... ...
datalets/base-datalet/base-datalet.html
... ... @@ -72,13 +72,28 @@ Example :
72 72 height:32px;
73 73 width: 32px;
74 74 }
  75 + #image_spin {
  76 + height:32px;
  77 + width: 32px;
  78 + position: relative;
  79 + center: center;
  80 + width: 100%;
  81 + }
  82 +
  83 +
75 84 </style>
76 85  
  86 + <div id="base_datalet_imgWaitDatalet">
  87 + <img id="image_spin" src="static/images/spin.svg">
  88 +
  89 + </div>
77 90 <div id="base_datalet_container">
78   - <b>Source: </b><span id="domain"></span>
  91 + <b> Source:</b><span id="domain"></span>
  92 + <b> </b><span id="domainPage">
  93 + </span>
79 94 <div id="base_datalet_rtp">
80   - <div id="rtp">Powered by Route-to-PA</div>
81   - <div><a href="http://routetopa.eu/"><img id="rtpalogo" src="static/images/rtpalogo.png"></a></div>
  95 + <div id="rtp">Powered by ROUTE-TO-PA</div>
  96 + <div><a href="http://www.routetopa.eu/"><img id="rtpalogo" src="static/images/rtpalogo.png" ></a></div>
82 97 </div>
83 98 </div>
84 99  
... ... @@ -92,20 +107,50 @@ Example :
92 107 <script>
93 108 BaseDatalet = Polymer({
94 109 is: 'base-datalet',
95   -
  110 + objectDatalet: {
  111 + /**
  112 + * It contains the json data from async xhr call returned from core-ajax core component
  113 + *
  114 + * @attribute json_resultDatalet
  115 + * @type object
  116 + * @default 'null'.
  117 + */
  118 + json_resultDatalet: {
  119 + type: Object,
  120 + value: {}
  121 + }
  122 + },
96 123 /**
97 124 * It is called after the element�s template has been stamped and all elements inside the element�s local
98 125 * DOM have been configured (with values bound from parents, deserialized attributes, or else default values)
99 126 * and had their ready method called.
100 127 *
101   - * Extract the dataset domain from the entire URL and set the text content of the datalet footer.
102   - *
  128 + * Extract
  129 + * 1) the dataset domain
  130 + * 2) the page of a datalet
  131 + * from the entire URL and set the text content of the datalet footer.
103 132 * @method ready
104   - *
105 133 */
106 134 ready: function(){
  135 + var urlDatalet;
107 136 if(this.dataUrl != undefined){
108   - this.$.domain.textContent = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];
  137 +
  138 + var apiIdResource = "resource_show?id=";
  139 +
  140 + //Resourceid of a datalet
  141 + var query = this.dataUrl.substring(this.dataUrl.indexOf("?"), this.dataUrl.length);
  142 + var params = this.decomponeQueryString(query);
  143 + resultIdDatalet = params["resource_id"];
  144 +
  145 + //cKan organized with or not catalog
  146 + queryInitial = this.dataUrl.substring(0, this.dataUrl.indexOf("api"));
  147 + queryFinal = this.dataUrl.substring(this.dataUrl.indexOf("api"), this.dataUrl.indexOf("datastore_search"));
  148 +
  149 + urlDatalet = queryInitial + queryFinal + apiIdResource + resultIdDatalet;
  150 + urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];
  151 +
  152 + this.$.domainPage.innerHTML = '<a href=' + urlSource + ' target=' + "_blank>" + urlSource + '</a>'+ "." ;
  153 + this.requestDataletData(urlDatalet);
109 154 }
110 155 },
111 156 /**
... ... @@ -113,7 +158,65 @@ Example :
113 158 */
114 159 setDomain: function(url){
115 160 this.$.domain.textContent = url;
  161 + },
  162 + /**
  163 + * Get the (key, value) query string parameters
  164 + **/
  165 + decomponeQueryString: function (querystring) {
  166 + // remove any preceding url and split
  167 + querystring = querystring.substring(querystring.indexOf('?')+1).split('&');
  168 + var params = {}, pair, d = decodeURIComponent;
  169 + // march and parse
  170 + for (var i = querystring.length - 1; i >= 0; i--) {
  171 + pair = querystring[i].split('=');
  172 + params[d(pair[0])] = d(pair[1]);
  173 + }
  174 + return params;
  175 + },
  176 + /**
  177 + * Make an AJAX call to the dataset URL to retrieve package_id
  178 + *
  179 + * @method urlDatalet
  180 + */
  181 + requestDataletData: function(urlDatalet){
  182 + var comp = this;
  183 + $.ajax({
  184 + url: urlDatalet, //url con package
  185 + dataType: "json",
  186 + success: function(e){
  187 + comp.handleDataletResponse(e);
  188 + }
  189 + });
  190 + },
  191 + /**
  192 + * Called when core-ajax component receive the json data from called url.
  193 + *
  194 + * @method handleResponse
  195 + */
  196 + handleDataletResponse: function(e) {
  197 + this.objectDatalet.json_resultDatalet.value = e;
116 198  
  199 + //packageId of a give datalet
  200 + packageIdDatalet = this.objectDatalet.json_resultDatalet.value.result.package_id;
  201 + resourceId = this.objectDatalet.json_resultDatalet.value.result.id;
  202 +
  203 + //url complete of download
  204 + urlDatasetDownload = this.objectDatalet.json_resultDatalet.value.result.url;
  205 +
  206 + if(this.dataUrl != undefined){
  207 + //static url
  208 + lastStringResourceId = this.dataUrl.split("/")[5];
  209 + resourceId = lastStringResourceId.split('=')[1];
  210 + var urlDatalet = this.dataUrl.split("/")[0]+ "//" + this.dataUrl.split("/")[2] + "/dataset/" + packageIdDatalet +"/resource/" +resourceId;
  211 +
  212 +
  213 + urlDatalet = urlDatasetDownload.replace(/\/download\/.*/, '');
  214 + urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];
  215 +
  216 +
  217 + this.$.domainPage.innerHTML += " (" + ' <a href=' + urlDatalet + ' target=' + "_blank>" + "Dataset's page" + '</a>' + " )";
  218 +
  219 + }
117 220 }
118 221 });
119 222 </script>
... ...
datalets/base-datalet/static/images/spin.svg 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?><svg width='198px' height='198px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-spin"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><g transform="translate(50 50)"><g transform="rotate(0) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(45) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.12s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.12s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(90) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.25s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.25s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(135) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.37s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.37s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(180) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.5s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.5s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(225) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.62s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.62s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(270) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.75s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.75s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(315) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.87s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.87s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g></g></svg>
0 2 \ No newline at end of file
... ...
datalets/datasetexplorer-datalet/datasetexplorer-datalet.html 100644 → 100755
... ... @@ -29,7 +29,8 @@
29 29 *
30 30 -->
31 31  
32   -<link rel="import" href="http://deep.routetopa.eu/COMPONENTS/datalets/base-ajax-json-jsonpath-datalet/base-ajax-json-jsonpath-datalet.html">
  32 +<link rel="import" href="../base-ajax-json-jsonpath-datalet/base-ajax-json-jsonpath-datalet.html">
  33 +<link rel="import" href="../base-ajax-json-jsonpath-datalet/base-ajax-json-jsonpath-datalet.html">
33 34  
34 35 <!--
35 36  
... ... @@ -64,7 +65,8 @@ Example:
64 65 width: 100%;
65 66 height: 70%;
66 67 min-height: 500px;
67   - background: #ddd;
  68 + background: #ffffff;
  69 + position: relative;
68 70 }
69 71  
70 72 :host ::content text {
... ... @@ -107,12 +109,23 @@ Example:
107 109 :host ::content .children:hover rect.child {
108 110 fill: #bbb;
109 111 }
  112 +
  113 + :host ::content .spinner {
  114 + position: absolute;
  115 + left: 50%;
  116 + top: 50%;
  117 + width: 160px;
  118 + height: 160px;
  119 + margin-left: -80px;
  120 + margin-top: -80px;
  121 +
  122 + }
110 123 </style>
111 124 <div id="treemap_placeholder"></div>
112 125 <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet>
113 126 </template>
114 127  
115   - <script src="http://deep.routetopa.eu/COMPONENTS/datalets/shared_js/d3.js"></script>
  128 + <script src="../shared_js/d3.js"></script>
116 129 <script src="js/buildtreemap.js"></script>
117 130 <script>
118 131  
... ... @@ -182,7 +195,15 @@ Example:
182 195 },
183 196  
184 197 presentData: function(){
185   - build(this.map, "treemap_placeholder");
  198 + var me = this;
  199 + var xyz = function(url) {
  200 + me.selectResource(url);
  201 + }
  202 + build(this.map, "treemap_placeholder", xyz);
  203 + },
  204 +
  205 + selectResource: function(url) {
  206 + this._component.fire("datasetexplorer-datalet_data-url", { url: url });
186 207 }
187 208 };
188 209  
... ... @@ -217,7 +238,7 @@ Example:
217 238  
218 239 ready: function(){
219 240 this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DatasetexplorerBehavior);
220   - this.async(function(){this.behavior.init(this)},1000);
  241 + this.async(function(){this.behavior.init(this)},0);
221 242 }
222 243  
223 244 });
... ...
datalets/datasetexplorer-datalet/datasetexplorer-datalet.png 100644 → 100755

1.58 KB | W: | H:

1.58 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/datasetexplorer-datalet/demo/index.html 100644 → 100755
datalets/datasetexplorer-datalet/docs.html 100644 → 100755
datalets/datasetexplorer-datalet/js/buildtreemap.js 100644 → 100755
... ... @@ -2,14 +2,12 @@
2 2 * Created by Utente on 17/07/2015.
3 3 */
4 4  
5   -function build(root, place_holder) {
  5 +function build(root, place_holder, select_listener) {
6 6  
7 7 var plwidth = $("#" + place_holder).width(),
8 8 plheight = $("#" + place_holder).height();
9 9  
10 10 var margin = {top: 20, right: 0, bottom: 0, left: 0},
11   - //width = 960,
12   - //height = 500 - margin.top - margin.bottom,
13 11 width = plwidth,
14 12 height = plheight - margin.top - margin.bottom,
15 13 formatNumber = d3.format(",d"),
... ... @@ -17,6 +15,7 @@ function build(root, place_holder) {
17 15  
18 16 var x = d3.scale.linear()
19 17 .domain([0, width])
  18 + .domain([0, width])
20 19 .range([0, width]);
21 20  
22 21 var y = d3.scale.linear()
... ... @@ -29,7 +28,8 @@ function build(root, place_holder) {
29 28 .ratio(height / width * 0.5 * (1 + Math.sqrt(5)))
30 29 .round(false);
31 30  
32   - var svg = d3.select("#" + place_holder).append("svg")
  31 + var svg = d3.select("#" + place_holder)
  32 + .append("svg")
33 33 .attr("width", width + margin.left + margin.right)
34 34 .attr("height", height + margin.bottom + margin.top)
35 35 .style("margin-left", -margin.left + "px")
... ... @@ -102,7 +102,7 @@ function build(root, place_holder) {
102 102 }
103 103 }
104 104  
105   - function display(d) {0
  105 + function display(d) {
106 106 grandparent
107 107 .datum(d.parent)
108 108 .on("click", transition)
... ... @@ -135,9 +135,7 @@ function build(root, place_holder) {
135 135  
136 136 g.append("text")
137 137 .attr("dy", ".75em")
138   - .text(function(d) { return (d._children) ? d.name : ''; })
139   - .call(text)
140   - ;
  138 + .call(text);
141 139  
142 140 function transition(d) {
143 141 if (transitioning || !d) return;
... ... @@ -160,7 +158,7 @@ function build(root, place_holder) {
160 158 svg.style("shape-rendering", null);
161 159  
162 160 // Draw child nodes on top of parent nodes.
163   - svg.selectAll(".depth").sort(function(a, b) { return a.depth - b.depth; });
  161 + svg.selectAll(".depth").sort(function(a, b) { return b.depth - a.depth; });
164 162  
165 163 // Fade-in entering text.
166 164 g2.selectAll("text").style("fill-opacity", 0);
... ... @@ -179,24 +177,110 @@ function build(root, place_holder) {
179 177 }
180 178  
181 179 if (!d._children[0]._children) {
  180 + if (select_listener) {
  181 + var url = d._children[0].name;
  182 +
  183 + // Check if CKAN
  184 + var strDatasetPos = url.indexOf('/dataset/');
  185 + var strResourcePos = (strDatasetPos >= 0) ? url.indexOf('/resource/') : -1;
  186 + if (strDatasetPos >= 0 && strResourcePos > strDatasetPos) {
  187 + var urlSegment1 = url.substring(0, strDatasetPos);
  188 + var urlResourceEnd = url.indexOf('/', strResourcePos + 10);
  189 + var resourceId = url.substring(strResourcePos + 10, urlResourceEnd);
  190 + url = urlSegment1 + "/api/action/datastore_search?resourceid=" + resourceId;
  191 + }
  192 +
  193 + // Check if OPENDATASOFT
  194 + var strExploreDatasetPos = url.indexOf('/explore/dataset/');
  195 + if (strExploreDatasetPos >= 0) {
  196 + var urlSegment1 = url.substring(0, strExploreDatasetPos);
  197 + var datasetEnd = url.indexOf(strExploreDatasetPos + 17, '/');
  198 + var datasetId = url.substring(strExploreDatasetPos + 17, datasetEnd >= 0 ? datasetEnd : url.length);
  199 + url = urlSegment1 + '/api/records/1.0/search?dataset=' + datasetId;
  200 + }
  201 +
  202 + select_listener(url);
  203 + }
  204 +
182 205 var dataurl = d._children[0].name;
183 206 var pageurl = dataurl.replace(/\/download\/.*/, '');
184 207 dataletContainer = svg
185 208 .append("foreignObject")
186 209 .attr("width", root.dx)
187 210 .attr("height", root.dy - root.y)
188   - .append("xhtml:body")
189   - .html('<iframe src="'+pageurl+'" width="'+root.dx+'" height="'+root.dy+'"></iframe>');
190   -
  211 + .append("xhtml:body")
  212 + .html('<iframe src="'+pageurl+'" width="'+root.dx+'" height="'+root.dy+'"></iframe>');
191 213 }
192 214  
193 215 return g;
194 216 }
195 217  
196 218 function text(text) {
197   - text.attr("x", function(d) { return x(d.x) + 6; })
198   - .attr("y", function(d) { return y(d.y) + 6; })
199   - ;
  219 + text
  220 + .attr("x", function(d) { return x(d.x) + 6; })
  221 + .attr("y", function(d) { return y(d.y) + 6; });
  222 + text.call(wrap);
  223 + }
  224 +
  225 + function wrap(d) {
  226 + var wwidth = width;
  227 + var hheight = height;
  228 +
  229 + d.each(function(){
  230 + var text = d3.select(this),
  231 + d = text[0][0].__data__,
  232 + name = d.name.trim(),
  233 + words = name.search(/\s+/) >= 0 ? name.split(/\s+/).reverse() : [name],
  234 + word = words.pop(),
  235 + line = [word],
  236 + lineNumber = 0,
  237 + lineHeight = 1.1, // ems
  238 + x = parseFloat(text.attr("x")),
  239 + y = parseFloat(text.attr("y")),
  240 + dy = parseFloat(text.attr("dy"));
  241 + text.selectAll("tspan").remove();
  242 +
  243 + var fx = d3.scale.linear()
  244 + .domain([d.parent.x, d.parent.x + d.parent.dx])
  245 + .range([0, wwidth]);
  246 +
  247 + var fy = d3.scale.linear()
  248 + .domain([d.parent.y, d.parent.y + d.parent.dy])
  249 + .range([0, hheight]);
  250 +
  251 + var tspan = text
  252 + .text(null)
  253 + .append("tspan")
  254 + .attr("x", fx(d.x) + 6)
  255 + .attr("y", fy(d.y) + 6)
  256 + .attr("dy", lineNumber++ * lineHeight + dy + "em")
  257 + .text(word);
  258 + var width = fx(d.x + d.dx) - fx(d.x) - 12;
  259 + var height = fy(d.y + d.dy) - fy(d.y) - 6;
  260 +
  261 + while (word = words.pop()) {
  262 + line.push(word);
  263 + tspan.text(line.join(" "));
  264 + if (tspan.node().getComputedTextLength() > width) {
  265 + line.pop();
  266 + tspan.text(line.join(" "));
  267 +
  268 + line = [word];
  269 +
  270 + tspan = text
  271 + .append("tspan")
  272 + .attr("x", fx(d.x) + 6)
  273 + .attr("y", fy(d.y) + 6)
  274 + .attr("dy", lineNumber++ * lineHeight + dy + "em")
  275 + .text(word);
  276 +
  277 + if (text.node().offsetHeight > height) {
  278 + tspan.remove();
  279 + break;
  280 + }
  281 + }
  282 + }
  283 + });
200 284 }
201 285  
202 286 function rect(rect) {
... ...
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/dataTables.bootstrap.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/dataTables.bootstrap.min.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/dataTables.foundation.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/dataTables.foundation.min.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/dataTables.jqueryui.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/dataTables.jqueryui.min.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/jquery.dataTables.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/jquery.dataTables.min.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/css/jquery.dataTables_themeroller.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/images/sort_asc.png 100644 → 100755

160 Bytes | W: | H:

160 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/images/sort_asc_disabled.png 100644 → 100755

148 Bytes | W: | H:

148 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/images/sort_both.png 100644 → 100755

201 Bytes | W: | H:

201 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/images/sort_desc.png 100644 → 100755

158 Bytes | W: | H:

158 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/images/sort_desc_disabled.png 100644 → 100755

146 Bytes | W: | H:

146 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/dataTables.bootstrap.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/dataTables.bootstrap.min.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/dataTables.foundation.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/dataTables.foundation.min.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/dataTables.jqueryui.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/dataTables.jqueryui.min.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/jquery.dataTables.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/DataTables-1.10.9/js/jquery.dataTables.min.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/datatables.css 100644 → 100755
... ... @@ -879,7 +879,7 @@ body .ui-tooltip {
879 879 .ui-widget-content .ui-state-default,
880 880 .ui-widget-header .ui-state-default {
881 881 /*border: 1px solid #cccccc;*/
882   - height: 48px;
  882 + /*height: 48px;*/
883 883 /*font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;*/
884 884 background: #2196F3; /*#f6f6f6 url("jQueryUI-1.11.4/images/ui-bg_glass_100_f6f6f6_1x400.png") 50% 50% repeat-x;*/
885 885 font-weight: 700;
... ... @@ -1263,7 +1263,7 @@ table.dataTable tfoot th {
1263 1263 }
1264 1264 table.dataTable thead th,
1265 1265 table.dataTable thead td {
1266   - padding: 10px 18px;
  1266 + padding: 15px 18px;
1267 1267 }
1268 1268 table.dataTable thead th:active,
1269 1269 table.dataTable thead td:active {
... ...
datalets/dynamic-datatable-datalet/js/DataTables/datatables.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/datatables.min.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/datatables.min.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_diagonals-thick_18_b81900_40x40.png 100644 → 100755

360 Bytes | W: | H:

360 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_diagonals-thick_20_666666_40x40.png 100644 → 100755

304 Bytes | W: | H:

304 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_flat_10_000000_40x100.png 100644 → 100755

204 Bytes | W: | H:

204 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_glass_100_f6f6f6_1x400.png 100644 → 100755

256 Bytes | W: | H:

256 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_glass_100_fdf5ce_1x400.png 100644 → 100755

330 Bytes | W: | H:

330 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_glass_65_ffffff_1x400.png 100644 → 100755

207 Bytes | W: | H:

207 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_gloss-wave_35_f6a828_500x100.png 100644 → 100755

5.13 KB | W: | H:

5.13 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_highlight-soft_100_eeeeee_1x100.png 100644 → 100755

258 Bytes | W: | H:

258 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-bg_highlight-soft_75_ffe45c_1x100.png 100644 → 100755

303 Bytes | W: | H:

303 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-icons_222222_256x240.png 100644 → 100755

4.33 KB | W: | H:

4.33 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-icons_228ef1_256x240.png 100644 → 100755

4.33 KB | W: | H:

4.33 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-icons_ef8c08_256x240.png 100644 → 100755

4.33 KB | W: | H:

4.33 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-icons_ffd27a_256x240.png 100644 → 100755

4.33 KB | W: | H:

4.33 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/images/ui-icons_ffffff_256x240.png 100644 → 100755

4.33 KB | W: | H:

4.33 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.min.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.min.js 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.structure.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.structure.min.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.theme.css 100644 → 100755
datalets/dynamic-datatable-datalet/js/DataTables/jQueryUI-1.11.4/jquery-ui.theme.min.css 100644 → 100755
datalets/graph-datalet/graph-datalet.html 0 → 100644
  1 +<!--
  2 +@license
  3 + The MIT License (MIT)
  4 +
  5 + Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy
  6 +
  7 + Permission is hereby granted, free of charge, to any person obtaining a copy
  8 + of this software and associated documentation files (the "Software"), to deal
  9 + in the Software without restriction, including without limitation the rights
  10 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11 + copies of the Software, and to permit persons to whom the Software is
  12 + furnished to do so, subject to the following conditions:
  13 +
  14 + The above copyright notice and this permission notice shall be included in
  15 + all copies or substantial portions of the Software.
  16 +
  17 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23 + THE SOFTWARE.
  24 +-->
  25 +
  26 +<!--
  27 +* Developed by :
  28 +* ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu
  29 +*
  30 +-->
  31 +
  32 +<link rel="import" href="../base-datalet/base-datalet.html">
  33 +<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
  34 +<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
  35 +
  36 +<!--
  37 +`preview-datalet` is a datalet that allow user to preview the content of a web page. It creates a thumbnail of the site using the data-url attribute passed as input.
  38 +
  39 +Example:
  40 +
  41 + <preview-datalet data-url="http://spod.routetopa.eu"
  42 + </preview-datalet>
  43 +
  44 +
  45 +@element preview-datalet
  46 +@status beta
  47 +@homepage
  48 +@group datalets
  49 +-->
  50 +
  51 +<dom-module id="graph-datalet">
  52 + <template>
  53 +
  54 + <link rel="stylesheet" href="static/css/graphStyle.css">
  55 +
  56 + <style is="custom-style">
  57 +
  58 + #dialog{
  59 + position: absolute;
  60 + padding: 20px;
  61 + }
  62 +
  63 + </style>
  64 +
  65 + <div style="align-content: center;" id="graph_content">
  66 + <svg id="sbiricuda"></svg>
  67 + </div>
  68 +
  69 + <paper-dialog id="dialog">
  70 + <h2 id="dialog_title"></h2>
  71 + <paper-dialog-scrollable id="dialog_content">
  72 + </paper-dialog-scrollable>
  73 + </paper-dialog>
  74 +
  75 + </template>
  76 +
  77 + <script src="static/js/d3.v3.js"></script>
  78 +
  79 + <script>
  80 +
  81 + gnodes = [];
  82 + glinks = [];
  83 +
  84 + width = undefined;
  85 + height = undefined;
  86 + svg = undefined;
  87 + _this = null;
  88 + prev_selected_node = null;
  89 +
  90 + Polymer({
  91 + is : 'graph-datalet',
  92 +
  93 + properties: {
  94 + /**
  95 + * It's the url for the preview
  96 + *
  97 + * @attribute url
  98 + * @type Strig
  99 + * @default ''
  100 + */
  101 + data : {
  102 + type : Object,
  103 + value : undefined
  104 + },
  105 +
  106 + width: {
  107 + type: Number,
  108 + value: 1250
  109 + },
  110 +
  111 + height : {
  112 + type : Number,
  113 + type: undefined
  114 + },
  115 +
  116 + svg: {
  117 + type: Object,
  118 + value: undefined
  119 + }
  120 + },
  121 +
  122 + buildGraph: function (t){
  123 +
  124 + this.svg = this.svg.append("g")
  125 + .call(d3.behavior.zoom().scaleExtent([.25, 20]).on("zoom", this.zoom))
  126 + .append("g");
  127 +
  128 + this.svg.append("rect")
  129 + .attr("fill", "white")
  130 + .attr("width", width)
  131 + .attr("height", height);
  132 +
  133 + var graph = {};
  134 +
  135 + graph.nodes = t.nodes;
  136 + graph.links = t.links;
  137 +
  138 + force = d3.layout.force().nodes(graph.nodes).links(graph.links).size([this.width, this.height]).charge(-1e3).friction(.7).linkDistance(function (t)
  139 + {
  140 + return t.value ? t.value : 80
  141 + }).on("tick", this.tick).start();
  142 +
  143 + glinks = this.svg.selectAll(".link").data(graph.links).enter().append("line").attr("class", "link");
  144 +
  145 + gnodes = this.svg.selectAll(".node").data(graph.nodes).enter().append("g").attr("class", function (t) {
  146 + return t.fixed ? "node fixed" : "node"
  147 + }).attr("name", function (t) {
  148 + return t.name ? t.name.split(" ").join("_").toLowerCase() : ""
  149 + }).on("mouseover", this.mouseover)
  150 + .on("mouseout", this.mouseout)
  151 + .on("click", this.active)
  152 + .append("circle")
  153 + .attr("id", function(t){
  154 + return t.id;
  155 + })
  156 + .attr("class", function (t) {
  157 + return t.fixed ? "" : "drag"
  158 + }).attr("r", function (t) {
  159 + return t.r ? t.r : 15
  160 + }).attr("style", function (t) {
  161 + return t.color ? "stroke:" + t.color : !1
  162 + });
  163 +
  164 + //d3.selectAll(".drag").call(force.drag), svg.selectAll("g.fixed").call(text);
  165 + d3.selectAll(".drag").call(force.drag), this.svg.selectAll("g.node").call(this.text);
  166 +
  167 + svg = this.svg;
  168 +
  169 + },
  170 +
  171 + zoom: function() {
  172 + svg.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
  173 + },
  174 +
  175 + text: function (t)
  176 + {
  177 + var e = t.append("svg:foreignObject").attr("width", 120).attr("height", 30);
  178 + e.attr("style", function (t) {
  179 + return "color:" + (t.color ? t.color : "#000")
  180 + }).append("xhtml:div").html(function (t) {
  181 + //return t.fixed ? t.name : null
  182 + return t.name;
  183 + })
  184 + },
  185 +
  186 + tick : function () {
  187 + // d3.select("svg").attr("style", "transform:translate(8%)");
  188 + d3.selectAll("g foreignObject").attr("x", function (t) {
  189 + return t.x + (t.r ? 1.1 * t.r : 15)
  190 + }).attr("y", function (t) {
  191 + return t.y - 35
  192 + });
  193 +
  194 + d3.selectAll("#logo text").attr("x", function (t) {
  195 + return t.x + .7 * (t.r ? t.r : 15)
  196 + }).attr("y", function (t) {
  197 + return t.y
  198 + });
  199 +
  200 +
  201 + gnodes.attr("cx", function (t) {
  202 + return t.x = Math.max(25, Math.min(width - 50, t.x))
  203 + }).attr("cy", function (t) {
  204 + return t.y = Math.max(8, Math.min(600, t.y))
  205 + });
  206 +
  207 + glinks.attr("x1", function (t) {
  208 + return t.source.x
  209 + }).attr("y1", function (t) {
  210 + return t.source.y
  211 + }).attr("x2", function (t) {
  212 + return t.target.x
  213 + }).attr("y2", function (t) {
  214 + return t.target.y
  215 + })
  216 + },
  217 + mouseover : function (t) {
  218 + d3.select(this).selectAll("circle").transition().duration(600).ease("elastic").attr("r", function (t) {
  219 + //return 1 == t.fixed ? 1.4 * t.r : 15
  220 + return 1 == t.fixed ? 1.4 * t.r : 15
  221 + });
  222 +
  223 + },
  224 +
  225 + mouseout : function () {
  226 + d3.select(this).selectAll("text").style("visibility", "hidden"), d3.select(this).selectAll("circle").transition().duration(400).attr("r", function (t) {
  227 + return t.r ? t.r : 15
  228 + })
  229 + },
  230 +
  231 + active : function (t) {
  232 + _this.fire('graph-datalet_node-clicked', {node : t});
  233 +
  234 + if(prev_selected_node != null){
  235 + prev_selected_node.style.stroke = prev_selected_node.style.fill;
  236 + prev_selected_node.style.fill = "";
  237 + }
  238 +
  239 + prev_selected_node = document.getElementById("" + t.id);
  240 + prev_selected_node.style.fill = prev_selected_node.style.stroke;
  241 + prev_selected_node.style.stroke = "#000000";
  242 +
  243 + /* _this.$.dialog_title.innerHTML = "Comment";
  244 + _this.$.dialog_content.innerHTML = t.name;
  245 + _this.$.dialog.style.top = t.y + "px";
  246 + _this.$.dialog.style.left = t.x + "px";
  247 +
  248 + _this.$.dialog.open();*/
  249 + },
  250 +
  251 + /**
  252 + * It is called after the element’s template has been stamped and all elements inside the element’s local
  253 + * DOM have been configured (with values bound from parents, deserialized attributes, or else default values)
  254 + * and had their ready method called.
  255 + *
  256 + * Extract the dataset domain from the entire URL and set the text content of the datalet footer.
  257 + *
  258 + * @method ready
  259 + *
  260 + */
  261 + ready: function(){
  262 +
  263 + _this = this;
  264 +
  265 + this.height = 9 * this.width / 16;
  266 +
  267 + width = this.width;
  268 + height = this.height;
  269 +
  270 + this.$.graph_content.style.height = height + "px";
  271 +
  272 + this.svg = d3.select("svg#sbiricuda").attr("class", "svg").attr({
  273 + width: "100%",
  274 + height: "100%"
  275 + }).attr("viewBox", "0 0 " + this.width + " " + this.height).attr("pointer-events", "all").style("position", "absolute").attr("style", "transform:translate(0px)");
  276 +
  277 + /*var g = JSON.parse(this.data);
  278 + g.nodes[0].x = this.width / 2;
  279 + g.nodes[0].y = this.height / 2;
  280 + this.buildGraph(g);*/
  281 +
  282 + var g = this.data;
  283 + g.nodes[0].x = this.width / 2;
  284 + g.nodes[0].y = this.height / 2;
  285 + this.buildGraph(g);
  286 + }
  287 + });
  288 + </script>
  289 +</dom-module>
0 290 \ No newline at end of file
... ...
datalets/graph-datalet/static/css/graphStyle.css 0 → 100644
  1 +circle{
  2 + stroke-width: 2.5px;
  3 +}
  4 +
  5 +.text {
  6 + font-family: 'Roboto', sans-serif;
  7 + visibility: hidden
  8 +}
  9 +
  10 +.node {
  11 + cursor: move;
  12 + fill: #fff;
  13 + stroke: #959595;
  14 + stroke-width: 4.5px
  15 + z-index: 100;
  16 +}
  17 +
  18 +.node.fixed {
  19 + cursor: pointer;
  20 + cursor: hand;
  21 + stroke-width: 6px
  22 +}
  23 +
  24 +.link {
  25 + stroke: #d0d0d0;
  26 + stroke-width: 2.5px
  27 +}
  28 +
  29 +g foreignObject {
  30 + z-index: 100;
  31 + position: relative;
  32 + -webkit-transition: opacity .5s ease-in-out;
  33 + -moz-transition: opacity .5s ease-in-out;
  34 + -ms-transition: opacity .5s ease-in-out;
  35 + -o-transition: opacity .5s ease-in-out;
  36 + transition: opacity .5s ease-in-out
  37 +}
  38 +
  39 +g foreignObject div {
  40 + font-family: 'Roboto', sans-serif;
  41 + display: inline-block;
  42 + font-size: 12px;
  43 + text-decoration: none;
  44 + padding: 0px
  45 +}
  46 +
  47 +g foreignObject a:hover {
  48 + background-color: #f4f4f4;
  49 + text-decoration: none
  50 +}
  51 +
  52 +.r {
  53 + color: #c82528
  54 +}
  55 +
  56 +.p {
  57 + color: #662d91
  58 +}
  59 +
  60 +.y {
  61 + color: #f69a43
  62 +}
  63 +
  64 +.g {
  65 + color: #519c76
  66 +}
  67 +
  68 +.header {
  69 + text-align: center
  70 +}
  71 +
  72 +.n1 {
  73 + font-size: 8em;
  74 + height: 120px;
  75 + color: #595a5a;
  76 + letter-spacing: -4px;
  77 + line-height: 1
  78 +}
  79 +
  80 +.n1 span {
  81 + color: #c82528;
  82 + font-weight: 700
  83 +}
  84 +
  85 +.n2 {
  86 + font-size: 1.5em;
  87 + line-height: 1
  88 +}
  89 +
  90 +.n2 span {
  91 + display: block
  92 +}
  93 +
  94 +span.n4 {
  95 + font-size: .8em;
  96 + padding-top: 10px;
  97 + line-height: 1.3
  98 +}
0 99 \ No newline at end of file
... ...
datalets/graph-datalet/static/js/d3.v3.js 0 → 100644
  1 +d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function i(){}function u(){}function a(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function o(){}function c(n){function t(){for(var t,r=e,i=-1,u=r.length;++i<u;)(t=r[i].on)&&t.apply(this,arguments);return n}var e=[],r=new i;return t.on=function(t,i){var u,a=r.get(t);return arguments.length<2?a&&a.on:(a&&(a.on=null,e=e.slice(0,u=e.indexOf(a)).concat(e.slice(u+1)),r.remove(t)),i&&e.push(r.set(t,{on:i})),n)},t}function l(){ua.event.stopPropagation(),ua.event.preventDefault()}function f(){for(var n,t=ua.event;n=t.sourceEvent;)t=n;return t}function s(n,t){function e(){n.on(t,null)}n.on(t,function(){l(),e()},!0),setTimeout(e,0)}function h(n){for(var t=new o,e=0,r=arguments.length;++e<r;)t[arguments[e]]=c(t);return t.of=function(e,r){return function(i){try{var u=i.sourceEvent=ua.event;i.target=n,ua.event=i,t[i.type].apply(e,r)}finally{ua.event=u}}},t}function g(n,t){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>pa&&(oa.scrollX||oa.scrollY)){e=ua.select(aa.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=e[0][0].getScreenCTM();pa=!(i.f||i.e),e.remove()}return pa?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var u=n.getBoundingClientRect();return[t.clientX-u.left-n.clientLeft,t.clientY-u.top-n.clientTop]}function p(n){for(var t=-1,e=n.length,r=[];++t<e;)r.push(n[t]);return r}function d(n){return Array.prototype.slice.call(n)}function m(n){return va(n,wa),n}function v(n){return function(){return ya(n,this)}}function y(n){return function(){return Ma(n,this)}}function M(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function i(){this.setAttribute(n,t)}function u(){this.setAttributeNS(n.space,n.local,t)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=ua.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?o:a:n.local?u:i}function x(n){return n.trim().replace(/\s+/g," ")}function _(n){return RegExp("(?:^|\\s+)"+ua.requote(n)+"(?:\\s+|$)","g")}function w(n,t){function e(){for(var e=-1;++e<i;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<i;)n[e](this,r)}n=n.trim().split(/\s+/).map(S);var i=n.length;return"function"==typeof t?r:e}function S(n){var t=_(n);return function(e,r){if(i=e.classList)return r?i.add(n):i.remove(n);var i=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(i)||e.setAttribute("class",x(i+" "+n))):e.setAttribute("class",x(i.replace(t," ")))}}function E(n,t,e){function r(){this.style.removeProperty(n)}function i(){this.style.setProperty(n,t,e)}function u(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?u:i}function k(n,t){function e(){delete this[n]}function r(){this[n]=t}function i(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?i:r}function A(n){return{__data__:n}}function N(n){return function(){return _a(this,n)}}function q(n){return arguments.length||(n=ua.ascending),function(t,e){return!t-!e||n(t.__data__,e.__data__)}}function T(){}function C(n,t,e){function r(){var t=this[a];t&&(this.removeEventListener(n,t,t.$),delete this[a])}function i(){var i=c(t,da(arguments));r.call(this),this.addEventListener(n,this[a]=i,i.$=e),i._=t}function u(){var t,e=RegExp("^__on([^.]+)"+ua.requote(n)+"$");for(var r in this)if(t=r.match(e)){var i=this[r];this.removeEventListener(t[1],i,i.$),delete this[r]}}var a="__on"+n,o=n.indexOf("."),c=z;o>0&&(n=n.substring(0,o));var l=ka.get(n);return l&&(n=l,c=D),o?t?i:r:t?T:u}function z(n,t){return function(e){var r=ua.event;ua.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ua.event=r}}}function D(n,t){var e=z(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function j(n,t){for(var e=0,r=n.length;r>e;e++)for(var i,u=n[e],a=0,o=u.length;o>a;a++)(i=u[a])&&t(i,a,e);return n}function L(n){return va(n,Aa),n}function F(){}function H(n,t,e){return new P(n,t,e)}function P(n,t,e){this.h=n,this.s=t,this.l=e}function R(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?u+(a-u)*n/60:180>n?a:240>n?u+(a-u)*(240-n)/60:u}function i(n){return Math.round(255*r(n))}var u,a;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,a=.5>=e?e*(1+t):e+t-e*t,u=2*e-a,et(i(n+120),i(n),i(n-120))}function O(n){return n>0?1:0>n?-1:0}function Y(n){return Math.acos(Math.max(-1,Math.min(1,n)))}function U(n){return n>1?Da/2:-1>n?-Da/2:Math.asin(n)}function I(n){return(Math.exp(n)-Math.exp(-n))/2}function V(n){return(Math.exp(n)+Math.exp(-n))/2}function X(n){return(n=Math.sin(n/2))*n}function Z(n,t,e){return new B(n,t,e)}function B(n,t,e){this.h=n,this.c=t,this.l=e}function $(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),J(e,Math.cos(n*=La)*t,Math.sin(n)*t)}function J(n,t,e){return new G(n,t,e)}function G(n,t,e){this.l=n,this.a=t,this.b=e}function K(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return i=Q(i)*Ra,r=Q(r)*Oa,u=Q(u)*Ya,et(tt(3.2404542*i-1.5371385*r-.4985314*u),tt(-.969266*i+1.8760108*r+.041556*u),tt(.0556434*i-.2040259*r+1.0572252*u))}function W(n,t,e){return n>0?Z(Math.atan2(e,t)*Fa,Math.sqrt(t*t+e*e),n):Z(0/0,0/0,n)}function Q(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function nt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function tt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function et(n,t,e){return new rt(n,t,e)}function rt(n,t,e){this.r=n,this.g=t,this.b=e}function it(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function ut(n,t,e){var r,i,u,a=0,o=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(lt(i[0]),lt(i[1]),lt(i[2]))}return(u=Va.get(n))?t(u.r,u.g,u.b):(null!=n&&"#"===n.charAt(0)&&(4===n.length?(a=n.charAt(1),a+=a,o=n.charAt(2),o+=o,c=n.charAt(3),c+=c):7===n.length&&(a=n.substring(1,3),o=n.substring(3,5),c=n.substring(5,7)),a=parseInt(a,16),o=parseInt(o,16),c=parseInt(c,16)),t(a,o,c))}function at(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),a=Math.max(n,t,e),o=a-u,c=(a+u)/2;return o?(i=.5>c?o/(a+u):o/(2-a-u),r=n==a?(t-e)/o+(e>t?6:0):t==a?(e-n)/o+2:(n-t)/o+4,r*=60):(r=0/0,i=c>0&&1>c?0:r),H(r,i,c)}function ot(n,t,e){n=ct(n),t=ct(t),e=ct(e);var r=nt((.4124564*n+.3575761*t+.1804375*e)/Ra),i=nt((.2126729*n+.7151522*t+.072175*e)/Oa),u=nt((.0193339*n+.119192*t+.9503041*e)/Ya);return J(116*i-16,500*(r-i),200*(i-u))}function ct(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function lt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function ft(n){return"function"==typeof n?n:function(){return n}}function st(n){return n}function ht(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function gt(n,t){function e(n,e,u){arguments.length<3&&(u=e,e=null);var a=ua.xhr(n,t,u);return a.row=function(n){return arguments.length?a.response(null==(e=n)?r:i(n)):e},a.row(e)}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function a(t){return t.map(o).join(n)}function o(n){return c.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var c=RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(f>=c)return a;if(i)return i=!1,u;var t=f;if(34===n.charCodeAt(t)){for(var e=t;e++<c;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}f=e+2;var r=n.charCodeAt(e+1);return 13===r?(i=!0,10===n.charCodeAt(e+2)&&++f):10===r&&(i=!0),n.substring(t+1,e).replace(/""/g,'"')}for(;c>f;){var r=n.charCodeAt(f++),o=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(f)&&(++f,++o);else if(r!==l)continue;return n.substring(t,f-o)}return n.substring(t)}for(var r,i,u={},a={},o=[],c=n.length,f=0,s=0;(r=e())!==a;){for(var h=[];r!==u&&r!==a;)h.push(r),r=e();(!t||(h=t(h,s++)))&&o.push(h)}return o},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new u,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(o).join(n)].concat(t.map(function(t){return i.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(a).join("\n")},e}function pt(){for(var n,t=Date.now(),e=Ja;e;)n=t-e.then,n>=e.delay&&(e.flush=e.callback(n)),e=e.next;var r=dt()-t;r>24?(isFinite(r)&&(clearTimeout(Za),Za=setTimeout(pt,r)),Xa=0):(Xa=1,Ga(pt))}function dt(){for(var n=null,t=Ja,e=1/0;t;)t.flush?(delete $a[t.callback.id],t=n?n.next=t.next:Ja=t.next):(e=Math.min(e,t.then+t.delay),t=(n=t).next);return e}function mt(n,t){var e=Math.pow(10,3*Math.abs(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function vt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function yt(n){return n+""}function Mt(n,t){n&&ao.hasOwnProperty(n.type)&&ao[n.type](n,t)}function xt(n,t,e){var r,i=-1,u=n.length-e;for(t.lineStart();++i<u;)r=n[i],t.point(r[0],r[1]);t.lineEnd()}function bt(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)xt(n[e],t,1);t.polygonEnd()}function _t(){function n(n,t){n*=La,t=t*La/2+Da/4;var e=n-r,a=Math.cos(t),o=Math.sin(t),c=u*o,l=i*a+c*Math.cos(e),f=c*Math.sin(e);co+=Math.atan2(f,l),r=n,i=a,u=o}var t,e,r,i,u;lo.point=function(a,o){lo.point=n,r=(t=a)*La,i=Math.cos(o=(e=o)*La/2+Da/4),u=Math.sin(o)},lo.lineEnd=function(){n(t,e)}}function wt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function St(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Et(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function kt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function At(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Nt(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function qt(n){return[Math.atan2(n[1],n[0]),Math.asin(Math.max(-1,Math.min(1,n[2])))]}function Tt(n,t){return Math.abs(n[0]-t[0])<ja&&Math.abs(n[1]-t[1])<ja}function Ct(n,t){if(!fo){++so,n*=La;var e=Math.cos(t*=La);ho+=(e*Math.cos(n)-ho)/so,go+=(e*Math.sin(n)-go)/so,po+=(Math.sin(t)-po)/so}}function zt(){var n,t;fo=1,Dt(),fo=2;var e=mo.point;mo.point=function(r,i){e(n=r,t=i)},mo.lineEnd=function(){mo.point(n,t),jt(),mo.lineEnd=jt}}function Dt(){function n(n,i){n*=La;var u=Math.cos(i*=La),a=u*Math.cos(n),o=u*Math.sin(n),c=Math.sin(i),l=Math.atan2(Math.sqrt((l=e*c-r*o)*l+(l=r*a-t*c)*l+(l=t*o-e*a)*l),t*a+e*o+r*c);so+=l,ho+=l*(t+(t=a)),go+=l*(e+(e=o)),po+=l*(r+(r=c))}var t,e,r;fo>1||(1>fo&&(fo=1,so=ho=go=po=0),mo.point=function(i,u){i*=La;var a=Math.cos(u*=La);t=a*Math.cos(i),e=a*Math.sin(i),r=Math.sin(u),mo.point=n})}function jt(){mo.point=Ct}function Lt(){return!0}function Ft(n,t,e,r,i){var u=[],a=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(Tt(e,r)){i.lineStart();for(var o=0;t>o;++o)i.point((e=n[o])[0],e[1]);return i.lineEnd(),void 0}var c={point:e,points:n,other:null,visited:!1,entry:!0,subject:!0},l={point:e,points:[e],other:c,visited:!1,entry:!1,subject:!1};c.other=l,u.push(c),a.push(l),c={point:r,points:[r],other:null,visited:!1,entry:!1,subject:!0},l={point:r,points:[r],other:c,visited:!1,entry:!0,subject:!1},c.other=l,u.push(c),a.push(l)}}),a.sort(t),Ht(u),Ht(a),u.length){if(e)for(var o=1,c=!e(a[0].point),l=a.length;l>o;++o)a[o].entry=c=!c;for(var f,s,h,g=u[0];;){for(f=g;f.visited;)if((f=f.next)===g)return;s=f.points,i.lineStart();do{if(f.visited=f.other.visited=!0,f.entry){if(f.subject)for(var o=0;o<s.length;o++)i.point((h=s[o])[0],h[1]);else r(f.point,f.next.point,1,i);f=f.next}else{if(f.subject){s=f.prev.points;for(var o=s.length;--o>=0;)i.point((h=s[o])[0],h[1])}else r(f.point,f.prev.point,-1,i);f=f.prev}f=f.other,s=f.points}while(!f.visited);i.lineEnd()}}}function Ht(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r<t;)i.next=e=n[r],e.prev=i,i=e;i.next=e=n[0],e.prev=i}}function Pt(n,t,e){return function(r){function i(t,e){n(t,e)&&r.point(t,e)}function u(n,t){m.point(n,t)}function a(){v.point=u,m.lineStart()}function o(){v.point=i,m.lineEnd()}function c(n,t){M.point(n,t),d.push([n,t])}function l(){M.lineStart(),d=[]}function f(){c(d[0][0],d[0][1]),M.lineEnd();var n,t=M.clean(),e=y.buffer(),i=e.length;if(!i)return p=!0,g+=Yt(d,-1),d=null,void 0;if(d=null,1&t){n=e[0],h+=Yt(n,1);var u,i=n.length-1,a=-1;for(r.lineStart();++a<i;)r.point((u=n[a])[0],u[1]);return r.lineEnd(),void 0}i>1&&2&t&&e.push(e.pop().concat(e.shift())),s.push(e.filter(Rt))}var s,h,g,p,d,m=t(r),v={point:i,lineStart:a,lineEnd:o,polygonStart:function(){v.point=c,v.lineStart=l,v.lineEnd=f,p=!1,g=h=0,s=[],r.polygonStart()},polygonEnd:function(){v.point=i,v.lineStart=a,v.lineEnd=o,s=ua.merge(s),s.length?Ft(s,Ut,null,e,r):(-ja>h||p&&-ja>g)&&(r.lineStart(),e(null,null,1,r),r.lineEnd()),r.polygonEnd(),s=null},sphere:function(){r.polygonStart(),r.lineStart(),e(null,null,1,r),r.lineEnd(),r.polygonEnd()}},y=Ot(),M=t(y);return v}}function Rt(n){return n.length>1}function Ot(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:T,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Yt(n,t){if(!(e=n.length))return 0;for(var e,r,i,u=0,a=0,o=n[0],c=o[0],l=o[1],f=Math.cos(l),s=Math.atan2(t*Math.sin(c)*f,Math.sin(l)),h=1-t*Math.cos(c)*f,g=s;++u<e;)o=n[u],f=Math.cos(l=o[1]),r=Math.atan2(t*Math.sin(c=o[0])*f,Math.sin(l)),i=1-t*Math.cos(c)*f,Math.abs(h-2)<ja&&Math.abs(i-2)<ja||(Math.abs(i)<ja||Math.abs(h)<ja||(Math.abs(Math.abs(r-s)-Da)<ja?i+h>2&&(a+=4*(r-s)):a+=Math.abs(h-2)<ja?4*(r-g):((3*Da+r-s)%(2*Da)-Da)*(h+i)),g=s,s=r,h=i);return a}function Ut(n,t){return((n=n.point)[0]<0?n[1]-Da/2-ja:Da/2-n[1])-((t=t.point)[0]<0?t[1]-Da/2-ja:Da/2-t[1])}function It(n){var t,e=0/0,r=0/0,i=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(u,a){var o=u>0?Da:-Da,c=Math.abs(u-e);Math.abs(c-Da)<ja?(n.point(e,r=(r+a)/2>0?Da/2:-Da/2),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(o,r),n.point(u,r),t=0):i!==o&&c>=Da&&(Math.abs(e-i)<ja&&(e-=i*ja),Math.abs(u-o)<ja&&(u-=o*ja),r=Vt(e,r,u,a),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(o,r),t=0),n.point(e=u,r=a),i=o},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function Vt(n,t,e,r){var i,u,a=Math.sin(n-e);return Math.abs(a)>ja?Math.atan((Math.sin(t)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*u*a)):(t+r)/2}function Xt(n,t,e,r){var i;if(null==n)i=e*Da/2,r.point(-Da,i),r.point(0,i),r.point(Da,i),r.point(Da,0),r.point(Da,-i),r.point(0,-i),r.point(-Da,-i),r.point(-Da,0),r.point(-Da,i);else if(Math.abs(n[0]-t[0])>ja){var u=(n[0]<t[0]?1:-1)*Da;i=e*u/2,r.point(-u,i),r.point(0,i),r.point(u,i)}else r.point(t[0],t[1])}function Zt(n){function t(n,t){return Math.cos(n)*Math.cos(t)>u}function e(n){var e,u,c,l,f;return{lineStart:function(){l=c=!1,f=1},point:function(s,h){var g,p=[s,h],d=t(s,h),m=a?d?0:i(s,h):d?i(s+(0>s?Da:-Da),h):0;if(!e&&(l=c=d)&&n.lineStart(),d!==c&&(g=r(e,p),(Tt(e,g)||Tt(p,g))&&(p[0]+=ja,p[1]+=ja,d=t(p[0],p[1]))),d!==c)f=0,d?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(o&&e&&a^d){var v;m&u||!(v=r(p,e,!0))||(f=0,a?(n.lineStart(),n.point(v[0][0],v[0][1]),n.point(v[1][0],v[1][1]),n.lineEnd()):(n.point(v[1][0],v[1][1]),n.lineEnd(),n.lineStart(),n.point(v[0][0],v[0][1])))}!d||e&&Tt(e,p)||n.point(p[0],p[1]),e=p,c=d,u=m},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return f|(l&&c)<<1}}}function r(n,t,e){var r=wt(n),i=wt(t),a=[1,0,0],o=Et(r,i),c=St(o,o),l=o[0],f=c-l*l;if(!f)return!e&&n;var s=u*c/f,h=-u*l/f,g=Et(a,o),p=At(a,s),d=At(o,h);kt(p,d);var m=g,v=St(p,m),y=St(m,m),M=v*v-y*(St(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=At(m,(-v-x)/y);if(kt(b,p),b=qt(b),!e)return b;var _,w=n[0],S=t[0],E=n[1],k=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=Math.abs(A-Da)<ja,q=N||ja>A;if(!N&&E>k&&(_=E,E=k,k=_),q?N?E+k>0^b[1]<(Math.abs(b[0]-w)<ja?E:k):E<=b[1]&&b[1]<=k:A>Da^(w<=b[0]&&b[0]<=S)){var T=At(m,(-v+x)/y);return kt(T,p),[b,qt(T)]}}}function i(t,e){var r=a?n:Da-n,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}var u=Math.cos(n),a=u>0,o=Math.abs(u)>ja,c=ue(n,6*La);return Pt(t,e,c)}function Bt(n,t,e,r){function i(r,i){return Math.abs(r[0]-n)<ja?i>0?0:3:Math.abs(r[0]-e)<ja?i>0?2:1:Math.abs(r[1]-t)<ja?i>0?1:0:i>0?3:2}function u(n,t){return a(n.point,t.point)}function a(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}function o(i,u){var a=u[0]-i[0],o=u[1]-i[1],c=[0,1];return Math.abs(a)<ja&&Math.abs(o)<ja?n<=i[0]&&i[0]<=e&&t<=i[1]&&i[1]<=r:$t(n-i[0],a,c)&&$t(i[0]-e,-a,c)&&$t(t-i[1],o,c)&&$t(i[1]-r,-o,c)?(c[1]<1&&(u[0]=i[0]+c[1]*a,u[1]=i[1]+c[1]*o),c[0]>0&&(i[0]+=c[0]*a,i[1]+=c[0]*o),!0):!1}return function(c){function l(u){var a=i(u,-1),o=f([0===a||3===a?n:e,a>1?r:t]);return o}function f(n){for(var t=0,e=M.length,r=n[1],i=0;e>i;++i)for(var u=1,a=M[i],o=a.length,c=a[0];o>u;++u)b=a[u],c[1]<=r?b[1]>r&&s(c,b,n)>0&&++t:b[1]<=r&&s(c,b,n)<0&&--t,c=b;return 0!==t}function s(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(e[0]-n[0])*(t[1]-n[1])}function h(u,o,c,l){var f=0,s=0;if(null==u||(f=i(u,c))!==(s=i(o,c))||a(u,o)<0^c>0){do l.point(0===f||3===f?n:e,f>1?r:t);while((f=(f+c+4)%4)!==s)}else l.point(o[0],o[1])}function g(i,u){return i>=n&&e>=i&&u>=t&&r>=u}function p(n,t){g(n,t)&&c.point(n,t)}function d(){C.point=v,M&&M.push(x=[]),N=!0,A=!1,E=k=0/0}function m(){y&&(v(_,w),S&&A&&T.rejoin(),y.push(T.buffer())),C.point=p,A&&c.lineEnd()}function v(n,t){n=Math.max(-yo,Math.min(yo,n)),t=Math.max(-yo,Math.min(yo,t));var e=g(n,t);if(M&&x.push([n,t]),N)_=n,w=t,S=e,N=!1,e&&(c.lineStart(),c.point(n,t));else if(e&&A)c.point(n,t);else{var r=[E,k],i=[n,t];o(r,i)?(A||(c.lineStart(),c.point(r[0],r[1])),c.point(i[0],i[1]),e||c.lineEnd()):e&&(c.lineStart(),c.point(n,t))}E=n,k=t,A=e}var y,M,x,_,w,S,E,k,A,N,q=c,T=Ot(),C={point:p,lineStart:d,lineEnd:m,polygonStart:function(){c=T,y=[],M=[]},polygonEnd:function(){c=q,(y=ua.merge(y)).length?(c.polygonStart(),Ft(y,u,l,h,c),c.polygonEnd()):f([n,t])&&(c.polygonStart(),c.lineStart(),h(null,null,1,c),c.lineEnd(),c.polygonEnd()),y=M=x=null}};return C}}function $t(n,t,e){if(Math.abs(t)<ja)return 0>=n;var r=n/t;if(t>0){if(r>e[1])return!1;r>e[0]&&(e[0]=r)}else{if(r<e[0])return!1;r<e[1]&&(e[1]=r)}return!0}function Jt(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function Gt(n){function t(t){function r(e,r){e=n(e,r),t.point(e[0],e[1])}function u(){f=0/0,d.point=a,t.lineStart()}function a(r,u){var a=wt([r,u]),o=n(r,u);e(f,s,l,h,g,p,f=o[0],s=o[1],l=r,h=a[0],g=a[1],p=a[2],i,t),t.point(f,s)}function o(){d.point=r,t.lineEnd()}function c(){var n,r,c,m,v,y,M;u(),d.point=function(t,e){a(n=t,r=e),c=f,m=s,v=h,y=g,M=p,d.point=a},d.lineEnd=function(){e(f,s,l,h,g,p,c,m,n,v,y,M,i,t),d.lineEnd=o,o()}}var l,f,s,h,g,p,d={point:r,lineStart:u,lineEnd:o,polygonStart:function(){t.polygonStart(),d.lineStart=c},polygonEnd:function(){t.polygonEnd(),d.lineStart=u}};return d}function e(t,i,u,a,o,c,l,f,s,h,g,p,d,m){var v=l-t,y=f-i,M=v*v+y*y;if(M>4*r&&d--){var x=a+h,b=o+g,_=c+p,w=Math.sqrt(x*x+b*b+_*_),S=Math.asin(_/=w),E=Math.abs(Math.abs(_)-1)<ja?(u+s)/2:Math.atan2(b,x),k=n(E,S),A=k[0],N=k[1],q=A-t,T=N-i,C=y*q-v*T;(C*C/M>r||Math.abs((v*q+y*T)/M-.5)>.3)&&(e(t,i,u,a,o,c,A,N,E,x/=w,b/=w,_,d,m),m.point(A,N),e(A,N,E,x,b,_,l,f,s,h,g,p,d,m))}}var r=.5,i=16;return t.precision=function(n){return arguments.length?(i=(r=n*n)>0&&16,t):Math.sqrt(r)},t}function Kt(n){return Wt(function(){return n})()}function Wt(n){function t(n){return n=a(n[0]*La,n[1]*La),[n[0]*f+o,c-n[1]*f]}function e(n){return n=a.invert((n[0]-o)/f,(c-n[1])/f),n&&[n[0]*Fa,n[1]*Fa]}function r(){a=Jt(u=te(d,m,v),i);var n=i(g,p);return o=s-n[0]*f,c=h+n[1]*f,t}var i,u,a,o,c,l=Gt(function(n,t){return n=i(n,t),[n[0]*f+o,c-n[1]*f]}),f=150,s=480,h=250,g=0,p=0,d=0,m=0,v=0,y=vo,M=st,x=null,b=null;return t.stream=function(n){return Qt(u,y(l(M(n))))},t.clipAngle=function(n){return arguments.length?(y=null==n?(x=n,vo):Zt((x=+n)*La),t):x},t.clipExtent=function(n){return arguments.length?(b=n,M=null==n?st:Bt(n[0][0],n[0][1],n[1][0],n[1][1]),t):b},t.scale=function(n){return arguments.length?(f=+n,r()):f},t.translate=function(n){return arguments.length?(s=+n[0],h=+n[1],r()):[s,h]},t.center=function(n){return arguments.length?(g=n[0]%360*La,p=n[1]%360*La,r()):[g*Fa,p*Fa]},t.rotate=function(n){return arguments.length?(d=n[0]%360*La,m=n[1]%360*La,v=n.length>2?n[2]%360*La:0,r()):[d*Fa,m*Fa,v*Fa]},ua.rebind(t,l,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function Qt(n,t){return{point:function(e,r){r=n(e*La,r*La),e=r[0],t.point(e>Da?e-2*Da:-Da>e?e+2*Da:e,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function ne(n,t){return[n,t]}function te(n,t,e){return n?t||e?Jt(re(n),ie(t,e)):re(n):t||e?ie(t,e):ne}function ee(n){return function(t,e){return t+=n,[t>Da?t-2*Da:-Da>t?t+2*Da:t,e]}}function re(n){var t=ee(n);return t.invert=ee(-n),t}function ie(n,t){function e(n,t){var e=Math.cos(t),o=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),f=l*r+o*i;return[Math.atan2(c*u-f*a,o*r-l*i),Math.asin(Math.max(-1,Math.min(1,f*u+c*a)))]}var r=Math.cos(n),i=Math.sin(n),u=Math.cos(t),a=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),o=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),f=l*u-c*a;return[Math.atan2(c*u+l*a,o*r+f*i),Math.asin(Math.max(-1,Math.min(1,f*r-o*i)))]},e}function ue(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,u,a,o){null!=i?(i=ae(e,i),u=ae(e,u),(a>0?u>i:i>u)&&(i+=2*a*Da)):(i=n+2*a*Da,u=n);for(var c,l=a*t,f=i;a>0?f>u:u>f;f-=l)o.point((c=qt([e,-r*Math.cos(f),-r*Math.sin(f)]))[0],c[1])}}function ae(n,t){var e=wt(t);e[0]-=n,Nt(e);var r=Y(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-ja)%(2*Math.PI)}function oe(n,t,e){var r=ua.range(n,t-ja,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function ce(n,t,e){var r=ua.range(n,t-ja,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function le(n){return n.source}function fe(n){return n.target}function se(n,t,e,r){var i=Math.cos(t),u=Math.sin(t),a=Math.cos(r),o=Math.sin(r),c=i*Math.cos(n),l=i*Math.sin(n),f=a*Math.cos(e),s=a*Math.sin(e),h=2*Math.asin(Math.sqrt(X(r-t)+i*a*X(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*f,i=e*l+t*s,a=e*u+t*o;return[Math.atan2(i,r)*Fa,Math.atan2(a,Math.sqrt(r*r+i*i))*Fa]}:function(){return[n*Fa,t*Fa]};return p.distance=h,p}function he(){function n(n,i){var u=Math.sin(i*=La),a=Math.cos(i),o=Math.abs((n*=La)-t),c=Math.cos(o);Mo+=Math.atan2(Math.sqrt((o=a*Math.sin(o))*o+(o=r*u-e*a*c)*o),e*u+r*a*c),t=n,e=u,r=a}var t,e,r;xo.point=function(i,u){t=i*La,e=Math.sin(u*=La),r=Math.cos(u),xo.point=n},xo.lineEnd=function(){xo.point=xo.lineEnd=T}}function ge(n){var t=0,e=Da/3,r=Wt(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Da/180,e=n[1]*Da/180):[180*(t/Da),180*(e/Da)]},i}function pe(n,t){function e(n,t){var e=Math.sqrt(u-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),a-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),a=Math.sqrt(u)/i;return e.invert=function(n,t){var e=a-t;return[Math.atan2(n,e)/i,U((u-(n*n+e*e)*i*i)/(2*i))]},e}function de(){function n(n,t){_o+=i*n-r*t,r=n,i=t}var t,e,r,i;Ao.point=function(u,a){Ao.point=n,t=r=u,e=i=a},Ao.lineEnd=function(){n(t,e)}}function me(n,t){wo>n&&(wo=n),n>Eo&&(Eo=n),So>t&&(So=t),t>ko&&(ko=t)}function ve(){function n(n,t){a.push("M",n,",",t,u)}function t(n,t){a.push("M",n,",",t),o.point=e}function e(n,t){a.push("L",n,",",t)}function r(){o.point=n}function i(){a.push("Z")}var u=ye(4.5),a=[],o={point:n,lineStart:function(){o.point=t},lineEnd:r,polygonStart:function(){o.lineEnd=i},polygonEnd:function(){o.lineEnd=r,o.point=n},pointRadius:function(n){return u=ye(n),o},result:function(){if(a.length){var n=a.join("");return a=[],n}}};return o}function ye(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Me(n,t){fo||(ho+=n,go+=t,++po)}function xe(){function n(n,r){var i=n-t,u=r-e,a=Math.sqrt(i*i+u*u);ho+=a*(t+n)/2,go+=a*(e+r)/2,po+=a,t=n,e=r}var t,e;if(1!==fo){if(!(1>fo))return;fo=1,ho=go=po=0}qo.point=function(r,i){qo.point=n,t=r,e=i}}function be(){qo.point=Me}function _e(){function n(n,t){var e=i*n-r*t;ho+=e*(r+n),go+=e*(i+t),po+=3*e,r=n,i=t}var t,e,r,i;2>fo&&(fo=2,ho=go=po=0),qo.point=function(u,a){qo.point=n,t=r=u,e=i=a},qo.lineEnd=function(){n(t,e)}}function we(n){function t(t,e){n.moveTo(t,e),n.arc(t,e,a,0,2*Da)}function e(t,e){n.moveTo(t,e),o.point=r}function r(t,e){n.lineTo(t,e)}function i(){o.point=t}function u(){n.closePath()}var a=4.5,o={point:t,lineStart:function(){o.point=e},lineEnd:i,polygonStart:function(){o.lineEnd=u},polygonEnd:function(){o.lineEnd=i,o.point=t},pointRadius:function(n){return a=n,o},result:T};return o}function Se(n){var t=Gt(function(t,e){return n([t*Fa,e*Fa])});return function(n){return n=t(n),{point:function(t,e){n.point(t*La,e*La)},sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}}function Ee(n,t){function e(t,e){var r=Math.cos(t),i=Math.cos(e),u=n(r*i);return[u*i*Math.sin(t),u*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),i=t(r),u=Math.sin(i),a=Math.cos(i);return[Math.atan2(n*u,r*a),Math.asin(r&&e*u/r)]},e}function ke(n,t){function e(n,t){var e=Math.abs(Math.abs(t)-Da/2)<ja?0:a/Math.pow(i(t),u);return[e*Math.sin(u*n),a-e*Math.cos(u*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Da/4+n/2)},u=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),a=r*Math.pow(i(n),u)/u;return u?(e.invert=function(n,t){var e=a-t,r=O(u)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/u,2*Math.atan(Math.pow(a/r,1/u))-Da/2]},e):Ne}function Ae(n,t){function e(n,t){var e=u-t;return[e*Math.sin(i*n),u-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),u=r/i+n;return Math.abs(i)<ja?ne:(e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,u-O(i)*Math.sqrt(n*n+e*e)]},e)}function Ne(n,t){return[n,Math.log(Math.tan(Da/4+t/2))]}function qe(n){var t,e=Kt(n),r=e.scale,i=e.translate,u=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=i.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var a=u.apply(e,arguments);if(a===e){if(t=null==n){var o=Da*r(),c=i();u([[c[0]-o,c[1]-o],[c[0]+o,c[1]+o]])}}else t&&(a=null);return a},e.clipExtent(null)}function Te(n,t){var e=Math.cos(t)*Math.sin(n);return[Math.log((1+e)/(1-e))/2,Math.atan2(Math.tan(t),Math.cos(n))]}function Ce(n){function t(t){function a(){l.push("M",u(n(f),o))}for(var c,l=[],f=[],s=-1,h=t.length,g=ft(e),p=ft(r);++s<h;)i.call(this,c=t[s],s)?f.push([+g.call(this,c,s),+p.call(this,c,s)]):f.length&&(a(),f=[]);return f.length&&a(),l.length?l.join(""):null}var e=ze,r=De,i=Lt,u=je,a=u.key,o=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(i=n,t):i},t.interpolate=function(n){return arguments.length?(a="function"==typeof n?u=n:(u=Lo.get(n)||je).key,t):a},t.tension=function(n){return arguments.length?(o=n,t):o},t}function ze(n){return n[0]}function De(n){return n[1]}function je(n){return n.join("L")}function Le(n){return je(n)+"Z"}function Fe(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("V",(r=n[t])[1],"H",r[0]);return i.join("")}function He(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("H",(r=n[t])[0],"V",r[1]);return i.join("")}function Pe(n,t){return n.length<4?je(n):n[1]+Ye(n.slice(1,n.length-1),Ue(n,t))}function Re(n,t){return n.length<3?je(n):n[0]+Ye((n.push(n[0]),n),Ue([n[n.length-2]].concat(n,[n[1]]),t))}function Oe(n,t){return n.length<3?je(n):n[0]+Ye(n,Ue(n,t))}function Ye(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return je(n);var e=n.length!=t.length,r="",i=n[0],u=n[1],a=t[0],o=a,c=1;if(e&&(r+="Q"+(u[0]-2*a[0]/3)+","+(u[1]-2*a[1]/3)+","+u[0]+","+u[1],i=n[1],c=2),t.length>1){o=t[1],u=n[c],c++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(u[0]-o[0])+","+(u[1]-o[1])+","+u[0]+","+u[1];for(var l=2;l<t.length;l++,c++)u=n[c],o=t[l],r+="S"+(u[0]-o[0])+","+(u[1]-o[1])+","+u[0]+","+u[1]}if(e){var f=n[c];r+="Q"+(u[0]+2*o[0]/3)+","+(u[1]+2*o[1]/3)+","+f[0]+","+f[1]}return r}function Ue(n,t){for(var e,r=[],i=(1-t)/2,u=n[0],a=n[1],o=1,c=n.length;++o<c;)e=u,u=a,a=n[o],r.push([i*(a[0]-e[0]),i*(a[1]-e[1])]);return r}function Ie(n){if(n.length<3)return je(n);var t=1,e=n.length,r=n[0],i=r[0],u=r[1],a=[i,i,i,(r=n[1])[0]],o=[u,u,u,r[1]],c=[i,",",u];for($e(c,a,o);++t<e;)r=n[t],a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),$e(c,a,o);for(t=-1;++t<2;)a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),$e(c,a,o);return c.join("")}function Ve(n){if(n.length<4)return je(n);for(var t,e=[],r=-1,i=n.length,u=[0],a=[0];++r<3;)t=n[r],u.push(t[0]),a.push(t[1]);for(e.push(Be(Po,u)+","+Be(Po,a)),--r;++r<i;)t=n[r],u.shift(),u.push(t[0]),a.shift(),a.push(t[1]),$e(e,u,a);return e.join("")}function Xe(n){for(var t,e,r=-1,i=n.length,u=i+4,a=[],o=[];++r<4;)e=n[r%i],a.push(e[0]),o.push(e[1]);for(t=[Be(Po,a),",",Be(Po,o)],--r;++r<u;)e=n[r%i],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),$e(t,a,o);return t.join("")}function Ze(n,t){var e=n.length-1;if(e)for(var r,i,u=n[0][0],a=n[0][1],o=n[e][0]-u,c=n[e][1]-a,l=-1;++l<=e;)r=n[l],i=l/e,r[0]=t*r[0]+(1-t)*(u+i*o),r[1]=t*r[1]+(1-t)*(a+i*c);return Ie(n)}function Be(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function $e(n,t,e){n.push("C",Be(Fo,t),",",Be(Fo,e),",",Be(Ho,t),",",Be(Ho,e),",",Be(Po,t),",",Be(Po,e))}function Je(n,t){return(t[1]-n[1])/(t[0]-n[0])}function Ge(n){for(var t=0,e=n.length-1,r=[],i=n[0],u=n[1],a=r[0]=Je(i,u);++t<e;)r[t]=(a+(a=Je(i=u,u=n[t+1])))/2;return r[t]=a,r}function Ke(n){for(var t,e,r,i,u=[],a=Ge(n),o=-1,c=n.length-1;++o<c;)t=Je(n[o],n[o+1]),Math.abs(t)<1e-6?a[o]=a[o+1]=0:(e=a[o]/t,r=a[o+1]/t,i=e*e+r*r,i>9&&(i=3*t/Math.sqrt(i),a[o]=i*e,a[o+1]=i*r));for(o=-1;++o<=c;)i=(n[Math.min(c,o+1)][0]-n[Math.max(0,o-1)][0])/(6*(1+a[o]*a[o])),u.push([i||0,a[o]*i||0]);return u}function We(n){return n.length<3?je(n):n[0]+Ye(n,Ke(n))}function Qe(n,t,e,r){var i,u,a,o,c,l,f;return i=r[n],u=i[0],a=i[1],i=r[t],o=i[0],c=i[1],i=r[e],l=i[0],f=i[1],(f-a)*(o-u)-(c-a)*(l-u)>0}function nr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function tr(n,t,e,r){var i=n[0],u=e[0],a=t[0]-i,o=r[0]-u,c=n[1],l=e[1],f=t[1]-c,s=r[1]-l,h=(o*(c-l)-s*(i-u))/(s*a-o*f);return[i+h*a,c+h*f]}function er(n,t){var e={list:n.map(function(n,t){return{index:t,x:n[0],y:n[1]}}).sort(function(n,t){return n.y<t.y?-1:n.y>t.y?1:n.x<t.x?-1:n.x>t.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(n,t){return{edge:n,side:t,vertex:null,l:null,r:null}},insert:function(n,t){t.l=n,t.r=n.r,n.r.l=t,n.r=t},leftBound:function(n){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,n));return t=t.l},del:function(n){n.l.r=n.r,n.r.l=n.l,n.edge=null},right:function(n){return n.r},left:function(n){return n.l},leftRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[n.side]},rightRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[Ro[n.side]]}},i={bisect:function(n,t){var e={region:{l:n,r:t},ep:{l:null,r:null}},r=t.x-n.x,i=t.y-n.y,u=r>0?r:-r,a=i>0?i:-i;return e.c=n.x*r+n.y*i+.5*(r*r+i*i),u>a?(e.a=1,e.b=i/r,e.c/=r):(e.b=1,e.a=r/i,e.c/=i),e},intersect:function(n,t){var e=n.edge,r=t.edge;if(!e||!r||e.region.r==r.region.r)return null;var i=e.a*r.b-e.b*r.a;if(Math.abs(i)<1e-10)return null;var u,a,o=(e.c*r.b-r.c*e.b)/i,c=(r.c*e.a-e.c*r.a)/i,l=e.region.r,f=r.region.r;
  2 + l.y<f.y||l.y==f.y&&l.x<f.x?(u=n,a=e):(u=t,a=r);var s=o>=a.region.r.x;return s&&"l"===u.side||!s&&"r"===u.side?null:{x:o,y:c}},rightOf:function(n,t){var e=n.edge,r=e.region.r,i=t.x>r.x;if(i&&"l"===n.side)return 1;if(!i&&"r"===n.side)return 0;if(1===e.a){var u=t.y-r.y,a=t.x-r.x,o=0,c=0;if(!i&&e.b<0||i&&e.b>=0?c=o=u>=e.b*a:(c=t.x+t.y*e.b>e.c,e.b<0&&(c=!c),c||(o=1)),!o){var l=r.x-e.region.l.x;c=e.b*(a*a-u*u)<l*u*(1+2*a/l+e.b*e.b),e.b<0&&(c=!c)}}else{var f=e.c-e.a*t.x,s=t.y-f,h=t.x-r.x,g=f-r.y;c=s*s>h*h+g*g}return"l"===n.side?c:!c},endPoint:function(n,e,r){n.ep[e]=r,n.ep[Ro[e]]&&t(n)},distance:function(n,t){var e=n.x-t.x,r=n.y-t.y;return Math.sqrt(e*e+r*r)}},u={list:[],insert:function(n,t,e){n.vertex=t,n.ystar=t.y+e;for(var r=0,i=u.list,a=i.length;a>r;r++){var o=i[r];if(!(n.ystar>o.ystar||n.ystar==o.ystar&&t.x>o.vertex.x))break}i.splice(r,0,n)},del:function(n){for(var t=0,e=u.list,r=e.length;r>t&&e[t]!=n;++t);e.splice(t,1)},empty:function(){return 0===u.list.length},nextEvent:function(n){for(var t=0,e=u.list,r=e.length;r>t;++t)if(e[t]==n)return e[t+1];return null},min:function(){var n=u.list[0];return{x:n.vertex.x,y:n.ystar}},extractMin:function(){return u.list.shift()}};r.init(),e.bottomSite=e.list.shift();for(var a,o,c,l,f,s,h,g,p,d,m,v,y,M=e.list.shift();;)if(u.empty()||(a=u.min()),M&&(u.empty()||M.y<a.y||M.y==a.y&&M.x<a.x))o=r.leftBound(M),c=r.right(o),h=r.rightRegion(o),v=i.bisect(h,M),s=r.createHalfEdge(v,"l"),r.insert(o,s),d=i.intersect(o,s),d&&(u.del(o),u.insert(o,d,i.distance(d,M))),o=s,s=r.createHalfEdge(v,"r"),r.insert(o,s),d=i.intersect(s,c),d&&u.insert(s,d,i.distance(d,M)),M=e.list.shift();else{if(u.empty())break;o=u.extractMin(),l=r.left(o),c=r.right(o),f=r.right(c),h=r.leftRegion(o),g=r.rightRegion(c),m=o.vertex,i.endPoint(o.edge,o.side,m),i.endPoint(c.edge,c.side,m),r.del(o),u.del(c),r.del(c),y="l",h.y>g.y&&(p=h,h=g,g=p,y="r"),v=i.bisect(h,g),s=r.createHalfEdge(v,y),r.insert(l,s),i.endPoint(v,Ro[y],m),d=i.intersect(l,s),d&&(u.del(l),u.insert(l,d,i.distance(d,h))),d=i.intersect(s,f),d&&u.insert(s,d,i.distance(d,h))}for(o=r.right(r.leftEnd);o!=r.rightEnd;o=r.right(o))t(o.edge)}function rr(n){return n.x}function ir(n){return n.y}function ur(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function ar(n,t,e,r,i,u){if(!n(t,e,r,i,u)){var a=.5*(e+i),o=.5*(r+u),c=t.nodes;c[0]&&ar(n,c[0],e,r,a,o),c[1]&&ar(n,c[1],a,r,i,o),c[2]&&ar(n,c[2],e,o,a,u),c[3]&&ar(n,c[3],a,o,i,u)}}function or(n,t){n=ua.rgb(n),t=ua.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,a=t.g-r,o=t.b-i;return function(n){return"#"+it(Math.round(e+u*n))+it(Math.round(r+a*n))+it(Math.round(i+o*n))}}function cr(n){var t=[n.a,n.b],e=[n.c,n.d],r=fr(t),i=lr(t,e),u=fr(sr(e,t,-i))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*Fa,this.translate=[n.e,n.f],this.scale=[r,u],this.skew=u?Math.atan2(i,u)*Fa:0}function lr(n,t){return n[0]*t[0]+n[1]*t[1]}function fr(n){var t=Math.sqrt(lr(n,n));return t&&(n[0]/=t,n[1]/=t),t}function sr(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function hr(n,t){return t-=n=+n,function(e){return n+t*e}}function gr(n,t){var e,r=[],i=[],u=ua.transform(n),a=ua.transform(t),o=u.translate,c=a.translate,l=u.rotate,f=a.rotate,s=u.skew,h=a.skew,g=u.scale,p=a.scale;return o[0]!=c[0]||o[1]!=c[1]?(r.push("translate(",null,",",null,")"),i.push({i:1,x:hr(o[0],c[0])},{i:3,x:hr(o[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),l!=f?(l-f>180?f+=360:f-l>180&&(l+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:hr(l,f)})):f&&r.push(r.pop()+"rotate("+f+")"),s!=h?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:hr(s,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:e-4,x:hr(g[0],p[0])},{i:e-2,x:hr(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=i.length,function(n){for(var t,u=-1;++u<e;)r[(t=i[u]).i]=t.x(n);return r.join("")}}function pr(n,t){var e,r={},i={};for(e in n)e in t?r[e]=vr(e)(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function dr(n,t){var e,r,i,u,a,o=0,c=0,l=[],f=[];for(n+="",t+="",Yo.lastIndex=0,r=0;e=Yo.exec(t);++r)e.index&&l.push(t.substring(o,c=e.index)),f.push({i:l.length,x:e[0]}),l.push(null),o=Yo.lastIndex;for(o<t.length&&l.push(t.substring(o)),r=0,u=f.length;(e=Yo.exec(n))&&u>r;++r)if(a=f[r],a.x==e[0]){if(a.i)if(null==l[a.i+1])for(l[a.i-1]+=a.x,l.splice(a.i,1),i=r+1;u>i;++i)f[i].i--;else for(l[a.i-1]+=a.x+l[a.i+1],l.splice(a.i,2),i=r+1;u>i;++i)f[i].i-=2;else if(null==l[a.i+1])l[a.i]=a.x;else for(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1),i=r+1;u>i;++i)f[i].i--;f.splice(r,1),u--,r--}else a.x=hr(parseFloat(e[0]),parseFloat(a.x));for(;u>r;)a=f.pop(),null==l[a.i+1]?l[a.i]=a.x:(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1)),u--;return 1===l.length?null==l[0]?(a=f[0].x,function(n){return a(n)+""}):function(){return t}:function(n){for(r=0;u>r;++r)l[(a=f[r]).i]=a.x(n);return l.join("")}}function mr(n,t){for(var e,r=ua.interpolators.length;--r>=0&&!(e=ua.interpolators[r](n,t)););return e}function vr(n){return"transform"==n?gr:mr}function yr(n,t){var e,r=[],i=[],u=n.length,a=t.length,o=Math.min(n.length,t.length);for(e=0;o>e;++e)r.push(mr(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;a>e;++e)i[e]=t[e];return function(n){for(e=0;o>e;++e)i[e]=r[e](n);return i}}function Mr(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function xr(n){return function(t){return 1-n(1-t)}}function br(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function _r(n){return n*n}function wr(n){return n*n*n}function Sr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Er(n){return function(t){return Math.pow(t,n)}}function kr(n){return 1-Math.cos(n*Da/2)}function Ar(n){return Math.pow(2,10*(n-1))}function Nr(n){return 1-Math.sqrt(1-n*n)}function qr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/(2*Da)*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,10*-r)*Math.sin(2*(r-e)*Da/t)}}function Tr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Cr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function zr(n,t){n=ua.hcl(n),t=ua.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,a=t.c-r,o=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return $(e+u*n,r+a*n,i+o*n)+""}}function Dr(n,t){n=ua.hsl(n),t=ua.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,a=t.s-r,o=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return R(e+u*n,r+a*n,i+o*n)+""}}function jr(n,t){n=ua.lab(n),t=ua.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,a=t.a-r,o=t.b-i;return function(n){return K(e+u*n,r+a*n,i+o*n)+""}}function Lr(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Fr(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return(e-n)*t}}function Hr(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return Math.max(0,Math.min(1,(e-n)*t))}}function Pr(n){for(var t=n.source,e=n.target,r=Or(t,e),i=[t];t!==r;)t=t.parent,i.push(t);for(var u=i.length;e!==r;)i.splice(u,0,e),e=e.parent;return i}function Rr(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Or(n,t){if(n===t)return n;for(var e=Rr(n),r=Rr(t),i=e.pop(),u=r.pop(),a=null;i===u;)a=i,i=e.pop(),u=r.pop();return a}function Yr(n){n.fixed|=2}function Ur(n){n.fixed&=-7}function Ir(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Vr(n){n.fixed&=-5}function Xr(n,t,e){var r=0,i=0;if(n.charge=0,!n.leaf)for(var u,a=n.nodes,o=a.length,c=-1;++c<o;)u=a[c],null!=u&&(Xr(u,t,e),n.charge+=u.charge,r+=u.charge*u.cx,i+=u.charge*u.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*e[n.point.index];n.charge+=n.pointCharge=l,r+=l*n.point.x,i+=l*n.point.y}n.cx=r/n.charge,n.cy=i/n.charge}function Zr(n,t){return ua.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=Gr,n}function Br(n){return n.children}function $r(n){return n.value}function Jr(n,t){return t.value-n.value}function Gr(n){return ua.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function Kr(n){return n.x}function Wr(n){return n.y}function Qr(n,t,e){n.y0=t,n.y=e}function ni(n){return ua.range(n.length)}function ti(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function ei(n){for(var t,e=1,r=0,i=n[0][1],u=n.length;u>e;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function ri(n){return n.reduce(ii,0)}function ii(n,t){return n+t[1]}function ui(n,t){return ai(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ai(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];++e<=t;)u[e]=i*e+r;return u}function oi(n){return[ua.min(n),ua.max(n)]}function ci(n,t){return n.parent==t.parent?1:2}function li(n){var t=n.children;return t&&t.length?t[0]:n._tree.thread}function fi(n){var t,e=n.children;return e&&(t=e.length)?e[t-1]:n._tree.thread}function si(n,t){var e=n.children;if(e&&(i=e.length))for(var r,i,u=-1;++u<i;)t(r=si(e[u],t),n)>0&&(n=r);return n}function hi(n,t){return n.x-t.x}function gi(n,t){return t.x-n.x}function pi(n,t){return n.depth-t.depth}function di(n,t){function e(n,r){var i=n.children;if(i&&(a=i.length))for(var u,a,o=null,c=-1;++c<a;)u=i[c],e(u,o),o=u;t(n,r)}e(n,null)}function mi(n){for(var t,e=0,r=0,i=n.children,u=i.length;--u>=0;)t=i[u]._tree,t.prelim+=e,t.mod+=e,e+=t.shift+(r+=t.change)}function vi(n,t,e){n=n._tree,t=t._tree;var r=e/(t.number-n.number);n.change+=r,t.change-=r,t.shift+=e,t.prelim+=e,t.mod+=e}function yi(n,t,e){return n._tree.ancestor.parent==t.parent?n._tree.ancestor:e}function Mi(n,t){return n.value-t.value}function xi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function bi(n,t){n._pack_next=t,t._pack_prev=n}function _i(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return i*i-e*e-r*r>.001}function wi(n){function t(n){f=Math.min(n.x-n.r,f),s=Math.max(n.x+n.r,s),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,i,u,a,o,c,l,f=1/0,s=-1/0,h=1/0,g=-1/0;if(e.forEach(Si),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(u=e[2],Ai(r,i,u),t(u),xi(r,u),r._pack_prev=u,xi(u,i),i=r._pack_next,a=3;l>a;a++){Ai(r,i,u=e[a]);var p=0,d=1,m=1;for(o=i._pack_next;o!==i;o=o._pack_next,d++)if(_i(o,u)){p=1;break}if(1==p)for(c=r._pack_prev;c!==o._pack_prev&&!_i(c,u);c=c._pack_prev,m++);p?(m>d||d==m&&i.r<r.r?bi(r,i=o):bi(r=c,i),a--):(xi(r,u),i=u,t(u))}var v=(f+s)/2,y=(h+g)/2,M=0;for(a=0;l>a;a++)u=e[a],u.x-=v,u.y-=y,M=Math.max(M,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=M,e.forEach(Ei)}}function Si(n){n._pack_next=n._pack_prev=n}function Ei(n){delete n._pack_next,delete n._pack_prev}function ki(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,a=i.length;++u<a;)ki(i[u],t,e,r)}function Ai(n,t,e){var r=n.r+e.r,i=t.x-n.x,u=t.y-n.y;if(r&&(i||u)){var a=t.r+e.r,o=i*i+u*u;a*=a,r*=r;var c=.5+(r-a)/(2*o),l=Math.sqrt(Math.max(0,2*a*(r+o)-(r-=o)*r-a*a))/(2*o);e.x=n.x+c*i+l*u,e.y=n.y+c*u-l*i}else e.x=n.x+r,e.y=n.y}function Ni(n){return 1+ua.max(n,function(n){return n.y})}function qi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ti(n){var t=n.children;return t&&t.length?Ti(t[0]):n}function Ci(n){var t,e=n.children;return e&&(t=e.length)?Ci(e[t-1]):n}function zi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Di(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],u=n.dy-t[0]-t[2];return 0>i&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function ji(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Li(n){return n.rangeExtent?n.rangeExtent():ji(n.range())}function Fi(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Hi(n,t){var e,r=0,i=n.length-1,u=n[r],a=n[i];return u>a&&(e=r,r=i,i=e,e=u,u=a,a=e),(t=t(a-u))&&(n[r]=t.floor(u),n[i]=t.ceil(a)),n}function Pi(n,t,e,r){var i=[],u=[],a=0,o=Math.min(n.length,t.length)-1;for(n[o]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++a<=o;)i.push(e(n[a-1],n[a])),u.push(r(t[a-1],t[a]));return function(t){var e=ua.bisect(n,t,1,o)-1;return u[e](i[e](t))}}function Ri(n,t,e,r){function i(){var i=Math.min(n.length,t.length)>2?Pi:Fi,c=r?Hr:Fr;return a=i(n,t,c,e),o=i(t,n,c,mr),u}function u(n){return a(n)}var a,o;return u.invert=function(n){return o(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Lr)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return Ii(n,t)},u.tickFormat=function(t,e){return Vi(n,t,e)},u.nice=function(){return Hi(n,Yi),i()},u.copy=function(){return Ri(n,t,e,r)},i()}function Oi(n,t){return ua.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Yi(n){return n=Math.pow(10,Math.round(Math.log(n)/Math.LN10)-1),n&&{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}}function Ui(n,t){var e=ji(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function Ii(n,t){return ua.range.apply(ua,Ui(n,t))}function Vi(n,t,e){var r=-Math.floor(Math.log(Ui(n,t)[2])/Math.LN10+.01);return ua.format(e?e.replace(to,function(n,t,e,i,u,a,o,c,l,f){return[t,e,i,u,a,o,c,l||"."+(r-2*("%"===f)),f].join("")}):",."+r+"f")}function Xi(n,t,e,r,i){function u(t){return n(e(t))}function a(){return e===Zi?{floor:o,ceil:c}:{floor:function(n){return-c(-n)},ceil:function(n){return-o(-n)}}}function o(n){return Math.pow(t,Math.floor(Math.log(n)/Math.log(t)))}function c(n){return Math.pow(t,Math.ceil(Math.log(n)/Math.log(t)))}return u.invert=function(t){return r(n.invert(t))},u.domain=function(t){return arguments.length?(t[0]<0?(e=$i,r=Ji):(e=Zi,r=Bi),n.domain((i=t.map(Number)).map(e)),u):i},u.base=function(n){return arguments.length?(t=+n,u):t},u.nice=function(){return n.domain(Hi(i,a).map(e)),u},u.ticks=function(){var i=ji(n.domain()),u=[];if(i.every(isFinite)){var a=Math.log(t),o=Math.floor(i[0]/a),c=Math.ceil(i[1]/a),l=r(i[0]),f=r(i[1]),s=t%1?2:t;if(e===$i)for(u.push(-Math.pow(t,-o));o++<c;)for(var h=s-1;h>0;h--)u.push(-Math.pow(t,-o)*h);else{for(;c>o;o++)for(var h=1;s>h;h++)u.push(Math.pow(t,o)*h);u.push(Math.pow(t,o))}for(o=0;u[o]<l;o++);for(c=u.length;u[c-1]>f;c--);u=u.slice(o,c)}return u},u.tickFormat=function(n,i){if(arguments.length<2&&(i=Go),!arguments.length)return i;var a,o=Math.log(t),c=Math.max(.1,n/u.ticks().length),l=e===$i?(a=-1e-12,Math.floor):(a=1e-12,Math.ceil);return function(n){return n/r(o*l(e(n)/o+a))<=c?i(n):""}},u.copy=function(){return Xi(n.copy(),t,e,r,i)},Oi(u,n)}function Zi(n){return Math.log(0>n?0:n)}function Bi(n){return Math.exp(n)}function $i(n){return-Math.log(n>0?0:-n)}function Ji(n){return-Math.exp(-n)}function Gi(n,t,e){function r(t){return n(i(t))}var i=Ki(t),u=Ki(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return Ii(e,n)},r.tickFormat=function(n,t){return Vi(e,n,t)},r.nice=function(){return r.domain(Hi(e,Yi))},r.exponent=function(a){return arguments.length?(i=Ki(t=a),u=Ki(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return Gi(n.copy(),t,e)},Oi(r,n)}function Ki(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Wi(n,t){function e(t){return a[((u.get(t)||u.set(t,n.push(t)))-1)%a.length]}function r(t,e){return ua.range(n.length).map(function(n){return t+e*n})}var u,a,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new i;for(var a,o=-1,c=r.length;++o<c;)u.has(a=r[o])||u.set(a,n.push(a));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(a=n,o=0,t={t:"range",a:arguments},e):a},e.rangePoints=function(i,u){arguments.length<2&&(u=0);var c=i[0],l=i[1],f=(l-c)/(Math.max(1,n.length-1)+u);return a=r(n.length<2?(c+l)/2:c+f*u/2,f),o=0,t={t:"rangePoints",a:arguments},e},e.rangeBands=function(i,u,c){arguments.length<2&&(u=0),arguments.length<3&&(c=u);var l=i[1]<i[0],f=i[l-0],s=i[1-l],h=(s-f)/(n.length-u+2*c);return a=r(f+h*c,h),l&&a.reverse(),o=h*(1-u),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(i,u,c){arguments.length<2&&(u=0),arguments.length<3&&(c=u);var l=i[1]<i[0],f=i[l-0],s=i[1-l],h=Math.floor((s-f)/(n.length-u+2*c)),g=s-f-(n.length-u)*h;return a=r(f+Math.round(g/2),h),l&&a.reverse(),o=Math.round(h*(1-u)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return ji(t.a[0])},e.copy=function(){return Wi(n,t)},e.domain(n)}function Qi(n,t){function e(){var e=0,u=t.length;for(i=[];++e<u;)i[e-1]=ua.quantile(n,e/u);return r}function r(n){return isNaN(n=+n)?0/0:t[ua.bisect(i,n)]}var i;return r.domain=function(t){return arguments.length?(n=t.filter(function(n){return!isNaN(n)}).sort(ua.ascending),e()):n},r.range=function(n){return arguments.length?(t=n,e()):t},r.quantiles=function(){return i},r.copy=function(){return Qi(n,t)},e()}function nu(n,t,e){function r(t){return e[Math.max(0,Math.min(a,Math.floor(u*(t-n))))]}function i(){return u=e.length/(t-n),a=e.length-1,r}var u,a;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],i()):[n,t]},r.range=function(n){return arguments.length?(e=n,i()):e},r.copy=function(){return nu(n,t,e)},i()}function tu(n,t){function e(e){return t[ua.bisect(n,e)]}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.copy=function(){return tu(n,t)},e}function eu(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Ii(n,t)},t.tickFormat=function(t,e){return Vi(n,t,e)},t.copy=function(){return eu(n)},t}function ru(n){return n.innerRadius}function iu(n){return n.outerRadius}function uu(n){return n.startAngle}function au(n){return n.endAngle}function ou(n){for(var t,e,r,i=-1,u=n.length;++i<u;)t=n[i],e=t[0],r=t[1]+tc,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function cu(n){function t(t){function c(){d.push("M",o(n(v),s),f,l(n(m.reverse()),s),"Z")}for(var h,g,p,d=[],m=[],v=[],y=-1,M=t.length,x=ft(e),b=ft(i),_=e===r?function(){return g}:ft(r),w=i===u?function(){return p}:ft(u);++y<M;)a.call(this,h=t[y],y)?(m.push([g=+x.call(this,h,y),p=+b.call(this,h,y)]),v.push([+_.call(this,h,y),+w.call(this,h,y)])):m.length&&(c(),m=[],v=[]);return m.length&&c(),d.length?d.join(""):null}var e=ze,r=ze,i=0,u=De,a=Lt,o=je,c=o.key,l=o,f="L",s=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(i=u=n,t):u},t.y0=function(n){return arguments.length?(i=n,t):i},t.y1=function(n){return arguments.length?(u=n,t):u},t.defined=function(n){return arguments.length?(a=n,t):a},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?o=n:(o=Lo.get(n)||je).key,l=o.reverse||o,f=o.closed?"M":"L",t):c},t.tension=function(n){return arguments.length?(s=n,t):s},t}function lu(n){return n.radius}function fu(n){return[n.x,n.y]}function su(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]+tc;return[e*Math.cos(r),e*Math.sin(r)]}}function hu(){return 64}function gu(){return"circle"}function pu(n){var t=Math.sqrt(n/Da);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function du(n,t){return va(n,oc),n.id=t,n}function mu(n,t,e,r){var i=n.id;return j(n,"function"==typeof e?function(n,u,a){n.__transition__[i].tween.set(t,r(e.call(n,n.__data__,u,a)))}:(e=r(e),function(n){n.__transition__[i].tween.set(t,e)}))}function vu(n){return null==n&&(n=""),function(){this.textContent=n}}function yu(n,t,e,r){var u=n.__transition__||(n.__transition__={active:0,count:0}),a=u[e];if(!a){var o=r.time;return a=u[e]={tween:new i,event:ua.dispatch("start","end"),time:o,ease:r.ease,delay:r.delay,duration:r.duration},++u.count,ua.timer(function(r){function i(r){return u.active>e?l():(u.active=e,h.start.call(n,f,t),a.tween.forEach(function(e,r){(r=r.call(n,f,t))&&d.push(r)}),c(r)||ua.timer(c,0,o),1)}function c(r){if(u.active!==e)return l();for(var i=(r-g)/p,a=s(i),o=d.length;o>0;)d[--o].call(n,a);return i>=1?(l(),h.end.call(n,f,t),1):void 0}function l(){return--u.count?delete u[e]:delete n.__transition__,1}var f=n.__data__,s=a.ease,h=a.event,g=a.delay,p=a.duration,d=[];return r>=g?i(r):ua.timer(i,g,o),1},0,o),a}}function Mu(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function xu(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function bu(n,t,e){if(r=[],e&&t.length>1){for(var r,i,u,a=ji(n.domain()),o=-1,c=t.length,l=(t[1]-t[0])/++e;++o<c;)for(i=e;--i>0;)(u=+t[o]-i*l)>=a[0]&&r.push(u);for(--o,i=0;++i<e&&(u=+t[o]+i*l)<a[1];)r.push(u)}return r}function _u(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function wu(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new pc(e-1)),1),e}function u(n,e){return t(n=new pc(+n),e),n}function a(n,r,u){var a=i(n),o=[];if(u>1)for(;r>a;)e(a)%u||o.push(new Date(+a)),t(a,1);else for(;r>a;)o.push(new Date(+a)),t(a,1);return o}function o(n,t,e){try{pc=_u;var r=new _u;return r._=n,a(r,t,e)}finally{pc=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=a;var c=n.utc=Su(n);return c.floor=c,c.round=Su(r),c.ceil=Su(i),c.offset=Su(u),c.range=o,n}function Su(n){return function(t,e){try{pc=_u;var r=new _u;return r._=t,n(r,e)._}finally{pc=Date}}}function Eu(n,t,e,r){for(var i,u,a=0,o=t.length,c=e.length;o>a;){if(r>=c)return-1;if(i=t.charCodeAt(a++),37===i){if(u=zc[t.charAt(a++)],!u||(r=u(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function ku(n){return RegExp("^(?:"+n.map(ua.requote).join("|")+")","i")}function Au(n){for(var t=new i,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Nu(n,t,e){n+="";var r=n.length;return e>r?Array(e-r+1).join(t)+n:n}function qu(n,t,e){Ec.lastIndex=0;var r=Ec.exec(t.substring(e));return r?e+=r[0].length:-1}function Tu(n,t,e){Sc.lastIndex=0;var r=Sc.exec(t.substring(e));return r?e+=r[0].length:-1}function Cu(n,t,e){Nc.lastIndex=0;var r=Nc.exec(t.substring(e));return r?(n.m=qc.get(r[0].toLowerCase()),e+=r[0].length):-1}function zu(n,t,e){kc.lastIndex=0;var r=kc.exec(t.substring(e));return r?(n.m=Ac.get(r[0].toLowerCase()),e+=r[0].length):-1}function Du(n,t,e){return Eu(n,""+Cc.c,t,e)}function ju(n,t,e){return Eu(n,""+Cc.x,t,e)}function Lu(n,t,e){return Eu(n,""+Cc.X,t,e)}function Fu(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+4));return r?(n.y=+r[0],e+=r[0].length):-1}function Hu(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+2));return r?(n.y=Pu(+r[0]),e+=r[0].length):-1}function Pu(n){return n+(n>68?1900:2e3)}function Ru(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+=r[0].length):-1}function Ou(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+=r[0].length):-1}function Yu(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+=r[0].length):-1}function Uu(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+=r[0].length):-1}function Iu(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+=r[0].length):-1}function Vu(n,t,e){Dc.lastIndex=0;var r=Dc.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+=r[0].length):-1}function Xu(n,t,e){var r=jc.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}function Zu(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return e+Nu(r,"0",2)+Nu(i,"0",2)}function Bu(n){return n.toISOString()}function $u(n,t,e){function r(t){return n(t)}return r.invert=function(t){return Ju(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Ju)},r.nice=function(n){return r.domain(Hi(r.domain(),function(){return n}))},r.ticks=function(e,i){var u=ji(r.domain());if("function"!=typeof e){var a=u[1]-u[0],o=a/e,c=ua.bisect(Fc,o);if(c==Fc.length)return t.year(u,e);if(!c)return n.ticks(e).map(Ju);Math.log(o/Fc[c-1])<Math.log(Fc[c]/o)&&--c,e=t[c],i=e[1],e=e[0].range}return e(u[0],new Date(+u[1]+1),i)},r.tickFormat=function(){return e},r.copy=function(){return $u(n.copy(),t,e)},Oi(r,n)}function Ju(n){return new Date(n)}function Gu(n){return function(t){for(var e=n.length-1,r=n[e];!r[1](t);)r=n[--e];return r[0](t)}}function Ku(n){var t=new Date(n,0,1);return t.setFullYear(n),t}function Wu(n){var t=n.getFullYear(),e=Ku(t),r=Ku(t+1);return t+(n-e)/(r-e)}function Qu(n){var t=new Date(Date.UTC(n,0,1));return t.setUTCFullYear(n),t}function na(n){var t=n.getUTCFullYear(),e=Qu(t),r=Qu(t+1);return t+(n-e)/(r-e)}function ta(n){return n.responseText}function ea(n){return JSON.parse(n.responseText)}function ra(n){var t=aa.createRange();return t.selectNode(aa.body),t.createContextualFragment(n.responseText)}function ia(n){return n.responseXML}var ua={version:"3.1.9"};Date.now||(Date.now=function(){return+new Date});var aa=document,oa=window;try{aa.createElement("div").style.setProperty("opacity",0,"")}catch(ca){var la=oa.CSSStyleDeclaration.prototype,fa=la.setProperty;la.setProperty=function(n,t,e){fa.call(this,n,t+"",e)}}ua.ascending=function(n,t){return t>n?-1:n>t?1:n>=t?0:0/0},ua.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ua.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u&&(null==(e=n[i])||e!=e);)e=void 0;for(;++i<u;)null!=(r=n[i])&&e>r&&(e=r)}else{for(;++i<u&&(null==(e=t.call(n,n[i],i))||e!=e);)e=void 0;for(;++i<u;)null!=(r=t.call(n,n[i],i))&&e>r&&(e=r)}return e},ua.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u&&(null==(e=n[i])||e!=e);)e=void 0;for(;++i<u;)null!=(r=n[i])&&r>e&&(e=r)}else{for(;++i<u&&(null==(e=t.call(n,n[i],i))||e!=e);)e=void 0;for(;++i<u;)null!=(r=t.call(n,n[i],i))&&r>e&&(e=r)}return e},ua.extent=function(n,t){var e,r,i,u=-1,a=n.length;if(1===arguments.length){for(;++u<a&&(null==(e=i=n[u])||e!=e);)e=i=void 0;for(;++u<a;)null!=(r=n[u])&&(e>r&&(e=r),r>i&&(i=r))}else{for(;++u<a&&(null==(e=i=t.call(n,n[u],u))||e!=e);)e=void 0;for(;++u<a;)null!=(r=t.call(n,n[u],u))&&(e>r&&(e=r),r>i&&(i=r))}return[e,i]},ua.sum=function(n,t){var e,r=0,i=n.length,u=-1;if(1===arguments.length)for(;++u<i;)isNaN(e=+n[u])||(r+=e);else for(;++u<i;)isNaN(e=+t.call(n,n[u],u))||(r+=e);return r},ua.mean=function(t,e){var r,i=t.length,u=0,a=-1,o=0;if(1===arguments.length)for(;++a<i;)n(r=t[a])&&(u+=(r-u)/++o);else for(;++a<i;)n(r=e.call(t,t[a],a))&&(u+=(r-u)/++o);return o?u:void 0},ua.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),i=+n[r-1],u=e-r;return u?i+u*(n[r]-i):i},ua.median=function(t,e){return arguments.length>1&&(t=t.map(e)),t=t.filter(n),t.length?ua.quantile(t.sort(ua.ascending),.5):void 0},ua.bisector=function(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n.call(t,t[u],u)<e?r=u+1:i=u}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;e<n.call(t,t[u],u)?i=u:r=u+1}return r}}};var sa=ua.bisector(function(n){return n});ua.bisectLeft=sa.left,ua.bisect=ua.bisectRight=sa.right,ua.shuffle=function(n){for(var t,e,r=n.length;r;)e=0|Math.random()*r--,t=n[r],n[r]=n[e],n[e]=t;return n},ua.permute=function(n,t){for(var e=[],r=-1,i=t.length;++r<i;)e[r]=n[t[r]];return e},ua.zip=function(){if(!(i=arguments.length))return[];for(var n=-1,e=ua.min(arguments,t),r=Array(e);++n<e;)for(var i,u=-1,a=r[n]=Array(i);++u<i;)a[u]=arguments[u][n];return r},ua.transpose=function(n){return ua.zip.apply(ua,n)},ua.keys=function(n){var t=[];for(var e in n)t.push(e);return t},ua.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},ua.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},ua.merge=function(n){return Array.prototype.concat.apply([],n)},ua.range=function(n,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/r)throw Error("infinite range");var i,u=[],a=e(Math.abs(r)),o=-1;if(n*=a,t*=a,r*=a,0>r)for(;(i=n+r*++o)>t;)u.push(i/a);else for(;(i=n+r*++o)<t;)u.push(i/a);return u},ua.map=function(n){var t=new i;for(var e in n)t.set(e,n[e]);return t},r(i,{has:function(n){return ha+n in this},get:function(n){return this[ha+n]},set:function(n,t){return this[ha+n]=t},remove:function(n){return n=ha+n,n in this&&delete this[n]},keys:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},values:function(){var n=[];return this.forEach(function(t,e){n.push(e)}),n},entries:function(){var n=[];return this.forEach(function(t,e){n.push({key:t,value:e})}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===ga&&n.call(this,t.substring(1),this[t])}});var ha="\0",ga=ha.charCodeAt(0);ua.nest=function(){function n(t,o,c){if(c>=a.length)return r?r.call(u,o):e?o.sort(e):o;for(var l,f,s,h,g=-1,p=o.length,d=a[c++],m=new i;++g<p;)(h=m.get(l=d(f=o[g])))?h.push(f):m.set(l,[f]);return t?(f=t(),s=function(e,r){f.set(e,n(t,r,c))}):(f={},s=function(e,r){f[e]=n(t,r,c)}),m.forEach(s),f}function t(n,e){if(e>=a.length)return n;var r=[],i=o[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,u={},a=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ua.map,e,0),0)},u.key=function(n){return a.push(n),u},u.sortKeys=function(n){return o[a.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ua.set=function(n){var t=new u;if(n)for(var e=0;e<n.length;e++)t.add(n[e]);return t},r(u,{has:function(n){return ha+n in this},add:function(n){return this[ha+n]=!0,n},remove:function(n){return n=ha+n,n in this&&delete this[n]},values:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===ga&&n.call(this,t.substring(1))}}),ua.behavior={},ua.rebind=function(n,t){for(var e,r=1,i=arguments.length;++r<i;)n[e=arguments[r]]=a(n,t,t[e]);return n},ua.dispatch=function(){for(var n=new o,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=c(n);return n},o.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ua.event=null,ua.mouse=function(n){return g(n,f())};var pa=/WebKit/.test(oa.navigator.userAgent)?-1:0,da=d;try{da(aa.documentElement.childNodes)[0].nodeType}catch(ma){da=p}var va=[].__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]};ua.touches=function(n,t){return arguments.length<2&&(t=f().touches),t?da(t).map(function(t){var e=g(n,t);return e.identifier=t.identifier,e}):[]},ua.behavior.drag=function(){function n(){this.on("mousedown.drag",t).on("touchstart.drag",t)}function t(){function n(){var n=a.parentNode;return null!=f?ua.touches(n).filter(function(n){return n.identifier===f})[0]:ua.mouse(n)}function t(){if(!a.parentNode)return i();var t=n(),e=t[0]-h[0],r=t[1]-h[1];g|=e|r,h=t,l(),o({type:"drag",x:t[0]+u[0],y:t[1]+u[1],dx:e,dy:r})}function i(){o({type:"dragend"}),g&&(l(),ua.event.target===c&&s(p,"click")),p.on(null!=f?"touchmove.drag-"+f:"mousemove.drag",null).on(null!=f?"touchend.drag-"+f:"mouseup.drag",null)}var u,a=this,o=e.of(a,arguments),c=ua.event.target,f=ua.event.touches?ua.event.changedTouches[0].identifier:null,h=n(),g=0,p=ua.select(oa).on(null!=f?"touchmove.drag-"+f:"mousemove.drag",t).on(null!=f?"touchend.drag-"+f:"mouseup.drag",i,!0);r?(u=r.apply(a,arguments),u=[u.x-h[0],u.y-h[1]]):u=[0,0],null==f&&l(),o({type:"dragstart"})}var e=h(n,"drag","dragstart","dragend"),r=null;return n.origin=function(t){return arguments.length?(r=t,n):r},ua.rebind(n,e,"on")};var ya=function(n,t){return t.querySelector(n)},Ma=function(n,t){return t.querySelectorAll(n)},xa=aa.documentElement,ba=xa.matchesSelector||xa.webkitMatchesSelector||xa.mozMatchesSelector||xa.msMatchesSelector||xa.oMatchesSelector,_a=function(n,t){return ba.call(n,t)};"function"==typeof Sizzle&&(ya=function(n,t){return Sizzle(n,t)[0]||null},Ma=function(n,t){return Sizzle.uniqueSort(Sizzle(n,t))},_a=Sizzle.matchesSelector),ua.selection=function(){return Na};var wa=ua.selection.prototype=[];wa.select=function(n){var t,e,r,i,u=[];"function"!=typeof n&&(n=v(n));for(var a=-1,o=this.length;++a<o;){u.push(t=[]),t.parentNode=(r=this[a]).parentNode;
  3 + for(var c=-1,l=r.length;++c<l;)(i=r[c])?(t.push(e=n.call(i,i.__data__,c)),e&&"__data__"in i&&(e.__data__=i.__data__)):t.push(null)}return m(u)},wa.selectAll=function(n){var t,e,r=[];"function"!=typeof n&&(n=y(n));for(var i=-1,u=this.length;++i<u;)for(var a=this[i],o=-1,c=a.length;++o<c;)(e=a[o])&&(r.push(t=da(n.call(e,e.__data__,o))),t.parentNode=e);return m(r)};var Sa={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ua.ns={prefix:Sa,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.substring(0,t),n=n.substring(t+1)),Sa.hasOwnProperty(e)?{space:Sa[e],local:n}:n}},wa.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ua.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(M(t,n[t]));return this}return this.each(M(n,t))},ua.requote=function(n){return n.replace(Ea,"\\$&")};var Ea=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;wa.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=n.trim().split(/^|\s+/g)).length,i=-1;if(t=e.classList){for(;++i<r;)if(!t.contains(n[i]))return!1}else for(t=e.getAttribute("class");++i<r;)if(!_(n[i]).test(t))return!1;return!0}for(t in n)this.each(w(t,n[t]));return this}return this.each(w(n,t))},wa.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(E(e,n[e],t));return this}if(2>r)return oa.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(E(n,t,e))},wa.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(k(t,n[t]));return this}return this.each(k(n,t))},wa.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},wa.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},wa.append=function(n){function t(){return this.appendChild(aa.createElementNS(this.namespaceURI,n))}function e(){return this.appendChild(aa.createElementNS(n.space,n.local))}return n=ua.ns.qualify(n),this.select(n.local?e:t)},wa.insert=function(n,t){function e(e,r){return this.insertBefore(aa.createElementNS(this.namespaceURI,n),t.call(this,e,r))}function r(e,r){return this.insertBefore(aa.createElementNS(n.space,n.local),t.call(this,e,r))}return n=ua.ns.qualify(n),"function"!=typeof t&&(t=v(t)),this.select(n.local?r:e)},wa.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},wa.data=function(n,t){function e(n,e){var r,u,a,o=n.length,s=e.length,h=Math.min(o,s),g=Array(s),p=Array(s),d=Array(o);if(t){var m,v=new i,y=new i,M=[];for(r=-1;++r<o;)m=t.call(u=n[r],u.__data__,r),v.has(m)?d[r]=u:v.set(m,u),M.push(m);for(r=-1;++r<s;)m=t.call(e,a=e[r],r),(u=v.get(m))?(g[r]=u,u.__data__=a):y.has(m)||(p[r]=A(a)),y.set(m,a),v.remove(m);for(r=-1;++r<o;)v.has(M[r])&&(d[r]=n[r])}else{for(r=-1;++r<h;)u=n[r],a=e[r],u?(u.__data__=a,g[r]=u):p[r]=A(a);for(;s>r;++r)p[r]=A(e[r]);for(;o>r;++r)d[r]=n[r]}p.update=g,p.parentNode=g.parentNode=d.parentNode=n.parentNode,c.push(p),l.push(g),f.push(d)}var r,u,a=-1,o=this.length;if(!arguments.length){for(n=Array(o=(r=this[0]).length);++a<o;)(u=r[a])&&(n[a]=u.__data__);return n}var c=L([]),l=m([]),f=m([]);if("function"==typeof n)for(;++a<o;)e(r=this[a],n.call(r,r.parentNode.__data__,a));else for(;++a<o;)e(r=this[a],n);return l.enter=function(){return c},l.exit=function(){return f},l},wa.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},wa.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=N(n));for(var u=0,a=this.length;a>u;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var o=0,c=e.length;c>o;o++)(r=e[o])&&n.call(r,r.__data__,o)&&t.push(r)}return m(i)},wa.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],i=r.length-1,u=r[i];--i>=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},wa.sort=function(n){n=q.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},wa.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(C(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(C(n,t,e))};var ka=ua.map({mouseenter:"mouseover",mouseleave:"mouseout"});ka.forEach(function(n){"on"+n in aa&&ka.remove(n)}),wa.each=function(n){return j(this,function(t,e,r){n.call(t,t.__data__,e,r)})},wa.call=function(n){var t=da(arguments);return n.apply(t[0]=this,t),this},wa.empty=function(){return!this.node()},wa.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null};var Aa=[];ua.selection.enter=L,ua.selection.enter.prototype=Aa,Aa.append=wa.append,Aa.insert=wa.insert,Aa.empty=wa.empty,Aa.node=wa.node,Aa.select=function(n){for(var t,e,r,i,u,a=[],o=-1,c=this.length;++o<c;){r=(i=this[o]).update,a.push(t=[]),t.parentNode=i.parentNode;for(var l=-1,f=i.length;++l<f;)(u=i[l])?(t.push(r[l]=e=n.call(i.parentNode,u.__data__,l)),e.__data__=u.__data__):t.push(null)}return m(a)},wa.transition=function(){var n,t,e=ic||++cc,r=[],i=Object.create(lc);i.time=Date.now();for(var u=-1,a=this.length;++u<a;){r.push(n=[]);for(var o=this[u],c=-1,l=o.length;++c<l;)(t=o[c])&&yu(t,c,e,i),n.push(t)}return du(r,e)},ua.select=function(n){var t=["string"==typeof n?ya(n,aa):n];return t.parentNode=xa,m([t])},ua.selectAll=function(n){var t=da("string"==typeof n?Ma(n,aa):n);return t.parentNode=xa,m([t])};var Na=ua.select(xa);ua.behavior.zoom=function(){function n(){this.on("mousedown.zoom",o).on("mousemove.zoom",f).on(Ca+".zoom",c).on("dblclick.zoom",g).on("touchstart.zoom",p).on("touchmove.zoom",d).on("touchend.zoom",p)}function t(n){return[(n[0]-w[0])/S,(n[1]-w[1])/S]}function e(n){return[n[0]*S+w[0],n[1]*S+w[1]]}function r(n){S=Math.max(E[0],Math.min(E[1],n))}function i(n,t){t=e(t),w[0]+=n[0]-t[0],w[1]+=n[1]-t[1]}function u(){M&&M.domain(y.range().map(function(n){return(n-w[0])/S}).map(y.invert)),b&&b.domain(x.range().map(function(n){return(n-w[1])/S}).map(x.invert))}function a(n){u(),ua.event.preventDefault(),n({type:"zoom",scale:S,translate:w})}function o(){function n(){c=1,i(ua.mouse(r),h),a(u)}function e(){c&&l(),f.on("mousemove.zoom",null).on("mouseup.zoom",null),c&&ua.event.target===o&&s(f,"click.zoom")}var r=this,u=k.of(r,arguments),o=ua.event.target,c=0,f=ua.select(oa).on("mousemove.zoom",n).on("mouseup.zoom",e),h=t(ua.mouse(r));oa.focus(),l()}function c(){m||(m=t(ua.mouse(this))),r(Math.pow(2,.002*qa())*S),i(ua.mouse(this),m),a(k.of(this,arguments))}function f(){m=null}function g(){var n=ua.mouse(this),e=t(n),u=Math.log(S)/Math.LN2;r(Math.pow(2,ua.event.shiftKey?Math.ceil(u)-1:Math.floor(u)+1)),i(n,e),a(k.of(this,arguments))}function p(){var n=ua.touches(this),e=Date.now();if(v=S,m={},n.forEach(function(n){m[n.identifier]=t(n)}),l(),1===n.length){if(500>e-_){var u=n[0],o=t(n[0]);r(2*S),i(u,o),a(k.of(this,arguments))}_=e}}function d(){var n=ua.touches(this),t=n[0],e=m[t.identifier];if(u=n[1]){var u,o=m[u.identifier];t=[(t[0]+u[0])/2,(t[1]+u[1])/2],e=[(e[0]+o[0])/2,(e[1]+o[1])/2],r(ua.event.scale*v)}i(t,e),_=null,a(k.of(this,arguments))}var m,v,y,M,x,b,_,w=[0,0],S=1,E=Ta,k=h(n,"zoom");return n.translate=function(t){return arguments.length?(w=t.map(Number),u(),n):w},n.scale=function(t){return arguments.length?(S=+t,u(),n):S},n.scaleExtent=function(t){return arguments.length?(E=null==t?Ta:t.map(Number),n):E},n.x=function(t){return arguments.length?(M=t,y=t.copy(),w=[0,0],S=1,n):M},n.y=function(t){return arguments.length?(b=t,x=t.copy(),w=[0,0],S=1,n):b},ua.rebind(n,k,"on")};var qa,Ta=[0,1/0],Ca="onwheel"in aa?(qa=function(){return-ua.event.deltaY*(ua.event.deltaMode?120:1)},"wheel"):"onmousewheel"in aa?(qa=function(){return ua.event.wheelDelta},"mousewheel"):(qa=function(){return-ua.event.detail},"MozMousePixelScroll");F.prototype.toString=function(){return this.rgb()+""},ua.hsl=function(n,t,e){return 1===arguments.length?n instanceof P?H(n.h,n.s,n.l):ut(""+n,at,H):H(+n,+t,+e)};var za=P.prototype=new F;za.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),H(this.h,this.s,this.l/n)},za.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),H(this.h,this.s,n*this.l)},za.rgb=function(){return R(this.h,this.s,this.l)};var Da=Math.PI,ja=1e-6,La=Da/180,Fa=180/Da;ua.hcl=function(n,t,e){return 1===arguments.length?n instanceof B?Z(n.h,n.c,n.l):n instanceof G?W(n.l,n.a,n.b):W((n=ot((n=ua.rgb(n)).r,n.g,n.b)).l,n.a,n.b):Z(+n,+t,+e)};var Ha=B.prototype=new F;Ha.brighter=function(n){return Z(this.h,this.c,Math.min(100,this.l+Pa*(arguments.length?n:1)))},Ha.darker=function(n){return Z(this.h,this.c,Math.max(0,this.l-Pa*(arguments.length?n:1)))},Ha.rgb=function(){return $(this.h,this.c,this.l).rgb()},ua.lab=function(n,t,e){return 1===arguments.length?n instanceof G?J(n.l,n.a,n.b):n instanceof B?$(n.l,n.c,n.h):ot((n=ua.rgb(n)).r,n.g,n.b):J(+n,+t,+e)};var Pa=18,Ra=.95047,Oa=1,Ya=1.08883,Ua=G.prototype=new F;Ua.brighter=function(n){return J(Math.min(100,this.l+Pa*(arguments.length?n:1)),this.a,this.b)},Ua.darker=function(n){return J(Math.max(0,this.l-Pa*(arguments.length?n:1)),this.a,this.b)},Ua.rgb=function(){return K(this.l,this.a,this.b)},ua.rgb=function(n,t,e){return 1===arguments.length?n instanceof rt?et(n.r,n.g,n.b):ut(""+n,et,R):et(~~n,~~t,~~e)};var Ia=rt.prototype=new F;Ia.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),et(Math.min(255,Math.floor(t/n)),Math.min(255,Math.floor(e/n)),Math.min(255,Math.floor(r/n)))):et(i,i,i)},Ia.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),et(Math.floor(n*this.r),Math.floor(n*this.g),Math.floor(n*this.b))},Ia.hsl=function(){return at(this.r,this.g,this.b)},Ia.toString=function(){return"#"+it(this.r)+it(this.g)+it(this.b)};var Va=ua.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});Va.forEach(function(n,t){Va.set(n,ut(t,et,R))}),ua.functor=ft,ua.xhr=function(n,t,e){function r(){var n=c.status;!n&&c.responseText||n>=200&&300>n||304===n?u.load.call(i,o.call(i,c)):u.error.call(i,c)}var i={},u=ua.dispatch("progress","load","error"),a={},o=st,c=new(oa.XDomainRequest&&/^(http(s)?:)?\/\//.test(n)?XDomainRequest:XMLHttpRequest);return"onload"in c?c.onload=c.onerror=r:c.onreadystatechange=function(){c.readyState>3&&r()},c.onprogress=function(n){var t=ua.event;ua.event=n;try{u.progress.call(i,c)}finally{ua.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.response=function(n){return o=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(da(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var o in a)c.setRequestHeader(o,a[o]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},ua.rebind(i,u,"on"),2===arguments.length&&"function"==typeof t&&(e=t,t=null),null==e?i:i.get(ht(e))},ua.csv=gt(",","text/csv"),ua.tsv=gt(" ","text/tab-separated-values");var Xa,Za,Ba=0,$a={},Ja=null;ua.timer=function(n,t,e){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;e=Date.now()}var r=$a[n.id];r&&r.callback===n?(r.then=e,r.delay=t):$a[n.id=++Ba]=Ja={callback:n,then:e,delay:t,next:Ja},Xa||(Za=clearTimeout(Za),Xa=1,Ga(pt))},ua.timer.flush=function(){for(var n,t=Date.now(),e=Ja;e;)n=t-e.then,e.delay||(e.flush=e.callback(n)),e=e.next;dt()};var Ga=oa.requestAnimationFrame||oa.webkitRequestAnimationFrame||oa.mozRequestAnimationFrame||oa.oRequestAnimationFrame||oa.msRequestAnimationFrame||function(n){setTimeout(n,17)},Ka=".",Wa=",",Qa=[3,3],no=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(mt);ua.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ua.round(n,vt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),no[8+e/3]},ua.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)},ua.format=function(n){var t=to.exec(n),e=t[1]||" ",r=t[2]||">",i=t[3]||"",u=t[4]||"",a=t[5],o=+t[6],c=t[7],l=t[8],f=t[9],s=1,h="",g=!1;switch(l&&(l=+l.substring(1)),(a||"0"===e&&"="===r)&&(a=e="0",r="=",c&&(o-=Math.floor((o-1)/4))),f){case"n":c=!0,f="g";break;case"%":s=100,h="%",f="f";break;case"p":s=100,h="%",f="r";break;case"b":case"o":case"x":case"X":u&&(u="0"+f.toLowerCase());case"c":case"d":g=!0,l=0;break;case"s":s=-1,f="r"}"#"===u&&(u=""),"r"!=f||l||(f="g"),null!=l&&("g"==f?l=Math.max(1,Math.min(21,l)):("e"==f||"f"==f)&&(l=Math.max(0,Math.min(20,l)))),f=eo.get(f)||yt;var p=a&&c;return function(n){if(g&&n%1)return"";var t=0>n||0===n&&0>1/n?(n=-n,"-"):i;if(0>s){var d=ua.formatPrefix(n,l);n=d.scale(n),h=d.symbol}else n*=s;n=f(n,l),!a&&c&&(n=ro(n));var m=u.length+n.length+(p?0:t.length),v=o>m?Array(m=o-m+1).join(e):"";return p&&(n=ro(v+n)),Ka&&n.replace(".",Ka),t+=u,("<"===r?t+n+v:">"===r?v+t+n:"^"===r?v.substring(0,m>>=1)+t+n+v.substring(m):t+(p?n:v+n))+h}};var to=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,eo=ua.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ua.round(n,vt(n,t))).toFixed(Math.max(0,Math.min(20,vt(n*(1+1e-15),t))))}}),ro=st;if(Qa){var io=Qa.length;ro=function(n){for(var t=n.lastIndexOf("."),e=t>=0?"."+n.substring(t+1):(t=n.length,""),r=[],i=0,u=Qa[0];t>0&&u>0;)r.push(n.substring(t-=u,t+u)),u=Qa[i=(i+1)%io];return r.reverse().join(Wa||"")+e}}ua.geo={},ua.geo.stream=function(n,t){n&&uo.hasOwnProperty(n.type)?uo[n.type](n,t):Mt(n,t)};var uo={Feature:function(n,t){Mt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++r<i;)Mt(e[r].geometry,t)}},ao={Sphere:function(n,t){t.sphere()},Point:function(n,t){var e=n.coordinates;t.point(e[0],e[1])},MultiPoint:function(n,t){for(var e,r=n.coordinates,i=-1,u=r.length;++i<u;)e=r[i],t.point(e[0],e[1])},LineString:function(n,t){xt(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)xt(e[r],t,0)},Polygon:function(n,t){bt(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)bt(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,i=e.length;++r<i;)Mt(e[r],t)}};ua.geo.area=function(n){return oo=0,ua.geo.stream(n,lo),oo};var oo,co,lo={sphere:function(){oo+=4*Da},point:T,lineStart:T,lineEnd:T,polygonStart:function(){co=0,lo.lineStart=_t},polygonEnd:function(){var n=2*co;oo+=0>n?4*Da+n:n,lo.lineStart=lo.lineEnd=lo.point=T}};ua.geo.bounds=function(){function n(n,t){M.push(x=[f=n,h=n]),s>t&&(s=t),t>g&&(g=t)}function t(t,e){var r=wt([t*La,e*La]);if(v){var i=Et(v,r),u=[i[1],-i[0],0],a=Et(u,i);Nt(a),a=qt(a);var c=t-p,l=c>0?1:-1,d=a[0]*Fa*l,m=Math.abs(c)>180;if(m^(d>l*p&&l*t>d)){var y=a[1]*Fa;y>g&&(g=y)}else if(d=(d+360)%360-180,m^(d>l*p&&l*t>d)){var y=-a[1]*Fa;s>y&&(s=y)}else s>e&&(s=e),e>g&&(g=e);m?p>t?o(f,t)>o(f,h)&&(h=t):o(t,h)>o(f,h)&&(f=t):h>=f?(f>t&&(f=t),t>h&&(h=t)):t>p?o(f,t)>o(f,h)&&(h=t):o(t,h)>o(f,h)&&(f=t)}else n(t,e);v=r,p=t}function e(){b.point=t}function r(){x[0]=f,x[1]=h,b.point=n,v=null}function i(n,e){if(v){var r=n-p;y+=Math.abs(r)>180?r+(r>0?360:-360):r}else d=n,m=e;lo.point(n,e),t(n,e)}function u(){lo.lineStart()}function a(){i(d,m),lo.lineEnd(),Math.abs(y)>ja&&(f=-(h=180)),x[0]=f,x[1]=h,v=null}function o(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var f,s,h,g,p,d,m,v,y,M,x,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=i,b.lineStart=u,b.lineEnd=a,y=0,lo.polygonStart()},polygonEnd:function(){lo.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>co?(f=-(h=180),s=-(g=90)):y>ja?g=90:-ja>y&&(s=-90),x[0]=f,x[1]=h}};return function(n){g=h=-(f=s=1/0),M=[],ua.geo.stream(n,b),M.sort(c);for(var t,e=1,r=M.length,i=M[0],u=[i];r>e;++e)t=M[e],l(t[0],i)||l(t[1],i)?(o(i[0],t[1])>o(i[0],i[1])&&(i[1]=t[1]),o(t[0],i[1])>o(i[0],i[1])&&(i[0]=t[0])):u.push(i=t);for(var a,t,p=-1/0,r=u.length-1,e=0,i=u[r];r>=e;i=t,++e)t=u[e],(a=o(i[1],t[0]))>p&&(p=a,f=t[0],h=i[1]);return M=x=null,[[f,s],[h,g]]}}(),ua.geo.centroid=function(n){fo=so=ho=go=po=0,ua.geo.stream(n,mo);var t;return so&&Math.abs(t=Math.sqrt(ho*ho+go*go+po*po))>ja?[Math.atan2(go,ho)*Fa,Math.asin(Math.max(-1,Math.min(1,po/t)))*Fa]:void 0};var fo,so,ho,go,po,mo={sphere:function(){2>fo&&(fo=2,so=ho=go=po=0)},point:Ct,lineStart:Dt,lineEnd:jt,polygonStart:function(){2>fo&&(fo=2,so=ho=go=po=0),mo.lineStart=zt},polygonEnd:function(){mo.lineStart=Dt}},vo=Pt(Lt,It,Xt),yo=1e9;ua.geo.projection=Kt,ua.geo.projectionMutator=Wt,(ua.geo.equirectangular=function(){return Kt(ne)}).raw=ne.invert=ne,ua.geo.rotation=function(n){function t(t){return t=n(t[0]*La,t[1]*La),t[0]*=Fa,t[1]*=Fa,t}return n=te(n[0]%360*La,n[1]*La,n.length>2?n[2]*La:0),t.invert=function(t){return t=n.invert(t[0]*La,t[1]*La),t[0]*=Fa,t[1]*=Fa,t},t},ua.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=te(-n[0]*La,-n[1]*La,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Fa,n[1]*=Fa}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ue((t=+r)*La,i*La),n):t},n.precision=function(r){return arguments.length?(e=ue(t*La,(i=+r)*La),n):i},n.angle(90)},ua.geo.distance=function(n,t){var e,r=(t[0]-n[0])*La,i=n[1]*La,u=t[1]*La,a=Math.sin(r),o=Math.cos(r),c=Math.sin(i),l=Math.cos(i),f=Math.sin(u),s=Math.cos(u);return Math.atan2(Math.sqrt((e=s*a)*e+(e=l*f-c*s*o)*e),c*f+l*s*o)},ua.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ua.range(Math.ceil(u/m)*m,i,m).map(h).concat(ua.range(Math.ceil(l/v)*v,c,v).map(g)).concat(ua.range(Math.ceil(r/p)*p,e,p).filter(function(n){return Math.abs(n%m)>ja}).map(f)).concat(ua.range(Math.ceil(o/d)*d,a,d).filter(function(n){return Math.abs(n%v)>ja}).map(s))}var e,r,i,u,a,o,c,l,f,s,h,g,p=10,d=p,m=90,v=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(c).slice(1),h(i).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],u>i&&(t=u,u=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[u,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),n.precision(y)):[[r,o],[e,a]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(m=+t[0],v=+t[1],n):[m,v]},n.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],n):[p,d]},n.precision=function(t){return arguments.length?(y=+t,f=oe(o,a,90),s=ce(r,e,y),h=oe(l,c,90),g=ce(u,i,y),n):y},n.majorExtent([[-180,-90+ja],[180,90-ja]]).minorExtent([[-180,-80-ja],[180,80+ja]])},ua.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=le,i=fe;return n.distance=function(){return ua.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},ua.geo.interpolate=function(n,t){return se(n[0]*La,n[1]*La,t[0]*La,t[1]*La)},ua.geo.length=function(n){return Mo=0,ua.geo.stream(n,xo),Mo};var Mo,xo={sphere:T,point:T,lineStart:he,lineEnd:T,polygonStart:T,polygonEnd:T};(ua.geo.conicEqualArea=function(){return ge(pe)}).raw=pe,ua.geo.albers=function(){return ua.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ua.geo.albersUsa=function(){function n(n){var u=n[0],a=n[1];return t=null,e(u,a),t||(r(u,a),t)||i(u,a),t}var t,e,r,i,u=ua.geo.albers(),a=ua.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o=ua.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?a:i>=.166&&.234>i&&r>=-.214&&-.115>r?o:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=a.stream(n),r=o.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),a.precision(t),o.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),a.scale(.35*t),o.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var l=u.scale(),f=+t[0],s=+t[1];return e=u.translate(t).clipExtent([[f-.455*l,s-.238*l],[f+.455*l,s+.238*l]]).stream(c).point,r=a.translate([f-.307*l,s+.201*l]).clipExtent([[f-.425*l+ja,s+.12*l+ja],[f-.214*l-ja,s+.234*l-ja]]).stream(c).point,i=o.translate([f-.205*l,s+.212*l]).clipExtent([[f-.214*l+ja,s+.166*l+ja],[f-.115*l-ja,s+.234*l-ja]]).stream(c).point,n},n.scale(1070)};var bo,_o,wo,So,Eo,ko,Ao={point:T,lineStart:T,lineEnd:T,polygonStart:function(){_o=0,Ao.lineStart=de},polygonEnd:function(){Ao.lineStart=Ao.lineEnd=Ao.point=T,bo+=Math.abs(_o/2)}},No={point:me,lineStart:T,lineEnd:T,polygonStart:T,polygonEnd:T},qo={point:Me,lineStart:xe,lineEnd:be,polygonStart:function(){qo.lineStart=_e},polygonEnd:function(){qo.point=Me,qo.lineStart=xe,qo.lineEnd=be}};ua.geo.path=function(){function n(n){return n&&ua.geo.stream(n,r(i.pointRadius("function"==typeof u?+u.apply(this,arguments):u))),i.result()}var t,e,r,i,u=4.5;return n.area=function(n){return bo=0,ua.geo.stream(n,r(Ao)),bo},n.centroid=function(n){return fo=ho=go=po=0,ua.geo.stream(n,r(qo)),po?[ho/po,go/po]:void 0},n.bounds=function(n){return Eo=ko=-(wo=So=1/0),ua.geo.stream(n,r(No)),[[wo,So],[Eo,ko]]},n.projection=function(e){return arguments.length?(r=(t=e)?e.stream||Se(e):st,n):t},n.context=function(t){return arguments.length?(i=null==(e=t)?new ve:new we(t),n):e},n.pointRadius=function(t){return arguments.length?(u="function"==typeof t?t:+t,n):u},n.projection(ua.geo.albersUsa()).context(null)};var To=Ee(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ua.geo.azimuthalEqualArea=function(){return Kt(To)}).raw=To;var Co=Ee(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},st);(ua.geo.azimuthalEquidistant=function(){return Kt(Co)}).raw=Co,(ua.geo.conicConformal=function(){return ge(ke)}).raw=ke,(ua.geo.conicEquidistant=function(){return ge(Ae)}).raw=Ae;var zo=Ee(function(n){return 1/n},Math.atan);(ua.geo.gnomonic=function(){return Kt(zo)}).raw=zo,Ne.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Da/2]},(ua.geo.mercator=function(){return qe(Ne)}).raw=Ne;var Do=Ee(function(){return 1},Math.asin);(ua.geo.orthographic=function(){return Kt(Do)}).raw=Do;var jo=Ee(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ua.geo.stereographic=function(){return Kt(jo)}).raw=jo,Te.invert=function(n,t){return[Math.atan2(I(n),Math.cos(t)),U(Math.sin(t)/V(n))]},(ua.geo.transverseMercator=function(){return qe(Te)}).raw=Te,ua.geom={},ua.svg={},ua.svg.line=function(){return Ce(st)};var Lo=ua.map({linear:je,"linear-closed":Le,"step-before":Fe,"step-after":He,basis:Ie,"basis-open":Ve,"basis-closed":Xe,bundle:Ze,cardinal:Oe,"cardinal-open":Pe,"cardinal-closed":Re,monotone:We});Lo.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Fo=[0,2/3,1/3,0],Ho=[0,1/3,2/3,0],Po=[0,1/6,2/3,1/6];ua.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i,u,a,o,c,l,f,s,h,g,p,d=ft(e),m=ft(r),v=n.length,y=v-1,M=[],x=[],b=0;if(d===ze&&r===De)t=n;else for(u=0,t=[];v>u;++u)t.push([+d.call(this,i=n[u],u),+m.call(this,i,u)]);for(u=1;v>u;++u)(t[u][1]<t[b][1]||t[u][1]==t[b][1]&&t[u][0]<t[b][0])&&(b=u);for(u=0;v>u;++u)u!==b&&(c=t[u][1]-t[b][1],o=t[u][0]-t[b][0],M.push({angle:Math.atan2(c,o),index:u}));for(M.sort(function(n,t){return n.angle-t.angle}),g=M[0].angle,h=M[0].index,s=0,u=1;y>u;++u){if(a=M[u].index,g==M[u].angle){if(o=t[h][0]-t[b][0],c=t[h][1]-t[b][1],l=t[a][0]-t[b][0],f=t[a][1]-t[b][1],o*o+c*c>=l*l+f*f){M[u].index=-1;continue}M[s].index=-1}g=M[u].angle,s=u,h=a}for(x.push(b),u=0,a=0;2>u;++a)M[a].index>-1&&(x.push(M[a].index),u++);for(p=x.length;y>a;++a)if(!(M[a].index<0)){for(;!Qe(x[p-2],x[p-1],M[a].index,t);)--p;x[p++]=M[a].index}var _=[];for(u=p-1;u>=0;--u)_.push(n[x[u]]);return _}var e=ze,r=De;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},ua.geom.polygon=function(n){return n.area=function(){for(var t=0,e=n.length,r=n[e-1][1]*n[0][0]-n[e-1][0]*n[0][1];++t<e;)r+=n[t-1][1]*n[t][0]-n[t-1][0]*n[t][1];return.5*r},n.centroid=function(t){var e,r,i=-1,u=n.length,a=0,o=0,c=n[u-1];for(arguments.length||(t=-1/(6*n.area()));++i<u;)e=c,c=n[i],r=e[0]*c[1]-c[0]*e[1],a+=(e[0]+c[0])*r,o+=(e[1]+c[1])*r;return[a*t,o*t]},n.clip=function(t){for(var e,r,i,u,a,o,c=-1,l=n.length,f=n[l-1];++c<l;){for(e=t.slice(),t.length=0,u=n[c],a=e[(i=e.length)-1],r=-1;++r<i;)o=e[r],nr(o,f,u)?(nr(a,f,u)||t.push(tr(a,o,f,u)),t.push(o)):nr(a,f,u)&&t.push(tr(a,o,f,u)),a=o;f=u}return t},n},ua.geom.delaunay=function(n){var t=n.map(function(){return[]}),e=[];return er(n,function(e){t[e.region.l.index].push(n[e.region.r.index])}),t.forEach(function(t,r){var i=n[r],u=i[0],a=i[1];t.forEach(function(n){n.angle=Math.atan2(n[0]-u,n[1]-a)}),t.sort(function(n,t){return n.angle-t.angle});for(var o=0,c=t.length-1;c>o;o++)e.push([i,t[o],t[o+1]])}),e},ua.geom.voronoi=function(n){function t(n){var t,r,a,o=n.map(function(){return[]}),c=ft(i),l=ft(u),f=n.length,s=1e6;if(c===ze&&l===De)t=n;else for(t=[],a=0;f>a;++a)t.push([+c.call(this,r=n[a],a),+l.call(this,r,a)]);if(er(t,function(n){var t,e,r,i,u,a;1===n.a&&n.b>=0?(t=n.ep.r,e=n.ep.l):(t=n.ep.l,e=n.ep.r),1===n.a?(u=t?t.y:-s,r=n.c-n.b*u,a=e?e.y:s,i=n.c-n.b*a):(r=t?t.x:-s,u=n.c-n.a*r,i=e?e.x:s,a=n.c-n.a*i);var c=[r,u],l=[i,a];o[n.region.l.index].push(c,l),o[n.region.r.index].push(c,l)}),o=o.map(function(n,e){var r=t[e][0],i=t[e][1],u=n.map(function(n){return Math.atan2(n[0]-r,n[1]-i)}),a=ua.range(n.length).sort(function(n,t){return u[n]-u[t]});return a.filter(function(n,t){return!t||u[n]-u[a[t-1]]>ja}).map(function(t){return n[t]})}),o.forEach(function(n,e){var r=n.length;if(!r)return n.push([-s,-s],[-s,s],[s,s],[s,-s]);if(!(r>2)){var i=t[e],u=n[0],a=n[1],o=i[0],c=i[1],l=u[0],f=u[1],h=a[0],g=a[1],p=Math.abs(h-l),d=g-f;if(Math.abs(d)<ja){var m=f>c?-s:s;n.push([-s,m],[s,m])}else if(ja>p){var v=l>o?-s:s;n.push([v,-s],[v,s])}else{var m=(l-o)*(g-f)>(h-l)*(f-c)?s:-s,y=Math.abs(d)-p;Math.abs(y)<ja?n.push([0>d?m:-m,m]):(y>0&&(m*=-1),n.push([-s,m],[s,m]))}}}),e)for(a=0;f>a;++a)e(o[a]);for(a=0;f>a;++a)o[a].point=n[a];return o}var e,r=null,i=ze,u=De;return arguments.length?t(n):(t.x=function(n){return arguments.length?(i=n,t):i},t.y=function(n){return arguments.length?(u=n,t):u},t.size=function(n){return arguments.length?(null==n?e=null:(r=[+n[0],+n[1]],e=ua.geom.polygon([[0,0],[0,r[1]],r,[r[0],0]]).clip),t):r},t.links=function(n){var t,e,r,a=n.map(function(){return[]}),o=[],c=ft(i),l=ft(u),f=n.length;if(c===ze&&l===De)t=n;else for(r=0;f>r;++r)t.push([+c.call(this,e=n[r],r),+l.call(this,e,r)]);return er(t,function(t){var e=t.region.l.index,r=t.region.r.index;a[e][r]||(a[e][r]=a[r][e]=!0,o.push({source:n[e],target:n[r]}))}),o},t.triangles=function(n){if(i===ze&&u===De)return ua.geom.delaunay(n);var t,e,r,a,o,c=ft(i),l=ft(u);for(a=0,t=[],o=n.length;o>a;++a)e=[+c.call(this,r=n[a],a),+l.call(this,r,a)],e.data=r,t.push(e);return ua.geom.delaunay(t).map(function(n){return n.map(function(n){return n.data})})},t)};var Ro={l:"r",r:"l"};ua.geom.quadtree=function(n,t,e,r,i){function u(n){function u(n,t,e,r,i,u,a,o){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,f=n.y;if(null!=c)if(Math.abs(c-e)+Math.abs(f-r)<.01)l(n,t,e,r,i,u,a,o);else{var s=n.point;n.x=n.y=n.point=null,l(n,s,c,f,i,u,a,o),l(n,t,e,r,i,u,a,o)}else n.x=e,n.y=r,n.point=t}else l(n,t,e,r,i,u,a,o)}function l(n,t,e,r,i,a,o,c){var l=.5*(i+o),f=.5*(a+c),s=e>=l,h=r>=f,g=(h<<1)+s;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=ur()),s?i=l:o=l,h?a=f:c=f,u(n,t,e,r,i,a,o,c)}var f,s,h,g,p,d,m,v,y,M=ft(o),x=ft(c);if(null!=t)d=t,m=e,v=r,y=i;else if(v=y=-(d=m=1/0),s=[],h=[],p=n.length,a)for(g=0;p>g;++g)f=n[g],f.x<d&&(d=f.x),f.y<m&&(m=f.y),f.x>v&&(v=f.x),f.y>y&&(y=f.y),s.push(f.x),h.push(f.y);
  4 +else for(g=0;p>g;++g){var b=+M(f=n[g],g),_=+x(f,g);d>b&&(d=b),m>_&&(m=_),b>v&&(v=b),_>y&&(y=_),s.push(b),h.push(_)}var w=v-d,S=y-m;w>S?y=m+w:v=d+S;var E=ur();if(E.add=function(n){u(E,n,+M(n,++g),+x(n,g),d,m,v,y)},E.visit=function(n){ar(n,E,d,m,v,y)},g=-1,null==t){for(;++g<p;)u(E,n[g],s[g],h[g],d,m,v,y);--g}else n.forEach(E.add);return s=h=n=f=null,E}var a,o=ze,c=De;return(a=arguments.length)?(o=rr,c=ir,3===a&&(i=e,r=t,e=t=0),u(n)):(u.x=function(n){return arguments.length?(o=n,u):o},u.y=function(n){return arguments.length?(c=n,u):c},u.size=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=e=0,r=+n[0],i=+n[1]),u):null==t?null:[r,i]},u)},ua.interpolateRgb=or,ua.transform=function(n){var t=aa.createElementNS(ua.ns.prefix.svg,"g");return(ua.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new cr(e?e.matrix:Oo)})(n)},cr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Oo={a:1,b:0,c:0,d:1,e:0,f:0};ua.interpolateNumber=hr,ua.interpolateTransform=gr,ua.interpolateObject=pr,ua.interpolateString=dr;var Yo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;ua.interpolate=mr,ua.interpolators=[function(n,t){var e=typeof t;return("string"===e?Va.has(t)||/^(#|rgb\(|hsl\()/.test(t)?or:dr:t instanceof F?or:"object"===e?Array.isArray(t)?yr:pr:hr)(n,t)}],ua.interpolateArray=yr;var Uo=function(){return st},Io=ua.map({linear:Uo,poly:Er,quad:function(){return _r},cubic:function(){return wr},sin:function(){return kr},exp:function(){return Ar},circle:function(){return Nr},elastic:qr,back:Tr,bounce:function(){return Cr}}),Vo=ua.map({"in":st,out:xr,"in-out":br,"out-in":function(n){return br(xr(n))}});ua.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):"in";return e=Io.get(e)||Uo,r=Vo.get(r)||st,Mr(r(e.apply(null,Array.prototype.slice.call(arguments,1))))},ua.interpolateHcl=zr,ua.interpolateHsl=Dr,ua.interpolateLab=jr,ua.interpolateRound=Lr,ua.layout={},ua.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Pr(n[e]));return t}},ua.layout.chord=function(){function n(){var n,l,s,h,g,p={},d=[],m=ua.range(u),v=[];for(e=[],r=[],n=0,h=-1;++h<u;){for(l=0,g=-1;++g<u;)l+=i[h][g];d.push(l),v.push(ua.range(u)),n+=l}for(a&&m.sort(function(n,t){return a(d[n],d[t])}),o&&v.forEach(function(n,t){n.sort(function(n,e){return o(i[t][n],i[t][e])})}),n=(2*Da-f*u)/n,l=0,h=-1;++h<u;){for(s=l,g=-1;++g<u;){var y=m[h],M=v[y][g],x=i[y][M],b=l,_=l+=x*n;p[y+"-"+M]={index:y,subindex:M,startAngle:b,endAngle:_,value:x}}r[y]={index:y,startAngle:s,endAngle:l,value:(l-s)/n},l+=f}for(h=-1;++h<u;)for(g=h-1;++g<u;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,i,u,a,o,c,l={},f=0;return l.matrix=function(n){return arguments.length?(u=(i=n)&&i.length,e=r=null,l):i},l.padding=function(n){return arguments.length?(f=n,e=r=null,l):f},l.sortGroups=function(n){return arguments.length?(a=n,e=r=null,l):a},l.sortSubgroups=function(n){return arguments.length?(o=n,e=null,l):o},l.sortChords=function(n){return arguments.length?(c=n,e&&t(),l):c},l.chords=function(){return e||n(),e},l.groups=function(){return r||n(),r},l},ua.layout.force=function(){function n(n){return function(t,e,r,i){if(t.point!==n){var u=t.cx-n.x,a=t.cy-n.y,o=1/Math.sqrt(u*u+a*a);if(d>(i-e)*o){var c=t.charge*o*o;return n.px-=u*c,n.py-=a*c,!0}if(t.point&&isFinite(o)){var c=t.pointCharge*o*o;n.px-=u*c,n.py-=a*c}}return!t.charge}}function t(n){n.px=ua.event.x,n.py=ua.event.y,o.resume()}var e,r,i,u,a,o={},c=ua.dispatch("start","tick","end"),l=[1,1],f=.9,s=Xo,h=Zo,g=-30,p=.1,d=.8,m=[],v=[];return o.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,o,s,h,d,y,M,x,b=m.length,_=v.length;for(e=0;_>e;++e)o=v[e],s=o.source,h=o.target,M=h.x-s.x,x=h.y-s.y,(d=M*M+x*x)&&(d=r*u[e]*((d=Math.sqrt(d))-i[e])/d,M*=d,x*=d,h.x-=M*(y=s.weight/(h.weight+s.weight)),h.y-=x*y,s.x+=M*(y=1-y),s.y+=x*y);if((y=r*p)&&(M=l[0]/2,x=l[1]/2,e=-1,y))for(;++e<b;)o=m[e],o.x+=(M-o.x)*y,o.y+=(x-o.y)*y;if(g)for(Xr(t=ua.geom.quadtree(m),r,a),e=-1;++e<b;)(o=m[e]).fixed||t.visit(n(o));for(e=-1;++e<b;)o=m[e],o.fixed?(o.x=o.px,o.y=o.py):(o.x-=(o.px-(o.px=o.x))*f,o.y-=(o.py-(o.py=o.y))*f);c.tick({type:"tick",alpha:r})},o.nodes=function(n){return arguments.length?(m=n,o):m},o.links=function(n){return arguments.length?(v=n,o):v},o.size=function(n){return arguments.length?(l=n,o):l},o.linkDistance=function(n){return arguments.length?(s="function"==typeof n?n:+n,o):s},o.distance=o.linkDistance,o.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,o):h},o.friction=function(n){return arguments.length?(f=+n,o):f},o.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,o):g},o.gravity=function(n){return arguments.length?(p=+n,o):p},o.theta=function(n){return arguments.length?(d=+n,o):d},o.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),ua.timer(o.tick)),o):r},o.start=function(){function n(n,r){for(var i,u=t(e),a=-1,o=u.length;++a<o;)if(!isNaN(i=u[a][n]))return i;return Math.random()*r}function t(){if(!c){for(c=[],r=0;p>r;++r)c[r]=[];for(r=0;d>r;++r){var n=v[r];c[n.source.index].push(n.target),c[n.target.index].push(n.source)}}return c[e]}var e,r,c,f,p=m.length,d=v.length,y=l[0],M=l[1];for(e=0;p>e;++e)(f=m[e]).index=e,f.weight=0;for(e=0;d>e;++e)f=v[e],"number"==typeof f.source&&(f.source=m[f.source]),"number"==typeof f.target&&(f.target=m[f.target]),++f.source.weight,++f.target.weight;for(e=0;p>e;++e)f=m[e],isNaN(f.x)&&(f.x=n("x",y)),isNaN(f.y)&&(f.y=n("y",M)),isNaN(f.px)&&(f.px=f.x),isNaN(f.py)&&(f.py=f.y);if(i=[],"function"==typeof s)for(e=0;d>e;++e)i[e]=+s.call(this,v[e],e);else for(e=0;d>e;++e)i[e]=s;if(u=[],"function"==typeof h)for(e=0;d>e;++e)u[e]=+h.call(this,v[e],e);else for(e=0;d>e;++e)u[e]=h;if(a=[],"function"==typeof g)for(e=0;p>e;++e)a[e]=+g.call(this,m[e],e);else for(e=0;p>e;++e)a[e]=g;return o.resume()},o.resume=function(){return o.alpha(.1)},o.stop=function(){return o.alpha(0)},o.drag=function(){return e||(e=ua.behavior.drag().origin(st).on("dragstart.force",Yr).on("drag.force",t).on("dragend.force",Ur)),arguments.length?(this.on("mouseover.force",Ir).on("mouseout.force",Vr).call(e),void 0):e},ua.rebind(o,c,"on")};var Xo=20,Zo=1;ua.layout.hierarchy=function(){function n(t,a,o){var c=i.call(e,t,a);if(t.depth=a,o.push(t),c&&(l=c.length)){for(var l,f,s=-1,h=t.children=[],g=0,p=a+1;++s<l;)f=n(c[s],p,o),f.parent=t,h.push(f),g+=f.value;r&&h.sort(r),u&&(t.value=g)}else u&&(t.value=+u.call(e,t,a)||0);return t}function t(n,r){var i=n.children,a=0;if(i&&(o=i.length))for(var o,c=-1,l=r+1;++c<o;)a+=t(i[c],l);else u&&(a=+u.call(e,n,r)||0);return u&&(n.value=a),a}function e(t){var e=[];return n(t,0,e),e}var r=Jr,i=Br,u=$r;return e.sort=function(n){return arguments.length?(r=n,e):r},e.children=function(n){return arguments.length?(i=n,e):i},e.value=function(n){return arguments.length?(u=n,e):u},e.revalue=function(n){return t(n,0),n},e},ua.layout.partition=function(){function n(t,e,r,i){var u=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,u&&(a=u.length)){var a,o,c,l=-1;for(r=t.value?r/t.value:0;++l<a;)n(o=u[l],e,c=o.value*r,i),e+=c}}function t(n){var e=n.children,r=0;if(e&&(i=e.length))for(var i,u=-1;++u<i;)r=Math.max(r,t(e[u]));return 1+r}function e(e,u){var a=r.call(this,e,u);return n(a[0],0,i[0],i[1]/t(a[0])),a}var r=ua.layout.hierarchy(),i=[1,1];return e.size=function(n){return arguments.length?(i=n,e):i},Zr(e,r)},ua.layout.pie=function(){function n(u){var a=u.map(function(e,r){return+t.call(n,e,r)}),o=+("function"==typeof r?r.apply(this,arguments):r),c=(("function"==typeof i?i.apply(this,arguments):i)-o)/ua.sum(a),l=ua.range(u.length);null!=e&&l.sort(e===Bo?function(n,t){return a[t]-a[n]}:function(n,t){return e(u[n],u[t])});var f=[];return l.forEach(function(n){var t;f[n]={data:u[n],value:t=a[n],startAngle:o,endAngle:o+=t*c}}),f}var t=Number,e=Bo,r=0,i=2*Da;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(i=t,n):i},n};var Bo={};ua.layout.stack=function(){function n(o,c){var l=o.map(function(e,r){return t.call(n,e,r)}),f=l.map(function(t){return t.map(function(t,e){return[u.call(n,t,e),a.call(n,t,e)]})}),s=e.call(n,f,c);l=ua.permute(l,s),f=ua.permute(f,s);var h,g,p,d=r.call(n,f,c),m=l.length,v=l[0].length;for(g=0;v>g;++g)for(i.call(n,l[0][g],p=d[g],f[0][g][1]),h=1;m>h;++h)i.call(n,l[h][g],p+=f[h-1][g][1],f[h][g][1]);return o}var t=st,e=ni,r=ti,i=Qr,u=Kr,a=Wr;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:$o.get(t)||ni,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:Jo.get(t)||ti,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(a=t,n):a},n.out=function(t){return arguments.length?(i=t,n):i},n};var $o=ua.map({"inside-out":function(n){var t,e,r=n.length,i=n.map(ei),u=n.map(ri),a=ua.range(r).sort(function(n,t){return i[n]-i[t]}),o=0,c=0,l=[],f=[];for(t=0;r>t;++t)e=a[t],c>o?(o+=u[e],l.push(e)):(c+=u[e],f.push(e));return f.reverse().concat(l)},reverse:function(n){return ua.range(n.length).reverse()},"default":ni}),Jo=ua.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,a=[],o=0,c=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>o&&(o=r),a.push(r)}for(e=0;u>e;++e)c[e]=(o-a[e])/2;return c},wiggle:function(n){var t,e,r,i,u,a,o,c,l,f=n.length,s=n[0],h=s.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,i=0;f>t;++t)i+=n[t][e][1];for(t=0,u=0,o=s[e][0]-s[e-1][0];f>t;++t){for(r=0,a=(n[t][e][1]-n[t][e-1][1])/(2*o);t>r;++r)a+=(n[r][e][1]-n[r][e-1][1])/o;u+=a*n[t][e][1]}g[e]=c-=i?u/i*o:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,i=n.length,u=n[0].length,a=1/i,o=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=a}for(e=0;u>e;++e)o[e]=0;return o},zero:ti});ua.layout.histogram=function(){function n(n,u){for(var a,o,c=[],l=n.map(e,this),f=r.call(this,l,u),s=i.call(this,f,l,u),u=-1,h=l.length,g=s.length-1,p=t?1:1/h;++u<g;)a=c[u]=[],a.dx=s[u+1]-(a.x=s[u]),a.y=0;if(g>0)for(u=-1;++u<h;)o=l[u],o>=f[0]&&o<=f[1]&&(a=c[ua.bisect(s,o,1,g)-1],a.y+=p,a.push(n[u]));return c}var t=!0,e=Number,r=oi,i=ui;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=ft(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return ai(n,t)}:ft(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ua.layout.tree=function(){function n(n,i){function u(n,t){var r=n.children,i=n._tree;if(r&&(a=r.length)){for(var a,c,l,f=r[0],s=f,h=-1;++h<a;)l=r[h],u(l,c),s=o(l,c,s),c=l;mi(n);var g=.5*(f._tree.prelim+l._tree.prelim);t?(i.prelim=t._tree.prelim+e(n,t),i.mod=i.prelim-g):i.prelim=g}else t&&(i.prelim=t._tree.prelim+e(n,t))}function a(n,t){n.x=n._tree.prelim+t;var e=n.children;if(e&&(r=e.length)){var r,i=-1;for(t+=n._tree.mod;++i<r;)a(e[i],t)}}function o(n,t,r){if(t){for(var i,u=n,a=n,o=t,c=n.parent.children[0],l=u._tree.mod,f=a._tree.mod,s=o._tree.mod,h=c._tree.mod;o=fi(o),u=li(u),o&&u;)c=li(c),a=fi(a),a._tree.ancestor=n,i=o._tree.prelim+s-u._tree.prelim-l+e(o,u),i>0&&(vi(yi(o,n,r),n,i),l+=i,f+=i),s+=o._tree.mod,l+=u._tree.mod,h+=c._tree.mod,f+=a._tree.mod;o&&!fi(a)&&(a._tree.thread=o,a._tree.mod+=s-f),u&&!li(c)&&(c._tree.thread=u,c._tree.mod+=l-h,r=n)}return r}var c=t.call(this,n,i),l=c[0];di(l,function(n,t){n._tree={ancestor:n,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),u(l),a(l,-l._tree.prelim);var f=si(l,gi),s=si(l,hi),h=si(l,pi),g=f.x-e(f,s)/2,p=s.x+e(s,f)/2,d=h.depth||1;return di(l,function(n){n.x=(n.x-g)/(p-g)*r[0],n.y=n.depth/d*r[1],delete n._tree}),c}var t=ua.layout.hierarchy().sort(null).value(null),e=ci,r=[1,1];return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(r=t,n):r},Zr(n,t)},ua.layout.pack=function(){function n(n,i){var u=t.call(this,n,i),a=u[0];a.x=0,a.y=0,di(a,function(n){n.r=Math.sqrt(n.value)}),di(a,wi);var o=r[0],c=r[1],l=Math.max(2*a.r/o,2*a.r/c);if(e>0){var f=e*l/2;di(a,function(n){n.r+=f}),di(a,wi),di(a,function(n){n.r-=f}),l=Math.max(2*a.r/o,2*a.r/c)}return ki(a,o/2,c/2,1/l),u}var t=ua.layout.hierarchy().sort(Mi),e=0,r=[1,1];return n.size=function(t){return arguments.length?(r=t,n):r},n.padding=function(t){return arguments.length?(e=+t,n):e},Zr(n,t)},ua.layout.cluster=function(){function n(n,i){var u,a=t.call(this,n,i),o=a[0],c=0;di(o,function(n){var t=n.children;t&&t.length?(n.x=qi(t),n.y=Ni(t)):(n.x=u?c+=e(n,u):0,n.y=0,u=n)});var l=Ti(o),f=Ci(o),s=l.x-e(l,f)/2,h=f.x+e(f,l)/2;return di(o,function(n){n.x=(n.x-s)/(h-s)*r[0],n.y=(1-(o.y?n.y/o.y:1))*r[1]}),a}var t=ua.layout.hierarchy().sort(null).value(null),e=ci,r=[1,1];return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(r=t,n):r},Zr(n,t)},ua.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;++i<u;)r=(e=n[i]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var a,o,c,l=s(e),f=[],h=u.slice(),p=1/0,d="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),f.area=0;(c=h.length)>0;)f.push(a=h[c-1]),f.area+=a.area,"squarify"!==g||(o=r(f,d))<=p?(h.pop(),p=o):(f.area-=f.pop().area,i(f,d,l,!1),d=Math.min(l.dx,l.dy),f.length=f.area=0,p=1/0);f.length&&(i(f,d,l,!0),f.length=f.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,a=s(t),o=r.slice(),c=[];for(n(o,a.dx*a.dy/t.value),c.area=0;u=o.pop();)c.push(u),c.area+=u.area,null!=u.z&&(i(c,u.z?a.dx:a.dy,a,!o.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,a=-1,o=n.length;++a<o;)(e=n[a].area)&&(u>e&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*p/r,r/(t*u*p)):1/0}function i(n,t,e,r){var i,u=-1,a=n.length,o=e.x,l=e.y,f=t?c(n.area/t):0;if(t==e.dx){for((r||f>e.dy)&&(f=e.dy);++u<a;)i=n[u],i.x=o,i.y=l,i.dy=f,o+=i.dx=Math.min(e.x+e.dx-o,f?c(i.area/f):0);i.z=!0,i.dx+=e.x+e.dx-o,e.y+=f,e.dy-=f}else{for((r||f>e.dx)&&(f=e.dx);++u<a;)i=n[u],i.x=o,i.y=l,i.dx=f,l+=i.dy=Math.min(e.y+e.dy-l,f?c(i.area/f):0);i.z=!1,i.dy+=e.y+e.dy-l,e.x+=f,e.dx-=f}}function u(r){var i=a||o(r),u=i[0];return u.x=0,u.y=0,u.dx=l[0],u.dy=l[1],a&&o.revalue(u),n([u],u.dx*u.dy/u.value),(a?e:t)(u),h&&(a=i),i}var a,o=ua.layout.hierarchy(),c=Math.round,l=[1,1],f=null,s=zi,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return u.size=function(n){return arguments.length?(l=n,u):l},u.padding=function(n){function t(t){var e=n.call(u,t,t.depth);return null==e?zi(t):Di(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Di(t,n)}if(!arguments.length)return f;var r;return s=null==(f=n)?zi:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,u},u.round=function(n){return arguments.length?(c=n?Math.round:Number,u):c!=Number},u.sticky=function(n){return arguments.length?(h=n,a=null,u):h},u.ratio=function(n){return arguments.length?(p=n,u):p},u.mode=function(n){return arguments.length?(g=n+"",u):g},Zr(u,o)},ua.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=ua.random.normal.apply(ua,arguments);return function(){return Math.exp(n())}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t/n}}},ua.scale={},ua.scale.linear=function(){return Ri([0,1],[0,1],mr,!1)},ua.scale.log=function(){return Xi(ua.scale.linear().domain([0,Math.LN10]),10,Zi,Bi,[1,10])};var Go=ua.format(".0e");ua.scale.pow=function(){return Gi(ua.scale.linear(),1,[0,1])},ua.scale.sqrt=function(){return ua.scale.pow().exponent(.5)},ua.scale.ordinal=function(){return Wi([],{t:"range",a:[[]]})},ua.scale.category10=function(){return ua.scale.ordinal().range(Ko)},ua.scale.category20=function(){return ua.scale.ordinal().range(Wo)},ua.scale.category20b=function(){return ua.scale.ordinal().range(Qo)},ua.scale.category20c=function(){return ua.scale.ordinal().range(nc)};var Ko=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Wo=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],Qo=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],nc=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];ua.scale.quantile=function(){return Qi([],[])},ua.scale.quantize=function(){return nu(0,1,[0,1])},ua.scale.threshold=function(){return tu([.5],[0,1])},ua.scale.identity=function(){return eu([0,1])},ua.svg.arc=function(){function n(){var n=t.apply(this,arguments),u=e.apply(this,arguments),a=r.apply(this,arguments)+tc,o=i.apply(this,arguments)+tc,c=(a>o&&(c=a,a=o,o=c),o-a),l=Da>c?"0":"1",f=Math.cos(a),s=Math.sin(a),h=Math.cos(o),g=Math.sin(o);return c>=ec?n?"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"Z":n?"M"+u*f+","+u*s+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+l+",0 "+n*f+","+n*s+"Z":"M"+u*f+","+u*s+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L0,0"+"Z"}var t=ru,e=iu,r=uu,i=au;return n.innerRadius=function(e){return arguments.length?(t=ft(e),n):t},n.outerRadius=function(t){return arguments.length?(e=ft(t),n):e},n.startAngle=function(t){return arguments.length?(r=ft(t),n):r},n.endAngle=function(t){return arguments.length?(i=ft(t),n):i},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,u=(r.apply(this,arguments)+i.apply(this,arguments))/2+tc;return[Math.cos(u)*n,Math.sin(u)*n]},n};var tc=-Da/2,ec=2*Da-1e-6;ua.svg.line.radial=function(){var n=Ce(ou);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},Fe.reverse=He,He.reverse=Fe,ua.svg.area=function(){return cu(st)},ua.svg.area.radial=function(){var n=cu(ou);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ua.svg.chord=function(){function n(n,o){var c=t(this,u,n,o),l=t(this,a,n,o);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?i(c.r,c.p1,c.r,c.p0):i(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+i(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var i=t.call(n,e,r),u=o.call(n,i,r),a=c.call(n,i,r)+tc,f=l.call(n,i,r)+tc;return{r:u,a0:a,a1:f,p0:[u*Math.cos(a),u*Math.sin(a)],p1:[u*Math.cos(f),u*Math.sin(f)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Da)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var u=le,a=fe,o=lu,c=uu,l=au;return n.radius=function(t){return arguments.length?(o=ft(t),n):o},n.source=function(t){return arguments.length?(u=ft(t),n):u},n.target=function(t){return arguments.length?(a=ft(t),n):a},n.startAngle=function(t){return arguments.length?(c=ft(t),n):c},n.endAngle=function(t){return arguments.length?(l=ft(t),n):l},n},ua.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),a=e.call(this,n,i),o=(u.y+a.y)/2,c=[u,{x:u.x,y:o},{x:a.x,y:o},a];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=le,e=fe,r=fu;return n.source=function(e){return arguments.length?(t=ft(e),n):t},n.target=function(t){return arguments.length?(e=ft(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ua.svg.diagonal.radial=function(){var n=ua.svg.diagonal(),t=fu,e=n.projection;return n.projection=function(n){return arguments.length?e(su(t=n)):t},n},ua.svg.symbol=function(){function n(n,r){return(rc.get(t.call(this,n,r))||pu)(e.call(this,n,r))}var t=gu,e=hu;return n.type=function(e){return arguments.length?(t=ft(e),n):t},n.size=function(t){return arguments.length?(e=ft(t),n):e},n};var rc=ua.map({circle:pu,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*ac)),e=t*ac;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/uc),e=t*uc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/uc),e=t*uc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ua.svg.symbolTypes=rc.keys();var ic,uc=Math.sqrt(3),ac=Math.tan(30*La),oc=[],cc=0,lc={ease:Sr,delay:0,duration:250};oc.call=wa.call,oc.empty=wa.empty,oc.node=wa.node,ua.transition=function(n){return arguments.length?ic?n.transition():n:Na.transition()},ua.transition.prototype=oc,oc.select=function(n){var t,e,r,i=this.id,u=[];"function"!=typeof n&&(n=v(n));for(var a=-1,o=this.length;++a<o;){u.push(t=[]);for(var c=this[a],l=-1,f=c.length;++l<f;)(r=c[l])&&(e=n.call(r,r.__data__,l))?("__data__"in r&&(e.__data__=r.__data__),yu(e,l,i,r.__transition__[i]),t.push(e)):t.push(null)}return du(u,i)},oc.selectAll=function(n){var t,e,r,i,u,a=this.id,o=[];"function"!=typeof n&&(n=y(n));for(var c=-1,l=this.length;++c<l;)for(var f=this[c],s=-1,h=f.length;++s<h;)if(r=f[s]){u=r.__transition__[a],e=n.call(r,r.__data__,s),o.push(t=[]);for(var g=-1,p=e.length;++g<p;)yu(i=e[g],g,a,u),t.push(i)}return du(o,a)},oc.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=N(n));for(var u=0,a=this.length;a>u;u++){i.push(t=[]);for(var e=this[u],o=0,c=e.length;c>o;o++)(r=e[o])&&n.call(r,r.__data__,o)&&t.push(r)}return du(i,this.id,this.time).ease(this.ease())},oc.tween=function(n,t){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(n):j(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},oc.attr=function(n,t){function e(){this.removeAttribute(o)}function r(){this.removeAttributeNS(o.space,o.local)}function i(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(o);return e!==n&&(t=a(e,n),function(n){this.setAttribute(o,t(n))})})}function u(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(o.space,o.local);return e!==n&&(t=a(e,n),function(n){this.setAttributeNS(o.space,o.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var a=vr(n),o=ua.ns.qualify(n);return mu(this,"attr."+n,t,o.local?u:i)},oc.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=ua.ns.qualify(n);return this.tween("attr."+n,i.local?r:e)},oc.style=function(n,t,e){function r(){this.style.removeProperty(n)}function i(t){return null==t?r:(t+="",function(){var r,i=oa.getComputedStyle(this,null).getPropertyValue(n);return i!==t&&(r=a(i,t),function(t){this.style.setProperty(n,r(t),e)})})}var u=arguments.length;if(3>u){if("string"!=typeof n){2>u&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}var a=vr(n);return mu(this,"style."+n,t,i)},oc.styleTween=function(n,t,e){function r(r,i){var u=t.call(this,r,i,oa.getComputedStyle(this,null).getPropertyValue(n));return u&&function(t){this.style.setProperty(n,u(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},oc.text=function(n){return mu(this,"text",n,vu)},oc.remove=function(){return this.each("end.transition",function(){var n;!this.__transition__&&(n=this.parentNode)&&n.removeChild(this)})},oc.ease=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:("function"!=typeof n&&(n=ua.ease.apply(ua,arguments)),j(this,function(e){e.__transition__[t].ease=n}))},oc.delay=function(n){var t=this.id;return j(this,"function"==typeof n?function(e,r,i){e.__transition__[t].delay=0|n.call(e,e.__data__,r,i)}:(n|=0,function(e){e.__transition__[t].delay=n}))},oc.duration=function(n){var t=this.id;return j(this,"function"==typeof n?function(e,r,i){e.__transition__[t].duration=Math.max(1,0|n.call(e,e.__data__,r,i))}:(n=Math.max(1,0|n),function(e){e.__transition__[t].duration=n}))},oc.each=function(n,t){var e=this.id;if(arguments.length<2){var r=lc,i=ic;ic=e,j(this,function(t,r,i){lc=t.__transition__[e],n.call(t,t.__data__,r,i)}),lc=r,ic=i}else j(this,function(r){r.__transition__[e].event.on(n,t)});return this},oc.transition=function(){for(var n,t,e,r,i=this.id,u=++cc,a=[],o=0,c=this.length;c>o;o++){a.push(n=[]);for(var t=this[o],l=0,f=t.length;f>l;l++)(e=t[l])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,yu(e,l,u,r)),n.push(e)}return du(a,u)},ua.svg.axis=function(){function n(n){n.each(function(){var n,s=ua.select(this),h=null==l?e.ticks?e.ticks.apply(e,c):e.domain():l,g=null==t?e.tickFormat?e.tickFormat.apply(e,c):String:t,p=bu(e,h,f),d=s.selectAll(".tick.minor").data(p,String),m=d.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),v=ua.transition(d.exit()).style("opacity",1e-6).remove(),y=ua.transition(d).style("opacity",1),M=s.selectAll(".tick.major").data(h,String),x=M.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),b=ua.transition(M.exit()).style("opacity",1e-6).remove(),_=ua.transition(M).style("opacity",1),w=Li(e),S=s.selectAll(".domain").data([0]),E=(S.enter().append("path").attr("class","domain"),ua.transition(S)),k=e.copy(),A=this.__chart__||k;this.__chart__=k,x.append("line"),x.append("text");var N=x.select("line"),q=_.select("line"),T=M.select("text").text(g),C=x.select("text"),z=_.select("text");switch(r){case"bottom":n=Mu,m.attr("y2",u),y.attr("x2",0).attr("y2",u),N.attr("y2",i),C.attr("y",Math.max(i,0)+o),q.attr("x2",0).attr("y2",i),z.attr("x",0).attr("y",Math.max(i,0)+o),T.attr("dy",".71em").style("text-anchor","middle"),E.attr("d","M"+w[0]+","+a+"V0H"+w[1]+"V"+a);break;case"top":n=Mu,m.attr("y2",-u),y.attr("x2",0).attr("y2",-u),N.attr("y2",-i),C.attr("y",-(Math.max(i,0)+o)),q.attr("x2",0).attr("y2",-i),z.attr("x",0).attr("y",-(Math.max(i,0)+o)),T.attr("dy","0em").style("text-anchor","middle"),E.attr("d","M"+w[0]+","+-a+"V0H"+w[1]+"V"+-a);break;case"left":n=xu,m.attr("x2",-u),y.attr("x2",-u).attr("y2",0),N.attr("x2",-i),C.attr("x",-(Math.max(i,0)+o)),q.attr("x2",-i).attr("y2",0),z.attr("x",-(Math.max(i,0)+o)).attr("y",0),T.attr("dy",".32em").style("text-anchor","end"),E.attr("d","M"+-a+","+w[0]+"H0V"+w[1]+"H"+-a);break;case"right":n=xu,m.attr("x2",u),y.attr("x2",u).attr("y2",0),N.attr("x2",i),C.attr("x",Math.max(i,0)+o),q.attr("x2",i).attr("y2",0),z.attr("x",Math.max(i,0)+o).attr("y",0),T.attr("dy",".32em").style("text-anchor","start"),E.attr("d","M"+a+","+w[0]+"H0V"+w[1]+"H"+a)}if(e.ticks)x.call(n,A),_.call(n,k),b.call(n,k),m.call(n,A),y.call(n,k),v.call(n,k);else{var D=k.rangeBand()/2,j=function(n){return k(n)+D};x.call(n,j),_.call(n,j)}})}var t,e=ua.scale.linear(),r=fc,i=6,u=6,a=6,o=3,c=[10],l=null,f=0;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in sc?t+"":fc,n):r},n.ticks=function(){return arguments.length?(c=arguments,n):c},n.tickValues=function(t){return arguments.length?(l=t,n):l},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t,e){if(!arguments.length)return i;var r=arguments.length-1;return i=+t,u=r>1?+e:i,a=r>0?+arguments[r]:i,n},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(t){return arguments.length?(f=+t,n):f},n};var fc="bottom",sc={top:1,right:1,bottom:1,left:1};ua.svg.brush=function(){function n(u){u.each(function(){var u,a=ua.select(this),l=a.selectAll(".background").data([0]),s=a.selectAll(".extent").data([0]),h=a.selectAll(".resize").data(f,String);a.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),l.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),s.enter().append("rect").attr("class","extent").style("cursor","move"),h.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return hc[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),h.style("display",n.empty()?"none":null),h.exit().remove(),o&&(u=Li(o),l.attr("x",u[0]).attr("width",u[1]-u[0]),e(a)),c&&(u=Li(c),l.attr("y",u[0]).attr("height",u[1]-u[0]),r(a)),t(a)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)][0]+","+s[+/^s/.test(n)][1]+")"})}function e(n){n.select(".extent").attr("x",s[0][0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1][0]-s[0][0])}function r(n){n.select(".extent").attr("y",s[0][1]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1][1]-s[0][1])}function i(){function i(){var n=ua.event.changedTouches;return n?ua.touches(y,n)[0]:ua.mouse(y)}function f(){32==ua.event.keyCode&&(E||(m=null,k[0]-=s[1][0],k[1]-=s[1][1],E=2),l())}function h(){32==ua.event.keyCode&&2==E&&(k[0]+=s[1][0],k[1]+=s[1][1],E=0,l())}function g(){var n=i(),u=!1;v&&(n[0]+=v[0],n[1]+=v[1]),E||(ua.event.altKey?(m||(m=[(s[0][0]+s[1][0])/2,(s[0][1]+s[1][1])/2]),k[0]=s[+(n[0]<m[0])][0],k[1]=s[+(n[1]<m[1])][1]):m=null),w&&p(n,o,0)&&(e(b),u=!0),S&&p(n,c,1)&&(r(b),u=!0),u&&(t(b),x({type:"brush",mode:E?"move":"resize"}))}function p(n,t,e){var r,i,a=Li(t),o=a[0],c=a[1],l=k[e],f=s[1][e]-s[0][e];return E&&(o-=l,c-=f+l),r=Math.max(o,Math.min(c,n[e])),E?i=(r+=l)+f:(m&&(l=Math.max(o,Math.min(c,2*m[e]-r))),r>l?(i=r,r=l):i=l),s[0][e]!==r||s[1][e]!==i?(u=null,s[0][e]=r,s[1][e]=i,!0):void 0}function d(){g(),b.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ua.select("body").style("cursor",null),A.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),x({type:"brushend"}),l()}var m,v,y=this,M=ua.select(ua.event.target),x=a.of(y,arguments),b=ua.select(y),_=M.datum(),w=!/^(n|s)$/.test(_)&&o,S=!/^(e|w)$/.test(_)&&c,E=M.classed("extent"),k=i(),A=ua.select(oa).on("mousemove.brush",g).on("mouseup.brush",d).on("touchmove.brush",g).on("touchend.brush",d).on("keydown.brush",f).on("keyup.brush",h);if(E)k[0]=s[0][0]-k[0],k[1]=s[0][1]-k[1];else if(_){var N=+/w$/.test(_),q=+/^n/.test(_);v=[s[1-N][0]-k[0],s[1-q][1]-k[1]],k[0]=s[N][0],k[1]=s[q][1]}else ua.event.altKey&&(m=k.slice());b.style("pointer-events","none").selectAll(".resize").style("display",null),ua.select("body").style("cursor",M.style("cursor")),x({type:"brushstart"}),g(),l()}var u,a=h(n,"brushstart","brush","brushend"),o=null,c=null,f=gc[0],s=[[0,0],[0,0]];return n.x=function(t){return arguments.length?(o=t,f=gc[!o<<1|!c],n):o},n.y=function(t){return arguments.length?(c=t,f=gc[!o<<1|!c],n):c},n.extent=function(t){var e,r,i,a,l;return arguments.length?(u=[[0,0],[0,0]],o&&(e=t[0],r=t[1],c&&(e=e[0],r=r[0]),u[0][0]=e,u[1][0]=r,o.invert&&(e=o(e),r=o(r)),e>r&&(l=e,e=r,r=l),s[0][0]=0|e,s[1][0]=0|r),c&&(i=t[0],a=t[1],o&&(i=i[1],a=a[1]),u[0][1]=i,u[1][1]=a,c.invert&&(i=c(i),a=c(a)),i>a&&(l=i,i=a,a=l),s[0][1]=0|i,s[1][1]=0|a),n):(t=u||s,o&&(e=t[0][0],r=t[1][0],u||(e=s[0][0],r=s[1][0],o.invert&&(e=o.invert(e),r=o.invert(r)),e>r&&(l=e,e=r,r=l))),c&&(i=t[0][1],a=t[1][1],u||(i=s[0][1],a=s[1][1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(l=i,i=a,a=l))),o&&c?[[e,i],[r,a]]:o?[e,r]:c&&[i,a])},n.clear=function(){return u=null,s[0][0]=s[0][1]=s[1][0]=s[1][1]=0,n},n.empty=function(){return o&&s[0][0]===s[1][0]||c&&s[0][1]===s[1][1]},ua.rebind(n,a,"on")};var hc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},gc=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];ua.time={};var pc=Date,dc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
  5 + _u.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){mc.setUTCDate.apply(this._,arguments)},setDay:function(){mc.setUTCDay.apply(this._,arguments)},setFullYear:function(){mc.setUTCFullYear.apply(this._,arguments)},setHours:function(){mc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){mc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){mc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){mc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){mc.setUTCSeconds.apply(this._,arguments)},setTime:function(){mc.setTime.apply(this._,arguments)}};var mc=Date.prototype,vc="%a %b %e %X %Y",yc="%m/%d/%Y",Mc="%H:%M:%S",xc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],bc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_c=["January","February","March","April","May","June","July","August","September","October","November","December"],wc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];ua.time.year=wu(function(n){return n=ua.time.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ua.time.years=ua.time.year.range,ua.time.years.utc=ua.time.year.utc.range,ua.time.day=wu(function(n){var t=new pc(1970,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ua.time.days=ua.time.day.range,ua.time.days.utc=ua.time.day.utc.range,ua.time.dayOfYear=function(n){var t=ua.time.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},dc.forEach(function(n,t){n=n.toLowerCase(),t=7-t;var e=ua.time[n]=wu(function(n){return(n=ua.time.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ua.time.year(n).getDay();return Math.floor((ua.time.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ua.time[n+"s"]=e.range,ua.time[n+"s"].utc=e.utc.range,ua.time[n+"OfYear"]=function(n){var e=ua.time.year(n).getDay();return Math.floor((ua.time.dayOfYear(n)+(e+t)%7)/7)}}),ua.time.week=ua.time.sunday,ua.time.weeks=ua.time.sunday.range,ua.time.weeks.utc=ua.time.sunday.utc.range,ua.time.weekOfYear=ua.time.sundayOfYear,ua.time.format=function(n){function t(t){for(var r,i,u,a=[],o=-1,c=0;++o<e;)37===n.charCodeAt(o)&&(a.push(n.substring(c,o)),null!=(i=Tc[r=n.charAt(++o)])&&(r=n.charAt(++o)),(u=Cc[r])&&(r=u(t,null==i?"e"===r?" ":"0":i)),a.push(r),c=o+1);return a.push(n.substring(c,o)),a.join("")}var e=n.length;return t.parse=function(t){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=Eu(e,n,t,0);if(r!=t.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var i=new pc;return i.setFullYear(e.y,e.m,e.d),i.setHours(e.H,e.M,e.S,e.L),i},t.toString=function(){return n},t};var Sc=ku(xc),Ec=ku(bc),kc=ku(_c),Ac=Au(_c),Nc=ku(wc),qc=Au(wc),Tc={"-":"",_:" ",0:"0"},Cc={a:function(n){return bc[n.getDay()]},A:function(n){return xc[n.getDay()]},b:function(n){return wc[n.getMonth()]},B:function(n){return _c[n.getMonth()]},c:ua.time.format(vc),d:function(n,t){return Nu(n.getDate(),t,2)},e:function(n,t){return Nu(n.getDate(),t,2)},H:function(n,t){return Nu(n.getHours(),t,2)},I:function(n,t){return Nu(n.getHours()%12||12,t,2)},j:function(n,t){return Nu(1+ua.time.dayOfYear(n),t,3)},L:function(n,t){return Nu(n.getMilliseconds(),t,3)},m:function(n,t){return Nu(n.getMonth()+1,t,2)},M:function(n,t){return Nu(n.getMinutes(),t,2)},p:function(n){return n.getHours()>=12?"PM":"AM"},S:function(n,t){return Nu(n.getSeconds(),t,2)},U:function(n,t){return Nu(ua.time.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Nu(ua.time.mondayOfYear(n),t,2)},x:ua.time.format(yc),X:ua.time.format(Mc),y:function(n,t){return Nu(n.getFullYear()%100,t,2)},Y:function(n,t){return Nu(n.getFullYear()%1e4,t,4)},Z:Zu,"%":function(){return"%"}},zc={a:qu,A:Tu,b:Cu,B:zu,c:Du,d:Ou,e:Ou,H:Yu,I:Yu,L:Vu,m:Ru,M:Uu,p:Xu,S:Iu,x:ju,X:Lu,y:Hu,Y:Fu},Dc=/^\s*\d+/,jc=ua.map({am:0,pm:1});ua.time.format.utc=function(n){function t(n){try{pc=_u;var t=new pc;return t._=n,e(t)}finally{pc=Date}}var e=ua.time.format(n);return t.parse=function(n){try{pc=_u;var t=e.parse(n);return t&&t._}finally{pc=Date}},t.toString=e.toString,t};var Lc=ua.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");ua.time.format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Bu:Lc,Bu.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Bu.toString=Lc.toString,ua.time.second=wu(function(n){return new pc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ua.time.seconds=ua.time.second.range,ua.time.seconds.utc=ua.time.second.utc.range,ua.time.minute=wu(function(n){return new pc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ua.time.minutes=ua.time.minute.range,ua.time.minutes.utc=ua.time.minute.utc.range,ua.time.hour=wu(function(n){var t=n.getTimezoneOffset()/60;return new pc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ua.time.hours=ua.time.hour.range,ua.time.hours.utc=ua.time.hour.utc.range,ua.time.month=wu(function(n){return n=ua.time.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ua.time.months=ua.time.month.range,ua.time.months.utc=ua.time.month.utc.range;var Fc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Hc=[[ua.time.second,1],[ua.time.second,5],[ua.time.second,15],[ua.time.second,30],[ua.time.minute,1],[ua.time.minute,5],[ua.time.minute,15],[ua.time.minute,30],[ua.time.hour,1],[ua.time.hour,3],[ua.time.hour,6],[ua.time.hour,12],[ua.time.day,1],[ua.time.day,2],[ua.time.week,1],[ua.time.month,1],[ua.time.month,3],[ua.time.year,1]],Pc=[[ua.time.format("%Y"),Lt],[ua.time.format("%B"),function(n){return n.getMonth()}],[ua.time.format("%b %d"),function(n){return 1!=n.getDate()}],[ua.time.format("%a %d"),function(n){return n.getDay()&&1!=n.getDate()}],[ua.time.format("%I %p"),function(n){return n.getHours()}],[ua.time.format("%I:%M"),function(n){return n.getMinutes()}],[ua.time.format(":%S"),function(n){return n.getSeconds()}],[ua.time.format(".%L"),function(n){return n.getMilliseconds()}]],Rc=ua.scale.linear(),Oc=Gu(Pc);Hc.year=function(n,t){return Rc.domain(n.map(Wu)).ticks(t).map(Ku)},ua.time.scale=function(){return $u(ua.scale.linear(),Hc,Oc)};var Yc=Hc.map(function(n){return[n[0].utc,n[1]]}),Uc=[[ua.time.format.utc("%Y"),Lt],[ua.time.format.utc("%B"),function(n){return n.getUTCMonth()}],[ua.time.format.utc("%b %d"),function(n){return 1!=n.getUTCDate()}],[ua.time.format.utc("%a %d"),function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],[ua.time.format.utc("%I %p"),function(n){return n.getUTCHours()}],[ua.time.format.utc("%I:%M"),function(n){return n.getUTCMinutes()}],[ua.time.format.utc(":%S"),function(n){return n.getUTCSeconds()}],[ua.time.format.utc(".%L"),function(n){return n.getUTCMilliseconds()}]],Ic=Gu(Uc);return Yc.year=function(n,t){return Rc.domain(n.map(na)).ticks(t).map(Qu)},ua.time.scale.utc=function(){return $u(ua.scale.linear(),Yc,Ic)},ua.text=function(){return ua.xhr.apply(ua,arguments).response(ta)},ua.json=function(n,t){return ua.xhr(n,"application/json",t).response(ea)},ua.html=function(n,t){return ua.xhr(n,"text/html",t).response(ra)},ua.xml=function(){return ua.xhr.apply(ua,arguments).response(ia)},ua}();
... ...