Using scatter charts – part 2

In addition to ‘Using scatter charts – part 1‘, this post will cover some more features and use cases for scatter charts.

In part 1 we ended with this result:

scatter_after

Now lets assume we wanted to use this scatter interactively. We then want to lasso a few bubbles and zoom in on them.

lasso-scatter

When we do that the chart will look like this after our selection is applied. (Figure 3)

after-lasso-scatter

Now, in some use cases it would be more convenient to keep the selected bubbles comparable to all of the bubbles. We can do this by using one of the most simple set analysis statements possible, using set analysis to exclude a certain dimension from the current selections. An example expression could be:

sum({<Customer = >} SalesPrice*Quantity)

Now if we would apply this idea to all of the expressions in the chart and we would make a selection, then the selection would be made but the chart would still show the same result. To add some feedback and adequate behavior to the chart we could do the following. Since the chart doesn’t respond to selections anymore we should color code the bubbles that are affected by the current selections. We should add the following adjustments to get from the end result (Figure 3) to the chart which we want:

    1. Add the exclusion for selected dimensions to your expression by using set analysis, like the example above
    2. Tell the chart that it has to color code the bubbles that are selected and to color code the non-selected bubbles differently, this can be done by getting an idea from this example:
if(Customer = Customer, rgb(41,133,251) , if((sum({<Customer = >} SalesPrice*Quantity)-sum({<Customer = >} (CostPrice)*Quantity)) / sum({<Customer = >} SalesPrice*Quantity) > 0.2 , argb(150,50,230,30) , argb(150,150,150,150) ))
    1. For more clarity and better feedback adjust the bubble size for the bubbles that are selected. This can be done by adding a third expression to the scatter chart and using an expression like this:
if(Customer = Customer , 2 , 1)

After these additions our scatter chart will look like this:

selected-bubbles-after-additions

As an example you can download the app. Thank Jesus Centeno for this request 😉

See you soon. Any feedback? Please put it in the comments.