From e1e298044e2dfbc449a4e8770bd13efc3059dd93 Mon Sep 17 00:00:00 2001 From: Maxime Date: Wed, 2 Sep 2015 05:15:02 +0000 Subject: [PATCH] Making x in timeseries non-ordinal --- app/highchart.py | 6 +++--- app/models.py | 3 +++ app/templates/panoramix/datasource.html | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/highchart.py b/app/highchart.py index 6a599b318..27541d376 100644 --- a/app/highchart.py +++ b/app/highchart.py @@ -156,7 +156,9 @@ class Highchart(BaseHighchart): def serialize_xaxis(self): df = self.df - x_axis = {} + x_axis = { + 'ordinal': False, + } if df.index.name: x_axis["title"] = {"text": df.index.name} if df.index.dtype.kind in "M": @@ -164,7 +166,6 @@ class Highchart(BaseHighchart): if df.index.dtype.kind == 'O': x_axis['categories'] = sorted( list(df.index)) if self.sort_columns else list(df.index) - print list(df.index) if self.grid: x_axis["gridLineWidth"] = 1 x_axis["gridLineDashStyle"] = "Dot" @@ -226,5 +227,4 @@ class HighchartBubble(BaseHighchart): l = [] for k, v in series.items(): l.append({'data': v, 'name': k}) - print(json.dumps(l, indent=2)) return l diff --git a/app/models.py b/app/models.py index 391f195c6..29543a706 100644 --- a/app/models.py +++ b/app/models.py @@ -410,6 +410,7 @@ class Cluster(Model, AuditMixin): "http://{self.coordinator_host}:{self.coordinator_port}/" "{self.coordinator_endpoint}/datasources" ).format(self=self) + datasources = json.loads(requests.get(endpoint).text) for datasource in datasources: Datasource.sync_to_db(datasource, self) @@ -459,6 +460,8 @@ class Datasource(Model, AuditMixin, Queryable): def latest_metadata(self): client = self.cluster.get_pydruid_client() results = client.time_boundary(datasource=self.datasource_name) + if not results: + return max_time = results[0]['result']['minTime'] max_time = parse(max_time) intervals = (max_time - timedelta(seconds=1)).isoformat() + '/' diff --git a/app/templates/panoramix/datasource.html b/app/templates/panoramix/datasource.html index b2f315035..6c5350a19 100644 --- a/app/templates/panoramix/datasource.html +++ b/app/templates/panoramix/datasource.html @@ -244,6 +244,7 @@ $( document ).ready(function() { multiple: false, data: [ {id: '{{ form.data.granularity }}', text: '{{ form.data.granularity }}'}, + {id: 'all', text: 'all'}, {id: '5 seconds', text: '5 seconds'}, {id: '30 seconds', text: '30 seconds'}, {id: '1 minute', text: '1 minute'},