In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use jointJS", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use jointJS" this article.
Recently, due to the needs of the project, began to contact jointJS, properly keep browsing the document mode, first write a superficial understanding of jointjs.
We can use the diagram elements already provided by JointJS to draw, or we can customize some diagram elements according to our needs. In addition, the charts created by JointJS are SVG graphs. If you want to change the graphic style, just go to GoogleSVG related syntax. In addition, it is extremely easy to use and easy to operate, and supports all modern browsers.
Let's show the use of jointjs through a small demo.
First of all, go to the official website to download these files, which can be found in the HTML code block head: when everything is ready, here we go.
First look at the HTML code, body is a div#myholder used to hold my artboard graph, here someone will ask what is graph, urgent, please read on.
The JS code is as follows: the first is to define the artboard and canvas
Var graph = new joint.dia.Graph; var paper = new joint.dia.Paper ({el: $('# myholder'), / / here is the container where you want to put graph width: 1300, height: 800, model: graph, gridSize: 1})
Next, draw a simple rectangle. To change some of the default styles, you need to know the SVG DOM structure of the element:
Var rect = new joint.shapes.basic.Rect ({position: {x: 100, y: 30}, size: {width: 200, height: 30}, attrs: {/ / attr SVG attr prop- custom data rect: {fill: 'rgb (238244247)', 'stroke':' rgb (47152223)' 'stroke-width':' 1px' / / svg coloring fill stroke}, text: {text:'my box', fill: 'black'})
Similar to a rectangle, we can also draw an ellipse with the following code:
Var ellipse = new joint.shapes.basic.Rect ({position: {x: 100, y: 30}, size: {width: 200, height: 30}, attrs: {/ / attr SVG attr prop- custom data rect: {fill: 'rgb (238244247)', 'stroke':' rgb (47152223)' 'stroke-width':' 1pxcards, 'rx':' 10pxtiles, 'ry':' 30px' / / svg coloring fill stroke}, text: {text: 'ellipse', fill:' pink'})
Let them have a certain distance.
Ellipse.translate (300); / / the distance between two blocks
Next, let's draw a line:
Var link = new joint.dia.Link ({source: {id: rect.id}, target: {id: ellipse.id}})
Put all the objects created in front of you into the drawing board:
Graph.addCells ([rect, rect2, link]); the above is all the content of this article "how to use jointJS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.