Skip to content

Commit d70f4e9

Browse files
DRY pixelToData
1 parent 759d37b commit d70f4e9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/shapes/helpers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ exports.getPixelToData = function(gd, axis, isVertical, opt) {
9292
if(axis) {
9393
if(opt === 'domain') {
9494
pixelToData = function(p) {
95-
var q = p - axis._offset;
95+
var q = (p - axis._offset) / axis._length;
9696
return ((isVertical ?
97-
(1 - q / axis._length) :
98-
q / axis._length));
97+
(1 - q) :
98+
q));
9999
};
100100
} else {
101101
var r2d = exports.rangeToShapePosition(axis);

0 commit comments

Comments
 (0)