class_docstr: An IPython widget display a Vega chart.
  
  Specifying the spec directly::
  
      widget = VegaWidget({...})
      widget.update(remove='datum.t < 5', insert=[{...}, {...}])
  
  To modify the created plot, additional options can be passed as in::
  
      widget = VegaWidget(spec, opt)
  
  Usage with ``altair``::
  
      widget = VegaWidget(chart.to_dict())
  
  To select between Vega and Vega-Lite use the ``$schema`` property on
  the ``spec`` dictionary.
  
  The chart can be updated by setting the ``spec`` property. In additon
  embedding options, such as the used theme, can be set via the ``opt``
  property::
  
      widget.spec = {...}
      widget.opt = {"theme": "dark"}
  
  For streaming data, setting the whole spec may be slow. For this use case,
  ``VegaWidget`` offers the ``update`` method. It sends the data to the
  client without persisting it on the Python side. In particular resetting
  the ``spec`` and ``opt`` properties will lose any data changes performed
  via ``update``.
class_docstr_tok: ["An","IPython","widget","display","a","Vega","chart",".","Specifying","the","spec","directly",":",":","widget","=","VegaWidget","(","{","...","}",")","widget.update","(","remove='datum.t","<","5","'",",","insert=","[","{","...","}",",","{","...","}","]",")","To","modify","the","created","plot",",","additional","options","can","be","passed","as","in",":",":","widget","=","VegaWidget","(","spec",",","opt",")","Usage","with","``","altair","``",":",":","widget","=","VegaWidget","(","chart.to_dict","(",")",")","To","select","between","Vega","and","Vega-Lite","use","the","``","$","schema","``","property","on","the","``","spec","``","dictionary",".","The","chart","can","be","updated","by","setting","the","``","spec","``","property",".","In","additon","embedding","options",",","such","as","the","used","theme",",","can","be","set","via","the","``","opt","``","property",":",":","widget.spec","=","{","...","}","widget.opt","=","{","``","theme","''",":","``","dark","''","}","For","streaming","data",",","setting","the","whole","spec","may","be","slow",".","For","this","use","case",",","``","VegaWidget","``","offers","the","``","update","``","method",".","It","sends","the","data","to","the","client","without","persisting","it","on","the","Python","side",".","In","particular","resetting","the","``","spec","``","and","``","opt","``","properties","will","lose","any","data","changes","performed","via","``","update","``","."]
docstr: Update the chart data.
  
  Updates are only reflected on the client, i.e., after re-displaying
  the widget will show the chart specified in its spec property.
  
  :param str key:
      the name of the dataset to update, as declared in the data
      section of the spec. To update several datasets, chain multiple
      update calls on the widget.
  
  :param Optional[str] remove:
      a JavaScript expression of items to remove. The item to test can
      be accessed as ``datum``. For example, the call
      ``update(remove="datum.t < 5")`` removes all items with the
      property ``t < 5``.
  
  :param Optional[List[dict]] insert:
      new items to add to the chart data.
  
  :param Optional[Bool] resize:
      trigger a resize of the widget after updating. This is
      required when the update creates or deletes important marks
      in the visualization, i.e. creating a new bar in a bar chart.
docstr_tok: ["Update","the","chart","data",".","Updates","are","only","reflected","on","the","client",",","i.e.",",","after","re-displaying","the","widget","will","show","the","chart","specified","in","its","spec","property",".",":","param","str","key",":","the","name","of","the","dataset","to","update",",","as","declared","in","the","data","section","of","the","spec",".","To","update","several","datasets",",","chain","multiple","update","calls","on","the","widget",".",":","param","Optional","[","str","]","remove",":","a","JavaScript","expression","of","items","to","remove",".","The","item","to","test","can","be","accessed","as","``","datum","``",".","For","example",",","the","call","``","update","(","remove=","''","datum.t","<","5","''",")","``","removes","all","items","with","the","property","``","t","<","5","``",".",":","param","Optional","[","List","[","dict","]","]","insert",":","new","items","to","add","to","the","chart","data",".",":","param","Optional","[","Bool","]","resize",":","trigger","a","resize","of","the","widget","after","updating",".","This","is","required","when","the","update","creates","or","deletes","important","marks","in","the","visualization",",","i.e",".","creating","a","new","bar","in","a","bar","chart","."]
code: def update(self, key, remove=None, insert=None, resize=True):
      """Update the chart data.
  
      Updates are only reflected on the client, i.e., after re-displaying
      the widget will show the chart specified in its spec property.
  
      :param str key:
          the name of the dataset to update, as declared in the data
          section of the spec. To update several datasets, chain multiple
          update calls on the widget.
  
      :param Optional[str] remove:
          a JavaScript expression of items to remove. The item to test can
          be accessed as ``datum``. For example, the call
          ``update(remove="datum.t < 5")`` removes all items with the
          property ``t < 5``.
  
      :param Optional[List[dict]] insert:
          new items to add to the chart data.
  
      :param Optional[Bool] resize:
          trigger a resize of the widget after updating. This is
          required when the update creates or deletes important marks
          in the visualization, i.e. creating a new bar in a bar chart.
      """
      if isinstance(insert, (np.ndarray, NumpyAdapter)):
          return self.update_array2d(
              key,
              arr=insert,
              columns=["x", "y", "z"],
              remove=remove,
              resize=resize,
          )
      if isinstance(insert, (pd.DataFrame, SourceAdapter)):
          return self.update_dataframe(
              key, df=insert, remove=remove, resize=resize
          )
      update = dict(key=key)
  
      if remove is not None:
          update["remove"] = remove
  
      if insert is not None:
          update["insert"] = insert
  
      if self._displayed:
          self.send(
              dict(type="update", updates=[update], resize=resize)
          )
  
      else:
          self._resize = resize
          self._pending_updates.append(update)
  
file_path: ipyvega/vega/widget.py
imports: from __future__ import print_function
  import json
  import pandas
  from ._frontend import module_name, EXTENSION_SPEC_VERSION
  from ipytablewidgets import serialization, SourceAdapter, PandasAdapter, NumpyAdapter, TableType
  import numpy
label_desc: Use image node_id 8 for calling the VegaWidget obj's underlying member method code with example usage: obj.update(key, remove, insert, resize) and returns: self, self