Nazmul Islam

A continuous learner

Deneb Templates for Power BI using Vega-lite

Deneb Templates for Power BI using Vega-lite

Share:

30 Aug 2024

Deneb is a powerful platform that allows you to create custom visualizations for your Power BI reports. These custom visuals can significantly enhance the storytelling capabilities of your reports and provide a more engaging user experience. In this post, we’ll explore some of the custom visualizations I’ve created using Deneb, which you can leverage in your own Power BI projects.

Area Chart with Gradient Fill

Is it working?

This is a picture

What a waste of time this is! Are you really able to live like this? How are you coping with the pain? Do you even feel any pain?

{
  // Dataset
  "data": {
    "name": "dataset"
  },

  // Layers.
  "layer": [

    {
      "mark": {
        "type": "area",
        "line": {
          "color": "brown"
          },
          "interpolate": "monotone",
        "color": {
          "x1": 0,
          "x2": 0,
          "y1": 1,
          "y2": 0,
          "gradient": "linear",
          "stops": [
            {
              "offset": 0,
              "color": "white"
            },
            {
              "offset": 1,
              "color": "darkblue"
            }
          ]
        }
      }
    }, // Area Layer.

    {
      "mark": {
        "type": "bar",
        "width": 2,
        "color": {
          "x1": 0,
          "x2": 0,
          "y1": 1,
          "y2": 0,
          "gradient": "linear",
          "stops": [
            {
              "offset": 0,
              "color": "white"
            },
            {
              "offset": 1,
              "color": "brown"
            }
          ]
        }
      }
    }, // Gradient Bar Layer.

    {
      "mark": {
        "type": "text",
        "fontWeight": "bold",
        "yOffset": -15,
        "size": 12
      },

      "encoding": {
        "text": {
          "field": "Total Actual",
        "format": "$#0,.K",
        "formatType": "pbiFormat"
        }
      }
    } // Data Labels.

  ],

  // Encodings.
  "encoding": {

    "x": {
      "field": "Month Name",
      "type": "nominal",
      "axis": {
        "labelAngle": 0
      }
    },

    "y": {
      "field": "Total Actual",
      "type": "quantitative",
      "axis": null
    }
  }
}
Example

Is it working?

What a waste of time this is! Are you really able to live like this? How are you coping with the pain? Do you even feel any pain?

{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A simple bar chart with embedded data.",
"data": {
    "values": [
    {"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43}
    ]
},
"mark": "bar",
"encoding": {
    "x": {"field": "a", "type": "nominal", "axis": {"title": "Category"}},
    "y": {"field": "b", "type": "quantitative", "axis": {"title": "Value"}}
}
} // This is a JSON script written in javascript.

Conclusion

By leveraging these Deneb custom visualizations, you can create more engaging and informative Power BI reports. Feel free to explore these options and adapt them to your specific needs. If you have any questions or require further assistance, please don’t hesitate to reach out.

Previous post:

Deneb: The Secret Weapon for Power BI Data Analysts

Next post:

Building Beautiful Visualizations with Vega-Lite: A Syntax Primer