
    hi                       d Z ddl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mZ ddlmZ dd	lmZmZmZmZ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dS )z@Custom element classes for top-level chart-related XML elements.    )annotations)cast)	parse_xml)CT_Title)nsdeclsqn)ST_Style	XsdString)CT_TextBody)BaseOxmlElementOneAndOnlyOneRequiredAttribute
ZeroOrMore	ZeroOrOnec                  "   e Zd ZU dZdZ ededd                   Z ededd                   Z ed	          Z	 ed
edd                   Z
 ede          Zded<   ed             Zej        d             Zedd            Zd ZdS )CT_Chartz`c:chart` custom element class.)c:titlec:autoTitleDeletedzc:pivotFmtszc:view3Dzc:floorz
c:sideWallz
c:backWall
c:plotAreac:legendzc:plotVisOnlyzc:dispBlanksAszc:showDLblsOverMaxc:extLstr      N
successorsr      r   r   	   r:idstrrIdc                    | j         }|dS dS )zK
        True if this chart has a legend defined, False otherwise.
        NFT)legend)selfr!   s     m/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/pptx/oxml/chart/chart.py
has_legendzCT_Chart.has_legend-   s    
 >5t    c                    t          |          du r|                                  dS | j        |                                  dS dS )a-  
        Add, remove, or leave alone the ``<c:legend>`` child element depending
        on current state and *bool_value*. If *bool_value* is |True| and no
        ``<c:legend>`` element is present, a new default element is added.
        When |False|, any existing legend element is removed.
        FN)bool_remove_legendr!   _add_legend)r"   
