Package Products :: Package ZenModel :: Module TickGraphPoint
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenModel.TickGraphPoint

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved. 
 4  #  
 5  # This content is made available according to terms specified in 
 6  # License.zenoss under the directory where your Zenoss product is installed. 
 7  #  
 8  ############################################################################## 
 9   
10   
11  __doc__="""TickGraphPoint 
12   
13  Handles GraphPoints that define an rrd TICK 
14  """ 
15   
16  from GraphPoint import GraphPoint 
17  from Globals import InitializeClass 
18  from Products.ZenUtils.deprecated import deprecated 
19 20 21 @deprecated 22 -def manage_addTickGraphPoint(context, id, REQUEST = None):
23 ''' This is here so than zope will let us copy/paste/rename 24 graphpoints. 25 ''' 26 gp = TickGraphPoint(id) 27 context._setObject(gp.id, gp) 28 if REQUEST: 29 return context.callZenScreen(REQUEST)
30
31 32 -class TickGraphPoint(GraphPoint):
33 34 meta_type = 'TickGraphPoint' 35 36 vname = '' 37 color = '' 38 fraction = '' 39 legend = GraphPoint.DEFAULT_LEGEND 40 41 _properties = GraphPoint._properties + ( 42 {'id':'vname', 'type':'string', 'mode':'w'}, 43 {'id':'color', 'type':'string', 'mode':'w'}, 44 {'id':'fraction', 'type':'string', 'mode':'w'}, 45 {'id':'legend', 'type':'string', 'mode':'w'}, 46 ) 47
48 - def getDescription(self):
49 return '%s' % self.fraction
50 51
52 - def getType(self):
53 return 'TICK'
54 55
56 - def getGraphCmds(self, cmds, context, rrdDir, addSummary, idx, 57 multiid=-1, prefix=''):
58 ''' Build the graphing commands for this graphpoint 59 ''' 60 from Products.ZenUtils.Utils import unused 61 unused(multiid, rrdDir) 62 if not self.vname: 63 return cmds 64 65 legend = self.talesEval(self.legend, context) 66 legend = self.escapeForRRD(legend) 67 return cmds + ['TICK:%s%s%s%s' % ( 68 self.addPrefix(prefix, self.vname), 69 self.getColor(idx), 70 self.fraction and ':%s' % self.fraction or '', 71 legend and ':%s' % legend or '')]
72 73 74 InitializeClass(TickGraphPoint) 75