fix Calendar Heatmap (#6445)

* fix  D3 v4.0, selections are not arrays anymore

* added vale checking

* fixed linting

* cleanup
This commit is contained in:
aboganas
2018-11-28 07:54:25 +03:00
committed by Maxime Beauchemin
parent b0a55743b3
commit 529cb5cab1
2 changed files with 8 additions and 5 deletions

View File

@@ -95,7 +95,7 @@ function Calendar(element, props) {
cal.init({
start: UTCTS(data.start),
data: timestamps,
itemSelector: calContainer[0][0],
itemSelector: calContainer.node(),
legendVerticalPosition: 'top',
cellSize,
cellPadding,

View File

@@ -789,10 +789,13 @@ class CalHeatmapViz(BaseViz):
data = {}
records = df.to_dict('records')
for metric in self.metric_labels:
data[metric] = {
str(obj[DTTM_ALIAS] / 10**9): obj.get(metric)
for obj in records
}
values = {}
for obj in records:
v = obj[DTTM_ALIAS]
if hasattr(v, 'value'):
v = v.value
values[str(v / 10**9)] = obj.get(metric)
data[metric] = values
start, end = utils.get_since_until(form_data.get('time_range'),
form_data.get('since'),