Blame view

datalets/graph-datalet/graph-with-clustering-extend-datalet.html 23.4 KB
cc7592d4   Luigi Serra   graphs update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  <!--

  @license

      The MIT License (MIT)

  

      Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy

  

      Permission is hereby granted, free of charge, to any person obtaining a copy

      of this software and associated documentation files (the "Software"), to deal

      in the Software without restriction, including without limitation the rights

      to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

      copies of the Software, and to permit persons to whom the Software is

      furnished to do so, subject to the following conditions:

  

      The above copyright notice and this permission notice shall be included in

      all copies or substantial portions of the Software.

  

      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

      THE SOFTWARE.

  -->

  

  <!--

  * Developed by :

  * ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu

  *

  -->

  

  <link rel="import" href="../base-datalet/base-datalet.html">

  <link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">

  <link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">

  <link rel="import" href="../../bower_components/paper-fab/paper-fab.html">

  

  <!--

  `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.

  

  Example:

  

      <preview-datalet data-url="http://spod.routetopa.eu"

      </preview-datalet>

  

  

  @element preview-datalet

  @status beta

  @homepage

  @group datalets

  -->

  

0e9a5727   Luigi Serra   graph updatesù
52
  <dom-module id="graph-with-clustering-extend-datalet">

cc7592d4   Luigi Serra   graphs update
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
      <template>

  

          <link rel="stylesheet" href="static/css/graphStyle.css">

  

          <style is="custom-style">

  

              #dialog{

                  position: absolute;

                  padding: 20px;

                  top: 20px;

                  right:5%;

              }

  

              #close{

                  position: absolute;

                  top: -20px;

                  right: 3px;

                  --iron-icon-height: 20px;

                  --iron-icon-width: 20px;

                  width: 24px;

                  height: 24px;

                  --paper-fab-background:#9e9e9e;

                  z-index: 1001;

              }

  

          </style>

  

          <div style="align-content: center;overflow: visible" id="graph_content">

              <svg id="sbiricuda"></svg>

          </div>

  

          <paper-dialog id="dialog">

              <paper-fab id="close" mini icon="close" on-click="_onCloseClick"></paper-fab>

              <h2 id="dialog_title"></h2>

              <paper-dialog-scrollable id="dialog_content">cos</paper-dialog-scrollable>

          </paper-dialog>

  

      </template>

  

      <script src="static/js/d3.v3.js"></script>

  

      <script>

          _this  = null;

  

          Polymer({

0e9a5727   Luigi Serra   graph updatesù
98
              is : 'graph-with-clustering-extend-datalet',

cc7592d4   Luigi Serra   graphs update
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  

              properties: {

                  /**

                   * It's the url for the preview

                   *

                   * @attribute url

                   * @type Strig

                   * @default ''

                   */

                  graph : {

                      type : Object,

                      value : undefined

                  },

  

                  svgNodes : {

0e9a5727   Luigi Serra   graph updatesù
114
115
                      type : Array,

                      value : []

cc7592d4   Luigi Serra   graphs update
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
                  },

  

                  svgLinks : {

                      type : Array,

                      value : []

                  },

  

                  width: {

                      type: Number,

                      value: undefined

                  },

  

                  height : {

                      type : Number,

                      value: undefined

                  },

  

                  svg: {

                      type: Object,

                      value: undefined

                  },

                  feelings:{

                      type: Array,

                      values: ["Agree", "Neutral", "Not agree"]

                  },

                  prev_selected_node : {

                      type : Object,

                      value : null

                  },

  

                  force : {

                      type : Object,

                      value : null

                  },

  

                  edgesMap : {

                      type : Array,

                      value : []

                  },

  

                  groups: {

                      type: Array,

                      value: []

                  },

  

cc7592d4   Luigi Serra   graphs update
161
162
163
                  hull : {

                      type : Array,

                      value : []

0e9a5727   Luigi Serra   graph updatesù
164
165
166
167
168
169
                  },

                  /*test*/

                  hullg : {

                      type : Array,

                      value : []

                  },

cc7592d4   Luigi Serra   graphs update
170
  

0e9a5727   Luigi Serra   graph updatesù
171
172
173
                  offset :{

                      type : Number,

                      value : 15

d0393f14   Luigi Serra   graphs updates
174
175
176
177
178
                  },

  

                  prevNetwork : {

                      type : Object,

                      value : undefined

cc7592d4   Luigi Serra   graphs update
179
                  }

cc7592d4   Luigi Serra   graphs update
180
  

0e9a5727   Luigi Serra   graph updatesù
181
                  /*end test*/

cc7592d4   Luigi Serra   graphs update
182
183
              },

  

0e9a5727   Luigi Serra   graph updatesù
184
185
              convexHulls : function() {

                  var hullset = [];

0e9a5727   Luigi Serra   graph updatesù
186
187
188
189
190
191
192
193
                  for(var n in _this.hulls){

                     var vertices = [];

                     for(var v in _this.hulls[n]){

                         vertices.push([_this.hulls[n][v].x - _this.offset, _this.hulls[n][v].y - _this.offset]);

                         vertices.push([_this.hulls[n][v].x - _this.offset, _this.hulls[n][v].y + _this.offset]);

                         vertices.push([_this.hulls[n][v].x + _this.offset, _this.hulls[n][v].y - _this.offset]);

                         vertices.push([_this.hulls[n][v].x + _this.offset, _this.hulls[n][v].y + _this.offset]);

                     }

d0393f14   Luigi Serra   graphs updates
194
                      hullset.push({id :  n, sentiment: _this.hulls[n][v].sentiment , path: d3.geom.hull(vertices)});

0e9a5727   Luigi Serra   graph updatesù
195
196
                  }

                  return hullset;

cc7592d4   Luigi Serra   graphs update
197
198
              },

  

0e9a5727   Luigi Serra   graph updatesù
199
200
201
202
203
204
205
206
207
208
              fill : function(d){

                  switch(((d - 1) % 3)){

                      case 0 :

                          return "#1F77B4";

                      case 1 :

                          return "#2CA02C";

                      case 2:

                          return "#FF1E1E";

                  }

              },

cc7592d4   Luigi Serra   graphs update
209
  

0e9a5727   Luigi Serra   graph updatesù
210
211
212
213
              drawCluster : function(d) {

                  var curve = d3.svg.line()

                          .interpolate("cardinal-closed")

                          .tension(.85);

cc7592d4   Luigi Serra   graphs update
214
  

0e9a5727   Luigi Serra   graph updatesù
215
216
                  return curve(d.path); // 0.8

              },

cc7592d4   Luigi Serra   graphs update
217
  

0e9a5727   Luigi Serra   graph updatesù
218
              getGroups : function(){

cc7592d4   Luigi Serra   graphs update
219
                  for(var i= 0,j=0; i < this.graph.nodes.length;i++,j+=3){

cc7592d4   Luigi Serra   graphs update
220
  

0e9a5727   Luigi Serra   graph updatesù
221
222
223
224
                      var f = this.graph.nodes[i].father;

                      if(f != null) {

                          while (f.sentiment == this.graph.nodes[i].sentiment) f = f.father;

                      }

cc7592d4   Luigi Serra   graphs update
225
  

0e9a5727   Luigi Serra   graph updatesù
226
227
228
229
230
231
232
233
234
235
                      if(f != null){

                          if(this.groups[f.id] == undefined){

                              this.groups[f.id] = ([

                                  {key: "" + j, values: [], extend: false},

                                  {key: "" + (j + 1), values: [],extend: false},

                                  {key: "" + (j + 2), values: [], extend: false}

                              ]);

                          }

                          this.graph.nodes[i].group = f.id;

                          this.groups[f.id][parseInt(this.graph.nodes[i].sentiment) - 1].values.push(this.graph.nodes[i]);

cc7592d4   Luigi Serra   graphs update
236
  

0e9a5727   Luigi Serra   graph updatesù
237
                      }else{

d0393f14   Luigi Serra   graphs updates
238
                          this.graph.nodes[i].group = 0;

0e9a5727   Luigi Serra   graph updatesù
239
                      }

cc7592d4   Luigi Serra   graphs update
240
                  }

0e9a5727   Luigi Serra   graph updatesù
241
242
243
244
245
246
247
248
249
              },

  

              getNetwork : function(){

                  var nodes = [], links = [];

                  var nodesMap = [];

  

                  //Associate the root to first node

                  var root = ({

                      id: 0,

d0393f14   Luigi Serra   graphs updates
250
251
252
253
                      group: 0,

                      name : this.graph.nodes[0].name,

                      content : this.graph.nodes[0].content,

                      r: this.graph.nodes[0].r,

0e9a5727   Luigi Serra   graph updatesù
254
255
                  });

                  nodes.push(root);

0e9a5727   Luigi Serra   graph updatesù
256
                  nodesMap[0] = root;

cc7592d4   Luigi Serra   graphs update
257
258
  

                  this.hulls = [];

0e9a5727   Luigi Serra   graph updatesù
259
260
261
                  for(var g in this.groups){

                      for(var s in this.groups[g]) {

                          if(this.groups[g][s].values.length > 0) {

d0393f14   Luigi Serra   graphs updates
262
                              if(this.groups[g][s].extend || this.groups[g][s].values.length == 1 ){

0e9a5727   Luigi Serra   graph updatesù
263
264
265
266
267
268
                                  this.hulls[g + "-" + s] = [];

                                  for(var n=0; n < this.groups[g][s].values.length;n++) {

                                      var node = ({

                                          id: g + "-" + s + "-" + n,

                                          group: g + "-" + s,

                                          sentiment: parseInt(s) + 1,

d0393f14   Luigi Serra   graphs updates
269
270
271
                                          r: this.groups[g][s].values[n].r,

                                          name : this.groups[g][s].values[n].name,

                                          content : this.groups[g][s].values[n].content

0e9a5727   Luigi Serra   graph updatesù
272
273
274
275
276
277
                                      });

                                      nodes.push(node);

                                      nodesMap[this.groups[g][s].values[n].id] = node;

                                      this.hulls[g + "-" + s].push(node);

                                  }

                              }else{

d0393f14   Luigi Serra   graphs updates
278
279
280
                                  var r = 0;

                                  for(var n=0; n < this.groups[g][s].values.length;n++) r+= Math.sqrt(this.groups[g][s].values[n].r);

  

0e9a5727   Luigi Serra   graph updatesù
281
282
283
284
285
                                  var node =  ({

                                      id : g + "-"+ s,

                                      group: g,

                                      sentiment: parseInt(s) + 1,

                                      nodes: this.groups[g][s].values,

d0393f14   Luigi Serra   graphs updates
286
287
                                      r: (r < 4) ? 4 : r,

                                      content : "This node contains " + this.groups[g][s].values.length + " nodes",

0e9a5727   Luigi Serra   graph updatesù
288
289
290
291
292
293
294
                                      extend: false

                                  });

  

                                  nodes.push(node);

  

                                  for(var n=0; n < this.groups[g][s].values.length;n++)

                                      nodesMap[this.groups[g][s].values[n].id] = node;

cc7592d4   Luigi Serra   graphs update
295
                              }

cc7592d4   Luigi Serra   graphs update
296
297
298
                          }

                      }

                  }

cc7592d4   Luigi Serra   graphs update
299
  

0e9a5727   Luigi Serra   graph updatesù
300
301
302
303
304
305
306
307
308
309
310
                  for(var e = 0; e < this.graph.links.length; e++){

                      if(this.graph.nodes[this.graph.links[e].source.id].group !=  this.graph.nodes[this.graph.links[e].target.id].group) {

                          var id = nodesMap[this.graph.links[e].source.id].id + "-" + nodesMap[this.graph.links[e].target.id].id;

                          var link = this.findLink(links, id);

                          if(link != null)

                              link.size += 3;

                          else

                              links.push({

                                  id: id,

                                  source: nodesMap[this.graph.links[e].source.id],

                                  target: nodesMap[this.graph.links[e].target.id],

0e9a5727   Luigi Serra   graph updatesù
311
312
313
314
                                  size : 1

                              });

                      }else{

                          links.push({

d0393f14   Luigi Serra   graphs updates
315
                              source: nodesMap[this.graph.links[e].source.id],

0e9a5727   Luigi Serra   graph updatesù
316
                              target: nodesMap[this.graph.links[e].target.id],

0e9a5727   Luigi Serra   graph updatesù
317
318
319
                              size : 1

                          });

                      }

cc7592d4   Luigi Serra   graphs update
320
321
                  }

  

0e9a5727   Luigi Serra   graph updatesù
322
323
                  return {nodes : nodes, links : links};

                  //return {nodes : this.graph.nodes, links : this.graph.links};

cc7592d4   Luigi Serra   graphs update
324
  

cc7592d4   Luigi Serra   graphs update
325
326
              },

  

0e9a5727   Luigi Serra   graph updatesù
327
328
329
330
331
              findLink : function(links, id){

                  for(var i=0; i<links.length;i++){

                      if(links[i].id == id) return links[i];

                  }

                  return null;

cc7592d4   Luigi Serra   graphs update
332
              },

cc7592d4   Luigi Serra   graphs update
333
334
335
  

              init : function(){

  

0e9a5727   Luigi Serra   graph updatesù
336
                  var net = this.getNetwork();

cc7592d4   Luigi Serra   graphs update
337
338
339
  

                  if(this.force != null) this.force.stop();

                  force = d3.layout.force()

0e9a5727   Luigi Serra   graph updatesù
340
341
342
343
344
345
346
347
348
349
350
351
                          .nodes(net.nodes)

                          .links(net.links)

                          .size([this.width, this.height])

                          .charge(-1e3)

                          .friction(.7)

                          .linkDistance(function (t){ return t.value ? t.value : 80})

                          .on("tick", this.tick).start();

  

                  this.hullg.selectAll("path.hull").remove();

                  this.hull = this.hullg.selectAll("path.hull")

                          .data(this.convexHulls)

                          .enter().append("path")

cc7592d4   Luigi Serra   graphs update
352
                          .attr("class", "hull")

0e9a5727   Luigi Serra   graph updatesù
353
354
355
356
                          .attr("d", this.drawCluster)

                          .style("fill", "#60df20")

                          .style("opacity", .2)

                          .on("click", function(d) {

d0393f14   Luigi Serra   graphs updates
357
358
359
                              var gids = d.id.split("-");

                              _this.groups[parseInt(gids[0])][parseInt(gids[1])].extend = false;

                              _this.init();

0e9a5727   Luigi Serra   graph updatesù
360
                          });

cc7592d4   Luigi Serra   graphs update
361
  

0e9a5727   Luigi Serra   graph updatesù
362
  

d0393f14   Luigi Serra   graphs updates
363
364
365
                  this.svg.selectAll(".link").data((this.prevNetwork != undefined) ? this.prevNetwork.links : net.links).remove();

                  this.svgLinks = this.svg.selectAll(".link").data(net.links);

                  this.svgLinks.enter()

cc7592d4   Luigi Serra   graphs update
366
367
                          .append("line")

                          .attr("class", "link")

d0393f14   Luigi Serra   graphs updates
368
                          .attr("style", function(t){ return "stroke:#999999"; /*+ t.color*/ })

0e9a5727   Luigi Serra   graph updatesù
369
370
                          .style("stroke-width", function(d) { return d.size || 0.3; });

  

d0393f14   Luigi Serra   graphs updates
371
                  this.svg.selectAll(".node").data((this.prevNetwork != undefined) ? this.prevNetwork.nodes : net.nodes).remove();

0e9a5727   Luigi Serra   graph updatesù
372
                  this.svgNodes = this.svg.selectAll(".node").data(net.nodes).enter()

cc7592d4   Luigi Serra   graphs update
373
374
375
376
377
378
                          .append("g")

                          .on("mouseover", this.mouseover)

                          .on("mouseout", this.mouseout)

                          .attr("class", function (t) { return t.fixed ? "node fixed" : "node"})

                          .attr("name", function (t) { return t.name ? t.name.split(" ").join("_").toLowerCase() : ""})

                          .append("circle")

0e9a5727   Luigi Serra   graph updatesù
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
                          .on("click", this.active)

                          .attr("id", function(t){ return t.id })

                          .attr("class", function (t) { return t.fixed ? "" : "drag"})

                          .attr("r", function (t){ return t.r ? t.r : 15 })

                          .attr("style", function (t) {

                              switch(parseInt(t.sentiment)){

                                  case 1 :

                                      t.color = "#1F77B4";

                                      break;

                                  case 2 :

                                      t.color = "#2CA02C";

                                      break;

                                  case 3:

                                      t.color = "#D62728";

                                      break;

                                  default:

                                      t.color = "#333";

                              }

                              //return t.color ? "fill:" + t.color : !1 + "; stroke:white"

                              return "fill:" + t.color + "; stroke:white"

                          })

                          .attr("filter", function(t){return  t.image ? 'url(#filter1)' : ""});

cc7592d4   Luigi Serra   graphs update
401
402
403
404
405
406
407
  

                  this.svg.style("opacity", 1e-6)

                          .transition()

                          .duration(1000)

                          .style("opacity", 1);

  

                  d3.selectAll(".drag").call(force.drag), this.svg.selectAll("g.node").call(this.text);

d0393f14   Luigi Serra   graphs updates
408
409
  

                  this.prevNetwork = net;

cc7592d4   Luigi Serra   graphs update
410
411
412
413
414
415
416
417
418
419
              },

  

              buildGraph: function (){

  

                  this.svg = this.svg.append("g")

                          .call(d3.behavior.zoom().scaleExtent([.25, 20]).on("zoom", this.zoom))

                          .append("g");

  

                  //set initial zoom

                  scale = (1.0);

cc7592d4   Luigi Serra   graphs update
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
                  translate = [0, 0];

                  this.svg.transition()

                          .duration(750)

                          .attr("transform", "translate(" + translate + ")scale(" + scale +    ")")

                          .each("end", function () {

                              d3.behavior.zoom()

                                      .scale(scale)

                                      .translate(translate);

                          });

                  //end set initial zoom

  

                  this.svg.append("rect")

                          .attr("fill", "white")

                          .attr("width", this.width)

                          .attr("height", this.height);

  

                  //pezzotto

                  this.svg.append("filter")

                          .attr("id","filter1")

                          .attr("x","0%")

                          .attr("y","0%")

                          .attr("width","100%")

                          .attr("height","100%")

                          .append("feImage")

                          .attr("xlink:href","http://icons.iconarchive.com/icons/hopstarter/soft-scraps/256/User-Executive-Green-icon.png");

  

0e9a5727   Luigi Serra   graph updatesù
446
                  for (var i = 0; i < this.graph.links.length; ++i) {

d0393f14   Luigi Serra   graphs updates
447
                      var o = this.graph.links[i];

0e9a5727   Luigi Serra   graph updatesù
448
449
450
451
452
453
454
                      o.source = this.graph.nodes[o.source];

                      o.target = this.graph.nodes[o.target];

                  }

  

                  this.hullg = this.svg.append("g");

  

                  this.getGroups();

cc7592d4   Luigi Serra   graphs update
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
                  this.init();

              },

  

              zoom: function() {

                  _this.svg.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");

              },

  

              text: function (t){

                  var e = t.append("svg:foreignObject").attr("width", 120).attr("height", 30);

                  e.attr("style", function (t) {

                      return "color:" + (t.color ? t.color : "#000")

                  }).append("xhtml:div").html(function (t) {

                      //return t.fixed ? t.name : null

                      return t.name;

                  })

              },

  

              tick : function () {

0e9a5727   Luigi Serra   graph updatesù
473
474
475
476
477
478
479
480
                  if(_this.hull != undefined) {

                      if (!_this.hull.empty()) {

                          _this.hull.data(_this.convexHulls)

                                  .style("fill", function (d) {

                                      return _this.fill(d.sentiment);

                                  })

                                  .attr("d", _this.drawCluster);

                      }

cc7592d4   Luigi Serra   graphs update
481
  

cc7592d4   Luigi Serra   graphs update
482
  

0e9a5727   Luigi Serra   graph updatesù
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
                      d3.selectAll("g foreignObject").attr("x", function (t) {

                          return t.x + (t.r ? 0.8 * t.r : 15)

                      }).attr("y", function (t) {

                          return t.y - 20

                      });

  

                      d3.selectAll("#logo text").attr("x", function (t) {

                          return t.x + .7 * (t.r ? t.r : 15)

                      }).attr("y", function (t) {

                          return t.y

                      });

  

                      _this.svgNodes.attr("cx", function (t) {

                          return t.x = Math.max(25, Math.min(_this.width - 50, t.x))

                      }).attr("cy", function (t) {

                          return t.y = Math.max(8, Math.min(600, t.y))

                      });

  

                      _this.svgLinks.attr("x1", function (t) {

                          return t.source.x

                      }).attr("y1", function (t) {

                          return t.source.y

                      }).attr("x2", function (t) {

                          return t.target.x

                      }).attr("y2", function (t) {

                          return t.target.y

                      });

cc7592d4   Luigi Serra   graphs update
510
                  }

0e9a5727   Luigi Serra   graph updatesù
511
  

cc7592d4   Luigi Serra   graphs update
512
513
514
              },

  

              mouseover : function (t) {

d0393f14   Luigi Serra   graphs updates
515
516
517
518
519
520
521
522
                  d3.select(this).selectAll("circle").transition().duration(600).ease("elastic")

                          .attr("r", function (t) {

                              return (t.extend == undefined) ? t.r + 1 : t.r + 10;

                          })

                          /*.attr("style", function(t){

                              return (t.extend == undefined) ? "fill:#FFFFFF; stroke:" + t.color : "fill:" + t.color + "; stroke:#FFFFFF";

                          })*/;

  

cc7592d4   Luigi Serra   graphs update
523
524
  

                  _this.$.dialog.close();

d0393f14   Luigi Serra   graphs updates
525
526
                  _this.$.dialog_title.innerHTML   = (t.name) ? t.name : "Cluster";

                  _this.$.dialog_content.innerHTML = t.content;

cc7592d4   Luigi Serra   graphs update
527
528
529
530
531
  

                  _this.$.dialog.open();

              },

  

              mouseout : function () {

d0393f14   Luigi Serra   graphs updates
532
533
534
535
536
537
538
                  d3.select(this).selectAll("text").style("visibility", "hidden"), d3.select(this).selectAll("circle").transition().duration(400)

                         .attr("r", function (t) {

                            return t.r ? t.r : 15

                          })

                         /*.attr("style", function(t){

                              return (t.extend == undefined) ? "stroke:#FFFFFF; fill:" + t.color  : "stroke:#FFFFFF; fill:" + t.color;

                         })*/;

cc7592d4   Luigi Serra   graphs update
539
540
541
542
543
                  _this.$.dialog.close();

              },

  

              active : function (t) {

  

0e9a5727   Luigi Serra   graph updatesù
544
545
546
547
                  if(t.extend == undefined)

                  {

                      _this.init();

                      _this.fire('graph-datalet_node-clicked', {node : t});

cc7592d4   Luigi Serra   graphs update
548
  

0e9a5727   Luigi Serra   graph updatesù
549
                      if(_this.prev_selected_node != null){

d0393f14   Luigi Serra   graphs updates
550
                          _this.prev_selected_node.style.fill = _this.prev_selected_node.color;

0e9a5727   Luigi Serra   graph updatesù
551
552
                          _this.prev_selected_node.style.stroke = "#FFFFFF";

                      }

cc7592d4   Luigi Serra   graphs update
553
  

0e9a5727   Luigi Serra   graph updatesù
554
                      _this.prev_selected_node = document.getElementById("" + t.id);

d0393f14   Luigi Serra   graphs updates
555
                      _this.prev_selected_node.style.fill   = "#FFFFFF";

0e9a5727   Luigi Serra   graph updatesù
556
557
                      _this.prev_selected_node.style.stroke = t.color;

                  }else{

d0393f14   Luigi Serra   graphs updates
558
                      var gids = t.id.split("-");

0e9a5727   Luigi Serra   graph updatesù
559
560
561
                      _this.groups[gids[0]][gids[1]].extend = true;

                      _this.init();

                  }

cc7592d4   Luigi Serra   graphs update
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
              },

  

              _onCloseClick : function(){

                  //_this.$.dialog.close();

              },

  

              /**

               * 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.

               *

               * Extract the dataset domain from the entire URL and set the text content of the datalet footer.

               *

               * @method ready

               *

               */

              ready: function(){

  

                  _this = this;

  

                  this.svg = d3.select("svg#sbiricuda").attr("class", "svg").attr({

                      width: "100%",

                      height: "100%"

                  }).attr("viewBox", "0 0 " + this.width + " " + this.height)

0e9a5727   Luigi Serra   graph updatesù
586
                          .attr("pointer-events", "all")

cc7592d4   Luigi Serra   graphs update
587
                          .attr("style", "transform:translate(0px)")

0e9a5727   Luigi Serra   graph updatesù
588
                          .style("position", "absolute");

cc7592d4   Luigi Serra   graphs update
589
590
591
592
593
594
  

                  this.buildGraph();

              }

          });

      </script>

  </dom-module>