-
Notifications
You must be signed in to change notification settings - Fork 120
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
feat(heatmap): allow rotation of x axis labels #1514
Conversation
packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/heatmap/renderer/canvas/canvas_renderers.ts
Outdated
Show resolved
Hide resolved
jenkins test this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overlap (and secondarily, rotating time tick labels in the example) look unintended, conveying less than ideal practice to users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for merging once all tests pass
The `rotation` configuration is available on the `theme.heatmap.xAxisLabel` theme style to rotate the labels of the X-axis from 0 to 90 degrees. The rotation will shrink the chart vertically( and occasionally also horizontally) depending on the length of the labels. Few changes to the x-axis labels are also landed in this PR: - categorical labels overflowing the chart boundaries will play a role in shrinking the chart size. - the X-axis now shows small ticks, center-aligned for categorical scale and left-aligned for time - the time axis ticks are aligned to the right of the ticks - time axis labels instead, will not shrink the chart anymore. The number of labels will be reduced gradually to avoid overlaps and overflows. The right edge of the heatmap will always touch the right edge of the rendering area. BREAKING CHANGE: `width`, `align`, and `baseline` style properties are removed from the `xAxisLabels` and `yAxisLabels` style of the Heatmap theme. Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
# [44.0.0](v43.1.1...v44.0.0) (2022-03-01) ### Bug Fixes * **axis:** correct tick alignment in ordinal scale with numeric values ([#1609](#1609)) ([915349d](915349d)) * **legend:** width with duplicate nested pie slice labels ([#1585](#1585)) ([1073231](1073231)) * **partition:** consider legend extras when computing the legend size ([#1611](#1611)) ([2078f3d](2078f3d)) * **xy:** dataIndex keeps original data order on small multiples ([#1597](#1597)) ([9e2566c](9e2566c)) ### Features * **api:** expose Predicate enum ([#1574](#1574)) ([1f73eec](1f73eec)) * **heatmap:** allow rotation of x axis labels ([#1514](#1514)) ([b655156](b655156)) ### BREAKING CHANGES * **heatmap:** `width`, `align`, and `baseline` style properties are removed from the `xAxisLabels` and `yAxisLabels` style of the Heatmap theme. Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
Summary
The
rotation
configuration is available on thetheme.heatmap.xAxisLabel
theme style to rotate the labels of the X axis from 0 to 90 degree.The rotation will shrink the chart vertically( and occasionally also horizontally) depending on the length of the labels.
Few changes to the x axis labels are also landed in this PR:
BREAKING CHANGES
width
,align
andbaseline
style properties are removed from thexAxisLabels
andyAxisLabels
style of the Heatmap theme.These properties were not used in the rendering.
Details
Compute the X axis space
The X axis space is computed as the following:
categorical
screenspaceMarkerScaleCompressor
to compute how much we need to shrink the grid width considering the label positions in the domain and their screen size. I also included the Y axis so that we can take also the maximum label width in the calculation.time
multiLayerTimeAxis
but in a future step we can include that.Future possible steps
Issues
Partially solves #1168 (missing the automatic trimming of horizontal labels)
Checklist
:xy
,:partition
):interactions
,:axis
)closes #123
,fixes #123
)packages/charts/src/index.ts