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

[Dashboard] Deprecate syncColors option #200276

Closed
wants to merge 1 commit into from

Conversation

nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented Nov 14, 2024

Summary

This PR deprecates the usage of colorSync option in the dashboard.

Closes #200272

Checklist

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_node:* label is applied per the guidelines

@nickofthyme nickofthyme requested review from a team as code owners November 14, 2024 23:08
@kibanamachine kibanamachine added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label Nov 14, 2024
@botelastic botelastic bot added Feature:Embedding Embedding content via iFrame Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) labels Nov 14, 2024
@nickofthyme nickofthyme marked this pull request as draft November 14, 2024 23:08
@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!

@elastic elastic deleted a comment from elasticmachine Nov 14, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nreese I moved these changes to a separate PR for further discussion...

Map embeddable still uses syncColors. Should this be cleaned up as part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at the Maps code usage of syncColors I don't think it's using it. Maybe you can help.

Here you are setting up the syncing by setting the chartsPaletteServiceGetColor method to the store when the option is enabled.

if (syncColors$) {
syncColorsSubscription = syncColors$.subscribe(async (syncColors: boolean | undefined) => {
const currentSyncColorsSymbol = Symbol();
syncColorsSymbol = currentSyncColorsSymbol;
const chartsPaletteServiceGetColor = syncColors
? await getChartsPaletteServiceGetColor()
: null;
if (syncColorsSymbol === currentSyncColorsSymbol) {
store.dispatch(setChartsPaletteServiceGetColor(chartsPaletteServiceGetColor));
}
});
}

Here is the function that creates the getColor logic.

async function getChartsPaletteServiceGetColor(): Promise<((value: string) => string) | null> {
const chartsService = getCharts();
const paletteRegistry: PaletteRegistry | null = chartsService
? await chartsService.palettes.getPalettes()
: null;
if (!paletteRegistry) {
return null;
}
const paletteDefinition = paletteRegistry.get('default');
const chartConfiguration = { syncColors: true };
return (value: string) => {
const series = [{ name: value, rankAtDepth: 0, totalSeriesAtDepth: 1 }];
const color = paletteDefinition.getCategoricalColor(series, chartConfiguration);
return color ? color : '#3d3d3d';
};
}

But the strange thing is if I enable the setting and put a breakpoint on line 277 in the getColor callback, it's never called when the map is rendered. 🤔

Furthermore, if I create a dashboard with 2 charts and 2 maps, one of each filters out a value to have a different legend orders. Enabling the syncColors option. I see the charts sync colors for like series names, but the maps do not.

Testing color sync - Elastic 2024-11-14 at 4 52 33 PM

Am I missing something? What calls the chartsPaletteServiceGetColor function?

Copy link
Contributor

Choose a reason for hiding this comment

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

Follow these steps to see sync colors effect map

  1. install sample web logs
  2. create new map
  3. add documents layer from Kibana Sample Data Logs
  4. Under scaling, select "Limit results to 10000"
  5. Under "Layer style" -> "Fill color", select "by value" and select field "geo.dest".
  6. Save map to library
  7. Create new dashboard and add map.
  8. Under dashboard settings, change toggle "sync colors" on and hit Apply. Notice how the colors shift in the legend.

Copy link
Contributor Author

@nickofthyme nickofthyme Nov 15, 2024

Choose a reason for hiding this comment

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

Oh I see, so it only works with the scaling set to Limit results to 10000. Looks to work for most things but breaks Lens Pie charts. 😅

image

Do you have a strong opinion to keep this feature around? I think there are too many caveats to make it work as a typical user would expect (only specific palettes under certain settings). Also it would help if we deprecated this as we plan to move away from the legacy palette service and towards the new color mapping.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a strong opinion to keep this feature around?
I am fine removing as part of 9.0. Just want to make sure the removal also cleans up maps.

I think there are too many caveats to make it work as a typical user would expect (only specific palettes under certain settings).

Agree. Most users will be using vector tiles which do not support sync colors. And this is not even documented.

Copy link
Contributor

Choose a reason for hiding this comment

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

I added a discuss item to our team sync on Tuesday morning to get feedback from team. I will invite you to the meeting.

I also opened #200290 to track removing sync colors from maps since it is non-trivial.

@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 14, 2024

💔 Build Failed

Failed CI Steps

History

@nickofthyme nickofthyme changed the title chore: deprecate syncColors option, remove related fn tests [Dashboard] deprecate syncColors option, remove related fn tests Nov 14, 2024
@nickofthyme nickofthyme changed the title [Dashboard] deprecate syncColors option, remove related fn tests [Dashboard] Deprecate syncColors option Nov 14, 2024
@nickofthyme
Copy link
Contributor Author

Closing this for now until we explore alternative functionality, see #200795.

@nickofthyme nickofthyme deleted the rm-color-sync branch November 19, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) Feature:Lens Feature:Maps Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard] Deprecate syncColors option
4 participants