Bar graph added.

This commit is contained in:
prabhatdev
2020-07-28 00:48:25 +05:30
parent d0a6e2667d
commit 194b41124d
3468 changed files with 640611 additions and 169 deletions

27
node_modules/vega-cli/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,27 @@
Copyright (c) 2015-2018, University of Washington Interactive Data Lab
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

5
node_modules/vega-cli/README.md generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# vega-cli
Command line tools for running server-side Vega.
This package provides `vg2pdf`, `vg2png`, and `vg2svg` command line utilities for parsing a Vega specification and generating an output PDF, PNG, or SVG image file. See the Vega website for [command line utility documentation](https://vega.github.io/vega/usage/#cli).

12
node_modules/vega-cli/bin/vg2pdf generated vendored Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env node
// Render a Vega specification to PDF, using node canvas
const {createWriteStream} = require('fs'),
render = require('../src/render');
render('pdf', function(canvas, arg) {
const file = arg._[1] || null,
config = arg.test ? {creationDate: new Date(2012, 0, 1)} : undefined,
out = file ? createWriteStream(file) : process.stdout,
stream = canvas.createPDFStream(config);
stream.on('data', chunk => { out.write(chunk); });
}, {type: 'pdf', context: {textDrawingMode: 'glyph'}});

11
node_modules/vega-cli/bin/vg2png generated vendored Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env node
// Render a Vega specification to PNG, using node canvas
const {createWriteStream} = require('fs'),
render = require('../src/render');
render('png', function(canvas, arg) {
const file = arg._[1] || null,
out = file ? createWriteStream(file) : process.stdout,
stream = canvas.createPNGStream();
stream.on('data', chunk => { out.write(chunk); });
});

22
node_modules/vega-cli/bin/vg2svg generated vendored Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env node
// Render a Vega specification to SVG
const {writeFile} = require('fs'),
render = require('../src/render');
const svgHeader =
'<?xml version="1.0" encoding="utf-8"?>\n' +
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ' +
'"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n';
render('svg', function(body, arg) {
const svg = (arg.h ? svgHeader : '') + body,
file = arg._[1] || null;
if (file) {
// write to file
writeFile(file, svg, err => { if (err) throw err; });
} else {
// write to stdout
process.stdout.write(svg);
}
});

1
node_modules/vega-cli/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('vega');

65
node_modules/vega-cli/package.json generated vendored Normal file
View File

@@ -0,0 +1,65 @@
{
"_from": "vega-cli",
"_id": "vega-cli@5.13.0",
"_inBundle": false,
"_integrity": "sha512-5gfN6JmZ4HqNr8gYdu2g+Nkh9MAcsUHJ6Bp1y67vxn9bs8LEWNk1t8vCGlt3BH2CjlyI7jLaF4NRw8bb2IhH8g==",
"_location": "/vega-cli",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "vega-cli",
"name": "vega-cli",
"escapedName": "vega-cli",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/vega-cli/-/vega-cli-5.13.0.tgz",
"_shasum": "9d7a34be8f5ccce149d773f83953d2ba1b54848e",
"_spec": "vega-cli",
"_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats",
"author": {
"name": "Jeffrey Heer",
"url": "http://idl.cs.washington.edu"
},
"bin": {
"vg2pdf": "bin/vg2pdf",
"vg2png": "bin/vg2png",
"vg2svg": "bin/vg2svg"
},
"bugs": {
"url": "https://github.com/vega/vega/issues"
},
"bundleDependencies": false,
"dependencies": {
"canvas": "^2.6.1",
"vega": "5.13.0",
"yargs": "15"
},
"deprecated": false,
"description": "Command line utilities for server-side Vega.",
"gitHead": "62565bbe084a422c4a0cbc6e19c6f7c45a3e5137",
"homepage": "https://github.com/vega/vega#readme",
"keywords": [
"vega",
"command line",
"server"
],
"license": "BSD-3-Clause",
"main": "index.js",
"name": "vega-cli",
"repository": {
"type": "git",
"url": "git+https://github.com/vega/vega.git"
},
"scripts": {
"postpublish": "git push && git push --tags",
"test": "tape 'test/**/*-test.js'"
},
"version": "5.13.0"
}

56
node_modules/vega-cli/src/args.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
module.exports = function(type) {
const helpText = `Render a Vega specification to ${type.toUpperCase()}.
Usage: vg2${type} [vega_json_spec_file] [output_${type}_file]
If no arguments are provided, reads from stdin.
If output_${type}_file is not provided, writes to stdout.
For errors and log messages, writes to stderr.
To load data, you may need to set a base directory:
For web retrieval, use '-b http://host/data/'.
For files, use '-b file:///dir/data/' (absolute) or '-b data/' (relative).`;
const args = require('yargs')
.usage(helpText)
.demand(0);
args.string('b')
.alias('b', 'base')
.describe('b', 'Base directory for data loading. Defaults to the directory of the input spec.');
args.string('l')
.alias('l', 'loglevel')
.describe('l', 'Level of log messages written to stderr. One of "error", "warn" (default), "info", or "debug".');
args.string('c')
.alias('c', 'config')
.describe('c', 'Vega config object. Either a JSON file or a .js file that exports the config object.');
args.string('f')
.alias('f', 'format')
.describe('f', 'Number format locale descriptor. Either a JSON file or a .js file that exports the locale object.');
args.string('t')
.alias('t', 'timeFormat')
.describe('t', 'Date/time format locale descriptor. Either a JSON file or a .js file that exports the locale object.');
if (type === 'svg') {
args.boolean('h')
.alias('h', 'header')
.describe('h', 'Include XML header and SVG doctype.');
}
args.number('s')
.alias('s', 'scale')
.default('s', 1)
.describe('s', 'Output resolution scale factor.');
args.number('seed')
.describe('seed', 'Seed for random number generation.');
if (type === 'pdf') {
args.boolean('test')
.describe('test', 'Disable default PDF metadata for test suites.');
}
return args.help().version().argv;
};

13
node_modules/vega-cli/src/read.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
const fs = require('fs');
module.exports = (file) => {
return new Promise((resolve, reject) => {
const input = file ? fs.createReadStream(file) : process.stdin;
let text = '';
input.setEncoding('utf8');
input.on('error', err => { reject(err); });
input.on('data', chunk => { text += chunk; });
input.on('end', () => { resolve(text); });
});
};

64
node_modules/vega-cli/src/render.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
const vega = require('vega'),
path = require('path'),
args = require('./args'),
read = require('./read');
function load(file) {
return require(path.resolve(file));
}
const Levels = {
error: vega.Error,
warn: vega.Warn,
info: vega.Info,
debug: vega.Debug
};
module.exports = function(type, callback, opt) {
// parse command line arguments
const arg = args(type);
// set baseURL, if specified. default to input spec directory
const base = arg.base || (arg._[0] ? path.dirname(arg._[0]) : null);
// set log level, defaults to logging warning messages
const loglevel = Levels[String(arg.loglevel).toLowerCase()] || vega.Warn;
// load config file, if specified
const config = arg.config ? load(arg.config) : null;
// set output image scale factor
const scale = arg.scale || undefined;
// use a seeded random number generator, if specified
if (typeof arg.seed !== 'undefined') {
if (Number.isNaN(arg.seed)) throw 'Illegal seed value: must be a valid number.';
vega.setRandom(vega.randomLCG(arg.seed));
}
// locale options, load custom number/time formats if specified
const locale = {
number: arg.format ? load(arg.format) : null,
time: arg.timeFormat ? load(arg.timeFormat) : null
};
// instantiate view and invoke headless render method
function render(spec) {
const view = new vega.View(vega.parse(spec, config), {
locale: locale, // set locale options
loader: vega.loader({baseURL: base}), // load files from base path
logger: vega.logger(loglevel, 'error'), // route all logging to stderr
renderer: 'none' // no primary renderer needed
}).finalize(); // clear any timers, etc
return (type === 'svg'
? view.toSVG(scale)
: view.toCanvas(scale, opt)
).then(_ => callback(_, arg));
}
// read input from file or stdin
read(arg._[0] || null)
.then(text => render(JSON.parse(text)))
.catch(err => console.error(err)); // eslint-disable-line no-console
};