Blog
Blog
Share
April 27, 2023

Step-by-Step Rotating Radar Charts in Power BI

Empirisys had a request from a client to build a very specific visualisation feature in PowerBI: a radar chart that can rotate.

Our client wanted to visualise their data in quadrants, so wanted the ability to rotate a radar chart to a different starting angle. An example of this can be seen in the images below. This feature isn’t available on other radar charts so this step-by-step guide will show you how we built a Rotating Radar Chart.

In our previous experience building custom data visualisations, we have worked mainly with the D3.js library. D3 is compatible with PowerBI and has a rich feature set we could build from, so we used it to build this new visualisation, too. Check out our blog looking at creating brilliant data visualizations on Google Data Studio.

Step 1: Environment

The first step we took to create a radar chart was getting the environment set up for building the visualisation. Firstly, this needed node.js. Once node.js is installed, you can install the pbiviz tool. Instructions on how to set this tool up can be found in Microsoft’s Documentation, which talks through the environment setup, as well as installing the required dependencies.

Step 2: Set Up

Once we had the environment set up, it was time to start building the visualisation. For this stage of the process, we used this document, which talks through the process of setting up a circle card visualisation.

Step 3: Code

With this set up, we could see our circle card visual in our PowerBI Workspace. To start making changes, the main files that we edited were settings.ts, visual.ts, and capabilities.ts. Each of these files allowed us to change elements of the visualization.

  • Settings.ts allows you to modify the formatting panel of the PowerBI Visual, giving additional customisation options.
  • Visual.ts is the main file for the visualization, and has two main functions: a constructor, which is run when the visualization is created, and an update function, which runs every time the data or formatting options change. It is therefore important that any changes that you expect to happen when the data or formatting options change are implemented in the update function, and not the constructor.
  • Capabilities.ts contains instructions on how the data will be imported to the PowerBI visual. This file has some strict formatting instructions, so we found it best to use this resource to ensure our formatting was correct for PowerBI.

With this in mind, we wrote our code. We started with the capabilities.ts file, setting our data properties that the visual should use. We then setup a test dataset to build the visualization with some data. Then, we moved on to the settings.ts file to implement the style functionality of the visualization, followed by the visual.ts file to implement the visual. For most elements, we would create them in the constructor with no properties set, and update them by changing their properties in the update function.

Step 4: Package

With our visual completed, it was time to package it to a .pbviz file. This tutorial by Microsoft gives some good direction on how to do this. And with this finished, the file is ready to be imported to PowerBI.

Step 5: Publish

With the .pbviz file packaged, it can be distributed and imported to PowerBI. This can be done by clicking the three dots in the visualisation section, and then clicking Import Visual from file. Select the .pbviz file that you have created, and click open.

Below is a screenshot of our visual, to see what we created, along with an example of the angle changes.

And with that finished, our client was able to visualise their data at any degree they liked.

If you found this interesting, please let us know by getting in touch, giving us a clap or a follow. You can find more about us at empirisys.io or on Twitter at @empirisys or on LinkedIn. And you can drop us an e-mail at info@empirisys.io or directly to the author of this article, fred@empirisys.io.

Back