From d7cbd357d47897613fda048a2951fa80b40abe75 Mon Sep 17 00:00:00 2001 From: apb Date: Wed, 19 Sep 2012 22:24:18 +0100 Subject: [PATCH] svg widget --- src/graphxq.xqm | 2 + src/graphxq/app.js | 8 +- src/graphxq/lib/txq.xqm | 4 +- src/graphxq/samples/graphxq.svg | 376 ++++++++++++++++++++++++++++++++ src/graphxq/samples/test.html | 291 +++++++++++++----------- src/graphxq/views/dotform.xml | 5 +- src/graphxq/views/layout.xml | 23 +- src/graphxq/views/widget.svg | 209 ++++++++++++++++++ 8 files changed, 768 insertions(+), 150 deletions(-) create mode 100644 src/graphxq/samples/graphxq.svg create mode 100644 src/graphxq/views/widget.svg diff --git a/src/graphxq.xqm b/src/graphxq.xqm index b08b50d..0415a2c 100644 --- a/src/graphxq.xqm +++ b/src/graphxq.xqm @@ -59,8 +59,10 @@ declare %rest:form-param("src","{$src}") function dotform($src){ let $dot:= getdot("digraph {{a -> b}}",$src) + let $svgwidget:=fn:doc("graphxq/views/widget.svg") let $map:=map{"list-shapes":=dotui:shapes(""), "list-colors":=dotui:colors(""), + "svgwidget":=$svgwidget, "dot":=$dot} return render("graphxq/views/dotform.xml",$map) }; diff --git a/src/graphxq/app.js b/src/graphxq/app.js index debb8d2..87fa416 100644 --- a/src/graphxq/app.js +++ b/src/graphxq/app.js @@ -69,10 +69,12 @@ function getsvg(dl){ var data = oParser.parseFromString(str, "text/xml"); // http://stackoverflow.com/questions/3346106/accessing-a-dom-object-defined-in-an-external-svg-file var n = document.importNode(data.documentElement,true); - $("#svgdiv").empty().append(n); + $("#cuthere").empty().append(n); $("#svgsrc").empty().text(str); - $("#svgdiv svg").svgPan("graph1"); - } + }, + error:function(jqXHR, textStatus, errorThrown){ + console.log("ajax error: "+textStatus + errorThrown); + } }); }; diff --git a/src/graphxq/lib/txq.xqm b/src/graphxq/lib/txq.xqm index b3666c8..f6611b1 100644 --- a/src/graphxq/lib/txq.xqm +++ b/src/graphxq/lib/txq.xqm @@ -1,6 +1,8 @@ (:~ : A(nother) templating Engine for XQuery (BaseX 7.5 specific) -: +: specials: +: partial(file,name,sequence) +: : @author andy bunce : @since sept 2012 :) diff --git a/src/graphxq/samples/graphxq.svg b/src/graphxq/samples/graphxq.svg new file mode 100644 index 0000000..491134b --- /dev/null +++ b/src/graphxq/samples/graphxq.svg @@ -0,0 +1,376 @@ + + + + + + + Generated by graphviz version 2.28.0 (20110507.0412) + + + + + + + + _anonymous_0 + + + + NULL + + NULL + + + + Not_Ready + + Not Ready + + + + NULL->Not_Ready + + + Start + + + + Not_Ready->Not_Ready + + + MH Auto Trade Cancel + + + + Not_Ready->Not_Ready + + + MH Auto Trade Rate Update + + + + Not_Ready->Not_Ready + + + UP Auto Trade Deal Create + + + + Not_Ready->Not_Ready + + + MH Auto Trade Dealing Key Pressed + + + + Not_Ready->Not_Ready + + + UP Auto Trade On Deal Create + + + + Not_Ready->Not_Ready + + + UP Auto Trade Role Deal Create + + + + Not_Ready->Not_Ready + + + MH Auto Trade Rate Failed + + + + Not_Ready->Not_Ready + + + MH Auto Trade Rate Timeout + + + + Trading + + Trading + + + + Not_Ready->Trading + + + MH Auto Trade Rate Update + + + + Not_Ready->Trading + + + MH Auto Trade Rate Update + + + + Not_Ready->Trading + + + UP Auto Trade On Deal Create + + + + Not_Ready->Trading + + + UP Auto Trade On Deal Create + + + + Not_Ready->Trading + + + UP Auto Trade Role Deal Create + + + + Not_Ready->Trading + + + UP Auto Trade Role Deal Create + + + + Deal_Failed + + Deal Failed + + + + Not_Ready->Deal_Failed + + + MH Auto Trade Cancel + + + + Not_Ready->Deal_Failed + + + MH Auto Trade Rate Timeout + + + + Not_Ready->Deal_Failed + + + UP Auto Trade Deal Create + + + + Not_Ready->Deal_Failed + + + UP Auto Trade Deal Create + + + + Not_Ready->Deal_Failed + + + UP Auto Trade Deal Failed + + + + Not_Ready->Deal_Failed + + + UP Auto Trade On Deal Create + + + + Not_Ready->Deal_Failed + + + UP Auto Trade Role Deal Create + + + + Not_Ready->Deal_Failed + + + MH Auto Trade Rate Failed + + + + Trading->Trading + + + MH Auto Trade Rate Update + + + + Trading->Trading + + + MH Auto Trade Rate Update + + + + Trading->Trading + + + MH Auto Trade Rate Update + + + + Trading->Trading + + + MH Auto Trade Refresh + + + + Trading->Trading + + + MH Auto Trade Submit + + + + Trading->Trading + + + MH Auto Trade Update Auto-trader + + + + Trading->Trading + + + UP Auto Trade Deal Updated + + + + Trading->Trading + + + UP Auto Trade Deal Updated + + + + Trading->Trading + + + UP Auto Trade Deal Updated + + + + Trading->Trading + + + UP Auto Trade Deal Updated + + + + Trading->Trading + + + MH Auto Trade Deal Submit Validation Exception + + + + Trading->Trading + + + MH Auto Trade Deal Update Validation Exception + + + + Deal_Submitted + + Deal Submitted + + + + Trading->Deal_Submitted + + + UP Auto Trade Deal Submit Pass + + + + Deal_Completed + + Deal Completed + + + + Trading->Deal_Completed + + + UP Auto Trade Deal Submit + + + + Trading->Deal_Failed + + + MH Auto Trade Cancel + + + + Trading->Deal_Failed + + + UP Auto Trade Deal Failed + + + + Trading->Deal_Failed + + + MH Auto Trade Rate Failed + + + + Deal_Submitted->Deal_Completed + + + UP Auto Trade Deal Complete + + + + Deal_Submitted->Deal_Failed + + + UP Auto Trade Deal Failed + + + + Deal_Submitted->Deal_Failed + + + UP Auto Trade Deal Quote + + + + Deal_Failed->Not_Ready + + + MH Auto Trade Refresh + + + + Deal_Failed->Deal_Failed + + + MH Auto Trade Refresh + + + + Deal_Failed->Deal_Failed + + + MH Auto Trade Refresh + + + \ No newline at end of file diff --git a/src/graphxq/samples/test.html b/src/graphxq/samples/test.html index 156de11..b0cd4a5 100644 --- a/src/graphxq/samples/test.html +++ b/src/graphxq/samples/test.html @@ -7,81 +7,13 @@ - + - @@ -198,26 +221,32 @@ $.ajax({ move - - + scale + - + scale - - - reset + + fit + + + full size - Client X = - Client Y = - User X = - User Y = - pTransX = - pTransY = + Client X= + Client Y= + User X= + User Y= + pTransX= + pTransY= + zoom= + fit= +
hi
\ No newline at end of file diff --git a/src/graphxq/views/dotform.xml b/src/graphxq/views/dotform.xml index cec768d..e8231df 100644 --- a/src/graphxq/views/dotform.xml +++ b/src/graphxq/views/dotform.xml @@ -60,14 +60,13 @@ -
svg here
-
svg here
+
{$svgwidget}
\ No newline at end of file diff --git a/src/graphxq/views/layout.xml b/src/graphxq/views/layout.xml index 5f49028..204a635 100644 --- a/src/graphxq/views/layout.xml +++ b/src/graphxq/views/layout.xml @@ -19,20 +19,19 @@ - - + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + ]]>