Making x in timeseries non-ordinal

This commit is contained in:
Maxime 2015-09-02 05:15:02 +00:00
parent b7acbd8d10
commit e1e298044e
3 changed files with 7 additions and 3 deletions

View File

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

View File

@ -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() + '/'

View File

@ -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'},