
    	i                        d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZmZmZmZmZ  G d
 dej                  ZdS )    N)AnyDictOptionalwarn)Color
ColorTypes   )	xmlwriter)
ChartTitle)Shape)_datetime_to_excel_datetime_supported_datetimequote_sheetnamexl_range_formulaxl_rowcol_to_cellc                   >	    e Zd ZdZd fdZddeeeef                  ddfdZ	deeef         ddfdZ
deeef         ddfdZdeeef         ddfd	Zdeeef         ddfd
Zddeeeef                  ddfdZdeeef         ddfdZdeeef         ddfdZdeeef         ddfdZddeddfdZdeddfdZddZddZddeeeef                  ddfdZddeeeef                  ddfdZddeeeef                  ddfdZddeeeef                  ddfdZddeeeef                  ddfdZdded          ddfdZddZd Zd Zd  Z d! Z!defd"Z"d# Z#d$ Z$d% Z%d& Z&d' Z'd( Z(d) Z)d* Z*ddeeeef                  fd+Z+d, Z,d- Z-d.e.de/fd/Z0d0 Z1d1 Z2d2 Z3d3 Z4dd4Z5dd5Z6dd6Z7dd7Z8dd8Z9dd9Z:dd:Z;dd;Z<dd<Z=dd=Z>dd>Z?dd?Z@dd@ZAddAZBdBeCddfdCZDddDZEddEZFddFZGddGZHddHZIddIZJddJZKddKZLddLZMddMZNddNZOddOZPddPZQddQZRddRZSddSZTddTZUddUZVddVZWddWZXddXZYddYZZddZZ[dd[Z\dd\Z]dd]Z^dd^Z_dd_Z`ddd`ZaddaZbdddbZcddcZddddZedddeZfddfZgddgZhddhZiddiZjddjZkddkZlddlZmddmZndddnZodddoZpddpZqddqZrddrZsddsZtddtZudduZvddvZwddwZxddxZyddyZzdd{e{d|e/ddfd}Z|dd{e{d|e/ddfd~Z}	 dd{e{d|e/ddfdZ~d{e{ddfdZddZddZddZddZddZddZddZddZddZddZddZddZddZddZdddZddZddZddZde.ddfdZddZddZddZddBeCddfdZddZddBeCddfdZddBeCddfdZdeddfdZdeddfdZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddZddÄZddĄZddńZddƄZddǄZddȄZddɄZddʄZdd˄Zdd̄Zdd̈́Zdd΄ZddτZddЄZddфZdd҄ZddӄZddԄZddՄZddքZddׄZdd؄ZddلZddڄZddۄZdd܄Zdd݄ZddބZdd߄ZddZddZddZddZdBeCddfdZdBeCddfdZ xZS )Chartz:
    A class for writing the Excel XLSX Chart file.


    returnNc                    t                                                       d| _        d| _        d| _        g | _        d| _        d| _        d| _        d| _	        g | _
        g | _        d| _        d| _        i | _        d| _        d| _        i | _        g | _        d| _        d	| _        d| _        i | _        i | _        i | _        i | _        i | _        i | _        d
| _        d| _        d| _        d| _        d| _         d| _!        d| _"        d	| _#        d	| _$        d| _%        d| _&        d| _'        d| _(        d| _)        d| _*        d| _+        d| _,        d| _-        d| _.        d| _/        d| _0        d| _1        te                      | _3        d| _4        d| _5        d| _6        i | _7        d
| _8        d| _9        d| _:        d| _;        d| _<        | =                                 i | _>        dS )z
        Constructor.

        Ni   r      Fblr
    gapTi  i   between)?super__init__subtype
sheet_typeorientationseriesembeddedidseries_indexstyle_idaxis_ids	axis2_idscat_has_num_fmtrequires_categorylegendcat_axis_positionval_axis_positionformula_idsformula_datahoriz_cat_axishoriz_val_axis
protection	chartareaplotareax_axisy_axisy2_axisx2_axis
chart_nameshow_blanksshow_na_as_emptyshow_hiddenshow_crosseswidthheightx_scaley_scalex_offsety_offsettablecross_betweendefault_markerseries_gap_1series_gap_2series_overlap_1series_overlap_2
drop_lineshi_low_linesup_down_barssmooth_allowedr   titledate_category	date_1904remove_timezonelabel_positionslabel_position_defaultalready_insertedcombinedis_secondarywarn_sheetname_set_default_propertiesfill)self	__class__s    H/srv/django_bis/venv311/lib/python3.11/site-packages/xlsxwriter/chart.pyr   zChart.__init__*   s    	 $!&!$!$  %  

&"   $ $  #\\
"$!&(# %!"$$&&&			    optionsc                 z   |i }d|vrt          d           dS | j        rd|vrt          d           dS t          | j                  dk    rt          d           dS |                     |                    d                    }|                     |                    d                    }|                     |                    d          |                    d	                    \  }}|                     ||                    d
                    }|                     ||                    d                    }|                     ||                    d                    }t          j	        |          }	t          j
        |                    d                    }
t          j        |                    d                    }t          j        |                    d                    }|rd| _        |rd}d}
|                     |                    d                    }|                     |                    d                    }|                    d          }|                     |                    d                    }|                     |                    d                    }||d}|                     |                    d                    }|                     |                    d                    }|                    dd          }|                    d          }|rt'          j        |          }|                    d          }|                    d          }|s|rd| _        |                    d          |r|d         | _        n|d         | _        |                    d          r|r|d         | _        n|d         | _        i d|d|d|d	|d |d!|d"|d#|	d|
d|d|d|d|d$|d%|d&|d|||||d'}| j                            |           dS )(z
        Add a data series to a chart.

        Args:
            options:  A dictionary of chart series options.

        Returns:
            Nothing.

        Nvaluesz%Must specify 'values' in add_series()
categoriesz=Must specify 'categories' in add_series() for this chart type   zGThe maximum number of series that can be added to an Excel Chart is 255namename_formulacategories_datavalues_data	name_datar[   patterngradientmarker	trendlinesmoothy_error_barsx_error_bars)rp   ro   pointsdata_labelsinvert_if_negativeFinvert_if_negative_colorr9   r8   Tr   overlapname_idval_data_idcat_data_idlinelabelsinvert_if_neginverted_color)r8   rq   
error_barsrn   )r   r+   lenr#   _list_to_formulaget_process_names_get_data_idr   _get_line_properties_get_fill_properties_get_pattern_properties_get_gradient_propertiesr[   _get_marker_properties_get_trendline_properties_get_error_bars_props_get_points_properties_get_labels_propertiesr   _from_valuerX   rI   rH   rK   rJ   append)r\   r`   rb   rc   re   rf   cat_idval_idrv   ry   r[   rj   rk   rl   rm   rn   ro   rp   r}   rq   rz   r{   r|   r9   r8   r#   s                             r^   
add_serieszChart.add_seriesp   s    ?G 7""8999F! 	l'&A&APQQQFt{s""%   F &&w{{8'<'<==**7;;|+D+DEE
 "00KK^!<!<
 
l
 "":w{{;L/M/MNN""67;;}+E+EFF##L'++k2J2JKK )'22 )'++f*=*=>> /I0F0FGG 1'++j2I2IJJ  	DI  	GD ,,W[[-B-BCC 227;;{3K3KLL	 X&& 11'++n2M2MNN11'++n2M2MNN&2LQQ
 ,,W[[-B-BCC ,,W[[-G-GHH  $8%@@ %?@@ 	?".~>>N ++i((++i((  	%g 	% $D ;;u) 3$+EN!!$+EN! ;;y!! 	; ;(/	(:%%(/	(:%
f
*
 D
 L	

 w
 6
 6
 D
 D
 w
 
 f
 
 f
 ]
  n!
" w#
$ $+
 
 
0 	6"""""r_   c                 J    |                      | j        |          }|| _        dS )z
        Set the chart X axis options.

        Args:
            options:  A dictionary of axis options.

        Returns:
            Nothing.

        N)_convert_axis_argsr6   r\   r`   axiss      r^   
set_x_axiszChart.set_x_axis   &     &&t{G<<r_   c                 J    |                      | j        |          }|| _        dS )z
        Set the chart Y axis options.

        Args:
            options: A dictionary of axis options.

        Returns:
            Nothing.

        N)r   r7   r   s      r^   
set_y_axiszChart.set_y_axis  r   r_   c                 J    |                      | j        |          }|| _        dS )z
        Set the chart secondary X axis options.

        Args:
            options: A dictionary of axis options.

        Returns:
            Nothing.

        N)r   r9   r   s      r^   set_x2_axiszChart.set_x2_axis  &     &&t|W==r_   c                 J    |                      | j        |          }|| _        dS )z
        Set the chart secondary Y axis options.

        Args:
            options: A dictionary of axis options.

        Returns:
            Nothing.

        N)r   r8   r   s      r^   set_y2_axiszChart.set_y2_axis,  r   r_   c                    |i }|                      |                    d          |                    d                    \  }}|                     ||                    d                    }|| j        _        || j        _        || j        _        |                    d          r3|                     |                    d                    | j        _        n2|                     |                    d                    | j        _        t          j
        |          | j        _        t          j        |                    d                    | j        _        t          j        |                    d                    | j        _        |                     |                    d	          d
          | j        _        |                    d          | j        _        |                    dd          | j        _        dS )z
        Set the chart title options.

        Args:
            options: A dictionary of chart title options.

        Returns:
            Nothing.

        Nre   rf   datafont	name_fontr[   rk   layoutToverlaynoneF)r   r   r   rP   re   formuladata_id_convert_font_argsr   r   r   ry   r   r[   r   rk   _get_layout_propertiesr   r   hidden)r\   r`   re   rf   r   s        r^   	set_titlezChart.set_title;  s    ?G!00KK^!<!<
 
l ##L'++f2E2EFF 
)
$
 ;;v 	P"55gkk&6I6IJJDJOO #55gkk+6N6NOODJO  4W==
  4W[[5H5HII
 $<W[[=T=TUU
 !77H8M8MtTT
 %[[33
 $KK66
r_   c                 :    |                      |          | _        dS )z
        Set the chart legend options.

        Args:
            options: A dictionary of chart legend options.

        Returns:
            Nothing.
        N)_get_legend_propertiesr,   r\   r`   s     r^   
set_legendzChart.set_legendm  s     11'::r_   c                 :    |                      |          | _        dS )z
        Set the chart plot area options.

        Args:
            options: A dictionary of chart plot area options.

        Returns:
            Nothing.
        N)_get_area_propertiesr5   r   s     r^   set_plotareazChart.set_plotareaz  s     11'::r_   c                 :    |                      |          | _        dS )z
        Set the chart area options.

        Args:
            options: A dictionary of chart area options.

        Returns:
            Nothing.
        N)r   r4   r   s     r^   set_chartareazChart.set_chartarea  s     227;;r_   r   r'   c                 8    |d}|dk     s|dk    rd}|| _         dS )z
        Set the chart style type.

        Args:
            style_id: An int representing the chart style.

        Returns:
            Nothing.
        Nr   r
   0   )r'   )r\   r'   s     r^   	set_stylezChart.set_style  s0     Ha<<8b==H r_   optionc                 Z    |sdS dddd}||vrt          d| d           dS || _        dS )z
        Set the option for displaying blank data in a chart.

        Args:
            option: A string representing the display option.

        Returns:
            Nothing.
        Nr
   )r   zerospanz!Unknown show_blanks_as() option '')r   r;   )r\   r   valid_optionss      r^   show_blanks_aszChart.show_blanks_as  sb      	F 
 
 &&>V>>>???F!r_   c                     d| _         dS )z
        Display ``#N/A`` on charts as blank/empty cells.

        Args:
            None.

        Returns:
            Nothing.
        TN)r<   r\   s    r^   show_na_as_empty_cellzChart.show_na_as_empty_cell  s     !%r_   c                     d| _         dS )z
        Display data on charts from hidden rows or columns.

        Args:
            None.

        Returns:
            Nothing.
        TN)r=   r   s    r^   show_hidden_datazChart.show_hidden_data  s      r_   c                 f   |i }|                     d| j                  | _        |                     d| j                  | _        |                     dd          | _        |                     dd          | _        |                     dd          | _        |                     d	d          | _        dS )
z
        Set size or scale of the chart.

        Args:
            options: A dictionary of chart size options.

        Returns:
            Nothing.
        Nr?   r@   rA   r
   rB   rC   r   rD   )r   r?   r@   rA   rB   rC   rD   r   s     r^   set_sizezChart.set_size  s     ?G [[$*55
kk(DK88{{9a00{{9a00J22J22r_   c                 >   |i }i }|                     dd          |d<   |                     dd          |d<   |                     dd          |d<   |                     dd          |d<   |                     |                     d                    |d<   || _        dS )	z
        Set properties for an axis data table.

        Args:
            options: A dictionary of axis table options.

        Returns:
            Nothing.

        N
horizontalr
   verticaloutline	show_keysr   r   )r   r   rE   )r\   r`   rE   s      r^   	set_tablezChart.set_table  s     ?G%kk,::l#KK
A66j";;y!44i$[[a88k//F0C0CDDf


r_   c                 z   |i }d}d}d}d}|                     d          r:t          j        |d                   }t          j        |d         d                   }|                     d          r:t          j        |d                   }t          j        |d         d                   }||d||dd| _        dS )z
        Set properties for the chart up-down bars.

        Args:
            options: A dictionary of options.

        Returns:
            Nothing.

        Nupr[   down)ry   r[   )r   r   )r   r   r   r   rN   )r\   r`   up_lineup_fill	down_line	down_fills         r^   set_up_down_barszChart.set_up_down_bars  s     ?G 		 ;;t 	H0??G0v1FGGG ;;v 	L276?CCI276?63JKKI   
 "! 	
 	
r_   c                 V   |i }t          j        |          }t          j        |                    d                    }t          j        |                    d                    }t          j        |                    d                    }|rd| _        |rd}d}||||d| _        dS )z
        Set properties for the chart drop lines.

        Args:
            options: A dictionary of options.

        Returns:
            Nothing.

        Nr[   rj   rk   ry   r[   rj   rk   )r   r   r   r   r   r   r[   rL   r\   r`   ry   r[   rj   rk   s         r^   set_drop_lineszChart.set_drop_lines.  s     ?G)'22)'++f*=*=>> /I0F0FGG 1'++j2I2IJJ  	DI  	GD  	
 
r_   c                 V   |i }t          j        |          }t          j        |                    d                    }t          j        |                    d                    }t          j        |                    d                    }|rd| _        |rd}d}||||d| _        dS )z
        Set properties for the chart high-low lines.

        Args:
            options: A dictionary of options.

        Returns:
            Nothing.

        Nr[   rj   rk   r   )r   r   r   r   r   r   r[   rM   r   s         r^   set_high_low_lineszChart.set_high_low_linesU  s     ?G)'22)'++f*=*=>> /I0F0FGG 1'++j2I2IJJ  	DI  	GD  	
 
r_   chartc                     |dS || _         dS )z
        Create a combination chart with a secondary chart.

        Args:
            chart: The secondary chart to combine with the primary chart.

        Returns:
            Nothing.

        N)rW   )r\   r   s     r^   combinezChart.combine|  s     =Fr_   c                    |                                   |                                  |                                  |                                  |                                  |                                  |                     | j                   | j        r| 	                                 | 
                    d           |                                  d S )Nc:chartSpace)_xml_declaration_write_chart_space_write_lang_write_style_write_protection_write_chart_write_sp_prr4   r$   _write_print_settings_xml_end_tag
_xml_closer   s    r^   _assemble_xml_filezChart._assemble_xml_file  s     	 	!!! 	 	 	    	 	$.))) = 	)&&((( 	.)))r_   c                    |d                                          }|                    |           i d|d         d|                    d          d|                    d          d|                    d          d|                    d          d|                    d          d|                    d          d|                    d          d	|                    d	          d
|                    d
          d|                    d          d|                    d          d|                    d          d|                    d          d|                    d          d|                    d          d|                    d          |                    d          |                    d          dt                      d}|                    dd          |d<   |                     |d	                   |d	<   |                    dd          |d<   |                    d          r,|d         d         r|                     |d                   |d<   |                    d          r,|d         d         r|                     |d                   |d<   |                    d          r#|d                                         d         |d<   |                    d          r$|d         dk    rd|d<   n|d         dk    rnd |d<   |                    d          rd| _        |                    d           rd| _        d|d <   |                    d          r9t          |d                   r$t          |d         | j
        | j                  |d<   |                    d          r9t          |d                   r$t          |d         | j
        | j                  |d<   |                    d          r9t          |d                   r$t          |d         | j
        | j                  |d<   |                     |                    d!                    |d!<   t          j        |          |d"<   t          j        |                    d#                    |d#<   t          j        |                    d$                    |d$<   t          j        |                    d%                    |d%<   |                    d$          rd |d#<   |                    d%          r
d |d$<   d |d#<   |                     |                    d&                    |d&<   |                     |                    d'                    |d'<   |                     |                    d(          |                    d)                    \  }}|                     ||                    d*                    }||d+         _        ||d+         _        ||d+         _        |                     |                    d,                    |d+         _        |                     |                    d-          d          |d+         _        |                    d.          |d"<   |                    d/          |d0<   t          j        |          |d+         _        t          j        |                    d1                    |d+         _        t          j        |                    d2                    |d+         _        t          j        |                    d3                    |d+         _        |S )4Ndefaultsreverseminmax
minor_unit
major_unitminor_unit_typemajor_unit_typedisplay_unitslog_basecrossingposition_axispositionlabel_positionlabel_align
num_formatnum_format_linkedinterval_unitinterval_tickF)r   r   	text_axisrP   visibleTdisplay_units_visiblemajor_gridlinesminor_gridlinesr   on_tickmidCatr   	date_axisr   num_fontry   r[   rj   rk   minor_tick_markmajor_tick_markre   rf   r   rP   r   name_layout	name_linename_borderborder	name_fillname_patternname_gradient)copyupdater   r   _get_display_units_get_gridline_propertieslowerrQ   r   r   rR   rS   r   r   r   r   r   r   _get_tick_typer   r   re   r   r   r   r   r   ry   r[   rj   rk   )r\   r   user_optionsr`   re   rf   r   s          r^   r   zChart._convert_axis_args  sh   z"''))|$$$
Z(
w{{9--
 7;;u%%
 7;;u%%	

 '++l33
 '++l33
 w{{+<==
 w{{+<==
 W[[99
 J//
 J//
 W[[99
 J//
 gkk*:;;
 7;;}55
  '++l33!
"  -@!A!A#
$ %[[99$[[99\\+
 
 
0 "++i66Y !% 7 7_8M N N_(/4KT(R(R$% ;;()) 	g6G.H.S 	&*&C&C)*' 'D"#
 ;;()) 	g6G.H.S 	&*&C&C)*' 'D"#
 88J 	;#J/5577:D 88O$$ 	-O$	11(0_%%o&)33 )-_% ;;{## 	&!%D ;;{## 	%!&D $D 88E?? 	24;?? 	5UT^T-A DK 88E?? 	24;?? 	5UT^T-A DK 88J 	$7Z8H$I$I 	:Z $.$2F   D
  227;;z3J3JKKZ 1'::V 1'++f2E2EFFV  7I8N8NOOY !9'++j:Q:QRRZ 88I 	 DL 88J 	 "DODL #'"5"5gkkBS6T6T"U"U"&"5"5gkkBS6T6T"U"U "00KK^!<!<
 
l
 ##L'++f2E2EFF "W ,W 'W!44W[[5M5MNNW#::KK&& 
  
W
 "++k22#KK66"7@@W"7K8P8PQQW % =KK''!
 !
W "'!?KK(("
 "
W r_   c                    |si S |                     d          |                     d          |                     d          |                     d          |                     d          |                     d          |                     d          |                     d          |                     d	d
          |                     d          d
}|d         rt          |d         dz            |d<   |d         rdt          |d                   z  |d<   |                     d          rt          j        |d                   |d<   |S )Nre   colorsizebolditalic	underlinepitch_familycharsetbaseliner   rotation)
re   r  r  r  r  r  r  r  r  r  d   `  )r   intr   r   )r\   r`   r   s      r^   r   zChart._convert_font_argsD  s9    	I KK''[[))KK''KK''kk(++ [11#KK77{{9--J22J//
 
 < 	3tF|c122DL 
 	=$s4
+;'<'<<D88G 	=!-d7m<<DMr_   c                     t          |t                    s&|r"d|v rd|vr| j        rt          d| d           |S t	          | }|S )N r   zSheetname in 'zE' contains spaces but isn't quoted. This may cause an error in Excel.)
isinstancelistrY   r   r   )r\   r   r   s      r^   r   zChart._list_to_formulac  ss     $%% 	 t4D<O9T 9 9 9   K"D)r_   c                     |jt          |t                    r<t          |d         |d         dd          }t          |d                   dz   |z   }d}nt	          j        d|          r|}d}||fS )Nr
   r   Tr   !r   ^=?[^!]+!\$?[A-Z]+\$?\d+)r%  r&  r   r   rematch)r\   re   rf   cells       r^   r   zChart._process_namest  s     $%% (a$q'4FF.tAw77#=D5t<< #\!!r_   c                    |t          |          dk    rdS t          |d         t                    rdS |D ]T}|t          |t                    rt	          j        d|          r dS 	 t          |           C# t          $ r Y  dS w xY wdS )Nr   r   	multi_strz[_ ]strnum)r~   r%  r&  r/  r*  searchfloat
ValueError)r\   r   tokens      r^   _get_data_typezChart._get_data_type  s     <3t99>>6d1gt$$ 	;  	 	E} %%% ")FE*B*B uue   uuu
 us   *A::
B	B	c                 .   |sd S |                     d          r|                    d          }|| j        vr9t          | j                  }| j                            |           || j        |<   n$| j        |         }| j        |         
|| j        |<   |S )N=)
startswithlstripr/   r~   r0   r   )r\   r   r   
formula_ids       r^   r   zChart._get_data_id  s      	4 c"" 	*nnS))G $***T.//J$$T***(2DW%% )'2J  ,404!*-r_   c                 &   |sd S t          j        |          }dddddddddd	d	d
ddd}|                    d          }|$||v r||         |d<   nt          d|            d S t	          j        |          }t	          j        |                    d                    }t	          j        |                    d                    }t	          j        |                    d                    }|rd | _	        |rd }d }||d<   ||d<   ||d<   ||d<   |S )N	automaticr   squarediamondtrianglexstardotdashcirclepluspicture)r<  r   r=  r>  r?  r@  rA  rB  
short_dashrC  	long_dashrD  rE  rF  typezUnknown marker type 'r[   rj   rk   ry   )
r  deepcopyr   r   r   r   r   r   r   r[   )r\   rl   typesmarker_typery   r[   rj   rk   s           r^   r   zChart._get_marker_properties  sf     	4 v&& % " 
 
$ jj(("e##!&{!3v:[::;;;t )&11 )&**V*<*<== /

90E0EFF 1&**Z2H2HII  	DI  	GDvv#y%zr_   c                 n   |sd S t          j        |          }ddddddd}|                    d          }||v r||         |d<   nt          d	| d
           d S t	          j        |          }t	          j        |                    d                    }t	          j        |                    d                    }t	          j        |                    d                    }| 	                    |                    d                    }|rd | _
        |rd }d }||d<   ||d<   ||d<   ||d<   ||d<   |S )Nexplinearlog	movingAvgpolypower)exponentialrO  rP  moving_average
polynomialrS  rI  zUnknown trendline type 'r   r[   rj   rk   labelry   )r  rJ  r   r   r   r   r   r   r   _get_trendline_label_propertiesr[   )	r\   rm   rK  
trend_typery   r[   rj   rk   rW  s	            r^   r   zChart._get_trendline_properties  s{     	4 M),,	 !) 
 
 ]]6**
 %j 1If9J999:::4 ))44 ))--*?*?@@ /	i0H0HII 1)--
2K2KLL 44Y]]75K5KLL  	DI  	GD 	& 	&&	) (	*"	'r_   c                    |si S t          j        |          }|                     |                    d                    }t	          j        |          }t	          j        |                    d                    }t	          j        |                    d                    }t	          j        |                    d                    }|rd | _	        |rd }d }||d<   ||d<   ||d<   ||d<   ||d<   |S )Nr   r[   rj   rk   ry   )
r  rJ  r   r   r   r   r   r   r   r[   )r\   rW  r   ry   r[   rj   rk   s          r^   rX  z%Chart._get_trendline_label_properties?  s     	I e$$ &&uyy'8'899 )%00 )%))F*;*;<< /		)0D0DEE 1%))J2G2GHH  	DI  	GDfff"i$jr_   c                     |si S ddddd}dddddd	}|d
         }||v r||         |d
<   nt          d|            i S d|v r|d         |d<   d|v r|d         |d<   d|v r%|d         dk    rd|d<   n|d         dk    rd|d<   n	 |                    d          |d<   |                    d          |d<   |                    d          |d<   |                    d          |d<   t          j        |          |d<   |S )NfixedValr
   both)rI  valueendcap	direction
percentagestdDevstdErrcust)fixedra  standard_deviationstandard_errorcustomrI  zUnknown error bars type 'r^  	end_styler_  r`  minusrE  plus_valuesminus_values	plus_data
minus_datary   )r   r   r   r   )r\   r`   r}   rK  
error_types        r^   r   zChart._get_error_bars_propsh  s    	I )1PVWW
  &"*&
 
 V_
!&z!2Jv9Z99:::I g")'"2Jw '!!#*;#7Jx  '!!{#w..*1
;''%//*0
;''  %,KK$>$>
=!%,[[%@%@
>"")++k":":
;#*;;|#<#<
<  #7@@
6r_   c                 b    d|                     d          i}t          j        |          |d<   |S )Nr   ry   )r   r   r   )r\   r`   gridlines      r^   r  zChart._get_gridline_properties  s6     w{{9556 !5g>>r_   c                    |sd S t          j        |          }|                    d          }|r@|| j        v r"|| j        k    rd |d<   n&| j        |         |d<   nt          d| d           d S |                    d          }ddddd	d
}|r!||v r||         |d<   nt          d           d S |                     |                    d                    |d<   t          j        |          }t          j	        |                    d                    }t          j
        |                    d                    }t          j        |                    d                    }|rd | _        |rd }d }||d<   ||d<   ||d<   ||d<   |                    d          r|d         D ]}	|	|	                    d          }
|
r't          j        dt          |
                    r|
|	d<   |	                    d          }|r-|                    d          r|                    d          |	d<   |                     ||	                    d                    }||	d<   |                     |	                    d                    |	d<   t          j        |	          }t          j	        |	                    d                    }t          j
        |	                    d                    }t          j        |	                    d                    }|rd | _        |rd }d }|	                    d          }|rA|| j        v r"|| j        k    rd |	d<   n'| j        |         |	d<   nt          d| d            d S ||	d<   ||	d<   ||	d<   ||	d<   |S )Nr   zUnsupported label position 'z' for this chart type	separatorz, z; z. 
r$  ),;.rt  r$  zUnsupported label separatorr   r[   rj   rk   ry   rh  r^  r)  r   r7  r   r   z' for chart type)r  rJ  r   rT   rU   r   r   r   r   r   r   r   r[   r*  r+  r/  r8  r9  r   )r\   rz   r   rs  
separatorsry   r[   rj   rk   rW  r^  r   r   s                r^   r   zChart._get_labels_properties  s     	4 v&& ::j)) 	4///t:::)-F:&&)-)=h)GF:&&SHSSSTTTt JJ{++	
 

  	J&&&0&;{##2333t 00F1C1CDDv )&11 )&**V*<*<== /

90E0EFF 1&**Z2H2HII  	DI  	GDvv#y%z::h 7	-) 6- 6-=		'** -RX&A3u::NN -',E)$))I.. ;w11#66 ;'.~~c':':E)$++GUYYv5F5FGG#*i  $ 7 7		&8I8I J Jf 1%88 1%))F2C2CDD  7		)8L8LMM !9%))J:O:OPP  % $DI   "GD !99Z00 $4#777#t'BBB04E*--040DX0NE*--VHVVVWWW#tt $f $f#*i $,j!!r_   c                    i }t          j        |          }t          j        |                    d                    }t          j        |                    d                    }t          j        |                    d                    }|rd | _        |rd }d }|                     |                    d          d          }||d<   ||d<   ||d<   ||d<   ||d<   |S )Nr[   rj   rk   r   Fry   )r   r   r   r   r   r   r[   r   )r\   r`   areary   r[   rj   rk   r   s           r^   r   zChart._get_area_properties(  s     )'22 )'++f*=*=>> /I0F0FGG 1'++j2I2IJJ  	DI  	GD ,,W[[-B-BEJJVV!YX#Zr_   c                 
   i }|i }|                     dd          |d<   |                     d          |d<   |                     |                     d                    |d<   |                     |                     d          d          |d<   |                     d          rd|d<   t          j        |          }t          j        |                     d                    }t          j        |                     d	                    }t          j        |                     d
                    }|rd | _        |rd }d }|                     |                     d          d          }||d<   ||d<   ||d	<   ||d<   ||d
<   |S )Nr   rightdelete_seriesr   r   Fr   r[   rj   rk   ry   )	r   r   r   r   r   r   r   r   r[   )r\   r`   r,   ry   r[   rj   rk   r   s           r^   r   zChart._get_legend_propertiesL  s   ?G$[[W==z")++o">">00V1D1DEEv66w{{87L7LeTTx ;;v 	(!'F: )'22 )'++f*=*=>> /I0F0FGG 1'++j2I2IJJ  	DI  	GD ,,W[[-B-BEJJvv#y!x%zr_   c           	         i }|si S |rd}nd}|                                 D ]}||vrt          d| d           i c S |D ]}||                                 vrt          d| d           i c S ||         }	 t          |           n*# t          $ r t          d| d| d           i cY c S w xY w|dk     s|d	k    rt          d| d| d
           i c S |d||<   |S )N)r@  y)r@  r  r?   r@   z
Property 'z!' not supported in layout optionsz%' must be specified in layout optionsz	' value 'z' must be numeric in layoutr   r
   z/' must be in range 0 < x <= 1 in layout optionsz.17g)keysr   r2  r3  )r\   argsis_textr   
propertieskeypropr^  s           r^   r   zChart._get_layout_properties|  s    	I 	7#JJ6J 99;; 	 	C*$$H#HHHIII			 %
  	+ 	+D499;;&&M$MMMNNN			JEe   S$SSSSSTTT					 qyyEAII4 4 4 4 4 4   			 $??F4LLs   :B

"B10B1c                    g }|sg S |D ]}i }|t          j        |          }t          j        |                    d                    }t          j        |                    d                    }t          j        |                    d                    }|rd | _        |rd }d }||d<   ||d<   ||d<   ||d<   |                    |           |S )Nr[   rj   rk   ry   )r   r   r   r   r   r   r[   r   )	r\   user_pointsrq   
user_pointpointry   r[   rj   rk   s	            r^   r   zChart._get_points_properties  s     	I% 	! 	!JE%1*== 1*..2H2HII  7
y8Q8QRR !9*..:T:TUU  % $DI   "GD $f $f#*i $,j!MM%    r_   elementc                     |                     d          o|d         d         }|                     d          o|d         d         }|                     d          }|                     d          }|p|p|p|S )Nr[   definedry   rj   rk   )r   )r\   r  has_fillhas_linehas_patternhas_gradients         r^   _has_formattingzChart._has_formatting  sw    ;;v&&E76?9+E;;v&&E76?9+Ekk),,{{:..B8B{BlBr_   c           
      j    |sd S ddddddddd	d
	}||v r	||         }nt          d| d           d S |S )Nhundreds	thousandstenThousandshundredThousandsmillionstenMillionshundredMillionsbillions	trillions)	r  r  ten_thousandshundred_thousandsr  ten_millionshundred_millionsr  r  zUnknown display_units type 'r   r   )r\   r   rK  s      r^   r  zChart._get_display_units  sv     	4 #$+!3") 1"$

 

 E!!!-0MM@@@@AAA4r_   c                 `    |sd S ddddd}||v r	||         }nt          d| d           d S |S )Noutinr   cross)outsideinsider   r  zUnknown tick_type 'r   r   )r\   	tick_typerK  s      r^   r  zChart._get_tick_type  sg     	4 	
 
 i(II3y3334444r_   c                 X    g }| j         D ]}|d         s|                    |            |S Nr8   r#   r   )r\   primary_axes_seriesr#   s      r^   _get_primary_axes_serieszChart._get_primary_axes_series  sA     k 	3 	3F)$ 3#**6222""r_   c                 X    g }| j         D ]}|d         r|                    |            |S r  r  )r\   secondary_axes_seriesr#   s      r^   _get_secondary_axes_seriesz Chart._get_secondary_axes_series  sA     "k 	5 	5Fi  5%,,V444$$r_   c                    dt          | j                  z   }dt          | j                  z   t          | j                  z   }|d|d}|d|dz   d}|d         r4| j                            |           | j                            |           |d         s6| j                            |           | j                            |           d S d S )Ni  r
   04dprimary_axes)r"  r%   r~   r)   r(   r   )r\   r  chart_id
axis_countid1id2s         r^   _add_axis_idszChart._add_axis_ids  s    #dg,,&T^,,,s4=/A/AA
//z///33zA~333 	&M  %%%M  %%%N# 	'N!!#&&&N!!#&&&&&	' 	'r_   c                 *   dddid| j         d<   dddid| j        d<   ddddd	| j        d<   dddid
dd| j        d<   |                     i            |                     i            |                     i            |                     i            d S )NGeneralr   r   )r   r   r   r
   r   r   )r   r   r   r   r|  )r   r   r   r   )r6   r7   r9   r8   r   r   r   r   r   s    r^   rZ   zChart._set_default_properties+  s     $ )1~#
 #
J $ )1~#
 #
J $$	$
 $
Z  $ )1~	$
 $
Z  	r_   c                 j    d}|dz   }|dz   }|dz   }d|fd|fd|fg}|                      d|           d S )	Nz"http://schemas.openxmlformats.org/zdrawingml/2006/chartzdrawingml/2006/mainz!officeDocument/2006/relationshipszxmlns:czxmlns:azxmlns:rr   )_xml_start_tag)r\   schemaxmlns_cxmlns_axmlns_r
attributess         r^   r   zChart._write_chart_spaceR  sg    51100>>    

 	NJ77777r_   c                 @    d}d|fg}|                      d|           d S )Nen-USvalzc:lang_xml_empty_tagr\   r  r  s      r^   r   zChart._write_langa  s.    cl^
Hj11111r_   c                 Z    | j         }|dk    rd S d|fg}|                     d|           d S )Nr   r  zc:style)r'   r  )r\   r'   r  s      r^   r   zChart._write_stylei  sB    = q==Fh'(
Iz22222r_   c                    |                      d           | j                                        r|                                  n|                     | j                   |                                  |                                  |                                  |                                  | j	        r| 
                                 |                     d           d S )Nzc:chart)r  rP   	is_hidden_write_c_auto_title_deleted_write_title_write_plot_area_write_legend_write_plot_vis_only_write_disp_blanks_asr<   _write_c_ext_lst_display_nar   r   s    r^   r   zChart._write_chartu  s    I&&&:!! 	*,,.... dj))) 	 	 	!!### 	""$$$   	/,,...)$$$$$r_   c                 Z    | j         }|dk    rd S d|fg}|                     d|           d S )Nr   r  zc:dispBlanksAs)r;   r  r  s      r^   r  zChart._write_disp_blanks_as  sB     %<<Fcl^
,j99999r_   c                 (   |                      d           |                     | j                            d          d           |                     ddi           |                     ddi           | j        }|ri|j        rd| j        z   |_        n| j        |_        | j        |_        | j	        |_	        |                    ddi           |                    ddi           | j
        | j        | j        d}| j        r|                     |           n|                     |           |                     |           | j        | j        | j        d}|                     |           |r1|j        r*|j        |j        |j        d}|                    |           | j        r|                     |           n|                     |           |                                  |                     | j                   |                     d           d S )	Nz
c:plotArear   plotr  TF  )r6   r7   r(   )r  _write_layoutr5   r   _write_chart_typerW   rX   r%   fhr&   r6   r7   r(   rQ   _write_date_axis_write_cat_axis_write_val_axisr9   r8   r)   _write_d_tabler   r   )r\   second_chartr  s      r^   r  zChart._write_plot_area  sK   L))) 	4=,,X66??? 	56666777 } 	D( *"&."&' #gLO )-(9L% **ND+ABBB**NE+BCCC +$-XX 	'!!$''''  &&&T""" ll
 
 	T"""  	/L5 	/&.&.(2 D ((... 	'!!$''''  &&& 	 	$-(((,'''''r_   c                     |s|                      d           d S |                     d           |                     ||           |                     d           d S )Nc:layout)r  r  _write_manual_layoutr   r\   r   layout_types      r^   r  zChart._write_layout  sl      	*
+++++ 
+++%%fk:::j)))))r_   c                    |                      d           |dk    r|                     ddg           |                     ddg           |                     ddg           |                     dd	|d
         fg           |                     dd	|d         fg           |dk    r>|                     dd	|d         fg           |                     dd	|d         fg           |                     d           d S )Nzc:manualLayoutr  zc:layoutTarget)r  innerzc:xMode)r  edgezc:yModezc:xr  r@  zc:yr  textzc:wr?   zc:hr@   r  r  r   r  s      r^   r  zChart._write_manual_layout  s$   ,--- &   03C2DEEE 	I'8999I'8999EUF3K$8#9:::EUF3K$8#9::: &  w(@'ABBBx0@(A'BCCC*+++++r_   c                     d S N r\   r  s     r^   r  zChart._write_chart_type  s	     	r_   c                 <    d|fg}|                      d|           d S )Nr  z
c:groupingr  r  s      r^   _write_groupingzChart._write_grouping  s)    cl^
L*55555r_   c                 0    |                      |           d S r  )
_write_serr\   r#   s     r^   _write_serieszChart._write_series  s    r_   c                 l   | j         }| xj         dz  c_         |                     d           |                     |           |                     |           |                     |           |                     |           |                     |d                    |                     |d                    |                     |d                    | 	                    |d                    | 
                    |d                    |                     |d                    |                     |           |                     |           | j        r|                     |d	                    |                    d
          r|                     |d
                    |                     d           d S )Nr
   zc:serrl   r{   rq   rz   rm   r}   rn   r|   )r&   r  
_write_idx_write_order_write_series_namer   _write_marker_write_c_invert_if_negative_write_d_pt_write_d_lbls_write_trendline_write_error_bars
_write_cat
_write_valrO   _write_c_smoothr   _write_c_ext_lst_inverted_colorr   )r\   r#   indexs      r^   r  zChart._write_ser  s   !QG$$$ 	 	%    	''' 	&!!! 	6(+,,, 	(()@AAA 	)*** 	6(+,,, 	f[1222 	vl3444 	 	  	3  !1222 ::&'' 	K008H1IJJJ'"""""r_   r  c                    d}d}d|fd|fg}d|fg}|                      d           |                      d|           |                      d           |                      d|           |                     d	|i           |                     d           |                     d           |                     d           |                     d           d S )
Nz&{6F2FDCE9-48DA-4B69-8628-5D25D57E5C99}z:http://schemas.microsoft.com/office/drawing/2007/8/2/charturiz	xmlns:c14c:extLstc:extzc14:invertSolidFillFmtzc14:spPrr  )r  _write_a_solid_fillr   )r\   r  r   
xmlns_c_14attributes1attributes2s         r^   r  z%Chart._write_c_ext_lst_inverted_colorL  s     7Q
 CL*%

 $Z01J'''G[1114555J444  '5!1222*%%%2333'"""*%%%%%r_   c                 N   d}d}d|fd|fg}dg}|                      d           |                      d|           |                      d           |                     d	|           |                     d           |                     d           |                     d           d S )
Nz&{56B9EC1D-385E-4148-901F-78D8002777C0}z9http://schemas.microsoft.com/office/drawing/2017/03/chartr   zxmlns:c16r3r  r
   r  r  zc16r3:dataDisplayOptions16zc16r3:dispNaAsBlankr  )r\   r   
xmlns_c_16r  r  s        r^   r  z!Chart._write_c_ext_lst_display_nae  s     7P
 CLJ'

 "lJ'''G[11189991;???6777'"""*%%%%%r_   c                 <    d|fg}|                      d|           d S )Nr  zc:idxr  r  s      r^   r  zChart._write_idxz  +     cl^
GZ00000r_   c                 <    d|fg}|                      d|           d S )Nr  c:orderr  r  s      r^   r  zChart._write_order  s+     cl^
Iz22222r_   c                     |d         $|                      |d         |d                    d S |d         |                     |d                    d S d S )Nrf   rv   re   )_write_tx_formula_write_tx_valuer  s     r^   r  zChart._write_series_name  se     .!-""6.#96);LMMMMMF^'  00000 ('r_   c                 <    |r|                      ddg           d S d S )Nzc:smooth)r  1r  )r\   rn   s     r^   r  zChart._write_c_smooth  s4      	<
\N;;;;;	< 	<r_   c                    |d         }|d         }d }|| j         |         }|sd S |                     d           |                     |          }|dk    rd| _        |                     |||           nB|dk    rd| _        |                     ||           nd| _        |                     |||           |                     d           d S )Nrc   rx   zc:catr/  Fr.  T)r0   r  r5  r*   _write_str_ref_write_multi_lvl_str_ref_write_num_refr   )r\   r#   r   r   r   cat_types         r^   r  zChart._write_cat  s    &'$W-D  	FG$$$ &&t,,u#(D x8888$$#(D ))'48888 $(D x888'"""""r_   c                     |d         }|d         }| j         |         }|                     d           |                     ||d           |                     d           d S )Nrb   rw   c:valr0  )r0   r  r  r   )r\   r#   r   r   r   s        r^   r  zChart._write_val  sk    "' )G$$$ 	GT5111'"""""r_   c                     |                      d           |                     |           |dk    r|                     |           n|dk    r|                     |           |                     d           d S )Nzc:numRefr0  r/  r  _write_series_formula_write_num_cache_write_str_cacher   r\   r   r   ref_types       r^   r  zChart._write_num_ref  s    J''' 	""7+++u!!$''''!!$'''*%%%%%r_   c                     |                      d           |                     |           |dk    r|                     |           n|dk    r|                     |           |                     d           d S )Nzc:strRefr0  r/  r  r  s       r^   r  zChart._write_str_ref  s     	J''' 	""7+++u!!$''''!!$'''*%%%%%r_   c                    |sd S |                      d           |                     |           |                      d           t          |d                   }|                     |           t	          |          D ]W}|                      d           t          |          D ]\  }}|                     ||           |                     d           X|                     d           |                     d           d S )Nzc:multiLvlStrRefzc:multiLvlStrCacher   zc:lvl)r  r  r~   _write_pt_countreversed	enumerate	_write_ptr   )r\   r   r   countcat_datair  s          r^   r  zChart._write_multi_lvl_str_ref  s     	F./// 	""7+++0111 DHU###  	' 	'H(((%h// ) )5q%((((g&&&&.///,-----r_   c                     |                     d          r|                    d          }|                     d|           d S )Nr7  zc:f)r8  r9  _xml_data_element)r\   r   s     r^   r  zChart._write_series_formula  sG     c"" 	*nnS))Gug.....r_   c                 D   |                      |           |d         rB|                     | j        d                    |                     | j        d                    d S |                     | j        d                    |                     | j        d                    d S )Nr  r   r
   )r  _write_axis_idr(   r)   r  s     r^   _write_axis_idszChart._write_axis_ids  s     	4    	3a 0111a 011111 q 1222q 122222r_   c                 <    d|fg}|                      d|           d S )Nr  zc:axIdr  r  s      r^   r-  zChart._write_axis_id  +     cl^
