
    hi9t                       d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
mZ ddl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 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 G d% d&e          ZdS )'zChartData and related objects.    )annotationsN)Sequence)Number)BubbleWorkbookWriterCategoryWorkbookWriterXyWorkbookWriter)ChartXmlWriter)lazypropertyc                       e Zd ZdZd fd	Zd Zd Zd Zd Ze	d             Z
d	 Zd
 Zd Ze	d             Zd Zd Ze	d             Zd Z xZS )_BaseChartDataa  Base class providing common members for chart data objects.

    A chart data object serves as a proxy for the chart data table that will be written to an
    Excel worksheet; operating as a sequence of series as well as providing access to chart-level
    attributes. A chart data object is used as a parameter in :meth:`shapes.add_chart` and
    :meth:`Chart.replace_data`. The data structure varies between major chart categories such as
    category charts and XY charts.
    Generalc                r    t          t          |                                            || _        g | _        d S N)superr   __init___number_format_series)selfnumber_format	__class__s     g/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/pptx/chart/data.pyr   z_BaseChartData.__init__   s2    nd##,,...+    c                6    | j                             |          S r   )r   __getitem__r   indexs     r   r   z_BaseChartData.__getitem__!   s    |''...r   c                4    | j                                         S r   )r   __len__r   s    r   r   z_BaseChartData.__len__$   s    |##%%%r   c                6    | j                             |          S r   )r   appendr   seriess     r   r!   z_BaseChartData.append'   s    |""6***r   c                b    d}| D ]}||u r|c S |t          |          z  }t          d          )z
        The total integer number of data points appearing in the series of
        this chart that are prior to *series* in this sequence.
        r   series not in chart data object)len
ValueError)r   r#   countthis_seriess       r   data_point_offsetz _BaseChartData.data_point_offset*   sO    
  	& 	&K$$S%%%EE:;;;r   c                    | j         S )ao  
        The formatting template string, e.g. '#,##0.0', that determines how
        X and Y values are formatted in this chart and in the Excel
        spreadsheet. A number format specified on a series will override this
        value for that series. Likewise, a distinct number format can be
        specified for a particular data point within a series.
        r   r   s    r   r   z_BaseChartData.number_format6   s     ""r   c                Z    t          |           D ]\  }}||u r|c S t          d          )zH
        Return the integer index of *series* in this sequence.
        r%   )	enumerater'   )r   r#   idxss       r   series_indexz_BaseChartData.series_indexA   sC      oo 	 	FC{{


 :;;;r   c                6    | j                             |          S )zl
        Return the Excel worksheet reference to the cell containing the name
        for *series*.
        )_workbook_writerseries_name_refr"   s     r   r4   z_BaseChartData.series_name_refJ   s    
 $44V<<<r   c                6    | j                             |          S )zv
        The Excel worksheet reference to the X values for *series* (not
        including the column label).
        )r3   x_values_refr"   s     r   r6   z_BaseChartData.x_values_refQ       
 $11&999r   c                    | j         j        S )z
        Return a blob containing an Excel workbook file populated with the
        contents of this chart data object.
        )r3   	xlsx_blobr   s    r   r9   z_BaseChartData.xlsx_blobX   s     $..r   c                R    |                      |                              d          S )z
        Return a blob containing the XML for a chart of *chart_type*
        containing the series in this chart data object, as bytes suitable
        for writing directly to a file.
        zutf-8)_xmlencoder   
