Socket
Socket
Sign inDemoInstall

vega

Package Overview
Dependencies
Maintainers
1
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega - npm Package Compare versions

Comparing version 1.4.2 to 1.4.3

src/data/aggregate.js

4

bower.json
{
"name": "vega",
"version": "1.4.2",
"version": "1.4.3",
"main": "vega.js",

@@ -23,4 +23,4 @@ "scripts": [

"dependencies": {
"d3": "3.4.10"
"d3": "3.5.2"
}
}
{
"name": "vega",
"version": "1.4.2",
"version": "1.4.3",
"description": "Vega Runtime",

@@ -26,11 +26,11 @@ "keywords": [

"dependencies": {
"d3": "3.4.10",
"canvas": "1.1.3",
"d3": "3.5.2",
"canvas": "1.1.6",
"optimist": "0.6.1",
"topojson": "1.6.14",
"d3-geo-projection": "0.2.10"
"topojson": "1.6.18",
"d3-geo-projection": "0.2.12"
},
"devDependencies": {
"uglify-js": "2.4.13",
"vows": "0.7"
"uglify-js": "2.4.16",
"vows": "0.8.1"
},

@@ -37,0 +37,0 @@ "scripts": {

@@ -75,6 +75,19 @@ // type checking functions

? f : vg.isString(f) && (s=vg.field(f)).length > 1
? function(x) { return s.reduce(function(x,f) { return x[f]; }, x); }
? function(x) { return s.reduce(function(x,f) {
return x[f];
}, x);
}
: function(x) { return x[f]; };
};
vg.mutator = function(f) {
var s;
return vg.isString(f) && (s=vg.field(f)).length > 1
? function(x, v) {
for (var i=0; i<s.length-1; ++i) x = x[s[i]];
x[s[i]] = v;
}
: function(x, v) { x[f] = v; };
};
vg.comparator = function(sort) {

@@ -81,0 +94,0 @@ var sign = [];

@@ -712,6 +712,16 @@ vg.canvas.path = (function() {

var o = items[0];
var area = d3.svg.area()
.x(function(d) { return d.x; })
.y1(function(d) { return d.y; })
.y0(function(d) { return d.y + d.height; });
var area;
if (o.orient === "horizontal") {
area = d3.svg.area()
.y(function(d) { return d.y; })
.x0(function(d) { return d.x; })
.x1(function(d) { return d.x + d.width; });
} else {
area = d3.svg.area()
.x(function(d) { return d.x; })
.y1(function(d) { return d.y; })
.y0(function(d) { return d.y + d.height; });
}
if (o.interpolate) area.interpolate(o.interpolate);

@@ -718,0 +728,0 @@ if (o.tension != null) area.tension(o.tension);

@@ -1,2 +0,2 @@

vg.canvas.Renderer = (function() {
vg.canvas.Renderer = (function() {
var renderer = function() {

@@ -7,8 +7,8 @@ this._ctx = null;

};
var prototype = renderer.prototype;
prototype.initialize = function(el, width, height, pad) {
this._el = el;
if (!el) return this; // early exit if no DOM element

@@ -20,3 +20,3 @@

.data([1]);
// create new canvas element if needed

@@ -26,9 +26,9 @@ canvas.enter()

.attr("class", "marks");
// remove extraneous canvas if needed
canvas.exit().remove();
return this.resize(width, height, pad);
};
prototype.resize = function(width, height, pad) {

@@ -38,3 +38,3 @@ this._width = width;

this._padding = pad;
if (this._el) {

@@ -54,7 +54,7 @@ var canvas = d3.select(this._el).select("canvas.marks");

}
initializeLineDash(this._ctx);
return this;
};
function scaleCanvas(canvas, ctx) {

@@ -100,3 +100,3 @@ // get canvas pixel data

}
prototype.context = function(ctx) {

@@ -106,7 +106,7 @@ if (ctx) { this._ctx = ctx; return this; }

};
prototype.element = function() {
return this._el;
};
prototype.pendingImages = function() {

@@ -123,3 +123,3 @@ return this._imgload;

}
function getBounds(items) {

@@ -130,5 +130,5 @@ return !items ? null :

.union(translatedBounds(item, item['bounds:prev']));
}, new vg.Bounds());
}, new vg.Bounds());
}
function setBounds(g, bounds) {

@@ -144,3 +144,3 @@ var bbox = null;

}
prototype.render = function(scene, items) {

@@ -172,3 +172,3 @@ var g = this._ctx,

}
// takedown

@@ -178,3 +178,3 @@ g.restore();

};
prototype.draw = function(ctx, scene, bounds) {

@@ -185,3 +185,3 @@ var marktype = scene.marktype,

};
prototype.renderAsync = function(scene) {

@@ -198,3 +198,3 @@ // TODO make safe for multiple scene rendering?

};
prototype.loadImage = function(uri) {

@@ -228,4 +228,4 @@ var renderer = this,

};
return renderer;
})();

@@ -24,5 +24,5 @@ // Define module using Universal Module Definition pattern

var vg = {
version: "1.4.2", // semantic versioning
version: "1.4.3", // semantic versioning
d3: d3, // stash d3 for use in property functions
topojson: topojson // stash topojson similarly
};

@@ -38,3 +38,3 @@ vg.Model = (function() {

} else if (deps[k]) {
x = vg_data_duplicate(data[deps[k]]);
x = vg_data_duplicate(this._data[deps[k]]);
if (vg.isTree(data)) vg_make_tree(x);

@@ -41,0 +41,0 @@ } else continue;

@@ -6,3 +6,3 @@ vg.data.facet = function() {

function facet(data) {
function facet(data) {
var result = {

@@ -13,3 +13,3 @@ key: "",

},
map = {},
map = {},
vals = result.values,

@@ -54,3 +54,3 @@ obj, klist, kstr, len, i, j, k, kv, cmp;

}
facet.keys = function(k) {

@@ -60,3 +60,3 @@ keys = vg.array(k).map(vg.accessor);

};
facet.sort = function(s) {

@@ -63,0 +63,0 @@ sort = vg.data.sort().by(s);

@@ -16,7 +16,7 @@ vg.data.force = function() {

function force(data, db, group) {
function force(data, db, group) {
layout
.size(vg.data.size(size, group))
.nodes(data);
if (links && db[links]) {

@@ -26,3 +26,3 @@ layout.links(db[links]);

layout.start();
layout.start();
for (var i=0; i<iterations; ++i) {

@@ -32,3 +32,3 @@ layout.tick();

layout.stop();
return data;

@@ -41,3 +41,3 @@ }

};
force.size = function(sz) {

@@ -47,3 +47,3 @@ size = sz;

};
force.linkDistance = function(field) {

@@ -64,3 +64,3 @@ linkDistance = typeof field === 'number'

};
force.charge = function(field) {

@@ -73,3 +73,3 @@ charge = typeof field === 'number'

};
force.iterations = function(iter) {

@@ -76,0 +76,0 @@ iterations = iter;

@@ -37,10 +37,19 @@ vg.data.load = function(uri, callback) {

function vg_url_check(url) {
if (!vg.config.domainWhiteList) return true;
// If vg.config.domainWhiteList is set, only allows url, whose hostname
// * Is the same as the origin (window.location.hostname)
// * Equals one of the values in the whitelist
// * Is a proper subdomain of one of the values in the whitelist
if (!vg.config.domainWhiteList)
return true;
var a = document.createElement("a");
a.href = url;
var domain = a.hostname.toLowerCase();
return vg.config.domainWhiteList.some(function(d) {
return d === domain ||
domain.lastIndexOf("."+d) === (domain.length - d.length - 1);
});
return window.location.hostname === domain ||
vg.config.domainWhiteList.some(function(d) {
var ind = domain.length - d.length;
return d === domain ||
(ind > 1 && domain[ind-1] === '.' && domain.lastIndexOf(d) === ind);
});
}

@@ -47,0 +56,0 @@

@@ -27,2 +27,9 @@ vg.parse.properties = (function() {

}
if (vars.xc) {
if (vars.width) {
code += "\n o.x = (o.xc - o.width/2);";
} else {
code += "\n o.x = o.xc;"
}
}

@@ -40,2 +47,9 @@ if (vars.y2) {

}
if (vars.yc) {
if (vars.height) {
code += "\n o.y = (o.yc - o.height/2);";
} else {
code += "\n o.y = o.yc;"
}
}

@@ -42,0 +56,0 @@ if (hasPath(mark, vars)) code += "\n item.touch();";

@@ -41,4 +41,7 @@ vg.parse.scales = (function() {

function ordinal(def, scale, rng, db, data) {
var domain, sort, str, refs, dataDrivenRange = false;
var dataDrivenRange = false,
pad = def.padding || 0,
outer = def.outerPadding || 0,
domain, sort, str, refs;
// range pre-processing for data-driven ranges

@@ -50,3 +53,3 @@ if (vg.isObject(def.range) && !vg.isArray(def.range)) {

}
// domain

@@ -57,2 +60,11 @@ sort = def.sort && !dataDrivenRange;

// width-defined range
if (def.bandWidth) {
var bw = def.bandWidth,
len = domain.length,
start = rng[0] || 0,
space = def.points ? (pad*bw) : (pad*bw*(len-1) + 2*outer);
rng = [start, start + (bw * len + space)];
}
// range

@@ -63,7 +75,7 @@ str = typeof rng[0] === 'string';

} else if (def.points) {
scale.rangePoints(rng, def.padding||0);
scale.rangePoints(rng, pad);
} else if (def.round || def.round===undefined) {
scale.rangeRoundBands(rng, def.padding||0);
scale.rangeRoundBands(rng, pad, outer);
} else {
scale.rangeBands(rng, def.padding||0);
scale.rangeBands(rng, pad, outer);
}

@@ -70,0 +82,0 @@ }

@@ -408,14 +408,27 @@ vg.scene.axis = function() {

if (vg.isObject(offset)) {
offset = -group.scales[offset.scale](offset.value);
}
if (vg.isArray(offset)) {
var ofx = offset[0],
ofy = offset[1];
switch (orient) {
case "left": { o.x = -offset; o.y = 0; break; }
case "right": { o.x = width + offset; o.y = 0; break; }
case "bottom": { o.x = 0; o.y = height + offset; break; }
case "top": { o.x = 0; o.y = -offset; break; }
default: { o.x = 0; o.y = 0; }
}
switch (orient) {
case "left": { o.x = -ofx; o.y = ofy; break; }
case "right": { o.x = width + ofx; o.y = ofy; break; }
case "bottom": { o.x = ofx; o.y = height + ofy; break; }
case "top": { o.x = ofx; o.y = -ofy; break; }
default: { o.x = ofx; o.y = ofy; }
}
} else {
if (vg.isObject(offset)) {
offset = -group.scales[offset.scale](offset.value);
}
switch (orient) {
case "left": { o.x = -offset; o.y = 0; break; }
case "right": { o.x = width + offset; o.y = 0; break; }
case "bottom": { o.x = 0; o.y = height + offset; break; }
case "top": { o.x = 0; o.y = -offset; break; }
default: { o.x = 0; o.y = 0; }
}
}
if (trans) trans.interpolate(item, o);

@@ -422,0 +435,0 @@ }

@@ -37,3 +37,3 @@ vg.scene.legend = function() {

? quantDef(scale)
: ordinalDef(scale);
: ordinalDef(scale);
}

@@ -40,0 +40,0 @@ legendDef.orient = orient;

@@ -5,2 +5,3 @@ vg.svg.marks = (function() {

function y(o) { return o.y || 0; }
function xw(o) { return o.x + o.width || 0; }
function yh(o) { return o.y + o.height || 0; }

@@ -12,3 +13,4 @@ function key(o) { return o.key; }

var arc_path = d3.svg.arc(),
area_path = d3.svg.area().x(x).y1(y).y0(yh),
area_path_v = d3.svg.area().x(x).y1(y).y0(yh),
area_path_h = d3.svg.area().y(y).x0(xw).x1(x),
line_path = d3.svg.line().x(x).y(y),

@@ -56,3 +58,3 @@ symbol_path = d3.svg.symbol().type(shape).size(size);

vg.svg._cur._defs.gradient[value.id] = value;
value = "url(#" + value.id + ")";
value = "url(" + window.location.href + "#" + value.id + ")";
}

@@ -73,7 +75,8 @@ this.style.setProperty(name, value+"", null);

if (!items.length) return;
var o = items[0];
area_path
var o = items[0],
path = o.orient === "horizontal" ? area_path_h : area_path_v;
path
.interpolate(o.interpolate || "linear")
.tension(o.tension == null ? 0.7 : o.tension);
this.setAttribute("d", area_path(items));
this.setAttribute("d", path(items));
}

@@ -241,3 +244,3 @@

function drawGroup(g, scene, index, prefix) {
function drawGroup(g, scene, index, prefix) {
var p = drawMark(g, scene, index, prefix || "group_", "g", group),

@@ -244,0 +247,0 @@ c = p.node().childNodes, n = c.length, i, j, m;

@@ -1,2 +0,2 @@

vg.svg.Renderer = (function() {
vg.svg.Renderer = (function() {
var renderer = function() {

@@ -3,0 +3,0 @@ this._svg = null;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc