How to render DotML

后端 未结 1 736
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-23 09:20

How do I render DotML into a chart? According to the website here:

Getting graphs from your data is a three-step process. First, generate or manually type

相关标签:
1条回答
  • 2021-01-23 09:48

    DotML is an alternative XML-based syntax for the dot language used to drive the GraphViz program. The normal way of using it is to convert the DotML to dot, and then run GraphViz to generate SVG. The way I do it (from Ant) is here:

      <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>
    

    My case is a bit different because I'm starting with a document that contains multiple diagrams in an XML vocabulary that first needs to be transformed to DotML.

    0 讨论(0)
提交回复
热议问题