Skip to main content
100%

Testing VizHub Stats API

✓ Published0🌍 Public
WWaseem Medhat
Last edited Dec 10, 2020
Created on Dec 10, 2020

This example demonstrates a minimal React and D3.js v6 application that fetches event statistics from the VizHub Stats API using a POST request to `/api/event/get`, but does not yet render any visualization of the retrieved data. The code establishes the structural foundation with a `VizContainer` SVG component that applies the margin convention and displays gray and light gray rectangles to indicate the outer and inner plotting areas. The React app uses `useState` and `useEffect` hooks to asynchronously load the event IDs and log the response to the console, leaving the visualization itself unimplemented.

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