Hj11111r_   c                 |   |d         }|d         }|d         }||sd S | j         }| j        }|                    d          r|d         }|                     d           |                     |d                    |                     |                    d          d d d            |                    d          s|                     d	           |                     ||                    d                     |                     |                    d
                     | 	                    |                    d                     | 
                    |d         |           |                     |           |                     |                    d                     |                     |                    d                     |                     |                    d                     |                     |           |                     |                    d                     |                     |d	                    | j        s|                    d          r|                    d          %|                    d          dk    s|d         dk    r)|                     |                    d                     n(|                     |                    d                     |                    d          s|                     d	           |                     |                    d                     |                     d           |                     |                    d                     |                     |                    d                     |                     d           d S )Nr6   r7   r(   r   zc:catAxr   r   r   r
   r   r  rP   r  r  r   r  r   r   r   r   r   r   r   r   )r-   r1   r   r  r-  _write_scaling_write_delete_write_axis_pos_write_major_gridlines_write_minor_gridlinesr  _write_cat_number_format_write_major_tick_mark_write_minor_tick_mark_write_tick_label_posr   _write_axis_font_write_cross_axisr>   _write_crosses_write_c_crosses_at_write_auto_write_label_align_write_label_offset_write_c_tick_lbl_skip_write_c_tick_mark_skipr   r\   r  r6   r7   r(   r   is_horizontals          r^   r  zChart._write_cat_axis$  s   hh
# 8F)+ ::j!! 	*j)HI&&&HQK((( 	FJJy114tDDDzz)$$ 	"q!!! 	Xvzz)'<'<=== 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	&/=999 	%%f--- 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	""6::.>#?#?@@@ 	&!!! 	fjj44555 	x{+++ 	A

9 5 5 	A 

:&&.::j))U22*%.. ##FJJz$:$:;;;; ((J)?)?@@@ zz+&& 	 Q 	

