Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions draftlogs/7877_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix missing last period label when using a negative `ticklabelindex` in a chart where the last major tick is not visible [[#7877](https://github.com/plotly/plotly.js/pull/7877)]
- Fix incorrect period label positioning when using `ticklabelindex` in a chart where not enough minor ticks are visible [[#7877](https://github.com/plotly/plotly.js/pull/7877)]
421 changes: 234 additions & 187 deletions src/plots/cartesian/axes.js

Large diffs are not rendered by default.

Binary file modified test/image/baselines/date_axes_period2_ticklabelindex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/date_axes_period_ticklabelindex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/image/baselines/ticklabelindex-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/ticklabelindex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/image/mocks/date_axes_period2_ticklabelindex.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"layout": {
"showlegend": false,
"width": 600,
"height": 500,
"height": 740,
"yaxis": {
"domain": [0, 0.04]
},
Expand Down
68 changes: 68 additions & 0 deletions test/image/mocks/ticklabelindex-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"data": [
{
"x": [
"2020", "2021", "2022"
],
"y": [
3, 2, 1
]
},
{
"mode": "markers+text",
"texttemplate": "%{x|Q%q %y}",
"textposition": "top center",
"x": [
"2019-07-01", "2019-10-01", "2020-01-01", "2020-04-01", "2020-07-01"
],
"y": [
2, 2, 2, 2, 2
],
"yaxis": "y2",
"xaxis": "x2"
}
],
"layout": {
"width": 600,
"height": 800,
"grid": {
"rows": 2,
"columns": 1,
"pattern": "independent"
},
"xaxis": {
"dtick": "M12",
"insiderange": [
"2020-03-27",
"2022-07-21"
],
"tickformat": "%Y",
"ticklabelindex": -1,
"ticks": "outside",
"ticklen": 20,
"ticklabelmode": "period",
"type": "date",
"title": {
"text": "Should display 2 major ticks and labels 2020, 2021, 2022"
}
},
"xaxis2": {
"dtick": "M24",
"insiderange": [
"2019-03-01",
"2021-01-01"
],
"tick0": "2021-01-01",
"tickformat": "%Y",
"ticklabelindex": -1,
"ticklabelmode": "period",
"ticklen": 20,
"type": "date",
"ticks": "outside",
"minor": { "dtick": "M12", "ticks": "outside", "ticklen": 5 },
"title": {
"text": "Should display 1 major tick, 1 minor tick and a label 2020 in between."
}
}
}
}
6 changes: 4 additions & 2 deletions test/jasmine/tests/titles_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1288,8 +1288,10 @@ describe('Editable titles', function() {

var textNode = document.querySelector('.' + className);
textNode.dispatchEvent(new window.MouseEvent('click'));

var editNode = document.querySelector('.plugin-editable.editable');
// make sure to select the editNode created by the click, not some leftover
// from the previous call (the blur event removes it asynchronously.)
var editNodes = document.querySelectorAll('.plugin-editable.editable');
var editNode = editNodes[editNodes.length - 1];
editNode.dispatchEvent(new window.FocusEvent('focus'));
editNode.textContent = text;
editNode.dispatchEvent(new window.FocusEvent('focus'));
Expand Down
Loading