def compile_intent(ldf: LuxDataFrame, _inferred_intent: List[Clause]) -> VisList: """ Compiles input specifications in the intent of the ldf into a collection of lux.vis objects for visualization. 1) Enumerate a collection of visualizations interested by the user to generate a vis list 2) Expand underspecified specifications(lux.Clause) for each of the generated visualizations. 3) Determine encoding properties for each vis Parameters ---------- ldf : lux.core.frame LuxDataFrame with underspecified intent. vis_collection : list[lux.vis.Vis] empty list that will be populated with specified lux.Vis objects. Returns ------- vis_collection: list[lux.Vis] vis list with compiled lux.Vis objects. """ if _inferred_intent: vis_collection = Compiler.enumerate_collection( _inferred_intent, ldf) # autofill data type/model information Compiler.populate_data_type_model(ldf, vis_collection) # remove invalid visualizations from collection if len(vis_collection) >= 1: vis_collection = Compiler.remove_all_invalid(vis_collection) for vis in vis_collection: # autofill viz related information Compiler.determine_encoding(ldf, vis) ldf._compiled = True return vis_collection
def compile_vis(ldf: LuxDataFrame, vis: Vis) -> VisList: if (vis): vis_collection = Compiler.populate_data_type_model( ldf, [vis]) # autofill data type/model information vis_collection = Compiler.remove_all_invalid( vis_collection ) # remove invalid visualizations from collection for vis in vis_collection: Compiler.determine_encoding( ldf, vis) # autofill viz related information ldf._compiled = True return vis_collection
def compile_vis(ldf: LuxDataFrame, vis: Vis) -> Vis: """ Root method for compiling visualizations Parameters ---------- ldf : LuxDataFrame vis : Vis Returns ------- Vis Compiled Vis object """ if vis: # autofill data type/model information Compiler.populate_data_type_model(ldf, [vis]) # remove invalid visualizations from collection Compiler.remove_all_invalid([vis]) # autofill viz related information Compiler.determine_encoding(ldf, vis) ldf._compiled = True return vis