-
-
Notifications
You must be signed in to change notification settings - Fork 43
feat: Added chart for history per country #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5453dc3
feat: Added non-interactive chart for history per country
jkga 516db55
chore: changed table and donut border
jkga 7e26403
feat: replaced wopr with blessed stream implementation
jkga c572ca6
fix: chnged cols and rows
jkga 2282e85
Merge branch 'dev' of https://github.com/WarenGonzaga/covid19-tracker…
jkga bc23907
fix: add white borders in table and bar graph
jkga 6f0bc9f
fix: extra lines and commented code
jkga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: replaced wopr with blessed stream implementation
- Loading branch information
commit 7e264034b8b9649469d7ef5c674350db9643eab8
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /** Modified script from blessed-contrib server-util */ | ||
| const blessed = require('blessed'), | ||
| contrib = require('blessed-contrib'), | ||
| Stream = require('stream'); | ||
|
|
||
| function OutputBuffer(options) { | ||
| this.isTTY = true; | ||
| this.columns = options.cols; | ||
| this.rows = options.rows; | ||
| this.write = function(s) { | ||
| s = s.replace('\x1b8', ''); //not clear from where in blessed this code comes from. It forces the terminal to clear and loose existing content. | ||
| options.stream.write(s) | ||
| }; | ||
|
|
||
| this.on = function() {}; | ||
| } | ||
|
|
||
| function InputBuffer() { | ||
| this.isTTY = true; | ||
| this.isRaw = true; | ||
| this.emit = function() {}; | ||
| this.setRawMode = function() {}; | ||
| this.resume = function() {}; | ||
| this.pause = function() {}; | ||
| this.on = function() {}; | ||
| } | ||
|
|
||
ianvizarra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| createScreen = (opt = {}) => { | ||
| const output = new OutputBuffer({stream: opt.stream, cols: 250, rows: 50}); | ||
| const input = new InputBuffer(); //required to run under forever since it replaces stdin to non-tty | ||
| const program = blessed.program({output: output, input: input}); | ||
|
|
||
| let screen = blessed.screen({program: program}); | ||
| return screen | ||
| } | ||
|
|
||
|
|
||
ianvizarra marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| loadTemplate = (gridTemplateClass, json, callback) => { | ||
|
|
||
| blessed.Screen.global = null | ||
| blessed.Program.global = null | ||
|
|
||
| const | ||
| customStream = new Stream.Transform() | ||
| screen = createScreen({stream: customStream}), | ||
| grid = new contrib.grid({rows: 12, cols: 16, screen: screen}); | ||
|
|
||
| let result = [] | ||
|
|
||
| if(!gridTemplateClass) throw new Error('No template loaded') | ||
|
|
||
| // parse template | ||
| gridTemplateClass.load(grid, json) | ||
|
|
||
| customStream._transform = function (chunk,encoding,done) { | ||
| result.push(chunk.toString()) | ||
| done() | ||
| } | ||
|
|
||
| customStream._final = () => { | ||
| callback(result.join('')) | ||
| } | ||
|
|
||
| customStream.on('error', (e) => { | ||
| // do nothing here | ||
| }) | ||
|
|
||
| screen.render() | ||
|
|
||
| setTimeout(() => { | ||
| customStream.end() | ||
| }, 1000) | ||
| } | ||
|
|
||
| module.exports = { | ||
| createScreen, | ||
| loadTemplate, | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.