Requirement

The sequence diagram of this case .


How to do in TextGraph(SVG)

* Step1 : install WinGrapgviz on IIS Server

* Step2 : Copy the following code and save it in test.asp.

In this case we use svg format!You mat use the other kind of TextGraph (like dot ,plain,....)

<%



    'Sample Code WinGraphviz in ASP



    'Create DOT Object 

            Dim dot

            Set dot = CreateObject("Wingraphviz.dot")

                                                            

    'Sample data of DOT     

            

            strCMD2 = strCMD2

            strCMD2 = strCMD2 + "digraph G {" + vbcrlf

            strCMD2 = strCMD2 + "   edge [fontname=""Helvetica"",fontsize=10,labelfontname=""Helvetica"",labelfontsize=10];" + vbcrlf

            strCMD2 = strCMD2 + "   node [fontname=""Helvetica"",fontsize=10,shape=record];" + vbcrlf

            strCMD2 = strCMD2 + "   c2 [label=""{Toolbar\n|# currentSelection : Tool\l# toolCount : Integer\l|+ pickItem(i : Integer)\l+ addTool(t : Tool)\l+ removeTool(i : Integer)\l+ getTool() : Tool\l# checkOrphans()\l- compact()\l}""];" + vbcrlf

            strCMD2 = strCMD2 + "}"

    

                            

    'Generate TextImage(SVG)

            Dim strXML

            strXML = dot.ToSVG(strCMD2)

            

    'Return         

            Response.contentType="image/svg+xml"

            Response.Write strXML

%>                              

    

* Step3 : Open it "http://[your URL]/test.asp" in Browser


How to do in BinaryGraph(PNG)

* Step1 : install WinGrapgviz on IIS Server

* Step2 : Copy the following code and save it in test2.asp.

In this case we use svg format!You mat use the other kind of BinaryGraph (like GIF ,PNG,....)

<%

'Sample Code WinGraphviz in ASP



'Create neato Object 

Dim neato

Set neato = CreateObject("Wingraphviz.neato")

                                                            

'Sample data of DOT     



strCMD2 = strCMD2 + "graph ER {" + vbcrlf

strCMD2 = strCMD2 + "   node [shape=box]; course; institute; student;" + vbcrlf

strCMD2 = strCMD2 + "   node [shape=ellipse]; {node [label=""name""] name0; name1; name2;}" + vbcrlf

strCMD2 = strCMD2 + "           code; grade; number;" + vbcrlf

strCMD2 = strCMD2 + "   node [shape=diamond,style=filled,color=lightgrey]; ""C-I""; ""S-C""; ""S-I"";" + vbcrlf



strCMD2 = strCMD2 + "   name0 -- course;" + vbcrlf

strCMD2 = strCMD2 + "   code -- course;" + vbcrlf

strCMD2 = strCMD2 + "   course -- ""C-I"" [label=""n"",len=1.00];" + vbcrlf

strCMD2 = strCMD2 + "   ""C-I"" -- institute [label=""1"",len=1.00];" + vbcrlf

strCMD2 = strCMD2 + "   institute -- name1;" + vbcrlf

strCMD2 = strCMD2 + "   institute -- ""S-I"" [label=""1"",len=1.00];" + vbcrlf

strCMD2 = strCMD2 + "   ""S-I"" -- student [label=""n"",len=1.00];" + vbcrlf

strCMD2 = strCMD2 + "   student -- grade;" + vbcrlf

strCMD2 = strCMD2 + "   student -- name2;" + vbcrlf

strCMD2 = strCMD2 + "   student -- number;" + vbcrlf

strCMD2 = strCMD2 + "   student -- ""S-C"" [label=""m"",len=1.00];" + vbcrlf

strCMD2 = strCMD2 + "   ""S-C"" -- course [label=""n"",len=1.00];" + vbcrlf



strCMD2 = strCMD2 + "   label = ""\n\nEntity Relation Diagram\ndrawn by NEATO"";" + vbcrlf

strCMD2 = strCMD2 + "   fontsize=20;" + vbcrlf

strCMD2 = strCMD2 + "}" + vbcrlf



'Generate BinaryImage(PNG)      

Dim Img         

Set Img = neato.ToPNG(strCMD2)          



            

'Return



Response.contentType="image/png"

Img.Dump(Response)                      



    

%>         

    

* Step3 : Open it "http://[your URL]/test2.asp" in Browser


How to cache binary image on IIS Server

* Step1 : install WinGrapgviz on IIS Server

* Step2 : Copy the following code and save it in test_cmap.asp.

create_img.asp : This code genarates binary image and save in application.

