orca icon indicating copy to clipboard operation
orca copied to clipboard

Possible to have deterministic clipPath ids?

Open cpsievert opened this issue 7 years ago • 3 comments

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?

cpsievert avatar Sep 24 '18 14:09 cpsievert

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.

etpinard avatar Sep 26 '18 14:09 etpinard

Tagging as type: feature here, but this would of course required some plotly.js work as well.

etpinard avatar Dec 28 '18 19:12 etpinard

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.

antoinerg avatar May 10 '19 17:05 antoinerg