{"action":"created","issue":{"url":"https://api.github.com/repos/yaronn/blessed-contrib/issues/7","labels_url":"https://api.github.com/repos/yaronn/blessed-contrib/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/yaronn/blessed-contrib/issues/7/comments","events_url":"https://api.github.com/repos/yaronn/blessed-contrib/issues/7/events","html_url":"https://github.com/yaronn/blessed-contrib/issues/7","id":54464254,"number":7,"title":"No Active Screen Error","user":{"login":"sarcasticHippo","id":1841823,"avatar_url":"https://avatars.githubusercontent.com/u/1841823?v=3","gravatar_id":"","url":"https://api.github.com/users/sarcasticHippo","html_url":"https://github.com/sarcasticHippo","followers_url":"https://api.github.com/users/sarcasticHippo/followers","following_url":"https://api.github.com/users/sarcasticHippo/following{/other_user}","gists_url":"https://api.github.com/users/sarcasticHippo/gists{/gist_id}","starred_url":"https://api.github.com/users/sarcasticHippo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarcasticHippo/subscriptions","organizations_url":"https://api.github.com/users/sarcasticHippo/orgs","repos_url":"https://api.github.com/users/sarcasticHippo/repos","events_url":"https://api.github.com/users/sarcasticHippo/events{/privacy}","received_events_url":"https://api.github.com/users/sarcasticHippo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-15T15:46:51Z","updated_at":"2015-01-16T15:15:36Z","closed_at":null,"body":"Hi,\r\nI am facing following error: \r\nError: No active screen.\r\n    at Node.screen (/home/training/node_modules/blessed/lib/widget.js:37:26)\r\n    at Line.Node (/home/training/node_modules/blessed/lib/widget.js:37:58)\r\n    at Line.Element (/home/training/node_modules/blessed/lib/widget.js:1712:8)\r\n    at Line.Box (/home/training/node_modules/blessed/lib/widget.js:3602:11)\r\n    at Line.Canvas (/home/training/node_modules/blessed-contrib/widget/canvas.js:16:7)\r\n    at new Line (/home/training/node_modules/blessed-contrib/widget/charts/line-simple.js:22:10)\r\n    at Object.Line [as obj] (/home/training/node_modules/blessed-contrib/widget/charts/line-simple.js:11:12)\r\n    at Grid.applyLayout (/home/training/node_modules/blessed-contrib/layout/grid.js:53:60)\r\n    at Grid.applyLayout (/home/training/node_modules/blessed-contrib/layout/grid.js:43:18)\r\n    at Object.<anonymous> (/home/training/blessed-contrib/examples/dashboard.js:66:6)\r\n\r\nwhen i tried the sample widgets while dashboard.js worked fine. Only difference i could find was that i was using require('blesseed-contrib') in place of ('../index') so when i changed that in dashboard.js, it returned the same error.\r\n\r\nI have installed blessed and blessed-contrib.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yaronn/blessed-contrib/issues/comments/70267387","html_url":"https://github.com/yaronn/blessed-contrib/issues/7#issuecomment-70267387","issue_url":"https://api.github.com/repos/yaronn/blessed-contrib/issues/7","id":70267387,"user":{"login":"sarcasticHippo","id":1841823,"avatar_url":"https://avatars.githubusercontent.com/u/1841823?v=3","gravatar_id":"","url":"https://api.github.com/users/sarcasticHippo","html_url":"https://github.com/sarcasticHippo","followers_url":"https://api.github.com/users/sarcasticHippo/followers","following_url":"https://api.github.com/users/sarcasticHippo/following{/other_user}","gists_url":"https://api.github.com/users/sarcasticHippo/gists{/gist_id}","starred_url":"https://api.github.com/users/sarcasticHippo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarcasticHippo/subscriptions","organizations_url":"https://api.github.com/users/sarcasticHippo/orgs","repos_url":"https://api.github.com/users/sarcasticHippo/repos","events_url":"https://api.github.com/users/sarcasticHippo/events{/privacy}","received_events_url":"https://api.github.com/users/sarcasticHippo/received_events","type":"User","site_admin":false},"created_at":"2015-01-16T15:15:35Z","updated_at":"2015-01-16T15:15:35Z","body":"**Its the same code as in current dashboard.js with only change in require (i.e. 2nd line) changed which is highlighted =>**\r\n\r\n    var blessed = require('blessed')\r\n     , contrib = require('blessed-contrib')\r\n\r\nvar screen = blessed.screen()\r\n\r\n//create layout and widgets\r\n\r\nvar grid = new contrib.grid({rows: 1, cols: 2})\r\n\r\nvar grid1 = new contrib.grid({rows: 1, cols: 3})\r\ngrid1.set(0, 0, contrib.log, \r\n  { fg: \"green\"\r\n  , selectedFg: \"green\"\r\n  , label: 'Server Log'})\r\ngrid1.set(0, 1, contrib.line, \r\n  { style: \r\n    { line: \"yellow\"\r\n    , text: \"green\"\r\n    , baseline: \"black\"}\r\n  , xLabelPadding: 3\r\n  , xPadding: 5\r\n  , label: 'Network Latency (sec)'})\r\n\r\nvar grid2 = new contrib.grid({rows: 2, cols: 1})\r\ngrid2.set(0, 0, contrib.gauge, {label: 'Deployment Progress'})\r\ngrid2.set(1, 0, contrib.sparkline, \r\n  { label: 'Throughput (bits/sec)'\r\n  , tags: true\r\n  , style: { fg: 'blue' }})\r\n\r\ngrid1.set(0, 2, grid2)\r\n\r\nvar grid3 = new contrib.grid({rows: 1, cols: 2})\r\ngrid3.set(0, 0, contrib.bar, \r\n  { label: 'Server Utilization (%)'\r\n  , barWidth: 4\r\n  , barSpacing: 6\r\n  , xOffset: 0\r\n  , maxHeight: 9})\r\ngrid3.set(0, 1, contrib.table, \r\n  { keys: true\r\n  , fg: 'green'\r\n  , label: 'Active Processes'\r\n  , columnSpacing: 16})\r\n\r\nvar grid4 = new contrib.grid({rows: 3, cols: 1})\r\ngrid4.set(0, 0, contrib.line, \r\n  { style: \r\n    { line: \"red\"\r\n    , text: \"white\"\r\n    , baseline: \"black\"}\r\n  , label: 'Errors Rate'\r\n  , maxY: 60})\r\ngrid4.set(1, 0, grid3)\r\ngrid4.set(2, 0, grid1)\r\n\r\nvar grid5 = new contrib.grid({rows: 2, cols: 1})\r\ngrid5.set(0, 0, contrib.line, \r\n  { showNthLabel: 5\r\n  , maxY: 100\r\n  , label: 'Total Transactions'})\r\ngrid5.set(1, 0, contrib.map, {label: 'Servers Location'})\r\ngrid.set(0, 0, grid5)\r\ngrid.set(0, 1, grid4)\r\n\r\ngrid.applyLayout(screen)\r\n\r\nvar transactionsLine = grid5.get(0, 0)\r\nvar errorsLine = grid4.get(0, 0)\r\nvar latencyLine = grid1.get(0, 1)\r\nvar map = grid5.get(1, 0)\r\nvar log = grid1.get(0, 0)\r\nvar table = grid3.get(0,1)\r\nvar sparkline = grid2.get(1, 0)\r\nvar gauge = grid2.get(0, 0)\r\nvar bar = grid3.get(0, 0)\r\n\r\n\r\n//dummy data\r\nvar servers = ['US1', 'US2', 'EU1', 'AU1', 'AS1', 'JP1']\r\nvar commands = ['grep', 'node', 'java', 'timer', '~/ls -l', 'netns', 'watchdog', 'gulp', 'tar -xvf', 'awk', 'npm install']\r\n\r\n\r\n//set dummy data on gauge\r\nvar gauge_percent = 0\r\nsetInterval(function() {\r\n  gauge.setPercent(gauge_percent++)  \r\n  if (gauge_percent>100) gauge_percent = 0  \r\n}, 200)\r\n\r\n\r\n//set dummy data on bar chart\r\nfunction fillBar() {\r\n  var arr = []\r\n  for (var i=0; i<servers.length; i++) {\r\n    arr.push(Math.round(Math.random()*10))\r\n  }\r\n  bar.setData({titles: servers, data: arr})\r\n}\r\nfillBar()\r\nsetInterval(fillBar, 2000)\r\n\r\n\r\n//set dummy data for table\r\nfunction generateTable() {\r\n   var data = []\r\n\r\n   for (var i=0; i<30; i++) {\r\n     var row = []          \r\n     row.push(commands[Math.round(Math.random()*(commands.length-1))])\r\n     row.push(Math.round(Math.random()*5))\r\n     row.push(Math.round(Math.random()*100))\r\n     data.push(row)\r\n   }\r\n\r\n   table.setData({headers: ['Process', 'Cpu (%)', 'Memory'], data: data})\r\n}\r\n\r\ngenerateTable()\r\ntable.focus()\r\nsetInterval(generateTable, 3000)\r\n\r\n\r\n//set log dummy data\r\nsetInterval(function() {\r\n   var rnd = Math.round(Math.random()*2)\r\n   if (rnd==0) log.log('starting process ' + commands[Math.round(Math.random()*(commands.length-1))])   \r\n   else if (rnd==1) log.log('terminating server ' + servers[Math.round(Math.random()*(servers.length-1))])\r\n   else if (rnd==2) log.log('avg. wait time ' + Math.random().toFixed(2))\r\n   screen.render()\r\n}, 500)\r\n\r\n\r\n//set spark dummy data\r\nvar spark1 = [1,2,5,2,1,5,1,2,5,2,1,5,4,4,5,4,1,5,1,2,5,2,1,5,1,2,5,2,1,5,1,2,5,2,1,5]\r\nvar spark2 = [4,4,5,4,1,5,1,2,5,2,1,5,4,4,5,4,1,5,1,2,5,2,1,5,1,2,5,2,1,5,1,2,5,2,1,5]\r\n\r\nrefreshSpark()\r\nsetInterval(refreshSpark, 1000)\r\n\r\nfunction refreshSpark() {\r\n  spark1.shift()\r\n  spark1.push(Math.random()*5+1)       \r\n  spark2.shift()\r\n  spark2.push(Math.random()*5+1)       \r\n  sparkline.setData(['Server1', 'Server2'], [spark1, spark2])  \r\n}\r\n\r\n\r\n\r\n//set map dummy markers\r\nvar marker = true\r\nsetInterval(function() {\r\n   if (marker) {\r\n    map.addMarker({\"lon\" : \"37.5000\", \"lat\" : \"-79.0000\" })\r\n    map.addMarker({\"lon\" : \"45.5200\", \"lat\" : \"-122.6819\" })\r\n    map.addMarker({\"lon\" : \"53.3478\", \"lat\" : \"-6.2597\" })\r\n    map.addMarker({\"lon\" : \"1.3000\", \"lat\" : \"103.8000\" })\r\n   }\r\n   else {\r\n    map.clearMarkers()\r\n   }\r\n   marker =! marker\r\n   screen.render()\r\n}, 1000)\r\n\r\n\r\n\r\n\r\n//set line charts dummy data\r\n\r\nvar transactionsData = {\r\n   x: ['00:00', '00:05', '00:10', '00:15', '00:20', '00:30', '00:40', '00:50', '01:00', '01:10', '01:20', '01:30', '01:40', '01:50', '02:00', '02:10', '02:20', '02:30', '02:40', '02:50', '03:00', '03:10', '03:20', '03:30', '03:40', '03:50', '04:00', '04:10', '04:20', '04:30'],\r\n   y: [0, 10, 40, 45, 45, 50, 55, 70, 65, 58, 50, 55, 60, 65, 70, 80, 70, 50, 40, 50, 60, 70, 82, 88, 89, 89, 89, 80, 72, 70]\r\n}\r\n\r\nvar errorsData = {\r\n   x: ['00:00', '00:05', '00:10', '00:15', '00:20', '00:25'],\r\n   y: [30, 50, 70, 40, 50, 20]\r\n}\r\n\r\nvar latencyData = {\r\n   x: ['t1', 't2', 't3', 't4'],\r\n   y: [5, 1, 7, 5]\r\n}\r\n\r\nsetLineData(transactionsData, transactionsLine)\r\nsetLineData(errorsData, errorsLine)\r\nsetLineData(latencyData, latencyLine)\r\n\r\nsetInterval(function() {\r\n   setLineData(transactionsData, transactionsLine)\r\n   screen.render()\r\n}, 500)\r\n\r\nsetInterval(function() {   \r\n   setLineData(errorsData, errorsLine)\r\n   screen.render()\r\n}, 1500)\r\n\r\nsetInterval(function() {   \r\n   setLineData(latencyData, latencyLine)\r\n   screen.render()\r\n}, 5000)\r\n\r\nfunction setLineData(mockData, line) {\r\n  var last = mockData.y[mockData.y.length-1]\r\n  mockData.y.shift()\r\n  var num = Math.max(last + Math.round(Math.random()*10) - 5, 10)    \r\n  mockData.y.push(num)     \r\n  line.setData(mockData.x, mockData.y)\r\n}\r\n\r\n\r\nscreen.key(['escape', 'q', 'C-c'], function(ch, key) {\r\n  return process.exit(0);\r\n});\r\n\r\nscreen.render()"}}