Skip to content

fix(playground): multiply percent-formatted values by 100 before display#10624

Merged
ovr merged 1 commit intocube-js:masterfrom
hank-sq:hank/fix-playground-percent-format
Apr 9, 2026
Merged

fix(playground): multiply percent-formatted values by 100 before display#10624
ovr merged 1 commit intocube-js:masterfrom
hank-sq:hank/fix-playground-percent-format

Conversation

@hank-sq
Copy link
Copy Markdown
Contributor

@hank-sq hank-sq commented Apr 3, 2026

Summary

The Playground displays format: percent values by appending a % suffix to the raw API value without multiplying by 100. This means a value of 0.273 (representing 27.3%) is shown as 0.273% instead of 27.3%.

Per the official documentation:

When using the percent format, do not multiply by 100 in your SQL expression. Presentation tools like Explore, Workbooks, and Dashboards apply this multiplication implicitly when displaying percent-formatted values, e.g., a value of 0.5 will be displayed as 50%.

This PR fixes all three rendering paths in the Playground:

  • QueryBuilderResults.tsx — Query Builder V2 results table
  • TableQueryRenderer.tsx — Drilldown modal table
  • ChartRenderer.tsx — Table chart type (was missing percent handling entirely)

Fixes #10623

Test plan

  • Create a cube with a format: percent measure (e.g. 1.0 * {purchases} / {count})
  • Query it in the Playground results table — value 0.5 should now display as 50%
  • Check the table chart type — same value should show 50.00%
  • Check drilldown modal — same value should show 50.00%

Made with Cursor

The Playground was displaying format: percent values with a raw %
suffix (e.g. 0.273%) instead of multiplying by 100 first (27.3%).
This contradicts the documented behavior where presentation tools
should apply the multiplication implicitly.

Fixes cube-js#10623

Made-with: Cursor
@hank-sq hank-sq requested a review from a team as a code owner April 3, 2026 21:14
@github-actions github-actions bot added client:playground Issues relating to the Developer Playground javascript Pull requests that update Javascript code pr:community Contribution from Cube.js community members. labels Apr 3, 2026
@ovr ovr merged commit 6f79820 into cube-js:master Apr 9, 2026
33 checks passed
@ovr
Copy link
Copy Markdown
Member

ovr commented Apr 9, 2026

Thank you @hank-sq for your contribution 🍰 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client:playground Issues relating to the Developer Playground javascript Pull requests that update Javascript code pr:community Contribution from Cube.js community members.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Playground does not multiply by 100 when displaying format: percent values

2 participants