I am building a Web-Client, which is supposed to visualize Sensor data (velocity, acceleration) inside a coordinate system. To display the coordinate system i used the library graph.js
from here https://github.com/dhuertas/graph.js , which worked perfectly fine with a classic index.html and normal javascript, but I want to use Angular7 , which does use TypeScript and Angulars Compnent app structure...
I already tried this: Use external javaScript library in angular 4 application
(which is basically exactly what I need)
and a couple of similar threads
but none did work for me
What I did was the following :
the HTML of my component
<div style="position:relative;top:100px;left:950px" id='container' class="trajStrly"></div>
<script type="module" src="../libraries/graph.js"></script>
parts the component.ts:
import * as Graph from '../libraries/graph';
declare var Graph: any;
// ... inside the component Class...
graph: any;
ngOnInit() {
this.graph = new Graph({
appendTo : "container",
canvasWidth : 100,
canvasHeight : 100,
colorList : ["#666666","#666666","#00F"],
xAxisTitle : "X",
yAxisTitle : "Y"
});
this.draw();
}
the draw function worked fine with the JavaScript and is not the probloem here. It initializes the graph with values to draw.
The Error I get is that graph.js is not a module. I already tried editing graph.js by putting export default
in front of the definition of Graph
inside grapf.js.
Also already emailed the creator, but he did not answer me yet