Skip to main content
100%

Fork of Fork of Temperature in San Francisco Line Chart

✓ Published0🌍 Public
Rrenguangz
Last edited Aug 27, 2021
Created on Aug 27, 2021

This example visualizes the temperature in San Francisco over time with a smooth, maroon line chart. The x-axis shows timestamps, while the y-axis displays temperature values, with gridlines extending across the plot area. Data is loaded from a CSV file via `d3.csv`, parsed, and rendered using D3 v5’s `scaleTime` and `scaleLinear` for axes, and `d3.line` with a `curveBasis` for the smoothed path. The code uses a React `VizContainer` component that follows a margin convention, drawing SVG rectangles to visualize the chart’s padding.

AI-generated description

Boilerplate code for a React + D3 visualization with:

  • CDN links for React, ReactDOM, and D3
  • Basic React boilerplate
  • Variables for dimensions and margins
  • A VizContainer component that:
    • Abstracts SVG/group container elements
    • Follows the margin convention
    • Show the margins, which can be easily removed by deleting the showMargins={true} prop
MIT Licensed

Similar vizzes