1
をグラフ化する:どのように私はこの1つのようなグラフをプログラムしようとしている政治的な座標グラフ
私はSVGでみましたが、私は2つの異なる長方形を使用していたので、それは非常に良いではないですし、 4つのエッジだけを丸くすることはできませんでした。ここで
は私のコードです:
<svg width="400" height="250">
<defs>
<linearGradient id="solids" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
<stop offset="50%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
<stop offset="50%" style="stop-color:rgb(0,255,0);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(0,255,0);stop-opacity:1" />
</linearGradient>
<linearGradient id="solids2" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
<stop offset="50%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
<stop offset="50%" style="stop-color:rgb(0,0,255);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1" />
</linearGradient>
</defs>
<text x="135" y="12" style="fill:black;">Conservadorismo
<tspan x="150" y="240">Liberalismo</tspan>
<tspan x="20" y="125">Esquerda</tspan>
<tspan x="305" y="125">Direita</tspan>
</text>
<rect x="100" y="20" rx="20" ry="20" width="200" height="100" style="fill:url(#solids); opacity:0.76" />
<rect x="100" y="120" rx="20" ry="20" width="200" height="100" style="fill:url(#solids2); opacity:0.76" />
<line x1="100" y1="120" x2="300" y2="120" style="stroke:black;stroke-width:2" />
<line x1="200" y1="20" x2="200" y2="220" style="stroke:black;stroke-width:2" />
</svg>
は、私はそれを修正するために何をすべきか、より良いそれを行いますか?
あなたはどのように「ビューボックス」と「クリップ経路」仕事してください私に説明してもらえますか? –
['viewBox'](https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute)は、長方形のSVGビューポートにマッピングされるSVG座標の領域と、[' clipPath'] (https://www.w3.org/TR/SVG/masking.html#EstablishingANewClippingPath)は、下にあるオブジェクトのどの部分が表示されるかを定義します。この例では、クリップパスは丸められた矩形であり、色付きの四角形を含む ''要素に適用することで、外側の角をカットする効果があります。同じ ' '要素の中にグリッド線を追加することをお勧めします。 –