Light High Efficiency Graph Component
en

Qunee Developer Guide

Data Acquisition

Build backstage data service to provide services via data base and technologies of web services (servlet, php, web socket, asp.net…). It is converted to XML,JSON,text or binary format to corresponding front ends, which acquires data via web messaging technology(ajax, web socket …) and then submits to JavaScript engine for handling.

Backstage data

Generally the JSON data format is used, such as the following linkage of ./data-server

{
  "nodes": [
    {
      "name": "A",
      "x": -100,
      "y": -50,
      "id": 1
    },
    {
      "name": "B",
      "id": 2
    }
  ],
  "edges": [
    {
      "name": "Edge",
      "from": 1,
      "to": 2
    }
  ]
}

Request data

Request backstage data via AJAX or Web socket. Generally take the usage of AJAX

AJAX for acquiring backstage data for example

function request(url, params, callback, callbackError) {
    try {
        var req = new XMLHttpRequest();
        req.open('GET', encodeURI(url));
        req.onreadystatechange = function(e) {
            if (req.readyState != 4) {
                return;
            }
            if (200 == req.status) {
                var code = req.responseText;
                if (code && callback) {
                    callback(req.responseText);
                }
                return;
            }else{
                if (callbackError) {
                    callbackError();
                }
            }
        }
        req.send(params);
    } catch (error) {
        if (callbackError) {
            callbackError();
        }
    }
}

Usage

request("./data-server", "", onDataCollected);

Icon

Web socket technology has requirements for both Web server and browser, which has not gotten common support and application