-
Notifications
You must be signed in to change notification settings - Fork 121
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: small multiples for XY charts (alpha) #793
Conversation
9aa7c0d
to
bbf23fc
Compare
Codecov Report
@@ Coverage Diff @@
## master #793 +/- ##
==========================================
+ Coverage 69.58% 69.82% +0.24%
==========================================
Files 321 351 +30
Lines 10636 10542 -94
Branches 2196 2031 -165
==========================================
- Hits 7401 7361 -40
+ Misses 3226 3099 -127
- Partials 9 82 +73
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Just looking at the visual changes, made a few observations.
Was this line removed intentionally?
Was this border only in debug mode?
Looks like the clipped area is slightly smaller here. This looks to be the cause of many of the minor pixel changes.
How do we want to handle the end and start tick label overlap?
Are we planning to fix the tooltip ordering before 7.11
?
These are duplicates and should be deleted:
integration/tests/__image_snapshots__/bar-stories-test-ts-bar-series-stories-test-histogram-mode-ordinal-enable-histogram-mode-is-true-has-histogram-bar-series-is-true-rotation-negative-90-2-snap.png
integration/tests/__image_snapshots__/interactions-test-ts-interactions-tooltips-positioning-boundary-el-default-rotation-0-placement-right-shows-tooltip-in-top-right-corner-2-snap.png
integration/tests/__image_snapshots__/mixed-stories-test-ts-mixed-series-stories-fitting-functions-stacked-charts-area-charts-end-value-set-to-nearest-should-display-correct-fit-for-type-linear-2-snap.png
...now off to the 9k code changes 😅
No that was an issue with the preexisting code where a LineSeries with a different groupId and an axis with the same groupId wasn't visualized: check the story code here: https://elastic.github.io/elastic-charts/?path=/story/axes--custom-domain to me, the right behavior is to show that line. This only appears in debug mode (it will helps when debugging multiple panels.
Right, I will check that
Yep, I think we should fix that before 7.11. What we can do is to: compute the exact overflow of the last displayed label on the chart, compare it to the current padding percentage, and adjust it accordingly. In case we can also hide the last tick on every panel except the latest one
Will do!
🙏 🙏 🙏 🙏 🙏 🙏 |
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.
Overall, really great enhancement and code refactoring. Love the changes to the test files and all the mock improvements/additions. Also love the separation into panels, makes the logic much cleaner.
Reviewed all the src code and everything LGTM. I left a few comments and questions.
Gonna now test storybook locally for any regressions.
Thanks for the response on the VRT changes. I think the clipped area changes and the end/start tick labels are the only thing remaining. |
I've checked the storybook going though about half of all stories and everything looks good outside of the two issues mentioned above. I was not able to check the legend interaction with the three split chart stories so might be worth adding a legend to one of them. The clipping issue seems to be different for areas/lines than points, as points are rendered beyond the clipped area/line geometry. |
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.
Clipping changes look good to me. 👍
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.
LGTM, fantastic work! 🎉
* @remarks | ||
* After mobx->redux https://github.com/elastic/elastic-charts/pull/281 we keep the specs untouched on mount | ||
* in MobX version, the stackAccessors was programmatically added to every histogram specs | ||
* in ReduX version, we left untouched the specs, so we have to manually check that |
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.
Should comments relating to MobX be removed?
}; | ||
} | ||
|
||
return null; |
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.
Wouldn't mind a slight reshaping, like return firstColumn || lastLine ? .... : null
or if / else
or if(!firstColumn && !lastLine) { return null}
return getPerPanelMap(scales, (anchor, h, v) => { | ||
const lastLine = horizontal.domain.includes(h) && vertical.domain[vertical.domain.length - 1] === v; | ||
const firstColumn = horizontal.domain[0] === h; | ||
if (firstColumn || lastLine) { |
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'd like to understand a little bit more about the logic here, maybe on a quick call?
# [24.1.0](v24.0.0...v24.1.0) (2020-11-24) ### Bug Fixes * **area_charts:** correctly represent baseline with negative data points ([#896](#896)) ([d1243f1](d1243f1)) * **legend:** legend sizes with ordinal data ([#867](#867)) ([7559e0d](7559e0d)), closes [#811](#811) * render orphan data points on lines and areas ([#900](#900)) ([0be282b](0be282b)), closes [#783](#783) * specs swaps correctly reflected in state ([#901](#901)) ([7fba882](7fba882)) ### Features * **legend:** allow legend text to be copyable ([#877](#877)) ([9cd3459](9cd3459)), closes [#710](#710) * allow clearing series colors from memory ([#899](#899)) ([ab1af38](ab1af38)) * merge series domain with the domain of another group ([#912](#912)) ([325b013](325b013)) * small multiples for XY charts (alpha) ([#793](#793)) ([d288208](d288208)), closes [#500](#500) [#500](#500)
🎉 This PR is included in version 24.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [24.1.0](elastic/elastic-charts@v24.0.0...v24.1.0) (2020-11-24) ### Bug Fixes * **area_charts:** correctly represent baseline with negative data points ([opensearch-project#896](elastic/elastic-charts#896)) ([b622fda](elastic/elastic-charts@b622fda)) * **legend:** legend sizes with ordinal data ([opensearch-project#867](elastic/elastic-charts#867)) ([74bcbad](elastic/elastic-charts@74bcbad)), closes [opensearch-project#811](elastic/elastic-charts#811) * render orphan data points on lines and areas ([opensearch-project#900](elastic/elastic-charts#900)) ([3e2c739](elastic/elastic-charts@3e2c739)), closes [opensearch-project#783](elastic/elastic-charts#783) * specs swaps correctly reflected in state ([opensearch-project#901](elastic/elastic-charts#901)) ([a94347f](elastic/elastic-charts@a94347f)) ### Features * **legend:** allow legend text to be copyable ([opensearch-project#877](elastic/elastic-charts#877)) ([21a96d3](elastic/elastic-charts@21a96d3)), closes [opensearch-project#710](elastic/elastic-charts#710) * allow clearing series colors from memory ([opensearch-project#899](elastic/elastic-charts#899)) ([e97f4ab](elastic/elastic-charts@e97f4ab)) * merge series domain with the domain of another group ([opensearch-project#912](elastic/elastic-charts#912)) ([716ad5a](elastic/elastic-charts@716ad5a)) * small multiples for XY charts (alpha) ([opensearch-project#793](elastic/elastic-charts#793)) ([3b88e1c](elastic/elastic-charts@3b88e1c)), closes [opensearch-project#500](elastic/elastic-charts#500) [opensearch-project#500](elastic/elastic-charts#500)
Summary
The PR adds a first alpha version of the
SmallMultiple
chart configuration as requested in #500Two main components are used to describe the small multiples:
<GroupBy />
that is a generic component that allows the specification of a group by operation and sorting order. Theby
prop request a function with two arguments, thespec
and thedatum
. It's called for each spec and for each data point available in thedata
array of a spec. It should return a unique value used to group the data points into multiple series.<SmallMultiples />
component with two main optional props:splitVertically
orsplitHorizontally
where you can specify theid
of aGroupBy
operator to render vertically (one below the other) or horizontally (one aside the other) the series defined by that group operation. A preliminary style configuration can be used to configure inner and outer padding in percentage for the vertical or horizontal charts.3 examples are added to Storybook.
This PR changes the way most of the geometries are computed targeting what I've called
panel
(the rectangular rendering area that cover a single small multiple)instead of the previously usedchartDimension
.Another important change was applied to the data pipeline: the Formatted and Raw DataSeries types are now removed in favor of a single
DataSeries
type that contains all the required props to identify a Series and its characteristics.Note:
Further developments, on subsequent PRs:
src/chart_types/xy_chart/state/selectors/compute_per_panel_axes_geoms.ts
that currently render axis only on the first column and the last row) [small multiples] Render axis on every panel #891Checklist
src/index.ts
(and stories only import from../src
except for test data & storybook)