= 9 9::: 	  %%% 	##FJJ$?$?@@@ 	$$VZZ%@%@AAA)$$$$$r_   c                    |d         }|d         }|d         }|                     d| j                  }| j        }||sd S |                     d          p|}|                     d           |                     |d                    |                     |                     d          |                     d          |                     d	          |                     d
                     |                     d          s|                     d           |                     ||                     d                     |                     |                     d                     | 	                    |                     d                     | 
                    |d         |           |                     |           |                     |                     d                     |                     |                     d                     |                     |                     d                     |                     |           |                     |                     d                     |                     |d                    |                     d          |d         d	k    s|d         dk    r)|                     |                     d                     n(|                     |                     d                     |                     |                     d                     |                     |                     d                     |                     |                     d                     |                     |                     d          |                     d                     |                     d           d S )Nr6   r7   r(   r   c:valAxr
   r   r   r   r   r   r   r  rP   r  r  r   r  r   r   r   r   r   r   r   )r   r.   r2   r  r-  r2  r3  r4  r5  r6  r  _write_number_formatr8  r9  r:  r   r;  r<  r=  r>  _write_cross_between_write_c_major_unit_write_c_minor_unit_write_disp_unitsr   rD  s          r^   r  zChart._write_val_axis  s   hh
#88J(>??+ 8F ::j))5XI&&&HQK((( 	JJy!!JJuJJuJJz""		
 	
 	
 zz)$$ 	"q!!! 	Xvzz)'<'<=== 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	&/=999 	!!&))) 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	""6::.>#?#?@@@ 	&!!! 	fjj44555 	x{+++ JJz""*j!U**j!U** 

