-
Notifications
You must be signed in to change notification settings - Fork 843
Charts: Add region and resolution props to GeoChart for state/province-level views #46332
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
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
8901d4c to
11bff5c
Compare
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the GeoChart component to support region and resolution configurations, enabling state/province-level map visualizations beyond the default world view. The changes allow users to display maps focused on specific countries (using ISO 3166-1 alpha-2 codes) with different granularity levels (countries, provinces/states, or metro areas).
Key Changes
- Added
regionandresolutionprops to GeoChart with proper TypeScript types - New types
GeoRegionandGeoResolutionexported for consumer use - Comprehensive test coverage for the new props including default behavior and combinations
- New "US States" Storybook story demonstrating state-level visualization
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
projects/js-packages/charts/src/charts/geo-chart/types.ts |
Added GeoRegion and GeoResolution type definitions and corresponding props to GeoChartProps interface with JSDoc documentation |
projects/js-packages/charts/src/charts/geo-chart/geo-chart.tsx |
Implemented region/resolution prop handling with defaults ('world', 'countries') and conditional inclusion in Google Charts options |
projects/js-packages/charts/src/charts/geo-chart/index.ts |
Exported new GeoRegion and GeoResolution types |
projects/js-packages/charts/src/index.ts |
Re-exported new types at package level for consumer access |
projects/js-packages/charts/src/charts/geo-chart/test/geo-chart.test.tsx |
Added comprehensive tests for region/resolution props including default behavior, individual props, and combined usage |
projects/js-packages/charts/src/charts/geo-chart/stories/index.stories.tsx |
Added "USStates" story demonstrating state-level map with sample US state data |
projects/js-packages/charts/changelog/charts-149-add-us-geochart |
Added changelog entry documenting the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Coverage SummaryCoverage changed in 1 file.
|
kangzj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Introduce GeoRegion and GeoResolution types to support displaying maps at different geographic levels (world, country, state/province).
Pass region and resolution options to Google Charts to enable state/province-level map views (e.g., US states).
Demonstrate the region and resolution props with a US states map showing views data across 15 states.
Test that region and resolution options are correctly passed to Google Charts and omitted when using default values.
Introduce a new story for the GeoChart component that visualizes views data for various European countries, enhancing the demonstration of region and resolution props.
05e4208 to
3df78fa
Compare
…an countries Updated the USStates and EuropeanCountries stories in the GeoChart component to utilize new sample data imports, enhancing maintainability and clarity. The data for both stories now references the newly defined viewsByUSState and viewsByEuropeanCountry datasets.
Fixes CHARTS-149: Add US geochart
Proposed changes:
This PR enhances the GeoChart component with
regionandresolutionprops, enabling users to display maps at different geographic levels beyond just the world view.Key Changes:
regionprop - Specify which region to display ('world', or any ISO 3166-1 alpha-2 country code)resolutionprop - Control granularity level ('countries', 'provinces', or 'metros')USStatesstory - Demonstrates state-level visualization for the United StatesEuropeanCountriesstory - Demonstrates continent-level visualization for EuropeGeoRegionandGeoResolutiontypes available for consumersScreenshots
Benefits:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No, this PR only adds configuration props to the GeoChart component. No tracking or data collection changes.
Testing instructions:
Basic Region/Resolution Usage
projects/js-packages/chartspnpm installandpnpm storybookVerify Props
regionandresolutionpropsTypeScript Usage
Verify Type Checking
cd projects/js-packages/charts pnpm typecheckAll types should compile without errors.