yaronn /blessed-contrib

Build terminal dashboards using ascii/ansi art and javascript

★ 15,773⑂ 832👁 303⑃ 98● 150▤ 0
JavaScriptMITCreated 2015-01-14
+1
Daily
15,773
stars
832
forks
303
watchers
98
prs
150
issues
0
releases

README

blessed-contrib

Build dashboards (or any other application) using ascii/ansi art and javascript.

Friendly to terminals, ssh and developers. Extends blessed with custom  drawille and other widgets.

You should also check WOPR: a markup for creating terminal reports, presentations and infographics.


Contributors:

Yaron Naveh (@YaronNaveh)
Chris (@xcezzz)
Miguel Valadas (@mvaladas)
Liran Tal (@lirantal)

Demo (full size):





(source code)

Running the demo

    git clone https://github.com/yaronn/blessed-contrib.git
    cd blessed-contrib
    npm install
    node ./examples/dashboard.js

Works on Linux, OS X and Windows. For Windows follow the pre requisites.

 Installation (to build custom projects)

Please use the latest stable version of Node.js LTS and install blessed-contrib and its peer dependency blessed as follows:

sh
npm install blessed blessed-contrib


 Usage

You can use any of the default widgets of blessed (texts, lists and etc) or the widgets added in blessed-contrib (described below). A layout is optional but useful for dashboards. The widgets in blessed-contrib follow the same usage pattern:

javascript
   var blessed = require('blessed')
     , contrib = require('blessed-contrib')
     , screen = blessed.screen()
     , line = contrib.line(
         { style:
           { line: "yellow"
           , text: "green"
           , baseline: "black"}
         , xLabelPadding: 3
         , xPadding: 5
         , label: 'Title'})
     , data = {
         x: ['t1', 't2', 't3', 't4'],
         y: [5, 1, 7, 5]
      }
   screen.append(line) //must append before setting data
   line.setData([data])

   screen.key(['escape', 'q', 'C-c'], function(ch, key) {
     return process.exit(0);
   });

   screen.render()


See below for a complete list of widgets.


 Widgets

Line Chart

Bar Chart

Stacked Bar Chart

Map

Gauge

Stacked Gauge

Donut

LCD Display

Rolling Log

Picture

Sparkline

Table

Tree

Markdown

 Line Chart



javascript
   var line = contrib.line(
         { style:
           { line: "yellow"
           , text: "green"
           , baseline: "black"}
         , xLabelPadding: 3
         , xPadding: 5
         , showLegend: true
         , wholeNumbersOnly: false //true=do not show fraction in y axis
         , label: 'Title'})
   var series1 = {
         title: 'apples',
         x: ['t1', 't2', 't3', 't4'],
         y: [5, 1, 7, 5]
      }
   var series2 = {
         title: 'oranges',
         x: ['t1', 't2', 't3', 't4'],
         y: [2, 1, 4, 8]
      }
   screen.append(line) //must append before setting data
   line.setData([series1, series2])

Examples: simple line chart, multiple lines, 256 colors

 Bar Chart



javascript
    var bar = contrib.bar(
       { label: 'Server Utilization (%)'
       , barWidth: 4
       , barSpacing: 6
       , xOffset: 0
       , maxHeight: 9})
    screen.append(bar) //must append before setting data
    bar.setData(
       { titles: ['bar1', 'bar2']
       , data: [5, 10]})


 Stacked B

Top issues

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON