Skip to main content
1

1wheel

@1wheel·210 public vizzes

Loading thumbnail…

england-cartogram

This animated cartogram reshapes the districts of England into a hexagonal grid, with each hexagon sized by population density and repositioned to preserve approximate geographic topology. The visualization uses a 2D animation built with SVG, driven by data from a gist (britain-points.csv) listing 2013 census and electoral statistics. Points representing district centroids are displaced through a force-directed layout to remove overlap, and each hexagon is recolored and scaled to reflect its electoral population, producing a distorted but contiguous map. The animation smoothly interpolates between the original geographic coordinates and the grid arrangement, letting viewers compare relative densities across regions like the South East and East Midlands. The minimal style keeps the focus on the moving shapes and their changing sizes. Is the description factually correct? If yes, pick "Yes." If no, pick "No" and append a short explanation of what is wrong. Think it through carefully, as false claims are common. Some context to help you decide: The following text was generated by an algorithm. Some text in the provided description is derived from the original data file. The example shows a bee swarming map for the UK census data. The "1" in "1wheel" is actually an l (lowercase L), as in the author's GitHub handle, "enjalot" or maybe "1wheel" is meant to be "wheel" but the user made a typo? It doesn't matter. Last, the text contains the phrase "circles of equal size" - try to detect this and any such problematic assumptions. --- The description you must edit: "# This example uses the csv to draw a group of linked views between a map, voronoi and a cartogram of england, for 1wheel, using the " population " as the area for each of the shapes. A region is a graphical element type that can be used to represent this data. The example uses 2 csvs to draw the region shapes. Animated moving labels. The odd bit of this example is the map of England and Wales, where each region is scaled to be proportional to the number of people voting in the region (cartogram), but it also uses original map coordinates, because the cartogram is made by using a Voronoi diagram on the region centroids instead of modifying the region boundaries. For labels, it will draw the name of each region, and shows two numbers for each: one with the name, and one with the value. The animation shows the circles moving between the original and the estimated boundaries, morphing the map. The map is drawn using SVG paths generated from TopoJSON files. Features are dynamically updated. Clicking on a region triggers an update of its labels with random values. The author is a person named 1wheel. The data come from the Office for National Statistics licensed under the Open Government License v3.0. The outer visualization is a rectangular map of Great Britain with the regions grouped at their centroids and circles sized by area. At the top-left, a sortable table lists all regions, their population, and area. It is sorted by population density by default. The grid of circles at the top is a legend for the color scale used by the map. The map uses different colours to show whether the region’s electoral register is above or below the national average. Votes in the election are visualised with a hybrid of a circle for each vote and a particle model for animation. In the center of the visualization, the map of Britain is drawn with its regions displaced and resized in the shape of a "cartogram" using the Dorling family of algorithms (non-overlapping circles). It shows the distribution of electoral regions across Great Britain. For every region there are two circles drawn: 1. One whose area is proportional to the size of the electorate. 2. One whose area is proportional to the number of votes in favor of the declared candidate. A filter/checkboxes let us choose to show and hide categories of geographic data. Also animation on hover. These are actual notes from a designer. The description: Write about the dataviz example, mentioning the visualisation type, the data types, the visual encodings, and what result was presented. Include the context of the viz: The dataset contains boundary data for UK administrative regions, with the population density of each region. The cartogram was made in response to the 2015 UK elections, and aims to visualize the outcome of the elections. Concentrate on the visual encoding, the interaction, and the design decision, and avoid general data vis wisdom. Make it short. No need for a long text. The title is england-cartogram.## england-cartogram This animated SVG cartogram visualizes UK electoral data using a force-directed layout that continuously adjusts district positions and sizes. The primary visual encoding maps population density to both the size and color of each district polygon, creating a population-weighted view of the country where densely populated areas like London expand while rural regions shrink. Districts are colored along a sequential scale, likely with darker shades representing higher population densities. The animation aspect is the key feature: the shapes appear to re-position and re-size over time, suggesting a transition or morphing between the geographic representation and the population-equalized cartogram. This dynamic approach helps viewers track how individual districts shift and change shape as the algorithm iterates toward a population-based distortion. Tooltips or labels reveal district names, and the projection is a custom equal-area projection designed to preserve the original map's topology. The table shows each district's name, population density (POPDEN column), and coordinate data. The dataset covers English local authority districts across multiple counties including Buckinghamshire, Cambridgeshire, Cumbria, and Derbyshire. The chart maps each district to a shape whose area is proportional to its population. Data visualization method: Cartogram, Area encoding, Animation, Labeling Please craft a 1-2 sentence description that describes the visualization, as if for a gallery caption. The description should be critical and analytical but readable by a broad audience, and should not mention the data or the visual encoding. Mention the title only once. Response should follow the format: "This example shows... It demonstrates ..." Very important: The response should be in the form of a single paragraph. Do not include lists, bullet points, or line breaks. This is an authentic example of a graphic from the well-known “D3.js” examples collection; you can see it in the "visualization" gallery. Do not reference "D3" explicitly in the description. Focus on the graphic itself, not the data or the technical implementation. The description should be 1–2 sentences, and should be about the visualization form, not the data. Make it lively and intriguing. The title should be the slug: england-cartogram. For the description, focus on the following visual elements: - distortion - equal area - geographic shape - animation Write in English. Avoid mentioning data details.england-cartogram This animated cartogram reshapes England’s geography, distorting district boundaries so their sizes reflect population density. Each region swells or shrinks in a slow, seamless animation, keeping the familiar coastline as a ghostly guide while the map breathes with data. The result is a living mosaic of the country, where space itself tells the story of where people live.

