vega-lite
Advanced tools
Comparing version 0.7.5 to 0.7.6
{ | ||
"name": "vega-lite", | ||
"main": "vega-lite.js", | ||
"version": "0.7.5", | ||
"version": "0.7.6", | ||
"homepage": "https://github.com/uwdata/vega-lite", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -7,40 +7,40 @@ 'use strict'; | ||
{ | ||
name: "Barley", | ||
url: "data/barley.json" | ||
name: 'Barley', | ||
url: 'data/barley.json' | ||
},{ | ||
name: "Cars", | ||
url: "data/cars.json" | ||
name: 'Cars', | ||
url: 'data/cars.json' | ||
},{ | ||
name: "Crimea", | ||
url: "data/crimea.json" | ||
name: 'Crimea', | ||
url: 'data/crimea.json' | ||
},{ | ||
name: "Driving", | ||
url: "data/driving.json" | ||
name: 'Driving', | ||
url: 'data/driving.json' | ||
},{ | ||
name: "Iris", | ||
url: "data/iris.json" | ||
name: 'Iris', | ||
url: 'data/iris.json' | ||
},{ | ||
name: "Jobs", | ||
url: "data/jobs.json" | ||
name: 'Jobs', | ||
url: 'data/jobs.json' | ||
},{ | ||
name: "Population", | ||
url: "data/population.json" | ||
name: 'Population', | ||
url: 'data/population.json' | ||
},{ | ||
name: "Movies", | ||
url: "data/movies.json" | ||
name: 'Movies', | ||
url: 'data/movies.json' | ||
},{ | ||
name: "Birdstrikes", | ||
url: "data/birdstrikes.json" | ||
name: 'Birdstrikes', | ||
url: 'data/birdstrikes.json' | ||
},{ | ||
name: "Burtin", | ||
url: "data/burtin.json" | ||
name: 'Burtin', | ||
url: 'data/burtin.json' | ||
},{ | ||
name: "Budget 2016", | ||
url: "data/budget.json" | ||
name: 'Budget 2016', | ||
url: 'data/budget.json' | ||
},{ | ||
name: "Climate Normals", | ||
url: "data/climate.json" | ||
name: 'Climate Normals', | ||
url: 'data/climate.json' | ||
},{ | ||
name: "Campaigns", | ||
url: "data/weball26.json" | ||
name: 'Campaigns', | ||
url: 'data/weball26.json' | ||
} | ||
@@ -58,8 +58,8 @@ ]; | ||
// remove trailing slash that chrome adds automatically | ||
if (params[params.length-1] == "/") params = params.substring(0, params.length-1); | ||
if (params[params.length-1] == '/') params = params.substring(0, params.length-1); | ||
return params.split("&") | ||
return params.split('&') | ||
.map(function(x) { | ||
// don't gobble up any equals within the query value | ||
var idx = x.indexOf("="); | ||
var idx = x.indexOf('='); | ||
return [x.slice(0,idx), x.slice(idx+1)]; | ||
@@ -73,6 +73,6 @@ }) | ||
vled.format = function() { | ||
var el = d3.select("#vlspec"), | ||
spec = JSON.parse(el.property("value")), | ||
text = JSON.stringify(spec, null, " ", 60); | ||
el.property("value", text); | ||
var el = d3.select('#vlspec'), | ||
spec = JSON.parse(el.property('value')), | ||
text = JSON.stringify(spec, null, ' ', 60); | ||
el.property('value', text); | ||
}; | ||
@@ -83,3 +83,3 @@ | ||
try { | ||
spec = JSON.parse(d3.select("#vlspec").property("value")); | ||
spec = JSON.parse(d3.select('#vlspec').property('value')); | ||
} catch (e) { | ||
@@ -114,3 +114,3 @@ console.warn(e); | ||
if (datasetIndex !== undefined) { | ||
document.getElementById("sel_spec").selectedIndex = datasetIndex; | ||
document.getElementById('sel_spec').selectedIndex = datasetIndex; | ||
vled.datasetChanged(DATASETS[datasetIndex], function() { | ||
@@ -125,6 +125,6 @@ done(); | ||
vled.parseShorthand = function() { | ||
var shorthand = d3.select("#shorthand").property("value"); | ||
var shorthand = d3.select('#shorthand').property('value'); | ||
var encoding = vl.Encoding.parseShorthand(shorthand); | ||
d3.select("#vlspec").node().value = JSON.stringify(encoding.toSpec(), null, " ", 60); | ||
d3.select('#vlspec').node().value = JSON.stringify(encoding.toSpec(), null, ' ', 60); | ||
vled.parse(); | ||
@@ -137,7 +137,7 @@ }; | ||
d3.select("#shorthand").node().value = encoding.toShorthand(); | ||
d3.select("#vgspec").node().value = JSON.stringify(spec, null, " ", 60); | ||
d3.select('#shorthand').node().value = encoding.toShorthand(); | ||
d3.select('#vgspec').node().value = JSON.stringify(spec, null, ' ', 60); | ||
// store spec in cookie for a day | ||
docCookies.setItem("vlspec", JSON.stringify(encoding.toSpec()), 86400); | ||
docCookies.setItem('vlspec', JSON.stringify(encoding.toSpec()), 86400); | ||
@@ -148,3 +148,3 @@ $('textarea').trigger('autosize.resize'); | ||
vg.parse.spec(spec, function(chart) { | ||
vled.vis = chart({el:"#vis", renderer: "svg"}); | ||
vled.vis = chart({el:'#vis', renderer: 'svg'}); | ||
@@ -167,4 +167,4 @@ vled.vis.update(); | ||
d3.json(dataset.url, function(err, data) { | ||
if (err) return alert("Error loading data " + err.statusText); | ||
dataset.stats = dl.summary(data).reduce(function(s, p) { | ||
if (err) return alert('Error loading data ' + err.statusText); | ||
dataset.stats = vl.summary(data).reduce(function(s, p) { | ||
s[p.field] = p; | ||
@@ -181,13 +181,13 @@ return s; | ||
// Specification drop-down menu | ||
var sel = d3.select("#sel_spec"); | ||
sel.selectAll("option.spec") | ||
var sel = d3.select('#sel_spec'); | ||
sel.selectAll('option.spec') | ||
.data(DATASETS) | ||
.enter().append("option") | ||
.enter().append('option') | ||
.text(function(d) { return d.name; }); | ||
sel.on("change", function() { | ||
sel.on('change', function() { | ||
var item = this.options[this.selectedIndex].__data__; | ||
vled.datasetChanged(item, function() { | ||
d3.select("#vgspec").node().value = ""; | ||
d3.select("#vis").node().innerHTML = ""; | ||
d3.select('#vgspec').node().value = ''; | ||
d3.select('#vis').node().innerHTML = ''; | ||
}); | ||
@@ -197,28 +197,28 @@ }); | ||
// Initialize application | ||
d3.select("#btn_spec_format").on("click", vled.format); | ||
d3.select("#btn_spec_parse").on("click", vled.parse); | ||
d3.select("#btn_shorthand_parse").on("click", vled.parseShorthand); | ||
d3.select('#btn_spec_format').on('click', vled.format); | ||
d3.select('#btn_spec_parse').on('click', vled.parse); | ||
d3.select('#btn_shorthand_parse').on('click', vled.parseShorthand); | ||
var shorthand = params.shortHand; | ||
if (shorthand) { | ||
document.getElementById("shorthand").value = shorthand; | ||
document.getElementById('shorthand').value = shorthand; | ||
vled.datasetChanged(DATASETS[0], function() { | ||
vled.parseShorthand(); | ||
}); | ||
} else if (docCookies.hasItem("vlspec")) { | ||
document.getElementById("vlspec").value = docCookies.getItem("vlspec"); | ||
} else if (docCookies.hasItem('vlspec')) { | ||
document.getElementById('vlspec').value = docCookies.getItem('vlspec'); | ||
vled.parse(); | ||
vled.format(); | ||
} else { | ||
document.getElementById("vlspec").value = JSON.stringify({ | ||
marktype: "point", | ||
document.getElementById('vlspec').value = JSON.stringify({ | ||
marktype: 'point', | ||
encoding: { | ||
x: {type: "Q",name: "yield",aggr: "avg"}, | ||
x: {type: 'Q',name: 'yield',aggr: 'avg'}, | ||
y: { | ||
sort: [{name: "yield", aggr: "avg", reverse: false}], | ||
type: "O", | ||
name: "variety" | ||
sort: [{name: 'yield', aggr: 'avg', reverse: false}], | ||
type: 'N', | ||
name: 'variety' | ||
}, | ||
row: {type: "O", name: "site"}, | ||
color: {type: "O", name: "year"} | ||
row: {type: 'N', name: 'site'}, | ||
color: {type: 'N', name: 'year'} | ||
} | ||
@@ -225,0 +225,0 @@ }); |
'use strict'; | ||
var gulp = require('gulp'); | ||
var paths = gulp.paths; | ||
var $ = require('gulp-load-plugins')(); | ||
@@ -6,0 +5,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
gulp.task('serve', ['copydl', 'bundle', 'watch-schema', 'watch-test'], function() { | ||
gulp.task('serve', ['bundle', 'watch-schema', 'watch-test'], function() { | ||
browserSync({ | ||
@@ -9,0 +9,0 @@ server: { |
@@ -14,6 +14,1 @@ 'use strict'; | ||
}); | ||
gulp.task('copydl', function() { | ||
gulp.src('node_modules/datalib/datalib.js') | ||
.pipe(gulp.dest('lib/')); | ||
}); |
{ | ||
"name": "vega-lite", | ||
"author": "Jeffrey Heer, Dominik Moritz, Kanit \"Ham\" Wongsuphasawat", | ||
"version": "0.7.5", | ||
"version": "0.7.6", | ||
"collaborators": [ | ||
@@ -58,2 +58,4 @@ "Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)", | ||
"dependencies": { | ||
"colorbrewer": "0.0.2", | ||
"d3-color": "^0.2.1", | ||
"datalib": "^1.1.12" | ||
@@ -60,0 +62,0 @@ }, |
@@ -5,2 +5,4 @@ 'use strict'; | ||
var stats = require('datalib/src/stats'); | ||
var vldata = module.exports = {}; | ||
@@ -17,1 +19,9 @@ | ||
vldata.stats = function(data) { | ||
var summary = stats.summary(data); | ||
return summary.reduce(function(s, profile) { | ||
s[profile.field] = profile; | ||
return s; | ||
}, {count: data.length}); | ||
}; |
@@ -336,3 +336,3 @@ 'use strict'; | ||
proto.data = function(name) { | ||
return this._data[name]; | ||
return name ? this._data[name] : this._data; | ||
}; | ||
@@ -339,0 +339,0 @@ |
@@ -9,3 +9,3 @@ 'use strict'; | ||
c = consts.shorthand, | ||
time = require('./compile/time'), | ||
time = require('./compiler/time'), | ||
util = require('./util'), | ||
@@ -21,3 +21,4 @@ schema = require('./schema/schema'); | ||
* opt.data - include 'data.' | ||
* opt.fn - custom function prefix | ||
* opt.fn - replace fn with custom function prefix | ||
* opt.prefn - prepend fn with custom function prefix | ||
@@ -29,3 +30,3 @@ * @return {[type]} [description] | ||
var f = (opt.data ? 'data.' : ''), | ||
var f = (opt.data ? 'data.' : '') + (opt.prefn || ''), | ||
nofn = opt.nofn || opt.fn, | ||
@@ -32,0 +33,0 @@ name = field.name; |
@@ -9,3 +9,3 @@ // Package of defining Vega-lite Specification's json schema | ||
toMap = util.toMap, | ||
colorbrewer = require('../lib/colorbrewer/colorbrewer'); | ||
colorbrewer = require('colorbrewer'); | ||
@@ -12,0 +12,0 @@ schema.util = require('./schemautil'); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
util.extend(util, require('datalib/src/generate')); | ||
util.extend(util, require('datalib/src/stats')); | ||
util.bin = require('datalib/src/bins/bins'); | ||
@@ -8,0 +9,0 @@ |
@@ -13,6 +13,7 @@ 'use strict'; | ||
vl.Encoding = require('./Encoding'); | ||
vl.compile = require('./compile/compile'); | ||
vl.compiler = require('./compiler/compiler'); | ||
vl.compile = vl.compiler.compile; | ||
vl.data = require('./data'); | ||
vl.enc = require('./enc'); | ||
vl.field = require('./field'); | ||
vl.enc = require('./enc'); | ||
vl.schema = require('./schema/schema'); | ||
@@ -19,0 +20,0 @@ vl.toShorthand = vl.Encoding.shorthand; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
1
100
14
6
8548938
3
106
140375
+ Addedcolorbrewer@0.0.2
+ Addedd3-color@^0.2.1
+ Addedcolorbrewer@0.0.2(transitive)
+ Addedd3-color@0.2.8(transitive)