Skip to content

Commit 8743766

Browse files
committed
Make tickmode proportional calculate reversed axes
1 parent 6d48a3b commit 8743766

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/plots/cartesian/axes.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -951,17 +951,17 @@ axes.calcTicks = function calcTicks(ax, opts) {
951951
if (mockAx.tickmode === 'array' || mockAx.tickmode === 'proportional') {
952952

953953
// Mapping proportions to array:
954-
var valsProp
955-
var proportionalVals
956-
var mappedVals
954+
var valsProp, proportionalVals, mappedVals;
957955
var distance = maxRange - minRange;
956+
if (axrev) distance *= -1;
958957
if (mockAx.tickmode === 'proportional') {
959958
valsProp = major ? Lib.nestedProperty(ax, "tickvals") : Lib.nestedProperty(ax.minor, "tickvals")
960959
proportionalVals = valsProp.get()
961-
mappedVals = proportionalVals.map(function(v) { return minRange+(distance*v) })
960+
mappedVals = proportionalVals.map(function(v) { return maxRange + (distance*v) })
962961
valsProp.set(mappedVals)
963962
}
964-
// Original
963+
964+
// Original 'array' only code
965965
if(major) {
966966
tickVals = [];
967967
ticksOut = arrayTicks(ax);

0 commit comments

Comments
 (0)