diff --git a/docs/index.html b/docs/index.html index 7c905a25a9..849d55dc60 100644 --- a/docs/index.html +++ b/docs/index.html @@ -95,6 +95,14 @@
h2o_q
visualization()
.vega_visualization()
.Display a plot inside a form.
+from synth import FakeCategoricalSeries
+from h2o_q import site, data, ui
+
+page = site['/demo']
+
+n = 20
+f = FakeCategoricalSeries()
+v = page.add('example', ui.form_card(
+ box='1 1 4 5',
+ items=[
+ ui.text_xl('Example 1'),
+ ui.visualization(
+ plot=ui.plot([ui.mark(type='interval', x='=product', y='=price', y_min=0)]),
+ data=data(fields='product price', rows=[(c, x) for c, x, _ in [f.next() for _ in range(n)]], pack=True),
+ ),
+ ui.text_xl('Example 2'),
+ ui.visualization(
+ plot=ui.plot([ui.mark(type='interval', x='=product', y='=price', y_min=0)]),
+ data=data(fields='product price', rows=[(c, x) for c, x, _ in [f.next() for _ in range(n)]], pack=True),
+ ),
+ ],
+))
+
page.save()
Display a Vega-lite plot inside a form card
+from h2o_q import site, data, ui
+import random
+import time
+
+page = site['/demo']
+
+spec = '''
+{
+ "description": "A simple bar plot with embedded data.",
+ "mark": "bar",
+ "encoding": {
+ "x": {"field": "a", "type": "ordinal"},
+ "y": {"field": "b", "type": "quantitative"}
+ }
+}
+'''
+
+
+# Get data rows for our plot.
+# Typically, this data would be read from some external data source.
+def poll():
+ return [
+ ["A", rnd()], ["B", rnd()], ["C", rnd()],
+ ["D", rnd()], ["E", rnd()], ["F", rnd()],
+ ["G", rnd()], ["H", rnd()], ["I", rnd()]
+ ]
+
+
+# Generate random datum between 1 and 100
+def rnd(): return random.randint(1, 100)
+
+
+page['example'] = ui.form_card(
+ box='1 1 2 -1',
+ items=[
+ ui.text_xl('Example 1'),
+ ui.vega_visualization(
+ specification=spec,
+ data=data(fields=["a", "b"], rows=poll(), pack=True),
+ ),
+ ui.text_xl('Example 2'),
+ ui.vega_visualization(
+ specification=spec,
+ data=data(fields=["a", "b"], rows=poll(), pack=True),
+ ),
+ ui.text_xl('Example 3'),
+ ui.vega_visualization(
+ specification=spec,
+ data=data(fields=["a", "b"], rows=poll(), pack=True),
+ ),
+ ],
+)
+
+page.save()
+
Use Altair to create plot specifications for the Vega card.
import altair
@@ -5236,8 +5328,10 @@ Index
- Plot / Area + Line / Groups
- Plot / Polygon
- Plot / Histogram
+- Plot / Form
- Plot / Vega-lite
- Plot / Vega-lite / Update
+- Plot / Vega-lite / Form
- Plot / Altair
- Plot / Bokeh
- Plot / Matplotlib
diff --git a/docs/types.html b/docs/types.html
index 6432066279..abd369f2c0 100644
--- a/docs/types.html
+++ b/docs/types.html
@@ -2649,6 +2649,547 @@ Module h2o_q.types
)
+class Mark:
+ """Create a specification for a layer of graphical marks such as bars, lines, points for a plot.
+ A plot can contain multiple such layers of marks.
+ """
+ def __init__(
+ self,
+ coord: Optional[str] = None,
+ type: Optional[str] = None,
+ x: Optional[Value] = None,
+ x0: Optional[Value] = None,
+ x1: Optional[Value] = None,
+ x2: Optional[Value] = None,
+ x_min: Optional[float] = None,
+ x_max: Optional[float] = None,
+ x_nice: Optional[bool] = None,
+ x_scale: Optional[str] = None,
+ x_title: Optional[str] = None,
+ y: Optional[Value] = None,
+ y0: Optional[Value] = None,
+ y1: Optional[Value] = None,
+ y2: Optional[Value] = None,
+ y_min: Optional[float] = None,
+ y_max: Optional[float] = None,
+ y_nice: Optional[bool] = None,
+ y_scale: Optional[str] = None,
+ y_title: Optional[str] = None,
+ color: Optional[str] = None,
+ color_range: Optional[str] = None,
+ shape: Optional[str] = None,
+ shape_range: Optional[str] = None,
+ size: Optional[Value] = None,
+ size_range: Optional[str] = None,
+ stack: Optional[str] = None,
+ dodge: Optional[str] = None,
+ curve: Optional[str] = None,
+ fill_color: Optional[str] = None,
+ fill_opacity: Optional[float] = None,
+ stroke_color: Optional[str] = None,
+ stroke_opacity: Optional[float] = None,
+ stroke_size: Optional[float] = None,
+ stroke_dash: Optional[str] = None,
+ label: Optional[str] = None,
+ label_offset: Optional[float] = None,
+ label_offset_x: Optional[float] = None,
+ label_offset_y: Optional[float] = None,
+ label_rotation: Optional[str] = None,
+ label_position: Optional[str] = None,
+ label_overlap: Optional[str] = None,
+ label_fill_color: Optional[str] = None,
+ label_fill_opacity: Optional[float] = None,
+ label_stroke_color: Optional[str] = None,
+ label_stroke_opacity: Optional[float] = None,
+ label_stroke_size: Optional[float] = None,
+ label_font_size: Optional[float] = None,
+ label_font_weight: Optional[str] = None,
+ label_line_height: Optional[float] = None,
+ label_align: Optional[str] = None,
+ ref_stroke_color: Optional[str] = None,
+ ref_stroke_opacity: Optional[float] = None,
+ ref_stroke_size: Optional[float] = None,
+ ref_stroke_dash: Optional[str] = None,
+ ):
+ self.coord = coord
+ """Coordinate system. `rect` is synonymous to `cartesian`. `theta` is transposed `polar`. One of 'rect', 'cartesian', 'polar', 'theta', 'helix'."""
+ self.type = type
+ """Graphical geometry. One of 'interval', 'line', 'path', 'point', 'area', 'polygon', 'schema', 'edge', 'heatmap'."""
+ self.x = x
+ """X field or value."""
+ self.x0 = x0
+ """X base field or value."""
+ self.x1 = x1
+ """X bin lower bound field or value. For histograms."""
+ self.x2 = x2
+ """X bin upper bound field or value. For histograms."""
+ self.x_min = x_min
+ """X axis scale minimum."""
+ self.x_max = x_max
+ """X axis scale maximum."""
+ self.x_nice = x_nice
+ """Whether to nice X axis scale ticks."""
+ self.x_scale = x_scale
+ """X axis scale type. One of 'linear', 'cat', 'category', 'identity', 'log', 'pow', 'time', 'timeCat', 'quantize', 'quantile'."""
+ self.x_title = x_title
+ """X axis title."""
+ self.y = y
+ """Y field or value."""
+ self.y0 = y0
+ """Y base field or value."""
+ self.y1 = y1
+ """Y bin lower bound field or value. For histograms."""
+ self.y2 = y2
+ """Y bin upper bound field or value. For histograms."""
+ self.y_min = y_min
+ """Y axis scale minimum."""
+ self.y_max = y_max
+ """Y axis scale maximum."""
+ self.y_nice = y_nice
+ """Whether to nice Y axis scale ticks."""
+ self.y_scale = y_scale
+ """Y axis scale type. One of 'linear', 'cat', 'category', 'identity', 'log', 'pow', 'time', 'timeCat', 'quantize', 'quantile'."""
+ self.y_title = y_title
+ """Y axis title."""
+ self.color = color
+ """Mark color field or value."""
+ self.color_range = color_range
+ """Mark color range for multi-series plots. A string containing space-separated colors, e.g. `'#fee8c8 #fdbb84 #e34a33'`"""
+ self.shape = shape
+ """Mark shape field or value for `point` mark types. Possible values are 'circle', 'square', 'bowtie', 'diamond', 'hexagon', 'triangle', 'triangle-down', 'cross', 'tick', 'plus', 'hyphen', 'line'."""
+ self.shape_range = shape_range
+ """Mark shape range for multi-series plots using `point` mark types. A string containing space-separated shapes, e.g. `'circle square diamond'`"""
+ self.size = size
+ """Mark size field or value."""
+ self.size_range = size_range
+ """Mark size range. A string containing space-separated integers, e.g. `'4 30'`"""
+ self.stack = stack
+ """Field to stack marks by, or 'auto' to infer."""
+ self.dodge = dodge
+ """Field to dodge marks by, or 'auto' to infer."""
+ self.curve = curve
+ """Curve type for `line` and `area` mark types. One of 'none', 'smooth', 'step-before', 'step', 'step-after'."""
+ self.fill_color = fill_color
+ """Mark fill color."""
+ self.fill_opacity = fill_opacity
+ """Mark fill opacity."""
+ self.stroke_color = stroke_color
+ """Mark stroke color."""
+ self.stroke_opacity = stroke_opacity
+ """Mark stroke opacity."""
+ self.stroke_size = stroke_size
+ """Mark stroke size."""
+ self.stroke_dash = stroke_dash
+ """Mark stroke dash style. A string containing space-separated integers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]."""
+ self.label = label
+ """Label field or value."""
+ self.label_offset = label_offset
+ """Distance between label and mark."""
+ self.label_offset_x = label_offset_x
+ """Horizontal distance between label and mark."""
+ self.label_offset_y = label_offset_y
+ """Vertical distance between label and mark."""
+ self.label_rotation = label_rotation
+ """Label rotation angle, in degrees, or 'none' to disable automatic rotation. The default behavior is 'auto' for automatic rotation."""
+ self.label_position = label_position
+ """Label position relative to the mark. One of 'top', 'bottom', 'middle', 'left', 'right'."""
+ self.label_overlap = label_overlap
+ """Strategy to use if labels overlap. One of 'hide', 'overlap', 'constrain'."""
+ self.label_fill_color = label_fill_color
+ """Label fill color."""
+ self.label_fill_opacity = label_fill_opacity
+ """Label fill opacity."""
+ self.label_stroke_color = label_stroke_color
+ """Label stroke color."""
+ self.label_stroke_opacity = label_stroke_opacity
+ """Label stroke opacity."""
+ self.label_stroke_size = label_stroke_size
+ """Label stroke size (line width or pen thickness)."""
+ self.label_font_size = label_font_size
+ """Label font size."""
+ self.label_font_weight = label_font_weight
+ """Label font weight."""
+ self.label_line_height = label_line_height
+ """Label line height."""
+ self.label_align = label_align
+ """Label text alignment. One of 'left', 'right', 'center', 'start', 'end'."""
+ self.ref_stroke_color = ref_stroke_color
+ """Reference line stroke color."""
+ self.ref_stroke_opacity = ref_stroke_opacity
+ """Reference line stroke opacity."""
+ self.ref_stroke_size = ref_stroke_size
+ """Reference line stroke size (line width or pen thickness)."""
+ self.ref_stroke_dash = ref_stroke_dash
+ """Reference line stroke dash style. A string containing space-separated integers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]."""
+
+ def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ return _dump(
+ coord=self.coord,
+ type=self.type,
+ x=self.x,
+ x0=self.x0,
+ x1=self.x1,
+ x2=self.x2,
+ x_min=self.x_min,
+ x_max=self.x_max,
+ x_nice=self.x_nice,
+ x_scale=self.x_scale,
+ x_title=self.x_title,
+ y=self.y,
+ y0=self.y0,
+ y1=self.y1,
+ y2=self.y2,
+ y_min=self.y_min,
+ y_max=self.y_max,
+ y_nice=self.y_nice,
+ y_scale=self.y_scale,
+ y_title=self.y_title,
+ color=self.color,
+ color_range=self.color_range,
+ shape=self.shape,
+ shape_range=self.shape_range,
+ size=self.size,
+ size_range=self.size_range,
+ stack=self.stack,
+ dodge=self.dodge,
+ curve=self.curve,
+ fill_color=self.fill_color,
+ fill_opacity=self.fill_opacity,
+ stroke_color=self.stroke_color,
+ stroke_opacity=self.stroke_opacity,
+ stroke_size=self.stroke_size,
+ stroke_dash=self.stroke_dash,
+ label=self.label,
+ label_offset=self.label_offset,
+ label_offset_x=self.label_offset_x,
+ label_offset_y=self.label_offset_y,
+ label_rotation=self.label_rotation,
+ label_position=self.label_position,
+ label_overlap=self.label_overlap,
+ label_fill_color=self.label_fill_color,
+ label_fill_opacity=self.label_fill_opacity,
+ label_stroke_color=self.label_stroke_color,
+ label_stroke_opacity=self.label_stroke_opacity,
+ label_stroke_size=self.label_stroke_size,
+ label_font_size=self.label_font_size,
+ label_font_weight=self.label_font_weight,
+ label_line_height=self.label_line_height,
+ label_align=self.label_align,
+ ref_stroke_color=self.ref_stroke_color,
+ ref_stroke_opacity=self.ref_stroke_opacity,
+ ref_stroke_size=self.ref_stroke_size,
+ ref_stroke_dash=self.ref_stroke_dash,
+ )
+
+ @staticmethod
+ def load(__d: Dict) -> 'Mark':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_coord: Any = __d.get('coord')
+ __d_type: Any = __d.get('type')
+ __d_x: Any = __d.get('x')
+ __d_x0: Any = __d.get('x0')
+ __d_x1: Any = __d.get('x1')
+ __d_x2: Any = __d.get('x2')
+ __d_x_min: Any = __d.get('x_min')
+ __d_x_max: Any = __d.get('x_max')
+ __d_x_nice: Any = __d.get('x_nice')
+ __d_x_scale: Any = __d.get('x_scale')
+ __d_x_title: Any = __d.get('x_title')
+ __d_y: Any = __d.get('y')
+ __d_y0: Any = __d.get('y0')
+ __d_y1: Any = __d.get('y1')
+ __d_y2: Any = __d.get('y2')
+ __d_y_min: Any = __d.get('y_min')
+ __d_y_max: Any = __d.get('y_max')
+ __d_y_nice: Any = __d.get('y_nice')
+ __d_y_scale: Any = __d.get('y_scale')
+ __d_y_title: Any = __d.get('y_title')
+ __d_color: Any = __d.get('color')
+ __d_color_range: Any = __d.get('color_range')
+ __d_shape: Any = __d.get('shape')
+ __d_shape_range: Any = __d.get('shape_range')
+ __d_size: Any = __d.get('size')
+ __d_size_range: Any = __d.get('size_range')
+ __d_stack: Any = __d.get('stack')
+ __d_dodge: Any = __d.get('dodge')
+ __d_curve: Any = __d.get('curve')
+ __d_fill_color: Any = __d.get('fill_color')
+ __d_fill_opacity: Any = __d.get('fill_opacity')
+ __d_stroke_color: Any = __d.get('stroke_color')
+ __d_stroke_opacity: Any = __d.get('stroke_opacity')
+ __d_stroke_size: Any = __d.get('stroke_size')
+ __d_stroke_dash: Any = __d.get('stroke_dash')
+ __d_label: Any = __d.get('label')
+ __d_label_offset: Any = __d.get('label_offset')
+ __d_label_offset_x: Any = __d.get('label_offset_x')
+ __d_label_offset_y: Any = __d.get('label_offset_y')
+ __d_label_rotation: Any = __d.get('label_rotation')
+ __d_label_position: Any = __d.get('label_position')
+ __d_label_overlap: Any = __d.get('label_overlap')
+ __d_label_fill_color: Any = __d.get('label_fill_color')
+ __d_label_fill_opacity: Any = __d.get('label_fill_opacity')
+ __d_label_stroke_color: Any = __d.get('label_stroke_color')
+ __d_label_stroke_opacity: Any = __d.get('label_stroke_opacity')
+ __d_label_stroke_size: Any = __d.get('label_stroke_size')
+ __d_label_font_size: Any = __d.get('label_font_size')
+ __d_label_font_weight: Any = __d.get('label_font_weight')
+ __d_label_line_height: Any = __d.get('label_line_height')
+ __d_label_align: Any = __d.get('label_align')
+ __d_ref_stroke_color: Any = __d.get('ref_stroke_color')
+ __d_ref_stroke_opacity: Any = __d.get('ref_stroke_opacity')
+ __d_ref_stroke_size: Any = __d.get('ref_stroke_size')
+ __d_ref_stroke_dash: Any = __d.get('ref_stroke_dash')
+ coord: Optional[str] = __d_coord
+ type: Optional[str] = __d_type
+ x: Optional[Value] = __d_x
+ x0: Optional[Value] = __d_x0
+ x1: Optional[Value] = __d_x1
+ x2: Optional[Value] = __d_x2
+ x_min: Optional[float] = __d_x_min
+ x_max: Optional[float] = __d_x_max
+ x_nice: Optional[bool] = __d_x_nice
+ x_scale: Optional[str] = __d_x_scale
+ x_title: Optional[str] = __d_x_title
+ y: Optional[Value] = __d_y
+ y0: Optional[Value] = __d_y0
+ y1: Optional[Value] = __d_y1
+ y2: Optional[Value] = __d_y2
+ y_min: Optional[float] = __d_y_min
+ y_max: Optional[float] = __d_y_max
+ y_nice: Optional[bool] = __d_y_nice
+ y_scale: Optional[str] = __d_y_scale
+ y_title: Optional[str] = __d_y_title
+ color: Optional[str] = __d_color
+ color_range: Optional[str] = __d_color_range
+ shape: Optional[str] = __d_shape
+ shape_range: Optional[str] = __d_shape_range
+ size: Optional[Value] = __d_size
+ size_range: Optional[str] = __d_size_range
+ stack: Optional[str] = __d_stack
+ dodge: Optional[str] = __d_dodge
+ curve: Optional[str] = __d_curve
+ fill_color: Optional[str] = __d_fill_color
+ fill_opacity: Optional[float] = __d_fill_opacity
+ stroke_color: Optional[str] = __d_stroke_color
+ stroke_opacity: Optional[float] = __d_stroke_opacity
+ stroke_size: Optional[float] = __d_stroke_size
+ stroke_dash: Optional[str] = __d_stroke_dash
+ label: Optional[str] = __d_label
+ label_offset: Optional[float] = __d_label_offset
+ label_offset_x: Optional[float] = __d_label_offset_x
+ label_offset_y: Optional[float] = __d_label_offset_y
+ label_rotation: Optional[str] = __d_label_rotation
+ label_position: Optional[str] = __d_label_position
+ label_overlap: Optional[str] = __d_label_overlap
+ label_fill_color: Optional[str] = __d_label_fill_color
+ label_fill_opacity: Optional[float] = __d_label_fill_opacity
+ label_stroke_color: Optional[str] = __d_label_stroke_color
+ label_stroke_opacity: Optional[float] = __d_label_stroke_opacity
+ label_stroke_size: Optional[float] = __d_label_stroke_size
+ label_font_size: Optional[float] = __d_label_font_size
+ label_font_weight: Optional[str] = __d_label_font_weight
+ label_line_height: Optional[float] = __d_label_line_height
+ label_align: Optional[str] = __d_label_align
+ ref_stroke_color: Optional[str] = __d_ref_stroke_color
+ ref_stroke_opacity: Optional[float] = __d_ref_stroke_opacity
+ ref_stroke_size: Optional[float] = __d_ref_stroke_size
+ ref_stroke_dash: Optional[str] = __d_ref_stroke_dash
+ return Mark(
+ coord,
+ type,
+ x,
+ x0,
+ x1,
+ x2,
+ x_min,
+ x_max,
+ x_nice,
+ x_scale,
+ x_title,
+ y,
+ y0,
+ y1,
+ y2,
+ y_min,
+ y_max,
+ y_nice,
+ y_scale,
+ y_title,
+ color,
+ color_range,
+ shape,
+ shape_range,
+ size,
+ size_range,
+ stack,
+ dodge,
+ curve,
+ fill_color,
+ fill_opacity,
+ stroke_color,
+ stroke_opacity,
+ stroke_size,
+ stroke_dash,
+ label,
+ label_offset,
+ label_offset_x,
+ label_offset_y,
+ label_rotation,
+ label_position,
+ label_overlap,
+ label_fill_color,
+ label_fill_opacity,
+ label_stroke_color,
+ label_stroke_opacity,
+ label_stroke_size,
+ label_font_size,
+ label_font_weight,
+ label_line_height,
+ label_align,
+ ref_stroke_color,
+ ref_stroke_opacity,
+ ref_stroke_size,
+ ref_stroke_dash,
+ )
+
+
+class Plot:
+ """Create a plot. A plot is composed of one or more graphical mark layers.
+ """
+ def __init__(
+ self,
+ marks: List[Mark],
+ ):
+ self.marks = marks
+ """The graphical mark layers contained in this plot."""
+
+ def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.marks is None:
+ raise ValueError('Plot.marks is required.')
+ return _dump(
+ marks=[__e.dump() for __e in self.marks],
+ )
+
+ @staticmethod
+ def load(__d: Dict) -> 'Plot':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_marks: Any = __d.get('marks')
+ if __d_marks is None:
+ raise ValueError('Plot.marks is required.')
+ marks: List[Mark] = [Mark.load(__e) for __e in __d_marks]
+ return Plot(
+ marks,
+ )
+
+
+class Visualization:
+ """Create a visualization for display inside a form.
+ """
+ def __init__(
+ self,
+ plot: Plot,
+ data: PackedRecord,
+ width: Optional[str] = None,
+ height: Optional[str] = None,
+ ):
+ self.plot = plot
+ """The plot to be rendered in this visualization."""
+ self.data = data
+ """Data for this visualization."""
+ self.width = width
+ """The width of the visualization. Defaults to 100%."""
+ self.height = height
+ """The height of the visualization. Defaults to 300px."""
+
+ def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.plot is None:
+ raise ValueError('Visualization.plot is required.')
+ if self.data is None:
+ raise ValueError('Visualization.data is required.')
+ return _dump(
+ plot=self.plot.dump(),
+ data=self.data,
+ width=self.width,
+ height=self.height,
+ )
+
+ @staticmethod
+ def load(__d: Dict) -> 'Visualization':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_plot: Any = __d.get('plot')
+ if __d_plot is None:
+ raise ValueError('Visualization.plot is required.')
+ __d_data: Any = __d.get('data')
+ if __d_data is None:
+ raise ValueError('Visualization.data is required.')
+ __d_width: Any = __d.get('width')
+ __d_height: Any = __d.get('height')
+ plot: Plot = Plot.load(__d_plot)
+ data: PackedRecord = __d_data
+ width: Optional[str] = __d_width
+ height: Optional[str] = __d_height
+ return Visualization(
+ plot,
+ data,
+ width,
+ height,
+ )
+
+
+class VegaVisualization:
+ """Create a Vega-lite plot for display inside a form.
+ """
+ def __init__(
+ self,
+ specification: str,
+ data: Optional[PackedRecord] = None,
+ width: Optional[str] = None,
+ height: Optional[str] = None,
+ ):
+ self.specification = specification
+ """The Vega-lite specification."""
+ self.data = data
+ """Data for the plot, if any."""
+ self.width = width
+ """The width of the visualization. Defaults to 100%."""
+ self.height = height
+ """The height of the visualization. Defaults to 300px."""
+
+ def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.specification is None:
+ raise ValueError('VegaVisualization.specification is required.')
+ return _dump(
+ specification=self.specification,
+ data=self.data,
+ width=self.width,
+ height=self.height,
+ )
+
+ @staticmethod
+ def load(__d: Dict) -> 'VegaVisualization':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_specification: Any = __d.get('specification')
+ if __d_specification is None:
+ raise ValueError('VegaVisualization.specification is required.')
+ __d_data: Any = __d.get('data')
+ __d_width: Any = __d.get('width')
+ __d_height: Any = __d.get('height')
+ specification: str = __d_specification
+ data: Optional[PackedRecord] = __d_data
+ width: Optional[str] = __d_width
+ height: Optional[str] = __d_height
+ return VegaVisualization(
+ specification,
+ data,
+ width,
+ height,
+ )
+
+
class Component:
"""Create a component.
"""
@@ -2686,6 +3227,8 @@ Module h2o_q.types
picker: Optional[Picker] = None,
range_slider: Optional[RangeSlider] = None,
stepper: Optional[Stepper] = None,
+ visualization: Optional[Visualization] = None,
+ vega_visualization: Optional[VegaVisualization] = None,
):
self.text = text
"""Text block."""
@@ -2744,13 +3287,17 @@ Module h2o_q.types
self.expander = expander
"""Expander."""
self.frame = frame
- """Frame"""
+ """Frame."""
self.picker = picker
- """Picker"""
+ """Picker."""
self.range_slider = range_slider
- """RangeSlider"""
+ """Range Slider."""
self.stepper = stepper
- """Stepper"""
+ """Stepper."""
+ self.visualization = visualization
+ """Visualization."""
+ self.vega_visualization = vega_visualization
+ """Vega-lite Visualization."""
def dump(self) -> Dict:
"""Returns the contents of this object as a dict."""
@@ -2787,6 +3334,8 @@ Module h2o_q.types
picker=None if self.picker is None else self.picker.dump(),
range_slider=None if self.range_slider is None else self.range_slider.dump(),
stepper=None if self.stepper is None else self.stepper.dump(),
+ visualization=None if self.visualization is None else self.visualization.dump(),
+ vega_visualization=None if self.vega_visualization is None else self.vega_visualization.dump(),
)
@staticmethod
@@ -2824,6 +3373,8 @@ Module h2o_q.types
__d_picker: Any = __d.get('picker')
__d_range_slider: Any = __d.get('range_slider')
__d_stepper: Any = __d.get('stepper')
+ __d_visualization: Any = __d.get('visualization')
+ __d_vega_visualization: Any = __d.get('vega_visualization')
text: Optional[Text] = None if __d_text is None else Text.load(__d_text)
text_xl: Optional[TextXl] = None if __d_text_xl is None else TextXl.load(__d_text_xl)
text_l: Optional[TextL] = None if __d_text_l is None else TextL.load(__d_text_l)
@@ -2856,6 +3407,8 @@ Module h2o_q.types
picker: Optional[Picker] = None if __d_picker is None else Picker.load(__d_picker)
range_slider: Optional[RangeSlider] = None if __d_range_slider is None else RangeSlider.load(__d_range_slider)
stepper: Optional[Stepper] = None if __d_stepper is None else Stepper.load(__d_stepper)
+ visualization: Optional[Visualization] = None if __d_visualization is None else Visualization.load(__d_visualization)
+ vega_visualization: Optional[VegaVisualization] = None if __d_vega_visualization is None else VegaVisualization.load(__d_vega_visualization)
return Component(
text,
text_xl,
@@ -2889,6 +3442,8 @@ Module h2o_q.types
picker,
range_slider,
stepper,
+ visualization,
+ vega_visualization,
)
@@ -3925,600 +4480,165 @@ Module h2o_q.types
"""Creates an instance of this class using the contents of a dict."""
__d_name: Any = __d.get('name')
if __d_name is None:
- raise ValueError('NavItem.name is required.')
- __d_label: Any = __d.get('label')
- if __d_label is None:
- raise ValueError('NavItem.label is required.')
- name: str = __d_name
- label: str = __d_label
- return NavItem(
- name,
- label,
- )
-
-
-class NavGroup:
- """Create a group of navigation items.
- """
- def __init__(
- self,
- label: str,
- items: List[NavItem],
- ):
- self.label = label
- """The label to display for this group."""
- self.items = items
- """The navigation items contained in this group."""
-
- def dump(self) -> Dict:
- """Returns the contents of this object as a dict."""
- if self.label is None:
- raise ValueError('NavGroup.label is required.')
- if self.items is None:
- raise ValueError('NavGroup.items is required.')
- return _dump(
- label=self.label,
- items=[__e.dump() for __e in self.items],
- )
-
- @staticmethod
- def load(__d: Dict) -> 'NavGroup':
- """Creates an instance of this class using the contents of a dict."""
- __d_label: Any = __d.get('label')
- if __d_label is None:
- raise ValueError('NavGroup.label is required.')
- __d_items: Any = __d.get('items')
- if __d_items is None:
- raise ValueError('NavGroup.items is required.')
- label: str = __d_label
- items: List[NavItem] = [NavItem.load(__e) for __e in __d_items]
- return NavGroup(
- label,
- items,
- )
-
-
-class NavCard:
- """Create a card containing a navigation pane.
- """
- def __init__(
- self,
- box: str,
- items: List[NavGroup],
- commands: Optional[List[Command]] = None,
- ):
- self.box = box
- """A string indicating how to place this component on the page."""
- self.items = items
- """The navigation groups contained in this pane."""
- self.commands = commands
- """Contextual menu commands for this component."""
-
- def dump(self) -> Dict:
- """Returns the contents of this object as a dict."""
- if self.box is None:
- raise ValueError('NavCard.box is required.')
- if self.items is None:
- raise ValueError('NavCard.items is required.')
- return _dump(
- view='nav',
- box=self.box,
- items=[__e.dump() for __e in self.items],
- commands=None if self.commands is None else [__e.dump() for __e in self.commands],
- )
-
- @staticmethod
- def load(__d: Dict) -> 'NavCard':
- """Creates an instance of this class using the contents of a dict."""
- __d_box: Any = __d.get('box')
- if __d_box is None:
- raise ValueError('NavCard.box is required.')
- __d_items: Any = __d.get('items')
- if __d_items is None:
- raise ValueError('NavCard.items is required.')
- __d_commands: Any = __d.get('commands')
- box: str = __d_box
- items: List[NavGroup] = [NavGroup.load(__e) for __e in __d_items]
- commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands]
- return NavCard(
- box,
- items,
- commands,
- )
-
-
-class PixelArtCard:
- """Create a card displaying a collaborative Pixel art tool, just for kicks.
- """
- def __init__(
- self,
- box: str,
- title: str,
- data: PackedRecord,
- commands: Optional[List[Command]] = None,
- ):
- self.box = box
- """A string indicating how to place this component on the page."""
- self.title = title
- """The title for this card."""
- self.data = data
- """The data for this card."""
- self.commands = commands
- """Contextual menu commands for this component."""
-
- def dump(self) -> Dict:
- """Returns the contents of this object as a dict."""
- if self.box is None:
- raise ValueError('PixelArtCard.box is required.')
- if self.title is None:
- raise ValueError('PixelArtCard.title is required.')
- if self.data is None:
- raise ValueError('PixelArtCard.data is required.')
- return _dump(
- view='pixel_art',
- box=self.box,
- title=self.title,
- data=self.data,
- commands=None if self.commands is None else [__e.dump() for __e in self.commands],
- )
-
- @staticmethod
- def load(__d: Dict) -> 'PixelArtCard':
- """Creates an instance of this class using the contents of a dict."""
- __d_box: Any = __d.get('box')
- if __d_box is None:
- raise ValueError('PixelArtCard.box is required.')
- __d_title: Any = __d.get('title')
- if __d_title is None:
- raise ValueError('PixelArtCard.title is required.')
- __d_data: Any = __d.get('data')
- if __d_data is None:
- raise ValueError('PixelArtCard.data is required.')
- __d_commands: Any = __d.get('commands')
- box: str = __d_box
- title: str = __d_title
- data: PackedRecord = __d_data
- commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands]
- return PixelArtCard(
- box,
- title,
- data,
- commands,
+ raise ValueError('NavItem.name is required.')
+ __d_label: Any = __d.get('label')
+ if __d_label is None:
+ raise ValueError('NavItem.label is required.')
+ name: str = __d_name
+ label: str = __d_label
+ return NavItem(
+ name,
+ label,
)
-class Mark:
- """Create a specification for a layer of graphical marks such as bars, lines, points for a plot.
- A plot can contain multiple such layers of marks.
+class NavGroup:
+ """Create a group of navigation items.
"""
def __init__(
self,
- coord: Optional[str] = None,
- type: Optional[str] = None,
- x: Optional[Value] = None,
- x0: Optional[Value] = None,
- x1: Optional[Value] = None,
- x2: Optional[Value] = None,
- x_min: Optional[float] = None,
- x_max: Optional[float] = None,
- x_nice: Optional[bool] = None,
- x_scale: Optional[str] = None,
- x_title: Optional[str] = None,
- y: Optional[Value] = None,
- y0: Optional[Value] = None,
- y1: Optional[Value] = None,
- y2: Optional[Value] = None,
- y_min: Optional[float] = None,
- y_max: Optional[float] = None,
- y_nice: Optional[bool] = None,
- y_scale: Optional[str] = None,
- y_title: Optional[str] = None,
- color: Optional[str] = None,
- color_range: Optional[str] = None,
- shape: Optional[str] = None,
- shape_range: Optional[str] = None,
- size: Optional[Value] = None,
- size_range: Optional[str] = None,
- stack: Optional[str] = None,
- dodge: Optional[str] = None,
- curve: Optional[str] = None,
- fill_color: Optional[str] = None,
- fill_opacity: Optional[float] = None,
- stroke_color: Optional[str] = None,
- stroke_opacity: Optional[float] = None,
- stroke_size: Optional[float] = None,
- stroke_dash: Optional[str] = None,
- label: Optional[str] = None,
- label_offset: Optional[float] = None,
- label_offset_x: Optional[float] = None,
- label_offset_y: Optional[float] = None,
- label_rotation: Optional[str] = None,
- label_position: Optional[str] = None,
- label_overlap: Optional[str] = None,
- label_fill_color: Optional[str] = None,
- label_fill_opacity: Optional[float] = None,
- label_stroke_color: Optional[str] = None,
- label_stroke_opacity: Optional[float] = None,
- label_stroke_size: Optional[float] = None,
- label_font_size: Optional[float] = None,
- label_font_weight: Optional[str] = None,
- label_line_height: Optional[float] = None,
- label_align: Optional[str] = None,
- ref_stroke_color: Optional[str] = None,
- ref_stroke_opacity: Optional[float] = None,
- ref_stroke_size: Optional[float] = None,
- ref_stroke_dash: Optional[str] = None,
+ label: str,
+ items: List[NavItem],
):
- self.coord = coord
- """Coordinate system. `rect` is synonymous to `cartesian`. `theta` is transposed `polar`. One of 'rect', 'cartesian', 'polar', 'theta', 'helix'."""
- self.type = type
- """Graphical geometry. One of 'interval', 'line', 'path', 'point', 'area', 'polygon', 'schema', 'edge', 'heatmap'."""
- self.x = x
- """X field or value."""
- self.x0 = x0
- """X base field or value."""
- self.x1 = x1
- """X bin lower bound field or value. For histograms."""
- self.x2 = x2
- """X bin upper bound field or value. For histograms."""
- self.x_min = x_min
- """X axis scale minimum."""
- self.x_max = x_max
- """X axis scale maximum."""
- self.x_nice = x_nice
- """Whether to nice X axis scale ticks."""
- self.x_scale = x_scale
- """X axis scale type. One of 'linear', 'cat', 'category', 'identity', 'log', 'pow', 'time', 'timeCat', 'quantize', 'quantile'."""
- self.x_title = x_title
- """X axis title."""
- self.y = y
- """Y field or value."""
- self.y0 = y0
- """Y base field or value."""
- self.y1 = y1
- """Y bin lower bound field or value. For histograms."""
- self.y2 = y2
- """Y bin upper bound field or value. For histograms."""
- self.y_min = y_min
- """Y axis scale minimum."""
- self.y_max = y_max
- """Y axis scale maximum."""
- self.y_nice = y_nice
- """Whether to nice Y axis scale ticks."""
- self.y_scale = y_scale
- """Y axis scale type. One of 'linear', 'cat', 'category', 'identity', 'log', 'pow', 'time', 'timeCat', 'quantize', 'quantile'."""
- self.y_title = y_title
- """Y axis title."""
- self.color = color
- """Mark color field or value."""
- self.color_range = color_range
- """Mark color range for multi-series plots. A string containing space-separated colors, e.g. `'#fee8c8 #fdbb84 #e34a33'`"""
- self.shape = shape
- """Mark shape field or value for `point` mark types. Possible values are 'circle', 'square', 'bowtie', 'diamond', 'hexagon', 'triangle', 'triangle-down', 'cross', 'tick', 'plus', 'hyphen', 'line'."""
- self.shape_range = shape_range
- """Mark shape range for multi-series plots using `point` mark types. A string containing space-separated shapes, e.g. `'circle square diamond'`"""
- self.size = size
- """Mark size field or value."""
- self.size_range = size_range
- """Mark size range. A string containing space-separated integers, e.g. `'4 30'`"""
- self.stack = stack
- """Field to stack marks by, or 'auto' to infer."""
- self.dodge = dodge
- """Field to dodge marks by, or 'auto' to infer."""
- self.curve = curve
- """Curve type for `line` and `area` mark types. One of 'none', 'smooth', 'step-before', 'step', 'step-after'."""
- self.fill_color = fill_color
- """Mark fill color."""
- self.fill_opacity = fill_opacity
- """Mark fill opacity."""
- self.stroke_color = stroke_color
- """Mark stroke color."""
- self.stroke_opacity = stroke_opacity
- """Mark stroke opacity."""
- self.stroke_size = stroke_size
- """Mark stroke size."""
- self.stroke_dash = stroke_dash
- """Mark stroke dash style. A string containing space-separated integers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]."""
self.label = label
- """Label field or value."""
- self.label_offset = label_offset
- """Distance between label and mark."""
- self.label_offset_x = label_offset_x
- """Horizontal distance between label and mark."""
- self.label_offset_y = label_offset_y
- """Vertical distance between label and mark."""
- self.label_rotation = label_rotation
- """Label rotation angle, in degrees, or 'none' to disable automatic rotation. The default behavior is 'auto' for automatic rotation."""
- self.label_position = label_position
- """Label position relative to the mark. One of 'top', 'bottom', 'middle', 'left', 'right'."""
- self.label_overlap = label_overlap
- """Strategy to use if labels overlap. One of 'hide', 'overlap', 'constrain'."""
- self.label_fill_color = label_fill_color
- """Label fill color."""
- self.label_fill_opacity = label_fill_opacity
- """Label fill opacity."""
- self.label_stroke_color = label_stroke_color
- """Label stroke color."""
- self.label_stroke_opacity = label_stroke_opacity
- """Label stroke opacity."""
- self.label_stroke_size = label_stroke_size
- """Label stroke size (line width or pen thickness)."""
- self.label_font_size = label_font_size
- """Label font size."""
- self.label_font_weight = label_font_weight
- """Label font weight."""
- self.label_line_height = label_line_height
- """Label line height."""
- self.label_align = label_align
- """Label text alignment. One of 'left', 'right', 'center', 'start', 'end'."""
- self.ref_stroke_color = ref_stroke_color
- """Reference line stroke color."""
- self.ref_stroke_opacity = ref_stroke_opacity
- """Reference line stroke opacity."""
- self.ref_stroke_size = ref_stroke_size
- """Reference line stroke size (line width or pen thickness)."""
- self.ref_stroke_dash = ref_stroke_dash
- """Reference line stroke dash style. A string containing space-separated integers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]."""
+ """The label to display for this group."""
+ self.items = items
+ """The navigation items contained in this group."""
def dump(self) -> Dict:
"""Returns the contents of this object as a dict."""
+ if self.label is None:
+ raise ValueError('NavGroup.label is required.')
+ if self.items is None:
+ raise ValueError('NavGroup.items is required.')
return _dump(
- coord=self.coord,
- type=self.type,
- x=self.x,
- x0=self.x0,
- x1=self.x1,
- x2=self.x2,
- x_min=self.x_min,
- x_max=self.x_max,
- x_nice=self.x_nice,
- x_scale=self.x_scale,
- x_title=self.x_title,
- y=self.y,
- y0=self.y0,
- y1=self.y1,
- y2=self.y2,
- y_min=self.y_min,
- y_max=self.y_max,
- y_nice=self.y_nice,
- y_scale=self.y_scale,
- y_title=self.y_title,
- color=self.color,
- color_range=self.color_range,
- shape=self.shape,
- shape_range=self.shape_range,
- size=self.size,
- size_range=self.size_range,
- stack=self.stack,
- dodge=self.dodge,
- curve=self.curve,
- fill_color=self.fill_color,
- fill_opacity=self.fill_opacity,
- stroke_color=self.stroke_color,
- stroke_opacity=self.stroke_opacity,
- stroke_size=self.stroke_size,
- stroke_dash=self.stroke_dash,
label=self.label,
- label_offset=self.label_offset,
- label_offset_x=self.label_offset_x,
- label_offset_y=self.label_offset_y,
- label_rotation=self.label_rotation,
- label_position=self.label_position,
- label_overlap=self.label_overlap,
- label_fill_color=self.label_fill_color,
- label_fill_opacity=self.label_fill_opacity,
- label_stroke_color=self.label_stroke_color,
- label_stroke_opacity=self.label_stroke_opacity,
- label_stroke_size=self.label_stroke_size,
- label_font_size=self.label_font_size,
- label_font_weight=self.label_font_weight,
- label_line_height=self.label_line_height,
- label_align=self.label_align,
- ref_stroke_color=self.ref_stroke_color,
- ref_stroke_opacity=self.ref_stroke_opacity,
- ref_stroke_size=self.ref_stroke_size,
- ref_stroke_dash=self.ref_stroke_dash,
+ items=[__e.dump() for __e in self.items],
+ )
+
+ @staticmethod
+ def load(__d: Dict) -> 'NavGroup':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_label: Any = __d.get('label')
+ if __d_label is None:
+ raise ValueError('NavGroup.label is required.')
+ __d_items: Any = __d.get('items')
+ if __d_items is None:
+ raise ValueError('NavGroup.items is required.')
+ label: str = __d_label
+ items: List[NavItem] = [NavItem.load(__e) for __e in __d_items]
+ return NavGroup(
+ label,
+ items,
+ )
+
+
+class NavCard:
+ """Create a card containing a navigation pane.
+ """
+ def __init__(
+ self,
+ box: str,
+ items: List[NavGroup],
+ commands: Optional[List[Command]] = None,
+ ):
+ self.box = box
+ """A string indicating how to place this component on the page."""
+ self.items = items
+ """The navigation groups contained in this pane."""
+ self.commands = commands
+ """Contextual menu commands for this component."""
+
+ def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.box is None:
+ raise ValueError('NavCard.box is required.')
+ if self.items is None:
+ raise ValueError('NavCard.items is required.')
+ return _dump(
+ view='nav',
+ box=self.box,
+ items=[__e.dump() for __e in self.items],
+ commands=None if self.commands is None else [__e.dump() for __e in self.commands],
)
@staticmethod
- def load(__d: Dict) -> 'Mark':
+ def load(__d: Dict) -> 'NavCard':
"""Creates an instance of this class using the contents of a dict."""
- __d_coord: Any = __d.get('coord')
- __d_type: Any = __d.get('type')
- __d_x: Any = __d.get('x')
- __d_x0: Any = __d.get('x0')
- __d_x1: Any = __d.get('x1')
- __d_x2: Any = __d.get('x2')
- __d_x_min: Any = __d.get('x_min')
- __d_x_max: Any = __d.get('x_max')
- __d_x_nice: Any = __d.get('x_nice')
- __d_x_scale: Any = __d.get('x_scale')
- __d_x_title: Any = __d.get('x_title')
- __d_y: Any = __d.get('y')
- __d_y0: Any = __d.get('y0')
- __d_y1: Any = __d.get('y1')
- __d_y2: Any = __d.get('y2')
- __d_y_min: Any = __d.get('y_min')
- __d_y_max: Any = __d.get('y_max')
- __d_y_nice: Any = __d.get('y_nice')
- __d_y_scale: Any = __d.get('y_scale')
- __d_y_title: Any = __d.get('y_title')
- __d_color: Any = __d.get('color')
- __d_color_range: Any = __d.get('color_range')
- __d_shape: Any = __d.get('shape')
- __d_shape_range: Any = __d.get('shape_range')
- __d_size: Any = __d.get('size')
- __d_size_range: Any = __d.get('size_range')
- __d_stack: Any = __d.get('stack')
- __d_dodge: Any = __d.get('dodge')
- __d_curve: Any = __d.get('curve')
- __d_fill_color: Any = __d.get('fill_color')
- __d_fill_opacity: Any = __d.get('fill_opacity')
- __d_stroke_color: Any = __d.get('stroke_color')
- __d_stroke_opacity: Any = __d.get('stroke_opacity')
- __d_stroke_size: Any = __d.get('stroke_size')
- __d_stroke_dash: Any = __d.get('stroke_dash')
- __d_label: Any = __d.get('label')
- __d_label_offset: Any = __d.get('label_offset')
- __d_label_offset_x: Any = __d.get('label_offset_x')
- __d_label_offset_y: Any = __d.get('label_offset_y')
- __d_label_rotation: Any = __d.get('label_rotation')
- __d_label_position: Any = __d.get('label_position')
- __d_label_overlap: Any = __d.get('label_overlap')
- __d_label_fill_color: Any = __d.get('label_fill_color')
- __d_label_fill_opacity: Any = __d.get('label_fill_opacity')
- __d_label_stroke_color: Any = __d.get('label_stroke_color')
- __d_label_stroke_opacity: Any = __d.get('label_stroke_opacity')
- __d_label_stroke_size: Any = __d.get('label_stroke_size')
- __d_label_font_size: Any = __d.get('label_font_size')
- __d_label_font_weight: Any = __d.get('label_font_weight')
- __d_label_line_height: Any = __d.get('label_line_height')
- __d_label_align: Any = __d.get('label_align')
- __d_ref_stroke_color: Any = __d.get('ref_stroke_color')
- __d_ref_stroke_opacity: Any = __d.get('ref_stroke_opacity')
- __d_ref_stroke_size: Any = __d.get('ref_stroke_size')
- __d_ref_stroke_dash: Any = __d.get('ref_stroke_dash')
- coord: Optional[str] = __d_coord
- type: Optional[str] = __d_type
- x: Optional[Value] = __d_x
- x0: Optional[Value] = __d_x0
- x1: Optional[Value] = __d_x1
- x2: Optional[Value] = __d_x2
- x_min: Optional[float] = __d_x_min
- x_max: Optional[float] = __d_x_max
- x_nice: Optional[bool] = __d_x_nice
- x_scale: Optional[str] = __d_x_scale
- x_title: Optional[str] = __d_x_title
- y: Optional[Value] = __d_y
- y0: Optional[Value] = __d_y0
- y1: Optional[Value] = __d_y1
- y2: Optional[Value] = __d_y2
- y_min: Optional[float] = __d_y_min
- y_max: Optional[float] = __d_y_max
- y_nice: Optional[bool] = __d_y_nice
- y_scale: Optional[str] = __d_y_scale
- y_title: Optional[str] = __d_y_title
- color: Optional[str] = __d_color
- color_range: Optional[str] = __d_color_range
- shape: Optional[str] = __d_shape
- shape_range: Optional[str] = __d_shape_range
- size: Optional[Value] = __d_size
- size_range: Optional[str] = __d_size_range
- stack: Optional[str] = __d_stack
- dodge: Optional[str] = __d_dodge
- curve: Optional[str] = __d_curve
- fill_color: Optional[str] = __d_fill_color
- fill_opacity: Optional[float] = __d_fill_opacity
- stroke_color: Optional[str] = __d_stroke_color
- stroke_opacity: Optional[float] = __d_stroke_opacity
- stroke_size: Optional[float] = __d_stroke_size
- stroke_dash: Optional[str] = __d_stroke_dash
- label: Optional[str] = __d_label
- label_offset: Optional[float] = __d_label_offset
- label_offset_x: Optional[float] = __d_label_offset_x
- label_offset_y: Optional[float] = __d_label_offset_y
- label_rotation: Optional[str] = __d_label_rotation
- label_position: Optional[str] = __d_label_position
- label_overlap: Optional[str] = __d_label_overlap
- label_fill_color: Optional[str] = __d_label_fill_color
- label_fill_opacity: Optional[float] = __d_label_fill_opacity
- label_stroke_color: Optional[str] = __d_label_stroke_color
- label_stroke_opacity: Optional[float] = __d_label_stroke_opacity
- label_stroke_size: Optional[float] = __d_label_stroke_size
- label_font_size: Optional[float] = __d_label_font_size
- label_font_weight: Optional[str] = __d_label_font_weight
- label_line_height: Optional[float] = __d_label_line_height
- label_align: Optional[str] = __d_label_align
- ref_stroke_color: Optional[str] = __d_ref_stroke_color
- ref_stroke_opacity: Optional[float] = __d_ref_stroke_opacity
- ref_stroke_size: Optional[float] = __d_ref_stroke_size
- ref_stroke_dash: Optional[str] = __d_ref_stroke_dash
- return Mark(
- coord,
- type,
- x,
- x0,
- x1,
- x2,
- x_min,
- x_max,
- x_nice,
- x_scale,
- x_title,
- y,
- y0,
- y1,
- y2,
- y_min,
- y_max,
- y_nice,
- y_scale,
- y_title,
- color,
- color_range,
- shape,
- shape_range,
- size,
- size_range,
- stack,
- dodge,
- curve,
- fill_color,
- fill_opacity,
- stroke_color,
- stroke_opacity,
- stroke_size,
- stroke_dash,
- label,
- label_offset,
- label_offset_x,
- label_offset_y,
- label_rotation,
- label_position,
- label_overlap,
- label_fill_color,
- label_fill_opacity,
- label_stroke_color,
- label_stroke_opacity,
- label_stroke_size,
- label_font_size,
- label_font_weight,
- label_line_height,
- label_align,
- ref_stroke_color,
- ref_stroke_opacity,
- ref_stroke_size,
- ref_stroke_dash,
+ __d_box: Any = __d.get('box')
+ if __d_box is None:
+ raise ValueError('NavCard.box is required.')
+ __d_items: Any = __d.get('items')
+ if __d_items is None:
+ raise ValueError('NavCard.items is required.')
+ __d_commands: Any = __d.get('commands')
+ box: str = __d_box
+ items: List[NavGroup] = [NavGroup.load(__e) for __e in __d_items]
+ commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands]
+ return NavCard(
+ box,
+ items,
+ commands,
)
-class Plot:
- """Create a plot. A plot is composed of one or more graphical mark layers.
+class PixelArtCard:
+ """Create a card displaying a collaborative Pixel art tool, just for kicks.
"""
def __init__(
self,
- marks: List[Mark],
+ box: str,
+ title: str,
+ data: PackedRecord,
+ commands: Optional[List[Command]] = None,
):
- self.marks = marks
- """The graphical mark layers contained in this plot."""
+ self.box = box
+ """A string indicating how to place this component on the page."""
+ self.title = title
+ """The title for this card."""
+ self.data = data
+ """The data for this card."""
+ self.commands = commands
+ """Contextual menu commands for this component."""
def dump(self) -> Dict:
"""Returns the contents of this object as a dict."""
- if self.marks is None:
- raise ValueError('Plot.marks is required.')
+ if self.box is None:
+ raise ValueError('PixelArtCard.box is required.')
+ if self.title is None:
+ raise ValueError('PixelArtCard.title is required.')
+ if self.data is None:
+ raise ValueError('PixelArtCard.data is required.')
return _dump(
- marks=[__e.dump() for __e in self.marks],
+ view='pixel_art',
+ box=self.box,
+ title=self.title,
+ data=self.data,
+ commands=None if self.commands is None else [__e.dump() for __e in self.commands],
)
@staticmethod
- def load(__d: Dict) -> 'Plot':
- """Creates an instance of this class using the contents of a dict."""
- __d_marks: Any = __d.get('marks')
- if __d_marks is None:
- raise ValueError('Plot.marks is required.')
- marks: List[Mark] = [Mark.load(__e) for __e in __d_marks]
- return Plot(
- marks,
+ def load(__d: Dict) -> 'PixelArtCard':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_box: Any = __d.get('box')
+ if __d_box is None:
+ raise ValueError('PixelArtCard.box is required.')
+ __d_title: Any = __d.get('title')
+ if __d_title is None:
+ raise ValueError('PixelArtCard.title is required.')
+ __d_data: Any = __d.get('data')
+ if __d_data is None:
+ raise ValueError('PixelArtCard.data is required.')
+ __d_commands: Any = __d.get('commands')
+ box: str = __d_box
+ title: str = __d_title
+ data: PackedRecord = __d_data
+ commands: Optional[List[Command]] = None if __d_commands is None else [Command.load(__e) for __e in __d_commands]
+ return PixelArtCard(
+ box,
+ title,
+ data,
+ commands,
)
@@ -7474,7 +7594,7 @@ Methods
class Component
-(text: Union[Text, NoneType] = None, text_xl: Union[TextXl, NoneType] = None, text_l: Union[TextL, NoneType] = None, text_m: Union[TextM, NoneType] = None, text_s: Union[TextS, NoneType] = None, text_xs: Union[TextXs, NoneType] = None, label: Union[Label, NoneType] = None, separator: Union[Separator, NoneType] = None, progress: Union[Progress, NoneType] = None, message_bar: Union[MessageBar, NoneType] = None, textbox: Union[Textbox, NoneType] = None, checkbox: Union[Checkbox, NoneType] = None, toggle: Union[Toggle, NoneType] = None, choice_group: Union[ChoiceGroup, NoneType] = None, checklist: Union[Checklist, NoneType] = None, dropdown: Union[Dropdown, NoneType] = None, combobox: Union[Combobox, NoneType] = None, slider: Union[Slider, NoneType] = None, spinbox: Union[Spinbox, NoneType] = None, date_picker: Union[DatePicker, NoneType] = None, color_picker: Union[ColorPicker, NoneType] = None, button: Union[Button, NoneType] = None, buttons: Union[Buttons, NoneType] = None, file_upload: Union[FileUpload, NoneType] = None, table: Union[Table, NoneType] = None, link: Union[Link, NoneType] = None, tabs: Union[Tabs, NoneType] = None, expander: Union[Expander, NoneType] = None, frame: Union[Frame, NoneType] = None, picker: Union[Picker, NoneType] = None, range_slider: Union[RangeSlider, NoneType] = None, stepper: Union[Stepper, NoneType] = None)
+(text: Union[Text, NoneType] = None, text_xl: Union[TextXl, NoneType] = None, text_l: Union[TextL, NoneType] = None, text_m: Union[TextM, NoneType] = None, text_s: Union[TextS, NoneType] = None, text_xs: Union[TextXs, NoneType] = None, label: Union[Label, NoneType] = None, separator: Union[Separator, NoneType] = None, progress: Union[Progress, NoneType] = None, message_bar: Union[MessageBar, NoneType] = None, textbox: Union[Textbox, NoneType] = None, checkbox: Union[Checkbox, NoneType] = None, toggle: Union[Toggle, NoneType] = None, choice_group: Union[ChoiceGroup, NoneType] = None, checklist: Union[Checklist, NoneType] = None, dropdown: Union[Dropdown, NoneType] = None, combobox: Union[Combobox, NoneType] = None, slider: Union[Slider, NoneType] = None, spinbox: Union[Spinbox, NoneType] = None, date_picker: Union[DatePicker, NoneType] = None, color_picker: Union[ColorPicker, NoneType] = None, button: Union[Button, NoneType] = None, buttons: Union[Buttons, NoneType] = None, file_upload: Union[FileUpload, NoneType] = None, table: Union[Table, NoneType] = None, link: Union[Link, NoneType] = None, tabs: Union[Tabs, NoneType] = None, expander: Union[Expander, NoneType] = None, frame: Union[Frame, NoneType] = None, picker: Union[Picker, NoneType] = None, range_slider: Union[RangeSlider, NoneType] = None, stepper: Union[Stepper, NoneType] = None, visualization: Union[Visualization, NoneType] = None, vega_visualization: Union[VegaVisualization, NoneType] = None)
-
Create a component.
@@ -7519,6 +7639,8 @@ Methods
picker: Optional[Picker] = None,
range_slider: Optional[RangeSlider] = None,
stepper: Optional[Stepper] = None,
+ visualization: Optional[Visualization] = None,
+ vega_visualization: Optional[VegaVisualization] = None,
):
self.text = text
"""Text block."""
@@ -7577,13 +7699,17 @@ Methods
self.expander = expander
"""Expander."""
self.frame = frame
- """Frame"""
+ """Frame."""
self.picker = picker
- """Picker"""
+ """Picker."""
self.range_slider = range_slider
- """RangeSlider"""
+ """Range Slider."""
self.stepper = stepper
- """Stepper"""
+ """Stepper."""
+ self.visualization = visualization
+ """Visualization."""
+ self.vega_visualization = vega_visualization
+ """Vega-lite Visualization."""
def dump(self) -> Dict:
"""Returns the contents of this object as a dict."""
@@ -7620,6 +7746,8 @@ Methods
picker=None if self.picker is None else self.picker.dump(),
range_slider=None if self.range_slider is None else self.range_slider.dump(),
stepper=None if self.stepper is None else self.stepper.dump(),
+ visualization=None if self.visualization is None else self.visualization.dump(),
+ vega_visualization=None if self.vega_visualization is None else self.vega_visualization.dump(),
)
@staticmethod
@@ -7657,6 +7785,8 @@ Methods
__d_picker: Any = __d.get('picker')
__d_range_slider: Any = __d.get('range_slider')
__d_stepper: Any = __d.get('stepper')
+ __d_visualization: Any = __d.get('visualization')
+ __d_vega_visualization: Any = __d.get('vega_visualization')
text: Optional[Text] = None if __d_text is None else Text.load(__d_text)
text_xl: Optional[TextXl] = None if __d_text_xl is None else TextXl.load(__d_text_xl)
text_l: Optional[TextL] = None if __d_text_l is None else TextL.load(__d_text_l)
@@ -7689,6 +7819,8 @@ Methods
picker: Optional[Picker] = None if __d_picker is None else Picker.load(__d_picker)
range_slider: Optional[RangeSlider] = None if __d_range_slider is None else RangeSlider.load(__d_range_slider)
stepper: Optional[Stepper] = None if __d_stepper is None else Stepper.load(__d_stepper)
+ visualization: Optional[Visualization] = None if __d_visualization is None else Visualization.load(__d_visualization)
+ vega_visualization: Optional[VegaVisualization] = None if __d_vega_visualization is None else VegaVisualization.load(__d_vega_visualization)
return Component(
text,
text_xl,
@@ -7722,6 +7854,8 @@ Methods
picker,
range_slider,
stepper,
+ visualization,
+ vega_visualization,
)
var frame
Frame
Frame.
var label
var picker
Picker
Picker.
var progress
var range_slider
RangeSlider
Range Slider.
var separator
var stepper
Stepper
Stepper.
var table
Toggle.
var vega_visualization
Vega-lite Visualization.
var visualization
Visualization.
+class VegaVisualization
+(specification: str, data: Union[dict, str, NoneType] = None, width: Union[str, NoneType] = None, height: Union[str, NoneType] = None)
+
Create a Vega-lite plot for display inside a form.
class VegaVisualization:
+ """Create a Vega-lite plot for display inside a form.
+ """
+ def __init__(
+ self,
+ specification: str,
+ data: Optional[PackedRecord] = None,
+ width: Optional[str] = None,
+ height: Optional[str] = None,
+ ):
+ self.specification = specification
+ """The Vega-lite specification."""
+ self.data = data
+ """Data for the plot, if any."""
+ self.width = width
+ """The width of the visualization. Defaults to 100%."""
+ self.height = height
+ """The height of the visualization. Defaults to 300px."""
+
+ def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.specification is None:
+ raise ValueError('VegaVisualization.specification is required.')
+ return _dump(
+ specification=self.specification,
+ data=self.data,
+ width=self.width,
+ height=self.height,
+ )
+
+ @staticmethod
+ def load(__d: Dict) -> 'VegaVisualization':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_specification: Any = __d.get('specification')
+ if __d_specification is None:
+ raise ValueError('VegaVisualization.specification is required.')
+ __d_data: Any = __d.get('data')
+ __d_width: Any = __d.get('width')
+ __d_height: Any = __d.get('height')
+ specification: str = __d_specification
+ data: Optional[PackedRecord] = __d_data
+ width: Optional[str] = __d_width
+ height: Optional[str] = __d_height
+ return VegaVisualization(
+ specification,
+ data,
+ width,
+ height,
+ )
+
+def load(_VegaVisualization__d: Dict) ‑> VegaVisualization
+
Creates an instance of this class using the contents of a dict.
@staticmethod
+def load(__d: Dict) -> 'VegaVisualization':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_specification: Any = __d.get('specification')
+ if __d_specification is None:
+ raise ValueError('VegaVisualization.specification is required.')
+ __d_data: Any = __d.get('data')
+ __d_width: Any = __d.get('width')
+ __d_height: Any = __d.get('height')
+ specification: str = __d_specification
+ data: Optional[PackedRecord] = __d_data
+ width: Optional[str] = __d_width
+ height: Optional[str] = __d_height
+ return VegaVisualization(
+ specification,
+ data,
+ width,
+ height,
+ )
+var data
Data for the plot, if any.
var height
The height of the visualization. Defaults to 300px.
var specification
The Vega-lite specification.
var width
The width of the visualization. Defaults to 100%.
+def dump(self) ‑> Dict
+
Returns the contents of this object as a dict.
def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.specification is None:
+ raise ValueError('VegaVisualization.specification is required.')
+ return _dump(
+ specification=self.specification,
+ data=self.data,
+ width=self.width,
+ height=self.height,
+ )
+
+class Visualization
+(plot: Plot, data: Union[dict, str], width: Union[str, NoneType] = None, height: Union[str, NoneType] = None)
+
Create a visualization for display inside a form.
class Visualization:
+ """Create a visualization for display inside a form.
+ """
+ def __init__(
+ self,
+ plot: Plot,
+ data: PackedRecord,
+ width: Optional[str] = None,
+ height: Optional[str] = None,
+ ):
+ self.plot = plot
+ """The plot to be rendered in this visualization."""
+ self.data = data
+ """Data for this visualization."""
+ self.width = width
+ """The width of the visualization. Defaults to 100%."""
+ self.height = height
+ """The height of the visualization. Defaults to 300px."""
+
+ def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.plot is None:
+ raise ValueError('Visualization.plot is required.')
+ if self.data is None:
+ raise ValueError('Visualization.data is required.')
+ return _dump(
+ plot=self.plot.dump(),
+ data=self.data,
+ width=self.width,
+ height=self.height,
+ )
+
+ @staticmethod
+ def load(__d: Dict) -> 'Visualization':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_plot: Any = __d.get('plot')
+ if __d_plot is None:
+ raise ValueError('Visualization.plot is required.')
+ __d_data: Any = __d.get('data')
+ if __d_data is None:
+ raise ValueError('Visualization.data is required.')
+ __d_width: Any = __d.get('width')
+ __d_height: Any = __d.get('height')
+ plot: Plot = Plot.load(__d_plot)
+ data: PackedRecord = __d_data
+ width: Optional[str] = __d_width
+ height: Optional[str] = __d_height
+ return Visualization(
+ plot,
+ data,
+ width,
+ height,
+ )
+
+def load(_Visualization__d: Dict) ‑> Visualization
+
Creates an instance of this class using the contents of a dict.
@staticmethod
+def load(__d: Dict) -> 'Visualization':
+ """Creates an instance of this class using the contents of a dict."""
+ __d_plot: Any = __d.get('plot')
+ if __d_plot is None:
+ raise ValueError('Visualization.plot is required.')
+ __d_data: Any = __d.get('data')
+ if __d_data is None:
+ raise ValueError('Visualization.data is required.')
+ __d_width: Any = __d.get('width')
+ __d_height: Any = __d.get('height')
+ plot: Plot = Plot.load(__d_plot)
+ data: PackedRecord = __d_data
+ width: Optional[str] = __d_width
+ height: Optional[str] = __d_height
+ return Visualization(
+ plot,
+ data,
+ width,
+ height,
+ )
+var data
Data for this visualization.
var height
The height of the visualization. Defaults to 300px.
var plot
The plot to be rendered in this visualization.
var width
The width of the visualization. Defaults to 100%.
+def dump(self) ‑> Dict
+
Returns the contents of this object as a dict.
def dump(self) -> Dict:
+ """Returns the contents of this object as a dict."""
+ if self.plot is None:
+ raise ValueError('Visualization.plot is required.')
+ if self.data is None:
+ raise ValueError('Visualization.data is required.')
+ return _dump(
+ plot=self.plot.dump(),
+ data=self.data,
+ width=self.width,
+ height=self.height,
+ )
+
class WideBarStatCard
(box: str, title: str, value: str, aux_value: str, progress: float, plot_color: Union[str, NoneType] = None, data: Union[dict, str, NoneType] = None, commands: Union[List[Command], NoneType] = None)
@@ -19716,6 +20148,8 @@ Compone
text_xs
textbox
toggle
+vega_visualization
+visualization
VegaCard<
VegaVisualization
Visualization
WideBarStatCard
aux_value
h2o_q.ui
h2o_q.ui
h2o_q.ui
h2o_q.ui
h2o_q.ui
-def component(text: Union[Text, NoneType] = None, text_xl: Union[TextXl, NoneType] = None, text_l: Union[TextL, NoneType] = None, text_m: Union[TextM, NoneType] = None, text_s: Union[TextS, NoneType] = None, text_xs: Union[TextXs, NoneType] = None, label: Union[Label, NoneType] = None, separator: Union[Separator, NoneType] = None, progress: Union[Progress, NoneType] = None, message_bar: Union[MessageBar, NoneType] = None, textbox: Union[Textbox, NoneType] = None, checkbox: Union[Checkbox, NoneType] = None, toggle: Union[Toggle, NoneType] = None, choice_group: Union[ChoiceGroup, NoneType] = None, checklist: Union[Checklist, NoneType] = None, dropdown: Union[Dropdown, NoneType] = None, combobox: Union[Combobox, NoneType] = None, slider: Union[Slider, NoneType] = None, spinbox: Union[Spinbox, NoneType] = None, date_picker: Union[DatePicker, NoneType] = None, color_picker: Union[ColorPicker, NoneType] = None, button: Union[Button, NoneType] = None, buttons: Union[Buttons, NoneType] = None, file_upload: Union[FileUpload, NoneType] = None, table: Union[Table, NoneType] = None, link: Union[Link, NoneType] = None, tabs: Union[Tabs, NoneType] = None, expander: Union[Expander, NoneType] = None, frame: Union[Frame, NoneType] = None, picker: Union[Picker, NoneType] = None, range_slider: Union[RangeSlider, NoneType] = None, stepper: Union[Stepper, NoneType] = None) ‑> Component
+def component(text: Union[Text, NoneType] = None, text_xl: Union[TextXl, NoneType] = None, text_l: Union[TextL, NoneType] = None, text_m: Union[TextM, NoneType] = None, text_s: Union[TextS, NoneType] = None, text_xs: Union[TextXs, NoneType] = None, label: Union[Label, NoneType] = None, separator: Union[Separator, NoneType] = None, progress: Union[Progress, NoneType] = None, message_bar: Union[MessageBar, NoneType] = None, textbox: Union[Textbox, NoneType] = None, checkbox: Union[Checkbox, NoneType] = None, toggle: Union[Toggle, NoneType] = None, choice_group: Union[ChoiceGroup, NoneType] = None, checklist: Union[Checklist, NoneType] = None, dropdown: Union[Dropdown, NoneType] = None, combobox: Union[Combobox, NoneType] = None, slider: Union[Slider, NoneType] = None, spinbox: Union[Spinbox, NoneType] = None, date_picker: Union[DatePicker, NoneType] = None, color_picker: Union[ColorPicker, NoneType] = None, button: Union[Button, NoneType] = None, buttons: Union[Buttons, NoneType] = None, file_upload: Union[FileUpload, NoneType] = None, table: Union[Table, NoneType] = None, link: Union[Link, NoneType] = None, tabs: Union[Tabs, NoneType] = None, expander: Union[Expander, NoneType] = None, frame: Union[Frame, NoneType] = None, picker: Union[Picker, NoneType] = None, range_slider: Union[RangeSlider, NoneType] = None, stepper: Union[Stepper, NoneType] = None, visualization: Union[Visualization, NoneType] = None, vega_visualization: Union[VegaVisualization, NoneType] = None) ‑> Component
Create a component.
@@ -3315,13 +3369,17 @@expander
frame
picker
range_slider
stepper
visualization
vega_visualization
A Component
instance.
+def vega_visualization(specification: str, data: Union[dict, str, NoneType] = None, width: Union[str, NoneType] = None, height: Union[str, NoneType] = None) ‑> Component
+
Create a Vega-lite plot for display inside a form.
+specification
data
width
height
A VegaVisualization
instance.
def vega_visualization(
+ specification: str,
+ data: Optional[PackedRecord] = None,
+ width: Optional[str] = None,
+ height: Optional[str] = None,
+) -> Component:
+ """Create a Vega-lite plot for display inside a form.
+
+ Args:
+ specification: The Vega-lite specification.
+ data: Data for the plot, if any.
+ width: The width of the visualization. Defaults to 100%.
+ height: The height of the visualization. Defaults to 300px.
+ Returns:
+ A `h2o_q.types.VegaVisualization` instance.
+ """
+ return Component(vega_visualization=VegaVisualization(
+ specification,
+ data,
+ width,
+ height,
+ ))
+
+def visualization(plot: Plot, data: Union[dict, str], width: Union[str, NoneType] = None, height: Union[str, NoneType] = None) ‑> Component
+
Create a visualization for display inside a form.
+plot
data
width
height
A Visualization
instance.
def visualization(
+ plot: Plot,
+ data: PackedRecord,
+ width: Optional[str] = None,
+ height: Optional[str] = None,
+) -> Component:
+ """Create a visualization for display inside a form.
+
+ Args:
+ plot: The plot to be rendered in this visualization.
+ data: Data for this visualization.
+ width: The width of the visualization. Defaults to 100%.
+ height: The height of the visualization. Defaults to 300px.
+ Returns:
+ A `h2o_q.types.Visualization` instance.
+ """
+ return Component(visualization=Visualization(
+ plot,
+ data,
+ width,
+ height,
+ ))
+
def wide_bar_stat_card(box: str, title: str, value: str, aux_value: str, progress: float, plot_color: Union[str, NoneType] = None, data: Union[dict, str, NoneType] = None, commands: Union[List[Command], NoneType] = None) ‑> WideBarStatCard
toggle
toolbar_card
vega_card
vega_visualization
visualization
wide_bar_stat_card
wide_gauge_stat_card
wide_series_stat_card