: 6 67777 $$VZZ
%;%;<<< 	!!&**_"="=>>> 	  L!9!9::: 	  L!9!9::: 	JJ''4K)L)L	
 	
 	
 	)$$$$$r_   c                    |d         }|d         }|d         }|d         p| j         }| j        }||sd S |                    d          p|}|                     d           |                     |d                    |                     |                    d          |                    d          |                    d	          |                    d
                     |                    d          s|                     d           |                     ||                    d                     |                     |                    d                     | 	                    |                    d                     | 
                    |d         |           |                     |           |                     |                    d                     |                     |                    d                     |                     |                    d                     |                     |           |                     |                    d                     |                     |d                    |                    d          |d         d	k    s|d         dk    r)|                     |                    d                     n(|                     |                    d                     |                     |                    d                     |                     |                    d                     |                     |                    d                     |                     |                    d          |                    d                     |                     d           d S )Nr6   r7   r(   r   rG  r   r   r   r   r   r   r
   r   r  rP   r  r  r   r  r   r   r   r   r   r   )r.   r2   r   r  r-  r2  r3  r4  r5  r6  r  rH  r8  r9  r:  r   r;  r<  r=  r>  rI  rJ  rK  rL  r   rD  s          r^   _write_cat_val_axiszChart._write_cat_val_axis  s    hh
#
#=t'=+ 8F ::j))5XI&&&HQK((( 	JJy!!JJuJJuJJz""		
 	
 	
 zz)$$ 	"q!!! 	Xvzz)'<'<=== 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	&/=999 	!!&))) 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	""6::.>#?#?@@@ 	&!!! 	fjj44555 	x{+++ JJz""*j!U**j!U** 

: 6 67777 $$VZZ
%;%;<<< 	!!&**_"="=>>> 	  L!9!9::: 	  L!9!9::: 	JJ''4K)L)L	
 	
 	
 	)$$$$$r_   c                    |d         }|d         }|d         }||sd S | j         }|                    d          p|}|                     d           |                     |d                    |                     |                    d          |                    d          |                    d	          |                    d
                     |                    d          s|                     d           |                     ||                    d                     |                     |                    d                     |                     |                    d                     | 	                    |d                    | 
                    |           |                     |                    d                     |                     |                    d                     |                     |                    d                     |                     |           |                     |                    d                     |                     |d                    | j        s|                    d          r|                    d          %|                    d          d	k    s|d         dk    r)|                     |                    d                     n(|                     |                    d                     |                     d           |                     d           |                     |                    d                     |                     |                    d                     |                     |                    d                     |                    d          r|                     |d                    |                     |                    d                     |                    d          r|                     |d                    |                     d           d S )Nr6   r7   r(   r   zc:dateAxr   r   r   r   r   r   r
   r   r  rP   r  r  r   r  r   r   r   r   r   r   r   r   )r-   r   r  r-  r2  r3  r4  r5  r6  r  rH  r8  r9  r:  r   r;  r<  r>   r=  r>  r?  rA  rB  rC  rJ  _write_c_major_time_unitrK  _write_c_minor_time_unitr   )r\   r  r6   r7   r(   r   s         r^   r  zChart._write_date_axis6	  s#   hh
# 8F) ::j))5XJ'''HQK((( 	JJy!!JJuJJuJJz""		
 	
 	
 zz)$$ 	"q!!! 	Xvzz)'<'<=== 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	&/*** 	!!&))) 	##FJJ/@$A$ABBB 	##FJJ/@$A$ABBB 	""6::.>#?#?@@@ 	&!!! 	fjj44555 	x{+++ 	A

9 5 5 	A 

