示例#1
0
def test_chart_wrapper(unittest):
    assert chart_wrapper('1', None)('foo') == 'foo'
    url_params = dict(chart_type='line', y=['b', 'c'], yaxis={'b': {'min': 3, 'max': 6}, 'd': {'min': 7, 'max': 10}},
                      agg='rolling', window=10, rolling_calc='corr')
    cw = chart_wrapper('1', dict(min={'b': 4}, max={'b': 6}), url_params)
    output = cw('foo')
    url_params = chart_url_params('?{}'.format(output.children[0].children[0].href.split('?')[-1]))
    unittest.assertEqual(url_params, {'chart_type': 'line', 'agg': 'rolling', 'window': 10, 'cpg': False,
                                      'y': ['b', 'c'], 'yaxis': {'b': {'min': 3, 'max': 6}}})
示例#2
0
def test_chart_url_params_w_group_filter(unittest):
    from dtale.dash_application.charts import chart_url_params, chart_url_querystring

    querystring = chart_url_querystring(dict(chart_type='bar', x='foo', y=['bar'], group=['baz']),
                                        group_filter=dict(group="baz == 'bizzle'"))
    parsed_params = chart_url_params(querystring)
    unittest.assertEqual(
        parsed_params,
        {'chart_type': 'bar', 'x': 'foo', 'cpg': False, 'y': ['bar'], 'group': ['baz'], 'query': "baz == 'bizzle'"}
    )
示例#3
0
文件: views.py 项目: hiwire03/dtale
 def display_page(_ts, pathname, search):
     """
     dash callback which gets called on initial load of each dash page (main & popup)
     """
     dash_app.config.suppress_callback_exceptions = False
     params = chart_url_params(search)
     data_id = get_data_id(pathname)
     df = global_state.get_data(data_id)
     settings = global_state.get_settings(data_id) or {}
     return charts_layout(df, settings, **params)
示例#4
0
 def display_page(pathname, search):
     """
     dash callback which gets called on initial load of each dash page (main & popup)
     """
     dash_app.config.suppress_callback_exceptions = False
     if pathname is None:
         raise PreventUpdate
     params = chart_url_params(search)
     params["data_id"] = params.get("data_id") or get_data_id(pathname)
     df = global_state.get_data(params["data_id"])
     settings = global_state.get_settings(params["data_id"]) or {}
     return html.Div(
         charts_layout(df, settings, **params) + saved_charts.build_layout(),
         className="charts-body",
     )