Kozea / Kozea/pygal

When embedding SVGs duplicate IDs trip up the html validator

Open
#563 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.8k
Forks
419
PR merge metrics
No merged PRs in 30d

Description

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".
```

Contributor guide

Open the contributing guide

Research direction

Start by locating where PyGAL generates SVG series IDs such as "activate-serie-0" and reproduce the duplicate-ID output when multiple charts are embedded in one HTML document. Done means embedded charts no longer produce duplicate SVG IDs while their series behavior remains intact; validate the resulting HTML against the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, python
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.