Update SVG output to play nice with SVG optimizers?
See original GitHub issueSorry for a vague subject, but I am just not too intimately familiar with vega
and just use it in one context only.
As you can see the graph is blank.
Inspecting the SVG markup the columns are still there, they are just not painted and thus blend in with the background.
Script that generates the graph: https://github.com/moltar/typescript-runtime-type-benchmarks/blob/master/graph.ts
Generated SVG Diff: https://github.com/moltar/typescript-runtime-type-benchmarks/commit/09db33972f1f6e1f87d1db4a72b5c9e4cd88ee08#diff-a9316fd460d64045bb8190f11727bcd9
Any ideas?
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Tools for Optimizing SVG | CSS-Tricks
This is our straight-to-the-point list of SVG optimizing tools across a number of categories. They are all largely based around SVGO, ...
Read more >8 tricks for SVG optimization - UX Collective
Here are some tricks that can save us time when manipulating SVG code on our projects. ... be productive, and think more critically...
Read more >An Optimized SVG Workflow - YouTube
From SVG optimization to base64 encoding, these methods are designed with performance in mind. If you fine folks know of newer/better ...
Read more >How to create, clean up, and optimize an SVG [ A ... - YouTube
Once we export the SVG our work isn't done though, we still need to do a bit of cleanup of the file, and...
Read more >How to optimize and reduce the file size of SVG images
For instance, Illustrator automatically adds export notes to SVGs that ... I find this easier than doing this work by hand or choosing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jheer wow Jeff, this is a huge fix. Thank you!
It looks like your SVG file is not the SVG exported by Vega, but a modified version run through an SVG optimizer (I see SVGO being used in your script). It looks like SVGO is stripping out the fill color from text marks. Apparently it is assuming that since black is normally the default fill color it is safe to remove, but in this case that is not true due to conflicts with the internal stylesheet. For the bar marks, it looks like it is moving the fill color to the parent group element, but the path elements for the bars no longer inherit this value, again due to the stylesheet.
We can consider modifying the internal stylesheet further to help avoid issues like this. Nevertheless this looks like a possible bug in the optimizer, as it appears to be oblivious to the existence of an internal stylesheet.