-
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
refactor: use redux in favour of mobx #281
Conversation
Codecov Report
@@ Coverage Diff @@
## master #281 +/- ##
==========================================
+ Coverage 77.85% 84.11% +6.25%
==========================================
Files 81 168 +87
Lines 4209 4784 +575
Branches 894 917 +23
==========================================
+ Hits 3277 4024 +747
+ Misses 920 744 -176
- Partials 12 16 +4
Continue to review full report at Codecov.
|
87af59b
to
aaa1416
Compare
First of all, great changes overall toward data flow simplification! There are a couple of places where some more uncoupling could be done, here's the main one: likely because of what chart types have been covered so far,
where As |
The other uncoupling question/suggestion is about whether certain computations could be separated from views that they are often associated with. For example, Another example is I'm not necessarily suggesting that instead of an |
Likely a known issue: apparently randomly, storybook examples fail:
then it may work on another try. Could be some race condition |
You are right. as this is a WIP PR there still some refactoring that I need to go through before making it really available for review. Right not
IMHO I prefer to keep the main root component as |
Definitely not news to you but I was curious, all MobX dependencies can now be removed 🎉
PS. I guess you're keeping there until the last moment for when you switch back&forth between branches |
Added external component renderer. Add bar values and grids. Refactor: line and rect annotations, legend, brush, add default settings spec to store Added re-reselect to handle multiple charti instances Add redux dev tools
Skipped test on existing chart store
@nickofthyme I've fixed the Annotation tooltips here: 143276c |
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.
BAM!! 🎍
YAAAAY!!!! |
# [15.0.0](v14.2.0...v15.0.0) (2019-12-02) ### Code Refactoring * series identifications throughout library ([#419](#419)) ([66a48ff](66a48ff)) * use redux in favour of mobx ([#281](#281)) ([cd34716](cd34716)) ### BREAKING CHANGES * `GeometryId` is now `SeriesIdentifier`. `customSeriesColors` prop on `SeriesSpec` which used to take a `CustomSeriesColorsMap`, now expects a `CustomSeriesColors` type. `LegendItemListener` now passes the `SeriesIdentifier` type as the first callback argument. * `SpecId`,`AxisId`, `AnnotationId` types are down-casted to a `string` type. The `getSpecId`, `getAxisId` and `getAnnotationId` methods still exist and but return just the same passed string until deprecated in a future version. The spec ids, previously `id`, `axisId`,`annotationId` etc are now aligned to use the same prop name: `id`. The chart rendering status `data-ech-render-complete` and `data-ech-render-count` is no more at the root level of the `echChart` div, but on its child element: `echChartStatus`. The `Spec` has two new private properties called `chartType` and `specType`.
🎉 This PR is included in version 15.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
during the redux refactoring (elastic#281) I've forgot to compute the brush correctly on rotated charts. In this commit I also fixed the min and max value passed to the onBrushEnd to be aligned with the min/max value of the domain. fix elastic#527
# [15.0.0](elastic/elastic-charts@v14.2.0...v15.0.0) (2019-12-02) ### Code Refactoring * series identifications throughout library ([opensearch-project#419](elastic/elastic-charts#419)) ([fc37dd6](elastic/elastic-charts@fc37dd6)) * use redux in favour of mobx ([opensearch-project#281](elastic/elastic-charts#281)) ([50ba58c](elastic/elastic-charts@50ba58c)) ### BREAKING CHANGES * `GeometryId` is now `SeriesIdentifier`. `customSeriesColors` prop on `SeriesSpec` which used to take a `CustomSeriesColorsMap`, now expects a `CustomSeriesColors` type. `LegendItemListener` now passes the `SeriesIdentifier` type as the first callback argument. * `SpecId`,`AxisId`, `AnnotationId` types are down-casted to a `string` type. The `getSpecId`, `getAxisId` and `getAnnotationId` methods still exist and but return just the same passed string until deprecated in a future version. The spec ids, previously `id`, `axisId`,`annotationId` etc are now aligned to use the same prop name: `id`. The chart rendering status `data-ech-render-complete` and `data-ech-render-count` is no more at the root level of the `echChart` div, but on its child element: `echChartStatus`. The `Spec` has two new private properties called `chartType` and `specType`.
The chart ids used to be cast as unique strings (https://github.com/markov00/elastic-charts/blame/8afa62afc4206d8ce3876aa5ccd9c69a8c20518a/src/utils/ids.ts) but this was changed in elastic/elastic-charts#281 and fully removed in elastic/elastic-charts#554.
Summary
Todos
check deselectedDataSeries: DataSeriesColorsValues[];isCursorOnChart
Breaking Changes
SpecId
,AxisId
,AnnotationId
types are down-casted to astring
type. ThegetSpecId
,getAxisId
mgetAnnotationId
methods still exist and but return just the same passed string until deprecated in a future version.id
,axisId
,annotationId
etc are now aligned to use the same prop name:id
data-ech-render-complete
anddata-ech-render-count
is no more at the root level of theechChart
div, but on its child element:echChartStatus
This PR refactor the current MobX implementation of elastic-chart in favour of redux and a better API to include new chart types.
GlobalChartState
The new redux state is configured as the following:
That global state maintain mainly the
specs
map (parsed from the<SpecParser />
component, similarly to the previous MobX implementation. Each spec is now stored into a plain JS object where each key is the id of theSpec
.A
Spec
has now few more propertiesNew Chart types
Each
ChartType
needs one or moreSpec
and needs to register its ownInternalChartState
class into theinitInternalChartState
function ofsrc/state/chart_state.ts
.The
InternalChartState
class follow this interface:close #75
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.src/index.ts
(and stories only import from../src
except for test data & storybook)