-
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(tooltip): allow postfix banded area series #391
feat(tooltip): allow postfix banded area series #391
Conversation
Allow user to set postfix for upper and lower bound of banded series to distinguish between values closes elastic#162
Codecov Report
@@ Coverage Diff @@
## master #391 +/- ##
==========================================
- Coverage 98.25% 98.05% -0.21%
==========================================
Files 38 39 +1
Lines 2814 2833 +19
Branches 666 673 +7
==========================================
+ Hits 2765 2778 +13
- Misses 44 50 +6
Partials 5 5
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.
I've left a suggestion to consider before merging this.
I've tested this locally and works fine.
* | ||
* @default 'lower' | ||
*/ | ||
y1AccessorPostfix?: string; |
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.
Hey @nickofthyme
can we change this to a postfix string OR a function that is invoked with the series name and return the user formatted series name like:
y0AccessorName={(seriesName) => { return `[min] ${seriesName}`; }}
because I think the position of the min/max fix depends on the user's language.
We can support both a string or a function?
In the case of the function, we can use it also on non-banded situations?
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.
Dangit! You're right, I should have thought of 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.
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
@@ -40,7 +40,7 @@ export function formatTooltip( | |||
displayName = name || `${id}`; | |||
} | |||
|
|||
if (banded) { | |||
if (y0Accessors && y0Accessors.length > 0) { |
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.
nit: small utility function?
as we are using this also on src/chart_types/xy_chart/store/utils.ts
?
hasY0Accessors({y0Accessors}) {
return y0Accessors && y0Accessors.length > 0
}
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.
🎉 This PR is included in version 13.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [13.3.0](elastic/elastic-charts@v13.2.0...v13.3.0) (2019-10-02) ### Features * **tooltip:** tooltip label format for upper/lower banded area series ([opensearch-project#391](elastic/elastic-charts#391)) ([701264c](elastic/elastic-charts@701264c)), closes [opensearch-project#162](elastic/elastic-charts#162)
Summary
Allow user to set postfix string or accessor for upper and lower bound of banded series to distinguish between values.
Adds
y1AccessorFormat
andy0AccessorFormat
props toBasicSeriesSpec
.y1AccessorFormat
defaults to' - upper'
andy0AccessorFormat
defaults to' - lower'
closes #162
see local storybook link http://localhost:9001/?path=/story/area-chart--band-area-chart
Area banded series
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)