1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 import crunchstat_summary.webchart
8 class DygraphsChart(crunchstat_summary.webchart.WebChart):
9 CSS = 'https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.0.0/dygraph.min.css'
10 JSLIB = 'https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.0.0/dygraph.min.js'
11 JSASSET = 'dygraphs.js'
14 return '<link rel="stylesheet" href="{}">\n'.format(self.CSS)
16 def chartdata(self, label, tasks, stat):
18 'data': self._collate_data(tasks, stat),
20 'connectSeparatedPoints': True,
21 'labels': ['elapsed']+[uuid for uuid, _ in tasks.iteritems()],
22 'title': '{}: {} {}'.format(label, stat[0], stat[1]),
26 def _collate_data(self, tasks, stat):
29 for uuid, task in tasks.iteritems():
30 for pt in task.series[stat]:
31 data.append([pt[0].total_seconds()] + nulls + [pt[1]])