
    ,h                        d dl Z d dl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mZ  G d dej                        Zy)	    Nwarn   )	xmlwriter)Shape)_datetime_to_excel_datetime_get_rgb_color_supported_datetimequote_sheetnamexl_range_formulaxl_rowcol_to_cellc                       e Zd ZdZ fdZddZd Zd Zd Zd Z	ddZ
d	 Zd
 Zd Zd Zd Zd Zd ZddZddZddZddZddZddZd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#d" Z$d# Z%dd$Z&d% Z'd& Z(d' Z)d( Z*d) Z+d* Z,d+ Z-d, Z.d- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDdC ZEdD ZFdE ZGdF ZHdG ZIdH ZJdI ZKdJ ZLdK ZMdL ZNdM ZOdN ZPdO ZQdP ZRdQ ZSdR ZTdS ZUdT ZVdU ZWdV ZXddWZYdX ZZddYZ[dZ Z\d[ Z]dd\Z^d] Z_d^ Z`d_ Zad` Zbda Zcdb Zddc Zedd ZfddeZgddfZhdg Zidh Zjdi Zkdj Zldk Zmdl Zndm Zodn Zpdo Zqdp ZrddqZs	 ddrZtds Zudt Zvdu Zwdv Zxdw Zydx Zzdy Z{dz Z|d{ Z}d| Z~d} Zd~ Zd Zd ZddZd Zd Zd Zd Zd Zd Zd ZddZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdÄ ZdĄ Zdń ZdƄ ZdǄ ZdȄ ZdɄ Zdʄ Zd˄ Zd̄ Zd̈́ Zd΄ Zdτ ZdЄ Z҈ xZS )Chartz:
    A class for writing the Excel XLSX Chart file.


    c                    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        d| _2        d| _3        d| _4        d| _5        d| _6        d| _7        d| _8        d| _9        d| _:        d| _;        i | _<        d
| _=        d| _>        d| _?        d| _@        d| _A        | j                          i | _C        y)z
        Constructor.

        Ni   r      Fblr    gapTi  i   between)D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_allowed
title_font
title_nametitle_formulatitle_data_idtitle_layouttitle_overlay
title_none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    R/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/xlsxwriter/chart.pyr   zChart.__init__'   s    	 $!&!$!$  %  

&"   $ $  #!! !"$!&(# %!"$$&	    c                    |i }d|vrt        d       y| j                  rd|vrt        d       yt        | j                        dk(  rt        d       y| j	                  |j                  d            }| j	                  |j                  d            }| j                  |j                  d      |j                  d	            \  }}| j                  ||j                  d
            }| j                  ||j                  d            }| j                  ||j                  d            }t        j                  |j                  d            }	|j                  d      rt        j                  |d         }	t        j                  |j                  d            }
t        j                  |j                  d            }t        j                  |j                  d            }|rd| _        |rd}d}
| j                  |j                  d            }| j                  |j                  d            }|j                  d      }| j!                  |j                  d            }| j!                  |j                  d            }||d}| j#                  |j                  d            }| j%                  |j                  d            }|j                  dd      }|j                  dd      }|j                  d      }|j                  d      }|s|rd| _        |j                  d       |r|d    | _        n
|d    | _        |j                  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                  j1                  |       y))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_datalineborderr[   patterngradientmarker	trendlinesmoothy_error_barsx_error_bars)rq   rp   pointsdata_labelsinvert_if_negativeFinvert_if_negative_colorr3   r2   Tr   overlapname_idval_data_idcat_data_idlabelsinvert_if_neginverted_color)r2   rr   
error_barsro   )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_propertiesrX   rC   rB   rE   rD   append)r\   optionsra   rb   rd   re   cat_idval_idrw   ri   r[   rk   rl   rm   rn   ro   rp   rq   r}   rr   rz   r{   r|   r3   r2   r   s                             r^   
add_serieszChart.add_seriesr   s    ?G 7"89!!l'&APQt{{s"%  &&w{{8'<=**7;;|+DE
 "00KK^!<
l
 "":w{{;L/MN""67;;}+EF##L'++k2JK ))'++f*=> ;;x --gh.?@D ))'++f*=> //I0FG 11'++j2IJ DI GD ,,W[[-BC 227;;{3KL	 X& 11'++n2MN11'++n2MN&2LQ
 ,,W[[-BC ,,W[[-GH  $8%@ %?G ++i(++i( g $D ;;u)$+EN!$+EN! ;;y!(/	(:%(/	(:%
f
*
 D
 L	

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

        Args:
            options:  A dictionary of axis options.

        Returns:
            Nothing.

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

        Args:
            options: A dictionary of axis options.

        Returns:
            Nothing.

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

        Args:
            options: A dictionary of axis options.

        Returns:
            Nothing.

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

        Args:
            options: A dictionary of axis options.

        Returns:
            Nothing.

        N)r   r2   r   s      r^   set_y2_axiszChart.set_y2_axis/  r   r_   c                    |i }| j                  |j                  d      |j                  d            \  }}| j                  ||j                  d            }|| _        || _        || _        | j                  |j                  d            | _        | j                  |j                  d      d      | _	        |j                  d      | _
        |j                  d	      | _        y)
z
        Set the chart title options.

        Args:
            options: A dictionary of chart title options.

        Returns:
            Nothing.

        Nrd   re   data	name_fontlayoutToverlaynone)r   r   r   rK   rL   rM   _convert_font_argsrJ   _get_layout_propertiesrN   rO   rP   )r\   r   rd   re   data_ids        r^   	set_titlezChart.set_title>  s     ?G!00KK^!<
l ##L'++f2EF)$ 11'++k2JK !77H8MtT$[[3 "++f-r_   c                 0    | j                  |      | _        y)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_legenda  s     11':r_   c                 0    | j                  |      | _        y)z
        Set the chart plot area options.

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

        Returns:
            Nothing.
        N)_get_area_propertiesr/   r   s     r^   set_plotareazChart.set_plotarean  s     11':r_   c                 0    | j                  |      | _        y)z
        Set the chart area options.

        Args:
            options: A dictionary of chart area options.

        Returns:
            Nothing.
        N)r   r.   r   s     r^   set_chartareazChart.set_chartarea{  s     227;r_   c                 2    |d}|dk  s|dkD  rd}|| _         y)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  s(     Ha<8b=H r_   c                 L    |sydddd}||vrt        d| d       y|| _        y)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   r5   )r\   optionvalid_optionss      r^   show_blanks_aszChart.show_blanks_as  sC      
 &4VHA>?!r_   c                     d| _         y)z
        Display ``#N/A`` on charts as blank/empty cells.

        Args:
            None.

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

        Args:
            None.

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

        Args:
            options: A dictionary of chart size options.

        Returns:
            Nothing.
        Nr9   r:   r;   r   r<   r=   r   r>   )r   r9   r:   r;   r<   r=   r>   r   s     r^   set_sizezChart.set_size  s     ?G [[$**5
kk(DKK8{{9a0{{9a0J2J2r_   c                    |i }i }|j                  dd      |d<   |j                  dd      |d<   |j                  dd      |d<   |j                  dd      |d<   | j                  |j                  d            |d<   || _        y)	z
        Set properties for an axis data table.

        Args:
            options: A dictionary of axis table options.

        Returns:
            Nothing.

        N
horizontalr   verticaloutline	show_keysr   font)r   r   r?   )r\   r   r?   s      r^   	set_tablezChart.set_table  s     ?G%kk,:l#KK
A6j";;y!4i$[[a8k//F0CDf
r_   c                    |i }d}d}d}d}|j                  d      rfd|d   v rt        j                  |d   d         }d|d   v rt        j                  |d   d         }d|d   v rt        j                  |d   d         }|j                  d      rfd|d   v rt        j                  |d   d         }d|d   v rt        j                  |d   d         }d|d   v rt        j                  |d   d         }||d||dd| _        y)	z
        Set properties for the chart up-down bars.

        Args:
            options: A dictionary of options.

        Returns:
            Nothing.

        Nuprj   ri   r[   down)ri   r[   )r   r   )r   r   r   r   rH   )r\   r   up_lineup_fill	down_line	down_fills         r^   set_up_down_barszChart.set_up_down_bars  sB    ?G 		 ;;t74=(44WT]85LM&44WT]65JK&44WT]65JK ;;v76?*!66wvx7PQ	(!66wvv7NO	(!66wvv7NO	  
 "!	
r_   c                 b   |i }t        j                  |j                  d            }t        j                  |j                  d            }t        j                  |j                  d            }t        j
                  |j                  d            }|rd| _        |rd}d}||||d| _        y)z
        Set properties for the chart drop lines.

        Args:
            options: A dictionary of options.

        Returns:
            Nothing.

        Nri   r[   rk   rl   ri   r[   rk   rl   )r   r   r   r   r   r   r[   rF   r\   r   ri   r[   rk   rl   s         r^   set_drop_lineszChart.set_drop_lines0  s     ?G))'++f*=>))'++f*=> //I0FG 11'++j2IJ DI GD  	
r_   c                 b   |i }t        j                  |j                  d            }t        j                  |j                  d            }t        j                  |j                  d            }t        j
                  |j                  d            }|rd| _        |rd}d}||||d| _        y)z
        Set properties for the chart high-low lines.

        Args:
            options: A dictionary of options.

        Returns:
            Nothing.

        Nri   r[   rk   rl   r   )r   r   r   r   r   r   r[   rG   r   s         r^   set_high_low_lineszChart.set_high_low_linesW  s     ?G))'++f*=>))'++f*=> //I0FG 11'++j2IJ DI GD  	
