Skip to content

Commit 50738cb

Browse files
committed
fix tooltip
1 parent 0872789 commit 50738cb

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

octoprint_external_temp_reader/static/js/external_temp_reader.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,23 +208,29 @@ $(function() {
208208
var date = new Date(item.datapoint[0]);
209209
var temp = item.datapoint[1];
210210

211-
$("#tooltip").remove();
212-
var tooltip = $('<div id="tooltip" class="tooltip-inner">')
213-
.text(date.toLocaleTimeString() + ": " + temp.toFixed(1) + "°C")
214-
.css({
215-
position: 'absolute',
216-
display: 'none',
217-
top: item.pageY - 28,
218-
left: item.pageX + 5,
219-
border: '1px solid #666',
220-
padding: '2px 5px',
221-
'background-color': '#fff',
222-
'border-radius': '3px',
223-
'font-size': '12px',
224-
'z-index': 1000
225-
}).appendTo("body").fadeIn(200);
211+
// Remove any existing tooltip
212+
$("#chamber-temp-tooltip").remove();
213+
214+
// Create tooltip content
215+
var tooltipContent = date.toLocaleTimeString() + ": " + temp.toFixed(1) + "°C";
216+
217+
// Create and show tooltip
218+
$('<div id="chamber-temp-tooltip">' + tooltipContent + '</div>').css({
219+
position: 'absolute',
220+
display: 'block',
221+
top: item.pageY - 40,
222+
left: item.pageX + 10,
223+
border: '1px solid #333',
224+
padding: '4px 8px',
225+
'background-color': '#ffffcc',
226+
'border-radius': '4px',
227+
'font-size': '12px',
228+
'font-weight': 'normal',
229+
'z-index': 10000,
230+
'box-shadow': '2px 2px 4px rgba(0,0,0,0.3)'
231+
}).appendTo("body");
226232
} else {
227-
$("#tooltip").remove();
233+
$("#chamber-temp-tooltip").remove();
228234
}
229235
});
230236
};

0 commit comments

Comments
 (0)