Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using this module with react ? #124

Open
Baribj opened this issue Mar 11, 2022 · 3 comments
Open

Using this module with react ? #124

Baribj opened this issue Mar 11, 2022 · 3 comments

Comments

@Baribj
Copy link

Baribj commented Mar 11, 2022

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

@MehGokalp
Copy link

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

@posiaden123
Copy link

Necroing, but this helps a lot, thanks.

@HeinKoZin
Copy link

Can someone share using with react example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants