Description
In cartesian/axes.js
: calcTicks()
we open a loop:
plotly.js/src/plots/cartesian/axes.js
Lines 927 to 929 in 8bf6d89
Where we eventually grab ticks using tickArray()
:
plotly.js/src/plots/cartesian/axes.js
Lines 947 to 958 in 8bf6d89
The problem is that arrayTicks(ax)
always returns major AND minor ticks- So minorTicks
and ticksOut
will both contain all ticks. This is not the case were tickmode
to be any other setting!
After we acquire the ticks, several hundred lines are dedicated to doing properties and checks dependent on whether we're major or minor- relevant lines concern setting major/minor ID and adjusting dates. This is where possible visual errors could be found, in these edge cases.
At the end, we concatenate minorTicks
onto ticksOut
right before return:
plotly.js/src/plots/cartesian/axes.js
Lines 1206 to 1208 in 8bf6d89
So we contain two sets of major ticks, two sets of minor ticks, each set the same. You can console.log()
it to see.
This doesn't always propogate to the DOM: Since draw functions have to account for axes referring to the same items, they create a set stashed = {}
and ensure not to redraw the same item twice. This would catch most errors.
I wanted to produce visual effects on edge cases, but date setting with arrays seems to be entirely wonky:
graph = Tabs.getGraph(); var update = {
title: 'Mock: date_axes_period_breaks_automargin!',
'xaxis.tickmode': 'array',
'xaxis.tickvals': ["2015-4", "2015-5", "2015-6", "2015-7", "2015-8", "2015-9", "2015-10", "2015-11", "2015-12", "2016-1", "2016-2", "2016-3", "2016-4", "2016-5", "2016-6", "2016-7", "2016-8", "2016-9", "2016-10", "2016-11", "2016-12", "2017-1"],
'xaxis.gridwidth': '2',
'xaxis.ticklabelmode': "period",
};
Plotly.relayout(graph, update)
Pull request incoming.