2013-02-13 64 views
1

如何渲染DotML到圖表中?根據網站here如何渲染DotML

從您的數據獲取圖形是一個三步過程。首先,生成或手動輸入包含DotML元素的> XHTML(或任何其他XML)文件。

使用「http://www.martin-loetzsch.de/DOTML」作爲DotML元素的名稱空間標識符。 >如果您想驗證您的DotML元素,請使用DotML架構。

其次,在輸入文件上應用腳本「generate-svg-graphics.bash」。它應用> dotml2dot.xsl樣式表,併爲每個DotML圖形元素生成一個SVG圖表和一個包含> SVG圖表大小的CSS文件。請查看「generate-svg-> graphics.bash」以瞭解所需的環境變量和參數。第三,如果將DotML圖嵌入到XHTML文檔中,則XSLT樣式表「embed-> svg-graphics.xsl」將包含生成的SVG替換爲DotML圖元素。有關詳細信息,請查看「embed-svg-graphics.xsl」。

我已經鍵入了XML,但我不知道剩下的步驟是什麼意思。如果任何人都可以解釋如何在非常簡單的層面上做到這一點,那將是非常棒的。

回答

1

DotML是用於驅動GraphViz程序的點語言的替代XML語法。使用它的正常方法是將DotML轉換爲點,然後運行GraphViz以生成SVG。我做的方式(從螞蟻)是在這裏:

<target name="dot-files" depends="merge-catalog" if="build.spec" unless="spec.exists"> 
    <xslt in="${merged-spec.xml}" out="${dist.dir}/Overview.html" style="style/xslt-diff.xsl" 
     force="yes" classpathref="saxon9.classpath"> 
     <factory name="net.sf.saxon.TransformerFactoryImpl"> 
     <attribute name="http://saxon.sf.net/feature/initialMode" value="make-dot-files"/> 
     </factory> 
     <param name="baseline" expression="${baseline}"/> 
     <param name="show.diff.markup.string" expression="0"/> 
    </xslt>  
    </target> 

    <target name="diagrams" description="Process all the diagrams in the img directory" 
    depends="dot-files"> 
    <foreach target="diagram" param="diagram"> 
     <path> 
     <fileset dir="${dist.dir}/img"> 
      <include name="*.dot"/> 
     </fileset> 
     </path> 
    </foreach> 
    </target> 

    <target name="diagram"> 
    <echo message="Converting diagram ${diagram}"/> 
    <basename property="name" file="${diagram}" suffix=".dot"/> 
    <echo message=" to ${dist.dir}/img/${name}.svg"/> 
    <!-- Requires "dot" to be on the path. dot is part of GraphViz. Location might be GraphViz2.24/bin/dot--> 
    <exec executable="dot"> 
     <arg line="-o${dist.dir}/img/${name}.raw.svg -Tsvg ${diagram} "/> 
    </exec> 

    <xslt in="${dist.dir}/img/${name}.raw.svg" out="${dist.dir}/img/${name}.svg" style="style/tidy-graphviz-svg.xsl" 
     force="yes" classpathref="saxon9.classpath"/> 
    </target> 

我的情況有點不同,因爲我開始與包含在首先需要轉化爲DotML的XML詞彙多個圖表的文檔。

+0

謝謝,我現在得看看這個。有沒有辦法在C#中以編程方式執行此操作? – Atrus 2013-02-14 18:22:08

+0

不知道,對不起(當然,作爲最後的手段,你可以通過exec調用...) – 2013-02-14 21:42:34