TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: X-spreadsheet – A JavaScript canvas spreadsheet for web

347 pointsby myliangover 6 years ago

37 comments

chatmastaover 6 years ago
Awesome job so far! This is obviously a monumental undertaking, especially since the quality of spreadsheet software seems mostly correlated with volume of features. This project looks like a great start, with an extensible architecture that will allow the project to eventually attain that &quot;volume of features.&quot; I think my favorite line of code is this one, from package.json:<p>&gt; &quot;dependencies&quot;: {}<p>:)
评论 #19022022 未加载
williamsteinover 6 years ago
This is amazing and fast. I&#x27;m complaining about it actually being easily broken only because I really wished this worked well, so I could build on it. It crashed for me on literally the very first thing I tried. I opened up the demo page, typed in 4 numbers in a column (in positions a5,a6,a7,a8), then typed &quot;=sum(a5:a8)&quot; in position a9, hit enter, and the demo crashed (with canvas all messed up). There&#x27;s a traceback in the console log that starts &quot;Uncaught TypeError: Cannot read property &#x27;render&#x27; of undefined at cell.js:146&quot;. I&#x27;m using Chrome 71. I refreshed and tried the same test and it crashed again. There is a test suite (<a href="https:&#x2F;&#x2F;github.com&#x2F;myliang&#x2F;x-spreadsheet&#x2F;tree&#x2F;master&#x2F;test" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myliang&#x2F;x-spreadsheet&#x2F;tree&#x2F;master&#x2F;test</a>) but the files have mostly not been touched in four months. In any case, awesome work - please make it even better!
评论 #19018478 未加载
评论 #19018667 未加载
评论 #19023872 未加载
davidy123over 6 years ago
AFAIK (and in evidence in this case) you can&#x27;t use the normal &quot;find in page&quot; (control-f) when using canvas. Consistency in functions like find is one of the greatest things about the browser, this approach removes it. Probably (!) an implementation will add its own find, which may be better or worse, but as browsers are best thought of as universal information vehicles, it won&#x27;t automatically fit into accessibility and extension schemes.
评论 #19018056 未加载
评论 #19018084 未加载
kevsimover 6 years ago
I think a description of why canvas was used would be nice in the README. My (probably naive) view is that browsers are pretty good at table-ish layouts so it’d be great to know why canvas was chosen.
评论 #19017759 未加载
评论 #19018504 未加载
评论 #19018359 未加载
评论 #19019764 未加载
评论 #19026404 未加载
评论 #19017918 未加载
评论 #19023171 未加载
sramamover 6 years ago
This looks really good - the speed of rendering of the default sheet was surprising and pleasant.<p>Is there a reason you switched from the earlier version in TypeScript[1] to this version in JavaScript?<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;myliang&#x2F;xspreadsheet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myliang&#x2F;xspreadsheet</a>
评论 #19024689 未加载
ryanianianover 6 years ago
The speed of the rendering is amazing compared especially to e.g. google sheets. I just informally timed both and gsheets was rendered and editable in 4 seconds whereas this took 0.2 seconds.<p>However nearly every native UI interaction seems kinda broken. Even entering a value on Firefox doesn&#x27;t work well. The first letter typed is entered into the cell but then every subsequent letter triggers firefox&#x27;s fine-in-page (which also doesn&#x27;t work as others have pointed out). Similarly copy&#x2F;paste doesn&#x27;t work, and the context menu (right-click) closes immediately. Maybe it works better in Chrome.<p>I wonder if there&#x27;s a case to be made for a hybrid rendering&#x2F;ui approach here. Rendering could be handled by canvas but native elements swapped in when actual text-editing is invoked?<p>Cool little demo in any case. I liked some of the simple but effective spreadsheet evaluation code.
dustingetzover 6 years ago
The canvas fonts are fuzzy? Stock OSX and Chrome, 4k display @ 3200 scaled<p>edit: <a href="https:&#x2F;&#x2F;github.com&#x2F;myliang&#x2F;x-spreadsheet&#x2F;issues&#x2F;5" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myliang&#x2F;x-spreadsheet&#x2F;issues&#x2F;5</a>
评论 #19021068 未加载
评论 #19022230 未加载
评论 #19020515 未加载
评论 #19021478 未加载
评论 #19032814 未加载
paulfitzover 6 years ago
Nice! Would be interested in how this compares to e.g. handsontable[1]. What do you think of audreyt&#x27;s ethercalc[2] myliang?<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;handsontable&#x2F;handsontable" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;handsontable&#x2F;handsontable</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;audreyt&#x2F;ethercalc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;audreyt&#x2F;ethercalc</a>
评论 #19017852 未加载
eternalny1over 6 years ago
This strongly goes against the best practices for Canvas:<p><a href="https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2dcontext&#x2F;#best-practices" rel="nofollow">https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2dcontext&#x2F;#best-practices</a>
评论 #19017869 未加载
cm2187over 6 years ago
It&#x27;s neat and fast. I do think that you should consider implementing a few more common excel shortcuts, to make it really seamless to an advanced excel user. For instance:<p>- CTRL ARROWS: to move on the grid to the next populated cell<p>- F2: edit the first cell of the selected range<p>- CTR ENTER: applies the content of the first cell of the selected range to the whole range (after you pressed F2 to edit it)<p>- when edit mode, pressing down arrow should leave edit mode and move to the cell below<p>- CTR *: select area<p>- SHIFT SPACE &#x2F; CTR SPACE: to select a row &#x2F; column
_bxg1over 6 years ago
I&#x27;ve theorized for a while about what it would look like to try and build a generic, app-focused layout engine on Canvas. The DOM gives you lots of things for free and has a long history of backward-compatibility, but both of those things come with huge costs in terms of performance and (to a degree) complexity. The fact that the DOM a) is stateful and b) was originally designed for documents, not apps, causes lots of challenges when what you want to build are apps. The entire reason React exists is to try and force the stateful DOM back into a functional paradigm.<p>I&#x27;d be very curious to learn how generic this project&#x27;s layout system is.
评论 #19019121 未加载
评论 #19023639 未加载
kybernetikosover 6 years ago
Here&#x27;s a canvas datagrid that I&#x27;ve come across in case anyone is interested in the genre:<p><a href="https:&#x2F;&#x2F;tonygermaneri.github.io&#x2F;canvas-datagrid&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tonygermaneri.github.io&#x2F;canvas-datagrid&#x2F;</a>
评论 #19018784 未加载
juretriglavover 6 years ago
This is amazing! I&#x27;m doing a deep dive into the code now to see how the extensibility is done.<p>Some folks here might be interested in Stencila Sheets too (<a href="https:&#x2F;&#x2F;stenci.la&#x2F;blog&#x2F;2017-08-features-stencila-sheets&#x2F;" rel="nofollow">https:&#x2F;&#x2F;stenci.la&#x2F;blog&#x2F;2017-08-features-stencila-sheets&#x2F;</a>, <a href="https:&#x2F;&#x2F;stenci.la&#x2F;blog&#x2F;introducing-sheets&#x2F;" rel="nofollow">https:&#x2F;&#x2F;stenci.la&#x2F;blog&#x2F;introducing-sheets&#x2F;</a>), <a href="https:&#x2F;&#x2F;github.com&#x2F;stencila&#x2F;stencila&#x2F;tree&#x2F;develop&#x2F;src&#x2F;sheet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;stencila&#x2F;stencila&#x2F;tree&#x2F;develop&#x2F;src&#x2F;sheet</a>. It&#x27;s a web-based spreadsheets where cells can execute other programming languages, such as R or Python.<p>Disclaimer: I know the authors. Even so, it&#x27;s very interesting tech.
评论 #19023203 未加载
based2over 6 years ago
alt: <a href="https:&#x2F;&#x2F;ethercalc.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ethercalc.net&#x2F;</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;audreyt&#x2F;ethercalc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;audreyt&#x2F;ethercalc</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;audreyt&#x2F;ethercalc&#x2F;blob&#x2F;master&#x2F;LICENSE.txt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;audreyt&#x2F;ethercalc&#x2F;blob&#x2F;master&#x2F;LICENSE.txt</a> cpal<p><a href="http:&#x2F;&#x2F;livescript.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;livescript.net&#x2F;</a> ^CoffeeScript
评论 #19022244 未加载
leonardoeloyover 6 years ago
First time I login in 5 years just to say GOOD EFFING JOB!
voctorover 6 years ago
This is really interesting! I&#x27;ve hoped of a scenegraph based web in the past, all rendered in a canvas (indexing can be done by serving a simplified html representation by checking the user agent). I think the most challenging part is text rendering, but some people have done some work in this area (<a href="https:&#x2F;&#x2F;github.com&#x2F;astiopin&#x2F;webgl_fonts" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;astiopin&#x2F;webgl_fonts</a>). Also, we may need some sort of API to trigger keyboard showing on mobile device. Anyway, congratulations!
Avery3Rover 6 years ago
In firefox entering a value in a cell for the first time works, but after that any time you enter a value in a cell it will duplicate the character.
barrowcliftover 6 years ago
Fun concept, but the cell text is blurry to the point of being a distraction for me, unfortunately. Is this a side effect of rendering to a canvas?
评论 #19017795 未加载
评论 #19017806 未加载
vdmover 6 years ago
<a href="http:&#x2F;&#x2F;mesh-spreadsheet.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mesh-spreadsheet.com&#x2F;</a>
crnoteover 6 years ago
Nice work! The UI is really good. In my one of the projects, I was looking for excel kind of functionality - and would like to give it a try. But the biggest value IMO excel offers is ability to define formulas. Is there any plans of adding that functionality?
评论 #19017991 未加载
deckar01over 6 years ago
The cells need to have some kind of hover styling. Without it the demo feels non-interactive.
评论 #19018239 未加载
nkingsyover 6 years ago
Looks very nice. Couple of nitpicks: 1. Tooltips go into a flicker loop when you hover over the tooltip arrow ( the triangle hanging off of the tooltip box ). 2. Dropdowns should close when you click a second time on the dropdown toggle.
评论 #19018133 未加载
niixover 6 years ago
Reminds me a bit of <a href="https:&#x2F;&#x2F;github.com&#x2F;SheetJS&#x2F;js-xlsx" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;SheetJS&#x2F;js-xlsx</a>
nwsmover 6 years ago
Very slick. Looks incredibly similar to google sheets.
评论 #19018102 未加载
rayvyover 6 years ago
This looks amazing (as everyone else said). Hope this remains somewhat stable so I&#x2F;we can build on top of it. 5 stars.
airstrikeover 6 years ago
I really like this and I can see the potential, but I certainly miss being able to type directly into the cell as opposed to double-clicking on it first. F2 should also enable editing and toggle between Edit and Enter modes.<p>It&#x27;s hard to spend more than a few seconds on the demo when my very first interaction with it hits a major roadblock like that.
评论 #19034644 未加载
tobyhinloopenover 6 years ago
It’s abbreviated as “XSS”, lol
PretzelFischover 6 years ago
Can this do multiple row per cell? I tried alt + enter and it didn&#x27;t work.
iddanover 6 years ago
If you&#x27;re looking for a simple, light and highly customizable Spreadsheet for the web checkout React Spreadsheet (<a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;react-spreadsheet" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;react-spreadsheet</a>).
laszlokorteover 6 years ago
scrolling is weird. looks like the canvas is bigger than the window. So when scrolling both the native document&#x2F;window scrolling is happing and the custom build scrolling of the canvas itself.
tianshuoover 6 years ago
Breaks easily, to reproduce bug: Put =B1 in A1 and =A1 in B1.
评论 #19018394 未加载
kovekover 6 years ago
Let&#x27;s render iframes in spreadsheet cells, and only display a selected element of the page in the iframe. We&#x27;ll build interfaces that help us deal with information accross webpages and websites in no time!
fareeshover 6 years ago
X Spread Sheet<p>XSS<p>probably not the best abbreviation
评论 #19018074 未加载
评论 #19017773 未加载
xiaodaiover 6 years ago
no web assembly used. If there is for the underlying calculation engine then it will be perfect.
marknadalover 6 years ago
Holy cow this is INCREDIBLE. Thank you.<p>~ sincerely, super critical HN person. Mind blown.
iraldirover 6 years ago
Was ready to open it and mock the results of a poor technological choice but it&#x27;s actually quite nice!
c-smileover 6 years ago
Well, &lt;canvas&gt; is not the best tool for doing such things.<p>&lt;canvas&gt; by its definition is essentially an &lt;img&gt; with its content (pixmap) modifiable from script side.<p>Better solution would be for browser to support immediate mode drawing. Like in my sciter (<a href="https:&#x2F;&#x2F;sciter.com" rel="nofollow">https:&#x2F;&#x2F;sciter.com</a>) where you can define immediate mode painting methods (Element.paintBackground|Content|Foreground|Outline):<p><pre><code> var elGrid = … elGrid.paintBackground = function(gfx) { for(var r in ROWS ) gfx.hline(0,r * cellh, width); for(var c in COLS ) gfx.vline(c * cellw, 0, height); } </code></pre> That paintBackground callback is invoked as a part of WM_PAINT window handler and with the same Graphics that window uses for rendering the DOM - no intermediate bitmaps.<p>Such model requires slightly different Graphics architecture than what is used by browsers. At least Path, Brush and TextLayout classes need to be added in order all that to work effectively.<p>Or to redefine all that on top of WebGL but that will be weird - browsers already have all 2D primitives (Direct2D, Skia, Cairo) implemented natively.