class_docstr: PerspectiveViewer wraps the `perspective.Table` API and exposes an API
  around creating views, loading data, and updating data.
class_docstr_tok: ["PerspectiveViewer","wraps","the","`","perspective.Table","`","API","and","exposes","an","API","around","creating","views",",","loading","data",",","and","updating","data","."]
docstr: Initialize an instance of `PerspectiveViewer` with the given viewer
  configuration.  Do not pass a `Table` or data into the constructor -
  use the :func:`load()` method to provide the viewer with data.
  
  Keyword Arguments:
      columns (:obj:`list` of :obj:`str`): A list of column names to be
          visible to the user.
      group_by (:obj:`list` of :obj:`str`): A list of column names to
          use as group by.
      split_by (:obj:`list` of :obj:`str`): A list of column names
          to use as split by.
      aggregates (:obj:`dict` of :obj:`str` to :obj:`str`):  A dictionary
          of column names to aggregate types, which specify aggregates
          for individual columns.
      sort (:obj:`list` of :obj:`list` of :obj:`str`): A list of lists,
          each list containing a column name and a sort direction
          (``asc``, ``desc``, ``asc abs``, ``desc abs``, ``col asc``,
          ``col desc``, ``col asc abs``, ``col desc abs``).
      filter (:obj:`list` of :obj:`list` of :obj:`str`): A list of lists,
          each list containing a column name, a filter comparator, and a
          value to filter by.
      expressions (:obj:`list` of :obj:`str`): A list of string
          expressions which are applied to the view.
      plugin (:obj:`str`/:obj:`perspective.Plugin`): Which plugin to
          select by default.
      plugin_config (:obj:`dict`): A configuration for the plugin, i.e.
          the datagrid plugin or a chart plugin.
      settings(:obj:`bool`): Whether the perspective query settings
          panel should be open.
      theme (:obj:`str`): The color theme to use.
      version (:obj:`str`): The version this configuration is restored from.
          This should only be used when restoring a configuration,
          and should not be set manually.
  
  Examples:
      >>> viewer = PerspectiveViewer(
      ...     aggregates={"a": "avg"},
      ...     group_by=["a"],
      ...     sort=[["b", "desc"]],
      ...     filter=[["a", ">", 1]],
      ...     expressions=[""a" + 100"]
      ... )
