It is pretty much unclear to me how I would use this. I tried creating a simple example. I downloaded the contents of the dist folder to my test workspace. AFAIK this is everything that you need from a javascript package to use it.
I created this index.html:
<!doctype html>
<html>
<head>
<title>Weathermap</title>
<link rel="stylesheet" href="/networkmap.css" />
<script src="/networkmap.min.js"></script>
</head>
<body>
<h1>Weathermap</h1>
<div id="weathermap"></div>
<script>
var map;
window.addEvent('load', function(){
map = new networkMap.Graph('weathermap').load('/weathermap.json');
});
</script>
</body>
</html>
Then I created this weathermap.json:
{
"nodes": [
{
"id": "core",
"name": "core-01",
"x": "10",
"y": "10",
"renderer": "rect",
"information": {
"test": "some value"
},
"label": {
"position": "internal",
"visable": "true"
},
"padding": "10",
"events": {
"click": {
"href": "https://example.com"
}
}
}
],
"links": [
],
"onsave": {
"method": "post",
"url": "/",
"data": {
"id": "weathermap.json"
}
}
}
Other files in this folder are:
- networkmap.css
- networkmap.js
- networkmap.min.js
I tried to run it with a simple python web server like this:
python -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Problem 1:
It complained about a file /resources/img/settings.png missing. So I grabbed it from the repo and put it where it was expected. Why is this file missing? Shouldn't it be in the dist/ folder if it is needed?
Problem 2:
When I open the site now it gives me this error:
Uncaught TypeError: window.addEvent is not a function
at (index):13
When I try this in the console:
> console.log(window.addEvent);
undefined
I'm out of ideas here. A simple getting started guide or instruction and how to get this running would be nice.
It is pretty much unclear to me how I would use this. I tried creating a simple example. I downloaded the contents of the
distfolder to my test workspace. AFAIK this is everything that you need from a javascript package to use it.I created this
index.html:Then I created this
weathermap.json:{ "nodes": [ { "id": "core", "name": "core-01", "x": "10", "y": "10", "renderer": "rect", "information": { "test": "some value" }, "label": { "position": "internal", "visable": "true" }, "padding": "10", "events": { "click": { "href": "https://example.com" } } } ], "links": [ ], "onsave": { "method": "post", "url": "/", "data": { "id": "weathermap.json" } } }Other files in this folder are:
I tried to run it with a simple python web server like this:
Problem 1:
It complained about a file
/resources/img/settings.pngmissing. So I grabbed it from the repo and put it where it was expected. Why is this file missing? Shouldn't it be in thedist/folder if it is needed?Problem 2:
When I open the site now it gives me this error:
When I try this in the console:
I'm out of ideas here. A simple getting started guide or instruction and how to get this running would be nice.