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: restore hover effect on pie charts when using Lumo theme classes #6850

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
package com.vaadin.flow.component.charts.themes;

import com.vaadin.flow.component.charts.model.AbstractDataLabels;
import com.vaadin.flow.component.charts.model.Hover;
import com.vaadin.flow.component.charts.model.States;
import com.vaadin.flow.component.charts.model.style.AxisStyle;
import com.vaadin.flow.component.charts.model.style.Color;
import com.vaadin.flow.component.charts.model.style.FontWeight;
Expand Down Expand Up @@ -164,10 +162,6 @@ public LumoDarkTheme() {
setDataLabelsDefaults(getPlotOptions().getPyramid().getDataLabels());
setDataLabelsDefaults(getPlotOptions().getSpline().getDataLabels());
setDataLabelsDefaults(getPlotOptions().getWaterfall().getDataLabels());

States states = new States();
states.setHover(new Hover(false));
getPlotOptions().getPie().setStates(states);
Comment on lines -167 to -170
Copy link
Contributor Author

@sissbruecker sissbruecker Nov 22, 2024

Choose a reason for hiding this comment

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

This was added initially with vaadin/vaadin-charts-flow#393. From the Hover JavaDoc I can not quite understand what the enabled state is supposed to do, but apparently disabling it doesn't do anything sensible as it then marks all chart slices as inactive on hover. Removing this configuration seems to make the chart behave like any other without a theme.

Copy link
Contributor

Choose a reason for hiding this comment

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

And this was there since Charts for FW 7(? maybe).

From what I understand from the hover configuration, disabling it would still allow to hover the legend items and see the correspondent slice in the chart highlighted. But, by default, the legends in a pie chart show in the pie itself, so it should require some extra configuration to show the legend in a separate box, which is not expected.

This is how it would look like (you can check here):

pie-chart.mp4

}

protected void setDataLabelsDefaults(AbstractDataLabels labels) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
package com.vaadin.flow.component.charts.themes;

import com.vaadin.flow.component.charts.model.AbstractDataLabels;
import com.vaadin.flow.component.charts.model.Hover;
import com.vaadin.flow.component.charts.model.States;
import com.vaadin.flow.component.charts.model.style.AxisStyle;
import com.vaadin.flow.component.charts.model.style.Color;
import com.vaadin.flow.component.charts.model.style.FontWeight;
Expand Down Expand Up @@ -164,10 +162,6 @@ public LumoLightTheme() {
setDataLabelsDefaults(getPlotOptions().getPyramid().getDataLabels());
setDataLabelsDefaults(getPlotOptions().getSpline().getDataLabels());
setDataLabelsDefaults(getPlotOptions().getWaterfall().getDataLabels());

States states = new States();
states.setHover(new Hover(false));
getPlotOptions().getPie().setStates(states);
}

protected void setDataLabelsDefaults(AbstractDataLabels labels) {
Expand Down