Kozea / pygal

PYthon svg GrAph plotting Library
https://www.pygal.org
GNU Lesser General Public License v3.0
2.62k stars 411 forks source link

When embedding SVGs duplicate IDs trip up the html validator #563

Open rhpvorderman opened 2 months ago

rhpvorderman commented 2 months ago

First of all, thanks for making PyGAL. I love it. It is by far the best plotting library for python. Rendering plain SVG is supercool. It allows embedding directly in the HTML. That in turn allows loading the javascript only once by also embedding it in the HTML and turning the JS property for all the figures off.

Embedding does come with the disadvantage of tripping up the HTML5 validator, as IDs will be duplicated.

I can write a PR to fix this, giving each sery an unique ID. Are there objections to this?

"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":233.658917-233.658980: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":256.78106-256.78169: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":256.78283-256.78346: error: Duplicate ID "activate-serie-1".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":256.78461-256.78524: error: Duplicate ID "activate-serie-2".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":256.78637-256.78700: error: Duplicate ID "activate-serie-3".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":256.78818-256.78881: error: Duplicate ID "activate-serie-4".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":345.24677-345.24740: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":363.227548-363.227611: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":363.227720-363.227783: error: Duplicate ID "activate-serie-1".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":363.227893-363.227956: error: Duplicate ID "activate-serie-2".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":363.228066-363.228129: error: Duplicate ID "activate-serie-3".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":381.68155-381.68218: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":408.49143-408.49206: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":420.299314-420.299377: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":452.164928-452.164991: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":452.165125-452.165188: error: Duplicate ID "activate-serie-1".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":452.165302-452.165365: error: Duplicate ID "activate-serie-2".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":480.22390-480.22453: error: Duplicate ID "activate-serie-0".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":480.22580-480.22643: error: Duplicate ID "activate-serie-1".
"file:/home/rhpvorderman/PycharmProjects/sequali/5millionreads_R1.fastq.html":543.17559-543.17622: error: Duplicate ID "activate-serie-0".
gentooboontoo commented 2 months ago

First of all, thanks for making PyGAL. I love it. It is by far the best plotting library for python.

Thank you on behalf of all the contributors thus far.

I can write a PR to fix this, giving each sery an unique ID. Are there objections to this?

It would be great to have a PR fixing the problem in this context.