:&&.::j))U22*%.. ##FJJz$:$:;;;; ((J)?)?@@@ 	 	  %%% 	##FJJ$?$?@@@ 	$$VZZ%@%@AAA 	  L!9!9::: ::l## 	E))&1B*CDDD 	  L!9!9::: ::l## 	E))&1B*CDDD*%%%%%r_   c                    |                      d           |                     |           |                     |           |                     |           |                     |           |                     d           d S )Nz	c:scaling)r  _write_c_log_base_write_orientation_write_c_max_write_c_minr   )r\   r   min_valmax_valr   s        r^   r2  zChart._write_scaling	  s     	K((( 	x((( 	((( 	'""" 	'"""+&&&&&r_   c                 D    |sd S d|fg}|                      d|           d S )Nr  z	c:logBaser  r  s      r^   rS  zChart._write_c_log_base	  8      	Fcl^
K44444r_   c                 H    d}|rd}d|fg}|                      d|           d S )NminMaxmaxMinr  zc:orientationr  )r\   r   r  r  s       r^   rT  zChart._write_orientation	  s;     	Ccl^
OZ88888r_   c                 D    |d S d|fg}|                      d|           d S )Nr  zc:maxr  )r\   rX  r  s      r^   rU  zChart._write_c_max	  7     ?Fg&'
GZ00000r_   c                 D    |d S d|fg}|                      d|           d S )Nr  zc:minr  )r\   rW  r  s      r^   rV  zChart._write_c_min	  r_  r_   c                 `    |r|dk    rd}|dk    rd}d|fg}|                      d|           d S )Nr   rr   tr  zc:axPosr  )r\   r  r   r  s       r^   r4  zChart._write_axis_pos	  sO      	czzczzcl^
Iz22222r_   c                     |                     d          }d}|||d         d         k    rd}|                     d          rd}d|fd|fg}|                     d|           d S 	Nr   r
   r   r   r   
formatCodesourceLinkedc:numFmt)r   r  )r\   r   format_codesource_linkedr  s        r^   rH  zChart._write_number_format	  s    
 hh|,, "{d:6F|6T'T'TM 88'(( 	M ;']+


 	J
33333r_   c                     |                     d          }d}d}|||d         d         k    rd}d}|                     d          rd}| j        s|rd S d|fd|fg}|                     d|           d S re  )r   r*   r  )r\   r   ri  rj  default_formatr  s         r^   r7  zChart._write_cat_number_format	  s     hh|,, "{d:6F|6T'T'TMN 88'(( 	M # 	 	F ;']+


 	J
33333r_   c                 F    d}d|fd|fg}|                      d|           d S )Nr   rf  rg  rh  r  )r\   ri  rj  r  s       r^   _write_data_label_number_formatz%Chart._write_data_label_number_format
  s>     ;']+


 	J
33333r_   c                 D    |sd S d|fg}|                      d|           d S )Nr  zc:majorTickMarkr  r  s      r^   r8  zChart._write_major_tick_mark$
  9      	Fcl^
-z:::::r_   c                 D    |sd S d|fg}|                      d|           d S )Nr  zc:minorTickMarkr  r  s      r^   r9  zChart._write_minor_tick_mark.
  rp  r_   c                 P    ||dk    rd}d|fg}|                      d|           d S )Nnext_tonextTor  zc:tickLblPosr  r  s      r^   r:  zChart._write_tick_label_pos8
  s=    ;#**Ccl^
NJ77777r_   c                 <    d|fg}|                      d|           d S )Nr  z	c:crossAxr  r  s      r^   r<  zChart._write_cross_axisA
  +     cl^
K44444r_   c                 D    |d}d|fg}|                      d|           d S )NautoZeror  z	c:crossesr  r  s      r^   r=  zChart._write_crossesH
  s3    ;Ccl^
K44444r_   c                 <    d|fg}|                      d|           d S )Nr  zc:crossesAtr  r  s      r^   r>  zChart._write_c_crosses_atQ
  +     cl^
M:66666r_   c                 <    d|fg}|                      d|           d S )Nr  zc:autor  r  s      r^   r?  zChart._write_autoX
  r0  r_   c                 d    |d}|dk    rd}|dk    rd}d|fg}|                      d|           d S )Nctrr|  rb  leftr   r  z	c:lblAlgnr  r  s      r^   r@  zChart._write_label_align_
  sQ     ;C'>>C&==Ccl^
K44444r_   c                 <    d|fg}|                      d|           d S )Nr  zc:lblOffsetr  r  s      r^   rA  zChart._write_label_offseto
  rz  r_   c                 D    |d S d|fg}|                      d|           d S )Nr  zc:tickLblSkipr  r  s      r^   rB  zChart._write_c_tick_lbl_skipv
  s3    ;Fcl^
OZ88888r_   c                 D    |d S d|fg}|                      d|           d S )Nr  zc:tickMarkSkipr  r  s      r^   rC  zChart._write_c_tick_mark_skip
  s4    ;Fcl^
,j99999r_   c                     |sd S |d         sd S |d         d         rA|                      d           |                     |           |                     d           d S |                     d           d S )Nr   ry   r  zc:majorGridlinesr  r   r   r  r\   	gridliness     r^   r5  zChart._write_major_gridlines
        	F# 	FVY' 	4 2333 i(((011111 233333r_   c                     |sd S |d         sd S |d         d         rA|                      d           |                     |           |                     d           d S |                     d           d S )Nr   ry   r  zc:minorGridlinesr  r  s     r^   r6  zChart._write_minor_gridlines
  r  r_   c                 N    || j         }d|fg}|                     d|           d S )Nr  zc:crossBetween)rF   r  r  s      r^   rI  zChart._write_cross_between
  s7    ;$Ccl^
,j99999r_   c                 D    |sd S d|fg}|                      d|           d S )Nr  zc:majorUnitr  r  s      r^   rJ  zChart._write_c_major_unit
  8      	Fcl^
M:66666r_   c                 D    |sd S d|fg}|                      d|           d S )Nr  zc:minorUnitr  r  s      r^   rK  zChart._write_c_minor_unit
  r  r_   c                 D    |d}d|fg}|                      d|           d S )Ndaysr  zc:majorTimeUnitr  r  s      r^   rP  zChart._write_c_major_time_unit
  4    ;Ccl^
-z:::::r_   c                 D    |d}d|fg}|                      d|           d S )Nr  r  zc:minorTimeUnitr  r  s      r^   rQ  zChart._write_c_minor_time_unit
  r  r_   c                     | j         }|                    dd          }|                    d          }g }d}|                    d          r#t          |d         t                    r|d         }|                    d          r|                    dd          }d}d	d
dddd}|dk    rd S ||vrd S ||         }|                     d           |                     |           |D ]}|                     |           | 	                    |                    d          d           |r| 
                                 |r|                     |           |                     |           |                     d           d S )Nr   r|  r   r   r}  overlay_r   r
   rb  r   rc  r   tr)r|  r~  topbottom	top_rightr   zc:legendr   r,   )r,   r   r%  r&  r8  replacer  _write_legend_pos_write_legend_entryr  _write_overlay_write_tx_prr   r   )r\   r,   r   r   r}  r   allowedr  s           r^   r  zChart._write_legend
  s   ::j'22zz&!!::o&& 	4:f_6Mt+T+T 	4"?3Mz** 	''
B77HG 
 
 vF7""F8$J''' 	x((( # 	, 	,E$$U++++ 	6::h//:::  	"!!! 	$d### 	&!!!*%%%%%r_   c                 <    d|fg}|                      d|           d S )Nr  zc:legendPosr  r  s      r^   r  zChart._write_legend_pos  rz  r_   c                     |                      d           |                     |           |                     d           |                     d           d S )Nzc:legendEntryr
   )r  r  r3  r   )r\   r  s     r^   r  zChart._write_legend_entry  s\     	O,,, 	 	1/*****r_   c                 @    d}d|fg}|                      d|           d S )Nr
   r  z	c:overlayr  r  s      r^   r  zChart._write_overlay)  .    cl^
K44444r_   c                 R    d}| j         rd S d|fg}|                     d|           d S )Nr
   r  zc:plotVisOnly)r=   r  r  s      r^   r  zChart._write_plot_vis_only1  s@      	Fcl^
OZ88888r_   c                     |                      d           |                                  |                                  |                                  |                     d           d S )Nzc:printSettings)r  _write_header_footer_write_page_margins_write_page_setupr   r   s    r^   r   zChart._write_print_settings=  sn    -... 	!!### 	  """ 	   +,,,,,r_   c                 0    |                      d           d S )Nzc:headerFooterr  r   s    r^   r  zChart._write_header_footerL  s    ,-----r_   c                 r    d}d}d}d}d}d}d|fd|fd|fd|fd|fd	|fg}|                      d
|           d S )Ng      ?gffffff?g333333?r   r   rb  rc  headerfooterzc:pageMarginsr  )r\   r  r~  r|  r  r  r  r  s           r^   r  zChart._write_page_marginsP  ss     &M$K%L#Jvv

 	OZ88888r_   c                 0    |                      d           d S )Nzc:pageSetupr  r   s    r^   r  zChart._write_page_setupd  s    M*****r_   c                 4    |                      ddg           d S )Nzc:autoTitleDeletedr  r  r   s    r^   r  z!Chart._write_c_auto_title_deletedh  s!    0:,?????r_   FrP   rE  c                    |                                 r|                     ||           d S |                                r|                     ||           d S |                                r|                     |           d S d S r  )has_name_write_title_richhas_formula_write_title_formulahas_formatting_write_title_format_onlyr\   rP   rE  s      r^   r  zChart._write_titlel  s    >> 	1""5-88888   	1%%e];;;;;!!## 	1))%00000	1 	1r_   c                 V   |                      d           |                     |j        ||j                   |                     |j        d           |j        r|                                  |                     |	                                           | 
                    d           d S Nzc:titler  )r  _write_tx_richre   r   r  r   r   r  r   get_formattingr   r  s      r^   r  zChart._write_title_richu  s    I&&& 	EJuzBBB 	5<000 = 	"!!! 	%..00111)$$$$$r_   c                    |                      d           |                     |j        |j                   |                     |j        d           |j        r|                                  |                     |	                                           | 
                    |j        |           |                     d           d S r  )r  r  r   r   r  r   r   r  r   r  r  r   r   r  s      r^   r  zChart._write_title_formula  s     	I&&& 	u}em<<< 	5<000 = 	"!!! 	%..00111 	%*m444)$$$$$r_   c                    |                      d           |                     |j        d           |j        r|                                  |                     |                                           |                     d           d S r  )r  r  r   r   r  r   r  r   r\   rP   s     r^   r  zChart._write_title_format_only  s    I&&& 	5<000 = 	"!!! 	%..00111)$$$$$r_   c                     |                      d           |                     |||d           |                     d           d S )Nc:txF)ignore_rich_pr)r  _write_richr   )r\   rP   rE  r   s       r^   r  zChart._write_tx_rich  sQ     	F### 	mEJJJ&!!!!!r_   c                     |                      d           |                     |           |                     d           d S )Nr  r  _write_vr   r  s     r^   r  zChart._write_tx_value  sF     	F### 	e&!!!!!r_   c                     d }|| j         |         }|                     d           |                     ||d           |                     d           d S )Nr  r/  )r0   r  r  r   )r\   rP   r   r   s       r^   r  zChart._write_tx_formula  sb    $W-DF### 	E4///&!!!!!r_   c                     |r|                     d          	|d         }nd }|                     d           |                     ||           |                                  |                     |||           |                     d           d S )Nr  zc:rich)r   r  _write_a_body_pr_write_a_lst_style_write_a_p_richr   )r\   rP   r   rE  r  r  s         r^   r  zChart._write_rich  s      	DHHZ((4J'HHHH%%% 	h666 	!!! 	UD.999(#####r_   c                 b   g }||rd}||dk    r+|                     d           |                     d           n]|dk    r+|                     d           |                     d           n,|                     d|f           |                     d           |                     d	|           d S )
Ni@i@1 )rotr   )vertwordArtVerti )r  eaVertr  )r  horzza:bodyPr)r   r  )r\   r  rE  r  s       r^   r  zChart._write_a_body_pr  s    
H8##!!*---!!"9::::X%%!!*---!!"45555!!5("3444!!"2333J
33333r_   c                 0    |                      d           d S )Nz
a:lstStyler  r   s    r^   r  zChart._write_a_lst_style  s    L)))))r_   c                     |                      d           |s|                     |           |                     ||           |                     d           d S Na:p)r  _write_a_p_pr_rich
_write_a_rr   )r\   rP   r   r  s       r^   r  zChart._write_a_p_rich  sf     	E"""  	*##D))) 	t$$$%     r_   c                     |                      d           |                     |           |                                  |                     d           d S r  )r  r  _write_a_end_para_rprr   r\   r   s     r^   _write_a_p_formulazChart._write_a_p_formula  s\     	E""" 	%%% 	""$$$%     r_   c                     |                      d           |                     |           |                     d           d S )Nza:pPr)r  _write_a_def_rprr   r  s     r^   r  zChart._write_a_p_pr_rich  sH     	G$$$ 	d###'"""""r_   c                    d}t          j        |          }t          j        |          }|r|                    d          rd}|s|rc|                     d|           |r|                     d|d         i           |r|                     |           |                     d           d S |                     d|           d S )NFr  Tza:defRPr)	r   _get_font_style_attributes_get_font_latin_attributesr   r  r  _write_a_latinr   r  )r\   r   	has_colorstyle_attributeslatin_attributess        r^   r  zChart._write_a_def_rpr&  s    	 ;DAA ;DAA 	DHHW%% 	I 	>y 	>
,<=== C(('4=)ABBB 6##$4555j)))))
,<=====r_   c                 @    d}d|fg}|                      d|           d S )Nr  langza:endParaRPrr  )r\   r  r  s      r^   r  zChart._write_a_end_para_rpr=  s/    tn%
NJ77777r_   c                     |                      d           |                     |           |                     |           |                     d           d S )Nza:r)r  _write_a_r_pr
_write_a_tr   )r\   rP   r   s      r^   r  zChart._write_a_rE  s\     	E""" 	4    	%     r_   c                    d}d}t          j        |          }t          j        |          }|r
|d         rd}|                    dd|f           |s|rc|                     d|           |r|                     d|d         i           |r|                     |           |                     d           d S |                     d|           d S )NFr  r  Tr   r  za:rPr)	r   r  r  insertr  r  r  r   r  )r\   r   r  r  r  r  s         r^   r  zChart._write_a_r_prR  s   	 ;DAA ;DAA 	DM 	I 	FD>222 	;y 	;)9::: C(('4=)ABBB 6##$4555g&&&&&)9:::::r_   c                 2    |                      d|           d S )Nza:tr+  r  s     r^   r  zChart._write_a_tm  s      	ue,,,,,r_   c                    |r|                     d          	|d         }nd }|                     d           |                     ||           |                                  |                     |           |                     d           d S )Nr  c:txPr)r   r  r  r  r  r   )r\   r   rE  r  s       r^   r  zChart._write_tx_prr  s      	DHHZ((4J'HHHH%%% 	h666 	!!! 	%%%(#####r_   c                 P   || j         }|sd S |d         dk    rd S |                     d           |                     |d                    |                    d          r|                     |d                    |                     |           |                     d           d S )NrI  r<  zc:markerr  )rG   r  _write_symbolr   _write_marker_sizer   r   )r\   rl   s     r^   r  zChart._write_marker  s    >(F 	F&>[((FJ''' 	6&>*** ::f 	4##F6N333 	&!!!*%%%%%r_   c                 <    d|fg}|                      d|           d S )Nr  zc:sizer  r  s      r^   r  zChart._write_marker_size  r0  r_   c                 <    d|fg}|                      d|           d S )Nr  zc:symbolr  r  s      r^   r  zChart._write_symbol  +     cl^
J
33333r_   chart_formatc                 ~   |                      |          sd S |                     d           |                    d          rH|d         d         r:d|d         v r|                                  n|                     |d                    |                    d          r|                     |d                    |                    d          r|                     |d                    |                    d          r)|d         d         r|                     |d                    |                     d           d S )Nc:spPrr[   r  r   rj   rk   ry   )	r  r  r   _write_a_no_fillr  _write_a_patt_fill_write_a_grad_fill_write_a_lnr   )r\   r  s     r^   r   zChart._write_sp_pr  sT   ##L11 	FH%%% F## 	?V(<Y(G 	?f---%%'''' ((f)=>>>I&& 	=##L$;<<<J'' 	>##L$<=== F## 	3V(<Y(G 	3\&1222(#####r_   c                 \   g }|                     d          }|2t          |dz   dz            dz  }t          dd|z  z             }d|fg}|                     d          s*|                     d	          s|                     d
          r|                     d|           d|v r|                                  nd	|v r|                     |           |                     d
          }|r|                     |           |                     d           d S |                     d|           d S )Nr?   g      ?   g      @g      ?i1  wr   r  	dash_typeza:ln)r   r"  r  r  r  _write_a_prst_dashr   r  )r\   ry   r  r?   	line_types        r^   r  zChart._write_a_ln  sP   
 !!!+,,s2E uu}-..E,J88F 	4txx00 	4DHH[4I4I 	4
333 ~~%%''''D((... --I 3''	222f%%%%%
33333r_   c                 0    |                      d           d S )Nza:noFillr  r   s    r^   r  zChart._write_a_no_fill  s    J'''''r_   c                     |                      d           |                    d          r/|                     |d         |                    d                     |                     d           d S )Nza:solidFillr  transparency)r  r   _write_colorr   )r\   r[   s     r^   r  zChart._write_a_solid_fill  sm     	M***88G 	Gd7mTXXn-E-EFFF-(((((r_   c                     |sd S |j         r|                                  d S |j        t          j        k    r|                     ||           d S |j        t          j        k    r|                     ||           d S d S r  )_is_automatic_write_a_sys_clr_typer	   RGB_write_a_srgb_clrTHEME_write_a_scheme_clr)r\   r  r  s      r^   r   zChart._write_color  s      	F 	:!!#####[JN**""5,77777[J,,,$$UL99999 -,r_   c                 J    d}d}d|fd|fg}|                      d|           d S )NwindowFFFFFFr  lastClrza:sysClrr  )r\   r  last_clrr  s       r^   r  zChart._write_a_sys_clr  sD      CL!


 	J
33333r_   c                     |sd S d|                                 fg}|rB|                     d|           |                     |           |                     d           d S |                     d|           d S )Nr  z	a:srgbClr)_rgb_hex_valuer  _write_a_alphar   r  )r\   r  r  r  s       r^   r  zChart._write_a_srgb_clr  s      	Fe224456
 	9Z888 ---k*****Z88888r_   c                 |   |                                 \  }}}d|fg}|dk    s|dk    s|rz|                     d|           |dk    r|                     |           |dk    r|                     |           |r|                     |           |                     d           d S |                     d|           d S )Nr  r   za:schemeClr)_chart_schemer  _write_a_lum_mod_write_a_lum_offr  r   r  )r\   r  r  schemelum_modlum_offr  s          r^   r  zChart._write_a_scheme_clr-  s    #(#6#6#8#8 fo&
Q;;'A+++z:::{{%%g...{{%%g... 2##L111m,,,,,z:::::r_   r^  c                 <    d|fg}|                      d|           d S )Nr  za:lumModr  r\   r^  r  s      r^   r  zChart._write_a_lum_modE  *    en%
J
33333r_   c                 <    d|fg}|                      d|           d S )Nr  za:lumOffr  r  s      r^   r  zChart._write_a_lum_offK  r  r_   c                     t          dt          |          z
  dz            }d|fg}|                     d|           d S )Nr   r  r  za:alphar"  r  r  s      r^   r  zChart._write_a_alphaQ  sG     3S>T)**cl^
Iz22222r_   c                 <    d|fg}|                      d|           d S )Nr  z
a:prstDashr  r  s      r^   r  zChart._write_a_prst_dashZ  s+     cl^
L*55555r_   c                    |sd S |                      d           |                     |                    d                     |                     |           |                     |d                    |d         dk    r(|                     |                    d                     |d         dk    r(|                     |                    d                     |                     |                    d                     |                     |                    d	                     d
|v r| 	                    |d
                    |                    d          r| 
                                 |                    d          r)|                                  |                     |           |                     d           d S )Nzc:trendlinere   rI  rR  orderrQ  periodforwardbackward	interceptdisplay_r_squareddisplay_equation)r  _write_namer   r   _write_trendline_type_write_trendline_order_write_period_write_forward_write_backward_write_c_intercept_write_c_disp_rsqr_write_c_disp_eq_write_c_trendline_lblr   )r\   rm   s     r^   r  zChart._write_trendlinea  s     	FM*** 	v../// 	)$$$ 	""9V#4555 V&&''	g(>(>??? V++y}}X66777 	IMM)44555 	Y]]:66777)####Ik$:;;;==,-- 	&##%%%==+,, 	3!!### ''	222-(((((r_   c                 <    d|fg}|                      d|           d S )Nr  zc:trendlineTyper  r  s      r^   r(  zChart._write_trendline_type  s,     cl^
-z:::::r_   c                 :    |d S |                      d|           d S )Nzc:namer  r\   r   s     r^   r'  zChart._write_name  s*     <Fx.....r_   c                 \    t          |d          }d|fg}|                     d|           d S )Nr   r  r  r   r  r  s      r^   r)  zChart._write_trendline_order  s6    #qkkcl^
Iz22222r_   c                 \    t          |d          }d|fg}|                     d|           d S )Nr   r  zc:periodr5  r  s      r^   r*  zChart._write_period  s6    #qkkcl^
J
33333r_   c                 D    |sd S d|fg}|                      d|           d S )Nr  z	c:forwardr  r  s      r^   r+  zChart._write_forward  rZ  r_   c                 D    |sd S d|fg}|                      d|           d S )Nr  z
c:backwardr  r  s      r^   r,  zChart._write_backward  s8      	Fcl^
L*55555r_   c                 <    d|fg}|                      d|           d S )Nr  zc:interceptr  r  s      r^   r-  zChart._write_c_intercept  s)    cl^
M:66666r_   c                 8    dg}|                      d|           d S )Nr  zc:dispEqr  r\   r  s     r^   r/  zChart._write_c_disp_eq  s%     \
J
33333r_   c                 8    dg}|                      d|           d S )Nr  z
c:dispRSqrr  r;  s     r^   r.  zChart._write_c_disp_rsqr  %     \
L*55555r_   c                 X   |                      d           |                     d d            |                                  |                     |d                    |d         r2|d                             d          }|r|                     |           |                     d           d S )Nzc:trendlineLblrW  r   )r  r  _write_trendline_num_fmtr   r   r;  r   )r\   rm   r   s      r^   r0  zChart._write_c_trendline_lbl  s    ,--- 	4&&& 	%%''' 	)G,--- W 	,W%))&11D ,%%d+++*+++++r_   c                 :    ddg}|                      d|           d S )N)rf  r  )rg  r   rh  r  r;  s     r^   r?  zChart._write_trendline_num_fmt  s/     &


 	J
33333r_   c                     | j         }|d S d|v rO|d         d         rA|                     d           |                     |           |                     d           d S |                     d           d S )Nry   r  zc:hiLowLines)rM   r  r   r   r  )r\   rM   s     r^   _write_hi_low_lineszChart._write_hi_low_lines  s    (F\!!l6&:9&E!/// l+++n-----/////r_   c                     | j         }|d S |d         d         rA|                     d           |                     |           |                     d           d S |                     d           d S )Nry   r  zc:dropLines)rL   r  r   r   r  )r\   rL   s     r^   _write_drop_lineszChart._write_drop_lines  s    _
Ffi( 	/... j)))m,,,,,.....r_   c                 D    |d S d|fg}|                      d|           d S )Nr  z	c:overlapr  r  s      r^   _write_overlapzChart._write_overlap  s5     ;Fcl^
K44444r_   c                    |rt          |          }nd}|                     d           |                     d           |                     |           t	          |          D ]F}||         }|	 t          |           n# t          $ r d}Y nw xY w|                     ||           G|                     d           d S )Nr   z
c:numCacher  	r~   r  _write_format_coder#  ranger2  r3  r&  r   r\   r   r'  r)  r4  s        r^   r  zChart._write_num_cache   s     	IIEEEL))) 		*** 	U###u 	% 	%AGE}e   
 NN1e$$$$,'''''s   1BBBc                     t          |          }|                     d           |                     |           t          |          D ]}|                     |||                    |                     d           d S )Nz
c:strCache)r~   r  r#  rJ  r&  r   )r\   r   r'  r)  s       r^   r  zChart._write_str_cache@  s    D		L))) 	U###u 	' 	'ANN1d1g&&&&,'''''r_   c                 2    |                      d|           d S )Nzc:formatCoder  r3  s     r^   rI  zChart._write_format_codeO  s      	~t44444r_   c                 <    d|fg}|                      d|           d S )Nr  z	c:ptCountr  r  s      r^   r#  zChart._write_pt_countT  rv  r_   c                     |d S d|fg}|                      d|           |                     |           |                     d           d S )Nidxzc:ptr  )r\   rP  r^  r  s       r^   r&  zChart._write_pt[  s]     =Fcl^
FJ/// 	e&!!!!!r_   c                 2    |                      d|           d S )Nzc:vr  r3  s     r^   r  zChart._write_vj  s      	ud+++++r_   c                 B    | j         sd S |                     d           d S )Nzc:protection)r3   r  r   s    r^   r   zChart._write_protectiono  s+     	FN+++++r_   c                 X    d}|sd S |D ] }|dz  }|s
|                      ||           !d S )Nr   r
   )_write_d_pt_point)r\   rq   r  r  s       r^   r  zChart._write_d_ptv  sZ     	F 	1 	1EQJE ""5%0000	1 	1r_   c                     |                      d           |                     |           |                     |           |                     d           d S )Nzc:dPt)r  r  r   r   )r\   r  r  s      r^   rT  zChart._write_d_pt_point  s\     	G$$$ 	 	%   '"""""r_   c                 Z   |sd S |                      d           |                    d          r|                     ||d                    |                    d          r|                     |d                    |                     |           |                    d          r|                     |d                    |                    d          r|                     |d                    |                    d          r|                                  |                    d          r|                                  |                    d          r| 	                                 |                    d	          r| 
                                 |                    d
          r|                                  |                    d          r|                     |d                    |                    d          r|                                  |                     d           d S )Nzc:dLblsrh  r   r   r   
legend_keyr^  categoryseries_namera  rs  leader_lines)r  r   _write_custom_labelsrn  r   r;  _write_d_lbl_pos_write_show_legend_key_write_show_val_write_show_cat_name_write_show_ser_name_write_show_percent_write_separator_write_show_leader_linesr   )r\   rz   s     r^   r  zChart._write_d_lbls  s3     	FI&&& ::h 	@%%ffX.>??? ::l## 	G001EFFF 	&!!! ::f 	2!!&.111 ::j!! 	6!!&"4555 ::l## 	*''))) ::g 	#  """ ::j!! 	(%%''' ::m$$ 	(%%''' ::l## 	'$$&&& ::k"" 	7!!&"5666 ::n%% 	,))+++)$$$$$r_   c                 x   d}|D ]3}|dz  }|d}|                      d           |                     |dz
             |                    d          }|r|                     d           n|                    d          s+|                    d          s|                    d          ra|                     d d            |                    d          r|                     |           n,|                    d          r|                     |           d	}|r|                     |           |                    d          r|                     |d                    n0|                    d          r|                     |d                    |                    d          r| 	                                 |                    d
          r| 
                                 |                    d          r|                                  n|                     |           |                     d           5d S )Nr   r
   Tzc:dLbldeleter   r^  r   FrX  rY  )r  r  r   r3  r  _write_custom_label_formula_write_custom_label_str_write_custom_label_formatr\  r^  r_  r`  r   )r\   parentrz   r  rW  use_custom_formattingdelete_labels          r^   r[  zChart._write_custom_labels  sX    2	( 2	(EQJE}$(!))) OOEAI&&& 99X..L !7""1%%%%9%% 77);); 7uyy?T?T 7 ""4...99Y'' 244U;;;;YYw'' 200777,1)( ;33E:::99Z(( >))%
*;<<<<ZZ
++ >))&*<===::g&& +((***::j)) 0--///::m,, 0--/// //666h''''e2	( 2	(r_   c                 4   |                     d          }|                     d          }|                     |          }|                     d           |                     ||d|            |                     d           |                     |           d S )Nr^  r   r  F)r   r  r  r  r   r   )r\   rW  rP   r   r  s        r^   rg  zChart._write_custom_label_str  s    		'""yy  --e44F### 	e-?@@@&!!! 	%     r_   c                     |                     d          }|                     d          }d }|| j        |         }|                     d           |                     ||d           |                     d           d S )Nr   r   r  r/  )r   r0   r  r  r   )r\   rW  r   r   r   s        r^   rf  z!Chart._write_custom_label_formula  s    ))I&&))I&&$W-DF### 	GT5111&!!!!!r_   c                    |                     d          }|                     |          }|r,|                     |           |                     |           d S |r,|                     d           |                     |           d S d S )Nr   r  )r   r  r   r  r  )r\   rW  r   r  s       r^   rh  z Chart._write_custom_label_format"  s    yy  --e44 	$e$$$d##### 	$)))d#####	$ 	$r_   c                 @    d}d|fg}|                      d|           d S )Nr  r  zc:showLegendKeyr  r  s      r^   r]  zChart._write_show_legend_key.  s/    cl^
-z:::::r_   c                 @    d}d|fg}|                      d|           d S )Nr
   r  z	c:showValr  r  s      r^   r^  zChart._write_show_val6  r  r_   c                 @    d}d|fg}|                      d|           d S )Nr
   r  zc:showCatNamer  r  s      r^   r_  zChart._write_show_cat_name>  .    cl^