chart_types     r   	xml_bytesz_BaseChartData.xml_bytes`   s$     yy$$++G444r   c                6    | j                             |          S )zv
        The Excel worksheet reference to the Y values for *series* (not
        including the column label).
        )r3   y_values_refr"   s     r   rA   z_BaseChartData.y_values_refh   r7   r   c                     t          d          )
        The worksheet writer object to which layout and writing of the Excel
        worksheet for this chart will be delegated.
        z%must be implemented by all subclasses)NotImplementedErrorr   s    r   r3   z_BaseChartData._workbook_writero   s     ""IJJJr   c                ,    t          ||           j        S )z
        Return (as unicode text) the XML for a chart of *chart_type*
        populated with the values in this chart data object. The XML is
        a complete XML document, including an XML declaration specifying
        UTF-8 encoding.
        )r	   xmlr=   s     r   r;   z_BaseChartData._xmlw   s     j$//33r   )r   )__name__
__module____qualname____doc__r   r   r   r!   r*   propertyr   r1   r4   r6   r9   r?   rA   r3   r;   __classcell__r   s   @r   r   r      s1             
/ / /& & &+ + +
< 
< 
< # # X#< < <= = =: : : / / X/5 5 5: : : K K XK4 4 4 4 4 4 4r   r   c                      e Zd ZdZd Zd Zd Zd Zed             Z	ed             Z
ed             Zed	             Zed
             Zed             Zed             Zed             Zed             ZdS )_BaseSeriesDataa   
    Base class providing common members for series data objects. A series
    data object serves as proxy for a series data column in the Excel
    worksheet. It operates as a sequence of data points, as well as providing
    access to series-level attributes like the series label.
    c                >    || _         || _        || _        g | _        d S r   )_chart_data_namer   _data_points)r   
chart_datanamer   s       r   r   z_BaseSeriesData.__init__   s'    %
+r   c                6    | j                             |          S r   )rS   r   r   s     r   r   z_BaseSeriesData.__getitem__   s     ,,U333r   c                4    | j                                         S r   )rS   r   r   s    r   r   z_BaseSeriesData.__len__   s     ((***r   c                6    | j                             |          S r   )rS   r!   )r   
data_points     r   r!   z_BaseSeriesData.append   s     ''
333r   c                6    | j                             |           S )zm
        The integer count of data points that appear in all chart series
        prior to this one.
        )rQ   r*   r   s    r   r*   z!_BaseSeriesData.data_point_offset   s     11$777r   c                6    | j                             |           S )z
        Zero-based integer indicating the sequence position of this series in
        its chart. For example, the second of three series would return `1`.
        )rQ   r1   r   s    r   r   z_BaseSeriesData.index        ,,T222r   c                "    | j         | j         ndS )z
        The name of this series, e.g. 'Series 1'. This name is used as the
        column heading for the y-values of this series and may also appear in
        the chart legend and perhaps other chart locations.
        N )rR   r   s    r   rU   z_BaseSeriesData.name   s     "Z3tzz;r   c                6    | j                             |           S )zh
        The Excel worksheet reference to the cell containing the name for
        this series.
        )rQ   r4   r   s    r   name_refz_BaseSeriesData.name_ref   s     //555r   c                0    | j         }|| j        j        S |S )a  
        The formatting template string that determines how a number in this
        series is formatted, both in the chart and in the Excel spreadsheet;
        for example '#,##0.0'. If not specified for this series, it is
        inherited from the parent chart data object.
        )r   rQ   r   r   r   s     r   r   z_BaseSeriesData.number_format   s$     + #11r   c                $    d | j         D             S )zr
        A sequence containing the X value of each datapoint in this series,
        in data point order.
        c                    g | ]	}|j         
S  )x.0dps     r   
<listcomp>z,_BaseSeriesData.x_values.<locals>.<listcomp>       111111r   rS   r   s    r   x_valuesz_BaseSeriesData.x_values        21t01111r   c                6    | j                             |           S )zz
        The Excel worksheet reference to the X values for this chart (not
        including the column heading).
        )rQ   r6   r   s    r   r6   z_BaseSeriesData.x_values_ref   r\   r   c                $    d | j         D             S )zr
        A sequence containing the Y value of each datapoint in this series,
        in data point order.
        c                    g | ]	}|j         
S re   )yrg   s     r   rj   z,_BaseSeriesData.y_values.<locals>.<listcomp>   rk   r   rl   r   s    r   y_valuesz_BaseSeriesData.y_values   rn   r   c                6    | j                             |           S )zz
        The Excel worksheet reference to the Y values for this chart (not
        including the column heading).
        )rQ   rA   r   s    r   rA   z_BaseSeriesData.y_values_ref   r\   r   N)rG   rH   rI   rJ   r   r   r   r!   rK   r*   r   rU   r`   r   rm   r6   rs   rA   re   r   r   rO   rO      sM          4 4 4+ + +4 4 4 8 8 X8 3 3 X3 < < X< 6 6 X6 
 
 X
 2 2 X2 3 3 X3 2 2 X2 3 3 X3 3 3r   rO   c                  8     e Zd ZdZ fdZed             Z xZS )_BaseDataPointzE
    Base class providing common members for data point objects.
    c                r    t          t          |                                            || _        || _        d S r   )r   rv   r   _series_datar   )r   series_datar   r   s      r   r   z_BaseDataPoint.__init__   s5    nd##,,...'+r   c                0    | j         }|| j        j        S |S )a(  
        The formatting template string that determines how the value of this
        data point is formatted, both in the chart and in the Excel
        spreadsheet; for example '#,##0.0'. If not specified for this data
        point, it is inherited from the parent series data object.
        )r   rx   r   rb   s     r   r   z_BaseDataPoint.number_format   s$     + $22r   )rG   rH   rI   rJ   r   rK   r   rL   rM   s   @r   rv   rv      s]         , , , , ,
 
 
 X
 
 
 
 
