B
    Y                 @   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	 ddl
mZ dd	lmZ dd
lmZmZmZ dddZG dd deZdS )a  This is the Bokeh charts interface. It gives you a high level API to build
complex plot is a simple way.

This is the Dot class which lets you build your Dot plots just passing
the arguments to the Chart class and calling the proper functions.
It also add a new chained stacked method.
    )absolute_import)BoolFloat)Range1d   )create_and_build   )
BarBuilder)DotGlyph)	ColorAttrCatAttr
MarkerAttrNsumcategoricallinearFTc             K   s   |rt |tstd|dk	rF|dkrFd|d< |dks>|dkrFd}|}|}||d< ||d	< ||d
< ||d< ||d< ||d< ||d< ||d< |	|d< |
|d< ||d< tt| f|S )a	   Create a Dot chart using
    :class:`DotBuilder <bkcharts.builders.dot_builder.DotBuilder>` to render the
    geometry from the inputs.

    Args:
        data (:ref:`userguide_charts_data_types`): the data
            source for the chart.
        label (list(str) or str, optional): list of string representing the categories.
            (Defaults to None)
        values (str, optional): iterable 2d representing the data series
            values matrix.
        color (str or list(str) or `~bkcharts._attributes.ColorAttr`): string color,
            string column name, list of string columns or a custom `ColorAttr`,
            which replaces the default `ColorAttr` for the builder.
        stack (list(str) or str, optional): columns to use for stacking.
            (Defaults to False, so grouping is assumed)
        group (list(str) or str, optional): columns to use for grouping.
        agg (str): how to aggregate the `values`. (Defaults to 'sum', or only label is
            provided, then performs a `count`)
        continuous_range(Range1d, optional): Custom continuous_range to be
            used. (Defaults to None)

    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 dots

    Examples:

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

            from bkcharts import Dot, output_file, show
            from bokeh.layouts import row

            # best support is with data in a format that is table-like
            data = {
                'sample': ['1st', '2nd', '1st', '2nd', '1st', '2nd'],
                'interpreter': ['python', 'python', 'pypy', 'pypy', 'jython', 'jython'],
                'timing': [-2, 5, 12, 40, 22, 30]
            }

            # x-axis labels pulled from the interpreter column, stacking labels from sample column
            dot = Dot(data, values='timing', label='interpreter', stack='sample', agg='mean',
                      title="Python Interpreter Sampling", legend='top_right', plot_width=400)

            # table-like data results in reconfiguration of the chart with no data manipulation
            dot2 = Dot(data, values='timing', label=['interpreter', 'sample'],
                       agg='mean', title="Python Interpreters", plot_width=400)

            output_file("Dot.html")
            show(row(dot, dot2))

    zCcontinuous_range must be an instance of bokeh.models.ranges.Range1dNTZ
label_onlyr   Zmeancountlabelvaluescolorstackgroupaggxscaleyscalexgridygridy_range)
isinstancer   
ValueErrorr   
DotBuilder)datar   r   r   r   r   r   r   r   r   r   Zcontinuous_rangekwr    r"   <lib/python3.7/site-packages/bkcharts/builders/dot_builder.pyDot#   s*    :r$   c               @   sH   e Zd ZdZeddZe e e e e e dZ	e
dddZeZdS )	r   zProduces Dot Glyphs for groups of data.

    Handles dot plot options to produce one to many dots,
    which are used to describe the values of aggregated groups of data.

    g      ?)default)r   r   Z
line_colorr   r   ZmarkerFz:
    Whether to draw a stem from each do to the axis.
    )helpN)__name__
__module____qualname____doc__r   Z
line_alphar   r   r   Zdefault_attributesr   Zstemr
   Zglyphr"   r"   r"   r#   r   y   s   

r   )NNNNNr   r   r   FTN)r*   Z
__future__r   Zbokeh.core.propertiesr   r   Zbokeh.modelsr   Zbuilderr   Zbar_builderr	   Zglyphsr
   Z
attributesr   r   r   r$   r   r"   r"   r"   r#   <module>   s     
T