Ë
    Ìim  ã                   óˆ   — d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
mZmZ d dlmZ d dlmZ d dlmZmZ  G d	„ d
«      Zy)é    )ÚAxis)ÚChart)ÚDateÚDateTime)ÚGrid)ÚLinearÚScaleÚTemporal)ÚSeries)ÚLine)ÚXÚYc                   ód   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
dd
„Zdd„Zdd„Zdd„Zdd„Zy)ÚLatticea  
    A grid of charts with synchronized shapes, scales, and axes.

    Lattice only supports graphing a single series of data.

    :param shape:
        An instance of :class:`.Shape` to use to render all series. Defaults
        to :class:`.Line` if not specified.
    Nc                 ón   — |xs
 t        «       | _        g | _        d d g| _        d d g| _        d d g| _        y ©N)r   Ú_shapeÚ_seriesÚ_typesÚ_scalesÚ_axes)ÚselfÚshapes     úP/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/leather/lattice.pyÚ__init__zLattice.__init__   s7   € Ø’oœt›vˆŒØˆŒØ˜T�lˆŒØ˜d�|ˆŒØ˜D�\ˆ�
ó    c                 ó*   — || j                   t        <   y)z=
        Set the X :class:`.Scale` for this lattice.
        N)r   r   ©r   Úscales     r   Úset_x_scalezLattice.set_x_scale   ó   € ð  ˆ�‰”QŠr   c                 ó*   — || j                   t        <   y)z3
        See :meth:`.Lattice.set_x_scale`.
        N)r   r   r   s     r   Úset_y_scalezLattice.set_y_scale"   r!   r   c                 ó´   — t         }t        |t        j                  «      st        |t        j                  «      rt
        }| j                   |||«      «       y)aI  
        Create and add a :class:`.Scale`.

        If the provided domain values are :class:`date` or :class:`datetime`
        then a :class:`.Temporal` scale will be created, otherwise it will
        :class:`.Linear`.

        If you want to set a custom scale class use :meth:`.Lattice.set_x_scale`
        instead.
        N)r   Ú
isinstancer   Útypesr   r
   r    ©r   Ú
domain_minÚ
domain_maxÚ
scale_types       r   Úadd_x_scalezLattice.add_x_scale(   s>   € ô ˆ
ä�j¤$§*¡*Ô-´¸JÌÏÉÔ1WÜ!ˆJà×Ñ™ J°
Ó;Õ<r   c                 ó´   — t         }t        |t        j                  «      st        |t        j                  «      rt
        }| j                   |||«      «       y)z3
        See :meth:`.Lattice.add_x_scale`.
        N)r   r%   r   r&   r   r
   r#   r'   s       r   Úadd_y_scalezLattice.add_y_scale:   s>   € ô ˆ
ä�j¤$§*¡*Ô-´¸JÌÏÉÔ1WÜ!ˆJà×Ñ™ J°
Ó;Õ<r   c                 ó*   — || j                   t        <   y)z?
        Set an :class:`.Axis` class for this lattice.
        N)r   r   ©r   Úaxiss     r   Ú
set_x_axiszLattice.set_x_axisE   ó   € ð ˆ�
‰
”1Šr   c                 ó*   — || j                   t        <   y)z2
        See :meth:`.Lattice.set_x_axis`.
        N)r   r   r/   s     r   Ú
set_y_axiszLattice.set_y_axisK   r2   r   c                 óB   — t        |||¬«      | j                  t        <   y)z–
        Create and add an X :class:`.Axis`.

        If you want to set a custom axis class use :meth:`.Lattice.set_x_axis`
        instead.
        ©ÚticksÚtick_formatterÚnameN)r   r   r   ©r   r7   r8   r9   s       r   Ú
add_x_axiszLattice.add_x_axisQ   s   € ô  5¸ÈdÔSˆ�
‰
”1Šr   c                 óB   — t        |||¬«      | j                  t        <   y)z2
        See :meth:`.Lattice.add_x_axis`.
        r6   N)r   r   r   r:   s       r   Ú
add_y_axiszLattice.add_y_axisZ   s   € ô  5¸ÈdÔSˆ�
‰
”1Šr   c                 óZ  — t        ||||¬«      }t        t        fD ]W  }| j                  |   r*|j                  |   | j                  |   usŒ1t	        d«      ‚|j                  |   | j                  |<   ŒY | j
                  j                  |«       | j                  j                  |«       y)ap  
        Add a data series to this lattice.

        :param data:
            A sequence of data suitable for constructing a :class:`.Series`,
            or a sequence of such objects.
        :param x:
            See :class:`.Series`.
        :param y:
            See :class:`.Series`.
        :param title:
            A title to render above this chart.
        )ÚxÚyr9   z.All data series must have the same data types.N)	r   r   r   r   Ú	TypeErrorr   Úvalidate_seriesr   Úappend)r   Údatar?   r@   ÚtitleÚseriesÚ	dimensions          r   Úadd_onezLattice.add_one`   s˜   € ô ˜  Q¨UÔ3ˆäœQ˜ò 	BˆIØ�{‰{˜9Ò%Ø—=‘= Ñ+°4·;±;¸yÑ3IÒIÜ#Ð$TÓUÐUà)/¯©°yÑ)A�—‘˜IÒ&ð	Bð 	�‰×#Ñ# FÔ+Ø�‰×Ñ˜FÕ#r   c                 óf   — t        |«      D ]#  \  }}|r||   nd}| j                  ||||¬«       Œ% y)a.  
        Same as :meth:`.Lattice.add_one` except :code:`data` is a list of data
        series to be added simultaneously.

        See :meth:`.Lattice.add_one` for other arguments.

        Note that :code:`titles` is a sequence of titles that must be the same
        length as :code:`data`.
        N)r?   r@   rE   )Ú	enumeraterH   )r   rD   r?   r@   ÚtitlesÚiÚdrE   s           r   Úadd_manyzLattice.add_manyz   s<   € ô ˜d“Oò 	3‰DˆAˆqÙ!'�F˜1’I¨TˆEà�L‰L˜˜a 1¨EˆLÕ2ñ	3r   c                 óX  — | j                   D �cg c]  }|| j                  f‘Œ }}| j                  t           s=t	        j
                  |t        | j                  t           «      | j                  t        <   | j                  t           s=t	        j
                  |t        | j                  t           «      | j                  t        <   | j                  t           st        «       | j                  t        <   | j                  t           st        «       | j                  t        <   t        «       }t        | j                   «      D ]Ð  \  }}t        |j                  ¬«      }	|	j                  | j                  t           «       |	j                  | j                  t           «       |	j!                  | j                  t           «       |	j#                  | j                  t           «       |	j%                  || j                  «       |j'                  |	«       ŒÒ |j)                  |||«      S c c}w )zi
        Render the lattice to an SVG.

        See :class:`.Grid` for additional documentation.
        )rE   )r   r   r   r   r	   Úinferr   r   r   r   r   rJ   r   r9   r    r#   r1   r4   Ú
add_seriesrH   Úto_svg)
r   ÚpathÚwidthÚheightÚsÚlayersÚgridrL   rF   Úcharts
             r   rR   zLattice.to_svg‰   su  € ð -1¯L©LÖ9 q�1�d—k‘kÒ"Ð9ˆÐ9à�|‰|œAŠÜ#Ÿk™k¨&´!°T·[±[Ä±^ÓDˆD�L‰Lœ‰Oà�|‰|œAŠÜ#Ÿk™k¨&´!°T·[±[Ä±^ÓDˆD�L‰Lœ‰Oà�z‰zœ!Š}Ü ›FˆD�J‰J”q‰Mà�z‰zœ!Š}Ü ›FˆD�J‰J”q‰Mä‹vˆä" 4§<¡<Ó0ò 	 ‰IˆAˆvÜ §¡Ô,ˆEØ×Ñ˜dŸl™l¬1™oÔ.Ø×Ñ˜dŸl™l¬1™oÔ.Ø×Ñ˜TŸZ™Z¬™]Ô+Ø×Ñ˜TŸZ™Z¬™]Ô+Ø×Ñ˜V T§[¡[Ô1à�L‰L˜Õð	 ð �{‰{˜4 ¨Ó/Ð/ùò5 :s   �H'r   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r#   r+   r-   r1   r4   r;   r=   rH   rN   rR   © r   r   r   r      sE   „ ñó"ò ò ò=ò$	=òòóTóTó$ó43ô 0r   r   N)Úleather.axisr   Úleather.chartr   Úleather.data_typesr   r   Úleather.gridr   Úleather.scalesr   r	   r
   Úleather.seriesr   Úleather.shapesr   Úleather.utilsr   r   r   r^   r   r   ú<module>rg      s,   ðÝ Ý ß -Ý ß 2Ñ 2Ý !Ý ß ÷^0ò ^0r   