Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I run/use this? #22

Open
XenGi opened this issue Jun 16, 2021 · 0 comments
Open

How do I run/use this? #22

XenGi opened this issue Jun 16, 2021 · 0 comments

Comments

@XenGi
Copy link

XenGi commented Jun 16, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant