Skip to main content
Public

Share visualization

Loading preview…

Activity6_Task1

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

Activity6_Task1

0
Ssagipavan2385@gmail.com
Last edited Apr 3, 2025
Created on Apr 3, 2025
Forked from Hello VizHub

This example visualizes the 2020 population estimates for 30 countries using a horizontal bar chart rendered as SVG in React. Population values are shown on the x-axis via a linear scale, with countries listed on the y-axis using a band scale. The code employs D3 v5 functions like `csv`, `scaleLinear`, `scaleBand`, and `max` through `useData` to load and process data from a GitHub CSV file. Axis components and bars are built with custom React components, and hover tooltips display formatted population values using the `format` API.

AI-generated description

import React from 'react';

export const Marks = ({ data, xScale, yScale, xValue, yValue, tooltipFormat, }) => ( <g className="marks"> {data.map((d) => ( <rect className="mark" key={yValue(d)} x={0} y={yScale(yValue(d))} width={xScale(xValue(d))} height={yScale.bandwidth()} > <title>{tooltipFormat(xValue(d))}</title> </rect> ))} </g> );

Comments

Sign in to join the discussion.

MIT Licensed