beeminder / road

Beebrain and Visual Graph Editor
http://graph.beeminder.com
Other
11 stars 3 forks source link

Sandbox aura=true throws error #215

Open bsoule opened 3 years ago

bsoule commented 3 years ago
### Desiderata
- [X] Confirm that it doesn't count as user-visible
- [ ] Update the compiled version of the bgraph stuff on the Beebody side

Replicata

  1. sandbox = new bsandbox({divGraph: div})
  2. sandbox.newGoal("fatloser", "w", 0, 75, false, {vini: 75})

Expectata

Display a fatloser graph in my div.

Resultata

A blank graph in the div, and the following output in the console:

> beemElf.bs.sandbox.newGoal("fatloser", "w", 0, 75, 1, {vini: 75})
  newGoal(fatloser, w, 0, 75, 1)
  goal {div: div.bmndrgraph, graph: bgraph, gtype: "fatloser", rfin: 0, vini: 75, …}
  bsandbox.reloadGoal(): Regenerating graph ********
  reGraph
 Uncaught TypeError: Polyfit is not a constructor
    at Object.self.smooth  (bsbpack.js?body=1:1879)
    at beebrain.reloadRoad (bsbpack.js?body=1:3194)
    at genStats            (bsbpack.js?body=1:3250)
    at new beebrain        (bsbpack.js?body=1:3287)
    at loadGoal            (bsbpack.js?body=1:5476)
    at bgraph.loadGoalJSON (bsbpack.js?body=1:8824)
    at reGraph             (bsbpack.js?body=1:9400)
    at reloadGoal          (bsbpack.js?body=1:9404)
    at bsandbox.newGoal    (bsbpack.js?body=1:9586)
    at <anonymous>:1:20

Nota Nebulosa

Same error for a "gainer" goal. Removing the aura: true in the graph options config for the "fatloser" and "gainer" types resolves the error. But aura does work as a setting for fatloser/gainer type graphs in general, (and is aura:true is the same/correct default as we use in Beebody when we set up these goals), so it's probably specific to how sandbox is using the bgraph code.

Cognata

Verbata: browser console errors, sandbox,

saranli commented 2 years ago

This was due to pikaday and polyfit not being included in the compiled and minified js files in lib/js. I fixed the gulpfile to include these in the packs, but if that's not appropriate, then pikaday and polyfit need to be loaded separately within html files.