
    >wgv                        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	 ddlm
Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ  G d dej                        Zy)    Nwarn   )Shape)	xmlwriter)get_rgb_color)xl_rowcol_to_cell)xl_range_formula)supported_datetime)datetime_to_excel_datetime)quote_sheetnamec                       e Zd ZdZdш 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         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| _0        d| _1        d| _2        d| _3        d| _4        d| _5        d| _6        d| _7        d| _8        d| _9        d| _:        d| _;        d| _<        i | _=        d
| _>        d| _?        d| _@        d| _A        d| _B        | j                          y)z
        Constructor.

        Ni   r      Fblr    gapi  i   betweenT)Dsuperr   __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)selfoptions	__class__s     G/var/www/horilla/myenv/lib/python3.12/site-packages/xlsxwriter/chart.pyr   zChart.__init__#   s     	eT#%  !&!$!$  % 

&"   $ $  #!! !"$!&(# %!"$$&    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borderfillpatterngradientmarker	trendlinesmoothy_error_barsx_error_bars)rr   rq   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   rs   
error_barsrp   )r   r%   lenr   _list_to_formulaget_process_names_get_data_idr   _get_line_properties_get_fill_properties_get_pattern_properties_get_gradient_propertiesrk   _get_marker_properties_get_trendline_properties_get_error_bars_props_get_points_properties_get_labels_propertiesrX   rC   rB   rE   rD   append)r[   r\   ra   rb   rd   re   cat_idval_idrx   ri   rk   rl   rm   rn   ro   rp   rq   rr   r~   rs   r{   r|   r}   r3   r2   r   s                             r^   
add_serieszChart.add_seriesm   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_title9  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_legend\  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_plotareai  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_chartareav  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                 J    |sydddd}||vrt        d|z         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 '%s')r   r5   )r[   optionvalid_optionss      r^   show_blanks_aszChart.show_blanks_as  s?      
 &7&@A!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   rk   down)ri   rk   )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   rk   rl   rm   ri   rk   rl   rm   )r   r   r   r   r   r   rk   rF   r[   r\   ri   rk   rl   rm   s         r^   set_drop_lineszChart.set_drop_lines+  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   rk   rl   rm   r   )r   r   r   r   r   r   rk   rG   r   s         r^   set_high_low_lineszChart.set_high_low_linesR  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.combiney  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}d|v r|j                  d      |d<   n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 )0N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visibler   display_units_visibleTmajor_gridlinesminor_gridlinesr   on_tickmidCatr   	date_axisr   num_fontr   name_layoutri   rk   rl   rm   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  s   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 %kk)4DODO !% 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?1$u+>4UT^^T-A-ADK 88E?1$u+>4UT^^T-A-ADK 88J$6tJ7G$H9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y |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_args4  s     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|z         |S t	        | }|S )N 'zSSheetname in '%s' contains spaces but isn't quoted. This may cause errors in Excel.)
isinstancelistrY   r   r
   )r[   r   r   s      r^   r   zChart._list_to_formulaP  sP     $%t4D<O<O68<= 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_namesa  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_typeq  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|z         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 '%sri   rj   rk   rl   rm   )
r  deepcopyr   r   r   r   r   r   r   rk   )r[   rn   typesmarker_typeri   rk   rl   rm   s           r^   r   zChart._get_marker_properties  s[     v& % " 
$ jj("e#!&{!3v.<= ))&**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	|z         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 '%s'ri   rj   rk   rl   rm   label)r  rC  r   r   r   r   r   r   r   _get_trendline_label_propertiesrk   )	r[   ro   rD  
trend_typeri   rk   rl   rm   rP  s	            r^   r   zChart._get_trendline_properties  sf     MM),	 !) 
 ]]6*
 %j 1If.;< )))--*?@ 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   rk   rl   rm   )
r  rC  r   r   r   r   r   r   r   rk   )r[   rP  r   ri   rk   rl   rm   s          r^   rQ  z%Chart._get_trendline_label_properties4  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y ddddd}dddddd	}|d
   }||v r	||   |d
<   nt        d|z         y 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 '%srW  	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_propsa  sG    )1PVW
  &"*&
 V_
