listBoxes.forEach((list) => { screen.append(list) })
function showResultsInDiagram(result) { var blessed = require('blessed'), screen = blessed.screen(); const contrib = require('blessed-contrib'); var barCharts = contrib.bar({ label: 'CPU tasks vs Memory', barWidth: 4, barSpacing: 6, xOffset: 0, height: "60%", width: "50%", maxHeight: 4 }) screen.append(barCharts) barCharts.setData({ titles: [result[0].name , result[1].name , result[2].name], data: [result[0].time, result[1].time, result[2].time] }) screen.render(); }
const render = (artist, title, lyrics) => { const screenTitle = chalk.yellow.bold(`${artist} - ${title}`) const highlightedLyrics = lyrics.replace(/^\[(.+)\]/gm, chalk.green.bold('[$1]')) const content = [screenTitle, '\n', highlightedLyrics].join('\n') const screen = blessed.screen({ smartCSR: true, fullUnicode: true }) const box = blessed.box({ width: '85%', height: '85%', left: 'center', top: 'center', scrollable: true, alwaysScroll: true, keys: true, vi: true, content: content }) screen.append(box) screen.render() screen.key(['escape', 'q', 'C-c'], () => process.exit(0)) return screen }
function renderChart(assetsData){ var blessed = require('blessed') , contrib = require('blessed-contrib') , screen = blessed.screen(); let titles=[],data=[],total = 0; for(let item in assetsData){ titles.push(item); data.push(assetsData[item].toFixed(1)); total += assetsData[item]; } var bar = contrib.bar( { label: chalk.blue('total assets size is : ') + chalk.yellow(`${total.toFixed(2)} kb`) + chalk.blue('. The details are as follows (kb): \n') , barWidth: 8 , barSpacing: 10 , xOffset: 5 , maxHeight: 7 , barBgColor: 'green' , barFgColor: 'red' }); screen.append(bar); //must append before setting data bar.setData({ titles, data }); screen.render(); }
}) screen.append(bookTable)
screen.append(box)