Skip to content

Commit 3089c4a

Browse files
committed
Restructure parameterization and fix linting
1 parent ecffc49 commit 3089c4a

File tree

3 files changed

+370
-349
lines changed

3 files changed

+370
-349
lines changed

src/plot_api/plot_api.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,11 +2945,11 @@ function getDiffFlags(oldContainer, newContainer, outerparts, opts) {
29452945
// so newContainer won't have them.
29462946
if((key === 'tick0' || key === 'dtick') && outerparts[0] !== 'geo') {
29472947
var tickMode = newContainer.tickmode;
2948-
if(tickMode === 'auto'
2949-
|| tickMode === 'array'
2950-
|| tickMode === 'domain array'
2951-
|| tickMode === 'full domain'
2952-
|| !tickMode) continue;
2948+
if(tickMode === 'auto' ||
2949+
tickMode === 'array' ||
2950+
tickMode === 'domain array' ||
2951+
tickMode === 'full domain' ||
2952+
!tickMode) continue;
29532953
}
29542954
// FIXME: Similarly for axis ranges for 3D
29552955
// contourcarpet doesn't HAVE zmin/zmax, they're just auto-added. It needs them.

src/plots/cartesian/axes.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,9 @@ axes.prepTicks = function(ax, opts) {
683683
}
684684

685685
if(!(ax.minor &&
686-
(ax.minor.tickmode !== 'array'
687-
&& ax.minor.tickmode !== 'domain array'
688-
&& ax.minor.tickmode !== 'full domain'))) {
686+
(ax.minor.tickmode !== 'array' &&
687+
ax.minor.tickmode !== 'domain array' &&
688+
ax.minor.tickmode !== 'full domain'))) {
689689
// add a couple of extra digits for filling in ticks when we
690690
// have explicit tickvals without tick text
691691
if(ax.tickmode === 'array' || ax.tickmode === 'domain array' || ax.tickmode === 'full domain') nt *= 100;
@@ -952,25 +952,24 @@ axes.calcTicks = function calcTicks(ax, opts) {
952952
axes.prepTicks(mockAx, opts);
953953
}
954954

955-
if(mockAx.tickmode === 'full domain'){
955+
if(mockAx.tickmode === 'full domain') {
956956
var nt = mockAx.nticks; // does mockAx have nitkcs?
957957
if(nt === undefined) nt = 0;
958-
var tickVals = [];
959-
if (nt == 0) {
958+
if(nt === 0) {
960959
// pass
961-
} else if (nt == 1) {
960+
} else if(nt === 1) {
962961
tickVals = [0];
963-
} else if (nt == 2) {
962+
} else if(nt === 2) {
964963
tickVals = [0, 1];
965964
} else {
966-
var increment = 1/(nt-1); // (nt-2) + 1
965+
var increment = 1 / (nt - 1); // (nt-2) + 1
967966
tickVals.push(0);
968-
for (let i = 0; i < nt-2; i++) {
969-
tickVals.push((i+1)*increment);
967+
for(var tickIndex = 0; tickIndex < nt - 2; tickIndex++) {
968+
tickVals.push((tickIndex + 1) * increment);
970969
}
971970
tickVals.push(1);
972971
}
973-
if (major) {
972+
if(major) {
974973
Lib.nestedProperty(ax, 'tickvals').set(tickVals);
975974
} else {
976975
Lib.nestedProperty(ax.minor, 'tickvals').set(tickVals);
@@ -980,7 +979,7 @@ axes.calcTicks = function calcTicks(ax, opts) {
980979
// original comment:
981980
// now that we've figured out the auto values for formatting
982981
// in case we're missing some ticktext, we can break out for array ticks
983-
if(mockAx.tickmode === 'array' || mockAx.tickmode === 'domain array' || mockAx.tickmode === 'full domain' ) {
982+
if(mockAx.tickmode === 'array' || mockAx.tickmode === 'domain array' || mockAx.tickmode === 'full domain') {
984983
// Mapping proportions to array:
985984
if(mockAx.tickmode === 'domain array' || mockAx.tickmode === 'full domain') {
986985
var width = (maxRange - minRange);
@@ -1278,12 +1277,12 @@ axes.calcTicks = function calcTicks(ax, opts) {
12781277
// Reset tickvals back to domain array
12791278
if(tickFractionalVals._isSet) {
12801279
delete tickFractionalVals._isSet;
1281-
if (ax.tickmode === 'full domain') tickFractionalVals = [];
1280+
if(ax.tickmode === 'full domain') tickFractionalVals = [];
12821281
Lib.nestedProperty(ax, 'tickvals').set(tickFractionalVals);
12831282
}
12841283
if(minorTickFractionalVals._isSet) {
12851284
delete tickFractionalVals._isSet;
1286-
if (ax.minor.tickmode === 'full domain') tickFractionalVals = [];
1285+
if(ax.minor.tickmode === 'full domain') tickFractionalVals = [];
12871286
Lib.nestedProperty(ax.minor, 'tickvals').set(minorTickFractionalVals);
12881287
}
12891288

0 commit comments

Comments
 (0)