A thin, typed, React wrapper over Google Charts Visualization and Charts API.
React Google Charts is a thin, typed, React wrapper for Google Charts. It allows developers to easily integrate Google Charts into their React applications, enabling visualization of data in a visually appealing manner. The library provides a quick start guide, detailed documentation, a range of components, examples, and even a step-by-step tutorial for creating dashboards.
To install React Google Charts, you can use your preferred package manager, such as npm or yarn. Here is a basic guide to installing the library:
npm install react-google-charts
Or with yarn:
yarn add react-google-charts
Once installed, you can import and start using it in your React components:
import { Chart } from 'react-google-charts';
function App() {
return (
<div>
<Chart
width={'500px'}
height={'300px'}
chartType="Bar"
loader={<div>Loading Chart...</div>}
data={[
['City', 'Population'],
['New York City, NY', 8175000],
['Los Angeles, CA', 3792000],
['Chicago, IL', 2695000],
['Houston, TX', 2099000],
]}
options={{/*
chart: {
title: 'Population of Largest U.S. Cities',
subtitle: 'Based on most recent data',
},
*/}}
rootProps={{/* 'data-testid': '1' */}}
/>
</div>
);
}
React Google Charts is a valuable tool for developers looking to incorporate Google Charts into their React applications efficiently. With its lightweight wrapper, type safety, extensive documentation, and various components, it simplifies the process of creating visually appealing charts. Additionally, the availability of examples, tutorials, and the option for community contributions make it a robust choice for data visualization needs in React projects.