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

chore: ability to change facet chart fixed size #372

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

islxyqwe
Copy link
Member

This PR make user can change the chart size by dragging when using facet chart.
image

Copy link

vercel bot commented Apr 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
graphic-walker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 10:04am

Copy link
Contributor

Risk Level 2 - /home/runner/work/graphic-walker/graphic-walker/packages/graphic-walker/src/renderer/specRenderer.tsx

The code is generally well written, but there are a few areas that could be improved:

  1. The enableResize variable is declared but only used once. Consider removing this variable and directly checking size.mode === 'fixed' && Boolean(onChartResize) where it's needed.

  2. The vegaConfig object is created using useMemo hook, which is good for performance. However, there are several @ts-ignore comments which are not recommended as they suppress TypeScript errors. Try to fix the underlying issues instead of ignoring them.

  3. The Resizable component has a lot of props. Consider creating a separate function or component to handle the rendering of this component to make the code cleaner and more readable.


Risk Level 2 - /home/runner/work/graphic-walker/graphic-walker/packages/graphic-walker/src/lib/vega.ts

The code seems to be well written and follows the SOLID principles. However, there are a few areas that could be improved for better readability and maintainability:

  1. The function toVegaSpec has a lot of parameters. Consider using an object to group related parameters. This would make the function signature more readable and easier to manage.

  2. The use of any type for spec variable should be avoided. Using any disables all type checking, which can lead to runtime errors. Try to define a more specific type if possible.

  3. The for loop iterating over resolve object can be replaced with Object.entries to make it more readable:

for (let [key, value] of Object.entries(resolve)) {
    let scaleValue = value ? 'independent' : 'shared';
    spec.resolve.scale = { ...spec.resolve.scale, [key]: scaleValue };
    // rest of the code
}
  1. The if conditions checking for layoutMode === 'auto' are empty. If these conditions are not needed, they should be removed to avoid confusion.

📝🔍👍


Powered by Code Review GPT

@ObservedObserver ObservedObserver merged commit dc5c24c into main Apr 12, 2024
6 checks passed
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.

2 participants