Commit 33ee61fdfe5e4c96af9817a8c3b75186fe9955c7
1 parent
c49910f8
graph updates
Showing
2 changed files
with
37 additions
and
135 deletions
datalets/graph-datalet/graph-datalet.html
... | ... | @@ -31,6 +31,7 @@ |
31 | 31 | |
32 | 32 | <link rel="import" href="../base-datalet/base-datalet.html"> |
33 | 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"> | |
34 | 35 | |
35 | 36 | <!-- |
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. |
... | ... | @@ -54,12 +55,23 @@ Example: |
54 | 55 | |
55 | 56 | <style is="custom-style"> |
56 | 57 | |
58 | + #dialog{ | |
59 | + position: absolute; | |
60 | + padding: 20px; | |
61 | + } | |
62 | + | |
57 | 63 | </style> |
58 | 64 | |
59 | 65 | <div style="align-content: center;" id="graph_content"> |
60 | 66 | <svg id="sbiricuda"></svg> |
61 | 67 | </div> |
62 | 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 | + | |
63 | 75 | </template> |
64 | 76 | |
65 | 77 | <script src="static/js/d3.v3.js"></script> |
... | ... | @@ -73,6 +85,7 @@ Example: |
73 | 85 | height = undefined; |
74 | 86 | svg = undefined; |
75 | 87 | _this = null; |
88 | + prev_selected_node = null; | |
76 | 89 | |
77 | 90 | Polymer({ |
78 | 91 | is : 'graph-datalet', |
... | ... | @@ -137,6 +150,9 @@ Example: |
137 | 150 | .on("mouseout", this.mouseout) |
138 | 151 | .on("click", this.active) |
139 | 152 | .append("circle") |
153 | + .attr("id", function(t){ | |
154 | + return t.id; | |
155 | + }) | |
140 | 156 | .attr("class", function (t) { |
141 | 157 | return t.fixed ? "" : "drag" |
142 | 158 | }).attr("r", function (t) { |
... | ... | @@ -200,9 +216,10 @@ Example: |
200 | 216 | }, |
201 | 217 | mouseover : function (t) { |
202 | 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 | |
203 | 220 | return 1 == t.fixed ? 1.4 * t.r : 15 |
204 | 221 | }); |
205 | - //$("#sbiricuda").html($("." + t.name.split(" ").join("_").toLowerCase()).html()) | |
222 | + | |
206 | 223 | }, |
207 | 224 | |
208 | 225 | mouseout : function () { |
... | ... | @@ -212,8 +229,23 @@ Example: |
212 | 229 | }, |
213 | 230 | |
214 | 231 | active : function (t) { |
215 | - /*t.fixed && openModal(t.name)*/ | |
216 | 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();*/ | |
217 | 249 | }, |
218 | 250 | |
219 | 251 | openModal : function(t) { | ... | ... |
datalets/graph-datalet/static/css/graphStyle.css
... | ... | @@ -37,10 +37,11 @@ g foreignObject { |
37 | 37 | } |
38 | 38 | |
39 | 39 | g foreignObject div { |
40 | + font-family: 'Roboto', sans-serif; | |
40 | 41 | display: inline-block; |
41 | - font-size: 16px; | |
42 | + font-size: 12px; | |
42 | 43 | text-decoration: none; |
43 | - padding: 4px | |
44 | + padding: 0px | |
44 | 45 | } |
45 | 46 | |
46 | 47 | g foreignObject a:hover { |
... | ... | @@ -48,37 +49,6 @@ g foreignObject a:hover { |
48 | 49 | text-decoration: none |
49 | 50 | } |
50 | 51 | |
51 | -.modal-content { | |
52 | - border-radius: 0 | |
53 | -} | |
54 | - | |
55 | -#modal { | |
56 | - text-align: justify | |
57 | -} | |
58 | - | |
59 | -#modal .modal-header { | |
60 | - text-align: center; | |
61 | - font-size: 25px; | |
62 | - color: #fff; | |
63 | - font-weight: 300; | |
64 | - background: #efefef | |
65 | -} | |
66 | - | |
67 | -#modal .modal-title { | |
68 | - font-size: 25px; | |
69 | - color: #fff | |
70 | -} | |
71 | - | |
72 | -.modal-body { | |
73 | - text-align: justify; | |
74 | - padding: 30px | |
75 | -} | |
76 | - | |
77 | -#modal .close { | |
78 | - color: #fff; | |
79 | - opacity: .8 | |
80 | -} | |
81 | - | |
82 | 52 | .r { |
83 | 53 | color: #c82528 |
84 | 54 | } |
... | ... | @@ -125,104 +95,4 @@ span.n4 { |
125 | 95 | font-size: .8em; |
126 | 96 | padding-top: 10px; |
127 | 97 | line-height: 1.3 |
128 | -} | |
129 | - | |
130 | -.howto { | |
131 | - font-family: arial; | |
132 | - font-size: 19px; | |
133 | - background: #595a5a; | |
134 | - color: #fff; | |
135 | - width: 25px; | |
136 | - height: 25px; | |
137 | - display: block; | |
138 | - text-align: center; | |
139 | - border-radius: 50% | |
140 | -} | |
141 | - | |
142 | -.howto_tooltip { | |
143 | - visibility: hidden; | |
144 | - color: #696969; | |
145 | - border: 1px solid #696969; | |
146 | - background: #fff; | |
147 | - display: inline-block; | |
148 | - width: 150px; | |
149 | - padding: 10px | |
150 | -} | |
151 | - | |
152 | -.modal-footer { | |
153 | - display: none | |
154 | -} | |
155 | - | |
156 | -.modal.fade:not(.in).bottom .modal-dialog { | |
157 | - -webkit-transform: translate3d(0, 25%, 0); | |
158 | - transform: translate3d(0, 25%, 0) | |
159 | -} | |
160 | - | |
161 | -.modal-backdrop { | |
162 | - background-color: #fff | |
163 | -} | |
164 | - | |
165 | -#credits { | |
166 | - position: fixed; | |
167 | - bottom: 10px; | |
168 | - right: 10px; | |
169 | - font-size: 10px | |
170 | -} | |
171 | - | |
172 | -#modal .modal-content.overview .modal-header { | |
173 | - background: #519c76 | |
174 | -} | |
175 | - | |
176 | -#modal .modal-content.cfp .modal-header { | |
177 | - background: #f69a43 | |
178 | -} | |
179 | - | |
180 | -#modal .modal-content.submission .modal-header { | |
181 | - background: #c82528 | |
182 | -} | |
183 | - | |
184 | -#modal .modal-content.organisation .modal-header { | |
185 | - background: #662d91 | |
186 | -} | |
187 | - | |
188 | -.deadlineext { | |
189 | - text-align: center; | |
190 | - width: 100%; | |
191 | - margin-top: -1em; | |
192 | - font-size: 120%; | |
193 | - border: 0 solid #f69a43; | |
194 | - padding: 0 | |
195 | -} | |
196 | - | |
197 | -.deadlineext hr { | |
198 | - border-width: 0; | |
199 | - border-top: 1px solid #f69a43; | |
200 | - margin: 3px | |
201 | -} | |
202 | - | |
203 | -@media print { | |
204 | - #modal.fade { | |
205 | - display: block !important; | |
206 | - opacity: 1; | |
207 | - page-break-before: always | |
208 | - } | |
209 | - | |
210 | - .modal { | |
211 | - position: static | |
212 | - } | |
213 | - | |
214 | - .modal-footer, .modal-header .close { | |
215 | - display: none | |
216 | - } | |
217 | - | |
218 | - .modal-content { | |
219 | - display: block !important; | |
220 | - border: 0; | |
221 | - box-shadow: none; | |
222 | - page-break-inside: avoid | |
223 | - } | |
224 | - | |
225 | - .modal h4, .modal-header { | |
226 | - padding: 0 | |
227 | - } | |
228 | 98 | } |
229 | 99 | \ No newline at end of file | ... | ... |