Skip to content

Commit

Permalink
Better tooltips and more ways to integrate them easily
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 10, 2015
1 parent c64473c commit fc93f36
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
29 changes: 23 additions & 6 deletions panoramix/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ def __init__(self, viz):
default='None',
choices=[(s, s) for s in ['None', 'mean', 'sum', 'std', 'cumsum']],
description=(
"Defines a rolling window function to apply")),
"Defines a rolling window function to apply, works along "
"with the [Periods] text box")),
'rolling_periods': IntegerField(
'Periods',
validators=[validators.optional()],
description=(
"Defines the size of the rolling window function, "
"relative to the 'granularity' field")),
"relative to the time granularity selected")),
'series': SelectField(
'Series', choices=group_by_choices,
default=default_groupby,
Expand All @@ -152,8 +153,19 @@ def __init__(self, viz):
'Bubble Size',
default=default_metric,
choices=datasource.metrics_combo),
'where': TextField('Custom WHERE clause', default=''),
'having': TextField('Custom HAVING clause', default=''),
'where': TextField(
'Custom WHERE clause', default='',
description=(
"The text in this box gets included in your query's WHERE "
"clause, as an AND to other criteria. You can include "
"complex expression, parenthesis and anything else "
"supported by the backend it is directed towards.")),
'having': TextField('Custom HAVING clause', default='',
description=(
"The text in this box gets included in your query's HAVING"
" clause, as an AND to other criteria. You can include "
"complex expression, parenthesis and anything else "
"supported by the backend it is directed towards.")),
'compare_lag': TextField('Comparison Period Lag',
description="Based on granularity, number of time periods to compare against"),
'compare_suffix': TextField('Comparison suffix',
Expand Down Expand Up @@ -305,8 +317,13 @@ class QueryForm(OmgWtForm):

# datasource type specific form elements
if datasource.__class__.__name__ == 'SqlaTable':
QueryForm.fieldsets += (
{'label': 'SQL', 'fields': ['where', 'having']},)
QueryForm.fieldsets += ({
'label': 'SQL',
'fields': ['where', 'having'],
'description': (
"This section exposes ways to include snippets of "
"SQL in your query"),
},)
setattr(QueryForm, 'where', px_form_fields['where'])
setattr(QueryForm, 'having', px_form_fields['having'])

Expand Down
8 changes: 8 additions & 0 deletions panoramix/templates/panoramix/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ <h4>
{% if fieldset.label %}
<legend class="legend-style">
<span class="legend_label">{{ fieldset.label }}</span>
{% if fieldset.description %}
<i class="fa fa-info-circle" data-toggle="tooltip"
data-placement="bottom"
title="{{ fieldset.description }}"></i>
{% endif %}
<span class="collapser"> [-]</span>
</legend>
{% endif %}
Expand Down Expand Up @@ -70,6 +75,9 @@ <h4>
<fieldset class="fs-style">
<legend class="legend-style">
<span class="legend_label">Filters</span>
<i class="fa fa-info-circle" data-toggle="tooltip"
data-placement="bottom"
title="Filters are defined using comma delimited strings as in 'US,FR,Other'"></i>
<span class="collapser"> [-]</span>
</legend>
<div class="fieldset_content">
Expand Down
4 changes: 4 additions & 0 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ class NVD3TimeSeriesViz(NVD3Viz):
),
}, {
'label': 'Advanced Analytics',
'description': (
"This section contains options "
"that allow for advanced analytical post processing "
"of query reults"),
'fields': (
('rolling_type', 'rolling_periods'),
'time_compare',
Expand Down

0 comments on commit fc93f36

Please sign in to comment.