Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TextPlot when color, font or other aesthetics change. #905

Merged
merged 2 commits into from
May 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions chaco/plots/text_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ class TextPlot(BaseXYPlot):
text = Instance(ArrayDataSource)

#: The font of the tick labels.
text_font = KivaFont("modern 10")
text_font = KivaFont("modern 10", redraw=True)

#: The color of the tick labels.
text_color = black_color_trait
text_color = black_color_trait(redraw=True)

#: The rotation of the tick labels.
text_rotate_angle = Float(0)
text_rotate_angle = Float(0, redraw=True)

#: The margin around the label.
text_margin = Int(2)
text_margin = Int(2, redraw=True)

#: horizontal position of text relative to target point
h_position = Enum("center", "left", "right")
h_position = Enum("center", "left", "right", redraw=True)

#: vertical position of text relative to target point
v_position = Enum("center", "top", "bottom")
v_position = Enum("center", "top", "bottom", redraw=True)

#: offset of text relative to non-index direction in pixels
text_offset = Tuple(Float, Float)
text_offset = Tuple(Float, Float, redraw=True)

# ------------------------------------------------------------------------
# Private traits
Expand Down Expand Up @@ -173,6 +173,6 @@ def _invalidate(self, event):
self._screen_cache_valid = False
self._label_cache_valid = False

@observe("value.data_changed")
@observe("value.data_changed,+redraw")
def _invalidate_labels(self, event):
self._label_cache_valid = False