mirror of https://gitlab.com/pamhyr/pamhyr2
doc: dev: Write Plot section.
parent
f93f3fe122
commit
a81564e582
|
|
@ -602,8 +602,35 @@ creation, this stack is accessible at =self._undo_stack=.
|
||||||
)
|
)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** TODO Plot
|
*** Plot
|
||||||
*** TODO Mainwindow
|
|
||||||
|
To define a new plot you can create a class who inherit to APlot. The
|
||||||
|
creator need threee argument:
|
||||||
|
- A =canvas= of type =MplCanvas=
|
||||||
|
- A =data= used in =draw= and =update= to create and update the plot
|
||||||
|
- A optional =toolbar= of type =PamhyrToolbar=
|
||||||
|
This class must implement two method =draw= and =update=, the first
|
||||||
|
method to draw the plot from scratch, the second to update the plot if
|
||||||
|
data has changed.
|
||||||
|
|
||||||
|
#+begin_src python :python python3 :results output :noweb yes
|
||||||
|
from View.Plot.APlot import APlot
|
||||||
|
|
||||||
|
class MyPlot(APlot):
|
||||||
|
def __init__(self, canvas=None, data=None, toolbar=None):
|
||||||
|
super(MyPlot, self).__init__(
|
||||||
|
canvas=canvas,
|
||||||
|
data=data,
|
||||||
|
toolbar=toolbar
|
||||||
|
)
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
# Draw function code...
|
||||||
|
|
||||||
|
def update(self, ind = None):
|
||||||
|
# Update function code...
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** TODO Solver
|
** TODO Solver
|
||||||
|
|
||||||
#+name: graph-pipeline
|
#+name: graph-pipeline
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue