A few basic chart improvements
This commit is contained in:
Родитель
b8bcf081cc
Коммит
02c4d17491
|
@ -127,14 +127,14 @@ class Airflow(BaseView):
|
|||
|
||||
all_data = {}
|
||||
hook = db.get_hook()
|
||||
jt = jinja2.Template(chart.sql)
|
||||
try:
|
||||
args = eval(chart.default_params)
|
||||
except:
|
||||
args = {}
|
||||
request_dict = {k:request.args.get(k) for k in request.args}
|
||||
args.update(request_dict)
|
||||
sql = jt.render(**args)
|
||||
sql = jinja2.Template(chart.sql).render(**args)
|
||||
label = jinja2.Template(chart.label).render(**args)
|
||||
df = hook.get_pandas_df(sql)
|
||||
|
||||
for i, (series, x, y) in df.iterrows():
|
||||
|
@ -156,7 +156,7 @@ class Airflow(BaseView):
|
|||
chart=chart, data=all_data, table=Markup(table),
|
||||
chart_options={},
|
||||
height=height,
|
||||
sql=sql)
|
||||
sql=sql, label=label)
|
||||
session.commit()
|
||||
session.close()
|
||||
return response
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<script src="{{ url_for('static', filename='highcharts.js') }}"></script>
|
||||
<script src="/ck/static/chartkick.js"></script>
|
||||
<div class="container">
|
||||
<h2>{{ chart.label }}</h2>
|
||||
<h2>{{ label }}</h2>
|
||||
{% if chart.chart_type == "area_chart" %}
|
||||
{% area_chart data with height=height library=chart_options%}
|
||||
{% elif chart.chart_type == "line_chart" %}
|
||||
|
|
Загрузка…
Ссылка в новой задаче