ó
ÎYc           @@  sŽ   d  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
 d d l m Z d
 d
 d
 d „ Z d e f d	 „  ƒ  YZ d
 S(   sý   This is the Bokeh charts interface. It gives you a high level API
to build complex plot is a simple way.

This is the Scatter class which lets you build your Scatter charts
just passing the arguments to the Chart class and calling the proper
functions.
i    (   t   absolute_import(   t   create_and_buildt	   XYBuilder(   t
   PointGlyph(   t
   MarkerAttrt	   ColorAttr(   t   add_tooltips_columnsc         K@  s$   | | d <| | d <t  t |  |  S(   s,   Create a scatter chart using :class:`ScatterBuilder <bkcharts.builders.scatter_builder.ScatterBuilder>`
    to render the geometry from values.

    Args:
        data (:ref:`userguide_charts_data_types`): table-like data
        x (str or list(str), optional): the column label to use for the x dimension
        y (str or list(str), optional): the column label to use for the y dimension

    In addition to the parameters specific to this chart,
    :ref:`userguide_charts_defaults` are also accepted as keyword parameters.

    Returns:
        :class:`Chart`: includes glyph renderers that generate the scatter points

    Examples:

    .. bokeh-plot::
        :source-position: above

        from bokeh.sampledata.autompg import autompg as df
        from bkcharts import Scatter, output_file, show

        scatter = Scatter(df, x='mpg', y='hp', color='cyl', marker='origin',
                          title="Auto MPG", xlabel="Miles Per Gallon",
                          ylabel="Horsepower")

        output_file('scatter.html')
        show(scatter)

    t   xt   y(   R   t   ScatterBuilder(   t   dataR   R   t   kws(    (    s@   lib/python2.7/site-packages/bkcharts/builders/scatter_builder.pyt   Scatter    s    

R	   c           B@  s1   e  Z d  Z i e ƒ  d 6e ƒ  d 6Z d „  Z RS(   sƒ  This is the Scatter class and it is in charge of plotting
    Scatter charts in an easy and intuitive way.

    Essentially, we provide a way to ingest the data, make the proper
    calculations and push the references into a source object.
    We additionally make calculations for the ranges. And finally add
    the needed glyphs (markers) taking the references from the source.

    t   colort   markerc         c@  sÈ   xÁ |  j  j |  j   D]ª } t d | j d | j |  j j ƒ d | j |  j j ƒ d | d d | d d | d ƒ } |  j	 | | ƒ x7 | j
 D], } |  j r· t | |  j | ƒ } n  | Vq Wq Wd S(	   s   Use the marker glyphs to display the points.

        Takes reference points from data loaded at the ColumnDataSource.
        t   labelR   R   t
   line_colorR   t
   fill_colorR   N(   t   _datat   groupbyt
   attributesR   R   t
   get_valuesR   t	   selectionR   t	   add_glypht	   rendererst   tooltipsR   (   t   selft   groupt   glypht   renderer(    (    s@   lib/python2.7/site-packages/bkcharts/builders/scatter_builder.pyt   yield_renderersR   s    

	(   t   __name__t
   __module__t   __doc__R   R   t   default_attributesR   (    (    (    s@   lib/python2.7/site-packages/bkcharts/builders/scatter_builder.pyR	   D   s   	N(   R!   t
   __future__R    t   bkcharts.builderR   R   t   bkcharts.glyphsR   t   bkcharts.attributesR   R   t   bkcharts.utilsR   t   NoneR   R	   (    (    (    s@   lib/python2.7/site-packages/bkcharts/builders/scatter_builder.pyt   <module>   s   $