I have to use the Treant.js librairy in a React.js project but i have some issues to create diagram. In fact, the official website tell us that we have to import script like that:
<script src="vendor/raphael.js"></script>
<script src="Treant.min.js"></script>
I don't think that it's possible in react to import scripts like that... I have also seen that they made a node module (here). So I installed it and I tryed to import the lib like that
import Treant from 'treant-js'
Moreover, I have seen in an exemple that they generate diagram like that :
<script>
new Treant( simple_chart_config );
</script>
Finally, the import worked but when i try to generate the diagram like that
{new Treant (this.state.diagram)}
I have this error : _treantJs2.default is not a constructor
Finally I have read this article : Integrating Treant-js in Angular2 Project and they say to import the lib from the files downloadable from the website but I don't think that it's possible to do that in react...
I already tryed many things but I'm a begginner with react, I'm certainly missing somethin obvious... If someone have an idea to help me, it would be nice :) Thank you
via Chili
No comments:
Post a Comment