help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back

Business Intelligence KPI Dashboard - Complete Documentation | Python | Power BI | Plotly | Pandas | Executive Reports | KPI Tracking | Forecasting | Alert System

Complete Documentation & Project Details for Business Intelligence KPI Dashboard - Comprehensive business intelligence dashboard with key performance indicators (KPIs), business metrics, and executive reports. Features include KPI Tracking and Visualization, Executive Summary Reports, Sales and Revenue Analytics, Performance Metrics Dashboard, Data Export and Sharing (CSV, Excel, PDF), Forecasting and Trend Analysis, Advanced KPIs (ROI, CLV, Conversion Metrics), Alert System, Data Filtering, Period Comparison, Advanced Visualizations (Scatter Plots, Box Plots, Correlation Heatmaps), and Interactive Web Dashboard. Perfect for Business Decision-Making, Performance Monitoring, and Strategic Insights. Features 3 Comprehensive Jupyter Notebooks and 8 Python Modules for Business Intelligence.

Business Intelligence KPI Dashboard - Project Description | Python | Power BI | Plotly | Pandas | Executive Reports

This project creates a comprehensive Business Intelligence KPI Dashboard using Python, Power BI, and Plotly for business intelligence and performance monitoring. The project includes KPI tracking and visualization with real-time monitoring of key performance indicators, executive summary reports with automated report generation and key insights extraction, sales and revenue analytics with detailed sales performance analysis and revenue trend tracking, performance metrics dashboard with comprehensive performance tracking and customizable KPI cards, data export and sharing (CSV, Excel, PDF formats) for sharing and analysis, forecasting and trend analysis using linear regression and moving average models to predict future trends, advanced KPIs including ROI calculation, Customer Lifetime Value (CLV), conversion metrics, and efficiency metrics, alert system with threshold management and real-time monitoring when KPIs exceed limits, data filtering by date range, category, value ranges, and custom conditions, period comparison for comparing performance across different time periods, advanced visualizations including scatter plots, box plots, correlation heatmaps, and comparison charts, and interactive web dashboard with filters and real-time updates. Perfect for business decision-making, performance monitoring, and strategic insights.

The Business Intelligence KPI Dashboard project features 3 comprehensive Jupyter notebooks (BI_Dashboard_Analysis.ipynb for basic analysis, Data_Processing.ipynb for data preparation, and Advanced_Features_Demo.ipynb for advanced features) covering KPI calculations, forecasting, alert systems, data processing, and advanced features. The project includes 8 Python modules (kpi_calculator.py for KPI calculations, data_processor.py for data processing, visualizations.py for dashboard visualizations, forecasting.py for trend analysis, advanced_kpis.py for advanced KPI calculations, data_filter.py for data filtering, alert_system.py for alert management, and export_manager.py for data export). Built with Python 3.8+, Power BI (for advanced visualizations), Plotly 5.14.0+ (for interactive charts), Pandas 1.5.0+ (for data manipulation), NumPy 1.23.0+ (for numerical computations), and Jupyter 1.0.0+ (for interactive development). The project supports CSV data loading with date columns for time-series analysis, sales/revenue columns for financial metrics, and category/product columns for segmentation.

BI Dashboard Screenshots | KPI Dashboard | Executive Reports | Sales Analytics | Interactive Dashboard Examples

1 / 4
Business Intelligence KPI Dashboard - Python Power BI Plotly - KPI Tracking - Executive Reports - Sales Analytics - Forecasting - RSK World

BI Dashboard Core Features | KPI Dashboard Features | Business Intelligence Features

KPI Tracking

  • Real-time KPI monitoring
  • Revenue, sales, customer metrics
  • Growth rate calculations
  • Monthly, quarterly, yearly aggregations
  • Performance tracking

Executive Reports

  • Automated report generation
  • Key insights extraction
  • Performance highlights
  • Export to multiple formats
  • High-level insights

Sales Analytics

  • Sales by category analysis
  • Revenue trend tracking
  • Performance heatmaps
  • Category distribution charts
  • Detailed performance analysis

Performance Dashboard

  • Interactive web dashboard
  • Real-time data visualization
  • Customizable KPI cards
  • Responsive design
  • Comprehensive tracking

Forecasting

  • Linear forecasting
  • Moving average forecasting
  • Trend detection
  • Seasonality detection
  • Future trend prediction

Jupyter Notebooks

  • BI_Dashboard_Analysis.ipynb
  • Data_Processing.ipynb
  • Advanced_Features_Demo.ipynb
  • All features demonstrated
  • Comprehensive tutorials

Advanced BI Dashboard Features | Forecasting | Alert System | Advanced KPIs | Data Filtering

Data Export

  • CSV data export
  • Excel formatted reports
  • PDF executive summaries
  • Data download and sharing

Alert System

  • Threshold management
  • Real-time monitoring
  • Alert classification
  • Alert dashboard

Advanced KPIs

  • ROI calculation
  • Customer Lifetime Value
  • Conversion metrics
  • Growth metrics (CAGR, MoM)

Data Filtering

  • Date range filtering
  • Category filtering
  • Value range filtering
  • Period comparison

Dashboard Features | BI Dashboard Features | Business Intelligence Features

Dashboard Feature Description Use Case
KPI Tracking and Visualization Real-time monitoring of key performance indicators with revenue, sales, customer, and order metrics Monitor business performance, track key metrics, make data-driven decisions
Executive Summary Reports Automated report generation with key insights extraction and performance highlights Provide high-level insights to decision makers, executive reporting
Sales and Revenue Analytics Detailed sales performance analysis with sales by category and revenue trend tracking Analyze sales performance, identify trends, optimize revenue
Forecasting and Trend Analysis Predict future trends using linear regression and moving average models Forecast business metrics, identify trends, plan for future
Advanced KPIs ROI calculation, Customer Lifetime Value (CLV), conversion metrics, efficiency metrics Calculate advanced business metrics, measure ROI, analyze customer value
Alert System Set thresholds and get notified when KPIs exceed limits with real-time monitoring Monitor KPIs in real-time, get alerts for critical metrics
Data Filtering Filter by date range, category, value ranges, and custom conditions Focus on specific data subsets, analyze filtered data
Period Comparison Compare performance across different time periods with statistical analysis Compare periods, analyze growth, identify trends over time
Advanced Visualizations Scatter plots, box plots, correlation heatmaps, and comparison charts Analyze relationships between metrics, view distributions, identify correlations
Data Export and Sharing Export to CSV, Excel, PDF formats for sharing and analysis Share reports with stakeholders, export data for further analysis
Interactive Web Dashboard Web-based dashboard with filters, real-time updates, and responsive design Access dashboard from anywhere, real-time monitoring, mobile-friendly

Technologies Used | Python Technologies | BI Dashboard Stack | Business Intelligence Tools

