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

feat(axis): improved axis styles #711

Merged
merged 19 commits into from
Jul 19, 2020

Conversation

nickofthyme
Copy link
Collaborator

@nickofthyme nickofthyme commented Jun 15, 2020

Summary

closes #714, #312

Type Changes

  • Adds visibility to axisTitle, axisLine and tickLabel
  • Adds inner and outer properties to TextStyle.padding. Still accepts number

BREAKING CHANGES

property name changes:

  • AxisSpec.gridLineStyle => AxisSpec.gridLine
  • AxisSpec.gridLineStyle => AxisSpec.gridLine

type changes:

  • AxisSpec.tickLabelRotation => AxisStyle.tickLabel.rotation
  • AxisSpec.tickPadding => AxisStyle.tickLine.padding
  • AxisSpec.tickSize => AxisStyle.tickLine.size
  • AxisStyle.tickLabelPadding => AxisStyle.tickLabel.padding
  • GridLineConfig => GridLineStyle
  • AxisSpec.style => RecursivePartial<AxisStyle> (new AxisStyle type)
  • AxisConfig.axisLineStyle => AxisStyle.axisLine
  • AxisConfig.axisTitleStyle => AxisStyle.axisTitle
  • AxisConfig.tickLabelStyle => AxisStyle.tickLabel
  • AxisConfig.tickLineStyle => AxisStyle.tickLine
  • GridLineStyle requires all properties
  • deprecate AxisSpec.showGridLines in favor of AxisSpec.gridLine.visible

Axis improvements

  • Hide axis but show gridlines

Screen Recording 2020-07-13 at 09 35 AM

  • hide axis titles, labels, ticks and line independently

Screen Recording 2020-07-13 at 09 56 AM

Screen Recording 2020-07-16 at 02 09 PM

  • add inner and outer padding to tick labels

Screen Recording 2020-07-13 at 09 59 AM

  • add inner and outer padding to axes titles

Screen Recording 2020-07-13 at 10 01 AM

  • transform offsets relative to local reference (i.e. rotated coordinates)

Screen Recording 2020-07-13 at 10 05 AM

  • transform offsets relative to global reference

Screen Recording 2020-07-13 at 10 06 AM

  • add tick label horizontal and vertical alignment

Screen Recording 2020-07-13 at 10 09 AM

Checklist

Delete any items that are not applicable to this PR.

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • This was checked for cross-browser compatibility, including a check against IE11
  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios

@nickofthyme nickofthyme changed the title Axis label styles feat(axis): improved label styles Jun 15, 2020
@markov00 markov00 mentioned this pull request Jun 15, 2020
27 tasks
@nickofthyme nickofthyme linked an issue Jun 17, 2020 that may be closed by this pull request
- add visibility to ticks, labels, line and overall axis
- add style overrides for each axis that override theme axis styles
- improve padding controls for axis titles, labels and ticks
- add tick label offsets to tweek final position of tick labels
@nickofthyme nickofthyme changed the title feat(axis): improved label styles feat(axis): improved axis styles Jul 13, 2020
api/charts.api.md Outdated Show resolved Hide resolved
src/chart_types/xy_chart/renderer/canvas/axes/index.ts Outdated Show resolved Hide resolved
src/chart_types/xy_chart/specs/axis.tsx Outdated Show resolved Hide resolved
src/utils/themes/theme.ts Outdated Show resolved Hide resolved
src/utils/themes/theme.ts Outdated Show resolved Hide resolved
src/chart_types/xy_chart/utils/specs.ts Outdated Show resolved Hide resolved
src/utils/commons.ts Outdated Show resolved Hide resolved
src/chart_types/xy_chart/utils/axis_utils.ts Outdated Show resolved Hide resolved
- update api docs and types
- fix gridline visibility to use theme or showGridline prop
- only translate canvas context when needed
- remove stale properties
- fix naming from latest variable and type changes
- improve type descriptions
- update theme values to match old padding theme config
- fix type errors in stories
@nickofthyme nickofthyme marked this pull request as ready for review July 15, 2020 22:25
@markov00 markov00 self-requested a review July 16, 2020 09:33
Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and works great!
I've left a comment on my previous review and I want to ask if, on the same PR, you think it's worth also removing/deprecating these two props showOverlappingTicks and showOverlappingLabels moving these to the style

@nickofthyme nickofthyme requested a review from markov00 July 16, 2020 15:13
@nickofthyme
Copy link
Collaborator Author

Tested locally and works great!
I've left a comment on my previous review and I want to ask if, on the same PR, you think it's worth also removing/deprecating these two props showOverlappingTicks and showOverlappingLabels moving these to the style

Yeah I think we punt this decision until we make gridlines a first-class-citizen. I would also like to see nicing and a major/minor tick function like we talked about. Or even tick intervals like excel does.

Image 2020-07-16 at 10 17 28 AM

Excel tick config
image

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nickofthyme nickofthyme merged commit 4f1a0b1 into elastic:master Jul 19, 2020
markov00 pushed a commit that referenced this pull request Jul 19, 2020
# [19.10.0](v19.9.0...v19.10.0) (2020-07-19)

### Features

