Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react';
import ReactDOM from 'react-dom';
import * as ReactGA from 'react-ga';
import {Provider} from 'react-redux';
import {hashHistory, Route, Router} from 'react-router';
import * as vega from 'vega';
import * as vl from 'vega-lite';
import App from './components/app';
import configureStore from './store/configure-store';
window.VEGA_DEBUG = window.VEGA_DEBUG || {};
window.VEGA_DEBUG.vega = vega;
window.VEGA_DEBUG.vl = vl;
window.VEGA_DEBUG.VEGA_VERSION = vega.version;
window.VEGA_DEBUG.VEGA_LITE_VERSION = vl.version;
// Configure history for react-router
const store = configureStore(hashHistory);
// Google analytics
ReactGA.initialize('UA-44428446-7');
function logPageView() {
ReactGA.set({page: window.location.pathname + window.location.search});
ReactGA.pageview(window.location.pathname + window.location.search);
}
// Now that redux and react-router have been configured, we can render the
// React application to the DOM!
ReactDOM.render(
import * as d3 from 'd3';
import * as vega from 'vega';
import * as vl from '../src/index';
import {TopLevelSpec} from '../src/spec';
d3.select('#vl-version').text(vl.version);
d3.select('#vg-version').text(vega.version);
function loadJSON(url: string, callback: (data: object) => void) {
vega.loader().load(url).then(function(data: string) {
callback(JSON.parse(data));
});
}
loadJSON('examples/all-examples.json', function(examples: string[]) {
const viz = d3.select('div.viz-list').selectAll('.viz').data(examples);
viz.exit().remove();
const vizEnter = viz
.enter()
.append('div')
.attr('class', 'viz')
import styled from 'styled-components';
import {FORMAT, readVegaFile} from './utils/helper';
import {showOpenDialog} from './utils/dialog';
import DropArea from './components/DropArea';
import VegaRenderer from './components/VegaRenderer';
import downloadURI from './utils/downloadURI';
const vg = require('vega');
const vl = require('vega-lite');
window.VEGA_DEBUG = window.VEGA_DEBUG || {};
window.VEGA_DEBUG = {};
window.VEGA_DEBUG.vega = vg;
window.VEGA_DEBUG.vl = vl;
window.VEGA_DEBUG.VEGA_VERSION = vg.version;
window.VEGA_DEBUG.VEGA_LITE_VERSION = vl.version;
console.log('%cWelcome to Vega-Desktop!', 'font-size: 16px; font-weight: bold;');
console.log('You can access the Vega view with VEGA_DEBUG. Learn more at https://vega.github.io/vega/docs/api/debugging/.');
const MenuBar = styled.div`
background-color: #eee;
padding: 5px;
position: fixed;
width: 100%;
z-index: 100;
`;
const StatusBar = styled.div`
background-color: #efefef;
padding: 5px 8px;
export function parseInputSpec(inputSpec, onWarning) {
let spec = { ...inputSpec };
if (!spec.$schema) {
onWarning(`The input spec does not specify a "$schema", defaulting to "${DEFAULT_SCHEMA}"`);
spec.$schema = DEFAULT_SCHEMA;
}
const schema = schemaParser(spec.$schema);
const isVegaLite = schema.library === 'vega-lite';
const libVersion = isVegaLite ? vegaLite.version : vega.version;
if (versionCompare(schema.version, libVersion) > 0) {
onWarning(
`The input spec uses "${schema.library}" ${schema.version}, but ` +
`current version of "${schema.library}" is ${libVersion}.`
);
}
const hostConfig = spec._hostConfig;
if (hostConfig !== undefined) {
delete spec.hostConfig;
if (typeof hostConfig !== 'object') {
throw new Error('_hostConfig must be an object');
}
}
<div>
{
this.vega = c;
}}
className="vis"
format={format}
spec={spec}
filePath={filePath}
/>
</div>
{format === FORMAT.VEGA_LITE ?
`Vega-Lite v${vl.version}` :
`Vega v${vg.version}`}
);
}
}