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): log scale improvements and options #1014

Merged
merged 17 commits into from
Feb 16, 2021

Conversation

nickofthyme
Copy link
Collaborator

@nickofthyme nickofthyme commented Feb 4, 2021

Summary

closes #916

The main features added in this PR are the following:

  • Set base of log scales to 10, 2 or e (Common, Binary or Natural)
  • Set custom min limit of log values, previously hardcoded to 1
  • Allow domain to fit full domain of dataset, without crossing 0

yMinLimit

Screen Recording 2021-02-04 at 01 16 PM

No yMinLimit set, uses full domain

Screen Recording 2021-02-04 at 01 17 PM

yLogBase

Screen Recording 2021-02-04 at 01 18 PM

Checklist

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • 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 added enhancement New feature or request :axis Axis related issue :data Data/series/scales related issue :xy Bar/Line/Area chart related labels Feb 4, 2021
@nickofthyme nickofthyme changed the title feat(scales): log scale improvements and options feat(axis): log scale improvements and options Feb 4, 2021
- Set base of log scales to 10, 2 or e
- Set custom min limit of log values, previously hardcoded to 1
- Allow domain to fit full domain of dataset, without crossing 0
@@ -6,7 +6,7 @@

import { $Values } from 'utility-types';
import { ComponentType } from 'react';
import React from 'react';
import { default as React_2 } from 'react';
Copy link
Collaborator Author

@nickofthyme nickofthyme Feb 8, 2021

Choose a reason for hiding this comment

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

@markov00 I was able to fix this error by upgrading the api-extractor but it made these changes to React. Any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

This usually happens when you are using JSX without importing React or when importing react as import * from React but I've checked your PR and it doesn't seem to touch anything like that. I will investigate on it a bit

- test all limitLogScaleDomain variations
- prevent negative domain padding
@nickofthyme nickofthyme marked this pull request as ready for review February 9, 2021 23:45
@codecov-io
Copy link

codecov-io commented Feb 9, 2021

Codecov Report

Merging #1014 (0e0dbb5) into master (5d32f23) will decrease coverage by 0.04%.
The diff coverage is 91.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1014      +/-   ##
==========================================
- Coverage   72.78%   72.73%   -0.05%     
==========================================
  Files         363      363              
  Lines       11211    11217       +6     
  Branches     2434     2447      +13     
==========================================
- Hits         8160     8159       -1     
- Misses       3037     3044       +7     
  Partials       14       14              
Flag Coverage Δ
unittests 72.73% <91.56%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../chart_types/heatmap/layout/viewmodel/viewmodel.ts 4.37% <0.00%> (ø)
src/chart_types/index.ts 100.00% <ø> (ø)
...y_chart/state/selectors/compute_axes_geometries.ts 100.00% <ø> (ø)
...t/state/selectors/compute_axis_ticks_dimensions.ts 100.00% <ø> (ø)
...chart/state/selectors/compute_series_geometries.ts 100.00% <ø> (ø)
src/chart_types/xy_chart/utils/specs.ts 100.00% <ø> (ø)
src/scales/constants.ts 100.00% <ø> (ø)
src/scales/scale_band.ts 92.85% <ø> (ø)
src/specs/settings.tsx 90.32% <ø> (ø)
src/utils/common.ts 88.07% <33.33%> (+2.18%) ⬆️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d32f23...9999d8b. Read the comment docs.

Comment on lines 1957 to 1960
xLogBase: LogBase;
xLogMinLimit?: number;
yLogBase: LogBase;
yLogMinLimit?: number;
Copy link
Member

Choose a reason for hiding this comment

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

We can have multiple Y axis and "ideally" multiple yLogBase
what if we move these option within the Axis and/or within the xDomain props?
let's discuss it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK see a26fd2c

@markov00 markov00 self-requested a review February 16, 2021 19:09
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.

Changes LGTM

@nickofthyme nickofthyme merged commit 0f52688 into elastic:master Feb 16, 2021
@nickofthyme nickofthyme deleted the log-options branch February 16, 2021 19:46
github-actions bot pushed a commit that referenced this pull request Feb 16, 2021
# [25.0.0](v24.6.0...v25.0.0) (2021-02-16)

### Bug Fixes

* group legend items by label and color ([#999](#999)) ([5d32f23](5d32f23))

### Features

* **axis:** log scale improvements and options ([#1014](#1014)) ([0f52688](0f52688))

### BREAKING CHANGES

* The `LegendActionProps` and the `LegendColorPickerProps`, used to add actions and color picker through the legend now receive an array of `SeriesIdentifiers`
@markov00
Copy link
Member

🎉 This PR is included in version 25.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Feb 16, 2021
nickofthyme added a commit that referenced this pull request Feb 17, 2021
nickofthyme added a commit that referenced this pull request Feb 17, 2021
github-actions bot pushed a commit that referenced this pull request Feb 17, 2021
## [25.0.1](v25.0.0...v25.0.1) (2021-02-17)

### Reverts

* log scale improvements and options ([#1014](#1014)) ([2189f92](2189f92))
@nickofthyme nickofthyme restored the log-options branch February 17, 2021 16:08
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
# [25.0.0](elastic/elastic-charts@v24.6.0...v25.0.0) (2021-02-16)

### Bug Fixes

* group legend items by label and color ([opensearch-project#999](elastic/elastic-charts#999)) ([ce0bfba](elastic/elastic-charts@ce0bfba))

### Features

* **axis:** log scale improvements and options ([opensearch-project#1014](elastic/elastic-charts#1014)) ([8bac5e8](elastic/elastic-charts@8bac5e8))

### BREAKING CHANGES

* The `LegendActionProps` and the `LegendColorPickerProps`, used to add actions and color picker through the legend now receive an array of `SeriesIdentifiers`
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:axis Axis related issue :data Data/series/scales related issue enhancement New feature or request released Issue released publicly :xy Bar/Line/Area chart related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto min value on log scale
3 participants