I am going to start learning the d3 and I have only a v4 tutorial available, so I am wondering if I will be able to use my learnings of v4 in v5 or it is vastly different.
D3 uses the semantic versioning convention. Therefore, for a given D3 version, like 5.15.1
for instance, you have three numbers: the first one is the major version, the second one is the minor version and the last one is the patch version. Still according to semver.org, one has to increment...
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards compatible manner, and
PATCH version when you make backwards compatible bug fixes.
Thus, we don't count only the number of changes for determining if a given code will work in a given version. For instance, D3 v5.8 introduced way more new features (compared to D3 v5.7) than v5 did compared to v4. Code written for D3 v5.8 may break when referencing D3 v5.7. So, why wasn't D3 v5.8 considered a new major version? Because all code written for D3 v5.7 or earlier will work referencing D3 v5.8. All those D3 v5.8 changes happened in a "backwards compatible manner".
The same cannot be said when comparing D3 v4 with v5: some code will break (but not all, more on that below). These are the main methods/mini-libraries (and properties) that won't work:
d3.csv
, d3.json
, d3.tsv
etc...)d3.queue
d3.schemeCategory20
etc...If your D3 v4 code doesn't use any of those, you can use it referencing D3 v5.