o
    7 ¾hÔ	  ã                   @  sH   d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd„ de	ƒZ
dS )	zLegend of a chart.é    )Úannotations)ÚXL_LEGEND_POSITION)ÚFont)Úlazypropertyc                      sz   e Zd ZdZ‡ fdd„Zedd„ ƒZedd„ ƒZej	dd„ ƒZed	d
„ ƒZ
e
j	dd
„ ƒZ
edd„ ƒZej	dd„ ƒZ‡  ZS )ÚLegendzP
    Represents the legend in a chart. A chart can have at most one legend.
    c                   s   t t| ƒ ¡  || _d S ©N)Úsuperr   Ú__init__Ú_element)ÚselfÚ
legend_elm©Ú	__class__© úY/var/www/html/figdemos/bartoux_crm/venv/lib/python3.10/site-packages/pptx/chart/legend.pyr	      s   
zLegend.__init__c                 C  s   | j j}t|ƒ}|S )zƒ
        The |Font| object that provides access to the text properties for
        this legend, such as bold, italic, etc.
        )r
   ÚdefRPrr   )r   r   Úfontr   r   r   r      s   zLegend.fontc                 C  s   | j jS )a+  
        Adjustment of the x position of the legend from its default.
        Expressed as a float between -1.0 and 1.0 representing a fraction of
        the chart width. Negative values move the legend left, positive
        values move it to the right. |None| if no setting is specified.
        ©r
   Úhorz_offset)r   r   r   r   r      s   zLegend.horz_offsetc                 C  s   || j _d S r   r   ©r   Úvaluer   r   r   r   '   s   c                 C  s   | j j}|du r
dS |jS )aÚ  |True| if legend should be located inside plot area.

        Read/write boolean specifying whether legend should be placed inside
        the plot area. In many cases this will cause it to be superimposed on
        the chart itself. Assigning |None| to this property causes any
        `c:overlay` element to be removed, which is interpreted the same as
        |True|. This use case should rarely be required and assigning
        a boolean value is recommended.
        NT)r
   ÚoverlayÚval)r   r   r   r   r   Úinclude_in_layout+   s   zLegend.include_in_layoutc                 C  s*   |d u r| j  ¡  d S t|ƒ| j  ¡ _d S r   )r
   Ú_remove_overlayÚboolÚget_or_add_overlayr   r   r   r   r   r   ;   s   
c                 C  s   | j j}|du rtjS |jS )z—
        Read/write :ref:`XlLegendPosition` enumeration value specifying the
        general region of the chart in which to place the legend.
        N)r
   Ú	legendPosr   ÚRIGHTr   )r   r   r   r   r   ÚpositionB   s   zLegend.positionc                 C  s   || j  ¡ _d S r   )r
   Úget_or_add_legendPosr   )r   r   r   r   r   r   M   s   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r   r   Úpropertyr   Úsetterr   r   Ú__classcell__r   r   r   r   r   
   s"    
	
	




r   N)r$   Ú
__future__r   Úpptx.enum.chartr   Úpptx.text.textr   Ú	pptx.utilr   Úobjectr   r   r   r   r   Ú<module>   s    