Comics with PureViz

Published Categorized as Custom Visualisations, Infographic, PureViz 11 Comments on Comics with PureViz

I recently discovered a new feature in PowerPoint – “Cartoon People”. It offers the ability to mix and match bodies, faces and expressions and looked quite a bit of fun. I thought to myself – “Wouldn’t this be interesting if I could make these data-driven?”

So, I thought I’d give it a go 🙂

I first created the bodies, heads and template KPI Card on the PowerPoint Canvas

Then selected two facial expressions and laid them on top of each other

I selected all icons and saved as SVG

In Power BI, I imported the PureViz custom visual, dragged the appropriate fields into the fields well, then imported the SVG.

With PureViz, each individual PowerPoint icon is represented as a group of shapes.

I could select an individual shape within a group, and pick “Custom color …” option

To then apply a Dynamic Formula to make the colour of the shape data-driven

Similarly, I could select a group of shapes, in this case, one of the faces, and create a formula to show or hide the face

The formula I applied was If [Profit::sum] is less than 0.3 then 1 (show) else 0 (hide). I applied a similar formula to the other face – If [Profit::sum] is greater than or equal to 0.3 then 1 (show) else 0 (hide).

I then updated the text value to be data-driven using the Advanced Dynamic Formula.

And voila!! half an hour for a cheeky quick viz!

11 comments

  1. Kerry – an offtopic – I don’t know who to ask for help.

    How to use measure as variable in Deneb. I cannot get the syntax right. So below syntax is working perfectly since the value is set to 100. However whenever I want to replace 100 with measure it doesn’t work. DAX for “Mymeasure = 100”

    “params”: [
    {
    “name”: “theta_single_arc”,
    “value”: 100
    }

    I have tried

    “params”: [
    {
    “name”: “theta_single_arc”,
    “value”: {“expr”: {“field”: “MyMeasure”}}
    }

    Already tried a lot of different variations of above with no major success :(. I hope you can help

    1. Hello there,
      Stack Overflow is a good place to ask Vega questions, similarly, the Power BI Community site has a growing number of Deneb users that are super willing to help. You could post a question there with the label #Deneb and perhaps tag a few community members. There is a list of other places to get support here: https://deneb-viz.github.io/community/support#getting-support
      With regard to your question, I am not aware that you can reference a field within parameters, this might be better done in the encoding channels.

      1. I agree with Kerry; this seems like something better done in the encoding channels, but if you want to get a value from your dataset you can use pluck (https://vega.github.io/vega/docs/expressions/#pluck) with the data function and your named dataset (https://vega.github.io/vega/docs/expressions/#data).

        Assuming your dataset is a single row, you could use the following as a starting point (which will display a single text mark with your value to confirm):

        {
        “data”: {“name”: “dataset”},
        “params”: [
        {
        “name”: “myParamValue”,
        “expr”: “pluck(data(‘dataset’), ‘myMeasure’)”
        }
        ],
        “mark”: {
        “type”: “text”
        },
        “encoding”: {
        “text”: {
        “value”: {“expr”: “myParamValue”}
        }
        }
        }

        If you have multiple rows, you will need to add an array accessor ([]) to the end of the expression to get the single value you need, e.g.:

        {
        “data”: {“name”: “dataset”},
        “params”: [
        {
        “name”: “myParamValue”,
        “expr”: “pluck(data(‘dataset’), ‘myMeasure’)[0]”
        }
        ],
        “mark”: {
        “type”: “text”
        },
        “encoding”: {
        “text”: {
        “value”: {“expr”: “myParamValue”}
        }
        }
        }

          1. You’re welcome! Note that my example is actually a Vega-Lite spec, but it’ll work in Vega too 🙂 It’s just that the expression language is used by both (so it’s documentation sits under Vega, but is linked from the Vega-Lite docs)

Leave a comment

Your email address will not be published. Required fields are marked *