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(goal): auto generated linear ticks #1637

Merged
merged 16 commits into from
Apr 6, 2022

Conversation

nickofthyme
Copy link
Collaborator

@nickofthyme nickofthyme commented Mar 31, 2022

Summary

Adds automated linear ticks for goal/gauge charts when to ticks value is provided. Adds a new nice prop to force ticks to be niced given the specified domain. The autogenerated ticks are independent of the values provided for bands.

BREAKING CHANGE: goal chart now requires domain min and max to be defined

Before

When no ticks prop is provided we just default to this...

Image 2022-03-30 at 10 05 25 PM

After

Now whenever ticks prop is not defined when compute the sensible linear ticks.

image

Details

This PR adds linear ticks generation from the provided domain via a ScaleContinuous.

See demo story here

Issues

closes #1238

Checklist

  • The proper chart type label has been added (e.g. :xy, :partition)
  • All related issues have been linked (i.e. closes #123, fixes #123)
  • New public API exports have been added to packages/charts/src/index.ts
  • Unit tests have been added or updated to match the most common scenarios
  • The proper documentation and/or storybook story has been added or updated
  • The code has been checked for cross-browser compatibility (Chrome, Firefox, Safari, Edge)

@nickofthyme nickofthyme added enhancement New feature or request :goal/gauge (old) Old Goal/Gauge chart related issues labels Mar 31, 2022
@nickofthyme nickofthyme requested a review from markov00 March 31, 2022 03:35
@nickofthyme nickofthyme marked this pull request as ready for review March 31, 2022 03:46
@nickofthyme nickofthyme requested a review from markov00 April 1, 2022 19:16
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.

Everything looks good now, thanks for all the updates.
I've put some minor comments about the docs/tsdocs, everything else is great!

packages/charts/src/chart_types/goal_chart/specs/index.ts Outdated Show resolved Hide resolved
packages/charts/src/chart_types/goal_chart/specs/index.ts Outdated Show resolved Hide resolved
storybook/stories/goal/26_auto_linear_ticks.story.tsx Outdated Show resolved Hide resolved
@nickofthyme nickofthyme enabled auto-merge (squash) April 6, 2022 14:03
@nickofthyme nickofthyme merged commit 378c147 into elastic:master Apr 6, 2022
@nickofthyme nickofthyme deleted the goal-linear-scale branch April 6, 2022 15:35
nickofthyme added a commit to nickofthyme/elastic-charts that referenced this pull request Apr 7, 2022
BREAKING CHANGE: goal chart now requires domain min and max to be defined
nickofthyme pushed a commit that referenced this pull request Apr 14, 2022
# [46.0.0](v45.1.1...v46.0.0) (2022-04-14)

### Bug Fixes

* **axis:** ticks generation for linear scale on bar charts ([#1645](#1645)) ([65d0e7d](65d0e7d))
* **axis:** use correct desired tick count based on axis type ([#1646](#1646)) ([512a6cd](512a6cd))
* **deps:** update dependency @elastic/eui to v53 ([#1639](#1639)) ([34bf325](34bf325))
* **deps:** update dependency @elastic/eui to v54 ([#1642](#1642)) ([6eaca0a](6eaca0a))

### Features

* **axes:** option to fit domain to list of annotation `SpecIds` ([#1641](#1641)) ([220350d](220350d))
* **goal:** auto generated linear ticks ([#1637](#1637)) ([5437d8e](5437d8e))
* **legend:** expose sorting function ([#1644](#1644)) ([128114c](128114c))

### BREAKING CHANGES

* **goal:** goal chart now requires domain min and max to be defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request :goal/gauge (old) Old Goal/Gauge chart related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-compute nice ticks for linear scales based on range
2 participants