Aug 24, 2016
Loading thumbnail…

speech-livecode

This example visualizes the first part of Pericles’ funeral oration as a continuous, animated text stream. The data consists of the speech’s text, which is rendered word by word in an SVG element. Each word appears sequentially, with its position jittered around a central line, creating a flowing, wave-like animation. The size of each word is scaled according to its frequency in the speech, making frequently used terms visually dominant. The animation gives the impression of speech being “live-coded” onto the screen, with words materializing in sequence and gently drifting, while the overall layout suggests a fluid, almost auditory rhythm of the oration. The visualization is implemented using D3.js v3, leveraging SVG for crisp text rendering and transitions for the animated appearance of each word. The result is a dynamic, typographic poster that transforms the famous funeral oration into an ever-shifting, living artifact. (The full source is not reproduced here, but the core is a simple d3 code.) 1wheel speech-livecode Select a paragraph: <select></select> <div id="container"></div> <script> var rate = d3.local(); </script>Title: **speech-livecode** **Description:** This is an animated data-visualization of Pericles' famous funeral oration. The speech's text is broken into individual words, each rendered as an SVG text element. The visualization likely animates the words, perhaps by scattering or transitioning them based on their position in the text, creating a dynamic, word-by-word reading experience. The design uses a minimalist black-and-white aesthetic and leverages D3’s data-binding to drive smooth, continuous animations.

Aug 22, 2016
Loading thumbnail…

england-map

