chartjs-chart-financial icon indicating copy to clipboard operation
chartjs-chart-financial copied to clipboard

Using this module with react ?

Open Baribj opened this issue 2 years ago • 3 comments

Hi there,

Any idea how would one use this module with react.js

I did

import {
  Chart as ChartJS,
  CategoryScale,
  LinearScale,
  PointElement,
  LineElement,
  Title,
  Tooltip,
  Legend,
} from "chart.js"

import { Chart } from "react-chartjs-2";

import "../public/static/chartjs-chart-financial";

But then I got stuck, not sure where to take it from here.

P.S I am trying to use candlestick chart

Baribj avatar Mar 11 '22 00:03 Baribj

as i spent some hours on this repository i think i can answer 🤓 this plugin only registers it's component into chartjs. when you call "import" it registers automatically and only thing that you need is changing the chart type to "candlestick" instead of barchart or line..

anyway if you need to access it's components i think there is a way to do;

import { OhlcElement, OhlcController, CandlestickElement, CandlestickController } from 'chartjs-chart-financial'
import Chart from 'chart.js/auto' // Easy way of importing everything

Chart.register(OhlcElement, OhlcController, CandlestickElement, CandlestickController)

i found it from web. i hope it helps

MehGokalp avatar Nov 13 '22 22:11 MehGokalp

Necroing, but this helps a lot, thanks.

posiaden123 avatar Jun 30 '23 16:06 posiaden123