This Business Intelligence KPI Dashboard project is built using modern Python business intelligence and data analytics technologies. The core implementation uses Python 3.8+ as the primary programming language, Power BI for advanced visualizations, Plotly 5.14.0+ for creating interactive charts and dashboards, and Pandas 1.5.0+ for data manipulation and analysis. The project includes NumPy 1.23.0+ for numerical computations, Jupyter 1.0.0+ for interactive development, and scikit-learn 1.3.0+ for machine learning and forecasting. The dashboard library features KPI tracking and visualization with real-time monitoring, executive summary reports with automated generation, sales and revenue analytics with detailed analysis, performance metrics dashboard with comprehensive tracking, data export and sharing (CSV, Excel, PDF), forecasting and trend analysis with linear and moving average models, advanced KPIs (ROI, CLV, conversion metrics), alert system with threshold management, data filtering by date range, category, and value ranges, period comparison for analyzing performance across time periods, advanced visualizations (scatter plots, box plots, correlation heatmaps), and interactive web dashboard for business decision-making, performance monitoring, and strategic insights.

The project uses Python as the core programming language and Power BI for advanced business intelligence visualizations. It supports business intelligence through KPI tracking with real-time monitoring of revenue, sales, customer, and order metrics, executive reports with automated generation and key insights extraction, sales analytics with sales by category analysis and revenue trend tracking, performance dashboard with interactive web dashboard and customizable KPI cards, forecasting with linear regression and moving average models, advanced KPIs including ROI calculation, Customer Lifetime Value (CLV), and conversion metrics, alert system with threshold management and real-time monitoring, data filtering by date range, category, value ranges, and custom conditions, period comparison for comparing performance across different time periods, advanced visualizations including scatter plots, box plots, correlation heatmaps, and comparison charts, and responsive design for all screen sizes. The project includes CSV data loading with date columns for time-series analysis, sales/revenue columns for financial metrics, and category/product columns for segmentation. The system includes interactive features such as real-time updates, filter controls for date range and category, KPI cards with visual display of key metrics, export capabilities to CSV, Excel, and PDF, and web-based dashboard for business intelligence, performance monitoring, strategic insights, and business decision-making applications.

Python 3.8+ Power BI Plotly 5.14.0+ Pandas 1.5.0+ NumPy 1.23.0+ Jupyter 1.0.0+ KPI Dashboard Executive Reports Forecasting Business Intelligence

Installation & Usage Guide | How to Install BI Dashboard | Setup Tutorial

Installation

Version: v1.0.0 (December 2024)

Install all required dependencies for the Business Intelligence KPI Dashboard project:

# Install all requirements pip install -r requirements.txt # Required packages: # - pandas>=1.5.0 # - numpy>=1.23.0 # - plotly>=5.14.0 # - jupyter>=1.0.0 # - openpyxl>=3.1.0 # - xlsxwriter>=3.1.0 # - matplotlib>=3.6.0 # - seaborn>=0.12.0 # - dash>=2.11.0 # - scikit-learn>=1.3.0 # - reportlab>=4.0.0 # Verify installation python -c "import pandas; import plotly; print('Installation successful!')"

Running Jupyter Notebooks

Start Jupyter Notebook to explore the BI dashboard examples:

# Start Jupyter Notebook jupyter notebook # Or use JupyterLab jupyter lab # Open the notebooks: # - BI_Dashboard_Analysis.ipynb - Main analysis notebook with all features # * KPI tracking and visualization # * Executive summary reports # * Sales and revenue analytics # * Performance metrics dashboard # * Data export and sharing # - Data_Processing.ipynb - Data preparation and processing # - Advanced_Features_Demo.ipynb - Advanced features demonstration # * Forecasting and trend analysis # * Advanced KPIs (ROI, CLV) # * Alert system # * Data filtering # * Advanced visualizations

Running Example Scripts

Run Python scripts to generate BI dashboard reports:

# Run main BI dashboard script: python main.py analyze data/sample_sales_data.csv # This will: # - Load sales data # - Calculate KPIs # - Generate executive summary # - Export processed data # Generate sample data: python generate_sample_data.py # Create visualizations: python main.py visualize data/sample_sales_data.csv # Example usage in Python: from src.kpi_calculator import KPICalculator from src.data_processor import DataProcessor from src.visualizations import DashboardVisualizations # Load and process data processor = DataProcessor() df = processor.load_csv('data/sample_sales_data.csv') df = processor.clean_data(df) # Calculate KPIs kpi_calc = KPICalculator(df) metrics = kpi_calc.calculate_performance_metrics() # Create visualizations viz = DashboardVisualizations(df) dashboard = viz.create_kpi_dashboard(metrics) dashboard.show()

Project Features

Explore the comprehensive BI dashboard features:

# Project Features (v1.0.0 - December 2024): # 1. KPI Tracking and Visualization - Real-time monitoring of key performance indicators # 2. Executive Summary Reports - Automated report generation with key insights # 3. Sales and Revenue Analytics - Detailed sales performance analysis # 4. Performance Metrics Dashboard - Comprehensive performance tracking # 5. Data Export and Sharing - CSV, Excel, PDF export formats # 6. Forecasting and Trend Analysis - Linear and moving average models # 7. Advanced KPIs - ROI, CLV, conversion metrics, efficiency metrics # 8. Alert System - Threshold management and real-time monitoring # 9. Data Filtering - Filter by date range, category, value ranges # 10. Period Comparison - Compare performance across time periods # 11. Advanced Visualizations - Scatter plots, box plots, correlation heatmaps # 12. Interactive Web Dashboard - Web-based dashboard with filters # 13. Responsive Design - Works on all screen sizes # 14. Data Loading - Load CSV files with date, sales, revenue, category columns # 15. 3 Jupyter Notebooks - BI_Dashboard_Analysis, Data_Processing, Advanced_Features_Demo # 16. 8 Python Modules - kpi_calculator, data_processor, visualizations, forecasting, # advanced_kpis, data_filter, alert_system, export_manager # All features are demonstrated in the Jupyter notebooks

Basic Usage Example

Create BI dashboard reports with Python:

# Basic Usage Example: from src.data_processor import DataProcessor from src.kpi_calculator import KPICalculator, calculate_executive_summary from src.visualizations import DashboardVisualizations from src.forecasting import ForecastingEngine from src.advanced_kpis import AdvancedKPICalculator # Load and process data processor = DataProcessor() df = processor.load_csv('data/sample_sales_data.csv') df = processor.clean_data(df) df = processor.add_date_features() # Calculate KPIs kpi_calc = KPICalculator(df) metrics = kpi_calc.calculate_performance_metrics() # Generate executive summary summary = calculate_executive_summary(df) print(f"Report Date: {summary['report_date']}") for insight in summary['key_insights']: print(f"• {insight}") # Create visualizations viz = DashboardVisualizations(df) dashboard = viz.create_kpi_dashboard(metrics) dashboard.show() # Forecasting forecast_engine = ForecastingEngine(df) forecast = forecast_engine.simple_linear_forecast('revenue', periods=30) # Advanced KPIs advanced_kpi = AdvancedKPICalculator(df) roi = advanced_kpi.calculate_roi() clv = advanced_kpi.calculate_customer_lifetime_value()

Project Structure | BI Dashboard File Structure | Source Code Organization

