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

fix: disable x filling for line and areas #833

Merged
merged 3 commits into from
Sep 29, 2020

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Sep 23, 2020

Summary

This fix removes the needs of filling the missing x values on line and area charts in the following
case: non-stacked line or area chart, with continuous scale and no fit function.

BREAKING CHANGE: On non-stacked line or area charts, with a continuous x scale and no fit function,
the line between consecutive points, independently from the other data series, will be a continuous
connecting line.

fix #825

Before the fix

Screenshot 2020-09-23 at 23 55 10

After the fix

Screenshot 2020-09-23 at 23 54 44

To Do

  • remove the playground demo data after review
  • add a VRT check

Checklist

Delete any items that are not applicable to this PR.

  • 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

This fix removes the needs of filling the missing x values on line and area charts in the following
case: non-stacked line or area chart, with continuous scale and no fit function.

BREAKING CHANGE: On non-stacked line or area charts, with a continuous x scale and no fit function,
the line between consecutive points, independently from the other data series, will be a continuous
connecting line.

fix elastic#825
Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

LGTM, path ordering story is still good.


function isXFillNotRequired(spec: BasicSeriesSpec, groupScaleType: ScaleType, isStacked: boolean) {
const onlyNoFitAreaLine = (isAreaSeriesSpec(spec) || isLineSeriesSpec(spec)) && !spec.fit;
const onlyContinuous = groupScaleType === ScaleType.Linear || groupScaleType === ScaleType.Time;
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does this affect Ordinal scales? Do we not need to fit with Ordinal scales?

Copy link
Member Author

Choose a reason for hiding this comment

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

with Ordinal scales it should work as before. the line, usually indicates a continuity on the data, using ordinal aka categorical scale the continuity is not the primary thing.
Let's stick with that for the moment, if there is the case to link discontinued points also on categorical scales we can fix that later, what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@nickofthyme
Copy link
Collaborator

It looks like the lastValue was affected to pull last value for each series not necessarily the last x domain value. I think this could be really confusing if they are all from different x values.

image

@markov00 markov00 marked this pull request as ready for review September 24, 2020 16:36
Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Code changes LGTM. Verified fixes issue.

integration/tests/line_stories.test.ts Show resolved Hide resolved
@markov00 markov00 merged commit 9f9892b into elastic:master Sep 29, 2020
markov00 pushed a commit that referenced this pull request Sep 30, 2020
# [23.0.0](v22.0.0...v23.0.0) (2020-09-30)

### Bug Fixes

* render continuous line/area between non-adjacent points ([#833](#833)) ([9f9892b](9f9892b)), closes [#825](#825)

### Features

* debug state flag added to chart status ([#834](#834)) ([83919ff](83919ff))
* expose datum as part of GeometryValue ([#822](#822)) ([dcd7077](dcd7077))

### BREAKING CHANGES

* when rendering non-stacked line/area charts with a continuous x scale and no fit function,
the line/area between non-consecutive data points will be rendered as a continuous line/area without adding an uncertain dashed line/ semi-transparent area that connects the two, non-adjacent, points.
@markov00
Copy link
Member Author

🎉 This PR is included in version 23.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Sep 30, 2020
@markov00 markov00 deleted the 2020_09_23-dont_fill_x_on_lines branch November 25, 2020 11:48
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
# [23.0.0](elastic/elastic-charts@v22.0.0...v23.0.0) (2020-09-30)

### Bug Fixes

* render continuous line/area between non-adjacent points ([opensearch-project#833](elastic/elastic-charts#833)) ([5222c40](elastic/elastic-charts@5222c40)), closes [opensearch-project#825](elastic/elastic-charts#825)

### Features

* debug state flag added to chart status ([opensearch-project#834](elastic/elastic-charts#834)) ([f3aba25](elastic/elastic-charts@f3aba25))
* expose datum as part of GeometryValue ([opensearch-project#822](elastic/elastic-charts#822)) ([e582bd6](elastic/elastic-charts@e582bd6))

### BREAKING CHANGES

* when rendering non-stacked line/area charts with a continuous x scale and no fit function,
the line/area between non-consecutive data points will be rendered as a continuous line/area without adding an uncertain dashed line/ semi-transparent area that connects the two, non-adjacent, points.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Line series with different x values are hidden
2 participants