
    e	                        d Z ddlZddlZddlmZmZ  ej                  d      Z	 ej                         Zej                  d       ej                          ej                  dd        ej                         Zej#                  e        ej$                         Zej)                  d       ej+                  d        ej,                         Z ej0                         Zej5                  e        G d d	ej6                        Z e ej:                  ddd
d
            Zej?                   ej@                  ddd             ej5                  e       ej5                  edd
       ejB                  jE                  e        ejF                  de      Z$ej5                  e$d
d
        ejF                  de      Z%ej5                  e%dd       e$jM                  dd       e%jM                  dd       d Z'd Z( e'd      \  Z)Z* e(        ejW                           ejX                         Z-e-j\                  j_                  e(       e-ja                  d       e1dk(  r ejd                          yy)a  
ViewBox is the general-purpose graphical container that allows the user to 
zoom / pan to inspect any area of a 2D coordinate system. 

This unimaginative example demonstrates the construction of a ViewBox-based
plot area with axes, very similar to the way PlotItem is built.
    N)QtCore	QtWidgetszViewBox Examplezpyqtgraph example: ViewBoxi   iX  c                   *    e Zd Zd Zd Zd Zd Zd Zy)movableRectc                 f    t        j                  j                  | g|  | j                  d       y )NT)r   QGraphicsRectItem__init__setAcceptHoverEvents)selfargss     </usr/lib/python3/dist-packages/pyqtgraph/examples/ViewBox.pyr	   zmovableRect.__init__$   s)    ##,,T9D9!!$'    c                     | j                         | _        | j                  t        j                  ddd             |j                          y )N   )pensavedPensetPenpgmkPenignorer   evs     r   hoverEnterEventzmovableRect.hoverEnterEvent'   s1    
BHHS#s+,
		r   c                 Z    | j                  | j                         |j                          y N)r   r   r   r   s     r   hoverLeaveEventzmovableRect.hoverLeaveEvent+   s    DMM"
		r   c                    |j                         t        j                  j                  j                  k(  rF|j                          | j                  |j                               | j                         z
  | _        y |j                          y r   )
buttonr   QtMouseButton
LeftButtonacceptmapToParentpos
pressDeltar   r   s     r   mousePressEventzmovableRect.mousePressEvent.   sU    99;&))//:::IIK"..rvvx8488:EDOIIKr   c                 z    | j                  | j                  |j                               | j                  z
         y r   )setPosr#   r$   r%   r   s     r   mouseMoveEventzmovableRect.mouseMoveEvent4   s(    D$$RVVX.@Ar   N)__name__
__module____qualname__r	   r   r   r&   r)    r   r   r   r   #   s    (Br   r      d      bottom)orientationlinkViewleftzD<span style='color: #ff0000; font-weight: bold'>X</span> <i>Axis</i>s)textunitszY AxisV)r7   c                    t         j                  j                  |       }|t        | dz        t        | dz        xxx dz  ccc |t        | dz        xx   dz  cc<   |t        | dz        t        | dz        xxx dz  ccc |t        | dz        xx   dz  cc<   |t        j                  | | t	        |      z         t        |       z  fS )Ng?gp=
ף?g      ?g
ףp=
?         )nprandomintarangelenfloat)ndatas     r   randrE   G   s    99ADQsUC$K B& QtVQsUC$K A% QtV1aD	k*U1X555r   c                  N    t        d      \  } }t        j                  | |       y )N'  )yx)rE   p1setData)ydxds     r   
updateDatarN   P   s    %[FBJJrJr   rG   2   __main__)3__doc__numpyr=   	pyqtgraphr   pyqtgraph.Qtr   r   mkQAppappQMainWindowmwsetWindowTitleshowresizeGraphicsViewgvsetCentralWidgetQGraphicsGridLayoutlsetHorizontalSpacingsetVerticalSpacingViewBoxvbPlotDataItemrJ   addItemr   r   QRectFrectr   r   centralWidget	setLayoutAxisItemxScaleyScalesetLabelrE   rN   rL   rM   	autoRangeQTimerttimeoutconnectstartr*   execr-   r   r   <module>rv      s     *bii!"Y   . / 	 		#s R__   B !I!!#   q    Q RZZ\R__ 

2B)-- B( =6==Aq!,- HBHHS#s# $ 

4  		"a      1  
B	7 		&!Q 	"	5 		&!Q  [cf g  $6 
eB 
 FMMO 		  *  zBGGI r   