* **axis:** improved axis styles ([#711](#711)) ([4f1a0b1](4f1a0b1)), closes [#714](#714) [#312](#312)
@markov00 markov00 added the released Issue released publicly label Jul 19, 2020
nickofthyme added a commit that referenced this pull request Jul 19, 2020
Axis improvements

- Hide axis but show gridlines
- hide axis titles, labels, ticks and line independently
- add inner and outer padding to tick labels
- add inner and outer padding to axes titles
- transform offsets relative to local reference (i.e. rotated coordinates)
- transform offsets relative to global reference
- add tick label horizontal and vertical alignment

closes #714, #312

BREAKING CHANGE:

- `AxisSpec.gridLineStyle` => `AxisSpec.gridLine`
- `AxisSpec.gridLineStyle` => `AxisSpec.gridLine`
- `AxisSpec.tickLabelRotation` => `AxisStyle.tickLabel.rotation`
- `AxisSpec.tickPadding` => `AxisStyle.tickLine.padding`
- `AxisSpec.tickSize` => `AxisStyle.tickLine.size`
- `AxisStyle.tickLabelPadding` => `AxisStyle.tickLabel.padding`
- `GridLineConfig` => `GridLineStyle`
- `AxisSpec.style` => `RecursivePartial<AxisStyle>` (new `AxisStyle` type)
- `AxisConfig.axisLineStyle` => `AxisStyle.axisLine`
- `AxisConfig.axisTitleStyle` => `AxisStyle.axisTitle`
- `AxisConfig.tickLabelStyle` => `AxisStyle.tickLabel`
- `AxisConfig.tickLineStyle` => `AxisStyle.tickLine`
- `GridLineStyle` requires all properties
- deprecate `AxisSpec.showGridLines` in favor of `AxisSpec.gridLine.visible`
markov00 pushed a commit that referenced this pull request Jul 19, 2020
# [20.0.0](v19.9.1...v20.0.0) (2020-07-19)

### Features

* **axis:** improved axis styles ([#711](#711)) ([3c46f9c](3c46f9c)), closes [#714](#714) [#312](#312)

### BREAKING CHANGES

* **axis:** - `AxisSpec.gridLineStyle` => `AxisSpec.gridLine`
- `AxisSpec.gridLineStyle` => `AxisSpec.gridLine`
- `AxisSpec.tickLabelRotation` => `AxisStyle.tickLabel.rotation`
- `AxisSpec.tickPadding` => `AxisStyle.tickLine.padding`
- `AxisSpec.tickSize` => `AxisStyle.tickLine.size`
- `AxisStyle.tickLabelPadding` => `AxisStyle.tickLabel.padding`
- `GridLineConfig` => `GridLineStyle`
- `AxisSpec.style` => `RecursivePartial<AxisStyle>` (new `AxisStyle` type)
- `AxisConfig.axisLineStyle` => `AxisStyle.axisLine`
- `AxisConfig.axisTitleStyle` => `AxisStyle.axisTitle`
- `AxisConfig.tickLabelStyle` => `AxisStyle.tickLabel`
- `AxisConfig.tickLineStyle` => `AxisStyle.tickLine`
- `GridLineStyle` requires all properties
- deprecate `AxisSpec.showGridLines` in favor of `AxisSpec.gridLine.visible`
@markov00
Copy link
Member

markov00 commented Jul 20, 2020

🎉 This PR is included in version 20.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

nickofthyme added a commit that referenced this pull request Jul 20, 2020
@elastic elastic deleted a comment from markov00 Jul 20, 2020
@nickofthyme nickofthyme deleted the axis-label-styles branch July 20, 2020 15:14
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
# [20.0.0](elastic/elastic-charts@v19.9.1...v20.0.0) (2020-07-19)

### Features

* **axis:** improved axis styles ([opensearch-project#711](elastic/elastic-charts#711)) ([e736aad](elastic/elastic-charts@e736aad)), closes [opensearch-project#714](elastic/elastic-charts#714) [opensearch-project#312](elastic/elastic-charts#312)

### BREAKING CHANGES

* **axis:** - `AxisSpec.gridLineStyle` => `AxisSpec.gridLine`
- `AxisSpec.gridLineStyle` => `AxisSpec.gridLine`
- `AxisSpec.tickLabelRotation` => `AxisStyle.tickLabel.rotation`
- `AxisSpec.tickPadding` => `AxisStyle.tickLine.padding`
- `AxisSpec.tickSize` => `AxisStyle.tickLine.size`
- `AxisStyle.tickLabelPadding` => `AxisStyle.tickLabel.padding`
- `GridLineConfig` => `GridLineStyle`
- `AxisSpec.style` => `RecursivePartial<AxisStyle>` (new `AxisStyle` type)
- `AxisConfig.axisLineStyle` => `AxisStyle.axisLine`
- `AxisConfig.axisTitleStyle` => `AxisStyle.axisTitle`
- `AxisConfig.tickLabelStyle` => `AxisStyle.tickLabel`
- `AxisConfig.tickLineStyle` => `AxisStyle.tickLine`
- `GridLineStyle` requires all properties
- deprecate `AxisSpec.showGridLines` in favor of `AxisSpec.gridLine.visible`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improved axis padding and visibility styles
2 participants