bi-dashboard/
├── README.md # Main documentation
├── FEATURES.md # Complete features list
├── CHANGELOG.md # Version history
├── PROJECT_INFO.md # Project information
├── CONTRIBUTING.md # Contribution guidelines
├── SETUP.md # Setup instructions
├── RELEASE_NOTES.md # Release notes
├── requirements.txt # Python dependencies
├── main.py # Main entry point
├── generate_sample_data.py # Sample data generator
├── .gitignore # Git ignore file
├── LICENSE # License file
│
├── notebooks/ # Jupyter notebooks
│ ├── BI_Dashboard_Analysis.ipynb # Main analysis notebook
│ ├── Data_Processing.ipynb # Data preparation
│ └── Advanced_Features_Demo.ipynb # Advanced features demo
│
├── src/ # Source code modules
│ ├── __init__.py # Package init
│ ├── kpi_calculator.py # KPI calculations
│ ├── data_processor.py # Data processing
│ ├── visualizations.py # Dashboard visualizations
│ ├── forecasting.py # Trend analysis
│ ├── advanced_kpis.py # Advanced KPI calculations
│ ├── data_filter.py # Data filtering
│ ├── alert_system.py # Alert management
│ └── export_manager.py # Data export
│
├── data/ # Data directory
│ └── sample_sales_data.csv # Sample sales data
│
├── dashboard/ # Web dashboard ├── styles.css # CSS styles └── visualizations.js # D3.js visualization code

Configuration Options | Plotly Configuration | BI Dashboard Customization Guide

Plotly Configuration

Version: v1.0.0 (December 2024)

Customize KPI dashboard visualization settings in Python code:

# Plotly Configuration for BI Dashboard import plotly.graph_objects as go from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from advanced_visualizations import create_interactive_treemap # Default configuration in tree_map_plotly.py: # - colorscale: 'Viridis' (can be 'Category20', 'Category10', 'Viridis', 'Plasma', 'Rainbow') # - branchvalues: 'total' (sum of children values) # - textinfo: 'label+value+percent parent' # - height: 800 (figure height in pixels) # - width: 1200 (figure width in pixels) # Customize in function calls: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() fig = create_treemap_plotly( data, title="Custom Tree Map", colorscale='Viridis', # Change color scheme height=1000, # Adjust height width=1400 # Adjust width ) # Available color schemes: # - 'Category20' (default): 20 distinct colors # - 'Category10': 10 distinct colors # - 'Viridis': Perceptually uniform colormap # - 'Plasma': Perceptually uniform colormap # - 'Rainbow': Rainbow color scale

Configuration Tips:

  • COLORSCALE: Choose from 'Category20', 'Category10', 'Viridis', 'Plasma', 'Rainbow'. Default: 'Category20'
  • BRANCHVALUES: 'total' (sum of children) or 'remainder' (parent minus children). Default: 'total'
  • TEXTINFO: Control displayed text: 'label', 'value', 'percent parent', 'percent root'. Default: 'label+value+percent parent'
  • HOOVERTEMPLATE: Customize hover tooltip information and format
  • DIMENSIONS: Set figure height and width in pixels. Default: 800x1200
  • EXPORT_FORMAT: HTML (interactive), JSON (data export), CSV (data export)

Hierarchical Data Format Requirements

Works with business data from JSON files or CSV files. Required structure:

# Supported data formats: # - JSON files with hierarchical structure (nested objects with name, value, children) # - CSV files with hierarchical columns (Department, SubDepartment, Value) # Required JSON structure: from data_utils import load_json_data # Load business data from JSON: data = load_json_data('data/sample_hierarchical_data.json') # Required JSON structure: # { # "name": "Root", # "value": 100, # "children": [ # {"name": "Child1", "value": 50, "children": [...]}, # {"name": "Child2", "value": 50} # ] # } # Required CSV structure (for organizational data): # Department,SubDepartment,Value # Sales,North,100 # Sales,South,150 # Marketing,Digital,200 # Works with: # - Any business data in JSON format # - CSV files with hierarchical columns # - Nested data structures # - Data created programmatically

Customizing Tree Map Appearance

Modify KPI dashboard visualization configurations in tree_map_plotly.py:

# Tree map customization in Python: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly import plotly.graph_objects as go # Load business data data = load_hierarchical_data() # Create KPI dashboard fig = create_treemap_plotly(data, title="My Tree Map") # Customize layout: fig.update_layout( title={ 'text': 'Custom Tree Map', 'x': 0.5, 'font': {'size': 24, 'color': '#1e293b'} }, height=1000, # Adjust height width=1400, # Adjust width margin=dict(l=50, r=50, t=80, b=50), showlegend=True ) # Customize appearance: # Colors based on color scheme (Category20, Viridis, etc.) # Sizes based on value # Text info based on textinfo parameter # Save customized KPI dashboard fig.write_html('custom_treemap.html')

Adding Custom BI Dashboards

Add new KPI dashboard visualizations using Plotly:

# Add new visualization function to tree_map_plotly.py: import plotly.graph_objects as go from data_utils import load_json_data def create_custom_treemap(data, title='Custom Tree Map', **kwargs): """Create a custom KPI dashboard visualization.""" def flatten_data(node, parent_path="", result=None): if result is None: result = [] current_path = f"{parent_path}/{node['name']}" if parent_path else node['name'] result.append({ 'path': current_path, 'value': node['value'], 'name': node['name'], 'parent': parent_path }) if 'children' in node: for child in node['children']: flatten_data(child, current_path, result) return result flattened = flatten_data(data) # Create KPI dashboard fig = go.Figure(go.Treemap( labels=[item['name'] for item in flattened], parents=[item['parent'] for item in flattened], values=[item['value'] for item in flattened], textinfo="label+value+percent parent", hovertemplate='%{label}
Value: %{value}', marker=dict(colorscale=kwargs.get('colorscale', 'Viridis')) )) fig.update_layout( title=title, height=kwargs.get('height', 800), width=kwargs.get('width', 1200) ) # Save if output file provided if kwargs.get('output_file'): fig.write_html(kwargs['output_file']) print(f"Tree map saved as '{kwargs['output_file']}'") return fig # Use in your code: from data_utils import load_json_data from tree_map_plotly import create_custom_treemap data = load_json_data('data/sample_hierarchical_data.json') fig = create_custom_treemap(data, title='My Custom Tree Map', colorscale='Plasma', output_file='custom_treemap.html')

Project Architecture | BI Dashboard Architecture | System Architecture | Technical Architecture

BI Dashboard Architecture

1. Plotly and D3.js Visualization Framework:

  • Built on Plotly for interactive KPI dashboard, sunburst, and icicle visualizations
  • Uses D3.js for web-based interactive business intelligence dashboards
  • Tree maps with rectangular hierarchical partitions
  • Sunburst charts with circular radial layout
  • Icicle charts with horizontal flow visualization
  • Interactive HTML output with zoom, pan, hover, and click

