Skip navigation

Visualize your data from database tables into Bubble pack layout using d3js

Originally Posted on Author's Blog

Previously we saw how to build D3js Analog clock on the dashboard

In the same note, we dig deeper and now take our data from database tables and visualize into pretty bubbles.

Here is how the tabular data looks like

Brazil 5,197.89
Argentina 702.69
France 1,025,156.84
Germany 2,604,893.08
Saudi Arabia 628.89
Denmark 598,323.01
Singapore 909,996.22

Image

And this is what we get the final result as

Image

You can check the complete dashboard visualization here

https://my.infocaptor.com/dash/mt.php?pa=rename_new_510da16b539c7

 

Here are the steps to produce this kind of visualizations. In D3js it is called the bubble pack layout. Leaving the technicals of d3js aside we will follow the simple steps to get the beautiful bubbles.

If you hover your mouse you can see details of the numbers associated with each bubble.

Data Source: We used the following Excel file as our data source. sales_data_excel_file

1. We upload the data to our personal cloud warehouse using this method

2. We use the below SQL to get summary data

select country_name,sum(amount_sold) total_amount
from sales_data
group by country_name

3. We drag the custom draw widget

Image

4. In the data source we select personal cloud and add the following SQL

Image

5. In the javascript section we copy paste the following javascript file.

Bubble pack javascript with new tool tips (version 3)

Bubble pack javascript d3js code

Image

 

6. Click OK and you will see the bubbles. That is it!

NOTES:

1. Just make sure whatever data you want to visualize, the first column is the category or the dimension value.

2. The second column should be the numeric or the metrics.

3. You can have more columns in your SQL but only the first two columns will be considered.

Final Dashboard : https://my.infocaptor.com/dash/mt.php?pa=rename_new_510da16b539c7

ZcwZ36hxbpg

Chapters
United States
Argentina
Australia
Austria
Bahrain
Belgium
Brazil
Cambodia
Canada
China
Costa Rica
Czech Republic
Denmark
Dominican Republic
Ecuador
El Salvador
France
Germany
Global
Greece
Iceland
India
Indonesia
Ireland
Isle of Man
Israel
Italy
Japan
Jordan
Kazakhstan
Kenya
Kuwait
Malaysia
Mexico
Moldova
Mongolia
Morocco
Netherlands
New Zealand
Nigeria
Oman
Panama
Paraguay
Peru
Portugal
Puerto Rico
Qatar
Russia
Saudi Arabia
Singapore
South Africa
South Korea
Spain
Sri Lanka
Sweden
Switzerland
Tunisia
Turkey
Ukraine
United Arab Emirates
United Kingdom