espruino / EspruinoDocs

See http://espruino.com for the complete Espruino Documentation - many links in this repository will not work
http://www.espruino.com/
Other
259 stars 284 forks source link

graph module bug #697

Closed d3nd3 closed 1 year ago

d3nd3 commented 1 year ago
var data = [1,3,8,10,12,10,8,3,1];
g.clear();
require("graph").drawBar(g, data, {
  miny: 0,
  axes : true,
  gridx : 1,
  gridy : 5
});

https://github.com/espruino/EspruinoDocs/blob/36d65564f17dd11b521b9ba48e42992dd8dd6499/modules/graph.js#L101

i is a string because key of array. "1" + 0.5 == "10.5" "11" + 0.5 == "110.5"

gfwilliams commented 1 year ago

Thanks! just fixed.

It's because recently Espruino changed to make array indices strings (to match the JS spec)