Skip to content

Commit

Permalink
Making x in timeseries non-ordinal
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Sep 2, 2015
1 parent b7acbd8 commit e1e2980
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/highchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,16 @@ def serialize_series(self):

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":
x_axis["type"] = "datetime"
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"
Expand Down Expand Up @@ -226,5 +227,4 @@ def series(self):
l = []
for k, v in series.items():
l.append({'data': v, 'name': k})
print(json.dumps(l, indent=2))
return l
3 changes: 3 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def refresh_datasources(self):
"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)
Expand Down Expand Up @@ -459,6 +460,8 @@ def get_metric_obj(self, metric_name):
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() + '/'
Expand Down
1 change: 1 addition & 0 deletions app/templates/panoramix/datasource.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ <h4 class="modal-title" id="myModalLabel">Query</h4>
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'},
Expand Down

0 comments on commit e1e2980

Please sign in to comment.