delete lines by one click
Question
Is it possible to delete all lines created with toolbox as one action? chart.lines() function returns nothing for those created by toolbox. I found clearDrawings() function in toolbox.js, but do not know how to use it my python code.
Code example
No response
Just like this:
def clear_drawings(chart):
chart.run_script(f'if ({chart.id}.toolBox) {chart.id}.toolBox.clearDrawings()')
# add a button that will clear all lines created with toolbox when clicked
chart.topbar.button('clear', 'clear_drawings', func=clear_drawings)
I also implemented this function by referring to the js and python code. Some features are not implemented in Python.
Question
Is it possible to delete all lines created with toolbox as one action? chart.lines() function returns nothing for those created by toolbox. I found clearDrawings() function in toolbox.js, but do not know how to use it my python code.是否可以一次性删除使用 toolbox 创建的所有行?chart.lines()函数对于由 toolbox 创建的行返回空值。我在 toolbox.js 中找到了 clearDrawings()函数,但不知道如何在 Python 代码中使用它。
Code example
No response 无响应
@anxi0us628