r_   c                     |y|| _         y)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\   charts     r^   combinezChart.combine~  s     =r_   c                 t   | j                          | j                          | j                          | j                          | j	                          | j                          | j                  | j                         | j                  r| j                          | j                  d       | j                          y )Nc:chartSpace)_xml_declaration_write_chart_space_write_lang_write_style_write_protection_write_chart_write_sp_prr.   r   _write_print_settings_xml_end_tag
_xml_closer   s    r^   _assemble_xml_filezChart._assemble_xml_file  s     	 	! 	 	 	  	 	$..) ==&&( 	.)r_   c                 
   |d   j                         }|j                  |       | j                  |j                  d      |j                  d            \  }}| j	                  ||j                  d            }i d|d   d|d|d|d|j                  d      d|j                  d      d	|j                  d	      d
|j                  d
      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      dd}|j                  dd      |d<   | j                  |d         |d<   |j                  dd      |d<   |j                  d      r|d   d   r| j                  |d         |d<   |j                  d      r|d   d   r| j                  |d         |d<   |j                  d      r|d   j                         d    |d<   |j                  d      r|d   d!k(  rd"|d<   n|d   d#k(  rnd |d<   |j                  d$      rd| _        |j                  d%      rd| _        d|d%<   |j                  d      r5t        |d         r't        |d   | j                  | j                        |d<   |j                  d	      r5t        |d	         r't        |d	   | j                  | j                        |d	<   |j                  d      r5t        |d         r't        |d   | j                  | j                        |d<   | j                  |j                  d&            |d&<   | j                  |j                  d'            |d'<   | j                  |j                  d(      d      |d(<   t        j                   |j                  d)            |d)<   t        j"                  |j                  d*            |d*<   t        j$                  |j                  d+            |d+<   t        j&                  |j                  d,            |d,<   |j                  d+      rd |d*<   |j                  d,      r
d |d+<   d |d*<   | j)                  |j                  d-            |d-<   | j)                  |j                  d.            |d.<   |S )/Ndefaultsrd   re   r   formular   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   r   r   r   	text_axisvisibleTdisplay_units_visiblemajor_gridlinesminor_gridlinesr   on_tickmidCatr   	date_axisr   num_fontr   name_layoutri   r[   rk   rl   minor_tick_markmajor_tick_mark)copyupdater   r   r   _get_display_units_get_gridline_propertieslowerrQ   r
   r   rR   rS   r   r   r   r   r   r   r   _get_tick_type)r\   r   user_optionsr   rd   re   r   s          r^   r   zChart._convert_axis_args  st   z"'')|$!00KK^!<