OZ88888r_   c                 @    d}d|fg}|                      d|           d S )Nr
   r  zc:showSerNamer  r  s      r^   r`  zChart._write_show_ser_nameF  rr  r_   c                 @    d}d|fg}|                      d|           d S )Nr
   r  zc:showPercentr  r  s      r^   ra  zChart._write_show_percentN  rr  r_   c                 2    |                      d|           d S )Nzc:separatorr  r3  s     r^   rb  zChart._write_separatorV  s    }d33333r_   c                     d}d}d|fd|fg}|                      d           |                      d|           |                     ddg           |                     d           |                     d           d S )	Nz&{CE6537A1-D6FC-4f65-9D91-7224C49458BB}z6http://schemas.microsoft.com/office/drawing/2012/chartr   z	xmlns:c15r  r  zc15:showLeaderLinesr  r  )r\   r   
xmlns_c_15r  s       r^   rc  zChart._write_show_leader_linesZ  s     7M
 CL*%


 	J'''GZ0001J<@@@'"""*%%%%%r_   c                 <    d|fg}|                      d|           d S )Nr  z	c:dLblPosr  r  s      r^   r\  zChart._write_d_lbl_posn  rv  r_   c                 <    d|fg}|                      d|           d S )Nr  zc:deleter  r  s      r^   r3  zChart._write_deleteu  r  r_   c                 H    d}|sd S d|fg}|                      d|           d S )Nr
   r  zc:invertIfNegativer  )r\   invertr  r  s       r^   r  z!Chart._write_c_invert_if_negative|  s<     	Fcl^
0*=====r_   c                    |sd S |                      d           |                     |                    d          d            |                                  |                      d           |                     |           |                                  |                     d           |                     d           d S )Nr  r  r  )r  r  r   r  r  r  r   r  s     r^   r;  zChart._write_axis_font  s      	FH%%%dhhz22D999!!!E"""%%%""$$$%   (#####r_   c                 2    |                      d|           d S )Nza:latinr  r;  s     r^   r  zChart._write_a_latin  s    Iz22222r_   c                    | j         }|sd S |                     d           |d         r|                                  |d         r|                                  |d         r|                                  |d         r|                                  |d         r|                     |d                    |                     d           d S )Nzc:dTabler   r   r   r   r   )rE   r  _write_show_horz_border_write_show_vert_border_write_show_outline_write_show_keysr  r   )r\   rE   s     r^   r  zChart._write_d_table  s    
 	FJ''' 	+((*** 	+((*** 	'$$&&& 	$!!###= 	-eFm,,,*%%%%%r_   c                 8    dg}|                      d|           d S )Nr  zc:showHorzBorderr  r;  s     r^   r  zChart._write_show_horz_border  &     \
.
;;;;;r_   c                 8    dg}|                      d|           d S )Nr  zc:showVertBorderr  r;  s     r^   r  zChart._write_show_vert_border  r  r_   c                 8    dg}|                      d|           d S )Nr  zc:showOutliner  r;  s     r^   r  zChart._write_show_outline  s%     \
OZ88888r_   c                 8    dg}|                      d|           d S )Nr  z
c:showKeysr  r;  s     r^   r  zChart._write_show_keys  r=  r_   c                     |sd S |d         r|                      d|d                    |d         r|                      d|d                    d S d S )Nrp   r@  ro   r  )_write_err_barsr\   r}   s     r^   r  zChart._write_error_bars  su      	Fn% 	B  j&@AAAn% 	B  j&@AAAAA	B 	Br_   c                    |sd S |                      d           |                     |           |                     |d                    |                     |d                    |d         s|                                  |d         dk    rn=|d         dk    r|                     |           n|                     |d                    |                     |           |                     d           d S )Nz	c:errBarsr`  rI  r_  rc  rd  r^  )	r  _write_err_dir_write_err_bar_type_write_err_val_type_write_no_end_cap_write_custom_error_write_error_valr   r   )r\   r`  r}   s      r^   r  zChart._write_err_bars  s     	FK((( 	I&&& 	  K!8999 	  F!3444(# 	%""$$$f))6))$$Z0000 !!*W"5666 	*%%%+&&&&&r_   c                 <    d|fg}|                      d|           d S )Nr  zc:errDirr  r  s      r^   r  zChart._write_err_dir  r  r_   c                 <    d|fg}|                      d|           d S )Nr  zc:errBarTyper  r  s      r^   r  zChart._write_err_bar_type
  +     cl^
NJ77777r_   c                 <    d|fg}|                      d|           d S )Nr  zc:errValTyper  r  s      r^   r  zChart._write_err_val_type  r  r_   c                 8    dg}|                      d|           d S )Nr  z
c:noEndCapr  r;  s     r^   r  zChart._write_no_end_cap  r=  r_   c                 <    d|fg}|                      d|           d S )Nr  r  r  r  s      r^   r  zChart._write_error_val  r  r_   c                 :   |d         r|                      d           t          |d         t                    r|                     |d                    n#|                     |d         |d         d           |                     d           |d         r|                      d           t          |d         t                    r|                     |d                    n#|                     |d         |d         d           |                     d           d S d S )Nrk  zc:plusrm  r0  rl  zc:minusrn  )r  r%  r&  _write_num_litr  r   r  s     r^   r  zChart._write_custom_error%  s:    m$ 
	()))*]3T:: ##J}$=>>>>##}-z+/F   h'''n% 
	)	****^4d;; ##J~$>????##~.
<0H%   i(((((
	) 
	)r_   c                 x   t          |          }|                     d           |                     d           |                     |           t	          |          D ]F}||         }|	 t          |           n# t          $ r d}Y nw xY w|                     ||           G|                     d           d S )Nzc:numLitr  r   rH  rK  s        r^   r  zChart._write_num_lit@  s    D		 	J''' 		*** 	U###u 	% 	%AGE}e   
 NN1e$$$$*%%%%%s   ,A<<B
Bc                 :   | j         }|d S |                     d           |                     d           |                     |                    d                     |                     |                    d                     |                     d           d S )Nzc:upDownBars   r   r   )rN   r  _write_gap_width_write_up_barsr   _write_down_barsr   )r\   rN   s     r^   _write_up_down_barszChart._write_up_down_bars^  s    (FN+++ 	c""" 	L,,T22333 	l..v66777.)))))r_   c                 D    |d S d|fg}|                      d|           d S )Nr  z
c:gapWidthr  r  s      r^   r  zChart._write_gap_widthr  s5     ;Fcl^
L*55555r_   c                     |d         rO|d         d         rA|                      d           |                     |           |                     d           d S |                     d           d S )Nry   r  zc:upBarsr  r\   
bar_formats     r^   r  zChart._write_up_bars|  s     f 	,*V"4Y"? 	,
+++ j)))j)))))
+++++r_   c                     |d         rO|d         d         rA|                      d           |                     |           |                     d           d S |                     d           d S )Nry   r  z
c:downBarsr  r  s     r^   r  zChart._write_down_bars  s     f 	.*V"4Y"? 	.--- j)))l+++++-----r_   c                    |sd S d|fg}|                      d           |                     d|           |r?|                      d           |                     d           |                     d           |                     d           d S )Nr  zc:dispUnitszc:builtInUnitzc:dispUnitsLblr  r  )r\   unitsdisplayr  s       r^   rL  zChart._write_disp_units  s      	Fen%
M***OZ888 	0 0111
+++.///-(((((r_   c                 f   ddg}|d         dk    rg }|                      d|           |                     |           |d         dk    r|                     |d                    n6|                     |d                    |                     |d                    |                     d           d S )N)flipr   )rotWithShaper  rI  rO  z
a:gradFillangle)r  _write_a_gs_lst_write_a_lin_write_a_path_write_a_tile_rectr   )r\   rk   r  s      r^   r  zChart._write_a_grad_fill  s     '(=>
Fx''JL*555 	X&&&Fx''hw/0000 x/000 ##HV$4555,'''''r_   c                 ^   |d         }|d         }|                      d           t          |          D ]b\  }}t          ||         dz            }d|fg}|                      d|           |                     |           |                     d           c|                     d           d S )N	positionscolorsza:gsLstr  posza:gs)r  r%  r"  r   r   )r\   rk   r  r  r)  r  r  r  s           r^   r  zChart._write_a_gs_lst  s    [)	(#I&&&!&)) 	& 	&HAuilT)**C #,J
333e$$$f%%%%)$$$$$r_   c                 b    t          d|z            }d|fdg}|                     d|           d S )Nr!  ang)scaled0za:linr  )r\   r  r  s      r^   r  zChart._write_a_lin  sF     EEM"" EN


 	GZ00000r_   c                     d|fg}|                      d|           |                     |           |                     d           d S )Npathza:path)r  _write_a_fill_to_rectr   r\   gradient_typer  s      r^   r  zChart._write_a_path  sW     }-.
Hj111 	""=111(#####r_   c                 P    |dk    rg d}nddg}|                      d|           d S )Nshape))r   50000)rc  r  )rb  r  )r   r  )r   100000)rc  r  za:fillToRectr  r  s      r^   r  zChart._write_a_fill_to_rect  sO     G##  JJ  J
 	NJ77777r_   c                 L    |dk    rg }nddg}|                      d|           d S )Nr  )rb  -100000)r   r  z
a:tileRectr  r  s      r^   r  zChart._write_a_tile_rect  sC     G##JJ ! J
 	L*55555r_   c                     d|d         fg}|                      d|           |                     |d                    |                     |d                    |                     d           d S )Nprstrj   z
a:pattFillfg_colorbg_color)r  _write_a_fg_clr_write_a_bg_clrr   )r\   rj   r  s      r^   r  zChart._write_a_patt_fill
  s|     wy123
L*555 	WZ0111 	WZ0111,'''''r_   c                     |                      d           |                     |           |                     d           d S )Nza:fgClrr  r   r   r\   r  s     r^   r  zChart._write_a_fg_clr  D    I&&&%   )$$$$$r_   c                     |                      d           |                     |           |                     d           d S )Nza:bgClrr  r  s     r^   r  zChart._write_a_bg_clr  r  r_   )r   Nr  )r   )F)__name__
__module____qualname____doc__r   r   r   r/  r   r   r   r   r   r   r   r   r   r   r"  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r5  r   r   r   rX  r   r  r   r   r   r   r   dictboolr  r  r  r  r  r  rZ   r   r   r   r   r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r.  r-  r  r  rN  r  r2  rS  rT  rU  rV  r4  rH  r7  rn  r8  r9  r:  r<  r=  r>  r?  r@  rA  rB  rC  r5  r6  rI  rJ  rK  rP  rQ  r  r  r  r  r  r   r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r   r  r  r  r  r  r  r  r  r(  r'  r)  r*  r+  r,  r-  r/  r.  r0  r?  rB  rD  rF  r  r  rI  r#  r&  r  r   r  rT  r  r[  rg  rf  rh  r]  r^  r_  r`  ra  rb  rc  r\  r3  r  r;  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rL  r  r  r  r  r  r  r  r  r  __classcell__)r]   s   @r^   r   r      s        D D D D D DLM# M#(4S>": M#d M# M# M# M#^$sCx. T    $sCx. T    4S> d    4S> d    07 07$sCx.!9 07T 07 07 07 07d;$sCx. ;T ; ; ; ;;DcN ;t ; ; ; ;<T#s(^ < < < < <! !# !d ! ! ! !&"S "T " " " "2
% 
% 
% 
%
  
  
  
 3 3c3h 8 3D 3 3 3 3* $sCx.!9 T    0'
 '
