Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 Nebxeã@s dZdZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZddlTddlmZddlmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#dd l$m%Z%m&Z&m'Z'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0dvdd„Z1dwdd„Z2dxdd„Z3dd„Z4Gdd„dƒZ5Gdd„dƒZ6Gdd„dƒZ7Gdd„dƒZ8Gdd „d e"ƒZ9Gd!d"„d"e&ƒZ:Gd#d$„d$e9ƒZ;d%d&„ZGd+d,„d,e>ƒZ?Gd-d.„d.e>e;ƒZ@Gd/d0„d0e?e;ƒZAGd1d2„d2ƒZBd3d4„ZCGd5d6„d6e9ƒZDGd7d8„d8e>eDƒZEd9d:d;dd?d@dAdBdCdDg ZFdEdFdEdGdEdGdEdEdGdEdGdEg ZGdHdI„ZHGdJdK„dKeƒZIeIƒZJdyZKGdbdc„dceEƒZLGddde„dee?eDƒZMGdfdg„dgƒZNGdhdi„dieNeEƒZOGdjdk„dkeMƒZPGdldm„dmeDƒZQGdndo„doeBƒZRGdpdq„dqƒZSGdrds„dseQeSeEƒZTGdtdu„dueQeSeMƒZUdS)zz3.3.0aCollection of axes for charts. The current collection comprises axes for charts using cartesian coordinate systems. All axes might have tick marks and labels. There are two dichotomies for axes: one of X and Y flavours and another of category and value flavours. Category axes have an ordering but no metric. They are divided into a number of equal-sized buckets. Their tick marks or labels, if available, go BETWEEN the buckets, and the labels are placed below to/left of the X/Y-axis, respectively. Value axes have an ordering AND metric. They correspond to a nu- meric quantity. Value axis have a real number quantity associated with it. The chart tells it where to go. The most basic axis divides the number line into equal spaces and has tickmarks and labels associated with each; later we will add variants where you can specify the sampling interval. The charts using axis tell them where the labels should be placed. Axes of complementary X/Y flavours can be connected to each other in various ways, i.e. with a specific reference point, like an x/value axis to a y/value (or category) axis. In this case the connection can be either at the top or bottom of the former or at any absolute value (specified in points) or at some value of the former axes in its own coordinate system. é)Úlog10)ÚisNumberÚisNumberOrNoneÚisListOfStringsOrNoneÚisListOfNumbersÚisListOfNumbersOrNoneÚ isColorOrNoneÚOneOfÚ isBooleanÚ SequenceOfÚisStringÚEitherOrÚ ValidatorÚNoneOrÚ isNormalDateÚisNoneOrCallable)Ú*)Ú normalDate)ÚDrawingÚLineÚPolyLineÚRectÚGroupÚSTATE_DEFAULTSÚ_textBoxLimitsÚ_rotatedBoxLimits)ÚWidgetÚTypedPropertyCollection)ÚLabelÚPMVLabelÚXLabelÚDirectDrawFlowable)ÚnextRoundNumber)Ú ShadedRect)ÚColor)ÚisSeqNcCs‚t|ddƒrH|r&|||fdd„}n |fdd„}tt|fdd„|ƒƒ}tttdd„|Dƒƒƒ}t|ƒdkrp|S|tt||ƒƒƒS)NrcSs ||||ƒS)N©)ÚTÚxÚspecialÚfuncr&r&ú?/tmp/tmp4i9tl1d3/lib64/python/reportlab/graphics/charts/axes.pyÚ5sz"_findMinMaxValue..cSs||S)Nr&)r'r(r&r&r+r,7scSstt||ƒƒS)N)ÚlistÚmap)ÚeÚfr&r&r+r,8scSsg|]}dd„|Dƒ‘qS)cSsg|]}|dk r|‘qS)Nr&)Ú.0r(r&r&r+ú 9sz/_findMinMaxValue...r&)r1r(r&r&r+r29sz$_findMinMaxValue..)r%r-r.ÚfilterÚlen)ÚVr(Údefaultr*r)r0r&r&r+Ú_findMinMaxValue2s  r7cCst|||t|d�S)zfind minimum over V[i][x])r))r7Úmin)r5r(r6r)r&r&r+Ú_findMin=sr9cCst|||t|d�S)zfind maximum over V[i][x])r))r7Úmax)r5r(r6r)r&r&r+Ú_findMaxAsr;c Cs2x,|D]$}yt|ƒ|krdSWqdSqWdS)ztrue if all values are intré)Úint)ÚvaluesÚvr&r&r+Ú_allIntEs  r@c@s eZdZdZdd„Zdd„ZdS)ÚAxisLabelAnnotationaKCreate a grid like line using the given user value to draw the line v value to use kwds may contain scaleValue True/not given --> scale the value otherwise use the absolute value labelClass the label class to use default Label all Label keywords are acceptable (including say _text) cKs||_||_dS)N)Ú_vÚ_kwds)Úselfr?Úkwdsr&r&r+Ú__init__WszAxisLabelAnnotation.__init__cCs‚|jjƒ}|jdtƒ}|jddƒ}t|dƒs4|jƒ|r>|jndd„|jƒ}|jr^|j }|}n |}|j }||d<||d<|f|ŽS) NÚ labelClassÚ scaleValueTÚ _tickValuescSs|S)Nr&)r(r&r&r+r,asz.AxisLabelAnnotation.__call__..r(Úy) rCÚcopyÚpoprÚhasattrÚ_pseudo_configureÚscalerBÚisYAxisÚ_xÚ_y)rDÚaxisrErGrHÚsvr(rJr&r&r+Ú__call__[s    zAxisLabelAnnotation.__call__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rFrUr&r&r&r+rANsrAc@s eZdZdZdd„Zdd„ZdS)ÚAxisLineAnnotationaCreate a grid like line using the given user value to draw the line kwds may contain startOffset if true v is offset from the default grid start position endOffset if true v is offset from the default grid end position scaleValue True/not given --> scale the value otherwise use the absolute value lo lowest coordinate to draw default 0 hi highest coordinate to draw at default = length drawAtLimit True draw line at appropriate limit if its coordinate exceeds the lo, hi range False ignore if it's outside the range all Line keywords are acceptable cKs||_||_dS)N)rBrC)rDr?rEr&r&r+rFyszAxisLineAnnotation.__init__c s|jjƒ}|jddƒ}|jddƒ}|jddƒ}|jrB|j}|j}n |j}|j}|jddƒ}|jddƒ} |dksv| dkrÜtt|ddƒd dƒ} | ržt| d ƒrž| ƒ} | rÄ|dkr²| d }| dkrÜ| d } n|dkrÐd }| dkrÜd } |jd |jƒ|} |jdd ƒ|} t | | ƒt | | ƒ} } |jddƒ} |j }|�s6dd„|_ zÐ|j }|�rN|| }n|�r\|| }|j ||| ||jddƒƒ}t|dƒ�sŽ|jƒ|j |ƒ‰ˆ| k�s¬ˆ| k�rØ| �s¶dSˆ| k�rÆ| ‰n| ‰‡fdd„|_ ||ƒ}x"|jƒD]\}}t|||ƒ�qêWWd||_ X|S)NrHTÚ endOffsetFÚ startOffsetÚstartÚendÚjoinAxisÚ getGridDimsrUrr<ÚhiÚloÚ drawAtLimitcSs|S)Nr&)r(r&r&r+r,šsz-AxisLineAnnotation.__call__..ÚparentrIcsˆS)Nr&)r()Údr&r+r,«s)rCrKrLrPrQrRÚgetattrrMÚ_lengthr8r:Ú _get_line_posrBÚ _getLineFuncrNÚitemsÚsetattr)rDrSrErHr[r\ÚoffsÚd0Úsr/ÚdimrarbrcZoaglpr?r*ÚLÚkr&)rer+rU}sj             zAxisLineAnnotation.__call__N)rVrWrXrYrFrUr&r&r&r+rZls rZc@s eZdZdZdd„Zdd„ZdS)ÚAxisBackgroundAnnotationaCreate a set of coloured bars on the background of a chart using axis ticks as the bar borders colors is a set of colors to use for the background bars. A colour of None is just a skip. Special effects if you pass a rect or Shaded rect instead. cKs||_||_dS)N)Ú_colorsrC)rDÚcolorsrEr&r&r+rF¸sz!AxisBackgroundAnnotation.__init__c CsN|j}|sdS|jjƒ}|j}|r0|j}|j}n |j}|j}|jddƒ}|jddƒ}|dksd|dkrÊtt|ddƒddƒ} | rŒt| dƒrŒ| ƒ} | r²|dkr | d}|dkrÊ| d}n|dkr¾d}|dkrÊd}t|dƒsÜ|j ƒt|ddƒ} | sðdSt ƒ} t |ƒ} |j | dƒ} �x:t dt | ƒƒD�]&}|j | |ƒ}||d| }|�r@|�rh| }|}|| }||}n| }|}|| }||}t|tƒ�r¢t|||||dd �}n”t|tƒ�rìt||||ƒ}xx|jD]"}|dk�rÄt||t||ƒƒ�qÄWnJt|tƒ�r6t||||d�}x,|jD]"}|dk�rt||t||ƒƒ�qW| j|ƒ|} �qW| S)Nr]r^r_r`rUrr<rI)Z fillColorÚ strokeColorr(rJÚwidthÚheight)r(rJrvrw)r(rJrvrw)r(rJrvrw)rsrCrKrPrQrRrLrfrMrNrr4rhÚrangeÚ isinstancer$rÚ__dict__rkr#Úadd)rDrSrtrErPrlrmrnr/roÚtvÚGZncolorsZv0ÚiZv1ÚcrJr(rwrvÚrrqr&r&r+rU¼sz                z!AxisBackgroundAnnotation.__call__N)rVrWrXrYrFrUr&r&r&r+rr³srrc@s(eZdZdZdd„Zdd„Zdd„ZdS) ÚTickLUz$lookup special cases for tick valuescOs|jddƒ|_||_dS)NÚaccuracyg:Œ0âŽyE>)rLr‚r')rDr'rEr&r&r+rFúszTickLU.__init__cCs2|j}x&|jD]\}}t||ƒ|krdSqWdS)NTF)r‚r'Úabs)rDÚtr‚r(r?r&r&r+Ú __contains__ýs zTickLU.__contains__cCs@|j}x(|jD]\}}t||ƒ|jkr|SqWtd|ƒ‚dS)Nzcannot locate index %r)r‚r'rƒÚ IndexError)rDr„r‚r(r?r&r&r+Ú __getitem__s zTickLU.__getitem__N)rVrWrXrYrFr…r‡r&r&r&r+r�øsr�c@s²eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d d „Zd gifdd„Z d d gfdd„Z d d gfdd„Z d!dd„Z dd„Z ee ƒZ dd„ZeeƒZd"dd„Zdd„Zdd„Zd S)#Ú_AxisGc Cs(|j|ƒ}y |d}Wn YnX|S)Nr)rO)rDr?r&r&r+rh s   z_AxisG._get_line_poscCs$|j|ƒ}t||j|||j|ƒS)N)rhrrR)rDr(r]r^r&r&r+Ú_cxLines z_AxisG._cxLinecCs$|j|ƒ}t|j|||j||ƒS)N)rhrrQ)rDrJr]r^r&r&r+Ú_cyLines z_AxisG._cyLinec Cs\|j|ƒ}|j|}|j|}t||ƒt||ƒ}}||}t||||||||gdd�S)Nr<)ÚstrokeLineJoin)rhrRr8r:r) rDr(r]r^Ú_3d_dxÚ_3d_dyÚy0Úy1Úx1r&r&r+Ú _cxLine3ds    z_AxisG._cxLine3dc Cs\|j|ƒ}|j|}|j|}t||ƒt||ƒ}}||}t||||||||gdd�S)Nr<)r‹)rhrQr8r:r) rDrJr]r^rŒr�Úx0r�r�r&r&r+Ú _cyLine3d#s    z_AxisG._cyLine3dNcCslt|ddƒ}|dk rFt|ddƒ}|jr,|jp0|j}|||||fdd„S|jrR|jpV|j}|||fdd„SdS)NrŒr�cSs||||||d�S)N)rŒr�r&)r?rnr/r0rŒr�r&r&r+r,0sz%_AxisG._getLineFunc..cSs ||||ƒS)Nr&)r?rnr/r0r&r&r+r,3s)rfrPr“r‘rŠr‰)rDr]r^rdrŒr�r0r&r&r+ri+s  z_AxisG._getLineFuncc sÎ|j||| ƒ} t|dƒs |jƒˆrD|jr6‡fdd„p@‡fdd„}nd}x€|jD]v}| |ƒ}|rj||ƒrjqP||_||_||_||_||_ | |_ || kr¼x$| |j ƒD]\}}t |||ƒq¤W|j |ƒqPWdS)NrIcs |jˆkS)N)r�)Úl)Úexcluder&r+r,:sz#_AxisG._makeLines..cs |jˆkS)N)r�)r”)r•r&r+r,:s)rirMrNrPrIruÚ strokeWidthÚstrokeDashArrayr‹Ú strokeLineCapÚstrokeMiterLimitrjrkr{)rDÚgr]r^rur–r—r‹r˜r™rdr•Úspecialsr*Zexfr„rpÚar?r&)r•r+Ú _makeLines5s(    z_AxisG._makeLinesc Csø|j}|jpd}|râ|râ|jrâ|j}|j}|dks:|dkrŒ|rNt|dƒrN|ƒ}|rt|dkrb|d}|dkrŒ|d}n|dkr€d}|dkrŒd}|s”|râ|jr¢|j} n|j} |j ||| || |||j |j |j |j ||t|diƒd� |j|||gd�dS)z)this is only called by a container objectrNrUr<Z _gridSpecials)rdr•r›)r•)ÚgridStrokeColorÚgridStrokeWidthÚ visibleGridÚ gridStartÚgridEndrMrPrQrRr�ÚgridStrokeDashArrayÚgridStrokeLineJoinÚgridStrokeLineCapÚgridStrokeMiterLimitrfÚ _makeSubGrid) rDršrordr•rÚwrnr/rlr&r&r+ÚmakeGridKs.  :z_AxisG.makeGridc Cs t|ddƒo|jdksdS|j}|jp(d}|o0|s6dS|j}|j}|dksR|dkr¤|rft|dƒrf|ƒ}|rŒ|dkrz|d}|dkr¤|d}n|dkr˜d}|dkr¤d}|s®|�r|jr¼|j} n|j } |j ƒ} z4|j ||| || |||j |j |j|j||d� Wd| |_XdS)z)this is only called by a container objectÚvisibleSubGridrNrUr<)rdr•)rfÚ subTickNumÚsubGridStrokeColorÚsubGridStrokeWidthÚ subGridStartÚ subGridEndrMrPrQrRÚ _calcSubTicksr�ÚsubGridStrokeDashArrayÚsubGridStrokeLineJoinÚsubGridStrokeLineCapÚsubGridStrokeMiterLimitrI) rDršrordr•rr¨rnr/rlÚotvr&r&r+r§as8   4z_AxisG._makeSubGridcCs4|dkr|j|jf|j}|dkr,||j}||fS)N)rQrRrPrg)rDr]r^r&r&r+r`{s  z_AxisG.getGridDimscCs8t|ddƒdkrdS|jj}|ddkp6|dd…dkS)NÚ _dataIndexr<TrÚYéZAdjY)rfÚ __class__rV)rDÚacnr&r&r+rP€sz_AxisG.isYAxiscCs8t|ddƒdkrdS|jj}|ddkp6|dd…dkS)Nr¶rTÚXé Ú NormalDateX)rfr¹rV)rDrºr&r&r+ÚisXAxis†sz_AxisG.isXAxiscCs4|dkrt|dgƒx|D]}|j||ƒƒqWdS)NÚ annotations)rfr{)rDršÚAr(r&r&r+ÚaddAnnotationsŒs  z_AxisG.addAnnotationscCsŠt|dgƒdd…}i}x\d D]T}gj}gj}x*|D]"}t||d ƒrN||ƒq4||ƒq4W|j||<|j|dd…<qW|d |7<|S) Nr¿ÚearlyÚ beforeAxisÚ afterAxisÚ beforeTicksÚ afterTicksÚbeforeTickLabelsÚafterTickLabelsÚlater)rÂrÃrÄrÅrÆrÇrÈrÉ)rfÚappendÚ__self__)rDrÀÚDr?ÚRÚPrœr&r&r+Ú_splitAnnotations‘s     z_AxisG._splitAnnotationscCsÂtƒ}|jƒ}|j||dƒ|jr®|j||dƒ|j|jƒƒ|j||dƒ|j||dƒ|j|jƒƒ|j||dƒ|j||dƒ|j|jƒƒ|j||dƒ|j||dƒ|S) NrÂrÃrÄrÅrÆrÇrÈrÉ)rrÏrÁÚvisibler{ÚmakeAxisÚ makeTicksÚmakeTickLabels)rDršrÀr&r&r+Údraw£sz _AxisG.draw)N)NN)N)rVrWrXrhr‰rŠr‘r“rir�r©r§r`rPÚpropertyr¾rÁrÏrÔr&r&r&r+rˆ s"   rˆc@s(eZdZeeeedd�d�Zdd„ZdS)ÚCALabelz?where in the category range [0,1] the labels should be anchored)Údesc)ÚBASEÚ labelPosFraccKstj|f|Ž|jdd�dS)Ngà?)rÙ)rrFÚ _setKeywords)rDÚkwr&r&r+rFºszCALabel.__init__N) rVrWrXÚAttrMaprÚ AttrMapValuerÚ_attrMaprFr&r&r&r+rÖ¶srÖc*@seZdZdZdZeeedd�eedd�eedd�eedd�eedd�eed d�ee d d�ee d d�ee d dd ƒdd�ee d dd ƒdd�eedd�eedd�ee dd�ee dd�ee d dd ƒdd�ee d dd ƒdd�eedd�ee dd�ee dd�eedd�eddd�ee dd�eddd�ee dd�eedd�ee d d!d"ƒd#ƒee d$d%d&d'ƒd(d�eed)d�ee d*d�ee d+d�eed,d�eed-d�edd.d�eed/d�eed0d�ee d1d2d3d4ƒd5ƒeed6d�d7�%Zd8d9„Zd:d;„ZdFdd?„Zd@dA„ZdBdC„ZdDdE„ZdS)GÚ CategoryAxisz+Abstract category axis, unusable in itself.r<zDisplay entire object, if true.)r×zDisplay axis line, if true.zDisplay axis ticks, if true.zDisplay axis labels, if true.zDisplay axis grid, if true.zWidth of axis line and ticks.zColor of axis line and ticks.zDash array used for axis line.réz#Line cap 0=butt, 1=round & 2=squarez$Line join 0=miter, 1=round & 2=bevelz$miter limit control miter line joinszWidth of grid lines.zColor of grid lines.zDash array used for grid lines.z(Grid Line cap 0=butt, 1=round & 2=squarez)Grid Line join 0=miter, 1=round & 2=bevelz)Grid miter limit control miter line joinsz#Start of grid lines wrt axis originz!End of grid lines wrt axis originz-if true draw gridlines after everything else.NzHandle of the axis labels.zList of category names.zJoin both axes if true.z*Position at which to join with other axis.z#If true reverse category direction.ÚparallelÚstackedÚ parallel_3dz$How common category bars are plottedÚhighÚlowrSÚaxispmvz*Like joinAxisMode, but for the axis labelszTick shift typicallyzWidth of ticks if specified.zColor of ticks if specified.z*extra inner space before start of the axisz'extra inner space after end of the axiszlist of annotationsz*extra line length before start of the axisz'extra line length after end of the axisÚnoneÚtopÚbothÚbottomz'grid lines to skip top bottom both nonez#Callable to replace _drawInnerTicks)%rÐÚ visibleAxisÚ visibleTicksÚ visibleLabelsr r–rur—r˜r‹r™rŸržr£r¥r¤r¦r¡r¢Ú drawGridLastÚlabelsÚ categoryNamesr_Ú joinAxisPosÚreverseDirectionÚstyleÚ labelAxisModeÚ tickShiftÚtickStrokeWidthÚtickStrokeColorÚloPadÚhiPadr¿ÚloLLenÚhiLLenÚskipGridÚ innerTickDrawcCs:|jjdkstdƒ‚d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ td|_td |_td |_|_td |_|_td |_|_d |_td|_td |_d|_|_td |_td |_td |_ttƒ|_d|_d|_ d|_!d|_"d|_#d|_$d|_%d|_&d|_'d|_(d|_)d|_*d|_+dS)Nrßz(Abstract Class CategoryAxis Instantiatedé2édrr<Frur—r‹r˜r™gÐ?rSrá),r¹rVÚAssertionErrorrQrRrgÚ _catCountrÐrërìrír rîr–rrur—r¤r‹r¥r˜r¦r™rŸržr£r¡r¢rrÖrïrðr_rñÚ joinAxisModerôròróÚ_labelTextFormatrõrørùrúrû)rDr&r&r+rFìsL         zCategoryAxis.__init__cCs"t|ƒ|_t|ƒ|_t|ƒ|_dS)N)ÚfloatrQrRrg)rDr(rJÚlengthr&r&r+Ú setPosition"s  zCategoryAxis.setPositioncsjttttˆƒƒƒ|_|p6|j|j|jt|jp2dƒ|_ |j ƒ|j dkrf‡fdd„t |jƒDƒ|_ dS)Nr<ræcs"g|]‰t‡fdd„ˆDƒƒ‘qS)csg|] }|ˆ‘qSr&r&)r1Zseries)r~r&r+r2-sz5CategoryAxis.configure...)Úsum)r1)Ú multiSeries)r~r+r2-sz*CategoryAxis.configure..)r:r-r.r4rrgrørùrÚ _barWidthÚ_calcTickmarkPositionsrôrxÚ_pmv)rDrÚbarWidthr&)rr+Ú configure(s & zCategoryAxis.configurecCsP|j}|jr"dd„t|ƒDƒ|_n*|jr:ttd|ƒƒ|_ntt|dƒƒ|_dS)NcSsg|] }|d‘qS)gà?r&)r1r„r&r&r+r22sz7CategoryAxis._calcTickmarkPositions..r<éÿÿÿÿ)rrõrxrIròr-)rDÚnr&r&r+r /s z#CategoryAxis._calcTickmarkPositionscCs|jr|j|d}|S)Nr<)ròr)rDÚidxr&r&r+Ú_scale9szCategoryAxis._scalecCs|j|ƒ|jfS)z/Returns the position and width in drawing units)ÚloScaler )rDrr&r&r+rO=szCategoryAxis.scalecCs|j|ƒd|jS)z-Returns the bar mid position in drawing unitsgà?)rr )rDrr&r&r+ÚmidScaleAszCategoryAxis.midScale)N)rVrWrXrYZ_nodocrÜrÝr rrrr rrrrÞrFrr r rrOrr&r&r&r+rßÁs^                             6  rßcCs|jstd|jjƒ‚dS)Nz/Cannot connect to other axes (%s), but Y- ones.)rPrr¹rV)rSr&r&r+Ú _assertYAxisEsrcCs|jstd|jjƒ‚dS)Nz/Cannot connect to other axes (%s), but X- ones.)r¾rr¹rV)rSr&r&r+Ú _assertXAxisGsrc@sTeZdZdZedd„ƒZedd„ƒZdd„Zdd d „Zd d „Z d d„Z ddd„Z dS)Ú_XTicksrcCst|d|jƒS)Nrö)rfr–)rDr&r&r+ÚactualTickStrokeWidthMsz_XTicks.actualTickStrokeWidthcCst|d|jƒS)Nr÷)rfru)rDr&r&r+ÚactualTickStrokeColorQsz_XTicks.actualTickStrokeColorc Csˆt|ddƒ}|r |||||ƒnd|s(|r„|j}|j}|r^|rL| rL||}n|r^| r^||}|j||| |j||j|j|j|jƒ dS)Nrý) rfrÚ _tickTweaksr�rr—r‹r˜r™)rDÚtUÚtDršZitdZsWZtWr&r&r+Ú_drawTicksInnerUs    z_XTicks._drawTicksInnerNcCs"|ptƒ}|jr|j|||ƒ|S)N)rrìr)rDrrršr&r&r+Ú _drawTickscs z_XTicks._drawTicksc CsHt|ddƒrD|jdkrD|jƒ}zd|_|j|||ƒWd|`||_XdS)NÚvisibleSubTicksrr<)rfr«r°Z _subTickingrrI)rDrrršrµr&r&r+Ú _drawSubTicksisz_XTicks._drawSubTicksc CsZ|j}zF|jt|ddƒƒ|_|j|j|jƒ}|jt|ddƒt|ddƒ|ƒ|S||_XdS)NÚ tickAxisModerSÚ subTickHirÚ subTickLo)rRÚ _labelAxisPosrfrÚtickUpÚtickDownr)rDZyoldršr&r&r+rÒssz_XTicks.makeTickscCs<|j}|r6|p|j}|dkr"|jS|dkr6|j|jS|jS)Nrårä)r_rôrRrg)rDÚmoderSr&r&r+r#}s  z_XTicks._labelAxisPos)N)N) rVrWrXrrÕrrrrrrÒr#r&r&r&r+rJs     rc@seZdZddd„Zdd„ZdS)Ú_YTicksNcCs<|j}|r6|p|j}|dkr"|jS|dkr6|j|jS|jS)Nrårä)r_rôrQrg)rDr&rSr&r&r+r#‰s  z_YTicks._labelAxisPosc CsZ|j}zF|jt|ddƒƒ|_|j|j|jƒ}|jt|ddƒt|ddƒ|ƒ|S||_XdS)Nr rSr!rr")rQr#rfrÚ tickRightÚtickLeftr)rDZxoldršr&r&r+rÒ“sz_YTicks.makeTicks)N)rVrWrXr#rÒr&r&r&r+r'‡s r'c @s‚eZdZdZeeeedd�eedd�eeddddd ƒd d�d �Z d Z d d„Z dd„Z ddd„Z dd„Zdd„Zdd„Zdd„Zd S)Ú XCategoryAxiszX/category axiszTick length up the axis.)r×zTick length down the axis.rêrèÚvalueÚpointsNzIMode used for connecting axis ('bottom', 'top', 'value', 'points', None).)rØr$r%rrcCs*tj|ƒd|j_d|j_d|_d|_dS)Nréréûÿÿÿ)rßrFrïÚ boxAnchorÚdyr$r%)rDr&r&r+rF«s  zXCategoryAxis.__init__cCsb|jdddƒ|jdgƒdd d d d g|_d |j_d|jd_d|jd_tddƒ}|j|ƒ|S)NééFéŒé éé(rþÚOneÚTwoÚThreeZFourZFiverr/r¸éZéÈrÿ)r4r5r1r6rþ)rr rðrïr/Úanglerr{)rDrer&r&r+Údemo´s     zXCategoryAxis.democCsZt|ƒ|dkr|j|_n<|dkr2|j|j|_n$|dkrH|j|ƒ|_n|dkrV||_dS)z!Join with y-axis using some mode.rêrèr+r,N)rrRrgrO)rDÚyAxisr&Úposr&r&r+Ú joinToAxisÂs zXCategoryAxis.joinToAxiscCsF|j}|rB|j}|dkr(|j||d�n|dkrB|j|||jd�dS) Nrêrè)r&r+r,)r&r?)rêrè)r+r,)r_rr@rñ)rDÚjaÚjamr&r&r+Ú _joinToAxisÎszXCategoryAxis._joinToAxiscCs|j|j|j|ƒ|jS)z'returns the x position in drawing units)rQrørr )rDrr&r&r+r×szXCategoryAxis.loScalecCsftƒ}|jƒ|js|St|j|j|j|j|j|j|jƒ}|j |_ |j |_ |j |_ |j |ƒ|S)N) rrCrërrQrúrRrgrûrur–r—r{)rDršrSr&r&r+rÑÛs( zXCategoryAxis.makeAxiscCs,tƒ}|js|S|j}|dk �r(|j}t|ƒ}|j}|j}|jƒ}|j}|j dkrX|j nd} xÊt |ƒD]¾} |r||| d} n| } | |krŠqf| |} | |j kr¨|j | } n |j | } | rÜ| j } | | }| _ |dkrà| d9} nd} | j}|| ||}| j||| ƒ| j|| �pdƒ|j| ƒqfW|S)Nrær<rràÚéþÿÿÿ)rrírðrr4ròr r#rQrôr rxrïr0rÙÚ setOriginÚsetTextr{)rDršrðÚcatCountrròr rRrQÚpmvr~ÚicÚlabelZ_dyr?Úlpfr(r&r&r+rÓèsD     zXCategoryAxis.makeTickLabels)rêN)rVrWrXrYrÜrßrÝrr rÞr¶rFr=r@rCrrÑrÓr&r&r&r+r*�s      r*c @szeZdZdZeeeedd�eedd�eedƒd d�d �Z d Z d d„Z dd„Z ddd„Z dd„Zdd„Zdd„Zdd„Zd S)Ú YCategoryAxiszY/category axiszTick length left of the axis.)r×zTick length right of the axis.ÚleftÚrightr+r,NzIMode used for connecting axis ('left', 'right', 'value', 'points', None).)rØr)r(rr<cCs*tj|ƒd|j_d|j_d|_d|_dS)Nr/r-rr.)rßrFrïr/Údxr)r()rDr&r&r+rFs  zYCategoryAxis.__init__cCs^|jdddƒ|jdgƒdddg|_d |j_d |jd _d |jd _td dƒ}|j|ƒ|S)Nrþr4éPr5r1r7r8r9r/rnràr:r;rÿ)r4r5r1)rr rðrïr/r<rr{)rDrer&r&r+r=%s      zYCategoryAxis.democCsjt|ƒ|dkr|jd|_nH|dkr:|j|jd|_n,|dkrT|j|ƒd|_n|dkrf|d|_dS)z!Join with x-axis using some mode.rNgð?rOr+r,N)rrQrgrO)rDÚxAxisr&r?r&r&r+r@2szYCategoryAxis.joinToAxiscCsF|j}|rB|j}|dkr(|j||d�n|dkrB|j|||jd�dS) NrNrO)r&r+r,)r&r?)rNrO)r+r,)r_rr@rñ)rDrArBr&r&r+rC?szYCategoryAxis._joinToAxiscCs|j|j|ƒ|jS)z'Returns the y position in drawing units)rRrr )rDrr&r&r+rHszYCategoryAxis.loScalecCsftƒ}|jƒ|js|St|j|j|j|j|j|j|jƒ}|j |_ |j |_ |j |_ |j |ƒ|S)N) rrCrërrQrRrúrgrûrur–r—r{)rDršrSr&r&r+rÑLs( zYCategoryAxis.makeAxiscCs2tƒ}|js|S|j}|dk �r.|j}t|ƒ}|j}|j}|j}|jƒ}|j } |j dkr^|j nd} xÊt |ƒD]¾} |r‚|| d} n| } | |kr�ql| |} | |jkr®|j| } n |j| } | j }| | ||}| rø| j}| | }| _ |dkrö|d9}nd}| j|||ƒ| j|| �pdƒ|j| ƒqlW|S)Nrær<rràrDrE)rrírðrr4ròr rïr#rRrôr rxrÙrPrFrGr{)rDršrðrHrròr rïrQrRrIr~rJrKrLrJZ_dxr?r&r&r+rÓYsF     zYCategoryAxis.makeTickLabels)rNrOr+r,N)rNN)rVrWrXrYrÜrßrÝrr rÞr¶rFr=r@rCrrÑrÓr&r&r&r+rMs      rMc@seZdZdZdd„ZdS)Ú TickLabellerztAbstract base class which may be used to indicate a change in the call signature for callable label formats cCsdS)NzAbstract class instance calledr&)rDrSr+r&r&r+rUƒszTickLabeller.__call__N)rVrWrXrYrUr&r&r&r+rSsrScCsd|S)Nz%.12gr&)r(r&r&r+r,‡sr,cH@seZdZdZeeeeedƒfƒdd�eedd�eedd�eedd�eedd�eed d�ee d d�ee d d�ee d d�eed ddƒdd�eed ddƒdd�ee dd�ee dd�ee dd�ee dd�eed ddƒdd�eed ddƒdd�ee dd�ee dd�ee dd�eedd�ee dd�ee dd�eddd�eed d!d"ƒd#d�edd$d�edd%d�ee d&d�ee d'd�ee d(d�ee d)d�ee d*d�eee e e d ddd+�fƒd,d�eee e e d ddd+�fƒd-d�eeeeƒe ed ddd+�fƒd.d�eed/d0d1d2ƒd3ƒee d4d�eed5d6d7ƒd8ƒeed/d9d:d0ƒd;d�ee dd�eed d!d"ƒd?d�eed@d�eddAd�ee dBd�ee dCd�ee dDd�ee dEd�ee dFd�eedGd�eedHd�ee dd�ee dd�ee dd�eed ddƒdd�eed ddƒdd�ee dd�ee dd�ee dd�ee dId�ee dJd�ee dKd�ee dLd�eedMd�eed/dNd0dOƒdPƒee dQd�eedRd�dS�DZdTdU„ZdVdW„ZdXdY„ZdZd[„Zifd\d]„Zd^d_„Zd`da„Zdbdc„Zddde„Zdfdg„Zdhdi„Zdjdk„Zdldm„Zdndo„Zdpdq„Zdrds„Z dtdu„Z!dvdw„Z"dxdy„Z#dS)zÚ ValueAxisz(Abstract value axis, unusable in itself.ÚnearzEnsure zero in range if true.)r×zDisplay entire object, if true.zDisplay axis line, if true.zDisplay axis labels, if true.zDisplay axis ticks, if true.zDisplay axis grid, if true.zWidth of axis line and ticks.zColor of axis line and ticks.zDash array used for axis line.rr<ràz#Line cap 0=butt, 1=round & 2=squarez$Line join 0=miter, 1=round & 2=bevelz$miter limit control miter line joinszWidth of grid lines.zColor of grid lines.zDash array used for grid lines.z(Grid Line cap 0=butt, 1=round & 2=squarez)Grid Line join 0=miter, 1=round & 2=bevelz)Grid miter limit control miter line joinsz#Start of grid lines wrt axis originz!End of grid lines wrt axis originz-if true draw gridlines after everything else.z)Minimum value for distance between ticks.zMaximum number of ticks.NzHandle of the axis labels.rärårSz*Like joinAxisMode, but for the axis labelsz3Formatting string or function used for axis labels.zExtra Formatting string.zScaling for label tick values.zMinimum value on axis.zMaximum value on axis.zStep size used between ticks.z&List of step sizes used between ticks.)ÚemptyOKrbraz.Fraction of interval to allow above and below.zSpace to allow above and below.zMSet to True to make the avoidBoundFrac calculations treat zero as non-specialrçréÚceilingÚfloorzHow to round the axis limitsz!Zero range axis limit preference.ÚnormalrârãzHow values are plotted!r]r^zSkip high/low tick labelsz"Lowest label shift interval ratio.zMinimum amount to shift.zspecial value for shiftz$Like joinAxisMode, but for the ticksz#If true reverse category direction.zlist of annotationsz*extra line length before start of the axisz'extra line length after end of the axiszNumber of axis sub ticks, if >0zsub tick down or leftzsub tick up or rightz Display axis sub ticks, if true.zDisplay axis sub grid, if true.zWidth of ticks if specified.z Width of sub ticks if specified.z Color of sub ticks if specified.zColor of ticks if specified.z?Ensure tick labels do not project beyond bounds of axis if truerèrêz'grid lines to skip top bottom both nonezMinimum required value range.z#Callable to replace _drawInnerTicks)DÚ forceZerorÐrërírìr r–rur—r˜r‹r™rŸržr£r¥r¤r¦r¡r¢rîÚminimumTickSpacingÚ maximumTicksrïrôÚlabelTextFormatÚlabelTextPostFormatÚlabelTextScaleÚvalueMinÚvalueMaxÚ valueStepÚ valueStepsÚavoidBoundFracÚavoidBoundSpaceÚabf_ignore_zeroÚ rangeRoundÚ zrangePrefróÚskipEndLÚ origShiftIPCÚ origShiftMinÚorigShiftSpecialValuer ròr¿rúrûr«r"r!rrªr­r¬r±r³r²r´r®r¯röZsubTickStrokeWidthZsubTickStrokeColorr÷ÚkeepTickLabelsInsiderüÚ requiredRangerýcCKsø|jjdkstdƒ‚|jf|Ž|jdddddddddddtdtdtd td td d tdtdtd td td ddd dddddtd td td d tdtdddttƒdddddddddddddd ddddddddddddd�Ad|j_dS)NrTz%Abstract Class ValueAxis Instantiatedrrþrÿr<rur—r‹r˜r™gÐ?Fr4érSrçrY)AÚ _configuredrQrRrgrÐrërírìr rZr–rur—r‹r˜r™rŸržr£r¤r¥r¦r¡r¢rîrªrr«r"r!r²r³r´r­r¬r±r®r¯rïrmr[r\rrôr]r^r_r`rarbrdrerfrgrhrórirjrkrlr ròrúrûrn) r¹rVrrÚrrrrïr<)rDrÛr&r&r+rFÔsŠ zValueAxis.__init__cCs"t|ƒ|_t|ƒ|_t|ƒ|_dS)N)rrQrRrg)rDr(rJrr&r&r+r+s  zValueAxis.setPositioncCs|j|ƒ|jƒdS)a=Let the axis configure its scale and range based on the data. Called after setPosition. Let it look at a list of lists of numbers determine the tick mark intervals. If valueMin, valueMax and valueStep are configured then it will use them; if any of them are set to None it will look at the data and make some sensible decision. You may override this to build custom axes with irregular intervals. It creates an internal variable self._values, which is a list of numbers to use in plotting. N)Ú _setRangeÚ_configure_end)rDÚ dataSeriesr&r&r+r 1s zValueAxis.configurecCs|jƒ|jƒd|_dS)Nr<)r Ú_calcScaleFactorrp)rDr&r&r+rrAszValueAxis._configure_endc CsTy||f}||}Wn:||_||_|jƒ\}}|||df}||<YnX|S)Ng:Œ0âŽyE>)Ú _valueMinÚ _valueMaxÚ_calcStepAndTickPositions)rDr`raÚcacheÚKr€rbr'r&r&r+Ú_getValueStepAndTicksFs  zValueAxis._getValueStepAndTickscCs¨|j}|dkr ||}||kr d||}|d9}t|||ƒ}t|||ƒ}|dkrp|dkrp|d|}d}n|dkrŒ|dkrŒ||}d}|}|_|}|_||fS)Nrgà?rÿ)rnr8r:Ú _cValueMinÚ _cValueMax)rDr`raÚrrr€Úmr�Úy2r&r&r+Ú_preRangeAdjustQs"    zValueAxis._preRangeAdjustc'CsP|j}}|j}}|dkr0t||jdƒ}|_|dkrLt||jdƒ}|_||krÞ|dkr¼|dkr¦|dkr¦t|ddƒ}|dkrŠ|}d}qº|dkrœd}|}qºd}d}qÞ|jdkr¶d}qÞd}n"|dkrÒd|}d}n d}d|}t|ddƒ�rvtt|ddƒƒ}d }|||} | |_ ||_ ||j |_ | |fd d „} |dk�rTt||jd| d �}|_|dk�rvt||jd| d �}|_|j ||ƒ\}}|j} |} |} |j}|�rì|d k�rÈtt|ƒt|ƒƒd||k}|�rì|dk�rÞd}n|dk�rìd}|j}t|ddƒ }|�o|}t|ƒ�s||f}t|ddƒ}t|ƒ�s:||f}| dk�oF|}|�r`| dk}| dk}nd}}|j}|}|�rŠt|ƒ�sŠ||f}t|j ƒ}|�p¢|�p¢|}i}d}�xÒ|�r€|dk�r€|d7}d}|�sØ|�rÞ|j|||ƒ\}}}|�r ||d}||d}nd}}|�rJ|||} t||d| ƒ}t||d| ƒ}|�rZ|d}!n|}!| |}"|d�s~t|!ƒ|k�r”|!|"|k�r”|"}d}|�r¤|d}!n|}!| |}"|d�sÈt|!ƒ|k�rÞ|!|"|k�rÞ|"}d}|�r°|j|||ƒ\}}}|�r:||d|k�r"|d|}d}n||d|k}|d}|�r°||d|k�rd|d|}d}n||d |k}|d!}�q°W|�r˜| �r˜||_nd|_||_||_|j}#|j}$|$dk �sÊ|#dk �rD|j}%|jƒ|j|j}}|%dk�st|%|ƒdk�rD|#�r|#|j}&nd}&|$�r6t|&|||$|j ƒ}&|j|&8_|jƒdS)"zÔSet minimum and maximum axis values. The dataSeries argument is assumed to be a list of data vectors. Each vector is itself a list or tuple of numbers. Returns a min, max tuple. Nrrhg{®Gáz„?g333333ó?gZ _bubblePlotràgÐ?c SsTy |d}Wntk r(td}YnX|||d9}|||||||ƒS)Nràgš™™™™™¹?gà?)r†Z bubbleMAx)r'r(r*ÚbubbleVÚ bubbleMaxr?r&r&r+r)’s  z$ValueAxis._setRange..special)r)rUr-rcrfFrçrérXrWr4r<g�íµ ÷ư>g{®Gáz„¿g{®Gáz„¿)rérX)rérWrrrrr) r`rar9r¶r{r;r|rfrZ_bubbleVZ _bubbleMaxrgZ _bubbleRadiusr€rgrZr8rƒrdr%rerzr:Ú_computedValueSteprurvrjrkrlÚ_calcValueStepÚ _valueStepÚ _rangeAdjust)'rDrsZoMinr`ZoMaxraZzrpr‚Zfracr�r)rgÚcMinÚcMaxrZÚabfZdo_rrZdo_abfZabfizZrrnZrrxÚabSZdo_absÚaLÚgorxÚiterrbr'ÚfuzzÚi0Úi1Úsfr?Úurjrkrlr~r&r&r+rqes                       & &   zValueAxis._setRangecCs*|j|_|j|_t|dƒr|`|jƒdS)NÚ_subTickValues)r`rurarvrMr“rr)rDr&r&r+rNs  zValueAxis._pseudo_configurecCsdS)zŸOverride this if you want to alter the calculated range. E.g. if want a minumamum range of 30% or don't want 100% as the first point. Nr&)rDr&r&r+r† szValueAxis._rangeAdjustcCsdS)z…Override if you want to put slack at the ends of the axis eg if you don't want the last tick to be at the bottom etc Nr&)rDr&r&r+Ú_adjustAxisTicksszValueAxis._adjustAxisTickscCs|jt|j|jƒ|_|jS)z‡Calculate the axis' scale factor. This should be called only *after* the axis' range is set. Returns a number. )rgrrvruÚ _scaleFactor)rDr&r&r+rtszValueAxis._calcScaleFactorcsøt|ddƒ‰ˆr|`ˆ|_n|jƒ|j‰|j}|j}dˆ}|j}tt|ƒˆƒ}|ˆ}|d krz|||krŽ|d8}n|||krŽ|d7}tt|ƒˆƒ}|ˆ}|d krÄ|||krØ|d7}n|||krØ|d8}ˆ‡fdd„t ||dƒDƒfS) Nrƒg:Œ0âŽyE>rérXr<rWcsg|] }|ˆ‘qSr&r&)r1r~)rbr&r+r29sz7ValueAxis._calcStepAndTickPositions..)rérX)rérW) rfrƒr…r„rurvrgr=rrx)rDr`rarŽrgr�r?r�r&)rbr+rw#s2     z#ValueAxis._calcStepAndTickPositionscCs |jƒdS)Nr<)rw)rDr&r&r+Ú_calcTickPositions;szValueAxis._calcTickPositionscCsÖt|dƒs|jƒ|j}t|dƒ�sÊ|jj}|dd…dkrFd}t}n d}dd„}d d „|Dƒ}gj}t|jƒ}t|ƒ}|d krŠg|_ �n@|d kr¤|d |d} nH|d krÐt |d |d|d |d ƒ} n|d L}||d ||} | |} |j | } |j | } |d| k�r*|j d|d| ƒ|d| k�rJ|j|d| ƒ| t|d ƒ} xft|dd…ƒD]R\}} xFt|ƒD]:}| ||d | ƒ}|| k�s~|| k�r®�q~||ƒ�q~W�qlW|j|_ |j |_|S)NrIr“r¼r½rg:Œ0âŽyE>cSs|S)Nr&)r(r&r&r+r,Isz)ValueAxis._calcSubTicks..cSsg|]}t|ddƒr|‘qS)Ú _doSubTicksr<)rf)r1r|r&r&r+r2Ksz+ValueAxis._calcSubTicks..ràr<érrr)rMrNrIr¹rVr=rÊr«r4r“r:rurvÚinsertrÚ enumeraterxrË)rDrµrºZiFuzzZdCnvZOTVr'Znstr~ÚdstrŽZvnZvxr(Újr„r&r&r+r°>sN    $  zValueAxis._calcSubTickscCs2t|ddƒ|_|jr|jS|jƒ|_|jƒ|jS)zKCalculate a list of tick positions on the axis. Returns a list of numbers.rcN)rfrIr–r”)rDr&r&r+r hs  z ValueAxis._calcTickmarkPositionscCsR|jdkrF|j|j}|tt|jdƒt|jƒ|jƒ}t|ƒ|_ n|j|_ dS)z8Calculate _valueStep for the axis or get from valueStep.Nr<) rbrvrur8rr\rgr[r"r…)rDÚrawRangeÚ rawIntervalr&r&r+r„ps   $ zValueAxis._calcValueStepcCs t|jƒS)N)r@rI)rDr&r&r+Ú _allIntTicksyszValueAxis._allIntTickscCsêtƒ}|js|S|j}|dkr6|jp2|jƒr0dp2t}n,|tkrL|jƒrLd}nt|dƒrb|j|j ƒ|j }|j }|j |j g}|j}|jƒ|d|<|j}|jdkræ|jr®|j }n|j }|jdkrÆ|g}qê|||jg}|jdkrê|d=ng}t|j ƒ} | d} �xæt|j ƒD�]Ö\} } | | } | |k�r0|| } n|| } |�r | j�r |j| ƒ}|�r~x&|D]}t||ƒdk�r\d}P�q\W|dk �r |dk �rœ| |}n| }t|tƒ�r¶||}nbt|ƒ�rÞ| t|ƒk�rØ|| }nd }n:t|d ƒ�r t|tƒ�r|||ƒ}n||ƒ}n td |ƒ‚|�r&||}|||<| j|Ž| j|ƒ|j�rÖt|t ƒ�rÖ|j }| �s’| j!ƒ\}}}}||k�r’| j"| j#||d �} | | k�rÖ||j}| j!ƒ\}}}}||k�rÖ| j"| j#||d �} |j$| ƒ�q W|S) Nz%.0fÚ calcPlacesr<rçr]r^rg�íµ ÷ư>rDrUzInvalid labelTextFormat %s)rP)%rrírr]rŸÚ_defaultLabelFormatterÚstrrMr rIr^r_rQrRr¶r#rïrir¾rgr4ršrÐrOrƒryr%rSÚ ValueErrorrFrGrmÚ XValueAxisZ getBoundsÚclonerPr{)rDršr0ÚpostZsclr?rerïÚskZnticksZnticks1r~ÚtickrKr?Zskvr„ÚtxtZa_xr’rŽr�r�Za_x1r&r&r+rÓ|s”                             zValueAxis.makeTickLabelscCsZ|jstdƒ‚|dkrd}|j|jf|j}|j}|jrH| }||j7}||||jS)zvConverts a numeric value to a plotarea position. The chart first configures the axis, then asks it to z1Axis cannot scale numbers before it is configuredNr) rprrQrRr¶r•ròrgru)rDr+Zorgr‘r&r&r+rOÒs zValueAxis.scale)$rVrWrXrYrÜrÝr r r rrrrr rrrÞrFrr rrrzr€rqrNr†r”rtrwr–r°r r„rŸrÓrOr&r&r&r+rTŠs´                          "                         W #* VrTc @s†eZdZdZeeeedd�eedd�eddd�eeddd d dƒd d�ee d d�d �Z dZ dd„Z dd„Z ddd„Zdd„Zdd„ZdS)r¤z X/value axiszTick length up the axis.)r×zTick length down the axis.NzJoin both axes if true.rêrèr+r,zIMode used for connecting axis ('bottom', 'top', 'value', 'points', None).z*Position at which to join with other axis.)rØr$r%r_rrñrcKsHtj|f|Žd|j_d|j_d|j_d|_d|_d|_d|_ d|_ dS)Nrrr-r.) rTrFrïr/rPr0r$r%r_rrñ)rDrÛr&r&r+rFôszXValueAxis.__init__cCs2|jdddƒ|jd gƒtddƒ}|j|ƒ|S) Nr5rþé–r4r1r6r;rÿ)r4r5r1r6rþ)rr rr{)rDrer&r&r+r=s    zXValueAxis.democCsjt|ƒ|dkr|jd|_nH|dkr:|j|jd|_n,|dkrT|j|ƒd|_n|dkrf|d|_dS)z!Join with y-axis using some mode.rêgð?rèr+r,N)rrRrgrO)rDr>r&r?r&r&r+r@ szXValueAxis.joinToAxiscCsJ|j}|rF|jpd}|dkr,|j||d�n|dkrF|j|||jd�dS) Nrêrè)r&r+r,)r&r?)rêrè)r+r,)r_rr@rñ)rDrArBr&r&r+rCs zXValueAxis._joinToAxiscCsftƒ}|jƒ|js|St|j|j|j|j|j|j|jƒ}|j |_ |j |_ |j |_ |j |ƒ|S)N) rrCrërrQrúrRrgrûrur–r—r{)rDršrSr&r&r+rÑs( zXValueAxis.makeAxis)rêN)rVrWrXrYrÜrTrÝrr rrÞr¶rFr=r@rCrÑr&r&r&r+r¤ás$   r¤ÚjanÚfebÚmarÚaprÚmayÚjunÚjulÚaugÚsepÚoctÚnovÚdecéér1cCsH|jdƒ\}}t|ƒ}|jƒ}tj|ƒd}|t|dks@t‚||fS)aThis accepts and validates strings like "31-Dec" i.e. dates of no particular year. 29 Feb is allowed. These can be used for recurring dates. It returns a (dd, mm) pair where mm is the month integer. If the text is not valid it raises an error. ú-r<)Úsplitr=ÚlowerÚ_monthsÚindexÚ_maxDaysr)ZdmstrZdstrZmstrÚddÚmmr&r&r+ÚparseDayAndMonth8s rÁc@s eZdZdZdd„Zdd„ZdS)Ú_isListOfDaysAndMonthsz¤This accepts and validates lists of strings like "31-Dec" i.e. dates of no particular year. 29 Feb is allowed. These can be used for recurring dates. c CsHt|ƒr@d}x.|D]&}yt|ƒ\}}Wqd}YqXqW|SdSdS)NTF)r%rÁ)rDr(ZanswerÚelementr¿rÀr&r&r+ÚtestKs z_isListOfDaysAndMonths.testcCs|S)Nr&)rDr(r&r&r+Ú normalizeWsz _isListOfDaysAndMonths.normalizeN)rVrWrXrYrÄrÅr&r&r&r+rÂFs rÂr<ràr˜éé éé<éxé´éðé,éhé¤éàééXéÐéHéÀé8é°é` c@søeZdZdZeeeedd�eedd�eedd�eedd�ee d*d�ed d d�ee e d d d d�dd�ee e d ddd�dd�eedd�ee e e ƒƒdd�eedd�eeddddƒdƒd� ZejZdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd S)+ÚNormalDateXValueAxisz×An X axis applying additional rules. Depending on the data and some built-in rules, the axis displays normalDate values as nicely formatted dates. The client chart should have NormalDate X values. z.Fractional amount used to adjust label spacing)r×z$Flag for displaying months 'nicely'.z0Flag for enforced displaying of last date value.z1Flag for enforced displaying of first date value.z!List of dates in format "31-Dec",zY"1-Jan". If present they will always be used for tick marks in the current year, rather z\than the dates chosen by the automatic algorithm. Hyphen compulsory, case of month optional.Nz3Label format string (e.g. '{mm}/{yy}') or function.rro)rVrbrazWeekday names.rÇz Month names.zATrue if we are to assume daily data to be ticked at end of month.z/Actual tick values to use; no calculations donez@clear rather than delete close ticks when forced first/end datesrçrèrérêz'grid lines to skip top bottom both none) rØÚbottomAxisLabelSlackÚ niceMonthÚ forceEndDateÚforceFirstDateÚforceDatesEachYearÚ xLabelFormatÚ dayOfWeekNameÚ monthNameÚ dailyFreqÚspecifiedTickDatesÚspecialTickClearrüc Ks€tj|f|Žd|_d|_d|_d|_g|_d|_d|_ddddd d d g|_ d d ddddddddddg |_ d|_ d|_ |_ dS)Ngš™™™™™¹?r<rz {mm}/{yy}ZMondayZTuesdayZ WednesdayZThursdayZFridayZSaturdayZSundayÚJanuaryÚFebruaryZMarchZAprilÚMayZJuneZJulyZAugustZ SeptemberZOctoberZNovemberZDecember)r¤rFrÚrÛrÜrÝrÞrârßràrárärcrã)rDrÛr&r&r+rFzszNormalDateXValueAxis.__init__cCs|jƒ}|j|ƒ|S)z'Convert a scalar to a NormalDate value.)Ú _valueClassrÅ)rDr(rer&r&r+Ú _scalar2ND‹s zNormalDateXValueAxis._scalar2NDc CsXt|tjƒs|j|ƒ}tjtj}}z|j|jt_t_|j|j ƒS||t_t_XdS)z(Create a formatted label for some value.N) ryrZ NormalDateréZ_dayOfWeekNameZ _monthNameràráZformatMSrß)rDr?rer~r&r&r+Ú_dateFormatter‘s   z#NormalDateXValueAxis._dateFormatterc!sÔˆj‰ˆj}ˆj‰tˆtƒr(‡fdd„‰ˆjs6|dnˆˆjƒ}ˆjsN|dnˆˆjƒ}ˆj}|j|j |j }}}|j |j |j } } } tˆ|ƒjdƒ|||p¦d|| | ƒ} t| d| d| d| d| ƒ} | d| d} | d| d}t| |j�püdˆjƒ}||ˆj}g}g}ˆj}ˆj�r‡fd d „ˆjDƒ}‡fd d „|Dƒ}ˆj�r°||dk�r°|t|d|dƒ|d|d|k�r°ˆj�r¤d |d<n |d=|d=ˆj�r||dk�r|t|d|dƒ|d|d|k�rˆj�rd |d<n |d=|d=||fSˆj�r¸tttˆjƒƒ}|jƒ}|jƒ}g}g}|}xh||k�r¶xN|D]F\}}t j!|||fƒ}||k�r`||k�r`|j"|ƒ|j"ˆ|ƒƒ�q`W|d7}�qPWˆj�r6||dk�r6|j#d|ƒ|j#dˆ|ƒƒ|t|d|dƒ|d|d|k�r6ˆj�r*d |d<n |d=|d=ˆj�r°||dk�r°|j"|ƒ|j"ˆ|ƒƒ|t|d|dƒ|d|d|k�r°ˆj�r¤d |d <n |d!=|d"=||fS|ˆ||fd d„}t$|ƒ}�xòt%D�]è}||}||k�rÚ|||k�rÚ|d}ˆj&�rT|j'ƒ|dk�r&|�p(d}|�rTˆj�rL||ƒd|d_(||8}y|j'ƒ|dj'ƒk} Wnd} YnXx || k�rž||ƒ||8}�q€Wˆj�r|d|k�r|dƒd|d_(|t|d#|dƒ|d|d|k�rˆj�rd |d<n |d=|d=ˆj�rvˆj&�rv|�rv|t|d$|dƒ|d%|d&|k�rvˆj�rjd |d'<n |d(=|d)=y,|d�r |d|dk�r |d=|d=Wnt)k �r¸YnX||fS�qÚWt*dƒ‚dS)*zÈComplex stuff... Needs explanation... Yes please says Andy :-(. Modified on 19 June 2006 to attempt to allow a mode where one can specify recurring days and months. cs ˆjˆ|ƒS)N)rê)r¨)rDr&r+Ú formatter¨sz4NormalDateXValueAxis._xAxisTicker..formatterrr<Ú g333333ó?ràr˜csg|] }ˆ|ƒ‘qSr&r&)r1r()ÚVCr&r+r2¼sz5NormalDateXValueAxis._xAxisTicker..csg|] }ˆ|ƒ‘qSr&r&)r1re)rër&r+r2½srDcSs(|jd||ƒ|jd|||ƒƒdS)Nr)r™)r~ÚxValsrëÚticksrïr&r&r+ÚaddTickõsz2NormalDateXValueAxis._xAxisTicker..addTickrÇz6Problem selecting NormalDate value axis tick positionsNrrrrrrErErErErrrrrErErErErrrrErErErE)+rèrgrêryrSr`rarïÚfontNameÚfontSizeÚleadingÚ textAnchorr/r<rrºrr:rvr[rÚr\rãrÝrrärÜrÞr-r.rÁÚyearrÚNDrÊr™r4Ú_NDINTMrÛÚmonthr—r†r£)!rDrîZ axisLengthZ firstDateZendDaterïrñròrórôr/r<ZRBLZxLabelWZxLabelHr¨ÚWrïr\ZforcedPartialDatesZ firstYearZlastYearZyyyyr¿rÀZtheDaterðrrerqr~rœZwfdr&)rírërDr+Ú _xAxisTickerœsÈ   D  D     .   .      .  .  z!NormalDateXValueAxis._xAxisTickercCsT|j}xH|D]@}x:tt|ƒƒD]*}||\}}t||ƒs||ƒ|f||<qWq WdS)z1Convert all XValues to a standard normalDate typeN)rèrxr4ry)rDÚdatarírÌr~r(rJr&r&r+Ú _convertXV)s    zNormalDateXValueAxis._convertXVc CsŽ|jrxg}d}|d}x2|D]*}|jƒ}||krB|r>|j|ƒ|}|}qW|d}|d|krh|j|ƒ|j|ƒ\}}n|j|ƒ\}}||fS)Nrr<rr)rârørÊrú) rDrîZxEOMZpmZpxr(r~Ústepsrïr&r&r+Ú_getStepsAndLabels3s"   z'NormalDateXValueAxis._getStepsAndLabelsc CsÚ|j|ƒtƒ}x(|D] }x|D]}|j|dƒq WqWt|ƒ}|jƒ|j}|j|ƒ\}}|j|j}} |dkr||dn||ƒ}| dkr”|dn|| ƒ} || |_ |_ ||_ ||_ |j t| |ƒ|_||_ d|_dS)Nrr<r)rüÚsetr{r-Úsortrèrþr`rarurvrIrrgrr•rp) rDrûrîr(Zdvrírýrïr`rar&r&r+r Es$   zNormalDateXValueAxis.configurezzList of dates in format "31-Dec","1-Jan". If present they will always be used for tick marks in the current year, rather zÖList of dates in format "31-Dec","1-Jan". If present they will always be used for tick marks in the current year, rather than the dates chosen by the automatic algorithm. Hyphen compulsory, case of month optional.)rVrWrXrYrÜr¤rÝrr ÚisListOfDaysAndMonthsr r rrr rÞrrörèrFrérêrúrürþr r&r&r&r+rÙ^s2         rÙc @s~eZdZdZeeeedd�eedd�eddd�eedƒd d�ee d d�d �Z dZ dd„Z dd„Z ddd„Zdd„Zdd„ZdS)Ú YValueAxisz Y/value axiszTick length left of the axis.)r×zTick length right of the axis.NzJoin both axes if true.rNrOr+r,zIMode used for connecting axis ('left', 'right', 'value', 'points', None).z*Position at which to join with other axis.)rØr)r(r_rrñr<cCsDtj|ƒd|j_d|j_d|j_d|_d|_d|_d|_ d|_ dS)Nr/r-rr.) rTrFrïr/rPr0r(r)r_rrñ)rDr&r&r+rFms zYValueAxis.__init__cCs6dg}|jdddƒ|j|ƒtddƒ}|j|ƒ|S) Nr4r5r1é*rÿrQr;)r4r5r1r)rr rr{)rDrûZdrawingr&r&r+r={s    zYValueAxis.democCsjt|ƒ|dkr|jd|_nH|dkr:|j|jd|_n,|dkrT|j|ƒd|_n|dkrf|d|_dS)z!Join with x-axis using some mode.rNgð?rOr+r,N)rrQrgrO)rDrRr&r?r&r&r+r@„szYValueAxis.joinToAxiscCsF|j}|rB|j}|dkr(|j||d�n|dkrB|j|||jd�dS) NrNrO)r&r+r,)r&r?)rNrO)r+r,)r_rr@rñ)rDrArBr&r&r+rC�szYValueAxis._joinToAxiscCsftƒ}|jƒ|js|St|j|j|j|j|j|j|jƒ}|j |_ |j |_ |j |_ |j |ƒ|S)N) rrCrërrQrRrúrgrûrur–r—r{)rDršrSr&r&r+rÑ™s( zYValueAxis.makeAxis)rNrOr+r,N)rNN)rVrWrXrYrÜrTrÝrr rrÞr¶rFr=r@rCrÑr&r&r&r+rZs$   rc@s8eZdZdZdeZdeZdd„Zdd„Zdd„Zd S) Ú TimeValueAxisrÉrÈcOs|js|j|_i|_dS)N)r]ÚtimeLabelTextFormatterÚ_saved_tickInfo)rDÚargsrEr&r&r+rFªszTimeValueAxis.__init__cCsÂ|jdkr¶|j|j}|tt|jdƒt|jƒ|jƒ}||jkrR|j}d|_ n:||j krj|j }d|_ n"||j kr‚|j }d|_ n d}d|_ ||_ |dkr¦t ||ƒ}t|ƒ||_n|j|_dS)z8Calculate _valueStep for the axis or get from valueStep.Nr<ÚdaysÚhoursÚminutesÚseconds)rbrvrur8rr\rgr[Ú_dcÚ_unitÚ_hcÚ_mcÚ_unitdr=r"r…)rDr�ržrer&r&r+r„¯s&  $    zTimeValueAxis._calcValueStepc s6|j}|t|jƒf}||jkr,|j|}�nt|ƒ‰‡fdd„|jDƒ}|jd}t|ƒrjˆ|fdd„}nºdd„|Dƒ}tdd„|Dƒƒ}|d kr¦ˆd |fd d„}n~||jkr´d nd ‰‡fdd„|Dƒ} t| ƒ�r||jkrâdn||j krðdnd} ˆˆd|| ffdd„}nˆd||ffdd„}||j|<||ƒS)Ncsg|] }|ˆ‘qSr&r&)r1r?)Úufr&r+r2Ïsz8TimeValueAxis.timeLabelTextFormatter..rcSsd|||fS)Nz%.0f%sr&)r(rrnr&r&r+r,Òsz6TimeValueAxis.timeLabelTextFormatter..cSsg|] }d|‘qS)z%.10fr&)r1r?r&r&r+r2Ôscss*|]"}t|jdƒƒ|jdƒdVqdS)Ú0Ú.r<N)r4Úrstripr½)r1r?r&r&r+ú Õsz7TimeValueAxis.timeLabelTextFormatter..r<z%%.%dfscSs |||S)Nr&)r(rÚfmtr&r&r+r,×srÈrÉcsg|]}|t|ƒˆ‘qSr&)r=)r1r?)Úfmr&r+r2ÛsÚhr~rnz %%d%s%%d%%scSs,|t||ƒt||t||ƒ|ƒfS)N)r=)r(rrrr&r&r+r,Þsz%%.%df%scSs |||S)Nr&)r(rrr&r&r+r,às) rÚtuplerIrrr r@r:r r) rDÚvalr’rqrr|rnZstvZstvlZfvÚs1r&)rrr+rÈs*     z$TimeValueAxis.timeLabelTextFormatterN) rVrWrXrrr rFr„rr&r&r&r+r¥s rc@seZdZdd„ZdS)ÚXTimeValueAxiscOs(tj|f|ž|Žtj|f|ž|ŽdS)N)r¤rFr)rDrrEr&r&r+rFèszXTimeValueAxis.__init__N)rVrWrXrFr&r&r&r+rçsrc @sdeZdZdZeeeedd�eedd�eedd�ee ee fƒdd�eedd�d�Z d d „Z d d „Z d S)Ú AdjYValueAxisz”A Y-axis applying additional rules. Depending on the data and some built-in rules, the axis may choose to adjust its range and origin. z+When true add percent sign to label values.)r×z"Lowest label shift interval ratio.zMinimum amount to shift.z8Skip/Keep lowest tick label when true/false. Or skiplistzadd this to the labels)rØÚleftAxisPercentÚleftAxisOrigShiftIPCÚleftAxisOrigShiftMinÚleftAxisSkipLL0Ú labelVOffsetcKs<tj|f|Žd|_d|_d|_d|_d|_|_d|_dS)Nr1r<g333333Ã?rÇr) rrFrnrrr r!r"rc)rDrÛr&r&r+rFús zAdjYValueAxis.__init__c Csêddlm}m}|j|j}}|j}tt|fdd„ddddd d gƒƒ}|sP|g}|j|j }}|ol|||k�r|||||d �d d …\} } | | |k�r | | d} t | |d|ƒ} t | |d|ƒ} |dkrì| dkrì| d| } d} n |dk�r | dk�r | | } d} | | |_|_||j|jd||j ||j d�\} } |j}|�r| d| d}t|ƒ�sp||}}n||d}||d}t|d| dƒ}t|d| dƒ}|| d|k�rÆ|j||_| d||k�rä|j||_||j|jd||j ||j d�\} } | d|_| d|_| |_|jd k�r4| |_n|j|_t|jdƒdk�r”|jƒ|j|j}}t |j|j|||j|jƒ}|j||_|j�ræt|jƒ�rÞx4|jD]*}y d| |<Wntk �rÖYnX�q°Wd| d<d S)z$Adjusts the value range of the axis.r)Úfind_good_gridrïcSs||kS)Nr&)r(r~r&r&r+r, sz,AdjYValueAxis._rangeAdjust..r¸r-rÆroéé )rÚgridNràgà?rÿr<)rºrÚpercentr&r"r{r|g�íµ ÷ư>rDrrr)Úreportlab.graphics.charts.utilsr#rïrurvr\r-r3rbrnr8r:rr"rdr%rfrIr]rrƒr„rr…r rgr!r†)rDr#rïZy_minZy_maxr~rrbrnr�rZymr'rpr‰r�r�Z_nrQZvMaxZvMinr(r&r&r+r†sn"  "     "         zAdjYValueAxis._rangeAdjustN)rVrWrXrYrÜrrÝr rr rrÞrFr†r&r&r&r+rìs    rc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) Ú LogValueAxiscCs&|jtt|jƒt|jƒƒ|_|jS)z‡Calculate the axis' scale factor. This should be called only *after* the axis' range is set. Returns a number. )rgrÚ math_log10rvrur•)rDr&r&r+rtDszLogValueAxis._calcScaleFactorc Cs|j}|j}t||jdƒ}t||jdƒ}|dkr4|}|dkr@|}||kr\td|jj|fƒ‚|dkrptd|ƒ‚|j}|�rt |ƒ}t |ƒ}t |ƒsœ||f}|dp¦d} |dp²d} |j | | } ||t | ƒ} || | 8}|| | 7}t |d|ƒ}t|d|ƒ}||_||_dS)Nrz7%s: valueMin=%r should not be greater than valueMax=%r!z0%s: valueMin=%r negative values are not allowed!r<r4)r`rar9r¶r;r£r¹Z_LogValueAxis__name__valueMinrer*r%rgrr8r:rurv) rDrsr`raZaMinZaMaxrŠZlMinZlMaxZa0Za1rpr‘r&r&r+rqNs8     zLogValueAxis._setRangec Cs&t|jƒ}}t|jƒ}}|j}|rn|dkrJt|ƒ}||krF|dn|}|dkrnt|ƒ}||krj|dn|}gj}t|ƒ}||krŒ|d7}t|ƒ|d} tt| |jƒdƒ}|| |jkrÆ|d7}||_x*||krØP||krì|d|ƒ||7}qÎW||k�r d||_||k�r d||_|j S)NrérWr<rXr4)rérW)rérX) r*rurvrgr=rÊr:r\Ú _powerIncrË) rDr`r‡rarˆr}r~r'r|rr&r&r+r–is<    zLogValueAxis._calcTickPositionsc Csjt|dƒs|jƒ|j}t|dƒ�s^gj}t|jƒ}t|jƒd}t|ƒ}|j}|dkrÒdt |j ƒ}d}|j dkrxd}xÜ||krÎx@t ||j ƒD]0} || d|} | |jkr�| |jkr�|| ƒq�W||7}qzWn„t |j d|dƒ} x.| �r|| dk�r|| }P| d8} qèWd}t|ƒ}x6d|} | |jk�r6P| |k�rH|| ƒ||7}�q W|j |_|j|_|S)NrIr“r<r4ràr)rMrNrIrÊr*rurvÚroundr+rr«rxr8rËr“) rDrµr'r`rar|r~Zfacr]rœr?Zngr&r&r+r°…sL         zLogValueAxis._calcSubTicksN)rVrWrXrtrqr–r°r&r&r&r+r)Bs r)c@seZdZdd„ZdS)ÚLogAxisTickLabellercCsDt|ƒ}t|dkr|dn|dƒ}|dkr0dS|dkr%s)r*r=)rDrSr+r/r&r&r+rU¯szLogAxisTickLabeller.__call__N)rVrWrXrUr&r&r&r+r-®sr-c@seZdZdd„ZdS)ÚLogAxisLabellingSetupcCsbtdk rXttƒ|_|jdkr6d|j_d|j_d|j_nd|j_d|j_d|j_tƒ|_ nd|_ dS) Nr<r/r-rrz%.0er.r.) r!rr rïr¶r/rPr0r-r])rDr&r&r+rF·s    zLogAxisLabellingSetup.__init__N)rVrWrXrFr&r&r&r+r0¶sr0c@s&eZdZeed�Zdd„Zdd„ZdS)Ú LogXValueAxis)rØcCstj|ƒtj|ƒdS)N)r¤rFr0)rDr&r&r+rFÉs zLogXValueAxis.__init__cCsZd}|jst|ƒ‚|dkrd}|dkr<|j|jt|jƒS|j|jt|ƒt|jƒS)zúConverts a numeric value to a Y position. The chart first configures the axis, then asks it to work out the x value for each point when plotting lines or bars. You could override this to do logarithmic axes. z1Axis cannot scale numbers before it is configuredNrg)rprrQr•r*ru)rDr+Úmsgr&r&r+rOÍs zLogXValueAxis.scaleN)rVrWrXrÜr¤rÞrFrOr&r&r&r+r1Æs r1c@s&eZdZeed�Zdd„Zdd„ZdS)Ú LogYValueAxis)rØcCstj|ƒtj|ƒdS)N)rrFr0)rDr&r&r+rFàs zLogYValueAxis.__init__cCsZd}|jst|ƒ‚|dkrd}|dkr<|j|jt|jƒS|j|jt|ƒt|jƒS)zúConverts a numeric value to a Y position. The chart first configures the axis, then asks it to work out the x value for each point when plotting lines or bars. You could override this to do logarithmic axes. z1Axis cannot scale numbers before it is configuredNrg)rprrRr•r*ru)rDr+r2r&r&r+rOäs zLogYValueAxis.scaleN)rVrWrXrÜrrÞrFrOr&r&r&r+r3Þs r3)N)N)N)r<ràr˜rÆrÇrÈrÉrÊrËrÌrÍrÎrÏrÐrÑrÒrÓrÔrÕrÖr×rØ)VÚ __version__rYÚmathrr*Zreportlab.lib.validatorsrrrrrrr r r r r rrrrZreportlab.lib.attrmapZ reportlab.librZreportlab.graphics.shapesrrrrrrrrZreportlab.graphics.widgetbaserrZ$reportlab.graphics.charts.textlabelsrrr r!r(r"Z reportlab.graphics.widgets.gridsr#Zreportlab.lib.colorsr$Zreportlab.lib.utilsr%r7r9r;r@rArZrrr�rˆrÖrßrrrr'r*rMrSr¡rTr¤r¼r¾rÁrÂrr÷rÙrrrrr)r-r0r1r3r&r&r&r+Úsp D (       GE- =qq[U}KBVl