# How to create a custom dashboard using Vega-lite

**URL:** <https://forums.losant.com/t/how-to-create-a-custom-dashboard-using-vega-lite/4894>\
**Category:** Help\
**Tags:** dashboard, edge\
**Created:** [January 19, 2023, 11:14am UTC](https://forums.losant.com/t/how-to-create-a-custom-dashboard-using-vega-lite/4894 "2023-01-19T11:14:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Pinheiro](https://avatars.discourse-cdn.com/v4/letter/l/bc79bd/32.png) [@Lucas\_Pinheiro](https://forums.losant.com/u/Lucas_Pinheiro)\
**Post date:** [January 19, 2023, 11:14am UTC](https://forums.losant.com/t/how-to-create-a-custom-dashboard-using-vega-lite/4894/1 "2023-01-19T11:14:39Z")

</div>

I’m trying to develop a graph to analyze the energy consumed daily in peak demand and off-peak demand, I have these two values being stored in an attribute of my device but I don’t know how to manipulate these variables to generate a graph similar to the one shown in the figure Below, I have a basic layout of the graph that was taken from the Vega lite platform, I would like to know if anyone can help me.

> **[Grouped Bar Chart](https://vega.github.io/vega-lite/examples/bar_grouped.html)**
>
> Read here for more details about how to set step size for grouped bar.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/c/c4d8b49c49a68d1a5a8550f47efba01d9bc1616a.png)

---

<div class="post-metadata">

**Author:** ![Lucas\_Pinheiro](https://avatars.discourse-cdn.com/v4/letter/l/bc79bd/32.png) [@Lucas\_Pinheiro](https://forums.losant.com/u/Lucas_Pinheiro)\
**Post date:** [January 19, 2023, 11:21am UTC](https://forums.losant.com/t/how-to-create-a-custom-dashboard-using-vega-lite/4894/2 "2023-01-19T11:21:58Z")

</div>

I also have an example using Chart JS

https://codepen.io/Shokeen/embed/preview/NpgbKg?default-tabs=js%2Cresult&height=300&host=https%3A%2F%2Fcodepen.io&slug-hash=NpgbKg

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [January 19, 2023, 2:29pm UTC](https://forums.losant.com/t/how-to-create-a-custom-dashboard-using-vega-lite/4894/3 "2023-01-19T14:29:31Z")

</div>

Could you make a [Time Series Graph](https://docs.losant.com/dashboards/blocks/time-series-graph/) with the following configuration?

- Duration: 30 days
- Resolution: 1 day
- Aggregation (on each segment): [Sum](https://docs.losant.com/references/aggregations/#sum)

I don’t know what your underlying data looks like; this assumes that what you are reporting up to the platform is the periodic power usage since the last report - i.e., 1 kWh since the last time the device reported state.

---

<div class="post-metadata">

**Author:** ![Lucas\_Pinheiro](https://avatars.discourse-cdn.com/v4/letter/l/bc79bd/32.png) [@Lucas\_Pinheiro](https://forums.losant.com/u/Lucas_Pinheiro)\
**Post date:** [January 25, 2023, 2:10pm UTC](https://forums.losant.com/t/how-to-create-a-custom-dashboard-using-vega-lite/4894/4 "2023-01-25T14:10:20Z")

</div>

If I want show the same graph on the stacked bar format, similar to the one shown in the figure Below, how must procedure?

> **[Stacked Bar Chart](https://vega.github.io/vega-lite/examples/stacked_bar_weather.html)**
>
> Vega-Lite - a high-level grammar for statistical graphics. Vega-Lite provides a higher-level grammar for visual analysis, comparable to ggplot or Tableau, that generates complete Vega specifications. Vega-Lite specifications consist of simple...

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [January 25, 2023, 5:41pm UTC](https://forums.losant.com/t/how-to-create-a-custom-dashboard-using-vega-lite/4894/5 "2023-01-25T17:41:33Z")

</div>

Sorry, but writing Vega chart specifications is not something we can provide support for.

We do have several examples in our [documentation](https://docs.losant.com/dashboards/blocks/custom-chart/#examples). The main difference between your example and how to build a Vega chart in Losant is that you must reference [named data sources](https://vega.github.io/vega-lite/docs/data.html#named) for accessing the data in your Losant queries.
