Deneb Example - Distributions

Deneb/Vega-Lite has built-in “binning” ability and can create histograms from raw data to display distributions. Further, while Power BI only permits a single dataset to be provided to custom visuals, additional datasets can be created using Vega-Lite’s data generators. The example herein consists of a 20-bin histogram of IMDB movie ratings overlaying a parameterized normal distribution using data from a sequence generator.

This example illustrates a number of Deneb/Vega-Lite features, including:

0 - General:

  • use of a “params” block to create range input widgets for the normal distribution height coefficient, mean, and standard deviation
  • use of a “layer” block consisting of 2 sections: normal distribution, and histogram

1 - Normal Distribution:

2 - Histogram:

  • use of a “bar” mark with X encoding for binning (20) and Y encoding for aggregation (count)
    {
      "name": "HISTOGRAM",
      "mark": {
        "type": "bar",
        "color": "#0F4C81",
        "opacity": 0.7,
        "tooltip": true
      },
      "encoding": {
        "x": {
          "bin": {"maxbins": 20},
          "field": "IMDB Rating",
          "type": "quantitative",
          "title": "IMDB Rating",
          "scale": {"domain": [0, 10]}
        },
        "y": {
          "aggregate": "count",
          "title": "Count"
        }
      }
    }

The intent of this example is not to provide a finished visual, but rather to serve as a starting point for further custom visual development.

Also included is the sample PBIX using the movies JSON file provided on the Vega-Lite examples website.

This example is provided as-is for information purposes only, and its use is solely at the discretion of the end user; no responsibility is assumed by the author.

Greg
Deneb Examples - Distributions.pbix (1.5 MB)

2 Likes

marking as solved

I am new to Enterprise DNA. Is it possible to change the distribution chart like Normal distribution’s mean to be as IMDB Rating’s mean as default and not to allow user’s to modify the mean. Currently here user can change the mean of Normal distribution.

Thank you.

Hi @nithesh.n15

Replying to a solved thread is discouraged on this forum. Please create a new thread for all new questions; you can link to a post in a solved thread if it helps explain your issue.

@EnterpriseDNA, please split this thread at the above post.

Regardless, to answer your question, yes, you can remove the display of the mean parameter so the user cannot change it. The example presented in my original post used 2 totally different unconnected datasets: 1 - IMDB Ratings from Power BI, and 2 - internally sequentially generated in Vega-Lite.

I believe what you ask can be done, but will entail a totally different approach to the statistical calculations in Vega-Lite for the normal distribution overlay. I’ll review and post to this thread if I find something.
Greg

1 Like

Thank you.