日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

轻量级流程图控件GoJS示例连载(一):最小化

發布時間:2025/6/15 javascript 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 轻量级流程图控件GoJS示例连载(一):最小化 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

GoJS是一款功能強大,快速且輕量級的流程圖控件,可幫助你在JavaScript 和 HTML5 Canvas程序中創建流程圖,且極大地簡化你的JavaScript / Canvas 程序。

小編為大家準備了一套完整的GoJS的示例,將以連載的形式展開,供大家學習和交流討論。

這不是GoJS的真正最小化演示,因為我們確實指定了自定義Node模板,但它非常簡單。如果單擊鏈接,示例的完整來源如下所示。

此示例使用Node模板設置Diagram.nodeTemplate,該模板數據綁定文本字符串和形狀的填充顏色。有關構建自己的模板和模型數據的概述,請參閱“入門教程”。

該Diagram.initialContentAlignment設置導致圖表內容出現在圖的視口的中心。

使用鼠標和常用鍵盤命令,你可以平移,選擇,移動,復制,刪除和撤消/重做。在觸摸設備上,使用手指作為鼠標,并保持手指靜止以顯示上下文菜單。默認上下文菜單支持當時為所選對象啟用的大多數標準命令。

有關更精細和更有說服力的樣本,請參閱基本示例。有關從服務器加載JSON數據的示例,請參閱最小化JSON示例。有關從服務器加載XML數據的示例,請參閱最小化XML示例

以下為在頁面中查看此示例頁面的源代碼:

