dtale.dash_application package

Submodules

dtale.dash_application.charts module

dtale.dash_application.charts.bar_builder(data, x, y, axes_builder, wrapper, cpg=False, barmode='group', barsort=None, **kwargs)[source]

Builder function for plotly.graph_objs.Surface

Parameters:
  • data (dict) – raw data to be represented within surface chart
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • axes_builder (func) – function for building axis configurations
  • wrapper (func) – wrapper function returned by dtale.charts.utils.chart_wrapper()
  • group (list of str or str) – column(s) to use for grouping
  • agg (str) – points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy. Possible values are: count, first, last mean, median, min, max, std, var, mad, prod, sum
Returns:

surface chart

Return type:

plotly.graph_objs.Surface

dtale.dash_application.charts.bar_code_builder(data, x, y, axes_builder, cpg=False, barmode='group', barsort=None, **kwargs)[source]
dtale.dash_application.charts.build_axes(data_id, x, axis_inputs, mins, maxs, z=None, agg=None, data=None)[source]

Returns helper function for building axis configurations against a specific y-axis.

Parameters:
  • data_id (str) – identifier of data to build axis configurations against
  • x (str) – column to be used as x-axis of chart
  • axis_inputs (dict) – current settings for y-axis limits
  • mins (dict) – minimums for all columns involved in chart
  • maxs – maximums for all columns invloved in chart
  • maxs – dict
  • z (str, optional) – column to use for the Z-Axis
  • agg (str, optional) – specific aggregation that can be applied to y or z axes. Possible values are: count, first, last mean, median, min, max, std, var, mad, prod, sum. This is included in label of axis it is being applied to.
Returns:

handler function to be applied against each y-axis used in chart

Return type:

func

dtale.dash_application.charts.build_chart(data_id=None, data=None, **inputs)[source]
Factory method that forks off into the different chart building methods (heatmaps are handled separately)
  • line
  • bar
  • scatter
  • pie
  • wordcloud
  • 3D scatter
  • surface
  • maps (choropleth, scattergeo, mapbox)
  • candlestick
  • treemap
Parameters:
  • data_id (str) – identifier of data to build axis configurations against
  • inputs – Optional keyword arguments containing the following information: - x: column to be used as x-axis of chart - y: column to be used as y-axis of chart - z: column to use for the Z-Axis - agg: points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy
Returns:

plotly chart object(s)

Return type:

type of (dash_core_components.Graph, dict)

dtale.dash_application.charts.build_choropleth(inputs, raw_data, layout)[source]
dtale.dash_application.charts.build_colorscale(colorscale)[source]
dtale.dash_application.charts.build_figure_data(data_id, chart_type=None, query=None, x=None, y=None, z=None, group=None, group_val=None, agg=None, window=None, rolling_comp=None, animate_by=None, data=None, **kwargs)[source]

Builds chart figure data for loading into dash:dash_core_components.Graph <dash-core-components/graph> components

Parameters:
  • data_id (str) – integer string identifier for a D-Tale process’s data
  • chart_type (str) – type of chart (line, bar, pie, scatter…)
  • query (str, optional) – pandas dataframe query string
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • z (str, optional) – column to use for the Z-Axis
  • group (list of str or str, optional) – column(s) to use for grouping
  • agg (str, optional) – specific aggregation that can be applied to y or z axes. Possible values are: count, first, last mean, median, min, max, std, var, mad, prod, sum. This is included in label of axis it is being applied to.
  • window (int, optional) – number of days to include in rolling aggregations
  • rolling_comp (str, optional) – computation to use in rolling aggregations
  • kwargs (dict) – optional keyword arguments, here in case invalid arguments are passed to this function
Returns:

dictionary of series data, min/max ranges of columns used in chart

Return type:

dict

dtale.dash_application.charts.build_frames(data, frame_builder)[source]
dtale.dash_application.charts.build_grouped_bars_with_multi_yaxis(series_cfgs, y)[source]

This generator is a hack for the lack of support plotly has for sorting plotly.graph_objs.Bar charts by an axis other than ‘y’. This also helps with issues around displaying multiple y-axis.

Parameters:
  • series_cfgs (list of dict) – configurations for all the series within a bar chart
  • y (list of str) – columns to use for the Y-Axes
Returns:

updated series configurations

Type:

generator

dtale.dash_application.charts.build_layout(cfg)[source]

Wrapper function for plotly.graph_objs.Layout

Parameters:cfg (dict) – layout configuration
Returns:layout object
Return type:plotly.graph_objs.Layout
dtale.dash_application.charts.build_line_cfg(series)[source]
dtale.dash_application.charts.build_map_frames(data, animate_by, frame_builder)[source]
dtale.dash_application.charts.build_mapbox(inputs, raw_data, layout)[source]
dtale.dash_application.charts.build_raw_chart(data_id=None, **inputs)[source]
Factory method that forks off into the different chart building methods
  • heatmap
  • line
  • bar
  • scatter
  • pie
  • 3D scatter
  • surface
Parameters:
  • data_id (str) – identifier of data to build axis configurations against
  • inputs – Optional keyword arguments containing the following information: - x: column to be used as x-axis of chart - y: column to be used as y-axis of chart - z: column to use for the Z-Axis - agg: points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy
Returns:

plotly chart object(s)

Return type:

type of (dash_core_components.Graph, dict)

dtale.dash_application.charts.build_raw_figure_data(data_id, chart_type=None, query=None, x=None, y=None, z=None, group=None, agg=None, window=None, rolling_comp=None, **kwargs)[source]

Returns a pandas.DataFrame of data used within chart configuration

Parameters:
  • data_id (str) – integer string identifier for a D-Tale process’s data
  • chart_type (str) – type of chart (line, bar, pie, scatter…)
  • query (str, optional) – pandas dataframe query string
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • z (str, optional) – column to use for the Z-Axis
  • group (list of str or str, optional) – column(s) to use for grouping
  • agg (str, optional) – specific aggregation that can be applied to y or z axes. Possible values are: count, first, last mean, median, min, max, std, var, mad, prod, sum. This is included in label of axis it is being applied to.
  • window (int, optional) – number of days to include in rolling aggregations
  • rolling_comp (str, optional) – computation to use in rolling aggregations
  • kwargs (dict) – optional keyword arguments, here in case invalid arguments are passed to this function
Returns:

dataframe of all data used in chart

Return type:

pandas.DataFrame

dtale.dash_application.charts.build_scatter_layout(axes, z)[source]
dtale.dash_application.charts.build_scatter_marker(series, z, colorscale=None)[source]
dtale.dash_application.charts.build_scatter_trendline(x, y, trendline)[source]
dtale.dash_application.charts.build_scattergeo(inputs, raw_data, layout)[source]
dtale.dash_application.charts.build_series_name(y, chart_per_group=False)[source]
Builds a helper function to build a name for a series in a chart.
  • (y=’a,b,c’, chart_per_group=False, sub_y=’a’, group=’d’) => ‘d/a’
  • (y=’a,b,c’, chart_per_group=True, sub_y=’a’, group=’d’) => ‘a’
  • (y=’a,b,c’, chart_per_group=False, sub_y=’a’, group=’all’) => ‘a’
Parameters:
  • y (list of str) – columns to use for the Y-Axes
  • chart_per_group (bool) – True if charts are split by groups, False if all are contained within one chart
Returns:

helper function for building series names based off y-axis & group values

Return type:

func

dtale.dash_application.charts.build_spaced_ticks(ticktext, mode='auto')[source]

plotly/dash doesn’t have particularly good tick position handling so in order to handle this on our end we’ll take the list of tick labels and depending on how large that list is we’ll build a configuration which will show a smaller group of ticks evenly spaced.

Parameters:ticktext (list) – list of tick labels
Returns:tick configuration
Return type:dict
dtale.dash_application.charts.build_title(x, y, group=None, z=None, agg=None)[source]
Helper function to build chart titles based on the inputs for x, y, z, group & aggregation.
  • (x=’a’, y=’b’) => ‘b by a’
  • (x=’a’, y=[‘b’,’c’]) => ‘b, c by a’
  • (x=’a’, y=’b’, z=’c’) => ‘b by a weighted by c’
  • (x=’a’, y=’b’, group=’d’) => ‘d - b by a’
  • (x=’a’, y=’b’, agg=’corr’) => ‘b by a (Correlation)’
  • (x=’a’, y=’b’, z=’c’, agg=’sum’) => ‘b by a weighted by c (Sum)’
Parameters:
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • group (list of str or str, optional) – column(s) to use for grouping
  • z (str, optional) – column to use for the Z-Axis
  • agg (str, optional) – specific aggregation that can be applied to y or z axes. Possible values are: count, first, last mean, median, min, max, std, var, mad, prod, sum. This is included in label of axis it is being applied to.
