Fix optionsRaw number formatting and improve JavaScript function support #36
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.
This PR resolves an issue where users were having trouble with number formatting in Chart.js tooltips and axis labels when using the
optionsRaw()method with JavaScript functions.Problem
Users reported that their Brazilian Real number formatting wasn't working when using
optionsRaw()with JavaScript callback functions:Root Cause
Investigation revealed two issues:
json_encode()usage: The code was usingjson_encode($data, true)wheretruewas incorrectly passed as flags parameteroptionsRaw()syntaxSolution
Core Fixes
json_encode()calls to use proper flags:json_encode($data, JSON_THROW_ON_ERROR)optionsRaw()method to catch common formatting errorsDocumentation & Examples
optionsRaw()issues"responsive": true) and unquoted JavaScript syntax (responsive: true) are validTesting
optionsRaw()scenariosVerification
The user's original code is actually correct and works as expected. Through browser testing, we confirmed that both syntax styles produce proper formatting:
If users are still experiencing issues, they should check:
Fixes #34.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/pestphp/pest-plugin/zipball/e05d2859e08c2567ee38ce8b005d044e72648c0b/usr/bin/php8.3 -n -c /tmp/ToIUD3 /usr/bin/composer install(http block)https://api.github.com/repos/symfony/process/zipball/710e27879e9be3395de2b98da3f52a946039f297/usr/bin/php8.3 -n -c /tmp/ToIUD3 /usr/bin/composer install(http block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.