r   rv   c                      e Zd ZdZd ZddZed             Zej        d             Zed             Z	d	 Z
ed
             ZdS )CategoryChartDataa  
    Accumulates data specifying the categories and series values for a chart
    and acts as a proxy for the chart data table that will be written to an
    Excel worksheet. Used as a parameter in :meth:`shapes.add_chart` and
    :meth:`Chart.replace_data`.

    This object is suitable for use with category charts, i.e. all those
    having a discrete set of label values (categories) as the range of their
    independent variable (X-axis) values. Unlike the ChartData types for
    charts supporting a continuous range of independent variable values (such
    as XyChartData), CategoryChartData has a single collection of category
    (X) values and each data point in its series specifies only the Y value.
    The corresponding X value is inferred by its position in the sequence.
    c                6    | j                             |          S )a  
        Return a newly created |data.Category| object having *label* and
        appended to the end of the category collection for this chart.
        *label* can be a string, a number, a datetime.date, or
        datetime.datetime object. All category labels in a chart must be the
        same type. All category labels in a chart having multi-level
        categories must be strings.
        )
categoriesadd_category)r   labels     r   r   zCategoryChartData.add_category  s     ++E222r   re   Nc                    t          | ||          }|                     |           |D ]}|                    |           |S )a>  
        Add a series to this data set entitled *name* and having the data
        points specified by *values*, an iterable of numeric values.
        *number_format* specifies how the series values will be displayed,
        and may be a string, e.g. '#,##0' corresponding to an Excel number
        format.
        )CategorySeriesDatar!   add_data_point)r   rU   valuesr   ry   values         r   
add_serieszCategoryChartData.add_series  sS     )t]CCK    	. 	.E&&u----r   c                X    t          | dd          st                      | _        | j        S )a  |data.Categories| object providing access to category-object hierarchy.

        Assigning an iterable of category labels (strings, numbers, or dates) replaces
        the |data.Categories| object with a new one containing a category for each label
        in the sequence.

        Creating a chart from chart data having date categories will cause the chart to
        have a |DateAxis| for its category axis.
        _categoriesF)getattr
Categoriesr   r   s    r   r~   zCategoryChartData.categories(  s-     t]E22 	,)||Dr   c                d    t                      }|D ]}|                    |           || _        d S r   )r   r   r   )r   category_labelsr~   r   s       r   r~   zCategoryChartData.categories7  s?    \\
$ 	+ 	+E##E****%r   c                    | j         j        S z|
        The Excel worksheet reference to the categories for this chart (not
        including the column heading).
        )r3   categories_refr   s    r   r   z CategoryChartData.categories_ref>  s     $33r   c                6    | j                             |          S )zv
        The Excel worksheet reference to the values for *series* (not
        including the column heading).
        )r3   
