code: def dataLimits(data, drawNullAsZero=False, stacked=False):
      
      missingValues = any(None in series for series in data)
      finiteData = [series for series in data
                    if not series.options.get('drawAsInfinite')]
  
      yMinValue = safeMin(safeMin(series) for series in finiteData)
  
      if yMinValue is None:
          # This can only happen if there are no valid, non-infinite data.
          return (0.0, 1.0)
  
      if yMinValue > 0.0 and drawNullAsZero and missingValues:
          yMinValue = 0.0
  
      if stacked:
          length = safeMin(len(series) for series in finiteData)
          sumSeries = []
  
          for i in range(0, length):
              sumSeries.append(safeSum(series[i] for series in finiteData))
          yMaxValue = safeMax(sumSeries)
      else:
          yMaxValue = safeMax(safeMax(series) for series in finiteData)
  
      if yMaxValue < 0.0 and drawNullAsZero and missingValues:
          yMaxValue = 0.0
  
      return (yMinValue, yMaxValue)
docs: Return the range of values in data as (yMinValue, yMaxValue).
  
      data is an array of TimeSeries objects.