docstr_tok: ["Initialize","an","instance","of","`","PerspectiveViewer","`","with","the","given","viewer","configuration",".","Do","not","pass","a","`","Table","`","or","data","into","the","constructor","-","use","the",":","func",":","`","load","(",")","`","method","to","provide","the","viewer","with","data",".","Keyword","Arguments",":","columns","(",":","obj",":","`","list","`","of",":","obj",":","`","str","`",")",":","A","list","of","column","names","to","be","visible","to","the","user",".","group_by","(",":","obj",":","`","list","`","of",":","obj",":","`","str","`",")",":","A","list","of","column","names","to","use","as","group","by",".","split_by","(",":","obj",":","`","list","`","of",":","obj",":","`","str","`",")",":","A","list","of","column","names","to","use","as","split","by",".","aggregates","(",":","obj",":","`","dict","`","of",":","obj",":","`","str","`","to",":","obj",":","`","str","`",")",":","A","dictionary","of","column","names","to","aggregate","types",",","which","specify","aggregates","for","individual","columns",".","sort","(",":","obj",":","`","list","`","of",":","obj",":","`","list","`","of",":","obj",":","`","str","`",")",":","A","list","of","lists",",","each","list","containing","a","column","name","and","a","sort","direction","(","``","asc","``",",","``","desc","``",",","``","asc","abs","``",",","``","desc","abs","``",",","``","col","asc","``",",","``","col","desc","``",",","``","col","asc","abs","``",",","``","col","desc","abs","``",")",".","filter","(",":","obj",":","`","list","`","of",":","obj",":","`","list","`","of",":","obj",":","`","str","`",")",":","A","list","of","lists",",","each","list","containing","a","column","name",",","a","filter","comparator",",","and","a","value","to","filter","by",".","expressions","(",":","obj",":","`","list","`","of",":","obj",":","`","str","`",")",":","A","list","of","string","expressions","which","are","applied","to","the","view",".","plugin","(",":","obj",":","`","str","`","\/",":","obj",":","`","perspective.Plugin","`",")",":","Which","plugin","to","select","by","default",".","plugin_config","(",":","obj",":","`","dict","`",")",":","A","configuration","for","the","plugin",",","i.e",".","the","datagrid","plugin","or","a","chart","plugin",".","settings","(",":","obj",":","`","bool","`",")",":","Whether","the","perspective","query","settings","panel","should","be","open",".","theme","(",":","obj",":","`","str","`",")",":","The","color","theme","to","use",".","version","(",":","obj",":","`","str","`",")",":","The","version","this","configuration","is","restored","from",".","This","should","only","be","used","when","restoring","a","configuration",",","and","should","not","be","set","manually",".","Examples",":",">",">",">","viewer","=","PerspectiveViewer","(","...","aggregates=","{","``","a","''",":","``","avg","''","}",",","...","group_by=","[","``","a","''","]",",","...","sort=","[","[","``","b","''",",","``","desc","''","]","]",",","...","filter=","[","[","``","a","''",",","``",">","''",",","1","]","]",",","...","expressions=","[","``","''","a","''","+","100","''","]","...",")"]
code: def __init__(
      self,
      plugin="Datagrid",
      columns=None,
      group_by=None,
      split_by=None,
      aggregates=None,
      sort=None,
      filter=None,
      expressions=None,
      plugin_config=None,
      settings=True,
      theme=None,
      title=None,
      # ignored, here for restore compatibility
      version=None,
  ):
      """Initialize an instance of `PerspectiveViewer` with the given viewer
      configuration.  Do not pass a `Table` or data into the constructor -
      use the :func:`load()` method to provide the viewer with data.
  
      Keyword Arguments:
          columns (:obj:`list` of :obj:`str`): A list of column names to be
              visible to the user.
          group_by (:obj:`list` of :obj:`str`): A list of column names to
              use as group by.
          split_by (:obj:`list` of :obj:`str`): A list of column names
              to use as split by.
          aggregates (:obj:`dict` of :obj:`str` to :obj:`str`):  A dictionary
              of column names to aggregate types, which specify aggregates
              for individual columns.
          sort (:obj:`list` of :obj:`list` of :obj:`str`): A list of lists,
              each list containing a column name and a sort direction
              (``asc``, ``desc``, ``asc abs``, ``desc abs``, ``col asc``,
              ``col desc``, ``col asc abs``, ``col desc abs``).
          filter (:obj:`list` of :obj:`list` of :obj:`str`): A list of lists,
              each list containing a column name, a filter comparator, and a
              value to filter by.
          expressions (:obj:`list` of :obj:`str`): A list of string
              expressions which are applied to the view.
          plugin (:obj:`str`/:obj:`perspective.Plugin`): Which plugin to
              select by default.
          plugin_config (:obj:`dict`): A configuration for the plugin, i.e.
              the datagrid plugin or a chart plugin.
          settings(:obj:`bool`): Whether the perspective query settings
              panel should be open.
          theme (:obj:`str`): The color theme to use.
          version (:obj:`str`): The version this configuration is restored from.
              This should only be used when restoring a configuration,
              and should not be set manually.
  
      Examples:
          >>> viewer = PerspectiveViewer(
          ...     aggregates={"a": "avg"},
          ...     group_by=["a"],
          ...     sort=[["b", "desc"]],
          ...     filter=[["a", ">", 1]],
          ...     expressions=["\"a\" + 100"]
          ... )
      """
  
      # Create an instance of `PerspectiveManager`, which receives messages
      # from the `PerspectiveJupyterClient` on the front-end.
      if is_libpsp():
          self.manager = PerspectiveManager()
  
      # The string name of the Table under management by this viewer and its
      # attached PerspectiveManager
      self.table_name = None
  
      # Viewer configuration
      self.plugin = validate_plugin(plugin)
      self.columns = validate_columns(columns) or []
      self.group_by = validate_group_by(group_by) or []
      self.split_by = validate_split_by(split_by) or []
      self.aggregates = validate_aggregates(aggregates) or {}
      self.sort = validate_sort(sort) or []
      self.filter = validate_filter(filter) or []
      self.expressions = validate_expressions(expressions) or {}
      self.plugin_config = validate_plugin_config(plugin_config) or {}
      self.settings = settings
      self.theme = theme
      self.title = title
  
file_path: perspective/python/perspective/perspective/viewer/viewer.py
imports: from random import random
  from ..libpsp import is_libpsp
  from .validate import validate_aggregates, validate_split_by, validate_columns, validate_expressions, validate_filter, validate_plugin, validate_plugin_config, validate_group_by, validate_sort
  from .viewer_traitlets import PerspectiveTraitlets
label_desc: Use image node_id 1 to create a new PerspectiveViewer object from inherited base classes: PerspectiveTraitlets, object with example: obj = PerspectiveViewer(plugin, columns, group_by, split_by, aggregates, sort, filter, expressions, plugin_config, settings, theme, title, version)