A demo of how to run Vega by offloading computational-intensive operations to a separate database management system. We have written a demo paper about the research behind. Please cite us if you use Vega Plus in a publication.
@article{yang2022vegaplus,
Author = {Junran Yang and Hyekang Kevin Joo and Sai S. Yerramreddy and Siyao Li and Dominik Moritz and Leilani Battle},
Title = {Demonstration of VegaPlus: Optimizing Declarative Visualization Languages},
Year = {2022},
Eprint = {arXiv:2201.06742},
Doi = {10.1145/3514221.3520168},
}
- 3M flights in the browser with DuckDB-WASM: https://vega.github.io/vega-plus/demo-duckdb
- 3M flights in the browser with SQL.JS: https://vega.github.io/vega-plus/demo-sqlite
We used yarn workspaces to structure this repository.
The primary VegaPlus library component to be used in your application. Install with yarn add vega-plus-core
.
An interactive web demo of VegaPlus components with examples of updating data and chart variables.
The middleware server for using the VegaPlus with a DBMS backend (we now support PostgreSQL and DuckDB). Install wih yarn add vega-plus-server
.
The customized Vega transform used by VegaPlus that sends queries to, and receives results from a DBMS. Install wih yarn add vega-transform-db
.
- Install and start PostgreSQL.
- Create a PostgreSQL database named
vega_plus
, e.g.,createdb vega_plus
. You don't need to do anything if you want to use DuckDB.
- Run
git clone https://github.com/vega/vega-plus.git
. - Run
yarn --frozen-lockfile
andyarn build
to install VegaPlus library dependencies. - For using prepopulated database in demo, look at additional notes.
- Run
yarn build:server
to install VegaPlus server dependencies. - Run
yarn start:server_pg
to start the application server with postgres, for DuckDB runyarn start:server_duck
- All the config information for the databases and server (including user, password and ports to be used) is currently stored in the
./packages/server/duck_db.js
/./packages/server/postgres_db.js
files and can be customized.
- Make sure you have the middleware server running.
- In another terminal window, run
cd /path/to/dev/repos/vega-plus
. - Run
yarn build:app
to build dependencies for the demo/application UI. - Run
yarn start:app
to start the web server. - Open a browser tab to localhost:1234.
- Upload the cars dataset from
./sample_data/data/cars.json
to the data input or click on theUpload Demo Data
button. - After uploading a dataset to database, upload a cars vega spec from
./sample_data/data/specs/specs/
to the specs inputor click on theShow me a Demo Spec
button and see the visualization.
- Again make sure you have the middleware server running.
- In another terminal window, run
cd /path/to/dev/repos/vega-plus
. - The Unit Tests assume a prepopulated database, either do so by uploading data using the web demo or use the provided database (look at additional notes).
- For running the unit tests:
- For PostgreSQL,
yarn test transform_pg
- For DuckDB,
yarn test transform_duckdb
- For PostgreSQL,
- Prepopulated Database, We have provided prepopulated databases and scripts for PostgreSQL and DuckDB in
./packages/server/database
- For PostgreSQL, use a command like
psql dbname < infile
. For example,psql postgresql://postgres@localhost/scalable_vega < ./packages/server/database/scalable_vega.sql
- For DuckDB you can run
yarn start:duckdb-sample
which will populate a duckdb database file with 5 tables. You can customize the name of the db file being used by making changes in./packages/server/server.js
and./packages/server/database/duckdb_insertion.js
- For PostgreSQL, use a command like
- If you face
Cannot find name 'expect'
type error while running tests- Run
yarn add @types/jest -D
- Run