def EncodeData(chart, series, y_min, y_max, encoder):
 assert ((y_min is None) == (y_max is None))
 if (y_min is not None):
  def _ScaleAndEncode(series):
   series = ScaleData(series, y_min, y_max, encoder.min, encoder.max)
   return encoder.Encode(series)
  encoded_series = [_ScaleAndEncode(s) for s in series]
 else:
  encoded_series = [encoder.Encode(s) for s in series]
 result = JoinLists(**{'data': encoded_series})
 result['data'] = (encoder.prefix + result['data'])
 return result

def EncodeData ( chart , series , y_min , y_max , encoder ) : assert ( ( y_min is None ) == ( y_max is None ) ) if ( y_min is not None ) : def _ScaleAndEncode ( series ) : series = ScaleData ( series , y_min , y_max , encoder . min , encoder . max ) return encoder . Encode ( series ) encoded_series = [ _ScaleAndEncode ( s ) for s in series ] else : encoded_series = [ encoder . Encode ( s ) for s in series ] result = JoinLists ( ** { 'data' : encoded_series } ) result [ 'data' ] = ( encoder . prefix + result [ 'data' ] ) return result
format the given data series in plain or extended format .