Reactochart Library: A chart Library of React.js
Published: 2022-04-03 04:14:34

**Introduction**

The Reactochart is a Library that contains a number of React components which are for graphs and charts and data visualization. The XY Data Components include: Bar, RangeRect, XLine, YLine while the XY Axis Components include: XAxis, XAxisLabels, XAxisTitle, XGrid, XTicks, YAxis, YAxisLabels, YAxisTitle, YGrid, YTicks and the standalone components include: Pie Chart,  SandeyDiagram and TreeMap.

Site URL:  https://www.spotify.com/us/
Developer:  https://github.com/spotify/reactochart
Framework: ReactJS
Library: Reactochart
Live Demo:

**Purpose of the Application**

Spotify is an audio-streaming subscription service. A digital music, podcast, and video service that gives you access to millions of songs and other content from creators all over the world.  It is easy to find the right music or podcast every time. This is doubled with the trends and music that top charts so as to give users seamless experience of new and trendy sounds. You can browse through millions of tracks, connect to any browser and can also let Spotify do the work of picking.

**Type of Integration used on the website** 

The Spotify website is built to interact and sync properly with users and their music and podcast choice hence a chart system. Spotify charts come in different types. From axial charts to non- axial charts hence giving vast information on the audio service. Charts are used to check trends, latest songs, age ranges and figures.

 ![Purpose of Application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91y7bcptxtyv54hddldy.png)                                                                     **Fig 1**  

**Charts components are categorized based on their type. The components are grouped as** 

XY chart components: AreaBarChart, AreaChart, BArChart, ScatterPlot, Histogram, MarkerLineChart, FunnelChart, ColorHeatMap, AreaHeatMap, RangeBarChart, KernelDensityEstimation, LineChart.
 
![charts](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6rekgnhfesjbsnwpqgl3.png)                                                                        **Fig 1.1**

Standalone chart components: PieChart, SankeyDiagram, TreeMap
 
![chart components](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c75vvvstcx2adv0lx3b4.png)                                                                               **Fig 1.2**
XY Data components: Bar, RangeRect, XLine, YLine
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3x7qv2g1hvu1b5w484a.png)                                                                         **Fig 1.3**

XY Axis components: XAxis, XAxisLabels, XAxisTitle, XGrid, XTicks, YAxis, YAxisLabels, YAxisTitle, YGrid and YTicks.
 
 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxwqbiozxavxoase3anx.png)                                                                                    **Fig 1.4**

As the XY charts require Axial plots, we have the XY Plots.


**Major Component Case Study: RangeBarChart**

The RangeBarChart is a variation on the standard bar chart. Just like a normal bar chart, each bar represents a single value on the independent axis (X axis for vertical bars) and is centered on this value. However, on the dependence axis, each bar represents a range (min/max) of values, rather than always starting at zero.
Cartesian (“X/Y” –type charts) accept an array of data and represent these data with some form of SVG marks on a 2-dimentional X/Y coordinate plane.
RangeBArChart is not meant to be rendered on its own but should instead always be wrapped in a <XYPlot> component. <XYPlot> is a wrapper which iterates over all of its charts and generates a common set of X and Y scales, which are shared and provided to its children as scaleprops. XYPlot also accepts several other props which apply to all of its children, such as width and height.
 
![RangeBar chart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2w7p3vlsdikys3iqdx9.png)
                                                                 **Fig 1.5**

 ![RangeBar chart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h96c5vg6q69gv9m41mnp.png)
                                          **Fig 1.6**



**RangeBarChart props include:**

barClassName, barLabelFormat, barStyle, DefaultValue, barThickness, onClick, onMouse

**Setup Code**

The ReactoChart can be installed and used on different projects . You can install individual components of the Reactochart or install the entire Reactochart Library. This might however hinder some optimization such as webpack tree-shaking.
To begin, use the npm command. npm install –save reactochart. Then import any of the Reactochart component you need. Here is an example below:
First, Import  LineChart from ‘reactochart/LineChart’. Also the XYPlot, XAxis, YAxis.
Outcome:
Import XYPlot from  ‘reactochart/XYPlot’;
Import XAxis from ‘reactochart/XAxis’;
Import YAxis from  ‘ reactochart/YAxis’;
Import LineChart from ‘reactochart/LineChart

You can install the entire Reactochart Library.
Import {XYPlot, XAxis, YAxis, LineChart} from  ‘reactochart’; Or  Import * as Reactochart from  ‘reactochart’;
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/brc9yi1nkmtmftx4vrn9.png)                                                                              **Fig 1.7**


**Compatibility**

The Reactochart library is compatible with a number of libraries especially at point 91 which is between Safari and Edge. Reactochart can be used across browsers although varying in compatibility as seen in Fig 1.8
 
 ![Test](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u56gvnbgz6bvs7v21cr4.png)                                                                                **Fig 1.8**
                                                   https://app.lambdatest.com/console/realtime

Any deficiencies with the development approach
The Reactochart library has been proven efficient and reliable. It can be used in different projects to implement the chart feature. It is majorly used when detailed statistical analytics is required. Although there are other chart libraries, the Reactochart works and serves its purpose adequately.

My Twitter Handle: https://twitter.com/mchelleOkonicha

My LinkedIn Handle: https://www.linkedin.com/in/buchi-michelle-okonicha-0a3b2b194/