Skip to content

Make decimal places in UI consistent#586

Closed
jordangeorge wants to merge 2 commits intoopenpredictionmarkets:mainfrom
jordangeorge:fix/decimal-places
Closed

Make decimal places in UI consistent#586
jordangeorge wants to merge 2 commits intoopenpredictionmarkets:mainfrom
jordangeorge:fix/decimal-places

Conversation

@jordangeorge
Copy link
Contributor

Addresses #443

Couldn't find an instance of 10 decimal places being used. I did, however, see 3 and 4. Let me know if I missed the 10.

@pwdel
Copy link
Member

pwdel commented Oct 28, 2025

OK @jordangeorge the only other place I'm seeing more than two sig fig's is:

image

Settings for that are here:

https://github.com/openpredictionmarkets/socialpredict/blob/main/frontend/src/components/charts/MarketChart.jsx

This is a stepped line chart.

https://www.chartjs.org/docs/latest/samples/line/stepped.html

I don't know if there is a "decimal," property in this chart.

However under another chart type:

https://www.chartjs.org/docs/latest/samples/area/line-drawtime.html

They do show decimals: 2.

const inputs = {
  min: -100,
  max: 100,
  count: 8,
  decimals: 2,
  continuity: 1
};

const generateLabels = () => {
  return Utils.months({count: inputs.count});
};

Utils.srand(3);
const generateData = () => (Utils.numbers(inputs));

Another thought ... is there a way we could globally adjust the number of significant figures displayed?

E.g., it seems like we are making an opinion that the decimals should always be 2...what if someone wants up to say 4?

I could see us putting a, 'sig figs display' setting in the game configuration and then pinging a service / the backend for this amount, which then gets pushed into a variable in the frontend that all of these pages and components inherit from. What do you think...?

https://github.com/openpredictionmarkets/socialpredict/blob/main/backend/setup/setup.yaml

@pwdel pwdel added the enhancement New feature or request label Oct 28, 2025
@pwdel pwdel linked an issue Oct 28, 2025 that may be closed by this pull request
@pwdel pwdel self-requested a review October 28, 2025 12:54
Copy link
Member

@pwdel pwdel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments

{error && <div className="error-message">Error: {error}</div>}
{projectionData && (
<p>New Market Probability: {projectionData.projectedprobability.toFixed(4)}</p>
<p>New Market Probability: {projectionData.projectedprobability.toFixed(2)}</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so here is what I'm seeing on the market projection... two sig fig's.

Image

</td>
<td className='px-6 py-4 whitespace-nowrap text-sm text-gray-300'>
{marketData.lastProbability.toFixed(3)}
{marketData.lastProbability.toFixed(2)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is what I see on the status table

Image

@astrosnat astrosnat self-requested a review November 4, 2025 06:31
@astrosnat
Copy link
Collaborator

@jordangeorge, thanks for your work on this!

When I mouse over the stepped line chart on dev I still get like 10 significant figures:

image

@pwdel, I like the idea of admins being able to adjust # of significant figures. But really, we don't have the precision for 10 significant figures to mean anything right now :')

Copy link
Collaborator

@astrosnat astrosnat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

still on 10 significant figures

@pwdel
Copy link
Member

pwdel commented Nov 4, 2025

@astrosnat I talked through a solution to that here on this comment. Is this something you would be willing to look into...? #586 (comment)

@astrosnat
Copy link
Collaborator

@astrosnat I talked through a solution to that here on this comment. Is this something you would be willing to look into...? #586 (comment)

Totally, will do this today

@astrosnat
Copy link
Collaborator

added new branch in main repo fix/decimal-places

@astrosnat
Copy link
Collaborator

Closing this - it works, the custom significant figure support is going to be revisited later

@astrosnat astrosnat closed this Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consistent number of decimal places in UI

3 participants