l ##L'++f2EF
Z(
D
 |
 w	

 w{{9-
 7;;u%
 7;;u%
 '++l3
 '++l3
 w{{+<=
 w{{+<=
 W[[9
 J/
 J/
 W[[9
  J/!
" gkk*:;#
$ #;;}5!++l3!(-@!A$[[9$[[9/
4 "++i6Y !% 7 7_8M N_(/4KT(R$% ;;()g6G.H.S&*&C&C)*'D"#
 ;;()g6G.H.S&*&C&C)*'D"#
 88J#J/557:D 88O$O$	1(0_%o&)3 )-_% ;;{#!%D ;;{#!&D $D 88E?24;?5UT^^T-A-ADK 88E?24;?5UT^^T-A-ADK 88J$7Z8H$I:Z $..$2F2F D
  227;;z3JKZ 33GKK4LM[ #99KK&
]
 11'++f2EFV 11'++f2EFV  77I8NOY !99'++j:QRZ 88IDL 88J"DODL #'"5"5gkkBS6T"U"&"5"5gkkBS6T"Ur_   c                    |si S |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d	d
      |j                  d      d
}|d   rt        |d   dz        |d<   |d   rdt        |d         z  |d<   |S )Nrd   colorsizebolditalic	underlinepitch_familycharsetbaseliner   rotation)
rd   r  r  r  r  r  r  r  r  r  d   `  )r   int)r\   r   r   s      r^   r   zChart._convert_font_args6  s    I KK'[[)KK'KK'kk(+ [1#KK7{{9-J2J/
 <tF|c12DL 
$s4
+;'<<D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_formulaR  sT     $%t4D<O<O$TF +8 9 K"D)r_   c                     |Xt        |t              r.t        |d   |d   dd      }t        |d         dz   |z   }d}||fS t	        j
                  d|      r|}d}||fS )Nr   r   Tr   !r   ^=?[^!]+!\$?[A-Z]+\$?\d+)r  r  r   r   rematch)r\   rd   re   cells       r^   r   zChart._process_namesc  s|     $%(a$q'4F.tAw7#=D \!! 5t<#\!!r_   c                     |t        |      dk(  ryt        |d   t              ry|D ]9  }|t        |t              rt	        j
                  d|      r y	 t        |       ; y# t        $ r Y  yw xY w)Nr   r   	multi_strz[_ ]strnum)r~   r  r  r(  r#  searchfloat
ValueError)r\   r   tokens      r^   _get_data_typezChart._get_data_types  s     <3t9>d1gt$  	E} %%"))FE*Be	"   s   A%%	A21A2c                 H   |sy |j                  d      r|j                  d      }|| j                  vrAt        | j                        }| j                  j                  |       || j                  |<   |S | j                  |   }| j                  |   || j                  |<   |S )N=)
startswithlstripr)   r~   r*   r   )r\   r   r   
formula_ids       r^   r   zChart._get_data_id  s      c"nnS)G $***T../J$$T*(2DW%  ))'2J   ,404!!*-r_   c                 T   |sy t        j                  |      }dddddddddd	d	d
ddd}|j                  d      }|||v r	||   |d<   nt        d|        y t	        j
                  |j                  d            }d|v rt	        j
                  |d         }t	        j                  |j                  d            }t	        j                  |j                  d            }t	        j                  |j                  d            }|rd | _	        |rd }d }||d<   ||d<   ||d<   ||d<   |S )N	automaticr   squarediamondtrianglexstardotdashcirclepluspicture)r5  r   r6  r7  r8  r9  r:  r;  
short_dashr<  	long_dashr=  r>  r?  typezUnknown marker type 'ri   rj   r[   rk   rl   )
r  deepcopyr   r   r   r   r   r   r   r[   )r\   rm   typesmarker_typeri   r[   rk   rl   s           r^   r   zChart._get_marker_properties  s]     v& % " 
$ jj("e#!&{!3v,[M:; ))&**V*<= v--fX.>?D ))&**V*<= //

90EF 11&**Z2HI DI GDvv#y%zr_   c                    |sy t        j                  |      }ddddddd}|j                  d      }||v r	||   |d<   nt        d	| d
       y t	        j
                  |j                  d            }d|v rt	        j
                  |d         }t	        j                  |j                  d            }t	        j                  |j                  d            }t	        j                  |j                  d            }| j                  |j                  d            }|rd | _
        |rd }d }||d<   ||d<   ||d<   ||d<   ||d<   |S )Nexplinearlog	movingAvgpolypower)exponentialrH  rI  moving_average
polynomialrL  rB  zUnknown trendline type 'r   ri   rj   r[   rk   rl   label)r  rC  r   r   r   r   r   r   r   _get_trendline_label_propertiesr[   )	r\   rn   rD  
trend_typeri   r[   rk   rl   rP  s	            r^   r   zChart._get_trendline_properties  sj     MM),	 !) 
 ]]6*
 %j 1If+J<q9: )))--*?@ y --i.ABD )))--*?@ //	i0HI 11)--
2KL 44Y]]75KL DI GD 	& 	&&	) (	*"	'r_   c                     |si S t        j                  |      }| j                  |j                  d            }t	        j
                  |j                  d            }d|v rt	        j
                  |d         }t	        j                  |j                  d            }t	        j                  |j                  d            }t	        j                  |j                  d            }|rd | _	        |rd }d }||d<   ||d<   ||d<   ||d<   ||d<   |S )Nr   ri   rj   r[   rk   rl   )
r  rC  r   r   r   r   r   r   r   r[   )r\   rP  r   ri   r[   rk   rl   s          r^   rQ  z%Chart._get_trendline_label_properties6  s    I e$ &&uyy'89 ))%))F*;< u--eHo>D ))%))F*;< //		)0DE 11%))J2G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	 |j                  d      |d<   |j                  d      |d<   |j                  d      |d<   |j                  d      |d<   t        j                  |j                  d            |d<   |S )NfixedValr   both)rB  valueendcap	direction
percentagestdDevstdErrcust)fixedrZ  standard_deviationstandard_errorcustomrB  zUnknown error bars type 'rW  	end_stylerX  rY  minusr>  plus_valuesminus_values	plus_data
minus_datari   )r   r   r   r   )r\   r   r}   rD  
error_types        r^   r   zChart._get_error_bars_propsc  sM   I )1PVW
  &"*&
 V_
!&z!2Jv,ZL9:I g")'"2Jw '!#*;#7Jx  '!{#w.*1
;'%/*0
;'  %,KK$>
=!%,[[%@
>"")++k":
;#*;;|#<
<  #77F8KL
6r_   c                 z    d|j                  d      i}t        j                  |j                  d            |d<   |S )Nr   ri   )r   r   r   )r\   r   gridlines      r^   r  zChart._get_gridline_properties  s<     w{{956 !55gkk&6IJr_   c                    |sy t        j                  |      }|j                  d      }|rF|| j                  v r(|| j                  k(  rd |d<   n#| j                  |   |d<   nt        d| d       y |j                  d      }ddddd	d
}|r||v r	||   |d<   nt        d       y | j                  |j                  d            |d<   t        j                  |j                  d            }d|v rt        j                  |d         }t        j                  |j                  d            }t        j                  |j                  d            }t        j                  |j                  d            }|rd | _        |rd }d }||d<   ||d<   ||d<   ||d<   |j                  d      r|d   D ]  }	|	|	j                  d      }
|
r$t        j                  dt        |
            r|
|	d<   |	j                  d      }|r%|j!                  d      r|j#                  d      |	d<   | j%                  ||	j                  d            }||	d<   | j                  |	j                  d            |	d<   t        j                  |	j                  d            }d|	v rt        j                  |	d         }t        j                  |	j                  d            }t        j                  |	j                  d            }t        j                  |	j                  d            }|rd | _        |rd }d }||	d<   ||	d<   ||	d<   ||	d<    |S )Nr   zUnsupported label position 'z' for this chart type	separatorz, z; z. 
r  ),;.rm  r  zUnsupported label separatorr   ri   rj   r[   rk   rl   ra  rW  r"  r   r0  r   r   )r  rC  r   rT   rU   r   r   r   r   r   r   r   r[   r#  r$  r(  r1  r2  r   )r\   rz   r   rl  
separatorsri   r[   rk   rl   rP  rW  r   r   s                r^   r   zChart._get_labels_properties  sS     v& ::j)4///t:::)-F:&)-)=)=h)GF:&3H:=RST JJ{+	

 J&&0&;{#23 00F1CDv ))&**V*<= v--fX.>?D ))&**V*<= //

90EF 11&**Z2HI DI GDvv#y%z::h) --=		'*RXX&A3u:N',E)$))I.w11#6'.~~c':E)$++GUYYv5FG#*i  $ 7 7		&8I Jf 11%))F2CD u$ 55eHoFD 11%))F2CD  77		)8LM !99%))J:OP  $DI "GD $f $f#*i $,j![--^ r_   c                    i }t        j                  |j                  d            }|j                  d      rt        j                  |d         }t        j                  |j                  d            }t        j                  |j                  d            }t        j
                  |j                  d            }|rd | _        |rd }d }| j                  |j                  d      d      }||d<   ||d<   ||d<   ||d<   ||d<   |S )Nri   rj   r[   rk   rl   r   F)r   r   r   r   r   r   r[   r   )r\   r   areari   r[   rk   rl   r   s           r^   r   zChart._get_area_properties  s    ))'++f*=> ;;x --gh.?@D ))'++f*=> //I0FG 11'++j2IJ DI GD ,,W[[-BEJVV!YX#Zr_   c                 "   i }|i }|j                  dd      |d<   |j                  d      |d<   | j                  |j                  d            |d<   | j                  |j                  d      d      |d<   |j                  d      rd|d<   t        j                  |j                  d            }|j                  d	      rt        j                  |d	         }t        j
                  |j                  d
            }t        j                  |j                  d            }t        j                  |j                  d            }|rd | _        |rd }d }| j                  |j                  d      d      }||d<   ||d
<   ||d<   ||d<   ||d<   |S )Nr   rightdelete_seriesr   r   Fr   ri   rj   r[   rk   rl   )	r   r   r   r   r   r   r   r   r[   )r\   r   r&   ri   r[   rk   rl   r   s           r^   r   zChart._get_legend_propertiesF  s   ?G$[[W=z")++o">00V1DEv66w{{87LeTx ;;v!'F: ))'++f*=> ;;x --gh.?@D ))'++f*=> //I0FG 11'++j2IJ DI GD ,,W[[-BEJvv#y!x%zr_   c           	         i }|si S |rd}nd}|j                         D ]  }||vst        d| d       i c S  |D ]_  }||j                         vrt        d| d       i c S ||   }	 t        |       |dk  s|d	kD  rt        d| d| d
       i c S |d||<   a |S # t        $ r t        d| d| d       i cY c S w xY w)N)r9  y)r9  rx  r9   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   r+  r,  )r\   argsis_textr   
propertieskeyproprW  s           r^   r   zChart._get_layout_propertiesz  s   I#J6J 99; 	C*$z#&GHI		  	+D499;&z$'LMN	JEe
 qyEAI iw 73 4 	 $D\F4L+	+.   z$y7RST	s   *B  CCc                    g }|sg S |D ]  }i }|t        j                  |j                  d            }d|v rt        j                  |d         }t        j                  |j                  d            }t        j                  |j                  d            }t        j
                  |j                  d            }|rd | _        |rd }d }||d<   ||d<   ||d<   ||d<   |j                  |        |S )Nri   rj   r[   rk   rl   )r   r   r   r   r   r   r[   r   )	r\   user_pointsrr   
user_pointpointri   r[   rk   rl   s	            r^   r   zChart._get_points_properties  s   I% "	!JE%11*..2HI z) 55j6JKD 11*..2HI  77
y8QR !99*..:TU  $DI "GD $f $f#*i $,j!MM% E"	!H r_   c                     d}d}|j                  d      }|j                  d      }|j                  d      r
|d   d   rd}|j                  d      r
|d   d   rd}|xs
 |xs |xs |S )NFrk   rl   r[   definedTri   )r   )r\   elementhas_fillhas_linehas_patternhas_gradients         r^   _has_fill_formattingzChart._has_fill_formatting  su    kk),{{:.;;v76?9#=H;;v76?9#=HB8B{BlBr_   c           
      V    |sy ddddddddd	d
	}||v r||   }|S t        d| d       y )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   rD  s      r^   r
  zChart._get_display_units  s_     #$+!3") 1"$

 E!!-0M
  /a@Ar_   c                 L    |sy ddddd}||v r||   }|S t        d| d       y )Noutinr   cross)outsideinsider   r  zUnknown tick_type 'r   r   )r\   	tick_typerD  s      r^   r  zChart._get_tick_type  sP     	
 i(I
  &yk34r_   c                 Z    g }| j                   D ]  }|d   r	|j                  |        |S Nr2   r   r   )r\   primary_axes_seriesr   s      r^   _get_primary_axes_serieszChart._get_primary_axes_series  s9     kk 	3F)$#**62	3 #"r_   c                 Z    g }| j                   D ]  }|d   s	|j                  |        |S r  r  )r\   secondary_axes_seriesr   s      r^   _get_secondary_axes_seriesz Chart._get_secondary_axes_series  s9     "kk 	5Fi %,,V4	5 %$r_   c                    dt        | j                        z   }dt        | j                        z   t        | j                        z   }|d|d}|d|dz   d}|d   r6| j                  j                  |       | j                  j                  |       |d   s7| j                  j                  |       | j                  j                  |       y y )Ni  r   04dprimary_axes)r  r   r~   r#   r"   r   )r\   rz  chart_id
axis_countid1id2s         r^   _add_axis_idszChart._add_axis_ids#  s    #dgg,&T^^,,s4==/AA
#z#./#zA~c23MM  %MM  %N#NN!!#&NN!!#& $r_   c                 0   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<   | j	                  i        | j                  i        | j                  i        | j                  i        y )NGeneralr   r   )r   r   r   r   r   r   )r   r   r   r   ru  )r   r   r   r   )r0   r1   r3   r2   r   r   r   r   r   s    r^   rZ   zChart._set_default_properties3  s     $ )1~#
J $ )1~#
J $$	$
Z  $ )1~	$
Z  	r_   c                 `    d}|dz   }|dz   }|dz   }d|fd|fd|fg}| j                  d|       y )	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_spaceZ  s[    51100>>    

 	NJ7r_   c                 6    d}d|fg}| j                  d|       y )Nen-USvalzc:lang_xml_empty_tagr\   r  r  s      r^   r   zChart._write_langi  s"    cl^
Hj1r_   c                 V    | j                   }|dk(  ry d|fg}| j                  d|       y )Nr   r  zc:style)r!   r  )r\   r!   r  s      r^   r   zChart._write_styleq  s4    == q=h'(
Iz2r_   c                 v   | j                  d       | j                  r| j                          n| j                  I| j	                  | j                  | j
                  d | j                  | j                  | j                         nI| j                  =| j                  | j                  d | j                  | j                  | j                         | j                          | j                          | j                          | j                          | j                  r| j!                          | j#                  d       y )Nzc:chart)r  rP   _write_c_auto_title_deletedrL   _write_title_formularM   rJ   rN   rO   rK   _write_title_rich_write_plot_area_write_legend_write_plot_vis_only_write_disp_blanks_asr6   _write_c_ext_lst_display_nar   r   s    r^   r   zChart._write_chart}  s   I&??,,. !!-))&&&&OO%%&& ,&&OOOO%%&& 	 	 	!!# 	""$   ,,.)$r_   c                 V    | j                   }|dk(  ry d|fg}| j                  d|       y )Nr   r  zc:dispBlanksAs)r5   r  r  s      r^   r  zChart._write_disp_blanks_as  s5     %<cl^
