mirror of https://github.com/apache/superset.git
Bugfix on timeseries where granularity=all
This commit is contained in:
parent
8e5a827b75
commit
b7acbd8d10
7
TODO.md
7
TODO.md
|
@ -1,8 +1,7 @@
|
|||
# TODO
|
||||
* in/notin filters autocomplete
|
||||
* Scatter plot
|
||||
* Allow for post aggregations (ratios!)
|
||||
* DRUID: Allow for post aggregations (ratios!)
|
||||
* compare time ranges
|
||||
* Add verbose_name and label method to metrics and columns
|
||||
* csv
|
||||
* csv export out of table view
|
||||
* Save / bookmark / url shortener
|
||||
* SQL: Find a way to manage granularity
|
||||
|
|
16
app/viz.py
16
app/viz.py
|
@ -85,8 +85,6 @@ class BaseViz(object):
|
|||
if self.df is not None:
|
||||
if 'timestamp' in self.df.columns:
|
||||
self.df.timestamp = pd.to_datetime(self.df.timestamp)
|
||||
self.df_prep()
|
||||
self.form_prep()
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
self.error_msg = str(e)
|
||||
|
@ -111,6 +109,9 @@ class BaseViz(object):
|
|||
return self.datasource.query(**self.query_obj())
|
||||
|
||||
def query_obj(self):
|
||||
"""
|
||||
Building a query object
|
||||
"""
|
||||
ds = self.datasource
|
||||
args = self.form_data
|
||||
groupby = args.getlist("groupby") or []
|
||||
|
@ -144,12 +145,6 @@ class BaseViz(object):
|
|||
}
|
||||
return d
|
||||
|
||||
def df_prep(self):
|
||||
pass
|
||||
|
||||
def form_prep(self):
|
||||
pass
|
||||
|
||||
def render_no_data(self):
|
||||
self.template = "panoramix/no_data.html"
|
||||
return BaseViz.render(self)
|
||||
|
@ -272,6 +267,11 @@ class TimeSeriesViz(HighchartsViz):
|
|||
sort_legend_y = True
|
||||
|
||||
def render(self):
|
||||
if request.args.get("granularity") == "all":
|
||||
self.error_msg = (
|
||||
"You have to select a time granularity for this view")
|
||||
return super(TimeSeriesViz, self).render(error_msg=self.error_msg)
|
||||
|
||||
metrics = self.metrics
|
||||
df = self.df
|
||||
df = df.pivot_table(
|
||||
|
|
Loading…
Reference in New Issue