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

# Source Code for Module Products.ZenModel.AreaGraphPoint

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 or (at your
     8  # option) any later version as published by the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  __doc__="""AreaGraphPoint
    15
    16  Handles GraphPoints that define an rrd AREA
    17  """
    18
    19  from GraphPoint import GraphPoint
    20  from Globals import InitializeClass
    21
    22  from Products.ZenUtils.Utils import unused
    23
    24 -def manage_addAreaGraphPoint(context, id, REQUEST = None):
    25      ''' This is here so than zope will let us copy/paste/rename
    26      graphpoints.
    27      '''
    28      gp = AreaGraphPoint(id)
    29      context._setObject(gp.id, gp)
    30      if REQUEST:
    31          return context.callZenScreen(REQUEST)
    32
    33
    34 -class AreaGraphPoint(GraphPoint):
    35
    36      meta_type = 'AreaGraphPoint'
    37
    38      value = ''
    39      color = ''
    40      legend = GraphPoint.DEFAULT_LEGEND
    41      stacked = False
    42
    43      _properties = GraphPoint._properties + (
    44          {'id':'value', 'type':'string', 'mode':'w'},
    45          {'id':'color', 'type':'string', 'mode':'w'},
    46          {'id':'legend', 'type':'string', 'mode':'w'},
    47          {'id':'stacked', 'type':'boolean', 'mode':'w'},
    48          )
    49
    50
    51 -    def getDescription(self):
    52          return '%s %s' % (self.value, self.legend)
    53
    54
    55 -    def getType(self):
    56          return 'AREA'
    57
    58
    59 -    def getGraphCmds(self, cmds, context, rrdDir, addSummary, idx,
    60                          multiid=-1, prefix=''):
    61          ''' Build the graphing commands for this graphpoint
    62          '''
    63          unused(multiid, rrdDir)
    64          gopts = 'AREA:%s%s' % (
    65              self.addPrefix(prefix, self.value), self.getColor(idx))
    66
    67          if self.legend or self.stacked:
    68              legend = self.talesEval(self.legend, context)
    69              legend = self.escapeForRRD(legend)
    70              gopts += ':%s' % legend
    71          if self.stacked:
    72              gopts += ':STACK'
    73          return cmds + [gopts]
    74
    75
    76  InitializeClass(AreaGraphPoint)
    77