values_refr"   s     r   r   zCategoryChartData.values_refF  s    
 $//777r   c                     t          |           S rC   )r   r   s    r   r3   z"CategoryChartData._workbook_writerM  s     &d+++r   )re   N)rG   rH   rI   rJ   r   r   rK   r~   setterr   r   r
   r3   re   r   r   r|   r|      s         	3 	3 	3        X  & & & 4 4 X48 8 8 , , \, , ,r   r|   c                       e Zd ZdZ fdZd Zd Zd Zed             Z	ed             Z
ed             Zd	 Zed
             Zed             Zed             Zej        d             Z xZS )r   z
    A sequence of |data.Category| objects, also having certain hierarchical
    graph behaviors for support of multi-level (nested) categories.
    c                r    t          t          |                                            g | _        d | _        d S r   )r   r   r   r   r   )r   r   s    r   r   zCategories.__init__\  s5    j$((***"r   c                6    | j                             |          S r   )r   r   )r   r/   s     r   r   zCategories.__getitem__a  s    ++C000r   c                4    | j                                         S )z
        Return the count of the highest level of category in this sequence.
        If it contains hierarchical (multi-level) categories, this number
        will differ from :attr:`category_count`, which is the number of leaf
        nodes.
        )r   r   r   s    r   r   zCategories.__len__d  s     '')))r   c                Z    t          ||           }| j                            |           |S )a   
        Return a newly created |data.Category| object having *label* and
        appended to the end of this category sequence. *label* can be
        a string, a number, a datetime.date, or datetime.datetime object. All
        category labels in a chart must be the same type. All category labels
        in a chart having multi-level categories must be strings.

        Creating a chart from chart data having date categories will cause
        the chart to have a |DateAxis| for its category axis.
        )Categoryr   r!   r   r   categorys      r   r   zCategories.add_categorym  s/     E4(()))r   c                    | j         dk    rdS | d         j        }t          j        t          j        f}t	          ||          rdS dS )a  
        Return |True| if the first category in this collection has a date
        label (as opposed to str or numeric). A date label is one of type
        datetime.date or datetime.datetime. Returns |False| otherwise,
        including when this category collection is empty. It also returns
        False when this category collection is hierarchical, because
        hierarchical categories can only be written as string labels.
           Fr   T)depthr   datetimedate
isinstance)r   first_cat_label
date_typess      r   	are_dateszCategories.are_dates|  sJ     :??5q'-mX%67
oz22 	4ur   c                    | j         dk    rdS | d         j        }t          t          j        t          j        f}t          ||          rdS dS )a  
        Return |True| if the first category in this collection has a numeric
        label (as opposed to a string label), including if that value is
        a datetime.date or datetime.datetime object (as those are converted
        to integers for storage in Excel). Returns |False| otherwise,
        including when this category collection is empty. It also returns
        False when this category collection is hierarchical, because
        hierarchical categories can only be written as string labels.
        r   Fr   T)r   r   r   r   r   r   )r   r   numeric_typess      r   are_numericzCategories.are_numeric  sN     :??5
 q'-0ABo}55 	4ur   c                    | j         }|sdS |d         j        }|dd         D ]}|j        |k    rt          d          |S )zx
        The number of hierarchy levels in this category graph. Returns 0 if
        it contains no categories.
        r   r   Ncategory depth not uniform)r   r   r'   )r   r~   first_depthr   s       r   r   zCategories.depth  sc     %
 	1 m)"122 	? 	?H~,, !=>>> -r   c                \    d}| j         D ]}||u r|c S ||j        z  }t          d          )z
        The offset of *category* in the overall sequence of leaf categories.
        A non-leaf category gets the index of its first sub-category.
        r   z$category not in top-level categories)r   
