Skip to main content
100%

Fork of Fork of HTML Starter

✓ Published0🌍 Public
NNita
Last edited Jul 19, 2025
Created on Jul 19, 2025

This interactive bar chart displays four colored bars with values represented by their heights, using HTML, CSS, and vanilla JavaScript. It includes a y-axis with scale labels and buttons that randomize data, sort bars by value, and reset to initial values. Bar heights update with CSS transitions, while DOM manipulation via `getElementById` and `addEventListener` handles interactivity and animations.

AI-generated description

Interactive Bar Chart

A responsive and interactive bar chart that displays four colored bars representing different values.

Features

  • Colorful bars with dynamic heights representing values
  • Y-axis with scale labels
  • Interactive buttons:
    • Randomize: Generate random data values
    • Sort: Sort bars by value (highest to lowest)
    • Reset: Return to the initial data values
  • Smooth animations when values change
  • Responsive design that works on different screen sizes

Improvements

  • Added color gradient to bars for a modern look
  • Added proper axis labeling
  • Added sorting functionality
  • Added smoother animations with bounce effect
  • Improved mobile responsiveness
  • Added CSS variables for easier theming
  • Improved overall styling with shadows and rounded corners

Usage

Open index.html in a browser to view the chart. Use the interactive buttons to:

  1. Randomize Data: Generate new random values for all bars
  2. Sort By Value: Arrange bars from highest to lowest value
  3. Reset Data: Return to the initial values

The chart is responsive and will adapt to different screen sizes.

MIT Licensed

Similar vizzes