2. Data Processing Pipeline:

  • JSON file loading for business data (nested structures)
  • CSV file loading with hierarchical columns (Department, SubDepartment, Value)
  • Data conversion utilities (CSV to hierarchical, hierarchical to CSV)
  • Data validation and hierarchical structure validation
  • Statistics calculation (total value, node count, mean, min, max)

3. Visualization Components:

  • Tree maps for rectangular business intelligence dashboard
  • Sunburst charts for circular business intelligence dashboard
  • Icicle charts for horizontal hierarchical flow
  • Interactive drill-down for exploring deeper levels
  • Custom color schemes with real-time updates
  • Search functionality with real-time highlighting
  • Statistics panel with comprehensive metrics

Module Structure

The project is organized into focused modules:

# Module Structure: # tree_map_plotly.py - Tree map visualization functions from tree_map_plotly import ( load_hierarchical_data, # Load business data from JSON create_treemap_plotly # Create KPI dashboard visualization ) # sunburst_plotly.py - Sunburst chart visualization functions from sunburst_plotly import ( load_hierarchical_data, # Load business data create_sunburst_chart, # Create sunburst chart create_sunburst_from_csv # Create sunburst from CSV ) # advanced_visualizations.py - Advanced visualization features from advanced_visualizations import ( create_interactive_treemap, # Create interactive KPI dashboard create_animated_sunburst, # Create animated sunburst create_comparison_visualization # Compare multiple datasets ) # data_utils.py - Data utility functions from data_utils import ( load_json_data, # Load data from JSON save_json_data, # Save data to JSON csv_to_hierarchical, # Convert CSV to hierarchical hierarchical_to_csv, # Convert hierarchical to CSV filter_data_by_value, # Filter data by value range search_in_data, # Search nodes in data get_node_statistics # Get statistics (total, count, mean, etc.) )

Data Format and Processing

How business data is processed for visualization:

# Data Format Requirements: # Hierarchical JSON format (nested objects with name, value, children) # Example JSON structure: # { # "name": "Root", # "value": 100, # "children": [ # {"name": "Child1", "value": 50, "children": [...]}, # {"name": "Child2", "value": 50} # ] # } # Or CSV format (Department, SubDepartment, Value): # Department,SubDepartment,Value # Sales,North,100 # Sales,South,150 # Data Processing Flow: from data_utils import load_json_data, csv_to_hierarchical from tree_map_plotly import create_treemap_plotly # Load business data from JSON data = load_json_data('data/sample_hierarchical_data.json') # Or convert CSV to hierarchical data = csv_to_hierarchical('data/organizational_data.csv') # Create visualization fig = create_treemap_plotly(data, title="My Tree Map") fig.write_html('tree_map.html')

Visualization Types and Usage

Different KPI dashboard visualization types and their use cases:

  • Tree Maps: Rectangular business intelligence dashboard using go.Treemap() with Plotly
  • Sunburst Charts: Circular business intelligence dashboard using go.Sunburst() with radial layout
  • Icicle Charts: Horizontal hierarchical flow using go.Icicle() with rectangular partitions
  • Interactive Drill-Down: Click handlers using Plotly's click events to explore deeper levels
  • Custom Color Schemes: Color scales using Plotly color scales (Category20, Viridis, Plasma, Rainbow)
  • Data Export/Import: JSON/CSV conversion using data_utils functions
  • Search Functionality: Node search using string matching and highlighting
  • Statistics Panel: Real-time metrics using get_node_statistics() function
  • Advanced Filtering: Value range filtering using filter_data_by_value() function
  • Comparison Mode: Side-by-side comparison using multiple figure subplots

Advanced Features Usage | BI Dashboard Usage Guide | How to Use BI Dashboard

Using Basic Network Functions

How to create different types of network visualizations:

# Basic Tree Map Usage Examples: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_chart from data_utils import load_json_data, csv_to_hierarchical # Load business data data = load_hierarchical_data() # Or load from JSON: data = load_json_data('data/sample_hierarchical_data.json') # Or convert CSV: data = csv_to_hierarchical('data/organizational_data.csv') # 1. Create Basic Tree Map: fig1 = create_treemap_plotly(data, title='Tree Map') fig1.show() # 2. Create Sunburst Chart: fig2 = create_sunburst_chart(data, title='Sunburst Chart') fig2.show() # 3. Create Interactive Tree Map with Custom Colors: from advanced_visualizations import create_interactive_treemap fig3 = create_interactive_treemap(data, title='Interactive Tree Map', colorscale='Viridis') fig3.show() # 4. Create Tree Map with Statistics: from data_utils import get_node_statistics stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}, Node Count: {stats['node_count']}") # 5. Create Comparison Visualization: from advanced_visualizations import create_comparison_visualization fig5 = create_comparison_visualization([data, data2], titles=['Dataset 1', 'Dataset 2']) fig5.show()

Using Advanced Features

Create advanced KPI dashboard visualizations:

# Advanced Features Usage: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from advanced_visualizations import create_interactive_treemap, create_comparison_visualization from data_utils import load_json_data, get_node_statistics, filter_data_by_value, search_in_data # Load business data data = load_hierarchical_data() # 1. Statistics Analysis: stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}") print(f"Node Count: {stats['node_count']}") print(f"Mean Value: {stats['mean_value']}") # 2. Search Functionality: search_results = search_in_data(data, 'Sales') print(f"Found nodes: {search_results}") # 3. Advanced Filtering: filtered_data = filter_data_by_value(data, min_value=50, max_value=200) fig = create_treemap_plotly(filtered_data, title='Filtered Tree Map') fig.show() # 4. Interactive Tree Map with Custom Colors: fig = create_interactive_treemap(data, title='Interactive Tree Map', colorscale='Plasma') fig.show() # 5. Comparison Visualization: data2 = load_json_data('data/sales_data.json') fig = create_comparison_visualization([data, data2], titles=['Organizational', 'Sales']) fig.show() # 6. Data Export: from data_utils import save_json_data, hierarchical_to_csv save_json_data(data, 'exported_data.json') hierarchical_to_csv(data, 'exported_data.csv')

Understanding Visualization Types

When to use different visualization types for business data:

# Visualization Type Usage Guide: # 1. Tree Maps # - Use: Visualize business data in rectangular partitions # - Shows: Nested rectangles sized by value, color-coded by level # - Best for: Understanding value distribution, comparing sizes # - Example: Organizational charts, file systems, sales data # 2. Sunburst Charts # - Use: Display business data in circular radial format # - Shows: Concentric rings representing hierarchy levels # - Best for: Circular hierarchical exploration, radial navigation # - Example: Organizational structures, category breakdowns, nested data # 3. Icicle Charts # - Use: Show hierarchical flow in horizontal layout # - Shows: Horizontal rectangular partitions flowing left to right # - Best for: Horizontal hierarchy exploration, flow visualization # - Example: Process flows, organizational hierarchies, sequential data # 4. Interactive Drill-Down # - Use: Explore deeper levels in the hierarchy # - Shows: Click to navigate to child nodes, smooth transitions # - Best for: Exploring nested structures, detailed investigation # - Example: File system navigation, organizational exploration # 5. Custom Color Schemes # - Use: Customize visualization appearance # - Shows: Different color palettes (Category20, Viridis, Plasma, Rainbow) # - Best for: Improving distinction, matching brand colors # - Example: Brand-aligned visualizations, improved readability # 6. Search Functionality # - Use: Find specific nodes quickly # - Shows: Real-time highlighting of search results # - Best for: Large hierarchies, finding specific items # - Example: Finding departments, locating files, searching data # 7. Statistics Panel # - Use: Understand data distribution and metrics # - Shows: Total value, node count, mean, min, max values # - Best for: Data analysis, understanding distribution # - Example: Sales analysis, budget analysis, data overview # 8. Advanced Filtering # - Use: Focus on specific data subsets # - Shows: Filtered visualization based on value ranges # - Best for: Analyzing subsets, focusing on ranges # - Example: High-value items, low-value analysis, range filtering # 9. Comparison Mode # - Use: Compare multiple datasets side-by-side # - Shows: Multiple visualizations with statistical comparison # - Best for: Dataset comparison, before/after analysis # - Example: Year-over-year comparison, department comparison # 10. Data Export/Import # - Use: Share data and integrate with other tools # - Shows: JSON/CSV export and import with format conversion # - Best for: Data sharing, tool integration, data persistence # - Example: Exporting results, importing external data

Data Preparation and Customization

Prepare and customize your network data for analysis:

# Data Preparation Examples: from data_utils import load_json_data, csv_to_hierarchical, save_json_data, hierarchical_to_csv from tree_map_plotly import load_hierarchical_data # 1. Load Hierarchical Data from JSON: data = load_json_data('data/sample_hierarchical_data.json') # Returns hierarchical dictionary structure # 2. Load from CSV and Convert to Hierarchical: data = csv_to_hierarchical('data/organizational_data.csv') # Converts CSV to hierarchical format # 3. Create Hierarchical Data Programmatically: data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50, "children": []}, {"name": "Child2", "value": 50} ] } # 4. Add Node Attributes: def add_attributes(node): node['label'] = node.get('name', 'Unknown') node['category'] = node.get('category', 'default') if 'children' in node: for child in node['children']: add_attributes(child) add_attributes(data) # 5. Filter Data by Value: from data_utils import filter_data_by_value filtered_data = filter_data_by_value(data, min_value=50, max_value=200) # 6. Search in Data: from data_utils import search_in_data search_results = search_in_data(data, 'Sales') # 7. Get Statistics: from data_utils import get_node_statistics stats = get_node_statistics(data) # Returns dictionary with total_value, node_count, mean_value, etc.

Exporting Tree Maps

Export KPI dashboards and data to different formats:

# Export Tree Map Examples: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from data_utils import save_json_data, hierarchical_to_csv, get_node_statistics # Load business data data = load_hierarchical_data() # Create visualization fig = create_treemap_plotly(data, title="My Tree Map") # 1. Export as HTML (interactive, default): fig.write_html('tree_map.html') # Opens in browser with full interactivity # 2. Export Data as JSON: save_json_data(data, filename='tree_map_data.json') # 3. Export Data as CSV: hierarchical_to_csv(data, filename='tree_map_data.csv') # 4. Export Statistics: stats = get_node_statistics(data) import json with open('statistics.json', 'w') as f: json.dump(stats, f, indent=2) # 5. Export Filtered Data: from data_utils import filter_data_by_value filtered = filter_data_by_value(data, min_value=50, max_value=200) save_json_data(filtered, filename='filtered_data.json')

Complete BI Dashboard Workflow | Step-by-Step Guide | Tree Map Tutorial

Step-by-Step BI Dashboard Setup

Step 1: Install Dependencies

# Install all required packages pip install -r requirements.txt # Required packages: # - plotly>=5.17.0 # - pandas>=2.0.0 # - numpy>=1.24.0 # - jupyter>=1.0.0 # Verify installation python -c "import plotly; import pandas; import numpy; print('Installation successful!')"

Step 2: Prepare Hierarchical Data

# Option 1: Load business data from JSON file from data_utils import load_json_data # Load business data (nested structure) data = load_json_data('data/sample_hierarchical_data.json') # Option 2: Load from CSV and convert to hierarchical from data_utils import csv_to_hierarchical data = csv_to_hierarchical('data/organizational_data.csv') # Option 3: Create business data programmatically data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50}, {"name": "Child2", "value": 50} ] } # Data format (JSON): # { # "name": "Root", # "value": 100, # "children": [{"name": "Child1", "value": 50}] # }

Step 3: Create Basic BI Dashboards

# Run main KPI dashboard script: python tree_map_plotly.py # This will: # - Load business data # - Create interactive KPI dashboard # - Generate interactive HTML visualization # - Display in browser # Or create visualizations programmatically: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_chart data = load_hierarchical_data() fig = create_treemap_plotly(data, title="My Tree Map") fig.show() # Export visualization: fig.write_html('tree_map.html') # Open HTML file in browser to view interactive KPI dashboard

Step 4: Explore Jupyter Notebook

  • Open BI_Dashboard_Analysis.ipynb for comprehensive tutorial
  • Run cells step-by-step to learn each visualization type
  • Explore interactive KPI dashboards, sunburst charts, icicle charts
  • Modify code examples to use different business data
  • Export visualizations as HTML, JSON, or CSV

Step 5: Customize BI Dashboards

# Customize KPI dashboard visualizations in Python code: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() # Change color scheme fig = create_treemap_plotly(data, title="Tree Map", colorscale='Viridis') # Available colorscales: 'Category20', 'Category10', 'Viridis', 'Plasma', 'Rainbow' # Adjust dimensions fig.update_layout(height=1000, width=1400) # Customize text info # Options: 'label', 'value', 'percent parent', 'percent root' # Use advanced features from advanced_visualizations import create_interactive_treemap fig = create_interactive_treemap(data, title="Interactive Tree Map", colorscale='Plasma') # Modify tree_map_plotly.py for advanced configurations

BI Dashboard Customization Examples | Customization Guide | Code Examples

Customizing Color Schemes

Change color schemes and styling for KPI dashboards:

# Customize Color Schemes: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() # Available color schemes: # 'Category20' (default), 'Category10', 'Viridis', 'Plasma', 'Rainbow' # Example 1: Use Category20 (default, 20 distinct colors) fig = create_treemap_plotly(data, title="Tree Map", colorscale='Category20') fig.show() # Example 2: Use Viridis (perceptually uniform) fig = create_treemap_plotly(data, title="Tree Map", colorscale='Viridis') fig.show() # Example 3: Use Plasma (perceptually uniform) fig = create_treemap_plotly(data, title="Tree Map", colorscale='Plasma') fig.show() # Example 4: Use Rainbow fig = create_treemap_plotly(data, title="Tree Map", colorscale='Rainbow') fig.show() # Note: Category20 is default for better color distinction

Adjusting Tree Map Appearance

Control text info, hover templates, and visual styling:

# Adjust Tree Map Appearance: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly import plotly.graph_objects as go data = load_hierarchical_data() # Text info options: # - 'label' - Show node names # - 'value' - Show node values # - 'percent parent' - Show percentage of parent # - 'percent root' - Show percentage of root # Example 1: Show label and value fig = go.Figure(go.Treemap( labels=[...], values=[...], textinfo="label+value" )) fig.show() # Example 2: Show label, value, and percent parent fig = go.Figure(go.Treemap( labels=[...], values=[...], textinfo="label+value+percent parent" )) fig.show() # Example 3: Custom hover template fig = go.Figure(go.Treemap( labels=[...], values=[...], hovertemplate='%{label}
Value: %{value}
Percentage: %{percentParent:.2%}' )) fig.show() # Example 4: Adjust dimensions fig = create_treemap_plotly(data, title="Tree Map") fig.update_layout(height=1000, width=1400) fig.show()

Changing Visualization Types

Create different types of business intelligence dashboards:

# Create Different Visualization Types: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_chart from advanced_visualizations import create_interactive_treemap data = load_hierarchical_data() # Available visualization types: # 'treemap' - Rectangular business intelligence dashboard # 'sunburst' - Circular radial visualization # 'icicle' - Horizontal flow visualization # Example 1: Tree Map fig1 = create_treemap_plotly(data, title="Tree Map") fig1.show() # Example 2: Sunburst Chart fig2 = create_sunburst_chart(data, title="Sunburst Chart") fig2.show() # Example 3: Interactive Tree Map with Custom Colors fig3 = create_interactive_treemap(data, title="Interactive Tree Map", colorscale='Plasma') fig3.show() # Example 4: Tree Map with Different Color Scheme fig4 = create_treemap_plotly(data, title="Tree Map", colorscale='Viridis') fig4.show() # Tip: Tree maps for value comparison, sunburst for circular exploration

Modifying Data Source

Load business data from different sources:

# Load Hierarchical Data from Different Sources: from data_utils import load_json_data, csv_to_hierarchical from tree_map_plotly import create_treemap_plotly import json # Option 1: Load from JSON file (hierarchical format, recommended) data = load_json_data('data/sample_hierarchical_data.json') # Required structure: {"name": "...", "value": ..., "children": [...]} # Option 2: Load from CSV and convert to hierarchical data = csv_to_hierarchical('data/organizational_data.csv') # Required columns: Department, SubDepartment, Value # Option 3: Create business data programmatically data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50}, {"name": "Child2", "value": 50} ] } # Option 4: Load from JSON file directly with open('data/sample_hierarchical_data.json', 'r') as f: data = json.load(f) # Option 5: Load different sample datasets data1 = load_json_data('data/sample_hierarchical_data.json') # Organizational data2 = load_json_data('data/file_system_data.json') # File system data3 = load_json_data('data/sales_data.json') # Sales data # Then create visualization fig = create_treemap_plotly(data, title="My Tree Map") fig.write_html('tree_map.html')

Customizing Tree Map Layout

Modify KPI dashboard appearance and layout settings:

# Customize Tree Map Layout: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly import plotly.graph_objects as go # Load business data data = load_hierarchical_data() # Create visualization fig = create_treemap_plotly(data, title="My Tree Map") # Customize layout fig.update_layout( title={ 'text': 'Custom Tree Map', 'x': 0.5, 'font': {'size': 24, 'color': '#1e293b'} }, height=1000, # Adjust height (default: 800) width=1400, # Adjust width (default: 1200) margin=dict(l=50, r=50, t=80, b=50), showlegend=True ) # Customize colors fig.update_traces( marker=dict(colorscale='Viridis'), textinfo="label+value+percent parent" ) # Save customized KPI dashboard fig.write_html('custom_treemap.html')

Network Data Information | Data Format | Edge List Format | Data Requirements

Data Format Requirements

The project works with edge list format for network data:

  • Required columns: source, target (weight is optional)
  • Node identifiers: Can be strings, integers, or any hashable type
  • Edge weights: Numeric values (optional, defaults to 1.0)
  • Automatic NetworkX Graph object creation
  • Support for directed and undirected networks
  • Automatic network validation and structure checking

Sample Data Format

Your network data CSV file should follow this structure:

# CSV file structure (network_data.csv): source,target,weight A,B,1.0 B,C,2.0 C,D,1.5 A,C,0.8 B,D,1.2 C,E,2.5 # Column descriptions: # - source: Source node identifier (string or integer) # - target: Target node identifier (string or integer) # - weight: Edge weight (numeric, optional, defaults to 1.0) # For unweighted networks, weight column can be omitted: # source,target # A,B # B,C # C,D # For multiple networks, use separate files or create multiple Graph objects

Loading Hierarchical Data

Load business data from JSON or CSV files:

# Load business data from JSON or CSV from data_utils import load_json_data, csv_to_hierarchical # Load from JSON (recommended): data = load_json_data('data/sample_hierarchical_data.json') # Load from CSV and convert: data = csv_to_hierarchical('data/organizational_data.csv') # Or create programmatically: data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50}, {"name": "Child2", "value": 50} ] } # Sample datasets available: # - sample_hierarchical_data.json (organizational structure) # - organizational_data.csv (department data) # - file_system_data.json (file system hierarchy) # - sales_data.json (sales revenue data) # Save business data: from data_utils import save_json_data, hierarchical_to_csv save_json_data(data, 'my_data.json') hierarchical_to_csv(data, 'my_data.csv')

Using Your Own Hierarchical Data

Use your own business data for visualization:

# Steps to use your own business data: # 1. Prepare your JSON file # - Required: name, value fields (children is optional) # - Name: Node identifier (string) # - Value: Numeric value for sizing # - Children: Array of child nodes (optional, for nested structure) # 2. Load and validate data from data_utils import load_json_data data = load_json_data('your_hierarchical_data.json') # Returns hierarchical dictionary structure # 3. Create visualization from tree_map_plotly import create_treemap_plotly from sunburst_plotly import create_sunburst_chart fig = create_treemap_plotly(data, title="My Tree Map") fig.write_html('tree_map.html') # 4. Verify data format # - Check name and value fields exist # - Ensure values are numeric # - Verify hierarchical structure is valid # - Check for proper nesting (children arrays) # 5. Use with all visualization types # - All visualization types work with your data # - Tree maps work automatically # - Sunburst charts work with any business data # - Icicle charts work with validated hierarchical structures

Troubleshooting & Best Practices | Common Issues | Performance Optimization | Best Practices