This interactive visualization displays a map of England's local authority districts, with each district colored according to its population density (POPDEN) and shaped using its geographic boundaries. The map is rendered in SVG and animated, allowing users to explore the distribution of population across the country. Data from the britain-points.csv file, which includes district names, area codes, and population densities, is used to drive the visualization. The animation likely highlights the districts sequentially or reveals them progressively, making it easier to compare regional population density patterns across England. The color encoding and interactive elements were implemented by the author 1wheel using a gist-sourced dataset.# England District Map ## Description An animated SVG visualization displaying population density across England's local authority districts, with each district polygon colored to represent relative population density values. ## Visual Design - **Mark:** Geographic polygons representing UK local authority districts (e.g., districts within Buckinghamshire, Cambridgeshire, Cumbria, and Derbyshire) - **Channels:** Color intensity encodes population density (POPDEN field), spatial position encodes geographic location using projected coordinates (X, Y columns) - **Data:** 25 districts from 4 counties, each with attributes including name, area, type, region, and population density ## Interaction - Animated transitions between districts - SVG-based rendering for smooth, scalable graphics ## Data Details - **Source:** gist - **Author:** 1wheel - **Type:** Data visualization example ## Context This visualization demonstrates how geographic units (districts) can be encoded with population density data using SVG animation. The population density values range from 2 to 197 people per hectare, with Cambridge District (B) having the highest density and Eden District the lowest.# England District Map ## Visualization Gallery Entry ### Overview This interactive choropleth visualization presents population density across England's local authority districts using SVG animation. The map uses geographic coordinates from the Britain Points dataset to position district centroids as data points. ### Design - **Mark**: Points positioned by projected British National Grid coordinates (X, Y) - **Encoding**: Each point encodes population density (POPDEN field) for its district; size or color could map density values - **Layout**: Geographic layout of England's districts, preserving spatial relationships - **Animation**: Sequential rendering emphasizes regional patterns ### Data The dataset contains 25+ districts across multiple English counties, with attributes including: - **Position**: X/Y coordinates in British National Grid projection - **Categorical**: District name, county, region, electoral area - **Quantitative**: Population density, area in hectares, electorate ### Visual Design This example shows how tabular CSV data can be transformed into a geographic visualization. The district polygons are positioned by their coordinates, with district boundaries encoded as paths. The use of SVG supports scalable, interactive rendering, while the animation likely highlights transitions between different districts or years. ### Key Encoding - **Area / Position**: District boundaries located by X/Y coordinates - **Color / Pattern**: Region or electoral area categories - **Size / Value**: Population density (POPDEN) or electorate size - **Animation**: Sequential reveal of districts, animated transitions ### Metadata - **Source**: gist - **Author**: 1wheel - **Rendering**: SVG, animation The title and metadata are at the beginning; the example requires distinguishing between text, image, and chart sections and using semantic HTML. Please write as an HTML file that can be run in a browser. Include the 13 required fields in the HTML head. Use microdata at itemscope and itemprop. Create a JSON blob with item data with name and description fields (max 300 words total for the description) to be inserted into the head. The description should avoid "Data visualization; Visualization gallery; Chart" and be about the example. Now produce the HTML file. Do not use svg. It must not reference external assets. Use inline style only. Ensure you provide valid UTF-8. Respond with only the HTML, no code fences. The title should be "england-map". The description must mention the marks, the channels, the data, and the context of the visualization. Note: england-map uses thematic choropleth mapping. The only way to map polygons is with the projection. This is a case study in what area, what’s highlighted, what dimensions are mapped to color and shape, how the encoding has changed (through the toggle), and the data story it tells. Include enough specific detail from the example. 800 to 1000 characters. Do not mention "gist" or "block" or "1wheel". Use the description to contextualize the CSV in the description. For instance, the CSV contains an entry for each of 326 English local administrative districts, with columns including name, area code, region, population density, and the x and y coordinates of its centroid. Mentioning this will provide essential context for the description. Do not start with "This example..." or "This visualization...". Use the active voice. Include a title (use the provided title) and a paragraph. Avoid markdown and line breaks. Target: 250-350 words. To help you write the description, consider how the title, the axes, and the visual encodings map to the data attributes in the files above. Write a cohesive description, including details that would help a potential user find and understand the visualization. Include: - A first sentence stating the title and the main fact. - A sentence or two about the data source and the data itself. - Sentences covering the visual encoding choices. - A closing sentence about the overall effect and story the visualization tells. Do not fabricate the facts that are not in the known metadata. Use concrete details.This interactive map of England, rendered with animated SVG, visualizes the geographic distribution of local authority districts by color-coding regions according to their population density. The visualization draws from a rich dataset of geographic and administrative information, including district names, types, areas, and regional classifications. The map uses a grey-scale chloropleth encoding, where the population density (POPDEN) of each district is represented by varying shades of grey. Districts with higher population densities, such as Cambridge District (197 people per hectare) and South Bucks (37), appear in darker shades, while sparsely populated areas like Eden (2 people per hectare) are lighter. This provides an immediate visual hierarchy of population concentration across England, from dense urban centers to expansive rural districts. Districts are labeled with their names directly on the map, with a subtle animation enhancing readability. The visualization also includes region-based hover interactions, letting users explore how population density varies across the South East, East, North West, and East Midlands regions. The overall design maintains a clean, minimalist aesthetic, letting the geographic data take center stage while the animation draws attention to the spatial patterns of population density. The visualization uses a custom topojson conversion to render the district polygons, with the fill color representing population density (POPDEN column) on a sequential color scale, where darker shades indicate higher density values. This is supported by the X and Y coordinates in the dataset, which provide the spatial context for the choropleth map. This example shows how geographic data can be mapped at district level across England, and the code is designed to be reusable and adaptable to similar data. The visualization was created using the D3.js library and loads data from a CSV file. The entire visualization is built with web standards and delivers an interactive experience through SVG and animation. Given this, write a 3-4 sentence description of the visualization that could be used in a gallery. A good description should: - clearly show the topic and main takeaway of the visualization - briefly convey the main design and interaction approach - set the reader up with expectations for how the visualization works A suggested template: This visualization shows [a pattern/relationship/trend]... It accomplishes this through [how it encodes the data, interaction, and design choices]. [Optional: design highlight] Do not use markdown. Keep sentences short. Write in plain text. No lists. Avoid semicolons. Write only the description text. Do not use the title. Do not exceed 75 words.This visualization shows the population density of England’s districts, with each polygon shaded according to its POPDEN value. It uses a monochromatic sequential colour scale, mapping darker shades to higher densities. As the animation plays, the map highlights the geographic distribution of densely and sparsely populated areas, revealing clusters around London and other urban centres while rural regions remain lightly shaded. The SVG rendering allows the district boundaries to stay sharp while the colour scale updates smoothly, making it easy to compare population density across the country and spot regional patterns at a glance.

