-
• #3
Yes, the issue is the app loader isn't handling modules yet.
If you upload this file: https://www.espruino.com/modules/graph.min.js
to a Storage file called
graph
then you should be sorted though -
• #4
Confirmed, then it is working.
Any ETA for the app loader change?What to do in the meantime, add the graph module to the app?
-
• #5
Any ETA for the app loader change?
Not yet. I'll probably just combine it with the minification changes by basically pulling in the Web IDE backend.
I think the most sane solution is to just include it up the top of the source for now:
Modules.addCached("graph",function(){exports.drawAxes=function(b,c,a){function h(a){return e+m*(a-t)/x}function l(a){return f+g-g*(a-n)/u}var k=a.padx||0,d=a.pady||0,t=-k,w=c.length+k-1,n=(void 0!==a.miny?a.miny:a.miny=c.reduce(function(a,b){return Math.min(a,b)},c[0]))-d;c=(void 0!==a.maxy?a.maxy:a.maxy=c.reduce(function(a,b){return Math.max(a,b)},c[0]))+d;a.gridy&&(d=a.gridy,n=d*Math.floor(n/d),c=d*Math.ceil(c/d));var e=a.x||0,f=a.y||0,m=a.width||b.getWidth()-(e+1),g=a.height||b.getHeight()-(f+1);a.axes&&(null!==a.ylabel&& (e+=6,m-=6),null!==a.xlabel&&(g-=6));a.title&&(f+=6,g-=6);a.axes&&(b.drawLine(e,f,e,f+g),b.drawLine(e,f+g,e+m,f+g));a.title&&(b.setFontAlign(0,-1),b.drawString(a.title,e+m/2,f-6));var x=w-t,u=c-n;u||(u=1);if(a.gridx){b.setFontAlign(0,-1,0);var v=a.gridx;for(d=Math.ceil((t+k)/v)*v;d<=w-k;d+=v){var r=h(d),p=a.xlabel?a.xlabel(d):d;b.setPixel(r,f+g-1);var q=b.stringWidth(p)/2;null!==a.xlabel&&r>q&&b.getWidth()>r+q&&b.drawString(p,r,f+g+2)}}if(a.gridy)for(b.setFontAlign(0,0,1),d=n;d<=c;d+=a.gridy)k=l(d), p=a.ylabel?a.ylabel(d):d,b.setPixel(e+1,k),q=b.stringWidth(p)/2,null!==a.ylabel&&k>q&&b.getHeight()>k+q&&b.drawString(p,e-5,k+1);b.setFontAlign(-1,-1,0);return{x:e,y:f,w:m,h:g,getx:h,gety:l}};exports.drawLine=function(b,c,a){a=a||{};a=exports.drawAxes(b,c,a);var h=!0,l;for(l in c)h?b.moveTo(a.getx(l),a.gety(c[l])):b.lineTo(a.getx(l),a.gety(c[l])),h=!1;return a};exports.drawBar=function(b,c,a){a=a||{};a.padx=1;a=exports.drawAxes(b,c,a);for(var h in c)b.fillRect(a.getx(h-.5)+1,a.gety(c[h]),a.getx(h+ .5)-1,a.gety(0));return a}}); ... your code here
-
• #6
I think the most sane solution is to just include it up the top of the source for now:
I will do that, thanks.
-
• #7
Hi, I'm using forked version of AppLoader. Is it still the best choice to include module into source as stated above?
-
• #8
Actually the App Loader was updated several months ago, so there should be no need for this now. I believe any referenced modules should automatically get pulled in when they are referenced?
-
• #9
Because few days ago I forked "BangleApps" repository to dive deeper into Espruino ecosystem. I was not able to use "Vertical watch face" from forked repo until I've not inserted Font8x12 module directly into application.
Maybe should I fork modules repository too? -
• #10
Odd - it shouldn't be needed. Are there any log messages in the chrome dev console that might help?
If you're uploading a file named
.min.js
then no transforms will be performed, so that might be it? -
• #11
Just looked into this and it's now fixed. I'm afraid a recent update to the app loader meant it stopped parsing code for modules in a lot of cases, but it's now sorted.
-
• #12
Yes, I can confirm. It work without module manually included. Thank You.
Hi,
I want to display a graph:
When uploading to RAM from IDE, the code works, the graph is displayed.
When installed as an application from the app loader, I get this error in IDE and the graph is not displayed:
Thanks
Christian