2013-02-13 73 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