refactor: chart widget chart.js implementation#19652
Open
ahmed-rashad-alnaggar wants to merge 5 commits intofilamentphp:4.xfrom
Open
refactor: chart widget chart.js implementation#19652ahmed-rashad-alnaggar wants to merge 5 commits intofilamentphp:4.xfrom
ahmed-rashad-alnaggar wants to merge 5 commits intofilamentphp:4.xfrom
Conversation
Signed-off-by: ahmed-rashad-alnaggar <131385452+ahmed-rashad-alnaggar@users.noreply.github.com>
Added maxHeight property to chart widget for responsive design. Signed-off-by: ahmed-rashad-alnaggar <131385452+ahmed-rashad-alnaggar@users.noreply.github.com>
Signed-off-by: ahmed-rashad-alnaggar <131385452+ahmed-rashad-alnaggar@users.noreply.github.com>
Member
2026-04-08.00.38.10.mov@ahmed-rashad-alnaggar |
Contributor
Author
|
@People-Sea |
Refactor chart initialization and resize observer setup for improved readability. Signed-off-by: ahmed-rashad-alnaggar <131385452+ahmed-rashad-alnaggar@users.noreply.github.com>
Signed-off-by: ahmed-rashad-alnaggar <131385452+ahmed-rashad-alnaggar@users.noreply.github.com>
Contributor
Author
|
Fixed! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, this PR is focused on improving performance of the chart.js implementation by not destroying and re-initializing the chart on every event, and also improve animating chart by removing the default
animation.duration = 0as this should not be the default case as the charts should animate to introduce a beautiful data visualization, handled missing or miss configured parts while initializing the chart, for example in the discussion #19609 with @danharrin I understood that the desired behavior is to rely onResizeObservernot chart responsiveness options, but actually the old implementation was still relies on it by not settingoptions.responsivetofalseso the chart was resized and calculations are done by many "providers".English is not my native language so i used AI to generate a well detailed description of the changes, rather than that I spent hours developing (only the
updateChartDatafunction is AI driven) and testing the code with all the possibilities to guarantee it is working (going from no data to data and vice versa with applying different cases like resizing). now the chart is animated when initialized for the first time or by updating data (not by a reset ugly animation but by a beautiful update and data changed animation). also the performance has significantly improved.START OF AI DESCRIPTION
Overview
This PR refactors the Filament Chart Widget's Alpine.js component and its companion Blade template. The primary goals are:
Chartdestroy/recreate cycles on resize and theme changes, replacing them with targeted, in-place updates.updateChartData,updateChartTheme,getChartFallbackColors,whenChart) to reduce duplication and improve readability.Chart.defaultsfor per-instance concerns (colors, font), scoping those values to individual chart options instead.maxHeightprop from the JS component API, detecting it from the canvas element's own style at runtime.@styledirective to applywidth,heightandmax-heightcss properties so the chart can animate properly.END OF AI DESCRIPTION
Feel free to ask any question!