@billboard.js/react
React component for billboard.js
Installation
$ npm install billboard.js @billboard.js/react
How to use
import React, {useEffect, useRef} from "react";
import bb, {line} from "billboard.js";
import "billboard.js/dist/billboard.css";
import BillboardJS, {IChart} from "@billboard.js/react";
function App() {
const chartComponent = useRef<IChart>();
const options = {
data: {
columns: [
["data1", 300, 350, 300]
],
type: line()
}
};
useEffect(() => {
const chart = chartComponent.current?.instance;
if (chart) {
chart.load( ... );
}
}, []);
return <div style={{width: "500px"}}>
<BillboardJS bb={bb} options={options} ref={chartComponent} />
</div>;
}