Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setupNavio2 = () => {
this.nn = new Navio(this.target, 600).updateCallback(this.props.updateFilteredData);
for (var i = 0; i < this.props.attributes.length; i++) {
let d = this.props.attributes[i];
if (d.checked) {
if (d.type === cat) {
this.nn.addCategoricalAttrib(d.name,
d3.scaleOrdinal(d3.schemeCategory10));
} else if (d.type === seq) {
if (d.data === 'date') {
this.nn.addSequentialAttrib(d.name,
d3.scaleTime(d3_chromatic.schemeBlues))
// .domain(d.min, d.max)
// .range([d3_chromatic.interpolatePurples(0), d3_chromatic.interpolatePurples(1)]))
}
else {
console.log(d3)
console.log(d3_chromatic)
this.nn.addSequentialAttrib(d.name)
// d3.scaleLinear()
// // .base(Math.E)
// .domain(d.min, d.max)
// .range([0,600]))
}
}
}
}
this.nn.data(this.props.data);
getScaleOrdinalColor = (color) => {
switch (color) {
case 'blue':
return d3.scaleOrdinal(d3_chromatic.schemeBlues);
case 'purple':
return d3.scaleOrdinal(d3_chromatic.schemePurples);
case 'red':
return d3.scaleOrdinal(d3_chromatic.schemeReds);
case 'green':
return d3.scaleOrdinal(d3_chromatic.schemeGreens);
case 'gray':
return d3.scaleOrdinal(d3_chromatic.schemeGreys);
case 'orange':
return d3.scaleOrdinal(d3_chromatic.schemeOranges);
default:
// purple
console.log('default', color);
return d3.scaleLinear(d3_chromatic.schemeOranges);
}
getScaleTimeColor = (color) => {
switch (color) {
case 'blue':
return d3.scaleTime(d3_chromatic.schemeBlues);
case 'purple':
return d3.scaleTime(d3_chromatic.schemePurples);
case 'red':
return d3.scaleTime(d3_chromatic.schemeReds);
case 'green':
return d3.scaleTime(d3_chromatic.schemeGreens);
case 'gray':
return d3.scaleTime(d3_chromatic.schemeGreys);
case 'orange':
return d3.scaleTime(d3_chromatic.schemeOranges);
default:
// purple
console.log('default!!!!!!!!!!!!!!!!!')
// color = null;
return d3.scaleTime(d3_chromatic.schemeGreys);
}
update: function (element, valueAccessor) {
var values = ko.unwrap(valueAccessor());
var data = values.data;
var date = values.date;
var buckets = 9;
var palette = d3_color.schemeBlues[buckets];
removeErrorBox(element);
try {
var currentData = getDataValues(data, date);
drawMap(element, currentData, buckets, palette);
} catch (error) {
showError(element, error);
}
}
};