Skip to content

Commit 00e884a

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

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: src/plots/cartesian/axes.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -951,17 +951,18 @@ 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+
var start = !axrev ? minRange : maxRange
957+
if (axrev) distance *= -1;
958958
if (mockAx.tickmode === 'proportional') {
959959
valsProp = major ? Lib.nestedProperty(ax, "tickvals") : Lib.nestedProperty(ax.minor, "tickvals")
960960
proportionalVals = valsProp.get()
961-
mappedVals = proportionalVals.map(function(v) { return minRange+(distance*v) })
961+
mappedVals = proportionalVals.map(function(v) { return start + (distance*v) })
962962
valsProp.set(mappedVals)
963963
}
964-
// Original
964+
965+
// Original 'array' only code
965966
if(major) {
966967
tickVals = [];
967968
ticksOut = arrayTicks(ax);

0 commit comments

Comments
 (0)