
    ,hC                        d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZmZ ddlmZ  G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)zAxis-related chart objects.    )ChartFormat)XL_AXIS_CROSSESXL_CATEGORY_TYPEXL_TICK_LABEL_POSITIONXL_TICK_MARK)qn)ST_Orientation)ElementProxy)Font	TextFrame)lazypropertyc                   j    e Zd ZdZ fdZed        Zed        Zed        Z	e	j                  d        Z	ed        Zej                  d        Zed	        Zej                  d
        Zed        Zed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Zed        Zej                  d        Zed        Zej                  d        Z xZS )	_BaseAxiszKBase class for chart axis objects. All axis objects share these properties.c                 F    t         t        |           || _        || _        y N)superr   __init___element_xAxselfxAx	__class__s     Q/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/chart/axis.pyr   z_BaseAxis.__init__   s    i')	    c                 H    t        | j                  j                               S )aA  An |AxisTitle| object providing access to title properties.

        Calling this property is destructive in the sense that it adds an
        axis title element (`c:title`) to the axis XML if one is not already
        present. Use :attr:`has_title` to test for presence of axis title
        non-destructively.
        )	AxisTitler   get_or_add_titler   s    r   
axis_titlez_BaseAxis.axis_title   s     779::r   c                 ,    t        | j                        S )z
        The |ChartFormat| object providing access to the shape formatting
        properties of this axis, such as its line color and fill.
        r   r   r   s    r   formatz_BaseAxis.format&   s     4==))r   c                 2    | j                   j                  yy)a  
        Read/write boolean value specifying whether this axis has gridlines
        at its major tick mark locations. Assigning |True| to this property
        causes major gridlines to be displayed. Assigning |False| causes them
        to be removed.
        FT)r   majorGridlinesr   s    r   has_major_gridlinesz_BaseAxis.has_major_gridlines.        ==''/r   c                     t        |      du r| j                  j                          y | j                  j                          y NT)boolr   get_or_add_majorGridlines_remove_majorGridlinesr   values     r   r&   z_BaseAxis.has_major_gridlines:   .    ;$MM335MM002r   c                 2    | j                   j                  yy)a  
        Read/write boolean value specifying whether this axis has gridlines
        at its minor tick mark locations. Assigning |True| to this property
        causes minor gridlines to be displayed. Assigning |False| causes them
        to be removed.
        FT)r   minorGridlinesr   s    r   has_minor_gridlinesz_BaseAxis.has_minor_gridlinesA   r'   r   c                     t        |      du r| j                  j                          y | j                  j                          y r)   )r*   r   get_or_add_minorGridlines_remove_minorGridlinesr-   s     r   r2   z_BaseAxis.has_minor_gridlinesM   r/   r   c                 2    | j                   j                  yy)a  Read/write boolean specifying whether this axis has a title.

        |True| if this axis has a title, |False| otherwise. Assigning |True|
        causes an axis title to be added if not already present. Assigning
        |False| causes any existing title to be deleted.
        FT)r   titler   s    r   	has_titlez_BaseAxis.has_titleT   s     ==&r   c                     t        |      du r| j                  j                          y | j                  j                          y r)   )r*   r   r   _remove_titler-   s     r   r8   z_BaseAxis.has_title`   s.    ;$MM**,MM'')r   c                 ,    t        | j                        S )ze
        The |MajorGridlines| object representing the major gridlines for
        this axis.
        )MajorGridlinesr   r   s    r   major_gridlinesz_BaseAxis.major_gridlinesg   s     dmm,,r   c                 j    | j                   j                  }|t        j                  S |j                  S )z|
        Read/write :ref:`XlTickMark` value specifying the type of major tick
        mark to display on this axis.
        )r   majorTickMarkr   CROSSval)r   r?   s     r   major_tick_markz_BaseAxis.major_tick_marko   1     33 %%%   r   c                     | j                   j                          |t        j                  u ry | j                   j	                  |       y NrA   )r   _remove_majorTickMarkr   r@   _add_majorTickMarkr-   s     r   rB   z_BaseAxis.major_tick_markz   8    ++-L&&&((U(3r   c                 B    | j                   j                  j                  S )am  
        Read/write float value specifying the upper limit of the value range
        for this axis, the number at the top or right of the vertical or
        horizontal value scale, respectively. The value |None| indicates the
        upper limit should be determined automatically based on the range of
        data point values associated with the axis.
        r   scalingmaximumr   s    r   maximum_scalez_BaseAxis.maximum_scale        }}$$,,,r   c                 >    | j                   j                  }||_        y r   rK   r   r.   rL   s      r   rN   z_BaseAxis.maximum_scale       --''r   c                 B    | j                   j                  j                  S )a]  
        Read/write float value specifying lower limit of value range, the
        number at the bottom or left of the value scale. |None| if no minimum
        scale has been set. The value |None| indicates the lower limit should
        be determined automatically based on the range of data point values
        associated with the axis.
        r   rL   minimumr   s    r   minimum_scalez_BaseAxis.minimum_scale   rO   r   c                 >    | j                   j                  }||_        y r   rT   rQ   s      r   rV   z_BaseAxis.minimum_scale   rR   r   c                 j    | j                   j                  }|t        j                  S |j                  S )zr
        Read/write :ref:`XlTickMark` value specifying the type of minor tick
        mark for this axis.
        )r   minorTickMarkr   r@   rA   )r   rY   s     r   minor_tick_markz_BaseAxis.minor_tick_mark   rC   r   c                     | j                   j                          |t        j                  u ry | j                   j	                  |       y rE   )r   _remove_minorTickMarkr   r@   _add_minorTickMarkr-   s     r   rZ   z_BaseAxis.minor_tick_mark   rI   r   c                 P    | j                   j                  t        j                  k(  S )a2  Read/write bool value specifying whether to reverse plotting order for axis.

        For a category axis, this reverses the order in which the categories are
        displayed. This may be desired, for example, on a (horizontal) bar-chart where
        by default the first category appears at the bottom. Since we read from
        top-to-bottom, many viewers may find it most natural for the first category to
        appear on top.

        For a value axis, it reverses the direction of increasing value from
        bottom-to-top to top-to-bottom.
        )r   orientationr	   MAX_MINr   s    r   reverse_orderz_BaseAxis.reverse_order   s     }}((N,B,BBBr   c                     t        |      du r t        j                  | j                  _        y t        j                  | j                  _        y r)   )r*   r	   r`   MIN_MAXr   r_   r-   s     r   ra   z_BaseAxis.reverse_order   s9     '+5kT&9N"" 	!?M?U?U 	!r   c                 ,    t        | j                        S )z
        The |TickLabels| instance providing access to axis tick label
        formatting properties. Tick labels are the numbers appearing on
        a value axis or the category names appearing on a category axis.
        )
