This package provide methods to render a Visualization
to a vega specification.
Vega was chosen as it provide a complex but almost exhaustive visualization grammar. Vega's api allows the rendering of visualizations both on the backend and frontend and has bridges with the main js frameworks (react, vue…).
from pybana import VegaTranslator, VegaRenderer, ElasticTranslator
# Let's assume you have a visualization & a context.
search = ElasticTranslator().translate(visualization, context)
response = search.execute()
# Translate to a vega spec
vega = VegaTranslator().translate(visualization, response, context)
The vega rendering supports:
- Visualizations:
- line (:warning: split lines is not supported)
- histogram (:warning: split lines is not supported)
- pie
- vega
- Metrics
- Count
- Average
- Min
- Max
- Median
- Sum
- Cardinality
- Datasweet
This package also provides a python helper to render a vega spec to html markup using a node subprocess.
To make it work, you need to:
- Install a recent version of node. So far, it has been tested using
v8.9.3
- Install the vega package.
from pybana import VegaRenderer
# Let's assume you have a vega spec
# Render it to a svg html node.
VegaRenderer().to_svg(vega)