,j9r_   c                 f   | j                  d       | j                  | j                  j                  d      d       | j	                  ddi       | j	                  ddi       | j
                  }|rz|j                  rd| j                  z   |_        n| j                  |_        | j                  |_        | j                  |_	        |j	                  ddi       |j	                  ddi       | j                  | j                  | j                  d}| j                  r| j                  |       n| j                  |       | j!                  |       | j"                  | j$                  | j&                  d}| j!                  |       |rA|j                  r5|j"                  |j$                  |j&                  d}|j!                  |       | j                  r| j                  |       n| j                  |       | j)                          | j+                  | j                         | j-                  d       y )	Nz
c:plotArear   plotr  TF  )r0   r1   r"   )r  _write_layoutr/   r   _write_chart_typerW   rX   r   fhr    r0   r1   r"   rQ   _write_date_axis_write_cat_axis_write_val_axisr3   r2   r#   _write_d_tabler   r   )r\   second_chartrz  s      r^   r  zChart._write_plot_area  s   L) 	4==,,X6? 	5667 }}(("&."&'' #ggLO )-(9(9L% **ND+AB**NE+BC ++$--X!!$'  &T" llll
 	T" L55&..&..(22D ((.!!$'  & 	 	$--(,'r_   c                     |s| j                  d       y | j                  d       | j                  ||       | j                  d       y )Nc:layout)r  r  _write_manual_layoutr   r\   r   layout_types      r^   r  zChart._write_layout  sC     
+ 
+%%fk:j)r_   c                    | j                  d       |dk(  r| j                  ddg       | j                  ddg       | j                  ddg       | j                  dd	|d
   fg       | j                  dd	|d   fg       |dk7  r0| j                  dd	|d   fg       | j                  dd	|d   fg       | j                  d       y )Nzc:manualLayoutr  zc:layoutTarget)r  innerzc:xMode)r  edgezc:yModezc:xr  r9  zc:yrx  textzc:wr9   zc:hr:   r  r  r   r  s      r^   r  zChart._write_manual_layout
  s    ,- &  03C2DE 	I'89I'89EUF3K$8#9:EUF3K$8#9: & w(@'ABx0@(A'BC*+r_   c                      y N r\   rz  s     r^   r  zChart._write_chart_type  s     	r_   c                 2    d|fg}| j                  d|       y )Nr  z
c:groupingr  r  s      r^   _write_groupingzChart._write_grouping%  s    cl^
L*5r_   c                 &    | j                  |       y r  )
_write_serr\   r   s     r^   _write_serieszChart._write_series+  s    r_   c                    | j                   }| xj                   dz  c_         | j                  d       | j                  |       | j                  |       | j	                  |       | j                  |       | j                  |d          | j                  |d          | j                  |d          | j                  |d          | j                  |d          | j                  |d          | j                  |       | j                  |       | j                  r| j                  |d	          |j!                  d
      r| j#                  |d
          | j%                  d       y )Nr   zc:serrm   r{   rr   rz   rn   r}   ro   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_valrI   _write_c_smoothr   _write_c_ext_lst_inverted_colorr   )r\   r   indexs      r^   r  zChart._write_ser/  sS   !!QG$ 	 	%  	' 	&! 	6(+, 	(()@A 	)* 	6(+, 	f[12 	vl34 	 	   !12 ::&'008H1IJ'"r_   c                 `   d}d}d|fd|fg}d|fg}| j                  d       | j                  d|       | j                  d       | j                  d|       | j                  d	|i       | j                  d       | j                  d       | j                  d       | j                  d       y )
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_colord  s     7Q
 CL*%

 $Z01J'G[145J4  '5!12*%23'"*%r_   c                    d}d}d|fd|fg}dg}| j                  d       | j                  d|       | j                  d       | j                  d	|       | j                  d       | j                  d       | j                  d       y )
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_na}  s     7P
 CLJ'

 "lJ'G[1891;?67'"*%r_   c                 2    d|fg}| j                  d|       y )Nr  zc:idxr  r  s      r^   r  zChart._write_idx       cl^
GZ0r_   c                 2    d|fg}| j                  d|       y )Nr  c:orderr  r  s      r^   r  zChart._write_order  s     cl^
Iz2r_   c                 t    |d   | j                  |d   |d          y |d   | j                  |d          y y )Nre   rw   rd   )_write_tx_formula_write_tx_valuer  s     r^   r  zChart._write_series_name  sJ     .!-""6.#96);LMF^'  0 (r_   c                 0    |r| j                  ddg       y y )Nzc:smooth)r  1r  )r\   ro   s     r^   r  zChart._write_c_smooth  s     
\N; r_   c                 \   |d   }|d   }d }|| j                   |   }|sy | j                  d       | j                  |      }|dk(  rd| _        | j	                  |||       n9|dk(  rd| _        | j                  ||       nd| _        | j                  |||       | j                  d       y )Nrb   ry   zc:catr(  Fr'  T)r*   r  r.  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 G$ &&t,u#(D x8$#(D ))'48 $(D x8'"r_   c                     |d   }|d   }| j                   |   }| j                  d       | j                  ||d       | j                  d       y )Nra   rx   c:valr)  )r*   r  r  r   )r\   r   r   r   r   s        r^   r  zChart._write_val  sV    "'  )G$ 	GT51'"r_   c                     | j                  d       | j                  |       |dk(  r| j                  |       n|dk(  r| j                  |       | j	                  d       y )Nzc:numRefr)  r(  r  _write_series_formula_write_num_cache_write_str_cacher   r\   r   r   ref_types       r^   r  zChart._write_num_ref  sZ    J' 	""7+u!!$'!!$'*%r_   c                     | j                  d       | j                  |       |dk(  r| j                  |       n|dk(  r| j                  |       | j	                  d       y )Nzc:strRefr)  r(  r  r  s       r^   r  zChart._write_str_ref  s\     	J' 	""7+u!!$'!!$'*%r_   c                    |sy | j                  d       | j                  |       | j                  d       t        |d         }| j                  |       t	        |      D ]I  }| j                  d       t        |      D ]  \  }}| j                  ||        | j                  d       K | j                  d       | j                  d       y )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     ./ 	""7+01 DHU#  	'H(%h/ )5q%() g&	' 	./,-r_   c                 l    |j                  d      r|j                  d      }| j                  d|       y )Nr0  zc:f)r1  r2  _xml_data_element)r\   r   s     r^   r  zChart._write_series_formula  s0     c"nnS)Gug.r_   c                 "   | j                  |       |d   r=| j                  | j                  d          | j                  | j                  d          y | j                  | j                  d          | j                  | j                  d          y )Nr  r   r   )r  _write_axis_idr"   r#   r  s     r^   _write_axis_idszChart._write_axis_ids&  sx     	4 a 01a 01 q 12q 12r_   c                 2    d|fg}| j                  d|       y )Nr  zc:axIdr  r  s      r^   r&  zChart._write_axis_id5       cl^
Hj1r_   c                 z   |d   }|d   }|d   }||sy | j                   }| j                  }|j                  d      r|d   }| j                  d       | j	                  |d          | j                  |j                  d      d d d        |j                  d      s| j                  d	       | j                  ||j                  d             | j                  |j                  d
             | j                  |j                  d             |d   "| j                  |d   |d   ||d   |d          n"|d   | j                  |d   ||d   |d          | j                  |       | j                  |j                  d             | j                  |j                  d             | j                  |j                  d             | j!                  |       | j#                  |j                  d             | j%                  |d	          | j&                  s|j                  d      rn|j                  d      |j                  d      dk(  s|d   dk(  r!| j)                  |j                  d             n | j+                  |j                  d             |j                  d      s| j-                  d	       | j/                  |j                  d             | j1                  d       | j3                  |j                  d             | j5                  |j                  d             | j7                  d       y )Nr0   r1   r"   r   zc:catAxr   r   r   r   r   r   r   r   r   r  rd   r  r  r   r  r   r   r   r   r   r  r   r   )r'   r+   r   r  r&  _write_scaling_write_delete_write_axis_pos_write_major_gridlines_write_minor_gridlinesr  r  _write_cat_number_format_write_major_tick_mark_write_minor_tick_mark_write_tick_label_posr   _write_axis_font_write_cross_axisr8   _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\   rz  r0   r1   r"   r   	is_y_axiss          r^   r  zChart._write_cat_axis<  s   hh
# 8))''	 ::j!j)HI&HQK( 	FJJy14tDzz)$q! 	Xvzz)'<= 	##FJJ/@$AB 	##FJJ/@$AB )(%%y!y!{#}% F^'""v	6++>}@U
 	%%f- 	##FJJ/@$AB 	##FJJ/@$AB 	""6::.>#?@ 	&! 	fjj45 	x{+

9 5 

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

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

;'

=)	 	!!&) 	##FJJ/@$AB 	##FJJ/@$AB 	""6::.>#?@ 	&! 	fjj45 	x{+ JJz"*j!U*j!U* 

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