bool_values     r#   r$   zCT_Chart.has_legend7   sW     
u$$!!!!!{"  """"" #"r%   returnc                    t          t          t          dt          d           dt          d           d|  d                    S )zReturn a new `c:chart` element.z	<c:chart c rz r:id="z"/>)r   r   r   r   )r   s    r#   	new_chartzCT_Chart.new_chartE   sE     Hi(`GCLL(`(`73<<(`(`X[(`(`(`aabbbr%   c                (    t          j                    S N)r   	new_titler"   s    r#   
_new_titlezCT_Chart._new_titleJ   s    !###r%   )r   r   r+   r   )__name__
__module____qualname____doc___tag_seqr   titleautoTitleDeletedr   plotArear!   r   r
   r   __annotations__propertyr$   setterstaticmethodr0   r5    r%   r#   r   r      s        ))H IiHQRRL999E y!5(122,OOO}\**HYzhqrrl;;;F  33C3333  X # # # c c c \c$ $ $ $ $r%   r   c                  l   e Zd ZdZdZ ededd                   Z ededd                   Z ed	          Z	 ed
edd                   Z
 ededd                   Z[ed             Zed             Zed             Zd Zed             Zed             Zed             Zd Zd ZdS )CT_ChartSpacez,`c:chartSpace` root element of a chart part.)
c:date1904zc:langzc:roundedCornersc:stylezc:clrMapOvrzc:pivotSourcezc:protectionc:chartzc:spPrc:txPrc:externalDatazc:printSettingszc:userShapesr   rE   r   Nr   rF      rG   rH   
   rI      c                $    | j         j        j        S r2   )chartr=   	catAx_lstr4   s    r#   rO   zCT_ChartSpace.catAx_lsth       z",,r%   c                &    | j         }|dS |j        S )z
        Return |True| if the `c:date1904` child element resolves truthy,
        |False| otherwise. This value indicates whether date number values
        are based on the 1900 or 1904 epoch.
        NF)date1904val)r"   rR   s     r#   	date_1904zCT_ChartSpace.date_1904l   s     =5|r%   c                ,    |                      d          S )Nzc:chart/c:plotArea/c:dateAx)xpathr4   s    r#   
dateAx_lstzCT_ChartSpace.dateAx_lstx   s    zz7888r%   c                4    | j                                         S )z>Return the `c:title` grandchild, newly created if not present.)rN   get_or_add_titler4   s    r#   rY   zCT_ChartSpace.get_or_add_title|   s    z**,,,r%   c                    | j         j        S )zc
        Return the required `c:chartSpace/c:chart/c:plotArea` grandchild
        element.
        )rN   r=   r4   s    r#   r=   zCT_ChartSpace.plotArea   s     z""r%   c                $    | j         j        j        S r2   )rN   r=   	valAx_lstr4   s    r#   r\   zCT_ChartSpace.valAx_lst   rP   r%   c                &    | j         }|dS |j        S )z
        The string in the required ``r:id`` attribute of the
        `<c:externalData>` child, or |None| if no externalData element is
        present.
        N)externalDatar   r"   r^   s     r#   xlsx_part_rIdzCT_ChartSpace.xlsx_part_rId   s      (4r%   c                    |                                  }|                    d           |                     |           |S )zu
        Always add a ``<c:autoUpdate val="0"/>`` child so auto-updating
        behavior is off by default.
        F)rS   )_new_externalData_add_autoUpdate_insert_externalDatar_   s     r#   _add_externalDatazCT_ChartSpace._add_externalData   sF    
 --//$$$///!!,///r%   c                (    t          j                    S r2   )r   new_txPrr4   s    r#   	_new_txPrzCT_ChartSpace._new_txPr   s    #%%%r%   )r6   r7   r8   r9   r:   r   rR   styler   rN   txPrr^   r?   rO   rT   rW   rY   r=   r\   r`   re   rh   rB   r%   r#   rD   rD   N   ss       66H  y(122,???HIiHQRRL999EM)$$E9X(233-888D9-(233-HHHL- - X- 	 	 X	 9 9 X9- - - # # X# - - X- 	  	  X	   & & & & &r%   rD   c                  @    e Zd ZdZ ed          Z ede          ZdS )CT_ExternalDatazq
    `<c:externalData>` element, defining link to embedded Excel package part
    containing the chart data.
    zc:autoUpdater   N)	r6   r7   r8   r9   r   
autoUpdater   r
   r   rB   r%   r#   rl   rl      s;         
 >**J

FI
.
.CCCr%   rl   c                      e Zd ZdZ ed          Z ed          Zd Zd Ze	d             Z
e	d             Ze	d             Ze	d	             Ze	d
             ZdS )CT_PlotAreaz#
    ``<c:plotArea>`` element.
    zc:catAxzc:valAxc              #  n   K   |                                  D ]}|                                D ]}|V  dS )z
        Generate each of the `c:ser` elements in this chart, ordered first by
        the document order of the containing xChart element, then by their
        ordering within the xChart element (not necessarily document order).
        N)iter_xCharts	iter_sers)r"   xChartsers      r#   rr   zCT_PlotArea.iter_sers   sX       '')) 	 	F''))  					 	r%   c              #    K   t          d          t          d          t          d          t          d          t          d          t          d          t          d          t          d          t          d	          t          d
          t          d          t          d          t          d          t          d          t          d          t          d          f}|                                 D ]}|j        |vr|V  dS )zA
        Generate each xChart child element in document.
        zc:area3DChartzc:areaChartzc:bar3DChartz
c:barChartzc:bubbleChartzc:doughnutChartzc:line3DChartzc:lineChartzc:ofPieChartzc:pie3DChartz
c:pieChartzc:radarChartzc:scatterChartzc:stockChartzc:surface3DChartzc:surfaceChartN)r   iterchildrentag)r"   	plot_tagschilds      r#   rq   zCT_PlotArea.iter_xCharts   s     
 }~| !!}~~|~  ~!""  !
	& &&(( 	 	Ey	))KKKK	 	r%   c                B    | j         d         }|j        }|sdS |d         S )z
        Return the last `<c:ser>` element in the last xChart element, based
        on series order (not necessarily the same element as document order).
        N)xChartssers)r"   last_xChartr}   s      r#   last_serzCT_PlotArea.last_ser   s.     l2& 	4Bxr%   c                P    d | j         D             }|sdS t          |          dz   S )z
        Return the next available `c:ser/c:idx` value within the scope of
        this chart, the maximum idx value found on existing series,
        incremented by one.
        c                &    g | ]}|j         j        S rB   )idxrS   .0ss     r#   
<listcomp>z(CT_PlotArea.next_idx.<locals>.<listcomp>   s    111!AEI111r%   r   r   r}   max)r"   idx_valss     r#   next_idxzCT_PlotArea.next_idx   s7     21ty111 	18}}q  r%   c                P    d | j         D             }|sdS t          |          dz   S )z
        Return the next available `c:ser/c:order` value within the scope of
        this chart, the maximum order value found on existing series,
        incremented by one.
        c                &    g | ]}|j         j        S rB   )orderrS   r   s     r#   r   z*CT_PlotArea.next_order.<locals>.<listcomp>   s    555aagk555r%   r   r   r   )r"   
order_valss     r#   
next_orderzCT_PlotArea.next_order   s7     6549555
 	1:""r%   c                D    t          |                                           S )a  
        Return a sequence containing all the `c:ser` elements in this chart,
        ordered first by the document order of the containing xChart element,
        then by their ordering within the xChart element (not necessarily
        document order).
        )tuplerr   r4   s    r#   r}   zCT_PlotArea.sers  s     T^^%%&&&r%   c                D    t          |                                           S )zv
        Return a sequence containing all the `c:{x}Chart` elements in this
        chart, in document order.
        )r   rq   r4   s    r#   r|   zCT_PlotArea.xCharts  s     T&&(()))r%   N)r6   r7   r8   r9   r   catAxvalAxrr   rq   r?   r   r   r   r}   r|   rB   r%   r#   ro   ro      s          Jy!!EJy!!E    8 	 	 X	 	! 	! X	! 	# 	# X	# ' ' X' * * X* * *r%   ro   c                  *    e Zd ZdZ ede          ZdS )CT_Stylez9
    ``<c:style>`` element; defines the chart style.
    rS   N)r6   r7   r8   r9   r   r	   rS   rB   r%   r#   r   r     s,          
E8
,
,CCCr%   r   N)r9   
__future__r   typingr   	pptx.oxmlr   pptx.oxml.chart.sharedr   pptx.oxml.nsr   r   pptx.oxml.simpletypesr	   r
   pptx.oxml.textr   pptx.oxml.xmlchemyr   r   r   r   r   r   rD   rl   ro   r   rB   r%   r#   <module>r      s   F F " " " " " "             + + + + + + $ $ $ $ $ $ $ $ 5 5 5 5 5 5 5 5 & & & & & &             6$ 6$ 6$ 6$ 6$ 6$ 6$ 6$rU& U& U& U& U&O U& U& U&p/ / / / /o / / /b* b* b* b* b*/ b* b* b*J- - - - - - - - - -r%   