Skip to main content
100%

3) Bar Chart - Adding Axis using Keys as required by React

✓ Published1🌍 Public
Bbrunoevione
Last edited Apr 2, 2021
Created on Apr 2, 2021

This example shows a horizontal bar chart of population data for ten countries, with labeled axes. Built with React and D3 v5, it uses d3.csv to load and parse United Nations World Population Prospects 2019 data, then renders SVG bars via React components. The chart employs d3.scaleBand for the categorical y-axis and d3.scaleLinear for the numeric x-axis, using d3 max to compute the domain. React keys, derived from tick values and country names, are applied within map functions to satisfy React's reconciliation requirements, as highlighted in the accompanying README. Axis ticks are generated with xScale.ticks().

AI-generated description

Usando keys nas funcoes map, como requerido pelo React para auxiliar na identificacao dos objetos

Ao usar o padrao .map com uma funcao q retorna algum js, devemos estabelcer uma chave q é unica para cada valor retornado

Data: United Nations World Population Prospects 2019.

MIT Licensed

Similar vizzes