示例工程 14-figure-picture

14-figure-picture/app/assets/chart.svg

xml · 0.9 KB

运行:figure 与 picture · 图注与响应式图片

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

<svg xmlns="http://www.w3.org/2000/svg" width="640" height="360" viewBox="0 0 640 360">
  <rect width="640" height="360" fill="#ffffff"/>
  <line x1="70" y1="300" x2="600" y2="300" stroke="#cbd5e1" stroke-width="2"/>
  <rect x="110" y="200" width="80" height="100" fill="#93c5fd"/>
  <rect x="240" y="150" width="80" height="150" fill="#60a5fa"/>
  <rect x="370" y="95" width="80" height="205" fill="#3b82f6"/>
  <rect x="500" y="55" width="80" height="245" fill="#2563eb"/>
  <text x="150" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q1</text>
  <text x="280" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q2</text>
  <text x="410" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q3</text>
  <text x="540" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q4</text>
</svg>