Closed
Description
Currently it is not possible to use this library with React (easily).
Some modifications are needed to use it.
I want to discuss what should happen in this repository and what not.
I already did small changes to use it as a simple React component.
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Frappe from 'frappe-charts/src/scripts/charts.js'
import 'frappe-charts/dist/frappe-charts.min.css' // to import styling
class Chart extends Component {
componentDidMount() {
const {title, data, type = 'bar', height = 250} = this.props
this.c = new Frappe({
parent: this.chart,
title,
data,
type,
height
})
}
render() {
return <div ref={chart => (this.chart = chart)}/>
}
}
export default Chart
I created a demo repo for showcase: https://github.com/tobiaslins/frappe-charts-react-example