I confess I was not a big fan of scatter plots until literally last week!
Why do I love them so much now? Because I found out how you can use them to make your Power BI reports even more interactive!
By combining a scatter plot chart with an image and the Play Axis custom visual, you can build a visualisation that will allow you to make objects "move" by themselves on your report!
This probably sounds a bit weird, so, as always, let me show you one example:
Yes, those circles are actually a formatted scatter plot chart! Underneath the scatter plot chart is an image of a football field.
And this gets even better! To check details of the players, you can click on any of the correspondent circles:
Pretty cool don't you think?? Let's go through the details :)
1) About the data:
In my example I used the Portuguese National Football Team data. I used two tables (you will probably need something similar too):
- One of my tables is the details of each player like age, rating, photo, etc.
- The other is the information on the position of the players during the simulation.
2) Find the perfect image and load it to Power BI Desktop. As I mentioned before, in my example I used an image of a football field. Next, let's add a scatter plot on top of the image and drag the fields we want to be using in the X-axis, Y-axis and Details:
> Drag field to X-Axis
> Drag field to Y-Axis
> Drag field to Details
> Change the default summarisation on the X-Axis and Y-Axis fields to average (this was specific for my example, so that I could see all the circles representing all the players in the game)
> On the Formatting Tab open Data Colours and change it to the colour you would like to use (you can also have multiple colours).
3) So that the scatter plot has the correct scaling and it fits with the image properly, you should define the start and end of both the X-axis and the Y-Axis.
For my example, I defined the positions of the players in an Excel sheet first, which looked like this:
X-Axis Y-Axis
Start: 0 Start: 0
End: 16 End: 10
After I decided which scaling I was going to apply to the players positions, I proceeded to change the axis in Power BI Desktop:
4) Now we just need to format our scatter plot chart, so it looks like the image and the chart are all in one:
> Make sure the scatter plot is align with the edges of your image!
> Disable both the X-Axis and the Y-Axis
> Make the circles look bigger by going to Shapes on the Formatting tab
> Still on the Formatting tab, turn on the Category Labels option and also the Show Background option
> Disable the Title
Make sure you don't have any background on the scatter plot chart!
5) Last part, to see your report coming to life, add the Play Axis custom visual:
> Click on Get More Visuals
> Search for "Play Axis" and import the custom visual to your report
> Add the time/date field you want to use on your Play Axis
> Change the colour of your play axis to whatever suits you best
You can download the report I used in this post from my GitHub account:
Here are a few more ideas on where you can use something similar to what I've built:
> IoT: you can add a scatter plot to a layout of a house or factory to represent sensors
> Manufacturing: You can simulate a process in a factory (product goes from A to B to C...)
> Tracking locations of people in a building
And so so many things you can do using this trick!
Cheers,
Mara
Comments