chart-unit
chart-unit copied to clipboard
Please add a class attribute to rect options so that the svg rects can be modified by css
It currently only supports single colors, with css I can add gradients.
My current work around is by giving a unique value to opacity and use that as a css selector eg:
<style>
g[fill-opacity="3.14159265359"]{
fill:url(#Gradient2);
fill-opacity: 1;
}
</style>
</head>
<body>
<svg style="background: linear-gradient(to right, red, yellow)" xmlns="http://www.w3.org/2000/svg" height="400.0000" stroke-opacity="1" viewBox="0 0 600 400" font-size="1" width="600.0000" xmlns:xlink="http://www.w3.org/1999/xlink" stroke="rgb(0,0,0)" version="1.1">
<linearGradient id="Gradient2" x1="0" x2="0" y1="1" y2="0">
<stop offset="0%" stop-color="#f4788c"/>
<stop offset="100%" stop-color="#84d0a1"/>
</linearGradient>
<defs>
</defs>
<g stroke-linejoin="miter" stroke-opacity="1.0" fill-opacity="3.14159265359" stroke="rgb(102,102,102)" stroke-width="0.8604638074350364" fill="rgb(255,0,0)" stroke-linecap="butt" stroke-miterlimit="10.0">
<path d="M 506.1335,295.4328 l -0.0000,-21.5734 h -33.6545 l -0.0000,21.5734 Z"/>
</g>
Although abusing opacity will work, I'd rather be spec compliant. Also the generated code would be nicer with proper names rather than numbers.
Sounds good - might be very easy or very hard. Just making notes:
https://hackage.haskell.org/package/diagrams-svg-1.4.1/changelog
svgClass was deprecated in 1.4. I don't know why.
https://hackage.haskell.org/package/diagrams-svg-1.3.1.10/docs/Diagrams-Backend-SVG-Attributes.html
https://stackoverflow.com/questions/30925400/setting-id-and-class-with-the-haskell-diagrams-package?rq=1
https://groups.google.com/forum/#!topic/diagrams-discuss/VOTjjDGQ-tg
Ok, so it's hard and will take some time. But it's an awesome feature and I'm going to give it a go.