Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, data, width=None, height=None,
left='0%', top='0%', position='relative'):
super(self.__class__, self).__init__()
self._name = 'VegaLite'
self.data = data.to_json() if hasattr(data, 'to_json') else data
if isinstance(self.data, str):
self.data = json.loads(self.data)
self.json = json.dumps(self.data)
# Size Parameters.
self.width = _parse_size(self.data.get('width', '100%') if
width is None else width)
self.height = _parse_size(self.data.get('height', '100%') if
height is None else height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
def __init__(self, data, width=None, height=None,
left='0%', top='0%', position='relative'):
super(Vega, self).__init__()
self._name = 'Vega'
self.data = data.to_json() if hasattr(data, 'to_json') else data
if isinstance(self.data, str):
self.data = json.loads(self.data)
# Size Parameters.
self.width = _parse_size(self.data.get('width', '100%') if
width is None else width)
self.height = _parse_size(self.data.get('height', '100%') if
height is None else height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
def __init__(self, data, width=None, height=None,
left='0%', top='0%', position='relative'):
super(self.__class__, self).__init__()
self._name = 'VegaLite'
self.data = data.to_json() if hasattr(data, 'to_json') else data
if isinstance(self.data, str):
self.data = json.loads(self.data)
self.json = json.dumps(self.data)
# Size Parameters.
self.width = _parse_size(self.data.get('width', '100%') if
width is None else width)
self.height = _parse_size(self.data.get('height', '100%') if
height is None else height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
def __init__(self, data, width="100%", height="100%"):
super(Html, self).__init__()
self._name = 'Html'
self.data = data
self.width = _parse_size(width)
self.height = _parse_size(height)
self._template = Template(u"""
def __init__(self, data, width="100%", height="100%"):
super(Html, self).__init__()
self._name = 'Html'
self.data = data
self.width = _parse_size(width)
self.height = _parse_size(height)
self._template = Template(u"""
def __init__(self, width='100%', height='100%',
left="0%", top="0%", position='relative'):
super(Figure, self).__init__()
self._name = 'Div'
# Size Parameters.
self.width = _parse_size(width)
self.height = _parse_size(height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
self.header = Element()
self.html = Element("""
{% for name, element in this._children.items() %}
{{element.render(**kwargs)}}
{% endfor %}
""")
self.script = Element()
self.header._parent = self
self.html._parent = self
self.script._parent = self
self._template = Template(u"""
def __init__(self, width='100%', height='100%',
left="0%", top="0%", position='relative'):
super(Figure, self).__init__()
self._name = 'Div'
# Size Parameters.
self.width = _parse_size(width)
self.height = _parse_size(height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
self.header = Element()
self.html = Element("""
{% for name, element in this._children.items() %}
{{element.render(**kwargs)}}
{% endfor %}
""")
self.script = Element()
self.header._parent = self
self.html._parent = self
self.script._parent = self
self._template = Template(u"""
{% macro header(this, kwargs) %}
# Undocumented for now b/c this will be subject to a re-factor soon.
self._png_image = None
self.png_enabled = png_enabled
if location is None:
# If location is not passed we center and zoom out.
self.location = [0, 0]
zoom_start = 1
else:
self.location = validate_location(location)
Figure().add_child(self)
# Map Size Parameters.
self.width = _parse_size(width)
self.height = _parse_size(height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
max_bounds_array = [[min_lat, min_lon], [max_lat, max_lon]] \
if max_bounds else None
self.crs = crs
self.control_scale = control_scale
self.options = parse_options(
max_bounds=max_bounds_array,
zoom=zoom_start,
zoom_control=zoom_control,
prefer_canvas=prefer_canvas,
**kwargs
self._env = ENV
# Undocumented for now b/c this will be subject to a re-factor soon.
self._png_image = None
self.png_enabled = png_enabled
if location is None:
# If location is not passed we center and zoom out.
self.location = [0, 0]
zoom_start = 1
else:
self.location = validate_location(location)
Figure().add_child(self)
# Map Size Parameters.
self.width = _parse_size(width)
self.height = _parse_size(height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
max_bounds_array = [[min_lat, min_lon], [max_lat, max_lon]] \
if max_bounds else None
self.crs = crs
self.control_scale = control_scale
self.options = parse_options(
max_bounds=max_bounds_array,
zoom=zoom_start,
zoom_control=zoom_control,
prefer_canvas=prefer_canvas,
self.png_enabled = png_enabled
if location is None:
# If location is not passed we center and zoom out.
self.location = [0, 0]
zoom_start = 1
else:
self.location = validate_location(location)
Figure().add_child(self)
# Map Size Parameters.
self.width = _parse_size(width)
self.height = _parse_size(height)
self.left = _parse_size(left)
self.top = _parse_size(top)
self.position = position
max_bounds_array = [[min_lat, min_lon], [max_lat, max_lon]] \
if max_bounds else None
self.crs = crs
self.control_scale = control_scale
self.options = parse_options(
max_bounds=max_bounds_array,
zoom=zoom_start,
zoom_control=zoom_control,
prefer_canvas=prefer_canvas,
**kwargs
)