-
Notifications
You must be signed in to change notification settings - Fork 122
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(xy): apply the data value formatter to data values over bars #1419
Conversation
@markov00 just wanted to confirm with the with value label story that the rotation in commit 06bef45 seems fine. There isn't a tick formatter for the bottom axis and the data for the non-stacked series isn't whole number data, so I think the formatting is working ok.
Let me know what you think, thank you. |
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.
To nicely verify that the correct formatter is applied on rotation please add two different formatters that can help identify the formatter on the value something like:
- for the horizontal axis:
${number.toFixed(2)} H
- for the vertical axis:
${number.toFixed(2) V}
This renders better nicely the values and shows the H or the V on the bar values that is easier to match that a missed formatter.
Checked through the failures in the vrts commit 8e768d2 - small formatting changes applied on the https://elastic.github.io/elastic-charts/?path=/story/bar-chart--with-value-label&globals=theme:light stories with rotations. Updated vrts in bar stories in 3c3a349 |
...ages/charts/src/chart_types/xy_chart/state/selectors/get_tooltip_values_highlighted_geoms.ts
Outdated
Show resolved
Hide resolved
...ages/charts/src/chart_types/xy_chart/state/selectors/get_tooltip_values_highlighted_geoms.ts
Outdated
Show resolved
Hide resolved
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.
Code changes LGTM.
eachRotation.describe((rotation) => { | ||
describe.each<NonNullable<DisplayValueStyle['alignment']>['vertical']>([ | ||
VerticalAlignment.Middle, | ||
VerticalAlignment.Top, | ||
VerticalAlignment.Bottom, | ||
])('Vertical Alignment - %s', (verticalAlignment) => { | ||
describe.each<NonNullable<DisplayValueStyle['alignment']>['horizontal']>([ | ||
HorizontalAlignment.Left, | ||
HorizontalAlignment.Center, | ||
HorizontalAlignment.Right, |
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.
👍🏼
fontSize: 10, | ||
fill: 'black', |
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.
I would suggest making this larger because it blends in. For others that view this story I'd be easier to view the change when the value is more pronounced.
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.
Looks great, I've added a comment that should probably addressed in this PR to have a nice and clean set of VRTs
@@ -129,6 +129,27 @@ describe('Bar series stories', () => { | |||
}); | |||
}); | |||
|
|||
describe('value label positioning and formatting', () => { |
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.
This is great, works well and visually is easy to read and check for defects!
I think we can really remove the screenshots and tests that looks similar to this but with a different story (the describe test before this one: value labels positioning
.
I think we can remove it, but keeping the additional test in the describe called clip both geometry and chart area values
. The reason is the following: that set screenshot is difficult to read, the high decimal values + very thin bars makes it difficult to understand what is the test about (rendering value labels with different configurations)
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 call - updated vrts in 14182f by deleting the old bar_stories vrts and rerunning.
# [38.0.0](v37.0.0...v38.0.0) (2021-10-15) ### Bug Fixes * **deps:** update dependency @elastic/eui to v39 ([#1422](#1422)) ([2ee97aa](2ee97aa)) * **goal:** reduce whitespace for circular charts ([#1413](#1413)) ([6517523](6517523)) * **interactions:** change allowBrushingLastHistogramBin to true ([#1396](#1396)) ([9fa9783](9fa9783)) * **xy:** remove wrongly represented null/missing values in tooltip ([#1415](#1415)) ([e5963a3](e5963a3)), closes [#1414](#1414) ### Code Refactoring * scales ([#1410](#1410)) ([a53a2ba](a53a2ba)) ### Features * **scales:** add `LinearBinary` scale type ([#1389](#1389)) ([9f2e427](9f2e427)) * **xy:** adaptive tick raster ([#1420](#1420)) ([200577b](200577b)) * **xy:** apply the data value formatter to data values over bars ([#1419](#1419)) ([e673fc7](e673fc7)) ### BREAKING CHANGES * **interactions:** allowBrushingLastHistogramBucket renamed to allowBrushingLastHistogramBin on the Settings component defaults true and is only applied for histogram type charts * LogScaleOptions.logBase` is now a `number` instead of the object enum `LogBase`. Some edge case data or configuration _might_, with a deemed low likelihood, lead to a situation where the earlier version would have silently not rendered a bar, line or point, while the new code doesn't `catch`, therefore throw an exception (see the last item). General risk of regressions due to the quantity of code changes (altogether 3.5k)
🎉 This PR is included in version 38.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
The tickFormat on the data values over bars now will correctly display when charts are rotated.
Details
PR #1390 includes some old commits changing the nature of getAxesBySpecId() but this function is used in multiple places where rotations were already accounted for. This new approach in this PR does not impact the tooltip header or body formatting, rectangular annotations, legend formatting etc.
Issues
Closes #1387
Checklist
:xy
,:partition
)closes #123
,fixes #123
)