Blame view

datalets/datasetexplorer-datalet/treemap_tooltip.html 5.81 KB
b53fef03   Renato De Donato   treemap tooltip
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
  <link rel="import" href="../../bower_components/polymer/polymer.html" />
  
  <link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
  
  <link rel="import" href="../../bower_components/iron-icons/editor-icons.html">
  <link rel="import" href="../../bower_components/iron-icons/communication-icons.html">
  
  <dom-module id="treemap-tooltip">
  
      <template>
  
          <style is="custom-style">
  
              iron-icon {
                  padding: 0px;
                  margin: 0px;
              }
  
              iron-icon.this {
                  position: absolute;
                  top: -3px;
                  left: -3px;
  
                  -moz-transform: scaleX(-1);
                  -o-transform: scaleX(-1);
                  -webkit-transform: scaleX(-1);
                  transform: scaleX(-1);
                  filter: FlipH;
                  -ms-filter: "FlipH";
              }
  
              paper-dialog {
                  margin: 0px;
              }
  
              .tooltip {
                  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
                  padding: 16px;
b53fef03   Renato De Donato   treemap tooltip
39
40
                  position: absolute;
  
9219771e   Renato De Donato   treemap tooltip
41
42
43
                  /*min-width: 200px;*/
                  /*max-width: 400px;*/
  
b53fef03   Renato De Donato   treemap tooltip
44
45
46
47
48
                  /*position: relative*/
                  /*top: 20px;*/
                  /*left: 20px;*/
              }
  
cc57caa4   Renato De Donato   datasetexplorer
49
50
51
52
              .tooltip#top_info {
                  white-space: nowrap;
              }
  
9219771e   Renato De Donato   treemap tooltip
53
54
55
56
57
58
59
60
61
62
63
64
65
              .tooltip#first_info {
                  width: 400px;
              }
  
              .tooltip#middle_info {
                  min-width: 200px;
              }
  
              .tooltip#last_info {
                  min-width: 200px;
                  max-width: 800px;
              }
  
b53fef03   Renato De Donato   treemap tooltip
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
              .tooltip_top {
                  display: flex;
                  margin: 0px;
                  padding: 0px;
                  height: 64px;
              }
  
              /*.tooltip_logo {*/
              /*}*/
  
              .tooltip_name {
                  height: 20px;
                  font-weight: 700;
                  padding: 22px;
              }
  
              .tooltip_img {
                  margin: 0px;
                  padding: 0px;
                  height: 64px;
fb7aea2c   Renato De Donato   tooltip, a new hope!
86
                  /*width: 64px;*/
b53fef03   Renato De Donato   treemap tooltip
87
88
89
90
91
92
93
94
95
96
97
98
99
              }
  
              p {
                  margin: 0px;
                  padding: 8px 0px 0px 0px;
              }
  
              .ptop{
                  padding-top: 0px;
              }
  
          </style>
  
cc57caa4   Renato De Donato   datasetexplorer
100
101
102
103
          <paper-dialog id="top_info" class="tooltip">
              <p class="ptop"><b>{{description}}</b></p>
          </paper-dialog>
  
b53fef03   Renato De Donato   treemap tooltip
104
105
106
107
          <paper-dialog id="first_info" class="tooltip">
              <iron-icon icon="communication:call-made" class="this" style$="color: {{color}};"></iron-icon>
              <div class="tooltip_top">
                  <div class="tooltip_logo"><img class="tooltip_img" src$={{logoUrl}}></div>
fb7aea2c   Renato De Donato   tooltip, a new hope!
108
                  <!--<div class="tooltip_name" style$="color: {{color}};">{{name}}</div>-->
b53fef03   Renato De Donato   treemap tooltip
109
              </div>
941bbb68   Renato De Donato   tooltip ln
110
111
              <p><b style$="color: {{color}};">{{name}}</b></p>
              <p><i>{{description}}</i></p>
b53fef03   Renato De Donato   treemap tooltip
112
113
114
115
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
              <p>There are <b>{{datasets}}</b> datasets.</p>
          </paper-dialog>
  
          <paper-dialog id="middle_info" class="tooltip">
              <iron-icon icon="communication:call-made" class="this" style$="color: {{color}};"></iron-icon>
              <p class="ptop"><b style$="color: {{color}};">{{name}}</b></p>
              <p>There are <b>{{datasets}}</b> datasets.</p>
          </paper-dialog>
  
          <paper-dialog id="last_info" class="tooltip">
              <iron-icon icon="communication:call-made" class="this" style$="color: {{color}};"></iron-icon>
              <p class="ptop"><b style$="color: {{color}};">{{name}}</b></p>
              <p>Dataset URL: <b>{{datasetUrl}}</b></p>
          </paper-dialog>
  
      </template>
  
      <script>
  
          Polymer({
  
              is : 'treemap-tooltip',
  
              properties : {
  
                  name : {
                      type  : String,
                      value : ""
                  },
  
                  color : {
                      type  : String,
                      value : "#2196F3"
                  },
  
                  description : {
                      type  : String,
                      value : ""
                  },
  
                  logoUrl : {
                      type  : String,
                      value : ""
                  },
  
                  datasets : {
                      type  : String,
                      value : "0"
                  },
  
                  datasetUrl : {
                      type  : String,
                      value : ""
                  }
  
              },
  
              showTooltip: function(e, lvl) {
                  var x = e.layerX + 16;//clientX
                  var y = e.layerY + 16;
  
                  this.hideTooltip();
  
                  switch (lvl) {
cc57caa4   Renato De Donato   datasetexplorer
176
177
178
179
180
                      case "top":
                          $("#top_info").css("top", y);
                          $("#top_info").css("left", x);
                          this.$.top_info.open();
                          break;
b53fef03   Renato De Donato   treemap tooltip
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
                      case "first":
                          $("#first_info").css("top", y);
                          $("#first_info").css("left", x);
                          this.$.first_info.open();
                          break;
                      case "middle":
                          $("#middle_info").css("top", y);
                          $("#middle_info").css("left", x);
                          this.$.middle_info.open();
                          break;
                      case "last":
                          $("#last_info").css("top", y);
                          $("#last_info").css("left", x);
                          this.$.last_info.open();
                  }
              },
  
              hideTooltip: function() {
cc57caa4   Renato De Donato   datasetexplorer
199
                  this.$.top_info.close();
b53fef03   Renato De Donato   treemap tooltip
200
201
202
203
204
205
206
207
208
209
                  this.$.first_info.close();
                  this.$.middle_info.close();
                  this.$.last_info.close();
              }
  
          });
  
      </script>
  
  </dom-module>