Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add switch to specify major/minor in axes.arrayTicks() #6829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 4, 2024
Prev Previous commit
Add legacy mode to arrayTicks()
  • Loading branch information
ayjayt committed Jan 3, 2024
commit 1051bb7f89bfad160238e9f9ca43614d69cf7900
12 changes: 5 additions & 7 deletions 12 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.