<%

    'Sample Code WinGraphviz in ASP



    'Create neato Object 

            Dim neato

            Set neato = CreateObject("Wingraphviz.neato")

                                                                            

    'Sample data of DOT     

            strCMD1 = "digraph G {A -> B -> C -> A;}"                               



    'Generate BinaryImage(PNG)      

            Dim Img         

            Set Img = neato.ToPNG(strCMD1)          

                                    

    'Cache

    

            Set Application("cache_image") = Img

            

            Response.Write "save image in cache_image"

%>      

    

show_cache.asp : This code display the image .

<%

    on error resume next

    

    Dim img

    Set img = Application("cache_image")

            

    Response.contentType="image/png"                                                

    Img.Dump(Response)      



%>

    

How to do in Clinet-side image map

* Step1 : install WinGrapgviz on IIS Server

* Step2 : Copy the following code and save it in test_cmap.asp.

This code genarates Client-Side Image map in HTML.

        

    <IMG src="test_cmap_png.asp" border="0" usemap="#map1">

    <MAP name="map1">

<%



    'Sample Code WinGraphviz in ASP



    'Create DOT Object 

            Dim dot

            Set dot = CreateObject("Wingraphviz.dot")

                                                            

    'Sample data of DOT                             

    

            strCMD3 = strCMD3

            strCMD3 = strCMD3 + "digraph G {" + vbcrlf

            strCMD3 = strCMD3 + "   A [label=""AT&T"" ];" + vbcrlf

            strCMD3 = strCMD3 + "   B [label=""WinGraphviz"" URL=""http://home.so-net.net.tw/oodtsen/wingraphviz/index.htm""];" + vbcrlf

            strCMD3 = strCMD3 + "   C [label=""Graphviz"" URL=""http://www.research.att.com/sw/tools/graphviz/""];" + vbcrlf

    

    

            strCMD3 = strCMD3 + "   A -> B ;" + vbcrlf

            strCMD3 = strCMD3 + "   B ->C -> A;" + vbcrlf



            strCMD3 = strCMD3 + "}" + vbcrlf

                            

    'Generate Client-side image map(CMAP)

            Dim strCMAP

            strCMAP = dot.ToCMAP(strCMD3)

            

    'Return                         

            Response.Write strCMAP

            

    'Release Resource                                               

            

            Set dot = Nothing

%>

    </MAP>

    

* Step3 : Copy the following code and save it in test_cmap_png.asp.

This code genarates a png-image file.

<%

    'Sample Code WinGraphviz in ASP



    'Create DOT Object 

            Dim dot

            Set dot = CreateObject("Wingraphviz.dot")

                                                            

    'Sample data of DOT                             

    

            strCMD3 = strCMD3

            strCMD3 = strCMD3 + "digraph G {" + vbcrlf

            strCMD3 = strCMD3 + "   A [label=""AT&T"" ];" + vbcrlf

            strCMD3 = strCMD3 + "   B [label=""WinGraphviz"" URL=""http://home.so-net.net.tw/oodtsen/wingraphviz/index.htm""];" + vbcrlf

            strCMD3 = strCMD3 + "   C [label=""Graphviz"" URL=""http://www.research.att.com/sw/tools/graphviz/""];" + vbcrlf

    

    

            strCMD3 = strCMD3 + "   A -> B ;" + vbcrlf

            strCMD3 = strCMD3 + "   B -> C -> A;" + vbcrlf



            strCMD3 = strCMD3 + "}" + vbcrlf

                            

    'Generate BinaryImage(PNG)      

            Dim Img         

            Set Img = dot.ToPNG(strCMD3)                                            

                                    

    'Return

            

            Response.contentType="image/png"

            Img.Dump(Response)              

                                            

    'Release Resource                               

            Set Img = Nothing                                                                                               

            

            Set dot = Nothing

                    

%>

    

* Step4 : Open it "http://[your URL]/test_cmap.asp" in Browser

HTML Source


<IMG src="test_cmap_png.asp" border="0" usemap="#map1">

<MAP name="map1">

	<AREA shape="rect" 

		href="http://home.so-net.net.tw/oodtsen/wingraphviz/index.htm" 

		title="WinGraphviz" 

		alt="WinGraphviz"

		coords="7,112,135,160">

		

	<AREA shape="rect" 

		href="http://www.research.att.com/sw/tools/graphviz/" 

		title="Graphviz" 

		alt="Graphviz" 

		coords="73,208,169,256">

</MAP>

    

Feedback

Submit bug reports or suggestions for the WinGraphvizood Tsen.