Convert Figma logo to code with AI

react-financial logoreact-financial-charts

Charts dedicated to finance.

1,186
207
1,186
53

Top Related Projects

📊 Interactive JavaScript Charts built on SVG

23,884

Redefined chart library built with React and D3

64,568

Simple HTML5 Charts using the <canvas> tag

Highcharts JS, the JavaScript charting framework

Performant financial charts built with HTML5 canvas

16,856

Open-source JavaScript charting library behind Plotly and Dash

Quick Overview

The react-financial/react-financial-charts repository is a comprehensive collection of React components for building financial data visualizations. It provides a wide range of customizable and interactive charts, including line charts, candlestick charts, and more, making it a valuable tool for developers working on financial applications.

Pros

  • Extensive Charting Capabilities: The library offers a diverse set of chart types, allowing developers to create visually appealing and informative financial data visualizations.
  • Customizability: The components are highly customizable, enabling developers to tailor the charts to their specific needs and branding requirements.
  • Interactive Features: The charts support various interactive features, such as zooming, panning, and tooltips, enhancing the user experience.
  • Active Development and Community: The project has an active development team and a growing community, ensuring ongoing support and improvements.

Cons

  • Learning Curve: The library has a relatively steep learning curve, especially for developers new to financial data visualization or React.
  • Performance Considerations: Depending on the complexity of the charts and the amount of data being displayed, the library may have performance implications, particularly on low-end devices.
  • Limited Documentation: While the project has documentation, it could be more comprehensive, making it challenging for new users to get started quickly.
  • Dependency on Third-Party Libraries: The library relies on several third-party libraries, which may introduce additional complexity and potential compatibility issues.

Code Examples

Here are a few code examples demonstrating the usage of the react-financial/react-financial-charts library:

import React from 'react';
import { ChartCanvas, Chart, series, coordinates, indicator, axes, helper } from 'react-financial-charts';

const { CandlestickSeries, BarSeries } = series;
const { MouseCoordinateX, MouseCoordinateY } = coordinates;
const { RSIIndicator, MACDIndicator } = indicator;
const { XAxis, YAxis } = axes;
const { fitWidth } = helper;

const CandlestickChart = ({ data, width, ratio }) => {
  return (
    <ChartCanvas
      width={width}
      height={400}
      ratio={ratio}
      data={data}
      seriesName="Data"
      xAccessor={(d) => d.date}
      xScale={scaleTime()}
      xExtents={(data) => [data[0].date, data[data.length - 1].date]}
    >
      <Chart id={1} yExtents={(d) => [d.high, d.low]}>
        <CandlestickSeries />
        <MouseCoordinateY />
      </Chart>
      <Chart id={2} height={100} yExtents={(d) => d.volume}>
        <BarSeries yAccessor={(d) => d.volume} fill={(d) => (d.close > d.open ? '#6BA583' : '#DB0000')} />
        <MouseCoordinateY />
      </Chart>
      <Chart id={3} height={100} yExtents={(d) => d.macd}>
        <MACDIndicator
          yAccessor={(d) => d.macd}
          nAccessor={(d) => d.nmacd}
          signalAccessor={(d) => d.signal}
        />
      </Chart>
      <Chart id={4} height={100} yExtents={(d) => d.rsi}>
        <RSIIndicator yAccessor={(d) => d.rsi} />
      </Chart>
      <XAxis axisAt="bottom" orient="bottom" />
      <YAxis axisAt="right" orient="right" ticks={5} />
    </ChartCanvas>
  );
};

export default fitWidth(CandlestickChart);

This code example demonstrates the creation of a candlestick chart with additional indicators, such as volume, MACD, and RSI.

import React from 'react';
import { ChartCanvas, Chart, series, coordinates, indicator, axes, helper } from 'react-financial-charts';

const { LineSeries } = series;
const { MouseCoordinateX, MouseCo

Competitor Comparisons

📊 Interactive JavaScript Charts built on SVG

Pros of ApexCharts.js

  • Wider variety of chart types, including pie charts, radar charts, and heatmaps
  • More extensive documentation and examples
  • Easier to set up and use for beginners

Cons of ApexCharts.js

  • Less specialized for financial charting
  • May have performance issues with large datasets
  • Limited customization options for advanced financial visualizations

Code Comparison

ApexCharts.js:

var options = {
  chart: { type: 'candlestick' },
  series: [{ data: seriesData }],
  xaxis: { type: 'datetime' }
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();

React Financial Charts:

<ChartCanvas height={400} ratio={1} width={800}>
  <Chart id={1} yExtents={d => [d.high, d.low]}>
    <CandlestickSeries />
    <XAxis dataKey="date" />
    <YAxis />
  </Chart>
</ChartCanvas>

ApexCharts.js offers a simpler setup for basic charts, while React Financial Charts provides more granular control over chart components, making it better suited for complex financial visualizations.

23,884

Redefined chart library built with React and D3

Pros of Recharts

  • More general-purpose charting library with a wider variety of chart types
  • Larger community and more frequent updates
  • Simpler API and easier to get started for basic charts

Cons of Recharts

  • Less specialized for financial charts and trading-specific visualizations
  • May require more custom work for advanced financial charting features
  • Performance can be slower for large datasets compared to React Financial Charts

Code Comparison

React Financial Charts:

<Chart id="chart" height={400} width={800}>
  <CandlestickSeries />
  <LineSeries yAccessor={d => d.close} />
  <MouseCoordinateX />
  <MouseCoordinateY />
</Chart>

Recharts:

<ComposedChart width={800} height={400} data={data}>
  <XAxis dataKey="date" />
  <YAxis />
  <Candlestick />
  <Line type="monotone" dataKey="close" stroke="#8884d8" />
</ComposedChart>

Both libraries offer React components for creating charts, but React Financial Charts provides more specialized components for financial data visualization out of the box, while Recharts requires more configuration for similar results.

64,568

Simple HTML5 Charts using the <canvas> tag

Pros of Chart.js

  • More versatile and supports a wider range of chart types
  • Simpler to set up and use for basic charting needs
  • Larger community and more extensive documentation

Cons of Chart.js

  • Less specialized for financial charting
  • Fewer built-in features for advanced financial analysis
  • May require more custom code for complex financial visualizations

Code Comparison

Chart.js:

new Chart(ctx, {
    type: 'line',
    data: {
        labels: ['Jan', 'Feb', 'Mar'],
        datasets: [{
            label: 'Stock Price',
            data: [10, 15, 7]
        }]
    }
});

React Financial Charts:

<Chart id="chart" height={400}>
    <CandlestickSeries />
    <LineSeries yAccessor={d => d.close} />
    <XAxis />
    <YAxis />
</Chart>

Summary

Chart.js is a more general-purpose charting library with broader applications, while React Financial Charts is specifically tailored for financial charting. Chart.js offers simplicity and versatility, making it suitable for various projects. React Financial Charts provides specialized components and features for financial data visualization, potentially requiring less custom code for complex financial charts. The choice between the two depends on the specific requirements of your project and the level of financial charting complexity needed.

Highcharts JS, the JavaScript charting framework

Pros of Highcharts

  • Extensive documentation and examples
  • Wide range of chart types and customization options
  • Strong community support and regular updates

Cons of Highcharts

  • Commercial license required for most use cases
  • Larger file size and potential performance impact
  • Steeper learning curve for complex customizations

Code Comparison

React Financial Charts:

<Chart id="chart" height={400}>
  <CandlestickSeries />
  <LineSeries yAccessor={d => d.close} />
  <XAxis />
  <YAxis />
</Chart>

Highcharts:

<HighchartsReact
  highcharts={Highcharts}
  options={{
    chart: { type: 'candlestick' },
    series: [{ data: candlestickData }, { type: 'line', data: closeData }]
  }}
/>

React Financial Charts offers a more declarative approach with individual components for chart elements, while Highcharts uses a configuration object to define the chart structure and data. React Financial Charts is specifically designed for financial charts, making it more straightforward for creating common financial visualizations. Highcharts, on the other hand, provides a broader range of chart types but may require more setup for financial-specific charts.

Performant financial charts built with HTML5 canvas

Pros of lightweight-charts

  • Lightweight and fast performance, optimized for mobile devices
  • Supports a wide range of chart types and technical indicators
  • Extensive documentation and active community support

Cons of lightweight-charts

  • Less customizable compared to react-financial-charts
  • Requires more manual setup for advanced features
  • Limited built-in interactivity options

Code Comparison

react-financial-charts:

import { Chart, LineSeries } from 'react-financial-charts';

<Chart id="chart" height={400} width={800}>
  <LineSeries yAccessor={(d) => d.close} />
</Chart>

lightweight-charts:

import { createChart } from 'lightweight-charts';

const chart = createChart(document.body, { width: 800, height: 400 });
const lineSeries = chart.addLineSeries();
lineSeries.setData(data);

Both libraries offer ways to create financial charts, but react-financial-charts provides a more React-centric approach with components, while lightweight-charts uses a more imperative style. react-financial-charts offers more built-in features and easier customization, while lightweight-charts focuses on performance and simplicity. The choice between them depends on specific project requirements, such as performance needs, desired level of customization, and familiarity with React ecosystem.

16,856

Open-source JavaScript charting library behind Plotly and Dash

Pros of plotly.js

  • More comprehensive and versatile, supporting a wide range of chart types beyond financial charts
  • Larger community and more frequent updates, leading to better support and documentation
  • Can be used with various frameworks or vanilla JavaScript, not limited to React

Cons of plotly.js

  • Larger file size and potentially slower performance for specific financial chart use cases
  • May require more configuration and customization for specialized financial charts
  • Steeper learning curve due to its extensive feature set

Code Comparison

react-financial-charts:

import { Chart, CandlestickSeries } from "react-financial-charts";

<Chart data={data}>
  <CandlestickSeries />
</Chart>

plotly.js:

import Plotly from 'plotly.js-dist';

Plotly.newPlot('chart', [{
  type: 'candlestick',
  x: data.dates,
  open: data.open,
  high: data.high,
  low: data.low,
  close: data.close
}]);

Summary

react-financial-charts is more focused on financial charts and integrates seamlessly with React, while plotly.js offers a broader range of chart types and framework flexibility. The choice between them depends on specific project requirements, performance needs, and developer preferences.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

React Financial Charts

Note: this repo is a fork of react-stockcharts, renamed, converted to typescript and bug fixes applied due to the original project being unmaintained.

Note: v1 is a fully breaking change with large parts, if not all, rewritten. Do not expect the same API! although the same features should exist.

ci codecov GitHub license npm version

Charts dedicated to finance.

The aim with this project is create financial charts that work out of the box.

Features

  • integrates multiple chart types
  • technical indicators and overlays
  • drawing objects

Chart types

  • Scatter
  • Area
  • Line
  • Candlestick
  • OHLC
  • HeikenAshi
  • Renko
  • Kagi
  • Point & Figure

Indicators

  • EMA, SMA, WMA, TMA
  • Bollinger band
  • SAR
  • MACD
  • RSI
  • ATR
  • Stochastic (fast, slow, full)
  • ForceIndex
  • ElderRay
  • Elder Impulse

Interactive Indicators

  • Trendline
  • Fibonacci Retracements
  • Gann Fan
  • Channel
  • Linear regression channel

Installation

npm install react-financial-charts

Documentation

Stories

Contributing

Refer to CONTRIBUTING.md

This project is a mono-repo that uses Lerna to manage dependencies between packages.

To get started run:

git clone https://github.com/react-financial/react-financial-charts.git
cd react-financial-charts
npm ci
npm run build

To start up a development server run:

npm start

Roadmap

  • Convert to typescript
  • Bump dependencies to latest
  • Remove React 16 warnings
  • Add CI
  • Fix passive scrolling issues
  • Implement PRs from react-stockcharts
  • Add all typings
  • Move examples to storybook
  • Add all series' to storybook
  • Split project into multiple packages
  • Fix issues with empty datasets
  • Correct all class props
  • Migrate to new React Context API
  • Remove all UNSAFE methods
  • Add documentation to storybook
  • Add full test suite

LICENSE

FOSSA Status