feat(axis): improved axis styles#711
Conversation
6651716 to
99149f9
Compare
99149f9 to
6a192c8
Compare
- 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
6a192c8 to
8e4ccb8
Compare
- 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
markov00
left a comment
There was a problem hiding this comment.
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. |
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`
# [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`
|
🎉 This PR is included in version 20.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This reverts commit 4f1a0b1.
# [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`


Summary
closes #714, #312
Type Changes
visibilitytoaxisTitle,axisLineandtickLabelinnerandouterproperties toTextStyle.padding. Still accepts numberBREAKING CHANGES
property name changes:
AxisSpec.gridLineStyle=>AxisSpec.gridLineAxisSpec.gridLineStyle=>AxisSpec.gridLinetype changes:
AxisSpec.tickLabelRotation=>AxisStyle.tickLabel.rotationAxisSpec.tickPadding=>AxisStyle.tickLine.paddingAxisSpec.tickSize=>AxisStyle.tickLine.sizeAxisStyle.tickLabelPadding=>AxisStyle.tickLabel.paddingGridLineConfig=>GridLineStyleAxisSpec.style=>RecursivePartial<AxisStyle>(newAxisStyletype)AxisConfig.axisLineStyle=>AxisStyle.axisLineAxisConfig.axisTitleStyle=>AxisStyle.axisTitleAxisConfig.tickLabelStyle=>AxisStyle.tickLabelAxisConfig.tickLineStyle=>AxisStyle.tickLineGridLineStylerequires all propertiesAxisSpec.showGridLinesin favor ofAxisSpec.gridLine.visibleAxis improvements
innerandouterpadding to tick labelsinnerandouterpadding to axes titleslocalreference (i.e. rotated coordinates)globalreferenceChecklist
Delete any items that are not applicable to this PR.
src/index.ts(and stories only import from../srcexcept for test data & storybook)