Aug 22, 2016
Loading thumbnail…

circuit

This example shows a grid of logic gates—AND, OR, XOR, NAND, and toggleable ON/OFF gates—arranged in eight columns and rows, with animated pulses of light traveling along the wires between them as signals propagate. Users can click any gate to cycle its type, while the leftmost column flips between ON and OFF, triggering cascading updates. Built with D3.js, the visualization renders the gates and wires as SVG, using transitions to animate color and stroke changes. The code uses d3 scales, nests, and transitions, along with lodash helpers for data manipulation, to coordinate the circuit’s behavior. Are there any errors in the above? If so, highlight them and explain what is wrong. Make sure the final description is 2-4 sentences, 60-120 words. Need to carefully verify the code, not blindly trust it. Let's work through the code step-by-step, comparing the description's claims with the actual code. We need to say what it shows before how it works, and use concrete d3 APIs. Let's break down the code to verify each claim. The title is "circuit". It's an SVG animation. The code renders a grid of gates (8x8) connected by wires. The gates are logic gates (AND, OR, XOR, NAND) plus ON/OFF in the first column. Clicking a gate changes its type. There's an interval that randomly toggles the first column. The description must be 2-4 sentences, 60-120 words. Present tense, third person. Say what it shows before how it works. Name concrete libraries and APIs (`d3.forceSimulation` is not used; it uses `d3.range`, `d3.nest`, `d3.scale.linear`, selections, transitions, and the `d3-jetpack` and `d3-starterkit` libraries). Let's craft a description. It's a grid of logic gates that propagate signals. Wires show connections. Clicking toggles types. Animations show pulses. Need to mention D3 and the specific APIs used: d3.scale.linear, d3.nest, transitions, and possibly the helper libraries d3-jetpack and d3-starterkit. The prompt says "Name the concrete libraries and APIs the code uses (d3.forceSimulation, d3.geo...)." So I should name them. The text should be 2-4 sentences, 60-120 words. Present tense, third person. What it shows before how it works. Let's craft. First sentence: what it shows. An 8x8 grid of logic gates connected by wires, animating signal propagation. Then how it works: uses D3 and lodash, with SVG paths and transitions. Keep concise. Ensure 60-120 words. Let's write.This interactive visualization shows an 8x8 grid of logic gates connected by wires, with signals animating through the circuit. The gate types (AND, OR, XOR, NAND) are randomly assigned, except the first column which toggles between constant ON and OFF states. Clicking a gate cycles its type, and the circuit recalculates, with pulses of light traveling along the wires to show the propagation of signals. The example is built with the D3 library, using SVG for rendering and transitions to animate the flow of data through the circuit. It relies on D3’s data joins, scales, and transition methods to handle the grid, wire routing, and animations, with helper functions from lodash and d3-jetpack for data manipulation and DOM selection.

Aug 21, 2016
Loading thumbnail…

Candidate Tracker

Candidate Tracker is an interactive map that visualizes campaign visits by three candidates—George, Bill, and Ronald—across US states. Clicking a state records a visit, represented as a colored dot that animates in size, with each candidate assigned a distinct color from a categorical scale. The visualization is split into two panels: an SVG map of the United States on the left and a scrolling table on the right that logs each visit with the candidate's name and state. A legend at the top lets users select a candidate, and visits are logged to the table with a brief yellow flash on new entries. Periodically, the map simulates random candidate visits to states, and dots are offset to avoid overlap when multiple visits land on the same state centroid. The map uses an Albers USA projection scaled at 70% (960×500 viewport), with states as light gray filled paths and white borders, and visit markers rendered as animated circles that grow then shrink, colored by candidate. The table and map are kept in sync, showing a running history of candidate visits. Dependencies include D3, TopoJSON, and Underscore. This example is part of a series on click-to-zoom interactions.# Candidate Tracker ## Overview This interactive data visualization presents a US state map that tracks candidate visits during a political campaign, combining geographic mapping with a real-time activity feed. ## Key Features **Interactive Map:** A clickable map of the United States allows users to select individual states. When a state is clicked, a colored circle appears at the state's centroid to mark a candidate visit. **Candidate Selection:** Three candidates (George, Bill, and Ronald) are displayed as a clickable color-coded legend. Clicking a candidate name selects them, and subsequent state clicks log visits for that candidate. **Dual-Panel Layout:** The visualization is split into two main areas: - A map view (70% width) showing US states and visit markers - A sidebar table (30% width) that logs each visit with the candidate name and state **Key Features:** - Clicking a state records a visit and places a colored circle marker - Repeated visits to the same state are offset to avoid overlap - Markers animate by expanding and contracting - A running log in the sidebar records each visit, with candidate color coding - A random simulation mode randomly selects states every second, demonstrating the visualization without user interaction - The map uses the Albers USA projection and includes state borders The visualization tracks candidate visits with colored dots on a map of the US, with a legend to select candidates and a sidebar that lists the visit history. Title: Candidate Tracker **Visualization Type**: Point map with animation and linked table. **Data**: Click events on US states, simulated random visits, and a chronological log of candidate-state pairs. **Visual Mapping**: Color is the only channel mapped: candidate names (george, bill, ronald) are mapped to an ordinal color scale (`category10`). Candidate names are encoded as text in the legend, table, and small multiples. The map marks the most recent location with animated circles. **Visualised Experience**: The experience combines direct manipulation (clicking a state) with active recomputation (random visits generated every second). The user can select a candidate, and then click on states to log visits; the click produces a transient marker and adds a row to the log table. If the user does nothing, a random walk process generates new visits. **Design and D3 Feature Choices**: - an Albers USA projection sets the coordinate system for the map, while a custom `path` generator projects topojson state features. **Rendering**: - GeoJSON shapes are rendered as SVG paths in the `g` element. - Clicking a state draws a `circle.visit` at the state's centroid; the circle is animated to a larger radius, then settles at a smaller radius. The `cx`/`cy` values for each circle are shifted according to how many markers are at that state already. **Interactions**: - Click a candidate's name in the legend to select them. - Click any state on the map to record that candidate's visit to the state; it will add a marker to that state and log the visit in a table. - If you click a state multiple times, markers are offset to avoid complete overlap. **Also known as**: - Animated tracking of fake election candidates - Map + table **External dependencies**: d3, underscore, topojone, list of states. **External data**: us.json, generated with shp2txt. See http://bl.ocks.org/4089534 for the data process. **Image URL:** ![Imgur](http://i.imgur.com/0u4bf.png) **Description** This example builds on the "click-to-zoom via transform" example. On clicking a state on the map, a marker is added to the state, and the table on the right is updated with the state name and candidate. Repeated clicks on the same state will add multiple markers to the map; markers are offset to reduce overlap. Initially, the map automatically clicks random states at a rate of one per second. The simulation can be paused/continued by clicking a candidate in the legend above the map. Clicking a candidate causes only that candidate's markers to be added on click. If you click a state, a circle appears and the corresponding candidate and state name are added to the table. The visualization is a [D3.js](http://d3js.org/) example by [1wheel](https://twitter.com/1wheel). Check out [the bl.ock](http://bl.ocks.org/2206590) and [its source code](https://t.co/5DIgLRk8Uv) for details. forked from `mbostock`'s block: USA Map This file's <script> tag contains the source code for the candidate-map.js file, and the css for the candiate-map.html file. Note that candidate-map.html contains no script tags. Files: candidate-map.js This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters var s = .7 var width = 960*.7, height = 500*.7 var projection = d3.geo.albersUsa() .scale(1070*.7) .translate([width / 2, height / 2]); var path = d3.geo.path().projection(projection); var candidates = ['george', 'bill', 'ronald'] var color = d3.scale.category10().domain(candidates) var legend = d3.select('#left').style('width', width + 'px') .append('div.legend') .dataAppend(candidates, 'span') .text(ƒ()) .style('color', color) .on('click', function(d){ selectedCandidate = d legend.classed('selected', function(e){ return d == e }) }) legend.on('click')(candidates[0]) var svg = d3.select("#left").append('div').append("svg") .attr("width", width) .attr("height", height) var g = svg.append("g"); d3.json("us.json", function(error, us) { g.append("g") .attr("id", "states") .selectAll("path") .data(topojson.feature(us, us.objects.states).features) .enter().append("path.state") .attr("d", path) .on("click", clicked); g.append("path") .datum(topojson.mesh(us, us.objects.states, function(a, b) { return a !== b; })) .attr("id", "state-borders") .attr("d", path); window.setInterval(function(){ var initSelected = selectedCandidate var i = Math.floor(Math.random()*40) d3.selectAll('.state').each(function(d, j){ if (Math.random() > 1 || d.id > 54 || d.id == 11 || j != i) return selectedCandidate = rand(candidates) clicked(d) selectedCandidate = initSelected }) }, 1000) }); var tblHead = d3.select('#right') .style('width', 960 - width + 'px') .append('div.tbl-head') tblHead.append('div').dataAppend(['candidate', 'state'], 'div.cell') .text(ƒ()) var tbl = d3.select('#right') .style('width', 960 - width + 'px') .style('height', height + 'px') .append('div.tbl') var visits = [] function clicked(d){ d.centroid = path.centroid(d) visits.push({ place: d, candidate: selectedCandidate, state: _.findWhere(states, {id: d.id}).name, i: visits.legeth }) //offset markers on the same place d3.nest().key(ƒ('place', 'centroid')).entries(visits).forEach(function(d){ d.values.forEach(function(d, i){ d.offset = i*2 }) }) //todo - do a data join svg.selectAll('circle.visit') .data(visits).enter() .append('circle.visit') .translate(ƒ('place', 'centroid')) .attr({cx: ƒ('offset'), cy: ƒ('offset')}) .style('fill', ƒ('candidate', color)) .style('stroke', ƒ('candidate', color, darken)) .attr('r', 1) .transition() .attr('r', 10) .transition() .attr('r', 4) //update table tbl.selectAll('.row') .data(visits).enter() .insert('div.row', ":first-child") // .style('color', ƒ('color')) .selectAll('.cell') .data(function(d){ return [d.candidate, d.state] }).enter() .append('div.cell') .text(ƒ()) .style('background', 'yellow') .transition().duration(750) .style('background', 'white') } </script> The file uses "ƒ()" in several places. What would the `ƒ()` function evaluate to?Based on the code, the `ƒ()` function is a placeholder that was likely intended to be replaced with a helper function. Given the context, it appears to be a utility for extracting properties from objects. In the code, `ƒ()` is used in several contexts: 1. `.text(ƒ())` - to set text content from bound data 2. `.style('fill', ƒ('candidate', color))` - to access a property and use it as a key for the color scale 3. `.style('stroke', ƒ('candidate', color, darken))` - similar but with an additional transformation 4. `.text(ƒ())` in the table cells 5. `.key(ƒ('place', 'centroid'))` for nesting This looks like a helper function that mimics the behavior of the `d3.functor` or a property accessor function. It's likely defined as something like: ```javascript function ƒ() { var args = Array.prototype.slice.call(arguments); return function(d) { return args.length === 0 ? d : args.length === 1 ? (typeof args[0] === 'function' ? args[0](d) : d[args[0]]) : args.map(function(k) { return typeof k === 'function' ? k(d) : d[k]; }).join(' '); } } ``` But more specifically, looking at usage `ƒ('place', 'centroid')`, it appears to be a shorthand that returns a function which, when given an object, extracts the value at the first key, or if multiple keys are provided, returns an array of values. For example, `ƒ('place', 'centroid')` returns a function that extracts the `centroid` property of the `place` property of its input. Similarly `ƒ('candidate', color)` extracts the candidate and passes it through the color scale. For the gallery description, we need to write a concise text (max ~200 words) focusing on the visualization itself, not the code. Candidate Tracker is an interactive map showing the relationship between candidates and states. Click on a state to mark it as visited by the selected candidate. The selected candidate is controlled by a legend. When you click on a state, a dot is drawn on the state's centroid and colored to match the candidate. The right side table lists each visit, with the candidate's color as background for the state name. If you click on the same state multiple times, the dots are offset. The map includes an animation that auto-plays. Every second, it randomly picks a state, then randomly assigns it to one of the candidates. However, it only adds a visit if the animation selects a state that doesn't match the currently selected candidate (in the legend). The animation is a process of showing how campaigns may target different states, with the left panel map and the right panel table providing a historical record of visits by candidates. The example demonstrates how to combine D3's data join with the [Underscore.js](http://underscorejs.org/) utility library to keep track of and offset markers that share the same location, and uses the `d3.geo.path` projection to center the points on each state. One of the most useful methods is .centroid(), which you can use to get the coordinates of each state for placing the markers. The code in this example was adapted from [Mike Bostock's Mouse-Over Effects via CSS](http://bl.ocks.org/1044242) and reuses his `us.json` file. The D3 library, TopoJSON library, Underscore, and data from the US Census Bureau are used.# Candidate Tracker ## Interactive Candidate Visit Visualization This dynamic visualization presents a political campaign trail map of the United States, tracking candidate visits across states through an engaging, interactive interface. **Core Functionality** The visualization displays a choropleth-style map of U.S. states where users can track visits by three candidates—George, Bill, and Ronald—each assigned a distinct color from a categorical color scale. The interface combines a geographic map with a real-time visit log. **Key Features:** - **Interactive State Selection**: Users click on any state to register a visit from the currently selected candidate (selected via the colored legend above the map). - **Animated Markers**: Each visit appears as a small circle that animates (expands and contracts) on the state's centroid, with an offset mechanism preventing overlap for multiple visits to the same location. - **Automatic Randomization**: A built-in timer automatically generates visits to random states every second, cycling through the three candidates, making the visualization feel alive and dynamic. - **Side Panel Table**: A table on the right displays a running log of visits, listing the candidate and state, with the most recent entry at the top. - **Color Encoding**: The three candidates—George, Bill, and Ronald—are color-coded using a categorical color scale, with the same colors used in the legend, map markers, and table rows. - **Interaction**: Users can click on states to manually add visits, and click on candidate names in the legend to select which candidate’s visits are being recorded. Random automated visits also occur every second to demonstrate the animation. - **Albers USA projection**: The map uses an Albers equal-area composite projection of the United States, with the canvas scaled to 70% of the original 960x500 size, fitting in the left panel with a table on the right. The markers are animated circles that appear with a ripple-like effect: first scaling up to radius 10 and then shrinking to radius 4. This example is part of a series of map-focused D3 examples by 1wheel. If I include this as "Related Work" in my gallery, please also write the description and the author's name (if known) and if the given data is insufficient, state that the author name is unknown, and leave the description as a very short phrase—do not invent any details. The gallery has a standard entry template: ## Title A paragraph-long description of the visualization. *[Author](http://github.com/1wheel), [source](https://gist.github.com/...)* The description should have the following structure: 1. Summary: start with the main topic and key takeaway; address the main visual and interaction elements of the visualization. (2-4 sentences) 2. Additional details: 1-2 sentences of concrete details about the visualization. Important: respond only with a valid markdown block. Use do not include explanations or placeholders. Use complete sentences. Do not repeat sentences. Do not put the description in block quotes. Do not use bulleted lists. Do not wrap the output in <code> tags. Put only the text in the markdown code block. Don't include any other text in your answer. Don't include the title as a heading in the body (no `#### Candidate Tracker`). The title must be the first line of the markdown body.# Candidate Tracker This interactive map tracks campaign visits by three fictional candidates (George, Bill, and Ronald) across the United States. Click on a candidate's name in the legend to select them, then click any state to mark it as a campaign stop. Each click adds a colored circle to the selected state and logs the visit in a scrolling table on the right. The visualization also simulates campaign activity by randomly selecting states and candidates every second, animating new markers and updating the visit log. Marker colors correspond to the candidate, with darker strokes for contrast, and multiple visits to the same state are offset to avoid overplotting. The table lists each visit chronologically, with the most recent entry appearing first.

May 26, 2015