Clickable Circles with D3 Rosetta
This interactive scatterplot displays BMW sales data from 2010 to 2024, plotting vehicle Price_USD against Sales_Volume. Clicking any circle highlights that datum with a white fill and thick black stroke while resetting all others to black. The visualization uses d3-rosetta’s `unidirectionalDataFlow`, `createStateField`, and `createMemoize` to manage state and cache data loading. D3 v7 scales (`scaleLinear`) and selections render circles, while `setupClickInteraction` binds click events that update the selected ID, triggering automatic re-rendering.
AI-generated descriptionBMW Sales Data (2010–2024)
This dataset contains information on BMW car sales across global regions from 2010 to 2024. It includes details about models, specifications, and market performance.
Source
The original dataset was published on Kaggle:
BMW Sales Data 2010–2024 – Kaggle
Dataset Description
- Model – BMW model name (e.g., 3 Series, X5, i8)
- Year – Year of manufacture (2010–2024)
- Region – Market region (Asia, Europe, North America, etc.)
- Color – Car color (categorical)
- Fuel_Type – Petrol, Diesel, Hybrid, or Electric
- Transmission – Manual or Automatic
- Engine_Size_L – Engine size in liters (numeric)
- Mileage_KM – Mileage in kilometers (numeric)
- Price_USD – Sale price in U.S. dollars (numeric)
- Sales_Volume – Number of units sold (numeric)
- Sales_Classification – Categorical label (High, Medium, Low)
Usage in VizHub
- Paste the dataset into a
data.csvfile in your VizHub project. - Use D3.js to load the file: