#NEWLINE# def __init__( self , * args , **kwargs ) : #NEWLINE# #INDENT# 'Create a Vega Area Chart' #NEWLINE# super ( Area , self ) . __init__ ( * args , ** kwargs ) #NEWLINE# x_type = ( 'time' if self . _is_datetime else 'linear' ) #NEWLINE# self . scales += [ Scale ( name = 'x' , type = x_type , range = 'width' , zero = False , domain = DataRef ( data = 'table' , field = 'data.idx' ) ) , Scale ( name = 'y' , range = 'height' , nice = True , domain = DataRef ( data = 'stats' , field = 'sum' ) ) , Scale ( name = 'color' , type = 'ordinal' , range = 'category20' , domain = DataRef ( data = 'table' , field = 'data.col' ) ) ] #NEWLINE# self . axes += [ Axis ( type = 'x' , scale = 'x' ) , Axis ( type = 'y' , scale = 'y' ) ] #NEWLINE# stats_transform = [ Transform ( type = 'facet' , keys = [ 'data.idx' ] ) , Transform ( type = 'stats' , value = 'data.val' ) ] #NEWLINE# stats_data = Data ( name = 'stats' , source = 'table' , transform = stats_transform ) #NEWLINE# self . data . append ( stats_data ) #NEWLINE# from_transform = [ Transform ( type = 'facet' , keys = [ 'data.col' ] ) , Transform ( type = 'stack' , point = 'data.idx' , height = 'data.val' ) ] #NEWLINE# from_ = MarkRef ( data = 'table' , transform = from_transform ) #NEWLINE# enter_props = PropertySet ( x = ValueRef ( scale = 'x' , field = 'data.idx' ) , y = ValueRef ( scale = 'y' , field = 'y' ) , y2 = ValueRef ( scale = 'y' , field = 'y2' ) , interpolate = ValueRef ( value = 'monotone' ) , fill = ValueRef ( scale = 'color' , field = 'data.col' ) ) #NEWLINE# marks = [ Mark ( type = 'area' , properties = MarkProperties ( enter = enter_props ) ) ] #NEWLINE# mark_group = Mark ( type = 'group' , from_ = from_ , marks = marks ) #NEWLINE# self . marks . append ( mark_group )