Blame view

datalets/datasetexplorer-datalet/treemap_tooltip.html 5.35 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;*/
              }
  
9219771e   Renato De Donato   treemap tooltip
49
50
51
52
53
54
55
56
57
58
59
60
61
              .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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
              .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!
82
                  /*width: 64px;*/
b53fef03   Renato De Donato   treemap tooltip
83
84
85
86
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>
  
          <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!
100
                  <!--<div class="tooltip_name" style$="color: {{color}};">{{name}}</div>-->
b53fef03   Renato De Donato   treemap tooltip
101
              </div>
941bbb68   Renato De Donato   tooltip ln
102
103
              <p><b style$="color: {{color}};">{{name}}</b></p>
              <p><i>{{description}}</i></p>
b53fef03   Renato De Donato   treemap tooltip
104
105
106
107
108
109
110
111
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
              <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) {
                      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() {
                  this.$.first_info.close();
                  this.$.middle_info.close();
                  this.$.last_info.close();
              }
  
          });
  
      </script>
  
  </dom-module>