Skip to content

Conversation

DiegoCardoso
Copy link
Contributor

@DiegoCardoso DiegoCardoso commented Aug 15, 2025

Description

Upgrade the Highcharts dependency to 12.3.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 legend-item-click API to cover the new legend.events.itemClick event introduced to replace series.events.legendItemClick.
  • 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

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 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.

}

${unsafeCSS(scope)} div.highcharts-tooltip {
filter: none;
font-size: 0.8em;
Copy link
Member

Choose a reason for hiding this comment

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

This makes the font size nicely smaller in the tooltip. But since the header within it is also using an em-based font size, that gets even smaller. I’d increase the header font size a bit, perhaps to 0.9em, if it needs to be smaller than the other text in the tooltip. Maybe add custom properties for controlling the font size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can update it to be the same as the current styles. Currently, the font size is inherited from the root with the value: var(--vaadin-charts-font-size, 0.75rem). The header currently has a size of 0.85em instead of the 0.8em being changed here.

Comment on lines 156 to 158
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', sans-serif;
Copy link
Member

Choose a reason for hiding this comment

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

Font family should be inherited.

Suggested change
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', sans-serif;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', sans-serif;
font-size: 1rem;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about this. Maybe we should at least have a property for this, or let it inherit. But if we let it inherit, then we should check the other font sizes so that they remain legible even if the font size on the parent is reduced to something like 13 or 14 px.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed that and attempted to align the font sizes elsewhere to work with our defaults, just as they are in the current version.

Copy link
Member

Choose a reason for hiding this comment

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

Why are the colors so different?

Copy link
Member

Choose a reason for hiding this comment

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

Ah. Legend shows 10 series, but there are only 5 lines visible, and the series titles show they are duplicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't catch that. Let me see what's going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it turned out the issue was coming from a known change in the behavior of the userOptions property of the Chart instance. We needed to add the series manually to the "exporting" one because the userOptions used to instantiate didn't use to have the information about the series in this case. But it now does, so no need to manually copy over the series into the new chart.

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
Copy link
Contributor Author

@DiegoCardoso DiegoCardoso left a comment

Choose a reason for hiding this comment

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

Addressed the comments about font size.

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
Contributor Author

Choose a reason for hiding this comment

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

}

${unsafeCSS(scope)} div.highcharts-tooltip {
filter: none;
font-size: 0.8em;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can update it to be the same as the current styles. Currently, the font size is inherited from the root with the value: var(--vaadin-charts-font-size, 0.75rem). The header currently has a size of 0.85em instead of the 0.8em being changed here.

font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', sans-serif;
font-size: 1rem;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed that and attempted to align the font sizes elsewhere to work with our defaults, just as they are in the current version.

Comment on lines 156 to 158
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', sans-serif;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@DiegoCardoso DiegoCardoso force-pushed the feat/charts/highcharts-v12 branch from 3ab8029 to a8e0f64 Compare August 26, 2025 14:15
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants