Skip to content

Commit fced9ce

Browse files
committed
Add log math to tickmode proportional
1 parent 931199e commit fced9ce

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/plots/cartesian/axes.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -953,15 +953,18 @@ axes.calcTicks = function calcTicks(ax, opts) {
953953
// Mapping proportions to array:
954954
var valsProp, fractionalVals;
955955
var width = maxRange - minRange;
956+
console.log("minRange = " + minRange + " maxRange = " + maxRange)
956957
var offset = !axrev ? minRange : maxRange;
957958
if (axrev) width *= -1;
958959
if (mockAx.tickmode === 'proportional') {
959960
valsProp = major ? Lib.nestedProperty(ax, "tickvals") : Lib.nestedProperty(ax.minor, "tickvals");
960961
fractionalVals = valsProp.get();
961-
962-
var mappedVals = Lib.simpleMap(fractionalVals, function(fraction, offset, width) {
963-
return offset + (width*fraction);
964-
}, offset, width);
962+
var mappedVals = Lib.simpleMap(fractionalVals, function(fraction, offset, width, type) {
963+
var mapped = offset + (width*fraction);
964+
console.log(mapped)
965+
console.log(type)
966+
return (type === "log") ? Math.pow(10, mapped) : mapped
967+
}, offset, width, type);
965968
valsProp.set(mappedVals);
966969
}
967970

0 commit comments

Comments
 (0)