react-candlestick-chart
High performance, lightweight and interactive candlestick chart using the canvas tag, D3 and React.
Installation
npm i react-candlestick-chart
Demo
To discover all features, capabilities and source code, check out Live Demo

Basic Usage
import CandlestickChart from "react-candlestick-chart";
function App() {
return (
<CandlestickChart
data={data}
id={"chart1"}
width={1000}
height={400}
decimal={2}
scrollZoom={{
enable: true,
max: 20,
}}
rangeSelector={{
enable: true,
height: 150,
initialRange: { type: "month", value: 1 },
}}
/>
);
}
Props
data - required
data: any;
example: [
{
date: "2018-10-23",
open: 182.47,
high: 183.01,
low: 177.39,
close: 179.93,
position: {
positionType: "long",
sl: 170,
tp: 190,
positionValue: 180,
},
},
{
date: "2018-10-24",
open: 180.82,
high: 181.4,
low: 177.56,
close: 178.75,
},
];
id - required
id: string;
width - required
width: number;
height - required
height: number;
decimal? - optional
decimal for price axis.
decimal?: number;
scrollZoom? - optional
scrollZoom?: {
enable: boolean;
max: number;
};
rangeSelector? - optional
rangeSelector?: {
enable: boolean;
height: number;
initialRange?: {
type: "month" | "day" | "hour" | "percent" | "milliseconds";
value: number;
};
};
responsiveBreakPoint? - optional
responsiveBreakPoint?: number;
enableResetButton? - optional
enableResetButton?: boolean;
dataViewerTexts? - optional
dataViewerTexts? : {
shortPosition?: string;
longPosition?: string;
stopLoss?: string;
takeProfit?: string;
open?: string;
high?: string;
low?: string;
close?: string;
}
dataViewerColors? - optional
dataViewerColors? : {
shortPositionLabel?: string;
shortPositionData?: string;
longPositionLabel?: string;
longPositionData?: string;
stopLossLabel?: string;
stopLossData?: string;
takeProfitLabel?: string;
takeProfitData?: string;
openLabel?: string;
openDataUp?: string;
openDataDown?: string;
highLabel?: string;
highDataUp?: string;
highDataDown?: string;
lowLabel?: string;
lowDataUp?: string;
lowDataDown?: string;
closeLabel?: string;
closeDataUp?: string;
closeDataDown?: string;
}
ColorPalette? - optional
ColorPalette? : {
background?: string;
grid?: string;
tick?: string;
selectorLine?: string;
selectorLabelBackground?: string;
selectorLabelText?: string;
greenCandle?: string;
redCandle?: string;
longPosition?: string;
shortPosition?: string;
sl?: string;
tp?: string;
RSChartStroke?: string;
RSChartOverlay?: string;
RSChartOverlayResize?: string;
resetButtonColor?: string;
}
License
ISC