Hey folks.
I was wondering if anyone out there had any experience with creating ReScript bindings to Fusion Charts. If so, I’d love to chat with you and hopefully avoid some of the grunt work that will go along with creating a full set of ReScript bindings to their component library.
So far, my biggest issue is how to deal with binding to a React component that, itself, has functions you can call. FusionCharts seems to use a non-standard mechanism for generating their components. I’m guessing this is an artifact of their library not being native to React, but I haven’t investigated that.
Here’s what the JavaScript sample looks like from their documentation. Note the React component (ReactFC
) has a function attached called fcRoot
that can (needs?) to be called before it is used as a component.
import ReactFC from "react-fusioncharts"
import FusionCharts from "fusioncharts"
import Column2D from "fusioncharts/fusioncharts.charts"
import FusionTheme from "fusioncharts/themes/fusioncharts.theme.fusion"
ReactFC.fcRoot(FusionCharts, Column2D, FusionTheme)
const chartData = [ ] // ..array of data
const chartConfigs = {
// some configs,
data: chartData,
}
class App extends React.Component {
render() {
return <ReactFC {...chartConfigs} />;
}
}
export default App
As I’m relatively new to ReScript bindings writing, this is making me feel like a junior developer all over again.
Thanks in advance for any help,
Wil