Bugfix on timeseries where granularity=all

This commit is contained in:
Maxime Beauchemin 2015-08-27 09:16:29 -07:00
parent 8e5a827b75
commit b7acbd8d10
2 changed files with 11 additions and 12 deletions

View File

@ -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

View File

@ -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(