Coverage for mtools.mplotqueries.plottypes.base_type : 44%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
except ImportError:
# 14 most distinguishable colors, according to # http://stackoverflow.com/questions/309149/generate-distinctly-different-rgb-colors-in-graphs '#010067','#95003A','#007DB5','#FF00F6','#FFEEE8','#774D00']
self.args = args self.groups = OrderedDict() self.empty = True self.limits = None
if self.args['optime_start']: self.xlabel = 'time (start of ops)' else: self.xlabel = 'time (end of ops)'
""" return True if this PlotType can plot this line. """
""" append log line to this plot type. """ self.empty = False self.groups.setdefault(key, list()).append(logevent)
def logevents(self): """ iterator yielding all logevents from groups dictionary. """ for key in self.groups: for logevent in self.groups[key]: yield logevent
def color_map(cls, group): cls.color_index += 1
marker = cls.markers[cls.marker_index] if cls.color_index >= len(cls.colors): cls.marker_index += 1 cls.marker_index %= len(cls.markers) cls.color_index %= cls.color_index
return color, marker
""" (re-)group all logevents by the given group. """ group_by = self.group_by else: group_by = self.default_group_by if self.args['group'] != None: group_by = self.args['group']
self.groups = Grouping(self.logevents, group_by) self.groups.move_items(None, 'others') self.groups.sort_by_size(group_limit=self.args['group_limit'], discard_others=self.args['no_others'])
raise NotImplementedError("BasePlotType can't plot. Use a derived class instead")
""" this is called if an element of this plottype was clicked. Implement in sub class. """ pass
self.limits = limits
artists = [] print self.plot_type_str.upper(), "plot" print "%5s %9s %s"%("id", " #points", "group")
for idx, group in enumerate(self.groups): print "%5s %9s %s"%(idx+1, len(self.groups[group]), group) group_artists = self.plot_group(group, idx+ith_plot, axis) if isinstance(group_artists, list): artists.extend(group_artists) else: artists.append(group_artists)
return artists
|