Viewing a saved revision (read-only)
HjThh1tkuHrW9DV_KIF7W
Interactive reference-based scatter plot adapted from the Interactive Scatter Plot reference, plus a detailed README documenting the Drive History dataset.
Drive History Scatter Plot
An interactive scatter plot of the Drive History - Master dataset, adapted from the reference "Interactive Scatter Plot" implementation. Points represent individual trips. X and Y axis encodings, plus the point color encoding, are selectable from the actual dataset fields.
Files
index.html— page shell and import map (React + D3 from a CDN).index.jsx— mounts<App />.App.jsx— loads the dataset, wires up encoding menus, legend, and plot.viz.js— D3 render entry point for the scatter plot, axes, points, and Voronoi hover overlay.schema.js— column metadata (labels, types, accessors) for the dataset.parseData.js— robust CSV parser for the multi-line, quoted header file.useScatterData.js— hook that loads the CSV and parses it.useContainerDimensions.js— responsive sizing viaResizeObserver.ColorLegend.jsx,Tooltip.jsx— legend and hover tooltip UI.styles.css— page styles.
Dataset Overview
- Filename:
Drive History - Master - Drive History - Master.csv - Location:
/data/Drive History - Master - Drive History - Master.csv - Delimiter:
,between data fields. The header text is spread across multiple physical lines and contains|characters inside quoted names, so this implementation parses data rows by physical position rather than by header text. - Row count (as observed in preview): 222 data rows.
- Column count: 17.
Subject matter. A personal log of car trips ("drives") around Vancouver using two car-sharing / rental services (Evo and Enterprise). Each row records a single trip, including the date, which vehicle was used, how far the trip was, how many people were in the car, the trip's stated purpose, destination, and whether the trip was related to going home.
Column Descriptions
Types use Tamara Munzner's framework: Nominal, Ordinal, Quantitative, Temporal, Geographic coordinates, Geographic identifiers.
- Trip_Id — Sequential identifier assigned to each trip. Type: Quantitative (ID-like). Notes: no missing values observed.
- Month — Month name of the trip (e.g., "November"). Type: Nominal. Notes: redundant with Month_Number / Full Date.
- Year — Calendar year of the trip (e.g., 2022). Type: Temporal (year granularity). Notes: stored as integer.
- Month_Number — Numeric month 1–12. Type: Ordinal / Quantitative. Notes: redundant with Month.
- Date — Day of month (1–31). Type: Quantitative. Notes: redundant with Full Date.
- Full Date — ISO-formatted date string (e.g.,
2022-11-18). Type: Temporal. Notes: primary temporal field. - Evo/Enterprise (The 2 car rentals I use in Vancouver) — Which service the vehicle belongs to. Type: Nominal. Notes: values observed are Evo and Enterprise.
- Total Distance Travelled in km (color coded by distance) — Length of the trip in kilometres. Type: Quantitative. Notes: header contains a parenthetical note that the original spreadsheet color-coded the cell by distance; that note is not a data value.
- Vehicle Make — Manufacturer of the vehicle (e.g., Toyota). Type: Nominal.
- Vehicle Model — Model of the vehicle (e.g., Prius, Prius C). Type: Nominal.
- vehicle_id — Identifier of the specific vehicle. Type: Quantitative. Notes: ID-like, not an ordered measurement.
- Destination — Named place the trip ended at. Type: Geographic identifier (place name). Notes: not coordinates.
- Mainland Vancouver (Within/Outside) [Color] — Whether the trip was
within or outside Mainland Vancouver.
Type: Nominal. Notes: values observed are
I(within) andO(outside). - Purpose of the trip (W-work/L-leisure/M-meeting) — Purpose of the trip using single-letter codes. Type: Nominal. Notes: W = work, L = leisure, M = meeting.
- No. of people in the car — Count of people in the vehicle. Type: Quantitative.
- Home (To/From/Both/Neither) — Relationship of the trip to home.
Type: Nominal. Notes: values observed are
T(to),F(from),B(both),N(neither). - Notes — Free-text notes on the trip. Type: Nominal (free text). Notes: frequently empty.
Missing / unusual values: empty strings and NA are treated as missing.
Rows where the X or Y accessor returns a non-finite value are excluded from
the plot at render time. Values shown in the README above are based on the
observed preview schema and may differ slightly from the full file.
Visualization Mappings
- X axis (default):
Total Distance Travelled (km)— a genuine quantitative field with a useful spread for horizontal comparison. - Y axis (default):
No. of People in Car— a quantitative count with a small number of discrete values (mostly 1–4), producing readable horizontal bands of points. - Color (default):
Purpose of Trip— a meaningful nominal field (W/L/M) suitable for categorical color encoding.
Axis and color encodings are selectable through the menus at the top of the page. Numeric fields available for the axes are Trip ID, Year, Month Number, Day of Month, Vehicle ID, Distance, and No. of People. Categorical fields available for color are Purpose, Evo/Enterprise, Vehicle Make, Vehicle Model, Mainland Vancouver, Home, and Destination.
Visualization Ideas
Distance vs. People, Colored by Purpose (baseline scatter).
- Question: How does trip distance relate to the number of people in the car, and does that relationship differ by work/leisure/meeting purpose?
- Fields:
distance_km,people,purpose. - Encoding: Existing scatter plot: x = distance, y = people, color = purpose.
- Interaction: Hover a Voronoi cell to show a tooltip with trip details; clicking a legend swatch isolates that purpose.
- Implementation: This is already the default view in
App.jsx; add legend-click filtering so the point set dims non-selected categories.
Trip Volume by Provider over Time (small-multiple bar strips).
- Question: Did the mix of Evo vs. Enterprise trips change month to month?
- Fields:
full_date,year,month_number,provider. - Encoding: Small multiples of stacked bars, one panel per year; x = month number, y = trip count, fill = provider.
- Interaction: Hover a segment to show the exact month/provider count and the average distance of those trips.
- Implementation: Derive a
year×month_numberrollup from the parsed rows and render with a new D3 bar render function alongside the scatter.
Trip Distance Distribution by Provider (beeswarm / jittered strip).
- Question: Do Evo and Enterprise trips have different distance profiles?
- Fields:
provider,distance_km,trip_id. - Encoding: Two horizontal lanes (Evo, Enterprise) with points jittered vertically along a shared distance axis.
- Interaction: Hover a point to see trip ID, date, vehicle, and destination; click to pin it.
- Implementation: Reuse the existing tooltip; replace y-position with a randomized jitter band per provider.
Distance vs. People Faceted by Mainland Vancouver (small multiples).
- Question: Do trips within Mainland Vancouver look different from trips outside it in terms of distance and occupancy?
- Fields:
distance_km,people,mainland,purpose. - Encoding: Two scatter panels side by side (I = within, O = outside), each with the same axes and purpose coloring.
- Interaction: Brush a distance range in one panel and highlight the same range in the other.
- Implementation: Extend
renderScatterto accept a filtered dataset and render two<svg>panels sharing scales.
Trip Timeline (temporal scatter / dot timeline).
- Question: How are trips distributed across the two-plus years of the log, and are there clusters or gaps?
- Fields:
full_date,distance_km,purpose. - Encoding: x = full date (parsed), y = distance, points colored by purpose; a horizontal band marks each calendar year.
- Interaction: Brush a date range to filter the scatter and legend counts; a running counter shows how many trips fall in the selected window.
- Implementation: Parse
full_datewithd3.timeParse('%Y-%m-%d')and usescaleTime; wire the brushed range into the existing App state.
Home-Relation Flow (To / From / Both / Neither).
- Question: Which kinds of trips are anchored at home, and how does that relate to purpose and distance?
- Fields:
home,purpose,distance_km. - Encoding: A grouped bar chart: x = home category (T/F/B/N), stacked bars by purpose, bar height = trip count; a secondary encoded row shows median distance per group.
- Interaction: Hover a bar to show count, median distance, and a mini histogram of that group's distances.
- Implementation: Aggregate rows in a
useMemo; render with the existing D3 SVG root but a new bar renderer.
Vehicle Model Usage Treemap.
- Question: Which vehicle makes and models dominate the log, and how much distance is attributed to each?
- Fields:
vehicle_make,vehicle_model,distance_km. - Encoding: Treemap with hierarchical grouping (make → model); tile area = total distance, tile color = number of trips.
- Interaction: Hover a tile to show make, model, trip count, total and median distance.
- Implementation: Use
d3.hierarchy+d3.treemap; click a make to drill into its models.
Destination Frequency Ranked Bar with Purpose Split.
- Question: Which destinations are visited most, and are they work, leisure, or meeting destinations?
- Fields:
destination,purpose,distance_km. - Encoding: Horizontal bars sorted by frequency; each bar split into purpose segments; bar length = trip count.
- Interaction: Hover a segment to highlight matching scatter points in the linked scatter plot.
- Implementation: Roll up
destination×purpose; support a top-N control (e.g., top 10/20/All).
Parallel Coordinates of Trip Attributes.
- Question: What combinations of distance, people, and month_number characterize different purposes?
- Fields:
distance_km,people,month_number,purpose. - Encoding: Parallel-coordinate axes with one line per trip; lines colored by purpose.
- Interaction: Drag along an axis to filter; hovering a line shows the trip tooltip; legend hover dims non-matching lines.
- Implementation: Normalize each axis to its extent; add a new
renderParallel.jsalongsideviz.js.
Monthly Trip Count Heatmap by Provider and Purpose.
- Question: Are there months where one provider or purpose dominates?
- Fields:
year,month_number,provider,purpose. - Encoding: Small-multiple heatmaps: rows = provider, columns = month; cell color = trip count, one panel per year.
- Interaction: Hover a cell to show the exact count, its share, and median distance.
- Implementation: Rollup with
d3.rollup; render rectangles on a shared color scale (sequential, e.g.,d3.interpolateBlues).
Distance vs. People, Sized by Shared-Trip Indicator.
- Question: Are longer trips more likely to be shared with more people?
- Fields:
distance_km,people,purpose,trip_id. - Encoding: Scatter with x = distance, y = people, color = purpose, and a subtle outline on trips where
people > 1. - Interaction: A toggle dims solo trips to reveal the shared-trip pattern.
- Implementation: Add a boolean derived field; pass it as a stroke attribute in
renderScatter.
Calendar View (GitHub-style contribution grid of trips).
- Question: On which specific days do multiple trips happen, and are there patterns within the week?
- Fields:
full_date,distance_km,purpose. - Encoding: A year × week grid, one cell per day; cell color = number of trips that day, cell border emphasis for high-total-distance days.
- Interaction: Hover a day cell to show that day's trips in a side list; click to filter the scatter to that date.
- Implementation: Compute day-of-year grid with
d3.timeWeekand a day index; render cells in a newCalendarGrid.jsx.
Trip Distance by Purpose Box Plot / Strip Combo.
- Question: Do work, leisure, and meeting trips differ in their central distance and spread?
- Fields:
purpose,distance_km. - Encoding: Three vertical lanes with box plots overlaid on a jittered strip of individual points.
- Interaction: Hover a box to see quartiles and the count of trips in that category.
- Implementation: Compute quartiles with
d3.quantile; overlay a beeswarm of points in each lane.
Mainland vs. Off-Mainland Destination Map (symbolic, no coordinates).
- Question: Which destinations are inside Mainland Vancouver versus outside, and how far are the outside ones?
- Fields:
destination,mainland,distance_km. - Encoding: A grouped dot-and-label layout: inside-lane and outside-lane, each destination plotted once at its median distance, dot size = trip count, color = purpose mix.
- Interaction: Hover a dot to list the trips to that destination and show their dates.
- Implementation: Group by
destination, sort within each lane by median distance, and render as a labeled dot plot.
People Count Distribution by Purpose (ordinal bar).
- Question: Does trip purpose correlate with how many people were in the car?
- Fields:
purpose,people. - Encoding: Grouped bars: x = people count (1, 2, 3, 4+), grouped by purpose; y = trip count.
- Interaction: Hover a segment to highlight matching scatter points and show the trips' median distances.
- Implementation: Rollup of
people×purpose; encodepeople > 4as a single bucket.
Duration/Recency of Vehicle Reuse (vehicle_id over time).
- Question: Are the same vehicles reused repeatedly, and over what time span?
- Fields:
vehicle_id,full_date,provider,vehicle_make,vehicle_model. - Encoding: A per-vehicle timeline: one horizontal lane per
vehicle_id, a dot for each trip, x = full date, dot color = provider. - Interaction: Hover a dot to show trip details; hover a lane to highlight that vehicle's trips in the scatter.
- Implementation: Sort lanes by first-seen date; render in a new
renderTimeline.jsusingscaleTime.
Purpose × Home-Relation Co-occurrence Matrix.
- Question: Which purpose/home combinations are common, and which are rare?
- Fields:
purpose,home. - Encoding: A 3 × 4 categorical matrix (purpose × home category) with cell fill = trip count and cell label = count.
- Interaction: Hover or click a cell to filter the scatter to that combination.
- Implementation: Rollup by
purposeandhome; render as an SVG grid with a sequential color scale.
Cumulative Distance by Provider over Time (step line).
- Question: How has cumulative driving accumulated over the log, and does one provider account for most of it?
- Fields:
full_date,distance_km,provider. - Encoding: Two cumulative step lines, one per provider, x = full date, y = cumulative kilometres; a shared total line for reference.
- Interaction: Hover along the x-axis to read cumulative distance for each provider on that date; brush to zoom the time window.
- Implementation: Sort rows by
full_date, compute running sums per provider, and render withd3.lineandcurveStepAfter.
Notes Field Word Cloud / Tag Extraction.
- Question: What themes appear in the free-text notes, and do they cluster by purpose or destination?
- Fields:
notes,purpose,destination. - Encoding: A frequency-ranked tag strip (tokenized words) sized by frequency, with tag color drawn from the most common purpose of the trips containing that word.
- Interaction: Hover a tag to list the trips whose notes contain it; click to filter the scatter to those trips.
- Implementation: Tokenize and stopword-filter
notesin auseMemo; render as an SVG flow layout or flex tag strip with per-tag frequency encoding.
Linked Coordinated View (scatter + destination bars + timeline).
- Question: How do distance/occupancy relationships, destination frequency, and timing interact when the same selection is applied everywhere?
- Fields:
distance_km,people,purpose,destination,full_date. - Encoding: Three coordinated panels sharing selection state: (1) the scatter, (2) a destination-frequency bar chart, (3) a timeline dot strip.
- Interaction: Brushing in any panel filters the other two; legend hover dims categories across all three; tooltips share trip details.
- Implementation: Introduce a shared selection state in
App.jsxand a small linked-view controller; reuse the existingrenderScatterand the new bar/timeline renderers.
Inspiration
Inspired by:
References
Getting started
Open index.html in the preview; the dataset loads automatically from
/data/Drive History - Master - Drive History - Master.csv.