EQWorks / widget-studio

Widget-creating tool for charts, maps, tables, stats
https://eqworks.github.io/widget-studio/
2 stars 3 forks source link

[G2M] Stat-widget percentage comparison view option #145

Closed kc-leung closed 2 years ago

kc-leung commented 2 years ago

fixes #152

https://user-images.githubusercontent.com/46459367/185987662-c0038b06-6db7-4bc8-ae40-2352d400cc19.mov

github-actions[bot] commented 2 years ago

📚 Storybook preview (updated to 08d149e55219f073098047ab3275cc824cefad0b)

geoerika commented 2 years ago

@kc-leung Sorry, but this doesn't fit the model for the Paymi percentage Stat. Take the image below:

Screen Shot 2022-08-04 at 6 01 48 PM

Now imagine, you have this data object:

{
   dealerId: 1,
   customers: 50, <- this is a value obtained after filtering in the dashboard
   customers_total: 100 <- this is the overall total nr of customers
}

What you want to do is to have customers column selected in the Value Configurations and select customers_total in your Percentage Configuration (need to come up with a better title). The Percentage part of the stat should not be the same as the Value part, because the title is different, it should be generated as part of the new Stat Percentage view with the specific Customer % label...... now, do you see why I insisted on not using multiple selections in Value Configuration for this particular Stat widgets?

Also, you calculate the percentage the other way. You want to calculate the percentage as customers/customers_total x 100, as to indicate what percentage customerscolumn value is from the customers_total value.