8000 Fix rangebreaks overlapping and tick positions by archmoj · Pull Request #4831 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Fix rangebreaks overlapping and tick positions #4831

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 22 commits into from
Jun 3, 2020
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c28d0e5
centralize & refactor range expansions
archmoj Apr 6, 2020
1e63bfc
add rangebreaks tests with hourly and auto dticks
archmoj May 13, 2020
3baed24
revise tick positioning - fix dtick hourly - move tick0 outside the b…
archmoj May 13, 2020
4eab137
drop endpoint ticks that fall inside breaks
archmoj May 14, 2020
a7633c3
move last tick on rangebreaks to the start of break instead of removi…
archmoj May 15, 2020
d2d8e6e
revisit ticks on axes with rangebreaks
archmoj May 19, 2020
ca193eb
reject last tick that may include decimals
archmoj May 19, 2020
6b77b31
refactor - no need for else ifs in axes tickIncrement
archmoj May 19, 2020
ef14d60
add jasmine tests for axes with rangebreaks and set dtick
archmoj May 19, 2020
a0d4d0d
improve auto ticks on axes with rangebreaks
archmoj May 20, 2020
0fb92d4
attempt improving ticks on rangebreaks
archmoj Jun 1, 2020
5c8055b
fix issue 4879
archmoj Jun 1, 2020
0a782d8
invert if statement
archmoj Jun 2, 2020
6cd55b5
drop extra function for hour rangebreaks
archmoj Jun 2, 2020
db7d47d
drop extra logic for dayRatio
archmoj Jun 2, 2020
8c8c928
drop extra logic for dynamic oneDay
archmoj Jun 2, 2020
21f4284
drop extra logic for startHour
archmoj Jun 2, 2020
9e7b80e
drop extra logic for dayHours
archmoj Jun 2, 2020
22e5658
avoid too tick overlaps on x axes with rangebreaks and now only when …
archmoj Jun 2, 2020
b38688d
reverse loop order
archmoj Jun 2, 2020
c5cf45a
fixups to avoid single tick
archmoj Jun 2, 2020
9241578
reduce roughDTick by total length of breaks
archmoj Jun 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
drop extra function for hour rangebreaks
  • Loading branch information
archmoj committed Jun 2, 2020
commit 6cd55b52296f2cab8ae19fad656fa4cff99ce206
24 changes: 1 addition & 23 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,25 +739,6 @@ function arrayTicks(ax) {
return ticksOut;
}

function roundBaseDay(dayHours) {
switch(dayHours) {
case 4: return [1, 2];
case 6: return [1, 2, 3];
case 8: return [1, 2, 4];
case 9: return [1, 3];
case 10: return [1, 2, 5];
case 12: return [1, 2, 3, 4, 6];
case 14: return [1, 2, 7];
case 15: return [1, 3, 5];
case 16: return [1, 2, 4, 8];
case 18: return [1, 2, 3, 6, 9];
case 20: return [1, 2, 4, 5, 10];
case 21: return [1, 3, 7];
case 22: return [1, 2, 11];
}
return [1];
}

var roundBase10 = [2, 5, 10];
var roundBase24 = [1, 2, 3, 6, 12];
var roundBase60 = [1, 2, 5, 10, 15, 30];
Expand Down Expand Up @@ -827,10 +808,7 @@ axes.autoTicks = function(ax, roughDTick) {
// 2 or 3 d 5911 ays... but that's a weird enough case that we'll ignore it.
ax.tick0 = Lib.dateTick0(ax.calendar, true);
} else if(roughX2 > ONEHOUR) {
ax.dtick = roundDTick(roughDTick, ONEHOUR, ax._hasHourBreaks ?
roundBaseDay(ax._dayHours) :
roundBase24
);
ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24);
} else if(roughX2 > ONEMIN) {
ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60);
} else if(roughX2 > ONESEC) {
Expand Down
0