If you take a look at the D3 gallery, you will quickly see how powerful of a tool it can be; the downside is that there is a fairly steep learning curve to get up and running for anyone without technical experience.
This is why we have put together the below files and instructions to allow anyone with the ability to cut and paste to create useful link analysis charts. Below are the only requirements for this exercise.
- Microsoft Excel
- Text Editor (such as Notepad)
- Modern Browser (basically anything after IE8)
Example Link Analysis Graph:
The most common use for link analysis charts in AML is to map relationships from transactional data. For this example, we are going to assume that we have a transaction spreadsheet with a column for originators and a column for beneficiaries.
Before we get started, click here for a demo to see what what the finished product will look like.
Step 1: Format the data
In order for our D3 script to render the chart, we have to format the data in the correct way. Attached is an Excel file that we created to help you do that.
First, you need to copy the column of originators from your transaction spreadsheet and paste them in the ‘source’ column. Next, you need to copy the column of beneficiaries and paste them into the ‘target’ column. Finally, starting at cell ‘C1’ you need to drag the formatting down to the last line of names.
This will create a properly structured comma separated value (CSV) list of names.
Step 2: Create the data file
Once you complete the above, open a text editor (e.g. Notepad) and paste everything from column C into the file. Save the file with the name of your choosing; just make sure it is saved as a .csv file.
This is an example of exactly how the file should be formatted.
Step 3: Link the data file to the graph file
Attached is also a file containing the D3 script to actually create the graph. Now that the data is formatted properly, we have to adjust the file’s code to grab the data from our newly created CSV file.
This file might look intimidating, but don’t worry, there is only one line that needs to be edited. Open the ‘graph-file.html’ file and edit the below line to replace ‘http://transparint.com/data/data.csv’ with the path where you saved your CSV file. Save this file to your computer.
Please note, by default your computer may open this file automatically with your web browser. To edit the file, you will need to open it with a text editor though. You can accomplish this by right-clicking on it to open it with Notepad or any other text editor.
Step 4: Open graph file in your browser
Now just open the ‘graph-file.html’ file with your favorite browser and enjoy! Your data should be rendered similar to this demo.
Link Analysis Files:
The attached zip file (Link_Chart_Files) contains the below:
- data-formater.xlxs – Excel file to help format data
- data.csv – Sample of properly formated data
- graph-file.html – Script to grab data and create link graph
- d3.v3.min.js – The graph file is set up to pull the D3 file over the web, but if your browser restricts this, the full D3.js file and be saved locally and linked
While this may seem like a lot of steps at first, once you have an understanding of the above you will be able to map out complex relationships within minutes. This is also the very tip of the iceberg of what is possible with D3. For example, this chart could be enhanced with transaction value labels over the links or by adding a search functionality. Below is a list of additional resources for anyone who wants to explore these possibilies.