;iddlZddlmZmZmZmZmZmZmZddlZ ddl m Z ddl m Z ddl mZddlmZddlmZmZmZd d lmZd gZGd d eZdS) N)ceilfloorisfinitelog10sqrtfrexpr)debug) functions)getConfigOption)Point)QtCoreQtGui QtWidgets)GraphicsWidgetAxisItemcNeZdZdZd8dZdZdZd Zd Zd Z d9d Z d:d Z d;dZ dZ dZdZdZd9dZdZd9dZdZdZdZdZdZdZdZd9dZd:dZdZd Zd!Zd"Z d#Z!d$Z"d9d%Z#d&Z$d'Z%d tag which will surround the axis label and units. =============== =============================================================== N)leftrighttopbottomzHOrientation argument must be one of 'left', 'right', 'top', or 'bottom'.rriFTr )FF))r皙?)r g333333?)g?)g?)tickTextOffset tickTextWidthtickTextHeightautoExpandTextSpaceautoReduceTextSpacehideOverlappingLabelstickFontstopAxisAtTicktextFillLimits showValues tickLength maxTickLevel maxTextLevel tickAlpha?rr)!r__init__rQGraphicsTextItemlabelpicture orientation Exception setRotationstyle textWidth textHeight fixedWidth fixedHeight labelText labelUnitslabelUnitPrefix labelStylelogMode _tickDensity _tickLevels _tickSpacingscale autoSIPrefixautoSIPrefixScale showLabelsetRangesetPen setTextPen setTickPen _linkedView_linkToView_internalgrid)selfr6pentextPentickPenlinkViewparent maxTickLengthr,textunits unitPrefixargshide_overlapping_labelss TC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\pyqtgraph/graphicsItems/AxisItem.pyr2zAxisItem.__init__s0 f---066  & @ @ @fgg g + + + J " "3 ' ' '&+ # #&* # !!f #'#'%<, %''   ,)     !$ u a ; KKMMMM KK    ? OO     OOG $ $ $ ? OO     OOG $ $ $    % %h / / / c ~|D]\}}||jvrtd|z|dvr't|tst d|z|dkr+|jdvr||jdd<k||jdd<||dkrl t|d kr6t|dtrt|dtsJn#t d xYw||j|<||j|<d |_ | | d S) a Set various style options. ===================== ======================================================= Keyword Arguments: tickLength (int) The maximum length of ticks in pixels. Positive values point toward the text; negative values point away. tickTextOffset (int) reserved spacing between text and axis in px tickTextWidth (int) Horizontal space reserved for tick text in px tickTextHeight (int) Vertical space reserved for tick text in px autoExpandTextSpace (bool) Automatically expand text space if the tick strings become too long. autoReduceTextSpace (bool) Automatically shrink the axis if necessary hideOverlappingLabels (bool or int) * *True* (default for horizontal axis): Hide tick labels which extend beyond the AxisItem's geometry rectangle. * *False* (default for vertical axis): Labels may be drawn extending beyond the extent of the axis. * *(int)* sets the tolerance limit for how many pixels a label is allowed to extend beyond the axis. Defaults to 15 for `hideOverlappingLabels = False`. tickFont (QFont or None) Determines the font used for tick values. Use None for the default font. stopAxisAtTick (tuple: (bool min, bool max)) If True, the axis line is drawn only as far as the last tick. Otherwise, the line is drawn to the edge of the AxisItem boundary. textFillLimits (list of (tick #, % fill) tuples). This structure determines how the AxisItem decides how many ticks should have text appear next to them. Each tuple in the list specifies what fraction of the axis length may be occupied by text, given the number of ticks that already have text displayed. For example:: [(0, 0.8), # Never fill more than 80% of the axis (2, 0.6), # If we already have 2 ticks with text, # fill no more than 60% of the axis (4, 0.4), # If we already have 4 ticks with text, # fill no more than 40% of the axis (6, 0.2)] # If we already have 6 ticks with text, # fill no more than 20% of the axis showValues (bool) indicates whether text is displayed adjacent to ticks. tickAlpha (float or int or None) If None, pyqtgraph will draw the ticks with the alpha it deems appropriate. Otherwise, the alpha will be fixed at the value passed. With int, accepted values are [0..255]. With value of type float, accepted values are from [0..1]. ===================== ======================================================= Added in version 0.9.9 z!%s is not a valid style argument.)r-r#r$r%zArgument '%s' must be intr#rrrr*r z5Argument 'stopAxisAtTick' must have type (bool, bool)N) itemsr9 NameError isinstanceint ValueErrorr6lenboolr5 _adjustSizeupdate)rQkwdskwdvalues r]setStylezAxisItem.setStylesfj ( (IC$*$$ Cc IJJJYYY!%--H$%@3%FGGG&&&#'8886;DJ/0336;DJ/033(((^u::??z%(D/I/I?jY^_`YacgNhNh??h?^$%\]]]"' 3"' 3   s A C$$C5c||jd|_||dSN)scene removeItemr4rQs r]closezAxisItem.closesI  +++  %%%%%r^cr||_d|_||dS)zSet the alpha value (0-255) for the grid, or False to disable. When grid lines are enabled, the axis tick lines are extended to cover the extent of the linked ViewBox, if any. N)rPr5prepareGeometryChangerh)rQrPs r]setGridzAxisItem.setGrids5    ""$$$ r^c4t|dkr|d|_ngt|dkr|\}}n*|d}|d}||jdvr||_||jdvr||_|jm|jdvr.|d|jn6|jdvr-|d|jd|_|dS) a Set log scaling for x and/or y axes. If two positional arguments are provided, the first will set log scaling for the x axis and the second for the y axis. If a single positional argument is provided, it will set the log scaling along the direction of the AxisItem. Alternatively, x and y can be passed as keyword arguments. If an axis is set to log scale, ticks are displayed on a logarithmic scale and values are adjusted accordingly. (This is usually accessed by changing the log mode of a :func:`PlotItem `.) The linked ViewBox will be informed of the change. rrr xyN)rrr)rerBgetr6rN setLogModer5rh)rQr[kwargsrwrxs r]rzzAxisItem.setLogModes t99>>7DLL4yyA~~11JJsOOJJsOO}!15F!F!F  }!15F!F!F    '#444  ""--c4<@@@@!%666  ""--c4<@@@  r^cx||jd<d|_||dS)zs (QFont or None) Determines the font used for tick values. Use None for the default font. r)N)r9r5rtrh)rQfonts r] setTickFontzAxisItem.setTickFonts< "& :  ""$$$ r^cd}|j d|_dS|j}tjdd}|jdkry|t| dz | dz z| | n|jdkr|t| dz | dz z| t| | z |znM|jdkrx|| | t| dz | dz z n|jdkr| t| dz | dz z |t| | z |z|j |d|_dS) Nrrrr rr@r) r4r5 boundingRectrQPointFr6setYrcsizeheightwidthsetXsetPos)rQevnudgebrps r] resizeEventzAxisItem.resizeEventsT : DL F Z $ $ & & N1a   v % % FF3tyy{{))++A- 1 <== > > > FFE6NNNN   ( ( FF3tyy{{))++A- 1 <== > > > FF3tyy{{((**299;;6u<== > > > >   & & FFE6NNN FF3tyy{{((**2- 2 =>> ? ? ? ?   ) ) FF3tyy{{((**2- 2 =>> ? ? ? FF3tyy{{))++BIIKK7=>> ? ? ? ! r^c|j||jdvr|n||jr|dSdS)z'Show/hide the label text for this axis.rN)r4 setVisibler6 _updateWidth _updateHeightrGupdateAutoSIPrefix)rQshows r]rIzAxisItem.showLabel,s} d###  0 0 0             &  # # % % % % % & &r^c |pd|_|pd|_|pd|_t|dkr||_|s|rdnd}|||dS)aSet the text displayed adjacent to the axis. ============== ============================================================= **Arguments:** text The text (excluding units) to display on the label for this axis. units The units for this axis. Units should generally be given without any scaling prefix (eg, 'V' instead of 'mV'). The scaling prefix will be automatically prepended based on the range of data displayed. args All extra keyword arguments become CSS style options for the tag which will surround the axis label and units. ============== ============================================================= The final text generated for the label will look like:: {text} (prefix{units}) Each extra keyword argument will become a CSS option in the above template. For example, you can set the font size and color of the label:: labelStyle = {'color': '#FFF', 'font-size': '14pt'} axis.setLabel('label text', units='V', **labelStyle) rrTFN)r>r?r@rerArI _updateLabel)rQrXrYrZr[visibles r]setLabelzAxisItem.setLabel7sz6+2)/R t99q=="DO454$$u w r^c|j||d|_|dS)z9Internal method to update the label according to the textN)r4setHtml labelStringrgr5rhrqs r]rzAxisItem._updateLabel\sN 4++--...   r^cjdkr#jr jdkrd}n ddjz z}ndjjd}jd|}dfdjD}d |d |d S) Nrr1z(x%g)() ;c4g|]}|dj|S)z: )rA).0krQs r] z(AxisItem.labelString..ns,VVVaaa););<VVVr^z z)r?rGrHr@r>joinrA)rQrYsr9s` r]rzAxisItem.labelStringcs ?b $ ?(>#(E(E3t'=#=> ! !% 4 4doooFE~~~uu -VVVVdoVVVWW/4uuaaa88r^c4|jdvr|jdr!||jks||jdz kr||_n5t|j|}||jks||jdz kr||_|jdr|dSdS|jdr!||jks||jdz kr||_n5t|j|}||jks||jdz kr||_|jdr|dSdS)Nrr' r&)r6r9r:maxrr;r)rQrwmxs r]_updateMaxTextSizezAxisItem._updateMaxTextSizersQ  0 0 0z/0 (t~%%T^b-@)@)@%&DN++&&"t~/B*B*B%'DNz/0 $!!##### $ $z/0 )t&&!do.B*B*B&'DO!,,''2"0D+D+D&(DOz/0 %""$$$$$ % %r^cl|jdvr|dS|dSNr)r6rrrqs r]rgzAxisItem._adjustSizesA  0 0 0            r^c<||_|dS)zSet the height of this axis reserved for ticks and tick labels. The height of the axis label is automatically added. If *height* is None, then the value will be determined automatically based on the size of the tick text.N)r=rrQhs r] setHeightzAxisItem.setHeights$  r^c2|sd}n|j|jdsd}n"|jdr|j}n |jd}||jdr|jddndz }|t d|jdz }|jr1||jdzz }n|j}||| |d|_ dS) Nrr,r&r%r#rr-r ) isVisibler=r9r;rr4rrsetMaximumHeightsetMinimumHeightr5rs r]rzAxisItem._updateHeights ~~ %AA'z,/5AAZ 565AA #34A <8PWTZ 01!44VWWSDJ|4555:''))B002299;;cAAA$ a    a    r^c<||_|dS)zSet the width of this axis reserved for ticks and tick labels. The width of the axis label is automatically added. If *width* is None, then the value will be determined automatically based on the size of the tick text.N)r<rrQws r]setWidthzAxisItem.setWidths#  r^c2|sd}n|j|jdsd}n"|jdr|j}n |jd}||jdr|jddndz }|t d|jdz }|jr1||jdzz }n|j}||| |d|_ dS)Nrr,r&r$r#r-r ) rr<r9r:rr4rrsetMaximumWidthsetMinimumWidthr5rs r]rzAxisItem._updateWidths~~ $AA&z,/4AAZ 564AA ?3A <8PWTZ 01!44VWWSDJ|4555:''))B002299;;cAAAO Q Q r^c|j!tjtdStj|jSN foreground)_penfnmkPenr rqs r]rRz AxisItem.pens4 9 8OL99:: :x """r^c$d|_|s|rtj|i||_n&tjt d|_|j|jd<|dS)z Set the pen used for drawing text, axes, ticks, and grid lines. If no arguments are given, the default foreground color will be used (see :func:`setConfigOption `). Nrcolor) r5rrrr rnamerArrQr[r{s r]rKzAxisItem.setPens   @6 @$1&11DII!>!>??DI#'9??#4#4#9#9#;#;  r^c|j!tjtdStj|jSr)_textPenrrr rqs r]rSzAxisItem.textPens4 = 8OL99:: :x &&&r^c$d|_|s|rtj|i||_n&tjt d|_|j|jd<|dS)z Set the pen used for drawing text. If no arguments are given, the default foreground color will be used. Nrr) r5rrrr rrrArrs r]rLzAxisItem.setTextPens   D6 DHd5f55DMMH_\%B%BCCDM#'=#6#6#8#8#=#=#?#?  r^cj|j|Stj|jSrn)_tickPenrRrrrqs r]rTzAxisItem.tickPens* = 88:: 8DM** *r^cd|_|s|rtj|i||_nd|_|dS)z{ Set the pen used for drawing tick marks. If no arguments are given, the default pen will be used. N)r5rrrrrs r]rMzAxisItem.setTickPensQ   !6 !Hd5f55DMM DM r^cV||jkr||_|dSdS)z Set the value scaling for this axis. Setting this value causes the axis to draw ticks and tick labels as if the view coordinate system were scaled. By default, the axis scaling is 1.0. N)rFr)rQrFs r]setScalezAxisItem.setScales8 DJ  DJ          r^c<||_|dS)aM Enable (or disable) automatic SI prefix scaling on this axis. When enabled, this feature automatically determines the best SI prefix to prepend to the label units, while ensuring that axis values are scaled accordingly. For example, if the axis spans values from -0.1 to 0.1 and has units set to 'V' then the axis would display values -100 to 100 and the units would appear as 'mV' This feature is enabled by default, and is only available when a suffix (unit string) is provided to display on the label. N)rGr)rQenables r]enableAutoSIPrefixzAxisItem.enableAutoSIPrefixs$# !!!!!r^c |jr|jrdtj|jz}n|j}t jtt|d|j zt|d|j z\}}|j dkr|dvrd}d}||_ ||_ nd|_ |dS)Nrrrr)rmr1)r4rrBnparrayrangersiScalerabsrFr?rHr@r)rQ_rangerFprefixs r]rzAxisItem.updateAutoSIPrefix&s :   ! ! )| $RXdj111 jS4:1E-F-FFSTIVZV`L`HaHa)b)bccOUF"$$:)=)=%*D "#)D %(D " r^c$t|rt|s0tdt|dt|d||g|_|jr|dSd|_|dS)zSet the range of values displayed by the axis. Usually this is handled automatically by linking the axis to a ViewBox with :func:`linkToView `zNot setting range to [z, ]N)rr7strrrGrr5rh)rQmnrs r]rJzAxisItem.setRange7s|| R8B<< R)s2wwwwBPQQ Q"X     # # % % % % %DL KKMMMMMr^c<|jdS|S)z*Return the ViewBox this axis is linked to.N)rNrqs r] linkedViewzAxisItem.linkedViewDs"   #4##%% %r^c.|tj||_|jdvr |j|jn|j|j|j |jdS)Nrr) unlinkFromViewweakrefrefrNr6sigYRangeChangedconnectlinkedViewChangedsigXRangeChanged sigResizedrQviews r]rOzAxisItem._linkToView_internalKs ";t,,  0 0 0  ! ) )$*@ A A A A  ! ) )$*@ A A A  677777r^c0||dS)z`Link this axis to a ViewBox, causing its displayed range to match the visible range of the view.N)rOrs r] linkToViewzAxisItem.linkToViewWs !!$'''''r^c|}d|_|jdvr"||j|jn!||j|j|!|j|jdSdS)z Unlink this axis from a ViewBox.Nr)rrNr6r disconnectrrr)rQoldViews r]rzAxisItem.unlinkFromView[s//##  0 0 0"(33D4JKKK"(33D4JKKK     ) )$*@ A A A A A  r^cX|jdvrQ||d}|r|j|ddddS|j|dS||d}|r|j|ddddS|j|dS)Nrrr)r6 viewRange yInvertedrJ xInverted)rQrnewRanges r]rzAxisItem.linkedViewChangedis  0 0 0>>++A.~~ ) x"~.... x((((>>++A.~~ ) x"~.... x((((r^c vd}|jd}|durn3|durd}n, t|jd}n#t$rYnwxYw|}| |jdur||}|jd}|jdkr)|d| td| |}n|jdkr(|td|| d|}nf|jd kr)|| d|td| }n2|jd kr'|| td||d}|S||| || zS) Nrr(TFr-rrrr) r9rcrdrrPmapRectFromParentgeometryr6adjustedmin mapRectToItemr)rQrr\rrecttls r]rzAxisItem.boundingRectys "&*-D"E "d * *  $ - -AA $$;<>> # # #tt #__&&  e!3!3))$--//::DL)B6))}}QS2YYJ::!W,,}}S2YYAq99!U**}}aRAAb z::!X--}}aRQrAq99K))$--//::Z=U=UVZ\f\s\s\u\u=v=vv vs8 AActj}|j tj}tj|}|jdr ||jd||}|d||j |g|R|d| n#| wxYw||_|j |dS)Nr)zgenerate specsz draw picture) r Profilerr5rQPictureQPainterr9setFontgenerateDrawSpecs drawPictureendplay)rQroptwidgetprofilerr5painterspecss r]paintzAxisItem.paints>## <  .**.11:j)<OODJz$:;;;..w77)***$$D$W5u5555H^,,,  "DL !s BCCr1cJ||_d|_|dS)a The default behavior is to show at least two major ticks for axes of up to 300 pixels in length, then add additional major ticks, spacing them out further as the available room increases. (Internally, the targeted number of major ticks grows with the square root of the axes length.) Setting a tick density different from the default value of `density = 1.0` scales the number of major ticks that is targeted for display. This only affects the automatic generation of ticks. N)rCr5rh)rQdensitys r]setTickDensityzAxisItem.setTickDensitys$$  r^cJ||_d|_|dS)atExplicitly determine which ticks to display. This overrides the behavior specified by tickSpacing(), tickValues(), and tickStrings() The format for *ticks* looks like:: [ [ (majorTickValue1, majorTickString1), (majorTickValue2, majorTickString2), ... ], [ (minorTickValue1, minorTickString1), (minorTickValue2, minorTickString2), ... ], ... ] The two levels of major and minor ticks are expected. A third tier of additional ticks is optional. If *ticks* is None, then the default tick system will be used instead. N)rDr5rh)rQtickss r]setTickszAxisItem.setTickss$!  r^ch| |d}n|df|dfg}||_d|_|dS)a Explicitly determine the spacing of major and minor ticks. This overrides the default behavior of the tickSpacing method, and disables the effect of setTicks(). Arguments may be either *major* and *minor*, or *levels* which is a list of (spacing, offset) tuples for each tick level desired. If no arguments are given, then the default behavior of tickSpacing is enabled. Examples:: # two levels, all offsets = 0 axis.setTickSpacing(5, 1) # three levels, all offsets = 0 axis.setTickSpacing(levels=[(3, 0), (1, 0), (0.25, 0)]) # reset to default axis.setTickSpacing() Nr)rEr5rh)rQmajorminorlevelss r]setTickSpacingzAxisItem.setTickSpacingsG* >} !*uaj1"  r^c|j|jSt||z }|dkrgSd}tdd|jzt ||z z}||z }t |\}} dt | dz dz dz z} d| z|krd } | dz} nd D] } | | z|krn| | z} d |z|z } | d krd }nd }|D]}|| z}|| krn| df|dfg}|jdd krT| d krd}n| dkrd}n | dkrd}nd}|}|D]}|| z}|| ks||krn||kr||df|S)aReturn values describing the desired spacing and offset of ticks. This method is called whenever the axis needs to be redrawn and is a good method to override in subclasses that require control over tick locations. The return value must be a list of tuples, one for each set of ticks:: [ (major tick spacing, offset), (minor tick spacing, offset), (sub-minor tick spacing, offset), ... ] Nrgr@g@g$@rgly O @gY@r)2rr )rr)rrrr.)rr rrr)r rrrr)rrr) rErrrCrrrr9append)rQminValmaxValrdifref_sizeminNumberOfIntervalsmajorMaxSpacingmantissaexp2p10unitmajorScaleFactor majorIntervalminorMinSpacingtrialsminorScaleFactor minorIntervalr extraIntervalextraScaleFactors r] tickSpacingzAxisItem.tickSpacings3   ($ $&6/"" !88I"  4$ $tDM':': :    44//$ a"#     '>_ , ,!  sNGG$0   #g-@@EA(72 c'$, r ! !FF!F &   ,w6M//0A  A   :n % * *2%%&!R'''!R''$ - $*   07 :  O33} 7U7UE8V},, }a0111 r^c "t||f\}}||jz}||jz}g}||||}tjg}t t |D]}||\}} t|| z |z |z| z} t|| z |z dz} tj | |z| z|jz } tj tj || ddtj fd||jz dzd} | | } tj || g}|||jz | f|jr|||||S|S)a\ Return the values and spacing of ticks to draw:: [ (spacing, [major ticks]), (spacing, [minor ticks]), ... ] By default, this method calls tickSpacing to determine the correct tick locations. This is a good method to override in subclasses. rNrg{Gz?)rtolatolraxis)sortedrFr0rrrrerrcarangeanyisclosenewaxis concatenatertolistrB logTickValues)rQrr rr tickLevels allValuesispacingoffsetstartnumvaluesrrs r] tickValueszAxisItem.tickValuesBs  011 $*$*%%ffd;; HRLL s:'' @ @A(mOGV6&=G344w>&HEve|w.//!3Cinnw.6$*DFF 9fQQQ ]&;!'RVR\J\]aJabbbEUF^F 6':;;I LL'$*,fmmoo> ? ? ? ? < C%%ffdEBB B r^c g}|D]"\}}|dkr|||f#t|dkrtt}tt } g} t || D]?} | | tjtj ddz@fd| D} |d| f|S)Nr1rrc,g|]}|k|k|Srr)rrwr rs r]rz*AxisItem.logTickValues..s&???16ahhQhhhr^) rrercrrrextendrrr7) rQrr rstdTicksrrAtv1v2rvs `` r]r=zAxisItem.logTickValues{s $ + +LWa#~~ gq\*** u::>>U6]]##BT&\\""BE2r]] = = Q")Ar*:*:!;!;;<<<<????????E LL$ ' ' ' r^c H|jr||||Stdtt ||z }g}|D]P}||z}t |dkst |dkrd|z}nd|z|z}||Q|S)azReturn the strings that should be placed next to ticks. This method is called when redrawing the axis and is a good method to override in subclasses. The method is called with a list of tick values, a scaling factor (see below), and the spacing between ticks (this is required since, in some instances, there may be only one tick and thus no other way to determine the tick spacing) The scale argument is used when the axis label is displaying units which may have an SI scaling prefix. When determining the text to display, use value*scale to correctly account for this prefix. For example, if the axis label's units are set to 'V', then a tick value of 0.001 might be accompanied by a scale value of 1000. This indicates that the label is displaying 'mV', and thus the tick should display 0.001 * 1000 = 1. rgMbP?i'z%gz%%0.%df)rBlogTickStringsrrrrr) rQrErFrAplacesstringsrOvsvstrs r] tickStringszAxisItem.tickStringss < ?&&vug>> >QeGEM2223344 ! !AUB2ww~~RE!1!1by!F*b0 NN4 r^c B ddtj|tztj|zD}ddddddd d d d d g}|D]}|dr|d\}}|ddkrdnd} d fd|dddD} |dkrd}n|dz}||dz| z| z|||S)Ncg|]}d|zS)z%0.1gr)rrws r]rz+AxisItem.logTickStrings..s^^^!GAI^^^r^ru⁰¹²³u⁴u⁵u⁶u⁷u⁸u⁹) 0123456789er-u⁻rc g|] }| Srr)rppconvdicts r]rz+AxisItem.logTickStrings..sHHHx|HHHr^rr\r]·10) rrastypefloatcountsplitrlstripr) rQrErFrAestringsdstringsrfrOrsignpotrjs @r]rQzAxisItem.logTickStringssJ^^rRXf-=-=-D-DU-K-K'KbhW\oo']^^^   # #Awws|| #wws||1 !! uuggHHHHaell36G6GHHHII88AADAD4# 56666""""r^c BCtj}|jd ||jd||}|}| |jdur|}n(||| }d}d}d}d} |j dkrx| t||z| t|| zf} |} |} d} d}n|j d krx|t||z|t|| zf} |} |} d } d}n|j d krw|t||z| t||zf} |} |} d} d }n|j d krw|t|| z| t|| zf} |} |} d } d }nt)d t+t-|j| }d|vrdSt|d |dz }|dkrdS|j0||jd|jd |}d}npg}g}|jD]d}g}g}|d|f|||D]/\}}||||0e|jd |jdz }|dkrd CdBnk|dkr>| |z C|jdCz|z Bn'||z C|jdCzBBCfd|jD}t?|}tA|}|dg}g}t7tC|D]}|g||d }|jd|dzdzz } |jd}!|!Ld|d zz }!|jdur:|!|jdz tEj#d|ztC|d zz ddzz}!ntI|!tJrZ|!dz}!tAdtMtO|!}!t?dtMtO|!}!n@tI|!tLr|!dks|!dkrt)dntQd|)}"|"*tVj,j-j.krqt_j0|"}"t_j1|"2}#|#3tM|!|"4|#|D]}$|$CzBz }%|%|ks|%|kr||d2|||%|%|%g}&|%|%g}'| |&|<| |'|<|jdur|'|xx| | zz cc<||"t|&t|'f|d|jdddurt?t-t>|}(|dkrDtA| d5|(})| d6|)nCtA| d7|(})| d8|)|jdd durtAt-t@|}*|dkrDt?| d 5|*})| d 6|)nCt?| d 7|*})| d 8|)|9| d| d f}+|jd|},d}-d}.g}/g}0|jds|+||0fSt7t?tC||jdd zD]}|0||\}1}|:||j;|j<z|1}n||}tC|dkrQt7tC|D]}2|||2d||2<g}3|D]}4|4|3d| tWj=ddddtVj,j>j?|4}5|5@|5d z|3|5|/|3dtC|/dkr|dkr=tjBd!|/D}6tj d"|/D}-nAtjBd#|/D}6tj d$|/D}-nd}6d}-|dkrItK|6|z }7d}8|jd%D]"\}9}:tC|0|9kr |7|:krd}8n#|8rne|-}.t7tC|D]C}2||2};|;|||2}%|3|2}<|<}=|<}>tAd|jd|,zBtWj=}?|j dkrRtVj,j>jCtVj,j>jDz}@tWj=| Bz |>z |%|=d&z z |>|=}?n |j d krNtVj,j>jEtVj,j>jDz}@tWj=| Bz|%|=d&z z |>|=}?n|j d krQtVj,j>jFtVj,j>jGz}@tWj=|%|>d'z z | Bz |=z |>|=}?nX|j d krMtVj,j>jFtVj,j>jHz}@tWj=|%|>d'z z | Bz|>|=}?|@tVj,jIjJz}A| }5|5K|?s+|0|?|A|;fE|d(|L|.|+||0fS))z Calls tickValues() and tickStrings() to determine where and how ticks should be drawn, then generates from this a set of drawing commands to be interpreted by drawPicture(). r)NFgr1rrrrrrrz>self.orientation must be in ('left', 'right', 'top', 'bottom')c g|] }|zz  Srr)rrwrBxScales r]rz.AxisItem.generateDrawSpecs..#s":::!!f*v%:::r^initr-g?r0go@g?gzlineAlpha should be [0..255]z/Line Alpha should be of type None, float or intz compute ticksr*Tr#r,r/dr c6g|]}|Srrrrs r]rz.AxisItem.generateDrawSpecs..s &E&E&Eaqxxzz&E&E&Er^c6g|]}|Srrr~s r]rz.AxisItem.generateDrawSpecs..s 'E'E'Ea 'E'E'Er^c6g|]}|Srrr~s r]rz.AxisItem.generateDrawSpecs..s &D&D&DQqwwyy&D&D&Dr^c6g|]}|Srr}r~s r]rz.AxisItem.generateDrawSpecs..s 'F'F'Fq 'F'F'Fr^r+r rz compute text)Mr rr9rrrrrPrrr6topRightr bottomRightrtopLeft bottomLeftrrrrdlistmap mapToDevicelengthrDrFrrrrrrrer clip_scalarrbrnrcround TypeErrorrTbrushrQt BrushStyle SolidPatternrQPenQColorrsetAlphasetColorrxrrwrrRrVrHrFQRectF AlignmentFlag AlignCenterrrsum AlignRight AlignVCenter AlignLeft AlignHCenter AlignBottomAlignTopTextFlag TextDontClipcontainsr)DrQrr boundsr tickBounds left_offset right_offset top_offset bottom_offsetspan tickStarttickStoptickDirr5pointslengthInPixelsr>rVlevelrErSvalstrnr!xRangexMinxMax tickPositions tickSpecsr@rr- lineAlpharTrrOrwp1p2minTickPositionstopmaxTickPositionaxisSpec textOffset textSize2 lastTextSize2 textRects textSpecsrAjrectsrrtextSize textFillRatiofinishednTextslimitrUtextRectrrr alignFlags textFlagsrBrxsD @@r]rzAxisItem.generateDrawSpecss >## :j ! - IIdj, - - -'' 88__&&  e!3!3JJ#11$ 8O8O8Q8QRRJ     v % %OO%%k:(F(FF&&((5m+L+LLND"((**I||~~HGDD   ( (NN$$u\:'F'FF%%''% m*L*LLND"))I{{}}HGDD   & &%%''% Z*H*HH&&((5z+J+JJLD"))++I}}HGDD   ) )NN$$u[-'H'HHOO%%lM(J(JJLD"((Izz||HGDD]^^ ^c$*D1122 6>> Fvay6!9455<<>> Q   F   #A 1 ~VVJKKJK) ) )!!4.111""7+++!&))ICMM#&&&NN4(((() jmdjm+ !88FFFqyy --//)C/A/&--//A#-A/:::::tz:::6{{6{{  s:''* B* BA   $ $ $qM!$EL1aeS[AJ ;/I 1Q3K 9E))4".$.BX\_`e\f\fgh\hBilnpr2s2s!ssIIu-- SS 3uY'7'7#8#899 Sy)9)9%:%:;; Is++ SOOQ$%CDDD*7 QRRRllnnG}}$$&&&)*>*KKK*W-- W]]__55s9~~...  ''' B BZ6)t88q4xx!!$++D111a ''***VV$4#49%%tHHH 7 22HHH  '599eBii!@AAAA B !!! :& ' *d 2 2!#c="9"9::Oqyy4799;;88Q T""""4799;;88Q T""" :& ' *d 2 2!#c="9"9::Oqyy4799;;88Q T""""4799;;88Q T"""HHJJQa1Z 01$7     z,' 4i3 3s3z??DJ~,Fq,HIIJJ^ :^ :A"",Q-**643IDJ3VX_``%a.7||q  3w<<(( & & #A&.!%GAJE 0 09LL&&&& aC(E(EvyG^GjlmnnBLLs!2333LL$$$$$U2Y////9~~!!199!v&E&E9&E&E&EFFH "'E'E9'E'E'E F FII!v&D&D)&D&D&DEEH "'F'FI'F'F'F G GII 1uu!&h. @  %)Z0@%AMFE9~~//MU4J4J#'E%M 3w<<((" :" :qz<!!$Q' 8!** ((Qtz,788:E}#v--!'!8!CFID[Dh!hJ!=&)>6!8 eU[\\DD%00!'!8!B69CZCg!gJ!=&!VAX,vVVDD%..!'!8!EfiF]Fi!iJ!=58Xf_V5KUTZ[D%11!'!8!EfiF]Ff!fJ!=58Xf_eVTTD&);)HH &&(({{4((  $ 4!89999E" :F      ...)Y//r^ctj}||jjd||jjd|\}}}||||||D]1\}}}|||||2|d|jd | |jd|| | } | | |D]*\} } } || t| | +|ddS)NFTz draw ticksr)z draw text)r r setRenderHint RenderHint AntialiasingTextAntialiasingrKdrawLiner9rrSr toAlignedRect setClipRectdrawTextrc) rQrrrrr rRrrboundingrflagsrXs r]rzAxisItem.drawPicturesz>##  15999  5t<<< R   2r%  KCR HHSMMM JJr2     :j ! - IIdj, - - -    $$&&4466 h!* / / D% JJtSZZ . . . .r^ctj||jdvr|dS|dSr)rrr6rrrqs r]rz AxisItem.showRD!!!  0 0 0            r^ctj||jdvr|dS|dSr)rhider6rrrqs r]rz AxisItem.hide rr^cl|}|dS||r|dS|jdvr||dn||d|dSNrrr4r)rsceneBoundingRectrscenePosignorer6 wheelEventacceptrQeventlvs r]rzAxisItem.wheelEvents __   : F   ! ! * *5>>+;+; < < - LLNNN F#444 e! ,,,, e! ,,, r^c>|}|dS||r|dS|jdvr||dS||dSr)rrrbuttonDownScenePosrr6mouseDragEventrs r]rzAxisItem.mouseDragEvent!s __   : F   ! ! * *5+C+C+E+E F F  LLNNN F  0 0 0$$U$33 3$$U$33 3r^c\|}|dS||Srn)rmouseClickEventrs r]rzAxisItem.mouseClickEvent/s/ __   : F!!%(((r^) NNNNNrTrrrrn)T)NNN)r1)5__name__ __module__ __qualname____doc__r2rlrrrurzr~rrIrrrrrgrrrrrRrKrSrLrTrMrrrrJrrOrrrrrrrrr0rFr=rVrQrrrrrrrrr^r]rrsNffffTMMM^&&&   $$$L   4 & & & &####J 9 9 9%%%4!!! ,,###   '''   +++        """"$"   &&& 8 8 8((( B B B)))) www<*    $>TTTn777r,68\0\0\0|:!!!!!! 4 4 4)))))r^)rmathrrrrrrnumpyrrr r rr r rrrrr__all__rrr^r]rs AAAAAAAAAAAAAAAAAA))))))))))****** ,e)e)e)e)e)~e)e)e)e)e)r^