Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const express = require('express');
const vg = require('vega');
vg.config.load.baseURL = 'https://vega.github.io/vega-editor/app/';
const TYPES = {
VegaLite: require('./charts/VegaLite'),
Bar: require('./charts/Bar'),
DistrictBar: require('./charts/DistrictBar'),
DemographicBar: require('./charts/DemographicBar'),
ZurichMap: require('./charts/ZurichMap')
};
const app = express();
app.get('/:type', (request, response) => {
if (!TYPES[request.params.type]) {
return response.status(404).send('Not Found');
}
const spec = TYPES[request.params.type]({
'use strict';
var vgCfg = require('vega').config,
axisDef = vgCfg.axis,
legendDef = vgCfg.legend,
GTYPES = {AXIS: 'axis', LEGEND: 'legend'},
ORIENT = {x: 'bottom', y: 'left'};
/**
* A factory to produce a Lyra guide (axis or legend).
*
* @param {number} gtype - Axis or Legend (use enumerated `Guide.TYPES`).
* @param {string} type - Axis/legend type (e.g., `x` axis, or `fill` legend).
* @param {number|Object} scale - The ID or Lyra Scale Primitive that backs the guide.
*
* @property {number} _gtype - Axis or Legend (based on enumerate `Guide.TYPES`).
* @property {string} _type - Type for legends (e.g., `fill`, `stroke`, etc.).
* @see Vega's {@link https://github.com/vega/vega/wiki/Axes|Axes} or
* {@link https://github.com/vega/vega/wiki/Legends|Legends} documentation for