Created
July 25, 2012 11:26
-
-
Save rauch/3175635 to your computer and use it in GitHub Desktop.
django-chartit, DateTime as xAxis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@staticmethod | |
def getJobStatChart(title, currentTime): | |
statistics =\ | |
DataPool( | |
series= | |
[{'options': { | |
'source': PBSServer.objects.order_by('-time')[:20] }, | |
'terms': [ | |
('time', lambda d: time.mktime(d.timetuple())), | |
'running_jobs', | |
'queued_jobs', | |
'total_jobs']} | |
]) | |
#Step 2: Create the Chart object | |
chart = Chart( | |
datasource=statistics, | |
series_options= | |
[{'options': { | |
'type': 'line', | |
'stacking': False}, | |
'terms': { | |
'time': [ | |
'running_jobs', | |
'queued_jobs', | |
'total_jobs'] | |
}}], | |
chart_options= | |
{'title': { | |
'text': title}, | |
'xAxis': { | |
'title': { | |
'text': 'Time'}}}, | |
x_sortf_mapf_mts=(None, lambda i: datetime.fromtimestamp(i).strftime("%H:%M"), False)) | |
return chart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems the patch code from @ofraam has been integrated at least into the django-chartit2-0.2.2.