Returns:

chart title

Return type:

str

dtale.dash_application.charts.candlestick_builder(data_id, export=False, **inputs)[source]

Builder function for plotly.graph_objs.Candlestick

Parameters:
  • data_id (str) – integer string identifier for a D-Tale process’s data
  • inputs (dict) – Optional keyword arguments containing the following information: - x: column to be used as x-axis of chart - open: column to be used as open - close: column to used as close - high: column to used as high - low: column to used as low - agg: points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy
Returns:

candlestick chart

Return type:

plotly.graph_objs.Candlestick

dtale.dash_application.charts.chart_builder_passthru(chart, group_filter=None)[source]
dtale.dash_application.charts.chart_url_params(search)[source]

Builds chart parameters by parsing the query string from main URL

Parameters:
  • search – URL querystring
  • search – str
Returns:

dictionary of parsed querystring key/values

Return type:

dict

dtale.dash_application.charts.chart_url_querystring(params, data=None, group_filter=None)[source]
dtale.dash_application.charts.chart_wrapper(data_id, data, url_params=None)[source]

Wrapper function which will wrap each plotly/dash chart with a link to view the chart in a separate popup

Parameters:
  • data_id (str) – identifier of data to build axis configurations against
  • data – data generated by dtale.charts.utils.build_chart()
  • url_params – parameters to be encoded within popup link
Returns:

dash components wrapped in div with popup link

Return type:

dash_html_components.Div

dtale.dash_application.charts.cpg_chunker(charts, columns=2)[source]

Helper function to break a list of charts up into rows of two. If there is only one chart it will only return one row with the chart occupying the full width.

Parameters:
Returns:

list of rows by columns if more than one chart is input otherwise simply return the chart

dtale.dash_application.charts.export_chart(data_id, params)[source]
dtale.dash_application.charts.export_chart_data(data_id, params)[source]
dtale.dash_application.charts.get_map_props(inputs)[source]
dtale.dash_application.charts.get_url_parser()[source]

Returns URL parser based on whether Python 2 or 3 is being used.

dtale.dash_application.charts.heatmap_builder(data_id, export=False, **inputs)[source]

Builder function for plotly.graph_objs.Heatmap

Parameters:
  • data_id (str) – integer string identifier for a D-Tale process’s data
  • inputs (dict) – Optional keyword arguments containing the following information: - x: column to be used as x-axis of chart - y: column to be used as y-axis of chart - z: column to use for the z-Axis - agg: points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy
Returns:

heatmap

Return type:

plotly.graph_objs.Heatmap

dtale.dash_application.charts.line_builder(data, x, y, axes_builder, wrapper, cpg=False, **inputs)[source]

Builder function for plotly.graph_objs.Scatter(mode=’lines’)

Parameters:
  • data (dict) – raw data to be represented within line chart
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • axes_builder (func) – function for building axis configurations
  • wrapper (func) – wrapper function returned by dtale.charts.utils.chart_wrapper()
  • cpg (bool) – True if charts are split by groups, False if all are contained within one chart
  • inputs (dict) – Optional keyword arguments containing information about which aggregation (if any) has been used
Returns:

line chart

Return type:

plotly.graph_objs.Scatter(mode=’lines’)

dtale.dash_application.charts.line_code_builder(data, x, y, axes_builder, **inputs)[source]
dtale.dash_application.charts.map_builder(data_id, export=False, **inputs)[source]
dtale.dash_application.charts.map_chart_post_processing(html_str, params)[source]
dtale.dash_application.charts.pie_builder(data, x, y, wrapper, export=False, **inputs)[source]

Builder function for plotly.graph_objs.Pie

Parameters:
  • data (dict) – raw data to be represented within surface chart
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • wrapper (func) – wrapper function returned by dtale.charts.utils.chart_wrapper()
  • inputs (dict) – Optional keyword arguments containing information about which aggregation (if any) has been used
Returns:

pie chart

Return type:

plotly.graph_objs.Pie

dtale.dash_application.charts.scatter_builder(data, x, y, axes_builder, wrapper, group=None, z=None, agg=None, animate_by=None, trendline=None, modal=False, colorscale=None)[source]

Builder function for plotly.graph_objs.Scatter

Parameters:
  • data (dict) – raw data to be represented within scatter chart
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • axes_builder (func) – function for building axis configurations
  • wrapper (func) – wrapper function returned by dtale.charts.utils.chart_wrapper()
  • z (str) – column to use for the Z-Axis
  • group (list of str or str) – column(s) to use for grouping
  • agg (str) – points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy. Possible values are: count, first, last mean, median, min, max, std, var, mad, prod, sum
Returns:

scatter chart

Return type:

plotly.graph_objs.Scatter

dtale.dash_application.charts.scatter_code_builder(data, x, y, axes_builder, z=None, agg=None, trendline=None, **kwargs)[source]
dtale.dash_application.charts.surface_builder(data, x, y, z, axes_builder, wrapper, agg=None, modal=False)[source]

Builder function for plotly.graph_objs.Surface

Parameters:
  • data (dict) – raw data to be represented within surface chart
  • x (str) – column to use for the X-Axis
  • y (list of str) – columns to use for the Y-Axes
  • z (str) – column to use for the Z-Axis
  • axes_builder (func) – function for building axis configurations
  • wrapper (func) – wrapper function returned by dtale.charts.utils.chart_wrapper()
  • group (list of str or str) – column(s) to use for grouping
  • agg (str) – points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy. Possible values are: count, first, last mean, median, min, max, std, var, mad, prod, sum
Returns:

surface chart

Return type:

plotly.graph_objs.Surface

dtale.dash_application.charts.treemap_builder(data_id, export=False, **inputs)[source]

Builder function for plotly.graph_objs.Treemap

Parameters:
  • data_id (str) – integer string identifier for a D-Tale process’s data
  • inputs (dict) – Optional keyword arguments containing the following information: - value: column to be used to drive the size of the shapes in the chart - label: column to be used for labels - agg: points to a specific function that can be applied to :func: pandas.core.groupby.DataFrameGroupBy
Returns:

treemap chart

Return type:

plotly.graph_objs.Treemap

dtale.dash_application.charts.update_cfg_w_frames(cfg, frame_col, frames, slider_steps)[source]
dtale.dash_application.charts.url_encode_func()[source]

dtale.dash_application.custom_geojson module

dtale.dash_application.custom_geojson.add_custom_geojson(geojson_key, geojson)[source]
dtale.dash_application.custom_geojson.build_geojson_upload(loc_mode, geojson_key=None, featureidkey=None)[source]
dtale.dash_application.custom_geojson.build_modal(map_type, loc_mode)[source]
dtale.dash_application.custom_geojson.get_custom_geojson(geojson_id=None)[source]
dtale.dash_application.custom_geojson.init_callbacks(dash_app)[source]
dtale.dash_application.custom_geojson.load_geojson(contents, filename)[source]

dtale.dash_application.drilldown_modal module

dtale.dash_application.drilldown_modal.build_drilldown_title(data_id, all_inputs, click_point, props, val_prop)[source]
dtale.dash_application.drilldown_modal.build_histogram(data_id, col, query, point_filter)[source]
dtale.dash_application.drilldown_modal.combine_inputs(dash_app, inputs, chart_inputs={}, yaxis_data={}, map_data={})[source]

Combines all managed state (inputs, chart inputs, map inputs & yaxis inputs) within Dash into one dictionary.

dtale.dash_application.drilldown_modal.init_callbacks(dash_app)[source]

dtale.dash_application.lock_zoom module

dtale.dash_application.lock_zoom.init_callbacks(dash_app)[source]

dtale.dash_application.topojson_injections module

dtale.dash_application.utils module

dtale.dash_application.utils.get_data_id(pathname)[source]

Parses data ID from query path (ex: ‘foo/bar/1’ => ‘1’)

dtale.dash_application.views module

class dtale.dash_application.views.DtaleDash(*args, **kwargs)[source]

Bases: dash.dash.Dash

Wrapper class to dash.Dash to allow for abstraction of global state used for building the default layout. Additional state include stylesheets, JS files and styling for github demos.

interpolate_index(**kwargs)[source]
dtale.dash_application.views.add_dash(server)[source]

Adds dash support to main D-Tale Flask process.

Parameters:server (flask.Flask) – main D-Tale Flask process
Returns:server with dash added
Return type:flask.Flask
dtale.dash_application.views.init_callbacks(dash_app)[source]

Dynamically adds dash callbacks to dash-wrapped flask server

Parameters:dash_app (flask.Flask) – flask server with dash support enabled
Returns:flask server with dash callbacks added
Return type:flask.Flask

Module contents