U
    td                     @   s(   d Z ddlmZ dZG dd deZdS )zIThis module provides implementation for a Cairo-specific histogram drawer    )AbstractCairoDrawer)CairoHistogramDrawerc                       s(   e Zd ZdZ fddZdd Z  ZS )r   z*Default Cairo drawer object for histogramsc                    s   t  j|dd dS )zConstructs the vertex drawer and associates it to the given
        palette.

        @param context: the context on which we will draw
        N)bbox)super__init__)selfcontext	__class__ W/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/igraph/drawing/cairo/histogram.pyr      s    zCairoHistogramDrawer.__init__c                 K   s   ddl m} | j}|dd }| _|dkr4td|d| j}d}|d| j}|dt	| j
}	| j}
|||||||	f}|d	 |d
dd | j}| j
D ]L}|||\}}||
7 }||d\}}||||| ||  |  q|  dS )TODOr   )DescartesCoordinateSystemr   Nz bbox is required for Cairo plotsminmaxZ	max_value   g      ?g        )Zigraph.drawing.cairo.coordr   r   popr   
ValueErrorget_min_maxr   Z_binsZ
_bin_widthZset_line_widthZset_source_rgbZlocal_to_contextZ	rectanglefilldraw)r   Z	histogramkwdsr   r   r   ZxminZyminZxmaxZymaxwidthZcoord_systemxvalueZ
top_left_xZ
top_left_yZbottom_right_xZbottom_right_yr   r   r   r      s<    



zCairoHistogramDrawer.draw)__name__
__module____qualname____doc__r   r   __classcell__r   r   r	   r   r      s   r   N)r    Zigraph.drawing.cairo.baser   __all__r   r   r   r   r   <module>   s   