示例工程 13-images

13-images/demo-01-alt/assets/chart.svg

xml · 1.1 KB

运行:替代文本演示

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

<svg xmlns="http://www.w3.org/2000/svg" width="640" height="360" viewBox="0 0 640 360" role="img" aria-label="四个季度访问量柱状图">
  <rect width="640" height="360" fill="#ffffff"/>
  <line x1="70" y1="300" x2="600" y2="300" stroke="#cbd5e1" stroke-width="2"/>
  <rect x="100" y="190" width="90" height="110" fill="#93c5fd"/>
  <rect x="230" y="140" width="90" height="160" fill="#60a5fa"/>
  <rect x="360" y="90" width="90" height="210" fill="#3b82f6"/>
  <rect x="490" y="50" width="90" height="250" fill="#2563eb"/>
  <text x="145" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q1</text>
  <text x="275" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q2</text>
  <text x="405" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q3</text>
  <text x="535" y="330" font-family="system-ui, sans-serif" font-size="18" fill="#475569" text-anchor="middle">Q4</text>
  <text x="70" y="40" font-family="system-ui, sans-serif" font-size="20" fill="#0f172a">访问量(千次)</text>
</svg>