Skip to content

Commit

Permalink
Add legacy mode to arrayTicks()
Browse files Browse the repository at this point in the history
  • Loading branch information
ayjayt committed Jan 3, 2024
1 parent cd3b261 commit 1051bb7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,10 +949,10 @@ axes.calcTicks = function calcTicks(ax, opts) {
if(mockAx.tickmode === 'array') {
if(major) {
tickVals = [];
ticksOut = arrayTicks(ax, major);
ticksOut = arrayTicks(ax, !isMinor);
} else {
minorTickVals = [];
minorTicks = arrayTicks(ax, false);
minorTicks = arrayTicks(ax, !isMinor);
}
continue;
}
Expand Down Expand Up @@ -1261,8 +1261,7 @@ function syncTicks(ax) {
return ticksOut;
}

function arrayTicks(ax, major) {
if(major === undefined) throw new Error('arrayTicks must specify ticktype');
function arrayTicks(ax, majorOnly) {
var rng = Lib.simpleMap(ax.range, ax.r2l);
var exRng = expandRange(rng);
var tickMin = Math.min(exRng[0], exRng[1]);
Expand All @@ -1280,11 +1279,10 @@ function arrayTicks(ax, major) {

var ticksOut = [];
for(var isMinor = 0; isMinor <= 1; isMinor++) {
if(!isMinor && !major) continue;
if(isMinor && (!ax.minor || major)) continue;
if((majorOnly !== undefined) && ((majorOnly && isMinor) || (majorOnly === false && !isMinor))) continue;
if(isMinor && !ax.minor) continue;
var vals = !isMinor ? ax.tickvals : ax.minor.tickvals;
var text = !isMinor ? ax.ticktext : [];

if(!vals) continue;


Expand Down

0 comments on commit 1051bb7

Please sign in to comment.