Example #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
Example #2
0
    def testDataSeriesArgumentOrder(self):
        # Deprecated approach
        warnings.filterwarnings('error')
        self.assertRaises(DeprecationWarning, common.DataSeries, [1, 2, 3],
                          '0000FF', 'style')

        # New order
        style = common._BasicStyle('0000FF')
        d = common.DataSeries([1, 2, 3], 'label', style)
        self.assertEqual('label', d.label)
        self.assertEqual(style, d.style)
  def testDataSeriesArgumentOrder(self):
    # Deprecated approach
    warnings.filterwarnings('error')
    self.assertRaises(DeprecationWarning, common.DataSeries, [1, 2, 3],
      '0000FF', 'style')

    # New order
    style = common._BasicStyle('0000FF')
    d = common.DataSeries([1, 2, 3], 'label', style)
    self.assertEqual('label', d.label)
    self.assertEqual(style, d.style)
 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
Example #5
0
 def AddData(self, points, color=None, label=None):
     style = common._BasicStyle(color)
     series = common.DataSeries(points, style=style, label=label)
     self.data.append(series)
     return series
 def AddData(self, points, color=None, label=None):
   style = common._BasicStyle(color)
   series = common.DataSeries(points, style=style, label=label)
   self.data.append(series)
   return series