Viewing a saved revision (read-only)
4d29c71858ca4d72825125f6598d7892
Car Accidents by passenger type in Greece 2022
A grouped bar chart visualizes car accidents in Greece for 2022 by passenger category, comparing total, lethal, and non-lethal counts across seven configurations such as drivers-only and pedestrian-involved crashes. The chart uses D3.js v6 with an SVG rendering, employing `d3.scaleBand` for the categorical x-axis and `d3.scaleLinear` for the numeric y-axis. Bars are color-coded with cyan for totals, purple for non-lethal, and crimson for lethal accidents, as defined in the stylesheet. Data comes from a CSV file based on Greek statistics authority records.
AI-generated descriptionVisualization of Car Crash Data by Passenger Categories
This project visualizes car crash data categorized by different passenger configurations. The data includes the total number of accidents, as well as the breakdown into lethal and non-lethal accidents.
Data Format The data should be provided in a CSV file named CarCrashByPassengers.csv with the following format:
accidents by passenger categories, sum of accidents, lethal, non-lethal
only drivers, x, x, x
only passengers, x, x, x
only pedestrians, x, x, x
pedestrians and passengers, x, x, x
drivers and passengers, x, x, x
drivers and pedestrians, x, x, x
drivers, pedestrians, passengers, x, x, x
CSV file is a modified csv file from https://www.statistics.gr/el/statistics/-/publication/SDT04/2022
Project Structure
index.html: Contains the structure of the webpage, including
the SVG element where the visualization will be rendered and
the legend for the color-coded bars.
script.js: Contains the D3.js code to generate the bar chart
visualization.
Grouped Bar Chart:
The bar chart displays bars grouped by the type of passenger category. Each group contains three bars representing the sum of accidents, lethal accidents, and non-lethal accidents.
Color Coding:
Sum of Accidents: Cyan (#48d1cc)
Lethal Accidents: Crimson (crimson)
Non-Lethal Accidents: Purple (#9370db)
Axes:
The x-axis displays the passenger categories.
The y-axis shows the number of accidents.