Skip to content

Charts: Add TimeSeriesForecastChart component#46817

Closed
annacmc wants to merge 17 commits intotrunkfrom
add/area-chart-component
Closed

Charts: Add TimeSeriesForecastChart component#46817
annacmc wants to merge 17 commits intotrunkfrom
add/area-chart-component

Conversation

@annacmc
Copy link
Contributor

@annacmc annacmc commented Jan 29, 2026

Proposed changes

This PR introduces the TimeSeriesForecastChart component - a specialized chart for displaying historical data alongside forecasted values with uncertainty bands.

Key Features

  • Historical and forecast data visualization: Displays historical data as a solid line and forecast data as a dashed line
  • Uncertainty bands: Shaded area representing the forecast confidence interval between lower and upper bounds
  • Forecast divider: Vertical dashed line marking the transition from historical to forecast data
  • Generic data support: Accepts any data shape via accessor functions
  • Compound composition pattern: Supports TimeSeriesForecastChart.SVG and TimeSeriesForecastChart.HTML for custom children
  • Full legend prop parity: Supports all standard legend props (orientation, alignment, maxWidth, textOverflow, etc.)
  • Responsive design: Auto-resizes with withResponsive HOC
  • Animation support: Optional entrance animation respecting prefers-reduced-motion
  • Customizable tooltips: Default tooltip with custom renderer support
  • i18n support: Default series labels are translatable

Other information

The component follows existing patterns in the charts library:

  • Uses useChartRegistration for chart registry (consistent with other charts)
  • Implements compound composition using attachSubComponents and useChartChildren
  • Integrates with SingleChartContext for state sharing
  • Follows BEM CSS naming conventions

Jetpack product changes

No changes to existing Jetpack functionality. This adds a new chart component to the charts library.

Does this pull request change what data or activity we track or use?

no

@annacmc annacmc added the [Status] Needs Review This PR is ready for review. label Jan 29, 2026
@annacmc annacmc self-assigned this Jan 29, 2026
@annacmc annacmc added the [Status] Needs Review This PR is ready for review. label Jan 29, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 29, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/area-chart-component branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/area-chart-component

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • 🔴 Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


🔴 Action required: Please include detailed testing steps, explaining how to test your change, like so:

## Testing instructions:

* Go to '..'
*

Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Jan 29, 2026
@jp-launch-control
Copy link

jp-launch-control bot commented Jan 29, 2026

Code Coverage Summary

6 files are newly checked for coverage. Only the first 5 are listed here.

File Coverage
projects/js-packages/charts/src/charts/time-series-forecast-chart/private/forecast-divider.tsx 0/10 (0.00%) 💔
projects/js-packages/charts/src/charts/time-series-forecast-chart/private/use-forecast-data.ts 0/27 (0.00%) 💔
projects/js-packages/charts/src/charts/time-series-forecast-chart/time-series-forecast-chart.tsx 0/69 (0.00%) 💔
projects/js-packages/charts/src/charts/time-series-forecast-chart/index.ts 0/0 (—%) 🤷

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@annacmc annacmc changed the title Portfolio Dashboard: Add TimeSeriesForecastChart component Charts: Add TimeSeriesForecastChart component Jan 29, 2026
@annacmc annacmc force-pushed the add/area-chart-component branch from 0d91eea to 71a5627 Compare January 29, 2026 23:16
@annacmc
Copy link
Contributor Author

annacmc commented Jan 30, 2026

Closing this up as it got a bit unweildy and I've split it up into #46844 & #46845

@annacmc annacmc closed this Jan 30, 2026
@github-actions github-actions bot removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels Jan 30, 2026
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.

1 participant