Tuesday, 30 June 2026

Building a Product Category Bar Chart in Apache Superset Using Realistic E-commerce Data

  

In this hands-on example, we use a real-world style product dataset containing smartphones, laptops, TVs, and accessories to build a bar chart in Apache Superset.

 

The goal is to visualize how products are distributed across different categories such as mobiles, laptops, TVs, and accessories. This helps in understanding product concentration and category-level business insights.

 

Dataset Overview

The dataset contains products across multiple categories:

 

·      Smartphones (iPhone 14, Galaxy S21 FE, Redmi Note 12)

·      Laptops (MacBook Air M2, Dell Inspiron, HP Pavilion)

·      TVs (Sony Bravia, Samsung Crystal 4K)

·      Accessories (Boat Earbuds, Logitech Mouse)

 

Each record includes:

·      Product ID

·      Product Name

·      Category ID

·      MRP & Selling Price

·      Brand

·      Stock Quantity

·      Timestamp

 

 


Follow below step-by-step procedure to build bar chart.

 

Step 1: Navigate to Charts tab.

 


Step 2: Create new chart.

 

Click on ‘+ Chart’ button.

 

Select the dataset as ‘products’ and select Bar Chart.

 


 

 

Click on Create new chart button.

 

Step 3: Set X-Axis as brand

Drag and drop brand column to X-axis. 

 


Step 4: Set Y-Axis

Set COUNT(product_id) Metric as Y-Axis

 

Drag and drop product_id column to Metrics, and set the aggregate operation as COUNT.

 

Save the settings and click on ‘Create chart’ button.

 

You can see bar chart create like below.

 


Step 5: Sort & Optimize

To make insights clearer:

·      Sort by count (descending)

·      Apply row limit if needed (e.g., top categories only)

 

For example, I set X-Axis sort by to COUNT(product_id)

 


After updating the chart, it looks like below.

 

By default, it displays the bar in ascending order of products by brand.

 

You can unselect the option ‘X-Axis Sort Ascending’ to sort the bars in descending order of brands.

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment