Comments (4)
Hi, whether you include a header row, and how it looks is up to you.. if you want the first row to include header titles, then pass it in with the table data array..
As an example, this project uses table-layout adding its own header row..
https://github.com/75lb/gfmt
from table-layout.
If we include a showHeader
option, how do you think the header row should look? What should the header titles be? The input array property names or something customisable? Should the header row be formatted? If so, how?
from table-layout.
I really like the simple interface with no complicated setup steps. If a user wants more, he can add his customized header to his data.
const data = [{"name":"udp","ms":395,"packets":20000,"rawbytes":1040000,"bytes":600000,"ratio":0.58},{"name":"http","ms":1554,"packets":20052,"rawbytes":3413448,"bytes":2090000,"ratio":0.61},{"name":"https","ms":1859,"packets":20215,"rawbytes":3866296,"bytes":2532090,"ratio":0.65},{"name":"mqtt2","ms":1312,"packets":40071,"rawbytes":3004749,"bytes":360059,"ratio":0.12},{"name":"mqtt1","ms":712,"packets":20216,"rawbytes":1614307,"bytes":280035,"ratio":0.17},{"name":"mqtt0","ms":139,"packets":53,"rawbytes":223549,"bytes":220035,"ratio":0.98}]
console.log(new TableLayout(data,{headers:true}).toString())
name ms packets rawbytes bytes ratio
udp 395 20000 1040000 600000 0.58
http 1554 20052 3413448 2090000 0.61
https 1859 20215 3866296 2532090 0.65
mqtt2 1312 40071 3004749 360059 0.12
mqtt1 712 20216 1614307 280035 0.17
mqtt0 139 53 223549 220035 0.98
from table-layout.
Hi.. If you want a header like the one you described above, simply add the header row yourself to the top of the array you pass into table-layout
..
I don't think I will add the headers: true
option you decribed, people will have their own personal preference on how the default header should look.. plus it is easy to simply add the header row manually.
from table-layout.
Related Issues (10)
- does not autosize to terminal width when piped into less HOT 1
- How to add delimiter? HOT 2
- table-layout v3 depends on command-line-usage v6 HOT 1
- empty columns HOT 1
- cell-width incorrect when containing multi-byte characters
- Remove core-js? HOT 2
- Upgrade deep-extend HOT 2
- instantiation fails in ionic HOT 6
- process.stdout.columns and process.stderr.columns are not always available HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from table-layout.