Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create Arbor.js using webworkers and jQuery

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to create Arbor.js using webworkers and jQuery, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Arbor.js is a data graphics visualization JavaScript framework created by webworkers and jQuery. It provides an efficient and force-oriented layout algorithm for graphic organization and screen refresh processing. This framework does not enforce which method to draw the screen, you can use the location elements of Canvas, SVG, or even HTML.

Arbor.js requirements

Because of the work, I need to use a js library of arbor to do something. After thinking about it for a day, I finally met the demand.

There are four requirements:

1. Different points can display the same text

Second, display text on the edge

When you click node, a form pops up.

Fourth, with arrows on the side

You can see that the demo on the official website is doing very well. If you download its code, you can see that the definitions of points and edges are all in site.js. This library is based on jQuery, so I wrote a button jQuery function to test.

First of all, look at the api provided by arbor, you can know the function of dynamically adding points and edges, through this plus ajax can dynamically interact, our final result is like this, but here only meet the above requirements.

Arbor.js code

$("Button") .click (function () {

/ / alert ("nihao")

Varnn=sys.addNode ("FSB", {label:'nihao',color:CLR.branch,shape: "dot", alpha:1,expanded:true})

Varnm=sys.addNode ("FSB", {label:'sad',color:CLR.branch,shape: "dot", alpha:1})

Varee=sys.addEdge (nm,nn, {label: "nihao"})

/ / varnodes=sys.getEdges (nm,nn)

/ / nodes [0] .data.label = "nihaoasfsa"

Alert ("" + nodes [0] .data.label)

})

After adding such code, I found that only one point can be added and the name is "FSB". It is easy to get the data results of node through the browser's console. Let's not talk about it here. Let's take a look at the rewriting of the redraw function in the Renderer function.

Thank you for reading this article carefully. I hope the article "how to create Arbor.js using webworkers and jQuery" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report