File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
example_cursor_scatter_experimental
kivy_matplotlib_widget/uix Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -397,14 +397,22 @@ def hover(self, event) -> None:
397397 if self .multi_xdata :
398398 self .hover_instance .custom_label = self .scatter_label [good_index2_scatter [idx_best ]]
399399 else :
400- self .hover_instance .custom_label = line . get_label ()
400+ self .hover_instance .custom_label = self . scatter_label [ good_index_scatter [ idx_best ]]
401401 if line :
402402 self .hover_instance .custom_color = get_color_from_hex (to_hex (line .get_color ()))
403403 elif scatter :
404404 if self .multi_xdata :
405- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
405+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
406+ color = scatter .get_facecolors ()[good_index2_scatter [idx_best ]]
407+ else :
408+ color = scatter .get_facecolors ()
409+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
406410 else :
407- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
411+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
412+ color = scatter .get_facecolors ()[good_index_scatter [idx_best ]]
413+ else :
414+ color = scatter .get_facecolors ()
415+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
408416
409417 if self .hover_instance .x_hover_pos > self .x + self .axes .bbox .bounds [2 ] + self .axes .bbox .bounds [0 ] or \
410418 self .hover_instance .x_hover_pos < self .x + self .axes .bbox .bounds [0 ] or \
Original file line number Diff line number Diff line change @@ -397,14 +397,22 @@ def hover(self, event) -> None:
397397 if self .multi_xdata :
398398 self .hover_instance .custom_label = self .scatter_label [good_index2_scatter [idx_best ]]
399399 else :
400- self .hover_instance .custom_label = line . get_label ()
400+ self .hover_instance .custom_label = self . scatter_label [ good_index_scatter [ idx_best ]]
401401 if line :
402402 self .hover_instance .custom_color = get_color_from_hex (to_hex (line .get_color ()))
403403 elif scatter :
404404 if self .multi_xdata :
405- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
405+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
406+ color = scatter .get_facecolors ()[good_index2_scatter [idx_best ]]
407+ else :
408+ color = scatter .get_facecolors ()
409+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
406410 else :
407- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
411+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
412+ color = scatter .get_facecolors ()[good_index_scatter [idx_best ]]
413+ else :
414+ color = scatter .get_facecolors ()
415+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
408416
409417 if self .hover_instance .x_hover_pos > self .x + self .axes .bbox .bounds [2 ] + self .axes .bbox .bounds [0 ] or \
410418 self .hover_instance .x_hover_pos < self .x + self .axes .bbox .bounds [0 ] or \
You can’t perform that action at this time.
0 commit comments