Show HN: X-spreadsheet – A JavaScript canvas spreadsheet for web
github.com
github.com
> "dependencies": {}
:)
to anyone else wondering: you can browse the available function with the button to the right. ( SUM, AVERAGE, MIN, MAX and CONCAT )
https://exceljet.net/excel-functions/excel-sumproduct-functi...
All I can say is, I am grateful I don’t have to deal with other people’s spreadsheets.
My jam is programming languages and SQL, not obscure formulas and weird constructs made from surprising ways of using them.
One very neat thing about this approach is that read-only access works without javascript
For example, Google Sheets hijacks command/control-F to show their own search for this reason.
That said, X-Spreadsheet does also use DOM for some text interactions at least—seemingly much less so than Google from what I can initially/briefly see though.
The browser certainly makes this convenient... until you have more than a few thousand cells. At some point even just having the whole table loaded into the DOM is too layout and memory intensive (except on servo, sometimes).
When you try, then, to work around those limitations, continuing to use the DOM for it becomes impractical. This gets especially difficult with a spreadsheet, where row and column size is user defined, and thus a scroll offset is a sum of all of those sizes.
I've done this several times, so I eventually settled on a bucketed, run-length encoded cache of row and column sizes, but keeping this data structure current was a mess. The mess further escalated since eventually I worked on an application where the row and column sizes could change in a different chunk with a network update, and that would need to be reconciled somehow.
2 easy to write code
github.com/xspreadsheet used table
In general, unless you are doing something very simple, replicating the dom and css engine with canvas is an uphill battle.
That being said, I love that the xterm terminal uses a canvas renderer and now going to move to a webgl renderer. Terminal like UI with monospaced fonts are an excellent candidate for low level rendering.
As an ultimate solution - to remove DOM at all and replace it by <canvas>. Minimization of updates is developer's business in this case. Presumably he/she will be able to do it better other than to walk through all DOM elements while handling, say this:
html:hover span { color:red; }You can style them such a way that updates do not cause re-layout, except for auto-sized cells.
Another big reason is wasm. It would be a big performance increase to write the layout engine in Rust/wasm. Native performance would be great.
Is there a reason you switched from the earlier version in TypeScript[1] to this version in JavaScript?
However nearly every native UI interaction seems kinda broken. Even entering a value on Firefox doesn't work well. The first letter typed is entered into the cell but then every subsequent letter triggers firefox's fine-in-page (which also doesn't work as others have pointed out). Similarly copy/paste doesn't work, and the context menu (right-click) closes immediately. Maybe it works better in Chrome.
I wonder if there's a case to be made for a hybrid rendering/ui approach here. Rendering could be handled by canvas but native elements swapped in when actual text-editing is invoked?
Cool little demo in any case. I liked some of the simple but effective spreadsheet evaluation code.
Here (MS Edge, Windows, High-DPI screen):
http://cloud.sciter.com/index.php/s/fcTbout1oQqwIJg
You see how different text rendering in normal DOM rendering (text "Normal") and the text inside canvas.
Grayscale AA text looks blurred. Grayscale AA works only for relatively large font sizes, for standard UI text sizes it is highly non-desirable.
Yet all that with the price of memory and CPU consumption - number of pixels to rasterize on 192 PPI monitor is four times of the one with "standard" 96 PPI.
I am interested in talking, as I work on ethercalc.
The big issue I have seen is formula calculation speed. I understand render speed is also an issue. I don't know your use case, but the use cases I see tend to have formulas. It is hard to makes formulas fast enough with JS.
The main speed problems with ethercalc are loading the data from the server and calculating the formulas. I did strip down the code to remove these problems to make web apps work.
Web apps as simple as spreadsheets. My aim is to make it easy to add a UI to a spreadsheet. Spreadsheets often have a UI bottle neck. I have seen many spreadsheets that would be much more valuable to business if it had a UI, as more people could use it. So I added UI formulas to ethercalc http://sheet.cellmaster.com.au/examples
Eddy.
- CTRL ARROWS: to move on the grid to the next populated cell
- F2: edit the first cell of the selected range
- CTR ENTER: applies the content of the first cell of the selected range to the whole range (after you pressed F2 to edit it)
- when edit mode, pressing down arrow should leave edit mode and move to the cell below
- CTR *: select area
- SHIFT SPACE / CTR SPACE: to select a row / column
I'd be very curious to learn how generic this project's layout system is.
This post is a good read: https://medium.com/flutter-io/hummingbird-building-flutter-f...
It's a very solid project, also based on canvas, and works (mostly) as advertised, but there are some strange procedures around repo maintenance and releases, and it's a massive dependency bundle. Docs can also out of date or missing information. If you don't require much customization and intend to release it as an internal tool, it will suit your purposes. But anything beyond that, I would look elsewhere. Nothing against adazzle, it's just an old repo and they inherited quite a bit of technical debt.
Some folks here might be interested in Stencila Sheets too (https://stenci.la/blog/2017-08-features-stencila-sheets/, https://stenci.la/blog/introducing-sheets/), https://github.com/stencila/stencila/tree/develop/src/sheet. It's a web-based spreadsheets where cells can execute other programming languages, such as R or Python.
Disclaimer: I know the authors. Even so, it's very interesting tech.
Development of the frontend has indeed slowed down while we focus on more lower-level "backend" tools for research reproduciblity (e.g. https://github.com/stencila/dockter).
But were currently recruiting for a frontend designer and an engineer. So will be definitely be getting back to the interfaces soon!
I added these :)
https://developer.mozilla.org/en-US/docs/Web/API/Window/devi...
In general <canvas> is acceptable for graphics but not for text.
This certainly feels interactive when I interact with it like I would any other spreadsheet. Are you unable to select cells and/or type in them?
None of the spreadsheet apps I tested have hover styling, but that seems like a violation of basic UX principles. Cells are the primary element of interaction, so I would expect some visual indicator to communicate interactivity (even if it is just the cursor changing).
It'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.
XSS
probably not the best abbreviation
I thought it was pretty common. I guess it depends on the environment you work in.
~ sincerely, super critical HN person. Mind blown.
<canvas> by its definition is essentially an <img> with its content (pixmap) modifiable from script side.
Better solution would be for browser to support immediate mode drawing. Like in my sciter (https://sciter.com) where you can define immediate mode painting methods (Element.paintBackground|Content|Foreground|Outline):
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);
}
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.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.
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.