: 67 $$VZZ
%;< 	!!&**_"=> 	  L!9: 	  L!9: 	JJ'4K)L	
 	)$r_   c                 l   |d   }|d   }|d   }||sy | j                   }|j                  d      xs |}| j                  d       | j                  |d          | j	                  |j                  d      |j                  d      |j                  d	      |j                  d
             |j                  d      s| j                  d       | j                  ||j                  d             | j                  |j                  d             | j                  |j                  d             |d   "| j                  |d   |d   d |d   |d          n"|d   | j                  |d   d |d   |d          | j                  |       | j                  |j                  d             | j                  |j                  d             | j                  |j                  d             | j                  |       | j!                  |j                  d             | j#                  |d          | j$                  s|j                  d      rn|j                  d      |j                  d      d	k(  s|d   dk(  r!| j'                  |j                  d             n | j)                  |j                  d             | j+                  d       | j-                  d       | j/                  |j                  d             | j1                  |j                  d             | j3                  |j                  d             |j                  d      r| j5                  |d          | j7                  |j                  d             |j                  d      r| j9                  |d          | j;                  d       y ) Nr0   r1   r"   r   zc:dateAxr   r   r   r   r   r   r   r   r   r   r   r   r  rd   r  r  r   r  r   r  r   r   r   r   r   r   )r'   r   r  r&  r+  r,  r-  r.  r/  r  r  rA  r1  r2  r3  r   r4  r5  r8   r6  r7  r8  r:  r;  r<  rC  _write_c_major_time_unitrD  _write_c_minor_time_unitr   )r\   rz  r0   r1   r"   r   s         r^   r  zChart._write_date_axisr	  sk   hh
# 8)) ::j)5XJ'HQK( 	JJy!JJuJJuJJz"		
 zz)$q! 	Xvzz)'<= 	##FJJ/@$AB 	##FJJ/@$AB )(%%y!y!{#}% F^'""vf[&96-;P
 	!!&) 	##FJJ/@$AB 	##FJJ/@$AB 	""6::.>#?@ 	&! 	fjj45 	x{+

9 5 

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


 	J
3r_   c                     |j                  d      }d}d}|||d   d   k7  rd}d}|j                  d      rd}| j                  s|ry d|fd|fg}| j                  d|       y r^  )r   r$   r  )r\   r   rb  rc  default_formatr  s         r^   r0  zChart._write_cat_number_formatE
  s     hh|, "{d:6F|6T'TMN 88'(M ## ;']+


 	J
3r_   c                 <    d}d|fd|fg}| j                  d|       y )Nr   r_  r`  ra  r  )r\   rb  rc  r  s       r^   _write_data_label_number_formatz%Chart._write_data_label_number_format`
  s2     ;']+


 	J
3r_   c                 8    |sy d|fg}| j                  d|       y )Nr  zc:majorTickMarkr  r  s      r^   r1  zChart._write_major_tick_markk
  &     cl^
-z:r_   c                 8    |sy d|fg}| j                  d|       y )Nr  zc:minorTickMarkr  r  s      r^   r2  zChart._write_minor_tick_marku
  ri  r_   c                 D    ||dk(  rd}d|fg}| j                  d|       y )Nnext_tonextTor  zc:tickLblPosr  r  s      r^   r3  zChart._write_tick_label_pos
  s.    ;#*Ccl^
NJ7r_   c                 2    d|fg}| j                  d|       y )Nr  z	c:crossAxr  r  s      r^   r5  zChart._write_cross_axis
       cl^
K4r_   c                 :    |d}d|fg}| j                  d|       y )NautoZeror  z	c:crossesr  r  s      r^   r6  zChart._write_crosses
  s'    ;Ccl^
K4r_   c                 2    d|fg}| j                  d|       y )Nr  zc:crossesAtr  r  s      r^   r7  zChart._write_c_crosses_at
       cl^
M:6r_   c                 2    d|fg}| j                  d|       y )Nr  zc:autor  r  s      r^   r8  zChart._write_auto
  r)  r_   c                 V    |d}|dk(  rd}|dk(  rd}d|fg}| j                  d|       y )Nctrru  r[  leftr   r  z	c:lblAlgnr  r  s      r^   r9  zChart._write_label_align
  sA     ;C'>C&=Ccl^
K4r_   c                 2    d|fg}| j                  d|       y )Nr  zc:lblOffsetr  r  s      r^   r:  zChart._write_label_offset
  rs  r_   c                 8    |y d|fg}| j                  d|       y )Nr  zc:tickLblSkipr  r  s      r^   r;  zChart._write_c_tick_lbl_skip
  s%    ;cl^
OZ8r_   c                 8    |y d|fg}| j                  d|       y )Nr  zc:tickMarkSkipr  r  s      r^   r<  zChart._write_c_tick_mark_skip
  s&    ;cl^
,j9r_   c                     |sy |d   sy |d   d   r4| j                  d       | j                  |       | j                  d       y | j                  d       y )Nr   ri   r  zc:majorGridlinesr  r   r   r  r\   	gridliness     r^   r.  zChart._write_major_gridlines
  _     #VY' 23 i(01 23r_   c                     |sy |d   sy |d   d   r4| j                  d       | j                  |       | j                  d       y | j                  d       y )Nr   ri   r  zc:minorGridlinesr|  r}  s     r^   r/  zChart._write_minor_gridlines
  r  r_   c                 N    || j                   }d|fg}| j                  d|       y )Nr  zc:crossBetween)r@   r  r  s      r^   rB  zChart._write_cross_between
  s.    ;$$Ccl^
,j9r_   c                 8    |sy d|fg}| j                  d|       y )Nr  zc:majorUnitr  r  s      r^   rC  zChart._write_c_major_unit
  %     cl^
M:6r_   c                 8    |sy d|fg}| j                  d|       y )Nr  zc:minorUnitr  r  s      r^   rD  zChart._write_c_minor_unit  r  r_   c                 :    |d}d|fg}| j                  d|       y )Ndaysr  zc:majorTimeUnitr  r  s      r^   rI  zChart._write_c_major_time_unit  (    ;Ccl^
-z:r_   c                 :    |d}d|fg}| j                  d|       y )Nr  r  zc:minorTimeUnitr  r  s      r^   rJ  zChart._write_c_minor_time_unit  r  r_   c                 z   | j                   }|j                  dd      }|j                  d      }g }d}|j                  d      rt        |d   t              r|d   }|j	                  d      r|j                  dd      }d}d	d
dddd}|dk(  ry ||vry ||   }| j                  d       | j                  |       |D ]  }| j                  |        | j                  |j                  d      d       |r| j                          |r| j                  |       | j                  |       | j                  d       y )Nr   ru  r   r   rv  overlay_r   r   r[  r   r\  r   tr)ru  rw  topbottom	top_rightr   zc:legendr   r&   )r&   r   r  r  r1  replacer  _write_legend_pos_write_legend_entryr  _write_overlay_write_tx_prr   r   )r\   r&   r   r   rv  r   allowedr  s           r^   r  zChart._write_legend$  sN   ::j'2zz&!::o&:f_6Mt+T"?3Mz*''
B7HG 
 v7"8$J' 	x( # 	,E$$U+	,
 	6::h/: !d# 	&!*%r_   c                 2    d|fg}| j                  d|       y )Nr  zc:legendPosr  r  s      r^   r  zChart._write_legend_pos\  rs  r_   c                     | j                  d       | j                  |       | j                  d       | j                  d       y )Nzc:legendEntryr   )r  r  r,  r   )r\   r  s     r^   r  zChart._write_legend_entryc  s>     	O, 	 	1/*r_   c                 6    d}d|fg}| j                  d|       y )Nr   r  z	c:overlayr  r  s      r^   r  zChart._write_overlayp  "    cl^