c3h(@ '
D '
 '
 '
 '
R%
 %
htCH~&> %
$ %
 %
 %
 %
N%
 %
(4S>*B %
d %
 %
 %
 %
N Xg. $    ,   BO O Ob  >  "" " " c    <     D> > >@9 9 9v' ' 'R4 4 4l	 	 	} } }~" " "H. .htCH~.F . . . .`* * *X' ' 'RCt C C C C C  2  (# # #% % %' ' ' '    N8 8 8 82 2 2 2
3 
3 
3 
3% % % %:
: 
: 
: 
:F( F( F( F(P
* 
* 
* 
*, , , ,*   6 6 6 6       3# 3# 3# 3#j&U &t & & & &2& & & &*1 1 1 13 3 3 31 1 1 1< < < <!# !# !# !#F# # # #& & & & & & & &". . . .:/ / / /3 3 3 32 2 2 2Y% Y% Y% Y%vY% Y% Y% Y%vZ% Z% Z% Z%xf& f& f& f&P' ' ' '&5 5 5 5	9 	9 	9 	91 1 1 11 1 1 13 3 3 34 4 4 4.4 4 4 46	4 	4 	4 	4; ; ; ;; ; ; ;8 8 8 8 85 5 5 55 5 5 5 57 7 7 72 2 2 25 5 5 5 5 7 7 7 79 9 9 9: : : :4 4 4 4&4 4 4 4&: : : :7 7 7 77 7 7 7; ; ; ; ;; ; ; ; ;6& 6& 6& 6&p7 7 7 7+ + + +5 5 5 5
9 
9 
9 
9- - - -. . . .9 9 9 9(+ + + +@ @ @ @1 1* 1T 1d 1 1 1 1% %z %$ %SW % % % %( 8=% %%04%	% % % %0%j %T % % % % " " " "" " " "" " " "$ $ $ $*4 4 4 4,* * * *! ! ! !! ! ! !# # # #> > > >.8 8 8 8! ! ! !; ; ; ;6- - - -
$ $ $ $ $*& & & &22 2 2 24 4 4 4$ $$ $ $ $ $<#4 #4 #4 #4J( ( ( () ) ) ): :% :t : : : :4 4 4 49 9u 9D 9 9 9 9$; ; ;d ; ; ; ;04c 4d 4 4 4 44c 4d 4 4 4 43 3 3 36 6 6 6.) .) .) .)`; ; ; ;/ / / /3 3 3 34 4 4 45 5 5 56 6 6 67 7 7 74 4 4 46 6 6 6, , , ,*4 4 4 40 0 0 0"/ / / /"5 5 5 5( ( ( (@( ( ( (5 5 5 5
5 5 5 5" " " ", , , ,
, , , ,1 1 1 1# # # #7% 7% 7% 7%r6( 6( 6( 6(p! ! ! ! " " " " 
$ 
$ 
$ 
$; ; ; ;5 5 5 59 9 9 99 9 9 99 9 9 94 4 4 4& & & &(5 5 5 54 4 4 4	> 	> 	> 	>$ $ $ $"3 3 3 3& & & &>< < < << < < <9 9 9 96 6 6 6
B 
B 
B 
B"' "' "' "'H4 4 4 48 8 8 88 8 8 86 6 6 61 1 1 1) ) ) )6& & & &<* * * *(6 6 6 6, , , ,. . . .) ) ) )$( ( ( (2% % % %$
1 
1 
1 
1
$ 
$ 
$ 
$8 8 8 8$6 6 6 6( ( ( (%U %t % % % %%U %t % % % % % % % %r_   r   )r  r*  typingr   r   r   warningsr   xlsxwriter.colorr   r	   r   r   chart_titler   r  r   utilityr   r   r   r   r   	XMLwriterr   r  r_   r^   <module>r     s(    				 & & & & & & & & & &       . . . . . . . .       # # # # # #                   FD% FD% FD% FD% FD%I FD% FD% FD% FD% FD%r_   