airbnb / visx

🐯 visx | visualization components
https://airbnb.io/visx
MIT License
19.36k stars 711 forks source link

[mock-data] improve genStats customizability #1069

Open williaster opened 3 years ago

williaster commented 3 years ago

Originally posted by @LoiKos in #1058


I just add 2 suggestions that makes genStats maybe easier to use

  1. xAxis customization
// today 
  const boxPlot = {
      x: `${xAxis(i)}`,
      ...
      }
// idea
function genStats(
  number,
  random = defaultRandom,
  randomOffset = defaultRandomOffset,
  xAxis = (i) => `Statistics ${i}`
) {
...
  const boxPlot = {
      x: xAxis(i),
      ...
      }
   ...
   }
  1. I don't know if you are looking into this but i build a boxPlots based 12 month. So it's great to be able to generate boxPlots for each month directly but unfortunately you don't get the original data (only bin) for each month so user are not able to calculate for example yearly mean/median. I think it could be a great addition to genStats. There is multiple options to add this functionality so if you are interested i could give you some examples 😄
LoiKos commented 3 years ago

Sorry didn't have time to look into this already. I'll try to send you a PR about this :)