K4r_   c                 P    d}| j                   ry d|fg}| j                  d|       y )Nr   r  zc:plotVisOnly)r7   r  r  s      r^   r  zChart._write_plot_vis_onlyx  s0     cl^
OZ8r_   c                     | j                  d       | j                          | j                          | j                          | j	                  d       y )Nzc:printSettings)r  _write_header_footer_write_page_margins_write_page_setupr   r   s    r^   r   zChart._write_print_settings  sJ    -. 	!!# 	  " 	 +,r_   c                 &    | j                  d       y )Nzc:headerFooterr  r   s    r^   r  zChart._write_header_footer  s    ,-r_   c                 h    d}d}d}d}d}d}d|fd|fd|fd|fd|fd	|fg}| j                  d
|       y )Ng      ?gffffff?g333333?r   r   r[  r\  headerfooterzc:pageMarginsr  )r\   r  rw  ru  r  r  r  r  s           r^   r  zChart._write_page_margins  sg     &M$K%L#Jvv

 	OZ8r_   c                 &    | j                  d       y )Nzc:pageSetupr  r   s    r^   r  zChart._write_page_setup  s    M*r_   c                 *    | j                  ddg       y )Nzc:autoTitleDeletedr  r  r   s    r^   r  z!Chart._write_c_auto_title_deleted  s    0:,?r_   c                     | j                  d       | j                  |||       | j                  |d       |r| j                          | j	                  d       y Nzc:titler  )r  _write_tx_richr  r  r   )r\   titler>  r   r   r   s         r^   r  zChart._write_title_rich  sW     	I& 	E9d3 	66* !)$r_   c                     | j                  d       | j                  ||       | j                  |d       |r| j                          | j	                  ||       | j                  d       y r  )r  r  r  r  r  r   )r\   r  r   r>  r   r   r   s          r^   r  zChart._write_title_formula  sg    
 	I& 	ug. 	66* ! 	$	*)$r_   c                 r    | j                  d       | j                  |||d       | j                  d       y )Nc:txF)ignore_rich_pr)r  _write_richr   )r\   r  r>  r   s       r^   r  zChart._write_tx_rich  s9     	F# 	iF&!r_   c                 j    | j                  d       | j                  |       | j                  d       y )Nr  r  _write_vr   r\   r  s     r^   r	  zChart._write_tx_value  s.     	F# 	e&!r_   c                     d }|| j                   |   }| j                  d       | j                  ||d       | j                  d       y )Nr  r(  )r*   r  r  r   )r\   r  r   r   s       r^   r  zChart._write_tx_formula  sM    $$W-DF# 	E4/&!r_   c                     |r|j                  d      |d   }nd }| j                  d       | j                  ||       | j                          | j	                  |||       | j                  d       y )Nr  zc:rich)r   r  _write_a_body_pr_write_a_lst_style_write_a_p_richr   )r\   r  r   r>  r  r  s         r^   r  zChart._write_rich  st     DHHZ(4J'HHH% 	h	2 	! 	UD.9(#r_   c                 $   g }||rd}|t|dk(  r#|j                  d       |j                  d       nL|dk(  r#|j                  d       |j                  d       n$|j                  d|f       |j                  d       | j                  d	|       y )
Ni@i@1 )rotr   )vertwordArtVerti )r  eaVertr  )r  horzza:bodyPr)r   r  )r\   r  r>  r  s       r^   r  zChart._write_a_body_pr  s    
	H8#!!*-!!"9:X%!!*-!!"45!!5("34!!"23J
3r_   c                 &    | j                  d       y )Nz
a:lstStyler  r   s    r^   r  zChart._write_a_lst_style'  s    L)r_   c                     | j                  d       |s| j                  |       | j                  ||       | j                  d       y Na:p)r  _write_a_p_pr_rich
_write_a_rr   )r\   r  r   r  s       r^   r  zChart._write_a_p_rich+  sC     	E" ##D) 	t$% r_   c                     | j                  d       | j                  |       | j                          | j                  d       y r  )r  r  _write_a_end_para_rprr   r\   r   s     r^   _write_a_p_formulazChart._write_a_p_formula9  s>     	E" 	% 	""$% r_   c                 j    | j                  d       | j                  |       | j                  d       y )Nza:pPr)r  _write_a_def_rprr   r  s     r^   r  zChart._write_a_p_pr_richF  s0     	G$ 	d#'"r_   c                 P   d}t        j                  |      }t        j                  |      }|r|j                  d      d}|s|rO| j	                  d|       |r| j                  d|d   i       |r| j                  |       | j                  d       y | j                  d|       y )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_rprP  s    	 ;;DA ;;DADHHW%1Iy
,<=(('4=)AB##$45j)
,<=r_   c                 6    d}d|fg}| j                  d|       y )Nr  langza:endParaRPrr  )r\   r  r  s      r^   r  zChart._write_a_end_para_rprg  s#    tn%
NJ7r_   c                     | j                  d       | j                  |       | j                  |       | j                  d       y )Nza:r)r  _write_a_r_pr
_write_a_tr   )r\   r  r   s      r^   r  zChart._write_a_ro  s>     	E" 	4  	% r_   c                 d   d}d}t        j                  |      }t        j                  |      }|r|d   d}|j                  dd|f       |s|rO| j	                  d|       |r| j                  d|d   i       |r| j                  |       | j                  d       y | j                  d|       y )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_pr|  s    	 ;;DA ;;DADM-I 	FD>2y)9:(('4=)AB##$45g&)9:r_   c                 (    | j                  d|       y )Nza:tr$  r  s     r^   r  zChart._write_a_t  s     	ue,r_   c                     |r|j                  d      |d   }nd }| j                  d       | j                  ||       | j                          | j	                  |       | j                  d       y )Nr  c:txPr)r   r  r  r  r  r   )r\   r   r>  r  s       r^   r  zChart._write_tx_pr  sp     DHHZ(4J'HHH% 	h	2 	! 	%(#r_   c                    || j                   }|sy |d   dk(  ry | j                  d       | j                  |d          |j                  d      r| j	                  |d          | j                  |       | j                  d       y )NrB  r5  zc:markerr  )rA   r  _write_symbolr   _write_marker_sizer   r   )r\   rm   s     r^   r  zChart._write_marker  s    >((F&>[(J' 	6&>* ::f##F6N3 	&!*%r_   c                 2    d|fg}| j                  d|       y )Nr  zc:sizer  r  s      r^   r  zChart._write_marker_size  r)  r_   c                 2    d|fg}| j                  d|       y )Nr  zc:symbolr  r  s      r^   r  zChart._write_symbol       cl^
J
3r_   c                    | j                  |      sy | j                  d       |j                  d      r4|d   d   r,d|d   v r| j                          n| j	                  |d          |j                  d      r| j                  |d          |j                  d      r| j                  |d          |j                  d      r|d   d   r| j                  |d          | j                  d       y )Nc:spPrr[   r  r   rk   rl   ri   )	r  r  r   _write_a_no_fillr  _write_a_patt_fill_write_a_grad_fill_write_a_lnr   r  s     r^   r   zChart._write_sp_pr  s     ((0H% ::f&.";'%%' ((8::i ##F9$56::j!##F:$67 ::f&.";VF^,(#r_   c                    g }|j                  d      }|*t        |dz   dz        dz  }t        dd|z  z         }d|fg}|j                  d      s"|j                  d	      s|j                  d
      rr| j                  d|       d|v r| j                          nd	|v r| j	                  |       |j                  d
      }|r| j                  |       | j                  d       y | j                  d|       y )Nr9   g      ?   g      @g      ?i1  wr   r  	dash_typeza:ln)r   r  r  r  r  _write_a_prst_dashr   r  )r\   ri   r  r9   	line_types        r^   r  zChart._write_a_ln  s    
 !!+,s2E uu}-.E,J88Ftxx0DHH[4I
3 ~%%'D((. -I''	2f%
3r_   c                 &    | j                  d       y )Nza:noFillr  r   s    r^   r  zChart._write_a_no_fill  s    J'r_   c                     | j                  d       d|v r1t        |d         }|j                  d      }| j                  ||       | j	                  d       y )Nza:solidFillr  transparency)r  r	   r   _write_a_srgb_clrr   )r\   r[   r  r  s       r^   r  zChart._write_a_solid_fill   sS     	M*d?"4=1E88N3L""5,7-(r_   c                     d|fg}|r5| j                  d|       | j                  |       | j                  d       y | j                  d|       y )Nr  z	a:srgbClr)r  _write_a_alphar   r  )r\   r  r  r  s       r^   r  zChart._write_a_srgb_clr-  sN    cl^
Z8 -k*Z8r_   c                 f    t        dt        |      z
  dz        }d|fg}| j                  d|       y )Nr  r  r  za:alphar  r  r  s      r^   r  zChart._write_a_alpha;  s6     3S>T)*cl^
Iz2r_   c                 2    d|fg}| j                  d|       y )Nr  z
a:prstDashr  r  s      r^   r  zChart._write_a_prst_dashD  s     cl^
L*5r_   c                    |sy | j                  d       | j                  |j                  d             | j                  |       | j	                  |d          |d   dk(  r | j                  |j                  d             |d   dk(  r | j                  |j                  d             | j                  |j                  d             | j                  |j                  d	             d
|v r| j                  |d
          |j                  d      r| j                          |j                  d      r!| j                          | j                  |       | j                  d       y )Nzc:trendlinerd   rB  rK  orderrJ  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\   rn   s     r^   r  zChart._write_trendlineK  s?    M* 	v./ 	)$ 	""9V#45 V&''	g(>? V+y}}X67 	IMM)45 	Y]]:67)###Ik$:;==,-##%==+,!!# ''	2-(r_   c                 2    d|fg}| j                  d|       y )Nr  zc:trendlineTyper  r  s      r^   r  zChart._write_trendline_type{  s      cl^
