我一直在尋找各種方式來生成web應用程序中的圖形,並發現HighCharts特別有用。該應用需要迎合色盲,所以我正在使用圖案而不是填充顏色 - 如in this question所述。使用填充圖案而不是顏色與HighCharts
像這樣的東西必須在SVG的<defs>
部分:
<pattern id="triangles" width="10" height="10" patternUnits="userSpaceOnUse">
<polygon points="5,0 10,10 0,10"/>
</pattern>
<pattern id="diagonal-hatch" patternUnits="userSpaceOnUse" width="4" height="4">
<path d="M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2"/>
</pattern>
<pattern id="cross-hatch" patternUnits="userSpaceOnUse" x="0" y="0" width="6" height="6">
<g style="fill:none; stroke:#22fa23; stroke-width:1">
<path d="M0,0 l10,10"/>
<path d="M10,0 l-10,10"/>
</g>
</pattern>
,然後代替fill="#0d233a"
我不得不fill="url(#triangles)"
有沒有其他人有HighCharts這樣做呢?是否有可能讓HighCharts在不破解它的情況下做到這一點?
你試過了嗎?這似乎是正常的SVG,它應該工作 – raam86