Common Issues

  • Data Not Loading: Ensure JSON file has correct format (name, value, children structure). Check file path is correct
  • Hierarchical Data Not Found: Verify JSON file exists and has proper hierarchical structure. Check required fields (name, value)
  • Import Errors: Verify all dependencies installed: pip install -r requirements.txt. Check Python version (3.8+)
  • Data Format Errors: Ensure name and value fields exist. Verify values are numeric. Check hierarchical structure is valid
  • Visualization Not Rendering: Check browser console for JavaScript errors. Verify Plotly is loaded correctly. Check data size (very large hierarchies may be slow)
  • Slow Performance: Reduce hierarchy depth, filter low-value nodes, or process in smaller subsets for large hierarchies
  • Memory Issues: Reduce number of nodes, use data filtering, or process in smaller hierarchical subsets
  • Color Scheme Not Working: Verify color scheme name is correct ('Category20', 'Viridis', 'Plasma', 'Rainbow')
  • Search Not Working: Check search function is called correctly. Verify data structure supports search
  • Statistics Not Calculating: Ensure data has valid numeric values. Check get_node_statistics function is used correctly
  • Export Not Working: Verify file path is writable. Check JSON/CSV export functions are called correctly
  • HTML Files Not Opening: Open HTML files in modern browser (Chrome, Firefox, Edge). Check file path is correct
  • Drill-Down Not Working: Ensure data has children structure. Check click handlers are properly configured

Performance Optimization Tips

  • Hierarchy Size: Reduce hierarchy depth or filter low-value nodes to improve performance
  • Visualization Type: Use simpler visualizations for large hierarchies (KPI dashboards are faster than sunburst for very large data)
  • Color Scheme: Choose appropriate color scheme based on hierarchy size (Category20 for many nodes, Viridis for continuous data)
  • Caching: Cache data processing results to avoid repeated calculations
  • Data Preprocessing: Pre-process and validate business data before creating visualizations
  • Data Validation: Validate hierarchical structure early to avoid processing errors
  • HTML File Size: Large HTML files may load slowly. Consider filtering data or reducing hierarchy depth
  • Browser Performance: Use modern browsers for best performance. Clear cache if issues occur

Best Practices

  • Data Quality: Ensure business data is clean, nodes have valid names, and values are numeric
  • Data Format: Always validate hierarchical format and structure before visualization
  • Required Fields: Ensure name and value fields exist. Validate children structure is properly nested
  • Hierarchy Size: For large hierarchies (10K+ nodes), consider filtering or reducing depth
  • Color Schemes: Choose appropriate color schemes for your data type (Category20 for distinct, Viridis for continuous)
  • Error Handling: Add error handling in data functions to prevent crashes
  • Data Validation: Always validate hierarchical structure and types before processing
  • Export Formats: Use HTML for interactive sharing, JSON/CSV for data export
  • Visualization Types: Choose appropriate visualization types (KPI dashboards for value comparison, sunburst for exploration)
  • Documentation: Document custom modifications and data sources
  • Testing: Test with different business data types and sizes
  • Sharing: HTML files are standalone and portable. Share via email, cloud storage, or web hosting

Use Cases and Applications

  • Organizational Charts: Visualize organizational structures, departments, and hierarchies
  • File System Visualization: Display file system structures and directory hierarchies
  • Sales Data Analysis: Analyze sales data by region, product, and category
  • Budget Analysis: Visualize budget allocation across departments and projects
  • Category Breakdown: Display category hierarchies and subcategories
  • Product Hierarchies: Show product categories, subcategories, and items
  • Geographic Data: Visualize geographic hierarchies (country, state, city)
  • Project Management: Display project structures and task hierarchies
  • Data Reporting: Generate comprehensive business data reports with visualizations
  • Educational Purposes: Learn business data visualization and KPI dashboard concepts

Performance Benchmarks

Expected performance for different hierarchy sizes:

Hierarchy Size Nodes Load Time Visualization Render Memory Usage
Small 10 - 100 < 1 second < 1 second < 50 MB
Medium 100 - 1K 1-2 seconds 1-3 seconds 50-150 MB
Large 1K - 10K 2-5 seconds 3-8 seconds 150-400 MB
Very Large 10K+ 5-15 seconds 8-20 seconds 400+ MB

Note: Performance depends on hardware, hierarchy complexity, and visualization type. Basic KPI dashboards are faster than complex interactive visualizations. Consider data filtering for very large hierarchies.

System Requirements

Recommended system requirements for optimal performance:

Component Minimum Recommended Optimal
Python 3.8 3.9+ 3.10+
RAM 4 GB 8 GB 16 GB+
CPU 2 cores 4 cores 8+ cores
Storage 100 MB 500 MB 1 GB+
Browser Chrome 90+ Chrome 100+ Latest

Note: Tree maps run in browser. No GPU required. Performance scales with hierarchy size. HTML files are interactive and can be shared easily.

Real-World Examples & Use Cases | BI Dashboard Use Cases | Hierarchical Data Visualization Examples

Example 1: Basic BI Dashboard

Create business intelligence dashboards with KPI dashboards and sunburst charts:

# 1. Load business data from tree_map_plotly import load_hierarchical_data from data_utils import load_json_data data = load_hierarchical_data() # Or: data = load_json_data('data/sample_hierarchical_data.json') # 2. Create basic KPI dashboard from tree_map_plotly import create_treemap_plotly fig1 = create_treemap_plotly(data, title='Tree Map') fig1.show() # 3. Create sunburst chart from sunburst_plotly import create_sunburst_chart fig2 = create_sunburst_chart(data, title='Sunburst Chart') fig2.show() # 4. Create icicle chart from advanced_visualizations import create_icicle_chart fig3 = create_icicle_chart(data, title='Icicle Chart') fig3.show() # 5. Analyze hierarchical structure # - Identify value distribution # - Find largest nodes # - Analyze hierarchy depth # - Evaluate data organization

Example 2: Statistics and Search Functionality

Analyze data statistics and search for specific nodes:

# Use Case: Statistics analysis and search functionality # 1. Load business data from tree_map_plotly import load_hierarchical_data from data_utils import get_node_statistics, search_in_data data = load_hierarchical_data() # 2. Get statistics stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}") print(f"Node Count: {stats['node_count']}") print(f"Mean Value: {stats['mean_value']:.2f}") print(f"Min Value: {stats['min_value']}, Max Value: {stats['max_value']}") # 3. Search for nodes search_results = search_in_data(data, 'Sales') print(f"Found nodes: {search_results}") # 4. Create visualization with search highlighting from advanced_visualizations import create_interactive_treemap fig = create_interactive_treemap(data, title="Tree Map with Search", colorscale='Viridis') fig.show() # 5. Analyze results # - Identify high-value nodes # - Evaluate data distribution # - Find specific nodes quickly # - Understand value hierarchy

Example 3: Dataset Comparison

Compare multiple datasets side-by-side:

# Use Case: Dataset comparison # 1. Load multiple datasets from data_utils import load_json_data from advanced_visualizations import create_comparison_visualization data1 = load_json_data('data/sample_hierarchical_data.json') # Organizational data2 = load_json_data('data/sales_data.json') # Sales data3 = load_json_data('data/file_system_data.json') # File system # 2. Compare datasets datasets = [data1, data2, data3] fig = create_comparison_visualization(datasets, titles=['Organizational', 'Sales', 'File System']) fig.show() # 3. Analyze statistics for each dataset from data_utils import get_node_statistics for i, data in enumerate(datasets): stats = get_node_statistics(data) print(f"Dataset {i}: Total={stats['total_value']}, Nodes={stats['node_count']}") # 4. Visualize comparison side-by-side from tree_map_plotly import create_treemap_plotly import plotly.graph_objects as go from plotly.subplots import make_subplots fig = make_subplots(rows=1, cols=3, subplot_titles=('Organizational', 'Sales', 'File System')) # Add KPI dashboards to subplots fig.show() # 5. Analyze differences # - Compare data structures # - Evaluate value differences # - Understand hierarchy properties # - Identify patterns across datasets