TickLabelsr   r   s    r   tick_labelsz_BaseAxis.tick_labels   s     $--((r   c                     | j                   j                  }|t        j                  S |j                  t        j                  S |j                  S )z
        Read/write :ref:`XlTickLabelPosition` value specifying where the tick
        labels for this axis should appear.
        )r   
tickLblPosr   NEXT_TO_AXISrA   )r   rh   s     r   tick_label_positionz_BaseAxis.tick_label_position   sE     ]]--
)666>>!)666~~r   c                 F    | j                   j                         }||_        y r   )r   get_or_add_tickLblPosrA   )r   r.   rh   s      r   rj   z_BaseAxis.tick_label_position   s    ]]88:

r   c                 T    | j                   j                  }|y|j                  rdS dS )zK
        Read/write. |True| if axis is visible, |False| otherwise.
        FT)r   delete_rA   )r   deletes     r   visiblez_BaseAxis.visible   s,    
 &&>

u,,r   c                 l    |dvrt        d|z        | j                  j                         }| |_        y )N)TFz-assigned value must be True or False, got: %s)
ValueErrorr   get_or_add_delete_rA   )r   r.   ro   s      r   rp   z_BaseAxis.visible   s6    %LuTUU113Y
r   )__name__
__module____qualname____doc__r   propertyr    r   r#   r&   setterr2   r8   r=   rB   rN   rV   rZ   ra   rf   rj   rp   __classcell__r   s   @r   r   r      s'   U
 ; ; * * 	 	 3  3 	 	 3  3 	 	 * * - - ! ! 4 4 - -     - -     ! ! 4 4 C C 
 

 ) ) 
 
    - - ^^ r   r   c                   v     e Zd ZdZ fdZed        Zed        Zej                  d        Zed        Z
 xZS )r   z0Provides properties for manipulating axis title.c                 :    t         t        |   |       || _        y r   )r   r   r   _title)r   r7   r   s     r   r   zAxisTitle.__init__   s    i'.r   c                 ,    t        | j                        S )z|ChartFormat| object providing access to shape formatting.

        Return the |ChartFormat| object providing shape formatting properties
        for this axis title, such as its line color and fill.
        r"   r   s    r   r#   zAxisTitle.format   s     4==))r   c                 2    | j                   j                  yy)ad  Read/write Boolean specifying presence of a text frame.

        Return |True| if this axis title has a text frame, and |False|
        otherwise. Assigning |True| causes a text frame to be added if not
        already present. Assigning |False| causes any existing text frame to
        be removed along with any text contained in the text frame.
        FT)r~   tx_richr   s    r   has_text_framezAxisTitle.has_text_frame  s     ;;&r   c                     t        |      du r| j                  j                          y | j                  j                          y r)   )r*   r~   get_or_add_tx_rich
