Open cpsievert opened 6 years ago
It would be possible. Sounds like a solid idea.
Off the top of my head, clip-path ids use either fullLayout._uid
and/or fullData[i].uid
to make them "unique" on the page.
fullData[i].uid
can be optionally set by users calling Plotly.newPlot
. In turn, fullLayout._uid
is only generated internally. So perhaps, we could add layout.uid
attribute that would be honored as fullLayout._uid
downstream.
Tagging as type: feature
here, but this would of course required some plotly.js work as well.
This feature could be really useful to simplify testing the correctness of SVGs. In PR https://github.com/plotly/orca/pull/222, we have to resort to rendering SVGs to images in order to compare them to our baselines. This rendering step could possibly be skipped altogether.
I'm working on a new visual testing framework for the plotly R package and I'm hoping to use at svg diffs via orca (if that seems like a bad idea in general, please let me know).
It looks as though the
id
property of<clipPath />
is semi-random -- would it be possible to add an argument to make this (and possibly other) svg properties be deterministic?If not, would you see any problem with removing the id property before performing the diff?