Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.loader.load(this.item.downloadUrl()).then((data) => {
data = read(data, options);
let columns = Object.keys(data[0]);
const types = inferTypes(data, columns);
data.__types__ = types;
// Vega has issues with empty-string fields and fields with dots, so rename those.
let rename = [];
_.each(data.__types__, (value, key) => {
if (key === '') {
rename.push({from: '', to: 'id'});
} else if (key.indexOf('.') >= 0) {
rename.push({from: key, to: key.replace(/\./g, '_')});
}
});
_.each(rename, (d) => {
data.__types__[d.to] = data.__types__[d.from];
loader.loader().load(this.file.downloadUrl()).then((data) => {
data = loader.read(data, {type: parser, parse: 'auto'});
this.data = data;
this.columns = _.keys(data[0]);
this.state = this.states.DATA_READY;
this.render();
return data;
}, (error) => {
console.error(error);
function(data) {
return read(data, format);
},
function(error) {
docManager.services.contents.get(wholePath).then(src => {
let local_filetype = PathExt.extname(DATA["url"]).substring(1);
let local_values = read(src.content, { type: local_filetype });
this.voyager_cur = CreateVoyager(
this.voyager_widget.node,
VoyagerPanel.config,
{ values: local_values }
);
});
this.voyager_cur.setSpec(spec);
export function ingest(target, data, format) {
return this.pulse(target, this.changeset().insert(read(data, format)));
}
this._context.ready.then(_ => {
this._ready.resolve(undefined);
const data = context.model.toString();
var values: any;
//read in the data
if (this.fileType === "txt") {
values = read(data, { type: "json" });
} else {
values = read(data, { type: this.fileType });
}
const spec: Object = {
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": values['data'],
"mark": values['mark'],
"encoding": values['encoding'],
"height":values['height'],
"width":values['width'],
"description":values['description'],
"name":values['name'],
"selection":values['selection'],
"title":values['title'],
"transform":values['transform']
};
if(this.fileType==='json'||this.fileType==='txt'){
if(values['data']){