Closed stockiNail closed 2 years ago
I think a new helper would be good (to resolve the code smell too):
const parse = Chart.version
? (scale, value) => scale.parse(value)
: (scale, value) => value;
function scaleValue(scale, value) {
const normValue = isNumber(value) ? parseFloat(value) : parse(scale, value);
return scale.getPixelForValue(normValue);
}
I think a new helper would be good (to resolve the code smell too):
I haven't seen your post. I do now.
@kurkle just FYI, including the CHART parts, the check on Chart.version was useless because the plugin finds always the chart version to 3.5.0, the version included. Therefore it never worked with version 2.x of CHART.JS.
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
de facto, this PR is not solving the compatibility with version 2 because it didn't work anyway, but, together with PR #18, it is solved.
FYI, I have tested the master and now it works both 3.x and 2.x !!! :ok_hand: :satisfied:
The PR # 16 introduced a breaking change, removing the support of version CHART.JS 2.x. This PR is fixing it.