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

# Source Code for Module Products.ZenModel.LineGraphPoint

     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__="""Line
    12
    13  Handles GraphPoints that define an rrd LINE
    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_addLineGraphPoint(context, id, REQUEST = None):
    23      ''' This is here so than zope will let us copy/paste/rename
    24      graphpoints.
    25      '''
    26      gp = LineGraphPoint(id)
    27      context._setObject(gp.id, gp)
    28      if REQUEST:
    29          return context.callZenScreen(REQUEST)
    30
    31
    32 -class LineGraphPoint(GraphPoint):
    33
    34      meta_type = 'LineGraphPoint'
    35
    36      lineWidth = 1
    37      value = ''
    38      color = ''
    39      legend = GraphPoint.DEFAULT_LEGEND
    40      stacked = False
    41
    42      _properties = GraphPoint._properties + (
    43          {'id':'lineWidth', 'type':'long', 'mode':'w'},
    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 -    def getDescription(self):
    51          return '%s %s' % (self.value, self.legend)
    52
    53
    54 -    def getType(self):
    55          return 'LINE'
    56
    57
    58 -    def getGraphCmds(self, cmds, context, rrdDir, addSummary, idx,
    59                          multiid=-1, prefix=''):
    60          ''' Build the graphing commands for this graphpoint
    61          '''
    62          from Products.ZenUtils.Utils import unused
    63          unused(multiid, rrdDir)
    64          value = self.addPrefix(prefix, self.value)
    65          gopts = 'LINE%s:%s%s' % (
    66              (self.lineWidth or ''), value, self.getColor(idx))
    67
    68          if self.legend or self.stacked:
    69              legend = self.talesEval(self.legend, context)
    70              legend = self.escapeForRRD(legend)
    71              gopts += ':%s' % legend
    72          if self.stacked:
    73              gopts += ':STACK'
    74          return cmds + [gopts]
    75
    76
    77  InitializeClass(LineGraphPoint)
    78