Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • Our Favorite Apple Watch Has Never Been Less Expensive
    • Vercel says it detected unauthorized access to its internal systems after a hacker using the ShinyHunters handle claimed a breach on BreachForums (Lawrence Abrams/BleepingComputer)
    • Today’s NYT Strands Hints, Answer and Help for April 20 #778
    • KV Cache Is Eating Your VRAM. Here’s How Google Fixed It With TurboQuant.
    • OneOdio Focus A1 Pro review
    • The 11 Best Fans to Buy Before It Gets Hot Again (2026)
    • A look at Dylan Patel’s SemiAnalysis, an AI newsletter and research firm that expects $100M+ in 2026 revenue from subscriptions and AI supply chain research (Abram Brown/The Information)
    • ‘Euphoria’ Season 3 Release Schedule: When Does Episode 2 Come Out?
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Sunday, April 19
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»Build a Data Dashboard Using HTML, CSS, and JavaScript
    Artificial Intelligence

    Build a Data Dashboard Using HTML, CSS, and JavaScript

    Editor Times FeaturedBy Editor Times FeaturedOctober 3, 2025No Comments16 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    dashboard to your prospects, purchasers, or fellow staff is changing into an important a part of the ability set required by software program builders, knowledge scientists, ML practitioners, and knowledge engineers. Even if you happen to work totally on back-end processing, the information you’re processing often must be “surfaced” to customers sooner or later. In case you’re fortunate, your organisation might have a devoted front-end crew to deal with that, however usually will probably be all the way down to you. 

    Being a straight-up Python developer with no expertise in HTML, JavaScript, and so on., is not an excuse, as many Python libraries, reminiscent of Streamlit and Gradio, have emerged over the previous few years.

    This text shouldn’t be about them, although, as a result of I’m a type of straight-up Python builders, and I’ve already achieved the Streamlit and Gradio factor. So it was time to roll up my sleeves and see if I might be taught new abilities and create a dashboard with these previous front-end improvement stalwarts: HTML, JavaScript, and CSS.

    The info for our dashboard will come from a neighborhood SQLite database. I created a sales_data desk in SQLite containing dummy gross sales knowledge. Right here is the information in tabular type.

    Picture by Writer

    Under is a few code that you should use to observe alongside and create your individual SQLite database and desk with the information as proven. 

    In case you’re questioning why I’m solely inserting a handful of information into my database, it’s not as a result of I don’t suppose the code can deal with massive knowledge volumes. It’s simply that I wished to focus on the dashboard performance fairly than being distracted by the information. Be at liberty to make use of the script I present beneath so as to add further information to the enter knowledge set if you happen to like.

    So, we keep within the Python world for only a bit longer as we arrange a SQLite DB programmatically.

    import sqlite3
    
    # Outline the database identify
    DATABASE_NAME = "C:Customersthomatasksmy-dashboardsales_data.db"
    
    # Hook up with SQLite database
    conn = sqlite3.join(DATABASE_NAME)
    
    # Create a cursor object
    cursor = conn.cursor()
    
    # SQL to create the 'gross sales' desk
    create_table_query = '''
    CREATE TABLE IF NOT EXISTS gross sales (
        order_id INTEGER PRIMARY KEY,
        order_date TEXT,
        customer_id INTEGER,
        customer_name TEXT,
        product_id INTEGER,
        product_names TEXT,
        classes TEXT,
        amount INTEGER,
        value REAL,
        whole REAL
    );
    '''
    
    # Execute the question to create the desk
    cursor.execute(create_table_query)
    
    # Pattern knowledge to insert into the 'gross sales' desk
    sample_data = [
        (1, "2022-08-01", 245, "Customer_884", 201, "Smartphone", "Electronics", 3, 90.02, 270.06),
        (2, "2022-02-19", 701, "Customer_1672", 205, "Printer", "Electronics", 6, 12.74, 76.44),
        (3, "2017-01-01", 184, "Customer_21720", 208, "Notebook", "Stationery", 8, 48.35, 386.80),
        (4, "2013-03-09", 275, "Customer_23770", 200, "Laptop", "Electronics", 3, 74.85, 224.55),
        (5, "2022-04-23", 960, "Customer_23790", 210, "Cabinet", "Office", 6, 53.77, 322.62),
        (6, "2019-07-10", 197, "Customer_25587", 202, "Desk", "Office", 3, 47.17, 141.51),
        (7, "2014-11-12", 510, "Customer_6912", 204, "Monitor", "Electronics", 5, 22.5, 112.5),
        (8, "2016-07-12", 150, "Customer_17761", 200, "Laptop", "Electronics", 9, 49.33, 443.97)
    ]
    
    # SQL to insert knowledge into the 'gross sales' desk
    insert_data_query = '''
    INSERT INTO gross sales (order_id, order_date, customer_id, customer_name, product_id, product_names, classes, amount, value, whole)
    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    '''
    
    # Insert the pattern knowledge
    cursor.executemany(insert_data_query, sample_data)
    
    # Commit the transaction
    conn.commit()
    
    # Shut the connection
    conn.shut()
    
    print(f"Database '{DATABASE_NAME}' has been created and populated efficiently.")

    Dashboard Performance

    Our dashboard can have the next performance.

    • Key Metrics. Complete income, whole orders, common order worth, prime class
    • Totally different Chart Sorts. Income Over Time (line chart), Income by Class (bar chart), Prime Merchandise by Income (horizontal bar chart)
    • Filtering. By date and class
    • Information Desk. Show our knowledge information in a paginated and searchable grid format.

    Organising our Setting

    Subsequent, we’ve a collection of steps to observe to arrange our surroundings.

    1/ Set up Node.js.

    Node.js is a runtime atmosphere that lets you run JavaScript exterior the browser, permitting you to make use of JavaScript to construct quick and scalable server-side purposes.

    So, guarantee Node.js is put in in your system to allow you to run a neighborhood server and handle packages. You possibly can obtain it from the Node.js official website.

    2/ Create a primary venture folder and subfolders

    Open your command terminal and run the next instructions. I’m utilizing Ubuntu on my Home windows field for this, however you’ll be able to change it to fit your most well-liked command-line utility and system.

    $ mkdir my-dashboard
    $ cd my-dashboard
    $ mkdir consumer
    % mkdir server

    3/ Initialise a Node venture

    $ npm init -y

    This command routinely creates a default package deal.json file in your venture listing with out requiring consumer enter.

    The -y flag solutions “sure” to all prompts, utilizing the default values for fields like:

    • identify
    • model
    • description
    • primary
    • scripts
    • creator
    • license

    Here’s what my package deal file regarded like.

    {
      "identify": "my-dashboard",
      "model": "1.0.0",
      "primary": "index.js",
      "scripts": {
        "check": "echo "Error: no check specified" && exit 1"
      },
      "key phrases": [],
      "creator": "",
      "license": "ISC",
      "description": "",
      "dependencies": {
        "categorical": "^4.21.2",
        "sqlite3": "^5.1.7"
      }
    }

    4/ Set up Specific and SQLite

    SQLite is a light-weight, file-based relational database engine that shops all of your knowledge in a single, transportable file, eliminating the necessity for a separate server.

    Specific is a minimal, versatile net software framework for Node.js that simplifies the constructing of APIs and net servers by means of routing and middleware.

    We will set up each utilizing the command beneath.

    $ npm set up categorical sqlite3

    Now, we are able to begin growing our code. For this venture, we’ll want 4 code information: an index.html file, a server.js file, a consumer.js file, and a script.js file. 

    Let’s undergo every of them step-by-step.

    1) consumer/index.html

    
    
    
        
        
        
        
        
        Gross sales Efficiency Dashboard
    
    
        

    Key Metrics