KEMBAR78
feat!: upgrade Highcharts version to 12.2.0 by DiegoCardoso · Pull Request #10010 · vaadin/web-components · GitHub
Skip to content

Conversation

@DiegoCardoso
Copy link
Contributor

@DiegoCardoso DiegoCardoso commented Aug 15, 2025

Description

Upgrade the Highcharts dependency to 12.2.0.

The list of changes introduced in this PR:

  • Update the base styles to use both the --vaadin-charts-* and --highcharts-* CSS properties API, with the latter taking precedence, when both are defined.
  • Add a new the new legend.events.itemClick event introduced to replace series.events.legendItemClick. The callback dispatches either a series-legend-item-click or a point-legend-item-click event, depending on the type of the legendItem property.
  • Update the monkeypatch for firing the beforeExport/afterExport events used by the mixin to copy the styles to the body and do the cleanup afterwards, when the user exports the chart as an image.
  • Update monkeypatch to fix a BFP to use the correct method
  • Add a workaround for allowing setting lang global options in rendered charts
  • Add a workaround for fixing labels' position in "organization" charts in styled mode
  • One possible breaking change introduced in recent versions of Highcharts is that userOptions used to be somewhat static, meaning that after the chart was initialized, its value wouldn't update based on the chart's updates. Now, adding/removing items (such as series or points) is reflected in the userOptions object.
  • Some of the changes in the userOptions object is that properties that accept arrays, such as xAxis, yAxis, etc, used to maintain the type of the object it was initially passed in the options, if for instance, an object was passed. That changed so that it always returns an array in the userOptions.
    • That's why the __hasConfigurationBuffer method has changed to take into account the case where the property is an array.

Part of #8825
Fix #9908

Type of change

  • Feature

@DiegoCardoso DiegoCardoso force-pushed the feat/charts/highcharts-v12 branch from 65ef5f8 to a8c2d3f Compare August 21, 2025 11:28
@DiegoCardoso DiegoCardoso changed the title feat: upgrade Highcharts version to 12.3.0 feat!: upgrade Highcharts version to 12.3.0 Aug 21, 2025
@DiegoCardoso DiegoCardoso marked this pull request as ready for review August 21, 2025 14:32
@DiegoCardoso DiegoCardoso requested a review from jouni August 21, 2025 14:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@DiegoCardoso DiegoCardoso force-pushed the feat/charts/highcharts-v12 branch from 88a8f07 to 2975887 Compare August 25, 2025 10:28
Copy link
Member

@jouni jouni left a comment

Choose a reason for hiding this comment

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

Overall a bit difficult to review the changes to the base styles, when they’ve changes so much. But the end results look to work as expected 🙂

Comment on lines -45 to +57
stroke-width: 1px;
stroke: var(--vaadin-charts-tooltip-border, var(--vaadin-border-color-subtle));
fill: var(--vaadin-charts-tooltip-background, var(--vaadin-background-color));
fill-opacity: var(--vaadin-charts-tooltip-background-opacity, 1);
stroke-width: 0;
fill: var(--highcharts-background-color, var(--vaadin-charts-tooltip-background, var(--vaadin-background-color)));
}
${unsafeCSS(scope)} .highcharts-tooltip-box .highcharts-label-box {
fill: var(--vaadin-charts-tooltip-background, var(--vaadin-background-color));
fill-opacity: var(--vaadin-charts-tooltip-background-opacity, 1);
stroke: var(--vaadin-charts-tooltip-border, var(--vaadin-border-color-subtle));
}
${unsafeCSS(scope)} .highcharts-tooltip-header {
stroke-width: 1px;
stroke: color-mix(in srgb, var(--vaadin-charts-contrast, var(--_label)) 20%, transparent);
fill: var(--highcharts-background-color, var(--vaadin-charts-tooltip-background, var(--vaadin-background-color)));
Copy link
Member

Choose a reason for hiding this comment

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

Why remove the tooltip border?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

As our own Tooltip component does offer properties for customizing the border (which I now notice aren't set as border but as box-shadow, which I plan to change), I’d say we would want to support the same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should it be an actual border or a box-shadow, as in the tooltip? Should it support the same amount of customization (width, color, box-shadow)?

DiegoCardoso added a commit to vaadin/flow-components that referenced this pull request Aug 26, 2025
The DOM structure in Highchart V12 is different related to how the
drilldown controls are rendered. That will cause test failures in the
ITs so we need to updated them.

Part of vaadin/web-components#8825
Depends on vaadin/web-components#10010
DiegoCardoso added a commit to vaadin/flow-components that referenced this pull request Aug 26, 2025
The DOM structure in Highchart V12 is different related to how the
drilldown controls are rendered. That will cause test failures in the
ITs so we need to updated them.

Part of vaadin/web-components#8825
Depends on vaadin/web-components#10010
@DiegoCardoso
Copy link
Contributor Author

This issue is now closed, could you please check if this CSS is still needed?

I couldn't see this issue anymore, so it seems that the workaround is not needed.

Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

The "solidgauge" chart type looks wrong with the change:

Screenshot 2025-08-28 at 11 05 22

@DiegoCardoso
Copy link
Contributor Author

DiegoCardoso commented Aug 28, 2025

The "solidgauge" chart type looks wrong with the change:

Screenshot 2025-08-28 at 11 05 22

Good catch. That seems to be a Highcharts regression in styled mode. You can check it out here. I'll fill a bug.

EDIT: it has already been reported: highcharts/highcharts#23279

@web-padawan
Copy link
Member

it has already been reported: highcharts/highcharts#23279

Should we downgrade to 12.2.0 as suggested in the issue?

@DiegoCardoso
Copy link
Contributor Author

Should we downgrade to 12.2.0 as suggested in the issue?

I wanted to see if there was a way to add a workaround for that, but it is safer to downgrade it for now. The biggest benefit I see in 12.3.0 is the ability to export charts locally instead of using the online exporting provided by Highcharts.

Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

LGTM. Let's create a follow-up issue to bump version once the solidgauge issue is fixed.

@DiegoCardoso DiegoCardoso changed the title feat!: upgrade Highcharts version to 12.3.0 feat!: upgrade Highcharts version to 12.2.0 Aug 28, 2025
@DiegoCardoso
Copy link
Contributor Author

LGTM. Let's create a follow-up issue to bump version once the solidgauge issue is fixed.

Created a new issue: #10104

@DiegoCardoso
Copy link
Contributor Author

Removed the legend-item-click added previously in this PR and used the new callback to dispatch either series-legend-item-click or point-legend-item-click events. Also, since the callback for the legend.itemClick is treated differently from the other cases, I decided to handle it separately from the more generic __createEventListeners method.

@sonarqubecloud
Copy link

@DiegoCardoso DiegoCardoso merged commit b24e2b8 into main Aug 29, 2025
9 checks passed
@DiegoCardoso DiegoCardoso deleted the feat/charts/highcharts-v12 branch August 29, 2025 12:07
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 25.0.0-beta2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[charts] Refactor tests to make it work in Highcharts V12

4 participants