Skip to content

Define action on canvas #1690

Answered by saulpw
cool-RR asked this question in Q&A
Jan 22, 2023 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Sheet is an alias for TableSheet, which only handles all sheets with rows and columns--a Canvas is actually not a TableSheet. BaseSheet is the ultimate parent sheet class for all "sheets" that get pushed, including Canvases.

If you decorate toggle_plot_asterisk with @Canvas.api instead, it should work. (Note that your first parameter is a Canvas, not a Sheet). The error is confusing, but is because all functions are implicitly globals exposed in .visidatarc, including functions decorated with the monkey-patching .api! The command executor will try the vd and sheet contexts first, but if an identifier isn't on there, it will look in globals; and then fail in this way.

Other ways to get dif…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by cool-RR
Comment options

You must be logged in to vote
3 replies
@saulpw
Comment options

@cool-RR
Comment options

@cool-RR
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants