
    e,                         d dl mZ d dlZd dl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mZ  G d d	e          Z G d
 de          Z G d de          ZdS )    )dequeN)
DynamicMap)CurvePath3D	Scatter3D)PointerX   )TestPlotlyPlotplotly_rendererc                       e 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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d ZdS )TestElementPlotc                    t          d          fd}t          d          }t          |g |g          }t          j        |          }t          |           t          d          D ]}|                    |           |j        }|                     |d         d         d	         t          j
        d                     |                     |d         d         d
         t          j
        dd                     d S )N
   )maxlenc                 f                         |            t          t                              S )N)appendr   list)xhistorys    Plib/python3.11/site-packages/holoviews/tests/plotting/plotly/test_elementplot.pyhistory_callbackzJTestElementPlot.test_stream_callback_single_call.<locals>.history_callback   s)    NN1g'''    r   )r   )kdimsstreams   datar   y)r   r   r   r   get_plotrangeeventstateassertEqualnparange)selfr   streamdmapplotir!   r   s          @r    test_stream_callback_single_callz0TestElementPlot.test_stream_callback_single_call   s   r"""	( 	( 	( 	( 	( A*"vhGGG'--r 	 	ALL1L
vq)#.	">>>vq)#.	"b0A0ABBBBBr   c                     d }t          t          d          d                              |g          }t          j        |          }|                     |j        d         d         d           d S )	Nc                 &    d| j         d         d<   d S )NCalledlayouttitle)r!   )r(   elements     r   hookz0TestElementPlot.test_element_hooks.<locals>.hook   s    ,4DJx )))r   r   z
Not Called)label)hooksr.   r/   r-   )r   r   optsr   r   r"   r!   )r%   r1   curver(   s       r   test_element_hooksz"TestElementPlot.test_element_hooks   st    	5 	5 	5eBii|444999GG'..H-g6AAAAAr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d         d           d S N)r   r	   )d      )     zX-Axis)xlabelr.   xaxisr/   textr   r4   _get_plot_stater"   r%   r5   r!   s      r   test_element_plot_xlabelz(TestElementPlot.test_element_plot_xlabel'   i    44455::(:KK$$U++x1':6BHMMMMMr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d         d           d S Nr9   zY-Axis)ylabelr.   yaxisr/   r@   rA   rC   s      r   test_element_plot_ylabelz(TestElementPlot.test_element_plot_ylabel,   rE   r   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d         d         d           d S 	N)r   r	   r;   )r:   r;   r=   )r<   r=      zZ-Axis)zlabelr.   scenezaxisr/   r@   r   r4   rB   r"   r%   scatterr!   s      r   test_element_plot_zlabelz(TestElementPlot.test_element_plot_zlabel1   so    CCCDDIIQYIZZ$$W--x1':7CFKXVVVVVr   c                     t          g d          }|                     |          }|                     |d         d         d         ddg           d S )Nr9   r.   r?   r   r   r<   r   rB   r"   rC   s      r   test_element_plot_xrangez(TestElementPlot.test_element_plot_xrange8   sW    44455$$U++x1':RJGGGGGr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         ddg           d S )	Nr	   r	   )r;   r   )r=   r:   )r     )xlimr.   r?   r   r   r\   rA   rC   s      r   test_element_plot_xlimz&TestElementPlot.test_element_plot_xlim=   sh    1112277Y7GG$$U++x1':QIFFFFFr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         ddg           d S )	NrZ   T)invert_xaxisr.   r?   r   r=   r	   rA   rC   s      r   test_element_plot_invert_xaxisz.TestElementPlot.test_element_plot_invert_xaxisB   sh    1112277T7JJ$$U++x1':QFCCCCCr   c                     t          g d          }|                     |          }|                     |d         d         d         ddg           d S )Nr9   r.   rI   r   r	   r=   rW   rC   s      r   test_element_plot_yrangez(TestElementPlot.test_element_plot_yrangeG   sW    44455$$U++x1':QFCCCCCr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         ddg           d S )	NrZ   )r      )ylimr.   rI   r   r   re   rA   rC   s      r   test_element_plot_ylimz&TestElementPlot.test_element_plot_ylimL   sh    1112277V7DD$$U++x1':QFCCCCCr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         ddg           d S )	NrZ   T)invert_yaxisr.   rI   r   r:   r	   rA   rC   s      r   test_element_plot_invert_yaxisz.TestElementPlot.test_element_plot_invert_yaxisQ   sh    1112277T7JJ$$U++x1':S!HEEEEEr   c                     t          g d          }|                     |          }|                     |d         d         d         d         ddg           d S )NrM   r.   rP   rQ   r   r;   rN   )r   rB   r"   rS   s      r   test_element_plot_zrangez(TestElementPlot.test_element_plot_zrangeV   s\    CCCDD$$W--x1':7CaVLLLLLr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d         dd	g           d S )
NrM   )r	      )zlimr.   rP   rQ   r   r	   rn   rR   rS   s      r   test_element_plot_zlimz&TestElementPlot.test_element_plot_zlim[   sm    CCCDDIIvIVV$$W--x1':7CaVLLLLLr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d         dd	g           d S )
NrM   T)invert_zaxisr.   rP   rQ   r   rN   r;   rR   rS   s      r   test_element_plot_invert_zaxisz.TestElementPlot.test_element_plot_invert_zaxis`   sn    CCCDDIIW[I\\$$W--x1':7CaVLLLLLr   c                 "   t          g d                              d          }|                     |          }|                     |d         d         d         ddg           |                     |d         d	         d         d
dg           d S )N)r   r	   )r	   r;   )r;   r=   )皙?r   paddingr.   r?   r   皙ɿ皙@rI   r	   r=   rA   rC   s      r   test_element_plot_xpaddingz*TestElementPlot.test_element_plot_xpaddinge   s    ...//44X4FF$$U++x1':T3KHHHx1':QFCCCCCr   c                 "   t          g d                              d          }|                     |          }|                     |d         d         d         ddg           |                     |d         d	         d         d
dg           d S )Nru   )r   rv   rw   r.   r?   r   r   r;   rI   皙?皙	@rA   rC   s      r   test_element_plot_ypaddingz*TestElementPlot.test_element_plot_ypaddingk   s    ...//44X4FF$$U++x1':QFCCCx1':S#JGGGGGr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d         dd	g           d S )
NrM   )r   r   rv   rw   r.   rP   rQ   r   333333?333333@rR   rS   s      r   test_element_plot_zpaddingz*TestElementPlot.test_element_plot_zpaddingq   sn    CCCDDIIR]I^^$$W--x1':7Cc3ZPPPPPr   c                 "   t          g d                              d          }|                     |          }|                     |d         d         d         ddg           |                     |d         d	         d         d
dg           d S )Nru   rv   rw   r.   r?   r   ry   rz   rI   r}   r~   rA   rC   s      r   test_element_plot_paddingz)TestElementPlot.test_element_plot_paddingv   s    ...//44S4AA$$U++x1':T3KHHHx1':S#JGGGGGr   c                    t          g d                              d          }|                     |          }|                     |d         d         d         d         dd	g           |                     |d         d         d
         d         ddg           |                     |d         d         d         d         ddg           d S )N))r   r	   r;   r	   r;   r=   )r;   r=   rN   rv   rw   r.   rP   r?   r   ry   rz   rI   r}   r~   rQ   r   r   rR   rS   s      r   test_element_plot3d_paddingz+TestElementPlot.test_element_plot3d_padding|   s    ===>>CCCCPP$$W--x1':7CdC[QQQx1':7Cc3ZPPPx1':7Cc3ZPPPPPr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d           d S Nr9   T)logxr.   r?   typelogrA   rC   s      r   test_element_plot_logxz&TestElementPlot.test_element_plot_logx   sd    44455:::EE$$U++x1&95AAAAAr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d           d S NrZ   T)logyr.   rI   r   r   rA   rC   s      r   test_element_plot_logyz&TestElementPlot.test_element_plot_logy   sd    1112277T7BB$$U++x1&95AAAAAr   c                     t          g d                              d          }|                     |          }|                     |d         d         d         d         d           d S 	N)r   r	   r   )r	   r;   r:   )r;   r=   r<   T)logzr.   rP   rQ   r   r   rR   rS   s      r   test_element_plot_logzz&TestElementPlot.test_element_plot_logz   si    CCCDDIItITT$$W--x1':6BEJJJJJr   c                     t          g d                              g d          }|                     |          }|                     |d         d         d         g d           d S )Nr[   )rN   r;   )r   r=   r	   rN   r   xticksr.   r?   tickvalsrA   rC   s      r   test_element_plot_xticks_valuesz/TestElementPlot.test_element_plot_xticks_values   sl    ///0055ZZZ5HH$$U++x1*=zzzJJJJJr   c                     t          g d                              g d          }|                     |          }|                     |d         d         d         g d           d S )Nr   r	         ?      @r=   yticksr.   rI   r   rA   rC   s      r   test_element_plot_yticks_valuesz/TestElementPlot.test_element_plot_yticks_values   sr    ///0055=M=M=M5NN$$U++x1*=?O?O?OPPPPPr   c                     t          g d                              g d          }|                     |          }|                     |d         d         d         d         g d           d S )Nr   r     r<   zticksr.   rP   rQ   r   rR   rS   s      r   test_element_plot_zticks_valuesz/TestElementPlot.test_element_plot_zticks_values   st    CCCDDIIQ_Q_Q_I``$$W--x1'::FWWWWWr   c                 &   t          g d                              g d          }|                     |          }|                     |d         d         d         g d           |                     |d         d         d         g d	           d S )
Nr   )r	   A)rN   B)r   Cr   r.   r?   r   r   ticktextr   r   r   rA   rC   s      r   test_element_plot_xticks_itemsz.TestElementPlot.test_element_plot_xticks_items   s    ///0055=\=\=\5]]$$U++x1*=zzzJJJx1*=OOOOOr   c                 &   t          g d                              g d          }|                     |          }|                     |d         d         d         g d           |                     |d         d         d         g d	           d S )
Nr   )r   )r   r   )r   r   )r=   Dr   r.   rI   r   r   r   )r   r   r   r   rA   rC   s      r   test_element_plot_yticks_itemsz.TestElementPlot.test_element_plot_yticks_items   s    ///0055??? 6 A A$$U++x1*=?O?O?OPPPx1*=?S?S?STTTTTr   c                 >   t          g d                              g d          }|                     |          }|                     |d         d         d         d         g d           |                     |d         d         d         d	         g d
           d S )Nr   ))r   r   )r   r   )r<   r   r   r.   rP   rQ   r   r   r   r   rR   rS   s      r   test_element_plot_zticks_itemsz.TestElementPlot.test_element_plot_zticks_items   s    CCCDDII666 J 8 8$$W--x1'::FWWWx1'::FXXXXXr   N)__name__
__module____qualname__r*   r6   rD   rJ   rU   rX   r^   ra   rc   rg   rj   rl   rp   rs   r{   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r   r   r      s       C C CB B BN N N
N N N
W W WH H H
G G G
D D D
D D D
D D D
F F F
M M M
M M M
M M M
D D DH H HQ Q Q
H H HQ Q QB B B
B B B
K K KK K K
Q Q Q
X X X
P P PU U UY Y Y Y Yr   r   c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	TestOverlayPlotc                    t          g d          t          g d          z  }|                     |          }|                     |d         d         d         t          j        g d                     |                     |d         d         d         t          j        g d                     |                     |d         d         d	         dd
g           d S )Nr   )r;      rn   r   r   r   r	   r.   rI   r   rn   )r   rB   r"   r#   array)r%   r.   r!   s      r   test_overlay_statez"TestOverlayPlot.test_overlay_state   s    yyy!!E)))$4$44$$V,,vq)#.0C0CDDDvq)#.0C0CDDDx1':QFCCCCCr   c                     t          g d          t          g           z                      d          }|                     |          }|                     |d         d         d         d           d S r   rA   rC   s      r   test_overlay_plot_logxz&TestOverlayPlot.test_overlay_plot_logx   so    55566rBHHdHSS$$U++x1&95AAAAAr   c                     t          g d          t          g           z                      d          }|                     |          }|                     |d         d         d         d           d S r   rA   rC   s      r   test_overlay_plot_logyz&TestOverlayPlot.test_overlay_plot_logy   so    22233eBii?EE4EPP$$U++x1&95AAAAAr   c                     t          g d          t          g           z                      d          }|                     |          }|                     |d         d         d         d         d           d S r   )r   r   r4   rB   r"   rS   s      r   test_overlay_plot_logzz&TestOverlayPlot.test_overlay_plot_logz   su    DDDEEr

RXX^bXcc$$W--x1':6BEJJJJJr   c                     t          g           t          g d                              d          z  }|                     |          }|                     |d         d         d         d         d           d S r8   rA   r%   overlayr!   s      r   test_overlay_plot_xlabelz(TestOverlayPlot.test_overlay_plot_xlabel   u    ))e$B$B$BCCHHPXHYYY$$W--x1':6BHMMMMMr   c                     t          g           t          g d                              d          z  }|                     |          }|                     |d         d         d         d         d           d S rG   rA   r   s      r   test_overlay_plot_ylabelz(TestOverlayPlot.test_overlay_plot_ylabel   r   r   c                    t          g           t          g d                              d          z  }|                     |          }|                     |d         d         d         d         d         d           d S rL   )r   r   r4   rB   r"   rS   s      r   test_overlay_plot_zlabelz(TestOverlayPlot.test_overlay_plot_zlabel   sz    **y)P)P)PQQVV^fVggg$$W--x1':7CFKXVVVVVr   N)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s        D D DB B B
B B B
K K KN N N
N N N
W W W W Wr   r   c                        e Zd Zd Zd Zd ZdS )TestColorbarPlotc                     t          j        t          j                            d          t	          d                    }t          |          }|                     |          }d|d         d         d         vsJ d S )	Nr   r   XYZTcolumnsr   colorbarr   r   marker)pd	DataFramer#   randomr   r   rB   r%   dfrT   r!   s       r   	test_basezTestColorbarPlot.test_base   st    \")**733T&\\JJJ$$$$$W--vq!1(!;;;;;;;r   c                    t          j        t          j                            d          t	          d                    }t          |                              dd          }|                     |          }d|d	         d
         d         v sJ |d	         d
         d         d         d         d         dk    sJ d S )Nr   r   r   r   TT)colorr   r   r   r   r   r/   r@   r   r   r#   r   r   r   r4   rB   r   s       r   test_colorbarzTestColorbarPlot.test_colorbar   s    \")**733T&\\JJJ$$$))d)CC$$W--U6]1-h77777V}Q)*5g>vF#MMMMMMr   c                    t          j        t          j                            d          t	          d                    }t          |                              ddddi	          }|                     |          }d
|d         d         d         v sJ |d         d         d         d
         d         d         dk    sJ d S )Nr   r   r   r   r   Tr/   z
some-title)r   r   colorbar_optsr   r   r   r   r@   r   r   s       r   test_colorbar_opts_titlez)TestColorbarPlot.test_colorbar_opts_title   s    \")**733T&\\JJJ$$$))"L1 * 
 

 $$W--U6]1-h77777V}Q)*5g>vF,VVVVVVr   N)r   r   r   r   r   r   r   r   r   r   r      sI        < < <N N N	W 	W 	W 	W 	Wr   r   )collectionsr   numpyr#   pandasr   holoviews.core.spacesr   holoviews.elementr   r   r   holoviews.streamsr   	test_plotr
   r   r   r   r   r   r   r   <module>r      s5                 , , , , , , 6 6 6 6 6 6 6 6 6 6 & & & & & & 6 6 6 6 6 6 6 6jY jY jY jY jYn jY jY jYZ)W )W )W )W )Wn )W )W )WVW W W W W~ W W W W Wr   