leaf_countr'   )r   r   r   this_categorys       r   r   zCategories.index  sM    
 !- 	. 	.M=((]--EE?@@@r   c                >    t          d | j        D                       S )z
        The number of leaf-level categories in this hierarchy. The return
        value is the same as that of `len()` only when the hierarchy is
        single level.
        c              3  $   K   | ]}|j         V  d S r   r   )rh   cs     r   	<genexpr>z(Categories.leaf_count.<locals>.<genexpr>  s$      ::A1<::::::r   )sumr   r   s    r   r   zCategories.leaf_count  s$     ::)9::::::r   c              #  :   K   fd |           D ]}|V  dS )z
        A generator of (idx, label) sequences representing the category
        hierarchy from the bottom up. The first level contains all leaf
        categories, and each subsequent is the next level up.
        c              3  h   K   d | D             }|r |          D ]}|V  d | D             V  d S )Nc                &    g | ]}|j         D ]}|S re   )sub_categories)rh   r   scs      r   rj   z5Categories.levels.<locals>.levels.<locals>.<listcomp>  s(    PPPQq?OPPbPPPPr   c                *    g | ]}|j         |j        fS re   )r/   r   )rh   cats     r   rj   z5Categories.levels.<locals>.levels.<locals>.<listcomp>  s!    >>>CCGSY'>>>r   re   )r~   r   levellevelss      r   r   z!Categories.levels.<locals>.levels  sf      PP*PPPN  #VN33    EKKKK>>:>>>>>>>>r   Nre   )r   r   r   s     @r   r   zCategories.levels  sN      	? 	? 	? 	? 	? VD\\ 	 	EKKKK	 	r   c                    d}| j         | j         S | j        dk    r|S | d         j        }t          |t          j        t          j        f          rdS |S )a  
        Read/write. Return a string representing the number format used in
        Excel to format these category values, e.g. '0.0' or 'mm/dd/yyyy'.
        This string is only relevant when the categories are numeric or date
        type, although it returns 'General' without error when the categories
        are string labels. Assigning |None| causes the default number format
        to be used, based on the type of the category labels.
        r   Nr   r   zyyyy\-mm\-dd)r   r   r   r   r   r   )r   GENERALr   s      r   r   zCategories.number_format  sb      *&& :??N q'-ox7H'IJJ 	#"?r   c                    || _         d S r   r,   )r   r   s     r   r   zCategories.number_format  s    #r   )rG   rH   rI   rJ   r   r   r   r   rK   r   r   r   r   r   r   r   r   rL   rM   s   @r   r   r   V  sB        