_remove_txr-   s     r   r   zAxisTitle.has_text_frame  s.    ;$KK**,KK""$r   c                 N    | j                   j                         }t        ||       S )a*  |TextFrame| instance for this axis title.

        Return a |TextFrame| instance allowing read/write access to the text
        of this axis title and its text formatting properties. Accessing this
        property is destructive as it adds a new text frame if not already
        present.
        )r~   r   r   )r   richs     r   
text_framezAxisTitle.text_frame  s#     {{--/t$$r   )rt   ru   rv   rw   r   r   r#   rx   r   ry   r   rz   r{   s   @r   r   r      sa    : * * 
 
 % % 	% 	%r   r   c                        e Zd ZdZed        Zy)CategoryAxiszA category axis of a chart.c                 "    t         j                  S )z
        A member of :ref:`XlCategoryType` specifying the scale type of this
        axis. Unconditionally ``CATEGORY_SCALE`` for a |CategoryAxis| object.
        )r   CATEGORY_SCALEr   s    r   category_typezCategoryAxis.category_type)  s      ...r   Nrt   ru   rv   rw   rx   r    r   r   r   r   &  s    %/ /r   r   c                        e Zd ZdZed        Zy)DateAxiszA category axis with dates as its category labels.

    This axis-type has some special display behaviors such as making length of equal
    periods equal and normalizing month start dates despite unequal month lengths.
    c                 "    t         j                  S )z
        A member of :ref:`XlCategoryType` specifying the scale type of this
        axis. Unconditionally ``TIME_SCALE`` for a |DateAxis| object.
        )r   
TIME_SCALEr   s    r   r   zDateAxis.category_type9  s      ***r   Nr   r   r   r   r   r   2  s     + +r   r   c                   2     e Zd ZdZ fdZed        Z xZS )r<   zNProvides access to the properties of the major gridlines appearing on an axis.c                 :    t         t        |   |       || _        y r   )r   r<   r   r   r   s     r   r   zMajorGridlines.__init__E  s    nd,S1	r   c                 L    | j                   j                         }t        |      S )z
        The |ChartFormat| object providing access to the shape formatting
        properties of this data point, such as line and fill.
        )r   r+   r   )r   r%   s     r   r#   zMajorGridlines.formatI  s!     <<>>**r   )rt   ru   rv   rw   r   r   r#   rz   r{   s   @r   r<   r<   B  s    X + +r   r<   c                        e Zd ZdZ fdZed        Zed        Zej                  d        Zed        Z
e
j                  d        Z
ed        Zej                  d	        Z xZS )
re   zHA service class providing access to formatting of axis tick mark labels.c                 8    t         t        |           || _        y r   )r   re   r   r   )r   xAx_elmr   s     r   r   zTickLabels.__init__V  s    j$(*r   c                 H    | j                   j                  }t        |      }|S )z
        The |Font| object that provides access to the text properties for
        these tick labels, such as bold, italic, etc.
        )r   defRPrr   )r   r   fonts      r   r   zTickLabels.fontZ  s!     %%F|r   c                 L    | j                   j                  }|y|j                  S )a  
        Read/write string (e.g. "$#,##0.00") specifying the format for the
        numbers on this axis. The syntax for these strings is the same as it
        appears in the PowerPoint or Excel UI. Returns 'General' if no number
        format has been set. Note that this format string has no effect on
        rendered tick labels when :meth:`number_format_is_linked` is |True|.
        Assigning a format string to this property automatically sets
        :meth:`number_format_is_linked` to |False|.
        General)r   numFmt
formatCode)r   r   s     r   number_formatzTickLabels.number_formatd  s'     %%>   r   c                 T    | j                   j                         }||_        d| _        y )NF)r   get_or_add_numFmtr   number_format_is_linkedr   r.   r   s      r   r   zTickLabels.number_formatt  s$    002!',$r   c                 j    | j                   j                  }|y|j                  }|y|j                  S )z
        Read/write boolean specifying whether number formatting should be
        taken from the source spreadsheet rather than the value of
        :meth:`number_format`.
        FT)r   r   sourceLinked)r   r   souceLinkeds      r   r   z"TickLabels.number_format_is_linkedz  s;     %%>))"""r   c                 F    | j                   j                         }||_        y r   )r   r   r   r   s      r   r   z"TickLabels.number_format_is_linked  s    002#r   c                 L    | j                   j                  }|y|j                  S )z
        Read/write int value in range 0-1000 specifying the spacing between
        the tick mark labels and the axis as a percentange of the default
        value. 100 if no label offset setting is present.
        d   )r   	lblOffsetrA   )r   r   s     r   offsetzTickLabels.offset  s&     MM++	}}r   c                     | j                   j                  t        d      k7  rt        d      | j                   j	                          |dk(  ry | j                   j                         }||_        y )Nzc:catAxz"only a category axis has an offsetr   )r   tagr   rr   _remove_lblOffset_add_lblOffsetrA   )r   r.   r   s      r   r   zTickLabels.offset  sW    ==9-ABB'')C<MM002		r   )rt   ru   rv   rw   r   r   r   rx   r   ry   r   r   rz   r{   s   @r   re   re   S  s    R    ! ! - -
 # # ##$ $$ 	 	 ]] r   re   c                       e Zd ZdZed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Z	e	j                  d	        Z	ed
        Z
