Published
Edited
Mar 16, 2021
Fork of Draco
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { tableInput } from "@linard-y/table-input"
Insert cell
computed_spec = {
if (solution) {
let spec = solution.specs[0];
delete spec.data.url;
spec.data.values = data_to_viz;
return spec;
} else return "";
}
Insert cell
Insert cell
Insert cell
Insert cell
data_schema = draco.data2schema(data_to_viz)
Insert cell
data_to_viz = data_table.objects()
Insert cell
Insert cell
solver = {
let s = await new draco.default('https://unpkg.com/wasm-clingo@0.2.0').init();
s.schema = schema;
return s;
}
Insert cell
schema = {
return draco.data2schema(data_to_viz);
}
Insert cell
filtered_schema = {
let filtered_stats = rm.pipe(
rm.toPairs,
rm.filter(([k, v]) => rm.contains(k, selected_features_ids)),
rm.fromPairs
)(schema.stats);
return rm.merge(schema, { stats: filtered_stats });
}
Insert cell
stats = data_schema.stats
Insert cell
selected_features_ids = features.filter(f => f.feature).map(f => f.feature)
Insert cell
not_binned_features_ids = features
.filter(f => f.binned == false)
.map(f => f.feature)
Insert cell
asp = draco.schema2asp(filtered_schema)
Insert cell
createDracoProgram = function(data) {
var query_constraints = "";
var c = 0;
for (var stat in schema.stats) {
if (selected_features_ids.includes(stat)) {
query_constraints += '\nencoding(e' + c + ').';
query_constraints += '\n:- not field(e' + c + ',"' + stat + '").';
let measureType = features.find(f => f.feature == stat).measureType;
query_constraints += "\n:- not type(e" + c + ',' + measureType + ').';
if (not_binned_features_ids.includes(stat)) {
query_constraints += '\n:- bin(e' + c + ',_).';
} else {
query_constraints += '\n:- not bin(e' + c + ',_).';
}
}
c += 1;
}
console.log("query constraints", query_constraints);
// console.log("final asp", data_def + query_constraints);
query_constraints += `\n`;
return query_constraints;
}
Insert cell
draco = require('draco-vis')
Insert cell
d3 = require('d3')
Insert cell
rm = require('ramda')
Insert cell
_ = {
const [_, fp] = await Promise.all([
require("lodash@4"),
require("https://cdn.jsdelivr.net/gh/lodash/lodash@4/dist/lodash.fp.min.js")
]);
return fp(_);
}
Insert cell
dataset_max_record_count_db = debounce(viewof dataset_max_record_count)
Insert cell
Insert cell
css`button:disabled {
background-color: #AAAAAA;
}

textarea {
height: 500px
}
`
Insert cell
import { debounce } from "@mbostock/debouncing-input"
Insert cell
import { css } from "@j-f1/css-template-tag"
Insert cell
ax = require('axios@0.21.1/dist/axios.js')
Insert cell
vgdata = require('datalib')
Insert cell
raw_data_url_init = "https://localhost/breizh/subventions_attribuees_scdl0_2000.json"
Insert cell
data_prep_url_init = "https://localhost/breizh/subventions_2000.json"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more