# # # # #
1 1 1* * *     X"   X,   X
A 
A 
A ; ; X;   X&   X4 $ $ $ $ $ $ $r   r   c                       e Zd ZdZ fdZd Zed             Zed             Zd Z	ed             Z
ed             Zdd
Zed             Zd Z xZS )r   z
    A chart category, primarily having a label to be displayed on the
    category axis, but also able to be configured in a hierarchy for support
    of multi-level category charts.
    c                    t          t          |                                            || _        || _        g | _        d S r   )r   r   r   _label_parent_sub_categories)r   r   parentr   s      r   r   zCategory.__init__  s;    h&&(((!r   c                Z    t          ||           }| j                            |           |S )z
        Return a newly created |data.Category| object having *label* and
        appended to the end of the sub-category sequence for this category.
        )r   r   r!   r   s      r   add_sub_categoryzCategory.add_sub_category
  s/    
 E4((##H---r   c                    | j         }|sdS |d         j        }|dd         D ]}|j        |k    rt          d          |dz   S )z
        The number of hierarchy levels rooted at this category node. Returns
        1 if this category has no sub-categories.
        r   r   Nr   )r   r   r'   )r   r   r   r   s       r   r   zCategory.depth  si     - 	1$Q'-&qrr* 	? 	?H~,, !=>>> -Qr   c                6    | j                             |           S )z
        The offset of this category in the overall sequence of leaf
        categories. A non-leaf category gets the index of its first
        sub-category.
        )r   r   r   s    r   r/   zCategory.idx"  s     |!!$'''r   c                    | j                             |           }| j        D ]}||u r|c S ||j        z  }t	          d          )zb
        The offset of *sub_category* in the overall sequence of leaf
        categories.
        z!sub_category not in this category)r   r   r   r   r'   )r   sub_categoryr   this_sub_categorys       r   r   zCategory.index+  s`    
 ""4((!%!5 	2 	2000&11EE<===r   c                P    | j         sdS t          d | j         D                       S )z
        The number of leaf category nodes under this category. Returns
        1 if this category has no sub-categories.
        r   c              3  $   K   | ]}|j         V  d S r   r   )rh   r   s     r   r   z&Category.leaf_count.<locals>.<genexpr>?  s%      LL88&LLLLLLr   )r   r   r   s    r   r   zCategory.leaf_count7  s4     # 	1LLt7KLLLLLLr   c                "    | j         | j         ndS )z
        The value that appears on the axis for this category. The label can
        be a string, a number, or a datetime.date or datetime.datetime
        object.
        Nr^   )r   r   s    r   r   zCategory.labelA  s     #k5t{{2=r   Fc                    | j         }t          |t          j        t          j        f          rd|                     |          z  S t          | j                   S )a  
        The string representation of the numeric (or date) label of this
        category, suitable for use in the XML `c:pt` element for this
        category. The optional *date_1904* parameter specifies the epoch used
        for calculating Excel date numbers.
        z%.1f)r   r   r   r   _excel_date_numberstr)r   	date_1904r   s      r   numeric_str_valzCategory.numeric_str_valJ  sP     ehmX->?@@ 	?D33I>>>>4;r   c                    | j         S )zE
        The sequence of child categories for this category.
        )r   r   s    r   r   zCategory.sub_categoriesV  s    
 ##r   c                    t           j        | j        }} ||j        |j        |j                  }|r |ddd          n |ddd          }||z
  }|j        }|s|dk    r|dz  }|S )z
        Return an integer representing the date label of this category as the
        number of days since January 1, 1900 (or 1904 if date_1904 is
        |True|).
        ip  r   ik        ;   )r   r   r   yearmonthdaydays)r   r   r   r   date_epochdeltaexcel_day_numbers           r   r   zCategory._excel_date_number]  s     mT[eUZei88$-ET1a   44b"3E3E :  	"-22!r   )F)rG   rH   rI   rJ   r   r   rK   r   r/   r   r   r   r   r   r   rL   rM   s   @r   r   r     s        " " " " "     X ( ( X(
> 
> 
> M M XM > > X>
  
  
  
  $ $ X$             r   r   c                      e Zd ZdZdS )	ChartDataz
    |ChartData| is simply an alias for |CategoryChartData| and may be removed
    in a future release. All new development should use |CategoryChartData|
    for creating or replacing the data in chart types other than XY and
    Bubble.
    N)rG   rH   rI   rJ   re   r   r   r   r   q  s           r   r   c                  r    e Zd ZdZddZed             Zed             Zed             Zed             Z	dS )	r   z
    The data specific to a particular category chart series. It provides
    access to the series label, the series data points, and an optional
    number format to be applied to each data point not having a specified
    number format.
    Nc                R    t          | ||          }|                     |           |S )z
        Return a CategoryDataPoint object newly created with value *value*,
        an optional *number_format*, and appended to this sequence.
        )CategoryDataPointr!   )r   r   r   rY   s       r   r   z!CategorySeriesData.add_data_point  s-    
 'tUMBB
Jr   c                    | j         j        S )zt
        The |data.Categories| object that provides access to the category
        objects for this series.
        )rQ   r~   r   s    r   r~   zCategorySeriesData.categories  s     **r   c                    | j         j        S r   )rQ   r   r   s    r   r   z!CategorySeriesData.categories_ref  s     ..r   c                $    d | j         D             S )zt
        A sequence containing the (Y) value of each datapoint in this series,
        in data point order.
        c                    g | ]	}|j         