!&z!2Jv.;< 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      }|rE|| j                  v r(|| j                  k(  rd |d<   n"| j                  |   |d<   nt        d|z         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   z3Unsupported label position '%s' for this chart type	separatorz, z; z. 
r  ),;.rm  r  zUnsupported label separatorr   ri   rj   rk   rl   rm   ra  rW  r"  r   r0  r   r   )r  rC  r   rT   rU   r   r   r   r   r   r   r   rk   r#  r$  r(  r1  r2  r   )r[   r{   r   rl  
separatorsri   rk   rl   rm   rP  rW  r   r   s                r^   r   zChart._get_labels_properties  sN     v& ::j)4///t:::)-F:&)-)=)=h)GF:&JXUV 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   rk   rl   rm   r   F)r   r   r   r   r   r   rk   r   )r[   r\   areari   rk   rl   rm   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   rk   rl   rm   )	r   r   r   r   r   r   r   r   rk   )r[   r\   r&   ri   rk   rl   rm   r   s           r^   r   zChart._get_legend_propertiesD  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           	      t   i }|sy |rd}nd}|j                         D ]  }||vst        d|z          y  |D ][  }||j                         vrt        d|z          y ||   }	 t        |       |dk  s|d	kD  rt        d|d|d
        y d|z  ||<   ] |S # t        $ r t        d|d|d       Y  y w xY w)N)r9  y)r9  rx  r9   r:   z+Property '%s' allowed not in layout optionsz1Property '%s' must be specified in layout optionsz
Property 'z	' 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_propertiesx  s    #J6J 99; 	C*$BSHI	  	+D499;&H4OPJEe qyEAI6:EC  #U?F4L/	+2 !  LPRWX 	s   #BB76B7c                    g }|sy |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   rk   rl   rm   )r   r   r   r   r   r   rk   r   )	r[   user_pointsrs   
user_pointpointri   rk   rl   rm   s	            r^   r   zChart._get_points_properties  s   % "	!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}|s|s|s|syy)NFrl   rm   rk   definedTri   )r   )r[   elementhas_fillhas_linehas_patternhas_gradients         r^   _has_fill_formattingzChart._has_fill_formatting  so    kk),{{:.;;v76?9#=H;;v76?9#=H\r_   c           
      T    |sy ddddddddd	d
	}||v r||   }|S t        d|z         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 '%s'r   )r[   r   rD  s      r^   r	  zChart._get_display_units  s[     #$+!3") 1"$

 E!!-0M
  2]BCr_   c                 J    |sy ddddd}||v r||   }|S t        d|z         y )Noutinr   cross)outsideinsider   r  zUnknown tick_type  '%s'r   )r[   	tick_typerD  s      r^   r  zChart._get_tick_type  sL     	
 i(I
  *Y67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||fz  }d||dz   fz  }|d   r6| j                  j                  |       | j                  j                  |       |d   s7| j                  j                  |       | j                  j                  |       y y )Ni  r   z%04d%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
Hj11Hj1n55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_properties6  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_space]  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_langl  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_stylet  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   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:serrn   r|   rs   r{   ro   r~   rp   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_ser1  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_colorf  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   rx   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[   rp   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   rz   zc:catr(  r   r'  r   )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   ry   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 ]L  }| j                  d       t        |      D ]  \  }}| j                  |||           | j                  d       N | 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(1+./ 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[   rz  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_id7       cl^
Hj1r_   c                    |d   }|d   }|d   }|t        |      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	       | j1                  |j                  d             | j3                  d       | j5                  |j                  d             | j7                  |j                  d             | j9                  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  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
# 3x=))''	 ::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                  }|t        |      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             | j1                  |j                  d             | j3                  |j                  d      |j                  d             | j5                  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  r  _write_number_formatr/  r0  r1  r   r2  r3  r4  r5  _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(>(>?''	 3x= ::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                  }|t        |      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             | j1                  |j                  d             | j3                  |j                  d      |j                  d             | j5                  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  r  r?  r/  r0  r1  r   r2  r3  r4  r5  r@  rA  rB  rC  r   r;  s          r^   _write_cat_val_axiszChart._write_cat_val_axis	  s    hh
#
#=t'='=''	 3x= ::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                 ~   |d   }|d   }|d   }|t        |      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       | j1                  |j                  d             | j3                  |j                  d             | j5                  |j                  d             |j                  d      r| j7                  |d          | j9                  |j                  d             |j                  d      r| j;                  |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  r  r?  r/  r0  r1  r   r2  r3  r8   r4  r5  r6  r8  r9  r:  rA  _write_c_major_time_unitrB  _write_c_minor_time_unitr   )r[   rz  r0   r1   r"   r   s         r^   r  zChart._write_date_axist	  so   hh
# 3x=)) ::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^   rJ  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^   rK  zChart._write_orientation
  s*    Ccl^
OZ8r_   c                 8    |y d|fg}| j                  d|       y )Nr  zc:maxr  )r[   rO  r  s      r^   rL  zChart._write_c_max
  )     ?g&'
GZ0r_   c                 8    |y d|fg}| j                  d|       y )Nr  zc:minr  )r[   rN  r  s      r^   rM  zChart._write_c_min
  rV  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^   r?  zChart._write_number_format0
  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   r`  ra  default_formatr  s         r^   r.  zChart._write_cat_number_formatG
  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^  r_  r  )r[   r`  ra  r  s       r^   _write_data_label_number_formatz%Chart._write_data_label_number_formatb
  s2     ;']+


 	J
3r_   c                 8    |sy d|fg}| j                  d|       y )Nr  zc:majorTickMarkr  r  s      r^   r/  zChart._write_major_tick_markm
  &     cl^
-z:r_   c                 8    |sy d|fg}| j                  d|       y )Nr  zc:minorTickMarkr  r  s      r^   r0  zChart._write_minor_tick_markw
  rg  r_   c                 D    ||dk(  rd}d|fg}| j                  d|       y )Nnext_tonextTor  zc:tickLblPosr  r  s      r^   r1  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^   r3  zChart._write_cross_axis
       cl^
K4r_   c                 :    |d}d|fg}| j                  d|       y )NautoZeror  z	c:crossesr  r  s      r^   r4  zChart._write_crosses
  s'    ;Ccl^
K4r_   c                 2    d|fg}| j                  d|       y )Nr  zc:crossesAtr  r  s      r^   r5  zChart._write_c_crosses_at
       cl^
M:6r_   c                 2    d|fg}| j                  d|       y )Nr  zc:autor  r  s      r^   r6  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  rY  leftr   r  z	c:lblAlgnr  r  s      r^   r7  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^   r8  zChart._write_label_offset
  rq  r_   c                 8    |y d|fg}| j                  d|       y )Nr  zc:tickLblSkipr  r  s      r^   r9  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:minorGridlinesrz  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^   r@  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^   rA  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^   rB  zChart._write_c_minor_unit
  r  r_   c                 :    |d}d|fg}| j                  d|       y )Ndaysr  zc:majorTimeUnitr  r  s      r^   rG  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^   rH  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   rY  r   rZ  r   tr)ru  ru  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^  rq  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_entrye  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_overlayr  "    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_onlyz  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   rY  rZ  headerfooterzc:pageMarginsr  )r[   r  ru  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_formula;  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_richH  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 )Nr   r  r   z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_rprR  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_rpri  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_rq  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 )Nr   r  r  r   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[   rn   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:spPrrk   r  r   rl   rm   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[   rk   r  r  s       r^   r  zChart._write_a_solid_fill"  sS     	M*d?!$w-0E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_dashF  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[   ro   s     r^   r  zChart._write_trendlineM  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                 @    |dk  rd}d|fg}| j                  d|       y )Nr   r  r  r  r  s      r^   r  zChart._write_trendline_order  s)    7Ccl^
Iz2r_   c                 @    |dk  rd}d|fg}| j                  d|       y )Nr   r  zc:periodr  r  s      r^   r  zChart._write_period  s)    7C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  rQ  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   r2  r   )r[   ro   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   r_  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_code=  s     	~t4r_   c                 2    d|fg}| j                  d|       y )Nr  z	c:ptCountr  r  s      r^   r  zChart._write_pt_countB  rm  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_ptI  sC     =cl^
FJ/ 	e&!r_   c                 (    | j                  d|       y )Nzc:vr  r  s     r^   r  zChart._write_vX  s     	ud+r_   c                 @    | j                   sy | j                  d       y )Nzc:protection)r-   r  r   s    r^   r   zChart._write_protection]  s    N+r_   c                 P    d}|sy |D ]  }|dz  }|s| j                  ||        y )Nr   r   )_write_d_pt_point)r[   rs   r  r  s       r^   r  zChart._write_d_ptd  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_pointr  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_labelsre  r   r2  _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[   r{   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_formular/  r1  r2  r3  _write_custom_label_str_write_custom_label_format_onlyr   )r[   parentr{   r  rP  delete_labels         r^   r.  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^   r9  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   r?  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^   r0  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^   r1  zChart._write_show_val'  r  r_   c                 6    d}d|fg}| j                  d|       y )Nr   r  zc:showCatNamer  r  s      r^   r2  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^   r3  zChart._write_show_ser_name7  rE  r_   c                 6    d}d|fg}| j                  d|       y )Nr   r  zc:showPercentr  r  s      r^   r4  zChart._write_show_percent?  rE  r_   c                 (    | j                  d|       y )Nzc:separatorr  r  s     r^   r5  zChart._write_separatorG  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^   r6  zChart._write_show_leader_linesK  su     7M
 CL*%


 	J'GZ01J<@'"*%r_   c                 2    d|fg}| j                  d|       y )Nr  z	c:dLblPosr  r  s      r^   r/  zChart._write_d_lbl_pos_  rm  r_   c                 2    d|fg}| j                  d|       y )Nr  zc:deleter  r  s      r^   r*  zChart._write_deletef  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_negativem  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^   r2  zChart._write_axis_fontx  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^   rR  zChart._write_show_horz_border       \
.
;r_   c                 .    dg}| j                  d|       y )Nr  zc:showVertBorderr  r  s     r^   rS  zChart._write_show_vert_border  rW  r_   c                 .    dg}| j                  d|       y )Nr  zc:showOutliner  r  s     r^   rT  zChart._write_show_outline  s     \
OZ8r_   c                 .    dg}| j                  d|       y )Nr  z
c:showKeysr  r  s     r^   rU  zChart._write_show_keys  r  r_   c                 t    |sy |d   r| j                  d|d          |d   r| j                  d|d          y y )Nrr   r9  rq   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^   r_  zChart._write_err_dir  r  r_   c                 2    d|fg}| j                  d|       y )Nr  zc:errBarTyper  r  s      r^   r`  zChart._write_err_bar_type       cl^
NJ7r_   c                 2    d|fg}| j                  d|       y )Nr  zc:errValTyper  r  s      r^   ra  zChart._write_err_val_type  rg  r_   c                 .    dg}| j                  d|       y )Nr  z
c:noEndCapr  r  s     r^   rb  zChart._write_no_end_cap	  r  r_   c                 2    d|fg}| j                  d|       y )Nr  r  r  r  s      r^   rd  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^   rc  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^   rl  zChart._write_num_lit1  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_barsO  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^   rp  zChart._write_gap_widthc  s'     ;cl^
L*5r_   c                     |d   r<|d   d   r4| j                  d       | j                  |       | j                  d       y | j                  d       y )Nri   r  zc:upBarsrz  r[   
bar_formats     r^   rq  zChart._write_up_barsm  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:downBarsrz  rv  s     r^   rr  zChart._write_down_barsz  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^   rC  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[   rm   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        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   )r[   rm   r  r  r   r  r  r  s           r^   r  zChart._write_a_gs_lst  s    [)	(#I&s6{# 		&AilT)*C #,J
3 "&),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)rZ  r  )rY  r  )r   r  )r   100000)rZ  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  )rY  -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prstrl   z
a:pattFillfg_colorbg_color)r  _write_a_fg_clr_write_a_bg_clrr   )r[   rl   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  :     e$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  rE  r  r)  rJ  rK  rL  rM  r+  r?  r.  re  r/  r0  r1  r3  r4  r5  r6  r7  r8  r9  r:  r,  r-  r@  rA  rB  rG  rH  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  r.  r:  r9  r;  r0  r1  r2  r3  r4  r5  r6  r/  r*  r  r2  r  r  rR  rS  rT  rU  r  r\  r_  r`  ra  rb  rd  rc  rl  rs  rp  rq  rr  rC  r  r  r  r  r  r  r  r  r  __classcell__)r]   s   @r^   r   r      sH   H'TN#`!.F;;<!&"2
%
 3*05
n%
N%
N,BBH8"" < DBH=~+Z4l	xt&P2h,\+Z$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     s>    
     " & % ' / $LD%I LD%r_   