evidence icon indicating copy to clipboard operation
evidence copied to clipboard

Add weighted mean aggregation to DataTable

Open hughess opened this issue 2 years ago β€’ 4 comments

Description

Adds weightedMean as a total aggregation in DataTable/Column. Should be used with weightCol to specify the column to pull the weight values from for the calculation. If no weightCol supplied, a weight of 1 is used for all values, resulting in the same output as the mean aggregation.

datatable-totalrow-agg-functions

<DataTable data={countries} totalRow=true rows=5>
  <Column id=country/>
  <Column id=gdp_usd totalAgg=sum/>
  <Column id=gdp_growth totalAgg=weightedMean weightCol=gdp_usd fmt='pct2'/>
  <Column id=population totalAgg=mean fmt='#,##0"M"'/>
</DataTable>

Checklist

  • [x] For UI or styling changes, I have added a screenshot or gif showing before & after
  • [x] I have added a changeset
  • [x] I have added to the docs where applicable

hughess avatar Feb 25 '24 02:02 hughess

πŸ¦‹ Changeset detected

Latest commit: 008ce9205d60f1a3153439f76fa5ef2dc888c12e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@evidence-dev/core-components Patch
evidence-docs Patch
@evidence-dev/components Patch
@evidence-dev/evidence Patch
evidence-test-environment Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Feb 25 '24 02:02 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
docs βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Feb 28, 2024 10:54pm

vercel[bot] avatar Feb 25 '24 02:02 vercel[bot]

Deploy Preview for evidence-development-workspace ready!

Name Link
Latest commit 008ce9205d60f1a3153439f76fa5ef2dc888c12e
Latest deploy log https://app.netlify.com/sites/evidence-development-workspace/deploys/65dfb974b7d31200082b09ea
Deploy Preview https://deploy-preview-1635--evidence-development-workspace.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Feb 25 '24 02:02 netlify[bot]

Not sure why all of the changesets are showing as deleted with this branch, this might need to have origin/next merged in

ItsMeBrianD avatar Feb 26 '24 21:02 ItsMeBrianD

Can this be merged

archiewood avatar Feb 28 '24 16:02 archiewood

Just attempting to get rid of the deleted changesets then will be good to go

hughess avatar Feb 28 '24 16:02 hughess

@ItsMeBrianD i think this might be caused by main not being merged back into next?

hughess avatar Feb 28 '24 16:02 hughess

I'm at a loss for how to remove the deleted changesets - I've merged with next and synced, but those changes don't seem to be taking effect

hughess avatar Feb 28 '24 22:02 hughess

solved?

archiewood avatar Feb 28 '24 22:02 archiewood

That did most of it! Now I’m just not sure why Cormick’s changes are showing up here - they were already merged to next

hughess avatar Feb 28 '24 22:02 hughess