流程图 - markdown

6 篇文章 0 订阅
<!DOCTYPE html >
< html lang= "en" >
< head >
< meta charset= "utf-8" >
< title > flowchart.js · Playground </ title >
< style type= "text/css" >
     . end-element { background-color : #333 ; color : #eee ; }
</ style >
< script src= " http://flowchart.js.org/flowchart-latest.js " ></ script >
<!-- <script src="../release/flowchart.min.js"></script> -->
< script >

     window . onload = function () {
          var btn = document . getElementById ( "run" ),
               cd1 = document . getElementById ( "code1" ), cd2 = document . getElementById ( "code2" ),
               chart ;

          ( btn .onclick = function () {
               var code = cd1 . value + cd2 . value ;
               if ( chart ) { chart . clean (); }
               chart = flowchart. parse ( code );
               chart .drawSVG( 'canvas' , {
                    // 'x': 30,
                    // 'y': 50,
                    'line-width' : 2 ,
                    'maxWidth' : 3 , //ensures the flowcharts fits within a certian width
                    'line-length' : 50 ,
                    'text-margin' : 10 ,
                    'font-size' : 14 ,
                    'font' : 'normal' ,
                    'font-family' : ' 微软雅黑 ' ,
                    'font-weight' : 'normal' ,
                    'font-color' : 'black' ,
                    'line-color' : 'black' ,
                    'element-color' : 'black' ,
                    'fill' : 'white' ,
                    // 'yes-text': 'yes',
                    // 'no-text': 'no',
                    'arrow-end' : 'block' ,
                    'scale' : 1 ,
                    'symbols' : {
                         'start' : {
                              'font-color' : 'red' ,
                              'element-color' : 'green' ,
                              'fill' : 'yellow'
                           },
                         'end' : {
                              'class' : 'end-element'
                         }
                    },
                    'flowstate' : {
                         'past' : { 'fill' : '#CCCCCC' , 'font-size' : 12 },
                         'current' : { 'fill' : 'yellow' , 'font-color' : 'red' , 'font-weight' : 'bold' },
                         'future' : { 'fill' : '#FFFF99' },
                         'request' : { 'fill' : 'blue' },
                         'invalid' : { 'fill' : '#444444' },
                         'approved' : { 'fill' : '#58C4A3' , 'font-size' : 12 , 'yes-text' : 'APPROVED' , 'no-text' : 'n/a' },
                         'rejected' : { 'fill' : '#C45879' , 'font-size' : 12 , 'yes-text' : 'n/a' , 'no-text' : 'REJECTED' }
                    }
               });

               $ ( '[id^=sub1]' ). click ( function (){
                    alert ( 'info here' );
               });
          })();

     };
</ script >
</ head >
< body >
< div >
< textarea id= "code1" style= " display : none ; width : 100 % ; " rows= "11" >
     start=>start: Start|past:> http://www.baidu.com[blank ]
     end=>end: End:> http://www.google.com
     op1=>operation: My Operation|past
     op2=>operation: Stuff|current
     sub1=>subroutine: My Subroutine|invalid
     cond=>condition: Yes or No?|approved:> http://www.google.com
     c2=>condition: Good idea|rejected
     io=>inputoutput: catch something...|request
</ textarea >
< textarea id= "code2" style= " display : none ; width : 100 % ; " rows= "11" >
     start->op1(right)->cond
     cond(yes, right)->c2
     cond(no)->sub1(left)->op1
     c2(yes)->io->end
     c2(no)->op2->end
</ textarea >
</ div >
< div >< button id= "run" type= "button" > Run </ button ></ div >
< div id= "canvas" ></ div >
</ body >
</html>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值