Test 三角形: Difference between revisions

From 清冽之泉
Jump to navigation Jump to search
No edit summary
Tag: Reverted
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!-- 方法1:SVG 版本(推荐) -->
<graphviz>
<div style="width:300px;">
digraph {
<svg viewBox="0 0 300 260" xmlns="http://www.w3.org/2000/svg" aria-label="三层三角形">
    rankdir=TB
  <!-- 三角形主体(浅蓝) -->
    splines=false
  <polygon points="150,0 0,260 300,260" fill="#E6F4FF" stroke="#BEE6FF" stroke-width="1"/>
   
  <!-- 分割线(两条) -->
    // 底层大三角形
   <line x1="100" y1="86.6667" x2="200" y2="86.6667" stroke="#FFFFFF" stroke-width="2" />
    底层 [
  <line x1="50" y1="173.3333" x2="250" y2="173.3333" stroke="#FFFFFF" stroke-width="2" />
        shape=invtriangle
  <!-- 层标签 A B C(居中) -->
        style=filled
  <text x="150" y="43.333" text-anchor="middle" dominant-baseline="middle" font-size="20" font-family="sans-serif" fill="#0b3b57">A</text>
        fillcolor=green
  <text x="150" y="130"   text-anchor="middle" dominant-baseline="middle" font-size="20" font-family="sans-serif" fill="#0b3b57">B</text>
        label="无罪"
  <text x="150" y="216.666" text-anchor="middle" dominant-baseline="middle" font-size="20" font-family="sans-serif" fill="#0b3b57">C</text>
        width=3
</svg>
        height=2
</div>
    ]
   
    // 中层三角形
    中层 [
        shape=invtriangle
        style=filled
        fillcolor=yellow
        label="轻罪"
        width=2
        height=1.3
    ]
   
    // 顶层三角形
    顶层 [
        shape=invtriangle
        style=filled
        fillcolor=red
        label="重罪"
        width=1
        height=0.7
    ]
   
    // 排列层级
    {rank=same; 底层 中层 顶层}
   
    // 不可见连接确保正确重叠
    底层 -> 中层 -> 顶层 [style=invis]
}
</graphviz>
 
 
 
<graphviz>
digraph {
    rankdir=TB
    nodesep=0.05
   
    node [style=filled]
    重罪 [shape=triangle, fillcolor=red, label="重罪", width=0.8]
    轻罪 [shape=trapezium, fillcolor=yellow, label="轻罪", width=1.6]
    无罪 [shape=trapezium, fillcolor=green, label="无罪", width=2.4]
   
    重罪 -> 轻罪 -> 无罪 [style=invis]
}
</graphviz>
 
 
<graphviz>
digraph pyramid {
    graph [splines=false, nodesep=0, ranksep=0]
    node [style=filled, fixedsize=true, fontcolor=black]
 
    重罪 [shape=triangle,   fillcolor=red,  width=1.2, height=0.6, label="重罪", pos="1,3!"]
    轻罪 [shape=trapezium, fillcolor=yellow, width=2.0, height=0.6, label="轻罪", pos="1,2!"]
    无罪 [shape=trapezium, fillcolor=green, width=3.0, height=0.6, label="无罪", pos="1,1!"]
 
}
</graphviz>
 
 
<graphviz>
digraph pyramid {
    node [shape=plaintext]
 
    pyramid [
      label=<
        <TABLE BORDER="1" CELLBORDER="0" CELLSPACING="0">
          <TR><TD BGCOLOR="red"   FIXEDSIZE="TRUE" WIDTH="100" HEIGHT="30">重罪</TD></TR>
          <TR><TD BGCOLOR="yellow" FIXEDSIZE="TRUE" WIDTH="160" HEIGHT="30">轻罪</TD></TR>
          <TR><TD BGCOLOR="green" FIXEDSIZE="TRUE" WIDTH="220" HEIGHT="30">无罪</TD></TR>
        </TABLE>
      >
    ];
}
</graphviz>

Latest revision as of 15:55, 23 September 2025