Skip to main content
Public

Share visualization

Loading preview…

Canadian Exports to US Treemap

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Canadian Exports to US Treemap

0
CCurran Kelleher
Last edited Dec 23, 2025
Created on Mar 10, 2025

This visualization displays Canada's exports to the United States in 2022 as a hierarchical treemap, with rectangles sized by export value and colored by sector (e.g., Minerals, Agriculture). Hovering over a product rectangle highlights related items and reveals a tooltip with the product name, export amount, share, code, and sector. Built with D3.js, it uses d3.treemap for layout, d3.scaleOrdinal for color assignment, d3.scaleSqrt for font sizing, and a ResizeObserver for responsive dimensions. The data loads from a TSV file via d3.tsv.

AI-generated description

This visualization shows Canadian exports to the United States in 2022 using a hierarchical treemap layout. The data is organized by sectors, with individual products nested within each sector. The data and visualization idea come from Atlas of Economic Complexity: What did Canada export to the United States of America in 2022?

See also Gist containing the data.

Visualization Features

  • Hierarchical treemap showing export values by sector and product
  • Interactive tooltips with detailed information
  • Color coding by sector
  • Responsive layout that adapts to screen size
  • Hover effects to highlight related items

Data Structure

The data is structured hierarchically:

  • Top level: Total exports
  • Second level: Sectors (e.g., Minerals, Agriculture)
  • Third level: Individual products within each sector

Each product includes:

  • Name
  • Export value
  • Share of total exports
  • Product code
  • Parent sector

Technical Implementation

Built using:

  • D3.js for visualization
  • Treemap layout for hierarchical data representation
  • ResizeObserver for responsive design
  • Custom tooltip implementation

How to Read the Visualization

  • Each rectangle represents a product or sector
  • Size corresponds to export value
  • Color indicates the sector
  • Hover over rectangles to see detailed information
  • Related items are highlighted on hover

Comments

Sign in to join the discussion.

MIT Licensed