Git Product home page Git Product logo

Comments (4)

75lb avatar 75lb commented on June 12, 2024

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.

75lb avatar 75lb commented on June 12, 2024

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.

mknj avatar mknj commented on June 12, 2024

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.

75lb avatar 75lb commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.