
    l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y)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y)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                   }|yy)zK
        True if this chart has a legend defined, False otherwise.
        FT)legend)selfr!   s     S/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/pptx/oxml/chart/chart.py
has_legendzCT_Chart.has_legend-   s    
 >    c                z    t        |      du r| j                          y| j                  | j                          yy)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   s8     
u$!{{"  " #r%   c                l    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   s7     Hi)GCL>73<.PWX[W\\_(`abbr%   c                *    t        j                         S N)r   	new_titler"   s    r#   
_new_titlezCT_Chart._new_titleJ   s    !!##r%   )r   r   returnr   )__name__
__module____qualname____doc___tag_seqr   titleautoTitleDeletedr   plotArear!   r   r
   r   __annotations__propertyr$   setterstaticmethodr/   r4    r%   r#   r   r      s    )H iHQRL9E !5(12,O\*Hzhqrl;F 3C3  # # c c$r%   r   c                      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y)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                B    | j                   j                  j                  S r1   )chartr=   	catAx_lstr3   s    r#   rO   zCT_ChartSpace.catAx_lsth       zz"",,,r%   c                8    | j                   }|y|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.
        F)date1904val)r"   rR   s     r#   	date_1904zCT_ChartSpace.date_1904l   s      ==||r%   c                $    | j                  d      S )Nzc:chart/c:plotArea/c:dateAx)xpathr3   s    r#   
dateAx_lstzCT_ChartSpace.dateAx_lstx   s    zz788r%   c                6    | j                   j                         S )z>Return the `c:title` grandchild, newly created if not present.)rN   get_or_add_titler3   s    r#   rY   zCT_ChartSpace.get_or_add_title|   s    zz**,,r%   c                .    | j                   j                  S )zc
        Return the required `c:chartSpace/c:chart/c:plotArea` grandchild
        element.
        )rN   r=   r3   s    r#   r=   zCT_ChartSpace.plotArea   s     zz"""r%   c                B    | j                   j                  j                  S r1   )rN   r=   	valAx_lstr3   s    r#   r\   zCT_ChartSpace.valAx_lst   rP   r%   c                8    | j                   }|y|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$     ((r%   c                l    | j                         }|j                  d       | j                  |       |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   s7    
 --/$$$/!!,/r%   c                *    t        j                         S r1   )r   new_txPrr3   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   s    6H  (12,?HiHQRL9E)$EX(23-8D-(23-HL- - 	 	 9 9- # # - - 	  	 &r%   rD   c                  2    e Zd ZdZ ed      Z ede      Zy)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
.Cr%   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y)CT_PlotAreaz#
    ``<c:plotArea>`` element.
    zc:catAxzc:valAxc              #  h   K   | j                         D ]  }|j                         D ]  }|   yw)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   s=      '') 	F'') 		s   02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}| j                         D ]  }|j                  |vr|  yw)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yy	)K	s   CCc                H    | j                   d   }|j                  }|sy|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,     ll2&Bxr%   c                    | j                   D cg c]  }|j                  j                   }}|syt        |      dz   S c c}w )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.
        r   r   )r}   idxrS   max)r"   sidx_valss      r#   next_idxzCT_PlotArea.next_idx   s=     (,yy1!AEEII118}q   2   ?c                    | j                   D cg c]  }|j                  j                   }}|syt        |      dz   S c c}w )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.
        r   r   )r}   orderrS   r   )r"   r   
order_valss      r#   
next_orderzCT_PlotArea.next_order   s=     ,0995aaggkk5
5:"" 6r   c                4    t        | j                               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   r3   s    r#   r}   zCT_PlotArea.sers  s     T^^%&&r%   c                4    t        | j                               S )zv
        Return a sequence containing all the `c:{x}Chart` elements in this
        chart, in document order.
        )r   rq   r3   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     y!Ey!E8 	 	 	! 	! 	# 	# ' ' * *r%   ro   c                  "    e Zd ZdZ ede      Zy)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
,Cr%   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      sj    F "   + $ 5 & 6$ 6$rU&O U&p/o /b*/ b*J- -r%   