-z:r_   c                 .    |y | j                  d|       y )Nzc:namer  r\   r   s     r^   r  zChart._write_name  s     <x.r_   c                 J    t        |d      }d|fg}| j                  d|       y )Nr   r  r  r   r  r  s      r^   r  zChart._write_trendline_order  s(    #qkcl^
Iz2r_   c                 J    t        |d      }d|fg}| j                  d|       y )Nr   r  zc:periodr  r  s      r^   r   zChart._write_period  s(    #qkcl^
J
3r_   c                 8    |sy d|fg}| j                  d|       y )Nr  z	c:forwardr  r  s      r^   r  zChart._write_forward  rS  r_   c                 8    |sy d|fg}| j                  d|       y )Nr  z
c:backwardr  r  s      r^   r  zChart._write_backward  s%     cl^
L*5r_   c                 2    d|fg}| j                  d|       y )Nr  zc:interceptr  r  s      r^   r  zChart._write_c_intercept  s    cl^
M:6r_   c                 .    dg}| j                  d|       y )Nr  zc:dispEqr  r\   r  s     r^   r  zChart._write_c_disp_eq  s     \
J
3r_   c                 .    dg}| j                  d|       y )Nr  z
c:dispRSqrr  r  s     r^   r  zChart._write_c_disp_rsqr       \
L*5r_   c                    | j                  d       | j                  d d        | j                          | j                  |d          |d   r'|d   j	                  d      }|r| j                  |       | j                  d       y )Nzc:trendlineLblrP  r   )r  r  _write_trendline_num_fmtr   r   r4  r   )r\   rn   r   s      r^   r  zChart._write_c_trendline_lbl  s    ,- 	4& 	%%' 	)G,- WW%))&1D%%d+*+r_   c                 0    ddg}| j                  d|       y )N)r_  r  )r`  r   ra  r  r  s     r^   r  zChart._write_trendline_num_fmt  s#     &


 	J
3r_   c                     | j                   }|y d|v r<|d   d   r4| j                  d       | j                  |       | j                  d       y | j	                  d       y )Nri   r  zc:hiLowLines)rG   r  r   r   r  )r\   rG   s     r^   _write_hi_low_lineszChart._write_hi_low_lines  sd    ((\!l6&:9&E/ l+n-/r_   c                     | j                   }|y |d   d   r4| j                  d       | j                  |       | j                  d       y | j	                  d       y )Nri   r  zc:dropLines)rF   r  r   r   r  )r\   rF   s     r^   _write_drop_lineszChart._write_drop_lines  s[    __
fi(. j)m,.r_   c                 8    |y d|fg}| j                  d|       y )Nr  z	c:overlapr  r  s      r^   _write_overlapzChart._write_overlap   s'     ;cl^
K4r_   c                 :   |rt        |      }nd}| j                  d       | j                  d       | j                  |       t	        |      D ](  }||   }|	 t        |       | j                  ||       * | j                  d       y # t        $ r d}Y 3w xY w)Nr   z
c:numCacher  	r~   r  _write_format_coder  ranger+  r,  r  r   r\   r   r   r"  r-  s        r^   r  zChart._write_num_cache
  s    IEEL) 		* 	U#u 	%AGE}e NN1e$	% 	,'  s   BBBc                     t        |      }| j                  d       | j                  |       t        |      D ]  }| j	                  |||           | j                  d       y )Nz
c:strCache)r~   r  r  r   r  r   )r\   r   r   r"  s       r^   r  zChart._write_str_cache*  s^    D	L) 	U#u 	'ANN1d1g&	' 	,'r_   c                 (    | j                  d|       y )Nzc:formatCoder  r	  s     r^   r  zChart._write_format_code9  s     	~t4r_   c                 2    d|fg}| j                  d|       y )Nr  z	c:ptCountr  r  s      r^   r  zChart._write_pt_count>  ro  r_   c                 |    |y d|fg}| j                  d|       | j                  |       | j                  d       y )Nidxzc:ptr  )r\   r&  rW  r  s       r^   r  zChart._write_ptE  sC     =cl^
FJ/ 	e&!r_   c                 (    | j                  d|       y )Nzc:vr  r	  s     r^   r  zChart._write_vT  s     	ud+r_   c                 @    | j                   sy | j                  d       y )Nzc:protection)r-   r  r   s    r^   r   zChart._write_protectionY  s    N+r_   c                 P    d}|sy |D ]  }|dz  }|s| j                  ||        y )Nr   r   )_write_d_pt_point)r\   rr   r  r  s       r^   r  zChart._write_d_pt`  s;     	1EQJE""5%0	1r_   c                     | j                  d       | j                  |       | j                  |       | j                  d       y )Nzc:dPt)r  r  r   r   )r\   r  r  s      r^   r*  zChart._write_d_pt_pointn  s>     	G$ 	 	% '"r_   c                 p   |sy | j                  d       |j                  d      r| j                  ||d          |j                  d      r| j                  |d          | j	                  |       |j                  d      r| j                  |d          |j                  d      r| j                  |d          |j                  d      r| j                          |j                  d      r| j                          |j                  d      r| j                          |j                  d	      r| j                          |j                  d
      r| j                          |j                  d      r| j                  |d          |j                  d      r| j                          | j                  d       y )Nzc:dLblsra  r   r   r   
legend_keyrW  categoryseries_namerZ  rl  leader_lines)r  r   _write_custom_labelsrg  r   r4  _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{  sx    I& ::h%%ffX.>? ::l#001EF 	&! ::f!!&.1 ::j!!!&"45 ::l#'') ::g  " ::j!%%' ::m$%%' ::l#$$& ::k"!!&"56 ::n%))+)$r_   c                    d}|D ]  }|dz  }|| j                  d       | j                  |dz
         |j                  d      }|r| j                  d       ng|j                  d      r| j	                  |       |j                  d      r| j                  |d          |j                  d      r| j                          |j                  d      r| j                          |j                  d	      r| j                          n|j                  d      r| j                  |       |j                  d      r| j                  |d          |j                  d      r| j                          |j                  d      r| j                          |j                  d	      r"| j                          n| j                  |       | j                  d        y )
Nr   r   zc:dLbldeleter   r   rW  r.  r/  )r  r  r   r,  _write_custom_label_formular2  r4  r5  r6  _write_custom_label_str_write_custom_label_format_onlyr   )r\   parentrz   r  rP  delete_labels         r^   r1  zChart._write_custom_labels  s    ,	(EQJE}) OOEAI& 99X.L""1%9%007::j)))&*<=::g&((*::j)--/::m,--/7#,,U3::j)))&*<=::g&((*::j)--/::m,--/44U;h'Y,	(r_   c                    |j                  d      }|j                  d      }| j                  |      }| j                  d d        | j                  d       | j	                  ||d|        | j                  d       | j                  |       y )NrW  r   r  F)r   r  r  r  r  r   r   )r\   rP  r  r   has_formattings        r^   r=  zChart._write_custom_label_str  s    		'"yy 2259 	4&F# 	e-?@&! 	% r_   c                    |j                  d      }|j                  d      }d }|| j                  |   }| j                  d d        | j                  d       | j	                  ||d       | j                  d       | j                  |       y )Nr   r   r  r(  )r   r*   r  r  r  r   r>  )r\   rP  r   r   r   s        r^   r<  z!Chart._write_custom_label_formula  s    ))I&))I&$$W-D 	4&F# 	GT51&! 	,,U3r_   c                     |j                  d      }| j                  |      }|r#| j                  |       | j                  |       y |r#| j	                  d       | j                  |       y y )Nr   r  )r   r  r   r  r  )r\   rP  r   rB  s       r^   r>  z%Chart._write_custom_label_format_only  sc    yy 2259e$d#)d# r_   c                 6    d}d|fg}| j                  d|       y )Nr  r  zc:showLegendKeyr  r  s      r^   r3  zChart._write_show_legend_key  s#    cl^
-z:r_   c                 6    d}d|fg}| j                  d|       y )Nr   r  z	c:showValr  r  s      r^   r4  zChart._write_show_val#  r  r_   c                 6    d}d|fg}| j                  d|       y )Nr   r  zc:showCatNamer  r  s      r^   r5  zChart._write_show_cat_name+  "    cl^
OZ8r_   c                 6    d}d|fg}| j                  d|       y )Nr   r  zc:showSerNamer  r  s      r^   r6  zChart._write_show_ser_name3  rH  r_   c                 6    d}d|fg}| j                  d|       y )Nr   r  zc:showPercentr  r  s      r^   r7  zChart._write_show_percent;  rH  r_   c                 (    | j                  d|       y )Nzc:separatorr  r	  s     r^   r8  zChart._write_separatorC  s    }d3r_   c                     d}d}d|fd|fg}| j                  d       | j                  d|       | j                  ddg       | j                  d       | j                  d       y )	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^   r9  zChart._write_show_leader_linesG  su     7M
 CL*%


 	J'GZ01J<@'"*%r_   c                 2    d|fg}| j                  d|       y )Nr  z	c:dLblPosr  r  s      r^   r2  zChart._write_d_lbl_pos[  ro  r_   c                 2    d|fg}| j                  d|       y )Nr  zc:deleter  r  s      r^   r,  zChart._write_deleteb  r  r_   c                 <    d}|sy d|fg}| j                  d|       y )Nr   r  zc:invertIfNegativer  )r\   invertr  r  s       r^   r  z!Chart._write_c_invert_if_negativei  s)    cl^
0*=r_   c                 6   |sy | j                  d       | j                  |j                  d      d        | j                          | j                  d       | j	                  |       | j                          | j                  d       | j                  d       y )Nr  r  r  )r  r  r   r  r  r  r   r  s     r^   r4  zChart._write_axis_fontt  s     H%dhhz2D9!E"%""$% (#r_   c                 (    | j                  d|       y )Nza:latinr  r  s     r^   r  zChart._write_a_latin  s    Iz2r_   c                 @   | j                   }|sy | j                  d       |d   r| j                          |d   r| j                          |d   r| j	                          |d   r| j                          |d   r| j                  |d          | j                  d       y )Nzc:dTabler   r   r   r   r   )r?   r  _write_show_horz_border_write_show_vert_border_write_show_outline_write_show_keysr  r   )r\   r?   s     r^   r  zChart._write_d_table  s    

