
    ,h8%                     h    d Z ddlmZmZmZmZ ddlmZmZ ddl	m
Z
  G d de      Z G d d	e      Zy
)z
Data label-related objects.
    )absolute_importdivisionprint_functionunicode_literals   )Font	TextFrame)lazypropertyc                       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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 xZS )
DataLabelsa?  Provides access to properties of data labels for a plot or a series.

    This is not a collection and does not provide access to individual data
    labels. Access to individual labels is via the |Point| object. The
    properties this object provides control formatting of *all* the data
    labels in its scope.
    c                 8    t         t        |           || _        y N)superr   __init___element)selfdLbls	__class__s     V/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/chart/datalabel.pyr   zDataLabels.__init__   s    j$(*    c                 H    | j                   j                  }t        |      }|S )z
        The |Font| object that provides access to the text properties for
        these data labels, such as bold, italic, etc.
        )r   defRPrr   )r   r   fonts      r   r   zDataLabels.font   s!     %%F|r   c                 L    | j                   j                  }|y|j                  S )a  
        Read/write string specifying the format for the numbers on this set
        of data labels. Returns 'General' if no number format has been set.
        Note that this format string has no effect on rendered data 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DataLabels.number_format$   s'     %%>   r   c                 P    || j                   j                         _        d| _        y )NF)r   get_or_add_numFmtr   number_format_is_linkedr   values     r   r   zDataLabels.number_format3   s    7<'')4',$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`.
        T)r   r   sourceLinked)r   r   souceLinkeds      r   r!   z"DataLabels.number_format_is_linked8   s;     %%>))"""r   c                 F    | j                   j                         }||_        y r   )r   r    r%   )r   r#   r   s      r   r!   z"DataLabels.number_format_is_linkedG   s    002#r   c                 L    | j                   j                  }|y|j                  S )a<  
        Read/write :ref:`XlDataLabelPosition` enumeration value specifying
        the position of the data labels with respect to their data point, or
        |None| if no position is specified. Assigning |None| causes
        PowerPoint to choose the default position, which varies by chart
        type.
        N)r   dLblPosval)r   r)   s     r   positionzDataLabels.positionL   s%     --''?{{r   c                 |    || j                   j                          y || j                   j                         _        y r   )r   _remove_dLblPosget_or_add_dLblPosr*   r"   s     r   r+   zDataLabels.positionZ   s/    =MM))+16((*.r   c                 J    | j                   j                         j                  S )z>Read/write. True when name of category should appear in label.)r   get_or_add_showCatNamer*   r   s    r   show_category_namezDataLabels.show_category_namea        }}335999r   c                 T    t        |      | j                  j                         _        y r   )boolr   r0   r*   r"   s     r   r2   zDataLabels.show_category_namef       59%[,,.2r   c                 J    | j                   j                         j                  S )z>Read/write. True when data label displays legend-color swatch.)r   get_or_add_showLegendKeyr*   r1   s    r   show_legend_keyzDataLabels.show_legend_keyj   s     }}557;;;r   c                 T    t        |      | j                  j                         _        y r   )r5   r   r8   r*   r"   s     r   r9   zDataLabels.show_legend_keyo   s    7;E{..04r   c                 J    | j                   j                         j                  S )zRead/write. True when data label displays percentage.

        This option is not operative on all chart types. Percentage appears
        on polar charts such as pie and donut.
        )r   get_or_add_showPercentr*   r1   s    r   show_percentagezDataLabels.show_percentages   s     }}335999r   c                 T    t        |      | j                  j                         _        y r   )r5   r   r<   r*   r"   s     r   r=   zDataLabels.show_percentage|   r6   r   c                 J    | j                   j                         j                  S )z6Read/write. True when data label displays series name.)r   get_or_add_showSerNamer*   r1   s    r   show_series_namezDataLabels.show_series_name   r3   r   c                 T    t        |      | j                  j                         _        y r   )r5   r   r@   r*   r"   s     r   rA   zDataLabels.show_series_name   r6   r   c                 J    | j                   j                         j                  S )z@Read/write. True when label displays numeric value of datapoint.)r   get_or_add_showValr*   r1   s    r   
show_valuezDataLabels.show_value   s     }}//1555r   c                 T    t        |      | j                  j                         _        y r   )r5   r   rD   r*   r"   s     r   rE   zDataLabels.show_value   s    15e((*.r   )__name__
__module____qualname____doc__r   r
   r   propertyr   setterr!   r+   r2   r9   r=   rA   rE   __classcell__r   s   @r   r   r      s      ! ! - - # # ##$ $$   __7 7 : : A A < < C C : : A A : : A A 6 6 = =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d	        Zd
 Zd Zd Zd Zd Z xZS )	DataLabelzB
    The data label associated with an individual data point.
    c                 T    t         t        |           |x| _        | _        || _        y r   )r   rP   r   _serr   _idx)r   seridxr   s      r   r   zDataLabel.__init__   s%    i')$''	DM	r   c                 p    | j                         }t        ||       }|j                  d   }|j                  S )a  The |Font| object providing text formatting for this data label.

        This font object is used to customize the appearance of automatically
        inserted text, such as the data point value. The font applies to the
        entire data label. More granular control of the appearance of custom
        data label text is controlled by a font object on runs in the text
        frame.
        r   )_get_or_add_txPrr	   
paragraphsr   )r   txPr
text_frame	paragraphs       r   r   zDataLabel.font   s8     $$&tT*
))!,	~~r   c                 F    | j                   }|y|j                  d      ryy)a]  
        Return |True| if this data label has a text frame (implying it has
        custom data label text), 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.
        Fzc:tx/c:richT)_dLblxpathr   dLbls     r   has_text_framezDataLabel.has_text_frame   s'     zz<::m$r   c                 `    t        |      du r| j                          y | j                          y )NT)r5   _get_or_add_tx_rich_remove_tx_richr"   s     r   ra   zDataLabel.has_text_frame   s&    ;$$$&  "r   c                 V    | j                   }|y|j                  }|y|j                  S )a'  
        Read/write :ref:`XlDataLabelPosition` member specifying the position
        of this data label with respect to its data point, or |None| if no
        position is specified. Assigning |None| causes PowerPoint to choose
        the default position, which varies by chart type.
        N)r]   r)   r*   )r   r`   r)   s      r   r+   zDataLabel.position   s0     zz<,,?{{r   c                     | | j                   }|y |j                          y | j                         }||j                         _        y r   )r]   r-   _get_or_add_dLblr.   r*   )r   r#   r`   s      r   r+   zDataLabel.position   sF    =::D|  "$$&(-!%r   c                 :    | j                         }t        ||       S )z
        |TextFrame| instance for this data label, containing the text of the
        data label and providing access to its text formatting properties.
        )_get_or_add_richr	   )r   richs     r   rZ   zDataLabel.text_frame   s     $$&t$$r   c                 L    | j                   j                  | j                        S )z
        Return the |CT_DLbl| instance referring specifically to this
        individual data label (having the same index value), or |None| if not
        present.
        )rR   get_dLblrS   r1   s    r   r]   zDataLabel._dLbl   s     yy!!$)),,r   c                 L    | j                   j                  | j                        S )z
        The ``CT_DLbl`` instance referring specifically to this individual
        data label, newly created if not yet present in the XML.
        )rR   get_or_add_dLblrS   r1   s    r   rg   zDataLabel._get_or_add_dLbl   s    
 yy((33r   c                     | j                         }|j                          |j                          |j                         S )z
        Return the `c:rich` element representing the text frame for this data
        label, newly created with its ancestors if not present.
        )rg   _remove_spPr_remove_txPrget_or_add_richr_   s     r   ri   zDataLabel._get_or_add_rich   s;    
 $$& 	##%%r   c                     | j                         }|j                          |j                          |j                         S )z
        Return the `c:tx` element for this data label, with its `c:rich`
        child and descendants, newly created if not yet present.
        )rg   rp   rq   get_or_add_tx_richr_   s     r   rc   zDataLabel._get_or_add_tx_rich  s;    
 $$& 	&&((r   c                 B    | j                         }|j                         S )zReturn the `c:txPr` element for this data label.

        The `c:txPr` element and its parent `c:dLbl` element are created if
        not yet present.
        )rg   get_or_add_txPrr_   s     r   rW   zDataLabel._get_or_add_txPr  s!     $$&##%%r   c                 B    | j                   }|y|j                          y)z
        Remove any `c:tx/c:rich` child of the `c:dLbl` element for this data
        label. Do nothing if that element is not present.
        N)r]   remove_tx_richr_   s     r   rd   zDataLabel._remove_tx_rich  s!    
 zz<r   )rG   rH   rI   rJ   r   r
   r   rK   ra   rL   r+   rZ   r]   rg   ri   rc   rW   rd   rM   rN   s   @r   rP   rP      s    
     # #   __. . % % - -4&)&r   rP   N)rJ   
__future__r   r   r   r   	text.textr   r	   utilr
   objectr   rP    r   r   <module>r~      s6    S R ' C= C=LQ Qr   