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(Tooltip): Fixes tooltip when split series charts are used #1324

Merged
merged 2 commits into from
Apr 13, 2022

Conversation

ashwin-pc
Copy link
Member

@ashwin-pc ashwin-pc commented Mar 8, 2022

Signed-off-by: Ashwin Pc ashwinpc@amazon.com

Description

On split series charts, the y axis label is incorrect. This change uses the value from the raw table data to correctly assign the value

Issues Resolved

#1262

Check List

  • New functionality includes testing.
    • All tests pass
      • yarn test:jest
      • yarn test:jest_integration
      • yarn test:ftr
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff

@ashwin-pc ashwin-pc requested a review from a team as a code owner March 8, 2022 03:30
Copy link
Member

@ananzh ananzh left a comment

Choose a reason for hiding this comment

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

some comments. Thanks Ashwin.

@@ -55,7 +56,15 @@ export function pointSeriesTooltipFormatter() {

if (datum.y !== null && datum.y !== undefined) {
const value = datum.yScale ? datum.yScale * datum.y : datum.y;
addDetail(currentSeries.label, currentSeries.yAxisFormatter(value));
let label = currentSeries.label;
Copy link
Member

Choose a reason for hiding this comment

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

seems data.yAxisLabel will give the label directly?
is there a specific reason to use datum?

data: 
{xAxisOrderedValues: Array(5), xAxisFormat: {…}, xAxisLabel: 'machine.os.keyword: Descending', yAxisFormat: {…}, yAxisLabel: 'Count', …}
hits: 25
series: (15) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
xAxisFormat: {id: 'terms', params: {…}}
xAxisFormatter: val => xConverter.convert(val)
xAxisLabel: "machine.os.keyword: Descending"
xAxisOrderedValues: (5) ['win xp', 'osx', 'win 7', 'win 8', 'ios']
yAxisFormat: {id: 'number'}
yAxisFormatter: val => yConverter.convert(val)
yAxisLabel: "Count"
zAxisFormat: {id: 'terms', params: {…}}
zAxisFormatter: val => zConverter.convert(val)
zAxisLabel: ""
[[Prototype]]: Object

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, when we have multiple fields on the y axis, the yAxisLabel is incorrectly set. The only way we have to correctly get the label then is from the yRaw value. Thats why i check in the next few lines to check to see if we have more than one y-axis field before using the yRaw value instead of the default label. I've added the comment below to call this out as well.

@ashwin-pc ashwin-pc force-pushed the fix/tooltip-label branch 2 times, most recently from a5a6d46 to 7260995 Compare March 24, 2022 18:25
@ashwin-pc ashwin-pc self-assigned this Mar 24, 2022
@ashwin-pc ashwin-pc requested a review from boktorbb March 31, 2022 03:59
AMoo-Miki
AMoo-Miki previously approved these changes Apr 1, 2022
@ashwin-pc ashwin-pc requested a review from a team April 12, 2022 20:42
boktorbb
boktorbb previously approved these changes Apr 12, 2022
Copy link
Contributor

@boktorbb boktorbb left a comment

Choose a reason for hiding this comment

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

Looks good

kavilla
kavilla previously approved these changes Apr 13, 2022
Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

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

LGTM! It solves the problem but @AMoo-Miki does raise a good point about loading lodash.

Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>
Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>
Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@tmarkley tmarkley left a comment

Choose a reason for hiding this comment

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

Thanks Ashwin!

@tmarkley
Copy link
Contributor

@ashwin-pc which version(s) are we targeting? Feel free to add the labels!

@kavilla kavilla linked an issue Apr 13, 2022 that may be closed by this pull request
@kavilla kavilla added v2.0.0 bug Something isn't working labels Apr 13, 2022
@kavilla kavilla merged commit e9e2904 into opensearch-project:main Apr 13, 2022
@ashwin-pc ashwin-pc deleted the fix/tooltip-label branch April 13, 2022 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] split title missing on tooltop
6 participants