J'((*((*$$&!!#=eFm,*%r_   c                 .    dg}| j                  d|       y )Nr  zc:showHorzBorderr  r  s     r^   rU  zChart._write_show_horz_border       \
.
;r_   c                 .    dg}| j                  d|       y )Nr  zc:showVertBorderr  r  s     r^   rV  zChart._write_show_vert_border  rZ  r_   c                 .    dg}| j                  d|       y )Nr  zc:showOutliner  r  s     r^   rW  zChart._write_show_outline  s     \
OZ8r_   c                 .    dg}| j                  d|       y )Nr  z
c:showKeysr  r  s     r^   rX  zChart._write_show_keys  r  r_   c                 t    |sy |d   r| j                  d|d          |d   r| j                  d|d          y y )Nrq   r9  rp   rx  )_write_err_barsr\   r}   s     r^   r  zChart._write_error_bars  sI     n%  j&@An%  j&@A &r_   c                 z   |sy | j                  d       | j                  |       | j                  |d          | j                  |d          |d   s| j	                          |d   dk(  rn.|d   dk(  r| j                  |       n| j                  |d          | j                  |       | j                  d       y )Nz	c:errBarsrY  rB  rX  r\  r]  rW  )	r  _write_err_dir_write_err_bar_type_write_err_val_type_write_no_end_cap_write_custom_error_write_error_valr   r   )r\   rY  r}   s      r^   r_  zChart._write_err_bars  s     K( 	I& 	  K!89 	  F!34(#""$f)6)$$Z0 !!*W"56 	*%+&r_   c                 2    d|fg}| j                  d|       y )Nr  zc:errDirr  r  s      r^   rb  zChart._write_err_dir  r  r_   c                 2    d|fg}| j                  d|       y )Nr  zc:errBarTyper  r  s      r^   rc  zChart._write_err_bar_type       cl^
NJ7r_   c                 2    d|fg}| j                  d|       y )Nr  zc:errValTyper  r  s      r^   rd  zChart._write_err_val_type  rj  r_   c                 .    dg}| j                  d|       y )Nr  z
c:noEndCapr  r  s     r^   re  zChart._write_no_end_cap  r  r_   c                 2    d|fg}| j                  d|       y )Nr  r  r  r  s      r^   rg  zChart._write_error_val  r  r_   c                    |d   rc| j                  d       t        |d   t              r| j                  |d          n| j	                  |d   |d   d       | j                  d       |d   rd| j                  d       t        |d   t              r| j                  |d          n| j	                  |d   |d   d       | j                  d       y y )Nrd  zc:plusrf  r)  re  zc:minusrg  )r  r  r  _write_num_litr  r   r`  s     r^   rf  zChart._write_custom_error  s     m$)*]3T:##J}$=>##}-z+/F h'n%	**^4d;##J~$>?##~.
<0H% i( &r_   c                 0   t        |      }| j                  d       | j                  d       | j                  |       t	        |      D ](  }||   }|	 t        |       | j                  ||       * | j                  d       y # t        $ r d}Y 3w xY w)Nzc:numLitr  r   r  r!  s        r^   ro  zChart._write_num_lit-  s    D	 	J' 		* 	U#u 	%AGE}e NN1e$	% 	*%  s   BBBc                    | j                   }|y | j                  d       | j                  d       | j                  |j	                  d             | j                  |j	                  d             | j                  d       y )Nzc:upDownBars   r   r   )rH   r  _write_gap_width_write_up_barsr   _write_down_barsr   )r\   rH   s     r^   _write_up_down_barszChart._write_up_down_barsK  sx    ((N+ 	c" 	L,,T23 	l..v67.)r_   c                 8    |y d|fg}| j                  d|       y )Nr  z
c:gapWidthr  r  s      r^   rs  zChart._write_gap_width_  s'     ;cl^
L*5r_   c                     |d   r<|d   d   r4| j                  d       | j                  |       | j                  d       y | j                  d       y )Nri   r  zc:upBarsr|  r\   
bar_formats     r^   rt  zChart._write_up_barsi  sR     f*V"4Y"?
+ j)j)
+r_   c                     |d   r<|d   d   r4| j                  d       | j                  |       | j                  d       y | j                  d       y )Nri   r  z
c:downBarsr|  ry  s     r^   ru  zChart._write_down_barsv  sR     f*V"4Y"?- j)l+-r_   c                     |sy d|fg}| j                  d       | j                  d|       |r3| j                  d       | j                  d       | j                  d       | j                  d       y )Nr  zc:dispUnitszc:builtInUnitzc:dispUnitsLblr  r  )r\   unitsdisplayr  s       r^   rE  zChart._write_disp_units  sq     en%
M*OZ8 01
+./-(r_   c                    ddg}|d   dk(  rg }| j                  d|       | j                  |       |d   dk(  r| j                  |d          n(| j                  |d          | j	                  |d          | j                  d       y )N)flipr   )rotWithShaper  rB  rH  z
a:gradFillangle)r  _write_a_gs_lst_write_a_lin_write_a_path_write_a_tile_rectr   )r\   rl   r  s      r^   r  zChart._write_a_grad_fill  s     '(=>
Fx'JL*5 	X&Fx'hw/0 x/0 ##HV$45,'r_   c                 ,   |d   }|d   }| j                  d       t        |      D ]Z  \  }}t        ||   dz        }d|fg}| j                  d|       t        |      }| j	                  |       | j                  d       \ | j                  d       y )N	positionscolorsza:gsLstr  posza:gs)r  r  r  r	   r  r   )r\   rl   r  r  r"  r  r  r  s           r^   r  zChart._write_a_gs_lst  s    [)	(#I&!&) 		&HAuilT)*C #,J
3 #5)E""5)f%		& 	)$r_   c                 P    t        d|z        }d|fdg}| j                  d|       y )Nr  ang)scaled0za:linr  )r\   r  r  s      r^   r  zChart._write_a_lin  s7     EEM" EN


 	GZ0r_   c                 v    d|fg}| j                  d|       | j                  |       | j                  d       y )Npathza:path)r  _write_a_fill_to_rectr   r\   gradient_typer  s      r^   r  zChart._write_a_path  s?     }-.
Hj1 	""=1(#r_   c                 D    |dk(  rg d}nddg}| j                  d|       y )Nshape))r   50000)r\  r  )r[  r  )r   r  )r   100000)r\  r  za:fillToRectr  r  s      r^   r  zChart._write_a_fill_to_rect  s4     G#J  J
 	NJ7r_   c                 @    |dk(  rg }nddg}| j                  d|       y )Nr  )r[  -100000)r   r  z
a:tileRectr  r  s      r^   r  zChart._write_a_tile_rect  s2     G#J ! J
 	L*5r_   c                     d|d   fg}| j                  d|       | j                  |d          | j                  |d          | j                  d       y )Nprstrk   z
a:pattFillfg_colorbg_color)r  _write_a_fg_clr_write_a_bg_clrr   )r\   rk   r  s      r^   r  zChart._write_a_patt_fill  s^     wy123
L*5 	WZ01 	WZ01,'r_   c                     t        |      }| j                  d       | j                  |       | j                  d       y )Nza:fgClrr	   r  r  r   r\   r  s     r^   r  zChart._write_a_fg_clr  :     u%I& 	u%)$r_   c                     t        |      }| j                  d       | j                  |       | j                  d       y )Nza:bgClrr  r  s     r^   r  zChart._write_a_bg_clr  r  r_   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   rQ  r   r  r   r   r   r   r   r  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  rG  r  r+  rL  rM  rN  rO  r-  rA  r0  rg  r1  r2  r3  r5  r6  r7  r8  r9  r:  r;  r<  r.  r/  rB  rC  rD  rI  rJ  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  r  r  r  r   r  r*  r  r1  r=  r<  r>  r3  r4  r5  r6  r7  r8  r9  r2  r,  r  r4  r  r  rU  rV  rW  rX  r  r_  rb  rc  rd  re  rg  rf  ro  rv  rs  rt  ru  rE  r  r  r  r  r  r  r  r  r  __classcell__)r]   s   @r^   r   r      sI   IVN#`!.F;;<!&"2
%
 3*05
n%
N%
N,BB8"" < DBH=~+Z4l	xt&P2h*X+ZC2(#%' N82
3+%Z
:F(P
*,*6 3#j&2&*131<!#F#& &".:/32d%Lg%Re%Nq&f'&5	91134.46	4;;855725 79:4&4&:77;;6&p7+5
9-.9(+@%$ @E%,"""$*4,*!!#>.8!;6-
$*&224$>#4J()936.)`;/3456746,*40"/"5(@(5
5",
,1#7%r0(d!&4,
$;59994&(54	>$"3&><<96
B"'H48861)6&<*(6,.)$(2%(
1
$8$6(
%
%r_   r   )r  r#  warningsr   r   r   r  r   utilityr   r	   r
   r   r   r   	XMLwriterr   r  r_   r^   <module>r     s6     	    DD%I DD%r_   