y)	ValueAxiszAn axis having continuous (as opposed to discrete) values.

    The vertical axis is generally a value axis, however both axes of an XY-type chart
    are value axes.
    c                 j    | j                   j                  }|t        j                  S |j                  S )a  
        Member of :ref:`XlAxisCrosses` enumeration specifying the point on
        this axis where the other axis crosses, such as auto/zero, minimum,
        or maximum. Returns `XL_AXIS_CROSSES.CUSTOM` when a specific numeric
        crossing point (e.g. 1.5) is defined.
        )
_cross_xAxcrossesr   CUSTOMrA   )r   r   s     r   r   zValueAxis.crosses  s.     //))?"))){{r   c                    | j                   }|t        j                  k(  r|j                  y |j	                          |j                          |t        j                  k(  r|j                  d       y |j                  |       y )Ng        rF   )r   r   r   	crossesAt_remove_crosses_remove_crossesAt_add_crossesAt_add_crossesr   r.   	cross_xAxs      r   r   zValueAxis.crosses  sp    OO	O***"".!!###%O***$$$-""u"-r   c                 L    | j                   j                  }|y|j                  S )z
        Numeric value on this axis at which the perpendicular axis crosses.
        Returns |None| if no crossing value is set.
        N)r   r   rA   )r   r   s     r   
crosses_atzValueAxis.crosses_at  s&     OO--	}}r   c                     | j                   }|j                          |j                          |y |j                  |       y rE   )r   r   r   r   r   s      r   r   zValueAxis.crosses_at  s<    OO	!!###%=  U +r   c                 L    | j                   j                  }|y|j                  S )a  
        The float number of units between major tick marks on this value
        axis. |None| corresponds to the 'Auto' setting in the UI, and
        specifies the value should be calculated by PowerPoint based on the
        underlying chart data.
        N)r   	majorUnitrA   )r   r   s     r   
major_unitzValueAxis.major_unit  &     MM++	}}r   c                 v    | j                   j                          |y | j                   j                  |       y rE   )r   _remove_majorUnit_add_majorUnitr-   s     r   r   zValueAxis.major_unit  /    '')=$$$/r   c                 L    | j                   j                  }|y|j                  S )a  
        The float number of units between minor tick marks on this value
        axis. |None| corresponds to the 'Auto' setting in the UI, and
        specifies the value should be calculated by PowerPoint based on the
        underlying chart data.
        N)r   	minorUnitrA   )r   r   s     r   
minor_unitzValueAxis.minor_unit  r   r   c                 v    | j                   j                          |y | j                   j                  |       y rE   )r   _remove_minorUnit_add_minorUnitr-   s     r   r   zValueAxis.minor_unit  r   r   c                     | j                   j                  j                  }d|z  }| j                   j                  |      d   }|j	                         S )zh
        The axis element in the same group (primary/secondary) that crosses
        this axis.
        z9(../c:catAx | ../c:valAx | ../c:dateAx)/c:axId[@val="%d"]r   )r   crossAxrA   xpath	getparent)r   
crossAx_idexpr
cross_axIds       r   r   zValueAxis._cross_xAx  sK     ]]**..
JZW]]((.q1
##%%r   N)rt   ru   rv   rw   rx   r   ry   r   r   r   r   r   r   r   r   r     s     
 
 ^^
. 
.   , , 
 
 0 0 
 
 0 0 & &r   r   N)rw   pptx.dml.chtfmtr   pptx.enum.chartr   r   r   r   pptx.oxml.nsr   pptx.oxml.simpletypesr	   pptx.sharedr
   pptx.text.textr   r   	pptx.utilr   objectr   r   r   r   r<   re   r   r   r   r   <module>r      s    " '   0 $ * "_ _D.% .%b	/9 	/+y + +\ +"O Odf&	 f&r   