Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_loadCsvFile(path, onDataLoaded) {
request.csv(path, function loadJson(error, data) {
if (error) {
console.error(error);
}
onDataLoaded(data);
});
},
var update_params = function(node, model) {
var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
d3Request.csv(url, row, function(params) {
params.forEach(function(p) {
$('#' + node).find('.params').append('<dt class="' + p.id + '" id="id_' + p.id + '">' + p.label + '</dt>')
var param_slider = s.paramSlider(nodes, node, p.id, p.slider);
param_slider.on("slideStop", function() {
simulate(1000.)
})
if (p.level > $('#levelInput').attr('value')) {
$('.' + p.id).addClass('hidden')
}
})
})
}
var update_params = function(node, model) {
var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
d3Request.csv(url, row, function(params) {
params.forEach(function(p) {
$('#' + node).find('.params').append('<dt class="' + p.id + '" id="id_' + p.id + '">' + p.label + '</dt>')
var param_slider = s.paramSlider(nodes, node, p.id, p.slider);
param_slider.on("slideStop", function() {
simulate(1000.)
})
if (p.level > $('#levelInput').attr('value')) {
$('.' + p.id).addClass('hidden')
}
})
})
}
var update_params = function(node, model) {
var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
d3Request.csv(url, row, function(params) {
params.forEach(function(p) {
$('#' + node).find('.params').append('<dt class="'+ p.id +'" id="id_' + p.id + '">' + p.label + '</dt>')
var param_slider = s.dataSlider(nodes, node, p.id, p.slider);
param_slider.on("slideStop", function() {
simulate()
})
if (p.level > $('#levelInput').attr('value')) {
$('.'+ p.id).addClass('hidden')
}
})
})
}
var update_params = function(node, model) {
var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
d3Request.csv(url, row, function(params) {
params.forEach(function(p) {
$('#' + node).find('.params').append('<dt class="' + p.id + '" id="id_' + p.id + '">' + p.label + '</dt>')
var param_slider = s.paramSlider(nodes, node, p.id, p.slider);
param_slider.on("slideStop", function() {
simulate(1000.)
})
if (p.level > $('#levelInput').attr('value')) {
$('.' + p.id).addClass('hidden')
}
})
})
}
export function renderToDOM(container) {
render(, container);
require('d3-request').csv(DATA_URL, (error, response) => {
if (!error) {
const data = response.map(d => [Number(d.lng), Number(d.lat)]);
render(, container);
}
});
}
json(this.props.data.dataFile, (error, data) => {
if (error) {
this.setState({
error: true,
});
} else {
this.setState({
data: data,
});
}
});
break;
}
case 'csv': {
csv(this.props.data.dataFile, (error, data) => {
data = data.map(d => {
for (let i = 0; i < this.props.data.fieldDesc.length; i++) {
if (this.props.data.fieldDesc[i][1] === 'number')
d[this.props.data.fieldDesc[i][0]] = +d[this.props.data.fieldDesc[i][0]]
if ((this.props.data.fieldDesc[i][1] === 'date') || (this.props.data.fieldDesc[i][1] === 'time'))
d[this.props.data.fieldDesc[i][0]] = moment(d[this.props.data.fieldDesc[i][0]], this.props.data.fieldDesc[i][2])['_d']
if (this.props.data.fieldDesc[i][1] === 'jsonObject')
d[this.props.data.fieldDesc[i][0]] = JSON.parse(d[this.props.data.fieldDesc[i][0]])
}
return d
})
if (error) {
this.setState({
error: true,
});
} else {
json(this.props.data.dataFile, (error, data) => {
if (error) {
this.setState({
error: true,
});
} else {
this.setState({
data: data,
});
}
});
break;
}
case 'csv': {
csv(this.props.data.dataFile, (error, data) => {
data = data.map(d => {
for (let i = 0; i < this.props.data.fieldDesc.length; i++) {
if (this.props.data.fieldDesc[i][1] === 'number')
d[this.props.data.fieldDesc[i][0]] = +d[this.props.data.fieldDesc[i][0]]
if ((this.props.data.fieldDesc[i][1] === 'date') || (this.props.data.fieldDesc[i][1] === 'time'))
d[this.props.data.fieldDesc[i][0]] = moment(d[this.props.data.fieldDesc[i][0]], this.props.data.fieldDesc[i][2])['_d']
if (this.props.data.fieldDesc[i][1] === 'jsonObject')
d[this.props.data.fieldDesc[i][0]] = JSON.parse(d[this.props.data.fieldDesc[i][0]])
}
return d
})
if (error) {
this.setState({
error: true,
});
} else {
json(this.props.data.dataFile, (error, data) => {
if (error) {
this.setState({
error: true,
});
} else {
this.setState({
data: data,
});
}
});
break;
}
case 'csv': {
csv(this.props.data.dataFile, (error, data) => {
data = data.map(d => {
for (let i = 0; i < this.props.data.fieldDesc.length; i++) {
if (this.props.data.fieldDesc[i][1] === 'number')
d[this.props.data.fieldDesc[i][0]] = +d[this.props.data.fieldDesc[i][0]]
if ((this.props.data.fieldDesc[i][1] === 'date') || (this.props.data.fieldDesc[i][1] === 'time'))
d[this.props.data.fieldDesc[i][0]] = moment(d[this.props.data.fieldDesc[i][0]], this.props.data.fieldDesc[i][2])['_d']
if (this.props.data.fieldDesc[i][1] === 'jsonObject')
d[this.props.data.fieldDesc[i][0]] = JSON.parse(d[this.props.data.fieldDesc[i][0]])
}
return d
})
if (error) {
this.setState({
error: true,
});
} else {
json(this.props.data.dataFile, (error, data) => {
if (error) {
this.setState({
error: true,
});
} else {
this.setState({
data: data,
});
}
});
break;
}
case 'csv': {
csv(this.props.data.dataFile, (error, data) => {
data = data.map(d => {
for (let i = 0; i < this.props.data.fieldDesc.length; i++) {
if (this.props.data.fieldDesc[i][1] === 'number')
d[this.props.data.fieldDesc[i][0]] = +d[this.props.data.fieldDesc[i][0]]
if ((this.props.data.fieldDesc[i][1] === 'date') || (this.props.data.fieldDesc[i][1] === 'time'))
d[this.props.data.fieldDesc[i][0]] = moment(d[this.props.data.fieldDesc[i][0]], this.props.data.fieldDesc[i][2])['_d']
if (this.props.data.fieldDesc[i][1] === 'jsonObject')
d[this.props.data.fieldDesc[i][0]] = JSON.parse(d[this.props.data.fieldDesc[i][0]])
}
return d
})
if (error) {
this.setState({
error: true,
});
} else {