Example 4: Advanced Filtering and Data Export

Filter data and export results:

# Use Case: Advanced filtering and data export # 1. Load business data from tree_map_plotly import load_hierarchical_data from data_utils import filter_data_by_value, save_json_data, hierarchical_to_csv data = load_hierarchical_data() # 2. Filter by value range filtered_data = filter_data_by_value(data, min_value=50, max_value=200) print(f"Filtered nodes: {len(filtered_data.get('children', []))}") # 3. Create visualization of filtered data from tree_map_plotly import create_treemap_plotly fig = create_treemap_plotly(filtered_data, title='Filtered Tree Map') fig.show() # 4. Export filtered data save_json_data(filtered_data, 'filtered_data.json') hierarchical_to_csv(filtered_data, 'filtered_data.csv') # 5. Use cases: # - Focus on high-value items # - Analyze specific value ranges # - Export filtered results # - Data subset analysis

Example 5: Comprehensive Tree Map Analysis

Comprehensive KPI dashboard analysis with all features:

# Use Case: Comprehensive KPI dashboard analysis # 1. Load business data from tree_map_plotly import load_hierarchical_data data = load_hierarchical_data() # 2. Get statistics from data_utils import get_node_statistics stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}") print(f"Node Count: {stats['node_count']}") print(f"Mean: {stats['mean_value']:.2f}") # 3. Search functionality from data_utils import search_in_data search_results = search_in_data(data, 'Sales') print(f"Found nodes: {search_results}") # 4. Filter data from data_utils import filter_data_by_value filtered = filter_data_by_value(data, min_value=50, max_value=200) # 5. Create multiple visualizations from tree_map_plotly import create_treemap_plotly from sunburst_plotly import create_sunburst_chart from advanced_visualizations import create_interactive_treemap fig1 = create_treemap_plotly(data, title='Tree Map') fig2 = create_sunburst_chart(data, title='Sunburst Chart') fig3 = create_interactive_treemap(data, title='Interactive Tree Map', colorscale='Plasma') # 6. Export data from data_utils import save_json_data, hierarchical_to_csv save_json_data(data, 'exported_data.json') hierarchical_to_csv(data, 'exported_data.csv') # 7. Use cases: # - Comprehensive hierarchical analysis # - Value distribution identification # - Data exploration and visualization # - Hierarchical structure assessment

Integration Examples | Database Integration | API Integration | Web Integration

Integration with Database

Load business data from SQL database:

# Load business data from SQL database import sqlite3 import pandas as pd from data_utils import csv_to_hierarchical from tree_map_plotly import create_treemap_plotly def load_hierarchical_from_db(dataset_id='dataset1'): """Load business data from SQL database.""" conn = sqlite3.connect('hierarchical_data.db') query = """ SELECT Department, SubDepartment, Value FROM organizational_data WHERE dataset_id = ? """ df = pd.read_sql_query(query, conn, params=[dataset_id]) conn.close() # Convert CSV format to hierarchical data = csv_to_hierarchical(df) return data # Load and create visualization data = load_hierarchical_from_db('dataset1') fig = create_treemap_plotly(data, title="Tree Map from Database") fig.write_html('tree_map_from_db.html') # For MySQL/PostgreSQL: # import mysql.connector # conn = mysql.connector.connect( # host='localhost', # user='username', # password='password', # database='hierarchical_db' # )

Integration with REST API

Load business data from REST API endpoint:

# Load business data from REST API import requests import json from data_utils import load_json_data from tree_map_plotly import create_treemap_plotly def load_hierarchical_from_api(): """Load business data from REST API.""" response = requests.get( 'https://api.example.com/hierarchical-data', headers={'Authorization': 'Bearer YOUR_TOKEN'} ) data = response.json() # Ensure required structure exists if 'name' in data and 'value' in data: return data else: raise ValueError("Invalid business data structure") return data # Load and create visualization data = load_hierarchical_from_api() fig = create_treemap_plotly(data, title="Tree Map from API") fig.write_html('tree_map_from_api.html') # For real-time updates, refresh data periodically: import time while True: data = load_hierarchical_from_api() fig = create_treemap_plotly(data, title="Live Tree Map") fig.write_html('tree_map_live.html') time.sleep(300) # Update every 5 minutes

Embedding Tree Maps in Web Pages

Embed interactive KPI dashboards in existing websites:

# Embed Tree Map in Web Page: # Option 1: Direct HTML embedding # The generated HTML files are standalone and can be embedded: <iframe src="path/to/tree_map.html" width="100%" height="700px" frameborder="0"> </iframe> # Option 2: Use Plotly's HTML output from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() fig = create_treemap_plotly(data, title="My Tree Map") # Get HTML div and script html_div = fig.to_html(include_plotlyjs='cdn', div_id='treemap-div') # Embed in your HTML page: # <div id="treemap-div"></div> # <script>...plotly.js code...</script> # Option 3: Serve HTML files via web server # Place HTML files in web server directory # Access via: https://yourdomain.com/tree-maps/tree_map.html # Option 4: Use Flask/Django to serve KPI dashboards from flask import Flask, send_file from tree_map_plotly import load_hierarchical_data, create_treemap_plotly app = Flask(__name__) @app.route('/treemap') def show_treemap(): data = load_hierarchical_data() fig = create_treemap_plotly(data, title="Tree Map") fig.write_html('static/tree_map.html') return send_file('static/tree_map.html')

Sharing Tree Maps

Share interactive KPI dashboards with others:

# Sharing Tree Map Options: # 1. Share HTML files directly # - HTML files are standalone and portable # - Can be opened in any browser # - No server required # - Share via email, cloud storage, etc. # 2. Upload to web hosting # - Upload HTML files to web server # - Share URL with team members # - Files remain interactive # 3. Export data (for sharing) from tree_map_plotly import load_hierarchical_data from data_utils import save_json_data, hierarchical_to_csv data = load_hierarchical_data() save_json_data(data, 'tree_map_data.json') hierarchical_to_csv(data, 'tree_map_data.csv') # Use in presentations, reports, documents # 4. Use Plotly Chart Studio (optional) # Upload to Plotly Chart Studio for cloud hosting # fig.write_html('tree_map.html') # Then upload to chart-studio.plotly.com # 5. GitHub Pages # - Push HTML files to GitHub repository # - Enable GitHub Pages # - Share public URL

Contact Information | Support | Get Help | Contact RSK World

Get in Touch

Developer: Molla Samser
Designer & Tester: Rima Khatun

rskworld.in
help@rskworld.in support@rskworld.in
+91 93305 39277

License | Open Source License | Project License

This project is for educational purposes only. See LICENSE file for more details.

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer