예제 #1
0
 def __init__(self, size, label=None, color=None):
   if label is not None and util._IsColor(label):
     warnings.warn('Your code may be broken! '
                   'Label looks like a hex triplet; it might be a color.  '
                   'The old argument order (color before label) is '
                   'deprecated.',
                   DeprecationWarning, stacklevel=2)
   style = common._BasicStyle(color)
   super(Segment, self).__init__([size], label=label, style=style)
   assert size >= 0
 def __init__(self, size, label=None, color=None):
     if label is not None and util._IsColor(label):
         warnings.warn(
             'Your code may be broken! '
             'Label looks like a hex triplet; it might be a color.  '
             'The old argument order (color before label) is '
             'deprecated.',
             DeprecationWarning,
             stacklevel=2)
     style = common._BasicStyle(color)
     super(Segment, self).__init__([size], label=label, style=style)
     assert size >= 0
예제 #3
0
    def AddBars(self, points, label=None, color=None):
        """Add a series of bars to the chart.

      points: List of y-values for the bars in this series
      label:  Name of the series (used in the legend)
      color:  Hex string, like '00ff00' for green

    This is a convenience method which constructs & appends the DataSeries for
    you.
    """
        if label is not None and util._IsColor(label):
            warnings.warn(
                'Your code may be broken! '
                'Label is a hex triplet.  Maybe it is a color? The '
                'old argument order (color before label) is deprecated.',
                DeprecationWarning,
                stacklevel=2)
        style = BarsStyle(color)
        series = common.DataSeries(points, label=label, style=style)
        self.data.append(series)
        return series
예제 #4
0
    def AddBars(self, points, label=None, color=None):
        """Add a series of bars to the chart.

      points: List of y-values for the bars in this series
      label:  Name of the series (used in the legend)
      color:  Hex string, like '00ff00' for green

    This is a convenience method which constructs & appends the DataSeries for
    you.
    """
        if label is not None and util._IsColor(label):
            warnings.warn(
                "Your code may be broken! "
                "Label is a hex triplet.  Maybe it is a color? The "
                "old argument order (color before label) is deprecated.",
                DeprecationWarning,
                stacklevel=2,
            )
        style = BarsStyle(color)
        series = common.DataSeries(points, label=label, style=style)
        self.data.append(series)
        return series
예제 #5
0
 def __init__(self,
              points,
              label=None,
              style=None,
              markers=None,
              color=None):
     """Construct a DataSeries.  See class docstring for details on args."""
     if label is not None and util._IsColor(label):
         warnings.warn(
             'Your code may be broken! Label is a hex triplet.  Maybe '
             'it is a color? The old argument order (color & style '
             'before label) is deprecated.',
             DeprecationWarning,
             stacklevel=2)
     if color is not None:
         warnings.warn(
             'Passing color is deprecated.  Pass a style object '
             'instead.',
             DeprecationWarning,
             stacklevel=2)
         # Attempt to fix it for them.  If they also passed a style, honor it.
         if style is None:
             style = _BasicStyle(color)
     if style is not None and isinstance(style, basestring):
         warnings.warn(
             'Your code is broken! Style is a string, not an object. '
             'Maybe you are passing a color?  Passing color is '
             'deprecated; pass a style object instead.',
             DeprecationWarning,
             stacklevel=2)
     if style is None:
         style = _BasicStyle(None)
     self.data = points
     self.style = style
     self.markers = markers or []
     self.label = label
예제 #6
0
파일: common.py 프로젝트: Agana/MyBlog
 def __init__(self, points, label=None, style=None, markers=None, color=None):
   """Construct a DataSeries.  See class docstring for details on args."""
   if label is not None and util._IsColor(label):
     warnings.warn('Your code may be broken! Label is a hex triplet.  Maybe '
                   'it is a color? The old argument order (color & style '
                   'before label) is deprecated.', DeprecationWarning,
                   stacklevel=2)
   if color is not None:
     warnings.warn('Passing color is deprecated.  Pass a style object '
                   'instead.', DeprecationWarning, stacklevel=2)
     # Attempt to fix it for them.  If they also passed a style, honor it.
     if style is None:
       style = _BasicStyle(color)
   if style is not None and isinstance(style, basestring):
     warnings.warn('Your code is broken! Style is a string, not an object. '
                   'Maybe you are passing a color?  Passing color is '
                   'deprecated; pass a style object instead.',
                   DeprecationWarning, stacklevel=2)
   if style is None:
     style = _BasicStyle(None)
   self.data = points
   self.style = style
   self.markers = markers or []
   self.label = label