Skip to content
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

Multicategory axis type #3300

Merged
merged 55 commits into from
Dec 11, 2018
Merged

Multicategory axis type #3300

merged 55 commits into from
Dec 11, 2018

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Nov 30, 2018

(attempts to) resolves #2799 by adding a ✨ new ✨ axis type: 'multicategory' - which displays two (maybe more later) axis labels levels along with "dividers" in-between each category group.

N.B. This branch is up-to-date with the latest master that includes uirevision.


Things to TODO:

  • add support for type: 'multicategory' on y-axes
  • add support to heatmap and contours
  • add support in histogram* traces
  • [ ] add some way to configure ticks/dividers per category level - leave for later
  • improve axis.automargin test coverage, partly done in: 80f4701, more to come in Allow replot during drag interactions #3305
  • test as many edge cases I can think of

Things skipped:

  • ticktext / tickvals are not coerced on type: 'multicategory' axes
  • support for transforms

cc @plotly/plotly_js @nicolaskruchten

- ax._mainLinePosition appears to be always defined for cartesian axes
- so that it can still be relevant for multi-category axes.
- no need to export it on Axes
- return Lib.syncOrAsync result
- this will allow us to use ax._boundingBox
  for multicategory axes
... similar to ax._lw for ax.linewidth.
- compute and use tick-label height to position secondary labels
- disallow 30deg tick label rotation when fixing overlaps
- use ax._boundingBox to position axis title on multicategory
  axes.
- make it return z.length if z is 1D
- make it return 0 when not an array
- mea culpa: no need to keep track of max-row-length for
  multicategory coordinate array, min-row-length suffices.
- make sure calc'ed arrays are sorted properly
- handle null and undefined item correctly
- handle non-2d-array input correctly
- test 2d-array input on non-multicategory axes
- improve secondary-label to axis title padding
- add horizontal violin mock
- lock down annotations in same mock.
@alexcjohnson
Copy link
Collaborator

💃 love it.

@Braintelligence
Copy link

Just to make 100% sure:
Is it somehow possible to combine this with xaxis.type = "date" or linear if you want your datapoint to be between two ticks (divider style) and still keep the advantages of these axis types? (scalability and so on)
As it stands now it seems that showdividers is not compatible with xaxis.type = "date" to me.

@etpinard
Copy link
Contributor Author

As it stands now it seems that showdividers is not compatible with xaxis.type = "date" to me.

That's correct. Dividers are only available for type: 'multicategory' axes.

@LJaschinski
Copy link

Hello, do you know when 'multicategory' type will displays more than two axis ? Is there a work in progress about it ?

@elmadj
Copy link

elmadj commented Jan 18, 2020

Hi is there support for something similar to bargap and bargroupgap with multicategory axes? The goal would be to have a different gaps between bars of an outer category and bars of an inner category. Thanks ! Any other way to achieve this would be helpful :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

two layer or grouped axes label / ticks
6 participants