Echarts force-oriented layout diagram-data source description and Backend API conventions

Source: Internet
Author: User
Echarts?

About Echarts please go here

Force Guide Diagram

Implementation methods, such as:

function require_EC () {require(    [        'echarts',        //载入force模块        'echarts/chart/kforce'    ],    function (ec) {    //确定需要绘制的DOM        setChats(ec);    })}function setChats (ec) {var myChart = ec.init(document.getElementById('main'));myChart.setOption(option);}

Data source Description

The main three data sources: categories (data classification), nodes (node name in the chart), links (link lines between nodes in the chart), as follows:

API Development

Force Guide Diagram Data API documentation (personal comments for reference only)

Implementation features 1, categories, nodes, links, array on-demand load, reduce server pressure;
2, the optimization of the Display Island link
3. Cache Data Application
Main parameters and primary values for interface delivery Name, force, categories, nodes, links, cache, refresh
Return code See Return code attachment diagram

Parameter description:

Request Example: (see picture for details)

Example links return value Meaning
Force-api.php?name=demo1&force=nodes Picture Details Gets the nodes (node) data for a force-directed chart called "Demo1"
Force-api.php?name=demo1&force=categories Picture Details Obtained the categories (categorical) data of a force-directed chart called "Demo1", "and so on links do not make an example"
Force-api.php?name=demo1_isolated_all&force=links Picture Details "How do I get an island link?" "Make a diagram of an island link a new chart: Get the links array for all of Demo1 's Island links (Demo1_isolated_all)
Force-api.php?name=demo1_isolated_all&force=nodes&cache=refresh Picture Details Gets the node array of all islanding links (Demo1_isolated_all) of Demo1 and makes a forced flush

Note: The first time the server is requested, the correct return code if requested will be

code: "2200",message: "nodes success",

The second request server will return

code: "3304",message: "cache:2015-01-19 15:14:43",

Unless you add the parameter cache=refresh cache time 3 days

Return Code conventions

Finish

Attached this API interface source PHP (PHP casually write down, tap ... ): Download

The above introduces the force-oriented layout of echarts-Data source description and backend API conventions, including the contents of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.