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

XyChart: Support adding calcs to legend #87155

Merged
merged 9 commits into from May 3, 2024
Merged

XyChart: Support adding calcs to legend #87155

merged 9 commits into from May 3, 2024

Conversation

adela-almasan
Copy link
Contributor

@adela-almasan adela-almasan commented Apr 30, 2024

legend_calcs

Fixes #85034

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@adela-almasan adela-almasan added type/bug no-changelog Skip including change in changelog/release notes backport v11.0.x Mark PR for automatic backport to v11.0.x labels May 1, 2024
@adela-almasan adela-almasan marked this pull request as ready for review May 1, 2024 17:54
@adela-almasan adela-almasan requested review from grafanabot and a team as code owners May 1, 2024 17:54
@adela-almasan adela-almasan requested review from leeoniya and drew08t and removed request for a team May 1, 2024 17:54
@adela-almasan adela-almasan changed the title [WIP] XyChart: Fixes [WIP] XyChart: Fix legend May 1, 2024
Copy link
Contributor

This PR must be merged before a backport PR will be created.

1 similar comment
Copy link
Contributor

This PR must be merged before a backport PR will be created.

@@ -68,17 +78,82 @@ export const XYChartPanel2 = (props: Props2) => {
getItemKey: () => `${idx}-${s.name.value}`,
fieldName: yField.state?.displayName ?? yField.name,
disabled: yField.state?.hideFrom?.viz ?? false,
getDisplayValues: () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function different than the one used in PlotLegend?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or in the original XYChart? Maybe we can DRY it out if it is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed a quick update. The plan was to extract it to a separate component, but not today apparently 😅

@adela-almasan adela-almasan changed the title [WIP] XyChart: Fix legend XyChart: Fix legend May 2, 2024
Copy link
Contributor

@baldm0mma baldm0mma left a comment

Choose a reason for hiding this comment

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

Nice!

@adela-almasan adela-almasan enabled auto-merge (squash) May 3, 2024 21:54
@adela-almasan adela-almasan merged commit 8a96fce into main May 3, 2024
19 checks passed
@adela-almasan adela-almasan deleted the xy_legend_calcs branch May 3, 2024 22:06
Copy link
Contributor

The backport to v11.0.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-87155-to-v11.0.x origin/v11.0.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8a96fcedb2f29f60d9a1fffeb0828e38a9cd4f4a

When the conflicts are resolved, stage and commit the changes:

git add . && git cherry-pick --continue

If you have the GitHub CLI installed:

# Push the branch to GitHub:
git push --set-upstream origin backport-87155-to-v11.0.x
# Create the PR body template
PR_BODY=$(gh pr view 87155 --json body --template 'Backport 8a96fcedb2f29f60d9a1fffeb0828e38a9cd4f4a from #87155{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title "[v11.0.x] XyChart: Fix legend" --body-file - --label "type/bug" --label "area/frontend" --label "area/panel/xychart" --label "no-changelog" --label "backport" --base v11.0.x --milestone 11.0.x --web

Or, if you don't have the GitHub CLI installed (we recommend you install it!):

# Push the branch to GitHub:
git push --set-upstream origin backport-87155-to-v11.0.x

# Create a pull request where the `base` branch is `v11.0.x` and the `compare`/`head` branch is `backport-87155-to-v11.0.x`.

# Remove the local backport branch
git switch main
git branch -D backport-87155-to-v11.0.x

@grafana-delivery-bot grafana-delivery-bot bot added the backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. label May 3, 2024
@adela-almasan adela-almasan changed the title XyChart: Fix legend XyChart: Supporting adding calcs to legend May 3, 2024
@adela-almasan adela-almasan changed the title XyChart: Supporting adding calcs to legend XyChart: Support adding calcs to legend May 3, 2024
@adela-almasan adela-almasan added no-backport Skip backport of PR and removed backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. backport v11.0.x Mark PR for automatic backport to v11.0.x labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend area/panel/xychart no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XYChart2: Some legend options don't work
2 participants