S re   )r   rg   s     r   rj   z-CategorySeriesData.values.<locals>.<listcomp>  s    555R555r   rl   r   s    r   r   zCategorySeriesData.values  s     654#45555r   c                6    | j                             |           S )z}
        The Excel worksheet reference to the (Y) values for this series (not
        including the column heading).
        )rQ   r   r   s    r   r   zCategorySeriesData.values_ref  s     **4000r   r   )
rG   rH   rI   rJ   r   rK   r~   r   r   r   re   r   r   r   r   z  s             + + X+ / / X/ 6 6 X6 1 1 X1 1 1r   r   c                  0    e Zd ZdZddZed             ZdS )XyChartDataz
    A specialized ChartData object suitable for use with an XY (aka. scatter)
    chart. Unlike ChartData, it has no category sequence. Rather, each data
    point of each series specifies both an X and a Y value.
    Nc                R    t          | ||          }|                     |           |S )z
        Return an |XySeriesData| object newly created and added at the end of
        this sequence, identified by *name* and values formatted with
        *number_format*.
        )XySeriesDatar!   r   rU   r   ry   s       r   r   zXyChartData.add_series  s-     #4}==K   r   c                     t          |           S r   )r   r   s    r   r3   zXyChartData._workbook_writer  s      %%%r   r   )rG   rH   rI   rJ   r   r
   r3   re   r   r   r   r     sM             & & \& & &r   r   c                  6    e Zd ZdZddZd Zed             ZdS )BubbleChartDataz
    A specialized ChartData object suitable for use with a bubble chart.
    A bubble chart is essentially an XY chart where the markers are scaled to
    provide a third quantitative dimension to the exhibit.
    Nc                R    t          | ||          }|                     |           |S )z
        Return a |BubbleSeriesData| object newly created and added at the end
        of this sequence, and having series named *name* and values formatted
        with *number_format*.
        )BubbleSeriesDatar!   r   s       r   r   zBubbleChartData.add_series  s-     'tT=AAK   r   c                6    | j                             |          S )zo
        The Excel worksheet reference for the range containing the bubble
        sizes for *series*.
        )r3   bubble_sizes_refr"   s     r   r   z BubbleChartData.bubble_sizes_ref  s    
 $55f===r   c                     t          |           S r   )r   r   s    r   r3   z BubbleChartData._workbook_writer  s     $D)))r   r   )rG   rH   rI   rJ   r   r   r
   r3   re   r   r   r   r     s\            > > > * * \* * *r   r   c                      e Zd ZdZddZdS )r   a  
    The data specific to a particular XY chart series. It provides access to
    the series label, the series data points, and an optional number format
    to be applied to each data point not having a specified number format.

    The sequence of data points in an XY series is significant; lines are
    plotted following the sequence of points, even if that causes a line
    segment to "travel backward" (implying a multi-valued function). The data
    points are not automatically sorted into increasing order by X value.
    Nc                T    t          | |||          }|                     |           |S )z|
        Return an XyDataPoint object newly created with values *x* and *y*,
        and appended to this sequence.
        )XyDataPointr!   )r   rf   rr   r   rY   s        r   r   zXySeriesData.add_data_point  s/    
 !q!];;
Jr   r   )rG   rH   rI   rJ   r   re   r   r   r   r     s2        	 	     r   r   c                  F    e Zd ZdZddZed             Zed             ZdS )r   a  
    The data specific to a particular Bubble chart series. It provides access
    to the series label, the series data points, and an optional number
    format to be applied to each data point not having a specified number
    format.

    The sequence of data points in a bubble chart series is maintained
    throughout the chart building process because a data point has no unique
    identifier and can only be retrieved by index.
    Nc                V    t          | ||||          }|                     |           |S )z
        Append a new BubbleDataPoint object having the values *x*, *y*, and
        *size*. The optional *number_format* is used to format the Y value.
        If not provided, the number format is inherited from the series data.
        )BubbleDataPointr!   )r   rf   rr   sizer   rY   s         r   r   zBubbleSeriesData.add_data_point	  s1     %T1a}EE
