How can I listen for changes in one plot's traits and update the second by that amount?

122 views Asked by At

https://github.com/enthought/chaco/blob/master/examples/demo/edit_line.py

My desired result is to have two plots side-by-side, the left is this edit_line.py plot, the right displays the sum of the y-values in edit_line.py and another array.

Right now I can look at self.component.index and self.component.value (x and y, respectively) from within PointDraggingTool. However, I need to be able to update the second plot based on updates in the first. How would I listen for changes in the first plot's traits and update the second by that amount?

1

There are 1 answers

0
foobuzz On BEST ANSWER

I've figured it out -- I'll post a proper solution soon.

In summary, it required listening to updates of the first plot using on_trait_change(self.lineplot.value, self._handle_data_change, name="data_changed") and redrawing the second plot