Get started¶
A dashboard is an HTML page with a few tags. There is nothing to install and nothing to build.
1. Write an HTML file¶
Create my_first_dashboard.html with this content:
<source-table
name="orders"
url="https://unytics.io/bi-components/examples/data/orders.csv"
date-column="date">
</source-table>
<date-range-filter presets="all,90d,365d,ytd"></date-range-filter>
<score-card title="Revenue" table="orders" measure="sum(revenue)" format="eur"></score-card>
<bar-chart
table="orders"
measure="sum(revenue)"
by="country">
</bar-chart>
<line-chart
table="orders"
measure="sum(revenue)"
by="date_trunc('month', date)">
</line-chart>
<script type="module" src="https://unytics.io/bi-components/src/connectors/duckdb-wasm.js"></script>
<script type="module" src="https://unytics.io/bi-components/src/components/source_tables.js"></script>
<script type="module" src="https://unytics.io/bi-components/src/components/echarts.js"></script>
<script type="module" src="https://unytics.io/bi-components/src/components/score_cards.js"></script>
<script type="module" src="https://unytics.io/bi-components/src/components/filters.js"></script>
What each part does:
<source-table>loads a Parquet, CSV or JSON file into an in-browser database and names it.- Each component describes what it shows: a
measure(any SQL aggregate), splitbya column. - The
<script>tags load the connector (where queries run) and the components you use.
2. Open it in a browser¶
Open the file in any recent browser. This is the same page, live:
3. Play with it¶
The dashboard is interactive without any code:
- Click a bar: the other components are filtered on that country. Click it again to remove the filter.
Ctrl/Cmd+ click selects several values.- The period applies to every table that declares a
date-column.
4. Put it anywhere¶
The page is static, so any host works: your own website or web app, GitHub Pages, Cloudflare Pages, Netlify, an S3 or Cloud Storage bucket, a documentation site (this site is made with mkdocs).
Two things to know:
- Data files must be reachable by the browser. A file on another domain needs to allow cross-origin requests (CORS).
- The scripts can be self-hosted. Copy the
src/folder of the repository next to your pages and point the<script>tags to it. To also serve ECharts and DuckDB-WASM yourself, see Customization.
Pin a version¶
The addresses above always serve the latest version. For a page that must keep working as it is, load a fixed version instead, from the jsDelivr CDN:
<script type="module" src="https://cdn.jsdelivr.net/gh/unytics/bi-components@v1.1.0/src/connectors/duckdb-wasm.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/unytics/bi-components@v1.1.0/src/components/echarts.js"></script>
Use the same version for every script of a page. Versions and their changes are listed in the changelog; a change that could break a dashboard only happens in a new major version (v2.0.0).
Next steps¶
- All the components and their attributes.
- Examples, from a static page to a chat that generates dashboards.
- Generative AI: let a model write the dashboards.
- Embed in your app: run them on your own data engine, with your access rules.