Jr   c                $    d | j         D             S )zw
        A sequence containing the bubble size for each datapoint in this
        series, in data point order.
        c                    g | ]	}|j         
S re   )bubble_sizerg   s     r   rj   z1BubbleSeriesData.bubble_sizes.<locals>.<listcomp>  s    ;;;2;;;r   rl   r   s    r   bubble_sizeszBubbleSeriesData.bubble_sizes  s     <;):;;;;r   c                6    | j                             |           S )zr
        The Excel worksheet reference for the range containing the bubble
        sizes for this series.
        )rQ   r   r   s    r   r   z!BubbleSeriesData.bubble_sizes_ref  s     00666r   r   )rG   rH   rI   rJ   r   rK   r  r   re   r   r   r   r     sh        	 	    < < X< 7 7 X7 7 7r   r   c                  8     e Zd ZdZ fdZed             Z xZS )r   z
    A data point in a category chart series. Provides access to the value of
    the datapoint and the number format with which it should appear in the
    Excel file.
    c                h    t          t          |                               ||           || _        d S r   )r   r   r   _value)r   ry   r   r   r   s       r   r   zCategoryDataPoint.__init__+  s/    &&//]KKKr   c                    | j         S )z=
        The (Y) value for this category data point.
        )r  r   s    r   r   zCategoryDataPoint.value/  s    
 {r   )rG   rH   rI   rJ   r   rK   r   rL   rM   s   @r   r   r   $  s]                X    r   r   c                  N     e Zd ZdZ fdZed             Zed             Z xZS )r   zi
    A data point in an XY chart series. Provides access to the x and y values
    of the datapoint.
    c                v    t          t          |                               ||           || _        || _        d S r   )r   r   r   _x_y)r   ry   rf   rr   r   r   s        r   r   zXyDataPoint.__init__=  s5    k4  ))+}EEEr   c                    | j         S )z5
        The X value for this XY data point.
        )r  r   s    r   rf   zXyDataPoint.xB      
 wr   c                    | j         S )z5
        The Y value for this XY data point.
        )r  r   s    r   rr   zXyDataPoint.yI  r  r   )	rG   rH   rI   rJ   r   rK   rf   rr   rL   rM   s   @r   r   r   7  sx         
    
   X   X    r   r   c                  8     e Zd ZdZ fdZed             Z xZS )r   zs
    A data point in a bubble chart series. Provides access to the x, y, and
    size values of the datapoint.
    c                l    t          t          |                               ||||           || _        d S r   )r   r   r   _size)r   ry   rf   rr   r   r   r   s         r   r   zBubbleDataPoint.__init__W  s2    ot$$--k1aOOO


r   c                    | j         S )zT
        The value representing the size of the bubble for this data point.
        )r  r   s    r   r  zBubbleDataPoint.bubble_size[  s    
 zr   )rG   rH   rI   rJ   r   rK   r  rL   rM   s   @r   r   r   Q  s]         
       X    r   r   ) rJ   
__future__r   r   collections.abcr   numbersr   pptx.chart.xlsxr   r   r   pptx.chart.xmlwriterr	   	pptx.utilr
   r   rO   objectrv   r|   r   r   r   r   r   r   r   r   r   r   r   re   r   r   <module>r     sS   $ $ " " " " " "  $ $ $ $ $ $               
 0 / / / / / " " " " " "l4 l4 l4 l4 l4X l4 l4 l4^c3 c3 c3 c3 c3h c3 c3 c3L    V   0T, T, T, T, T, T, T, T,nd$ d$ d$ d$ d$ d$ d$ d$Nq  q  q  q  q v q  q  q h    !   /1 /1 /1 /1 /1 /1 /1 /1d& & & & &. & & &4* * * * *k * * *B    ?   ,$7 $7 $7 $7 $7| $7 $7 $7N       &    .   4    k     r   