function init() {if (window.goSamples) goSamples(); // init for these samples -- you don't need to call thisvar $ = go.GraphObject.make; // for conciseness in defining templatesmyDiagram = $(go.Diagram, "myDiagramDiv", // create a Diagram for the DIV HTML element{initialContentAlignment: go.Spot.Center, // center the content"undoManager.isEnabled": true // enable undo & redo});// define a simple Node templatemyDiagram.nodeTemplate =$(go.Node, "Auto", // the Shape will go around the TextBlock$(go.Shape, "RoundedRectangle", { strokeWidth: 0, fill: "white" },// Shape.fill is bound to Node.data.colornew go.Binding("fill", "color")),$(go.TextBlock,{ margin: 8 }, // some room around the text// TextBlock.text is bound to Node.data.keynew go.Binding("text", "key")));// but use the default Link template, by not setting Diagram.linkTemplate// create the model data that will be represented by Nodes and LinksmyDiagram.model = new go.GraphLinksModel([{ key: "Alpha", color: "lightblue" },{ key: "Beta", color: "orange" },{ key: "Gamma", color: "lightgreen" },{ key: "Delta", color: "pink" }],[{ from: "Alpha", to: "Beta" },{ from: "Alpha", to: "Gamma" },{ from: "Beta", to: "Beta" },{ from: "Gamma", to: "Delta" },{ from: "Delta", to: "Alpha" }]);} <div id="sample" deep="0"><!-- The DIV for the Diagram needs an explicit size or else we won't see anything.This also adds a border to help see the edges of the viewport. --><div id="myDiagramDiv" style="border: solid 1px black; width:400px; height:400px"></div><p>This isn't a truly <i>minimal</i> demonstration of <b>GoJS</b>,because we do specify a custom Node template, but it's pretty simple.The whole source for the sample is shown below if you click on the link.</p><p>This sample sets the <a>Diagram.nodeTemplate</a>, with a <a>Node</a> template that data binds both the text string and the shape's fill color.For an overview of building your own templates and model data, see the <a href="../learn/index.html">Getting Started tutorial.</a></p><p>The <a>Diagram.initialContentAlignment</a> setting causes the diagram's contentsto appear in the center of the diagram's viewport.</p><p>Using the mouse and common keyboard commands, you can pan, select, move, copy, delete, and undo/redo.On touch devices, use your finger to act as the mouse, and hold your finger stationary to bring up a context menu.The default context menu supports most of the standard commands thatare enabled at that time for the selected object.</p><p>For a more elaborate and capable sample, see the <a href="basic.html">Basic</a> sample.For a sample that loads JSON data from the server,see the <a href="minimalJSON.html">Minimal JSON</a> sample.For a sample that loads XML data from the server,see the <a href="minimalXML.html">Minimal XML</a> sample.</p> </div>

以下為在GitHub上查看此示例頁面的源代碼:

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Minimal GoJS Sample</title> <meta name="description" content="An almost minimal diagram using a very simple node template and the default link template." /> <!-- Copyright 1998-2018 by Northwoods Software Corporation. --> <meta charset="UTF-8"> <script src="../release/go.js"></script> <script src="../assets/js/goSamples.js"></script> <!-- this is only for the GoJS Samples framework --> <script id="code">function init() {if (window.goSamples) goSamples(); // init for these samples -- you don't need to call thisvar $ = go.GraphObject.make; // for conciseness in defining templatesmyDiagram = $(go.Diagram, "myDiagramDiv", // create a Diagram for the DIV HTML element{initialContentAlignment: go.Spot.Center, // center the content"undoManager.isEnabled": true // enable undo & redo});// define a simple Node templatemyDiagram.nodeTemplate =$(go.Node, "Auto", // the Shape will go around the TextBlock$(go.Shape, "RoundedRectangle", { strokeWidth: 0, fill: "white" },// Shape.fill is bound to Node.data.colornew go.Binding("fill", "color")),$(go.TextBlock,{ margin: 8 }, // some room around the text// TextBlock.text is bound to Node.data.keynew go.Binding("text", "key")));// but use the default Link template, by not setting Diagram.linkTemplate// create the model data that will be represented by Nodes and LinksmyDiagram.model = new go.GraphLinksModel([{ key: "Alpha", color: "lightblue" },{ key: "Beta", color: "orange" },{ key: "Gamma", color: "lightgreen" },{ key: "Delta", color: "pink" }],[{ from: "Alpha", to: "Beta" },{ from: "Alpha", to: "Gamma" },{ from: "Beta", to: "Beta" },{ from: "Gamma", to: "Delta" },{ from: "Delta", to: "Alpha" }]);} </script> </head> <body οnlοad="init()"> <div id="sample"><!-- The DIV for the Diagram needs an explicit size or else we won't see anything.This also adds a border to help see the edges of the viewport. --><div id="myDiagramDiv" style="border: solid 1px black; width:400px; height:400px"></div><p>This isn't a truly <i>minimal</i> demonstration of <b>GoJS</b>,because we do specify a custom Node template, but it's pretty simple.The whole source for the sample is shown below if you click on the link.</p><p>This sample sets the <a>Diagram.nodeTemplate</a>, with a <a>Node</a> template that data binds both the text string and the shape's fill color.For an overview of building your own templates and model data, see the <a href="../learn/index.html">Getting Started tutorial.</a></p><p>The <a>Diagram.initialContentAlignment</a> setting causes the diagram's contentsto appear in the center of the diagram's viewport.</p><p>Using the mouse and common keyboard commands, you can pan, select, move, copy, delete, and undo/redo.On touch devices, use your finger to act as the mouse, and hold your finger stationary to bring up a context menu.The default context menu supports most of the standard commands thatare enabled at that time for the selected object.</p><p>For a more elaborate and capable sample, see the <a href="basic.html">Basic</a> sample.For a sample that loads JSON data from the server,see the <a href="minimalJSON.html">Minimal JSON</a> sample.For a sample that loads XML data from the server,see the <a href="minimalXML.html">Minimal XML</a> sample.</p> </div> </body> </html>

想要查看在線操作示例,可以點擊此處>>>>>

轉載于:https://juejin.im/post/5bebb2576fb9a049ea388104

總結

以上是生活随笔為你收集整理的轻量级流程图控件GoJS示例连载(一):最小化的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日本ww色| 撸啊撸在线视频 | 日韩精美视频 | 国产熟女高潮一区二区三区 | 亚洲图片欧美色图 | 亚洲五月六月 | 奇米影视77777 | 北条麻妃一区二区三区免费 | 蜜桃视频黄色 | www.黄色片网站 | 亚洲乱人伦 | 国产精品国产三级国产在线观看 | 二区在线观看 | 日本在线观看视频网站 | av男女 | 色综合99久久久无码国产精品 | 国产情侣av自拍 | 亚洲国产精品成人无久久精品 | 波多野结衣毛片 | av私库在线观看 | 性猛交富婆╳xxx乱大交麻豆 | 国产精品久久久久久免费播放 | 在线视频免费观看你懂的 | 国产天堂在线 | 欧美区一区二区三 | 尹人在线视频 | 91国产在线免费观看 | 国产成人免费 | 麻豆精品一区二区三区 | 亚洲成年人在线观看 | 亚洲国产精品网站 | 日韩丰满少妇无码内射 | 黄色在线网站 | 日日夜夜免费 | 久久www视频 | 亚洲精品视频在线观看免费 | 午夜影院在线观看视频 | 91中出| 精品人妻无码专区视频 | 国产福利久久久 | 亚洲综合色婷婷 | 中国a毛片| 又色又爽又黄gif动态图 | 免费裸体视频女性 | 97caocao| 免费看v片| 久久精品国产亚洲AV成人婷婷 | 乌克兰黄色片 | 韩国av一区二区 | 国产九九 | 国产精品视频久久久久久久 | 那里有毛片看 | 国产农村妇女精品 | 黄色片网站视频 | 快播视频在线观看 | 久热av在线 | 免费黄色大片 | www精品国产 | 免费麻豆av | 911久久| 中文字幕av观看 | 精品国产av 无码一区二区三区 | 亚欧精品视频一区二区三区 | 国产伊人一区 | 91视频国产免费 | 四虎视频国产精品免费入口 | 亚洲精品18 | 久热精品视频在线播放 | 日韩av电影中文字幕 | 看黄色的网址 | 国产日韩欧美不卡 | 成人手机视频在线观看 | 美女福利视频网 | 亚洲无人禁区 | 亚洲一区二区三区91 | 久久综合伊人 | 永久免费精品影视网站 | 台湾色综合 | 一级黄网站 | 妇女一级片| 一级全黄毛片 | 亚洲一区图片 | av第一福利大全导航 | 波多野结衣乳巨码无在线 | 欧美一级α片 | 久艹在线| 一级黄色片在线 | 日本黄页网站免费大全 | 日本涩涩网站 | 欧美日批视频 | 日韩av在线播放一区 | 欧美成人一区二区三区片免费 | 电影《两个尼姑》免费播放 | 亚洲综合视频网站 | 一个色综合网 | 中国女人一级片 | 国产视频二区三区 | 国产中文字幕精品 | 欧美激情爱爱 |