Socket
Socket
Sign inDemoInstall

vega-lite

Package Overview
Dependencies
Maintainers
2
Versions
470
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-lite - npm Package Compare versions

Comparing version 0.7.13 to 0.7.14

.idea/.name

2

bower.json
{
"name": "vega-lite",
"main": "vega-lite.js",
"version": "0.7.13",
"version": "0.7.14",
"homepage": "https://github.com/uwdata/vega-lite",

@@ -6,0 +6,0 @@ "authors": [

@@ -121,2 +121,17 @@ 'use strict';

}
},{
title: 'Area chart',
spec: {
'marktype': 'area',
'encoding': {
'x': {'name': 'Year','type': 'T','timeUnit': 'year'},
'y': {'name': 'Weight_in_lbs','type': 'Q','aggregate': 'sum'},
'color': {
'scale': {'quantitativeRange': ['#AFC6A3','#09622A']},
'name': 'Cylinders',
'type': 'O'
}
},
'data': {'url': 'data/cars.json'}
}
}

@@ -123,0 +138,0 @@ ];

{
"name": "vega-lite",
"author": "Jeffrey Heer, Dominik Moritz, Kanit \"Ham\" Wongsuphasawat",
"version": "0.7.13",
"version": "0.7.14",
"collaborators": [

@@ -30,8 +30,9 @@ "Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)",

"devDependencies": {
"browser-sync": "^2.7.13",
"browserify": "^10.2.4",
"browserify-shim": "^3.8.9",
"chai": "^3.0.0",
"browser-sync": "^2.8.2",
"browserify": "^11.0.1",
"browserify-shim": "^3.8.10",
"browserify-versionify": "^1.0.6",
"chai": "^3.2.0",
"commander": "^2.8.1",
"coveralls": "^2.11.2",
"coveralls": "^2.11.4",
"d3": "^3.5.6",

@@ -41,27 +42,28 @@ "deep-diff": "^0.3.2",

"gulp-bump": "^0.3.1",
"gulp-git": "^1.2.4",
"gulp-jshint": "^1.11.1",
"gulp-git": "^1.3.1",
"gulp-jshint": "^1.11.2",
"gulp-load-plugins": "^1.0.0-rc",
"gulp-rename": "^1.2.2",
"gulp-run": "^1.6.8",
"gulp-run": "^1.6.10",
"gulp-sourcemaps": "^1.5.2",
"gulp-spawn-mocha": "^2.2.1",
"gulp-tag-version": "^1.2.1",
"gulp-uglify": "^1.2.0",
"gulp-tag-version": "^1.3.0",
"gulp-uglify": "^1.4.0",
"gulp-util": "^3.0.6",
"jshint-stylish": "^2.0.1",
"lodash": "^3.10.0",
"mocha": "^2.2.5",
"lodash": "^3.10.1",
"mocha": "^2.3.0",
"require-dir": "^0.3.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.2.3",
"z-schema": "^3.12.0"
"watchify": "~3.4.0",
"z-schema": "^3.12.4"
},
"dependencies": {
"colorbrewer": "0.0.2",
"d3-color": "^0.2.1",
"d3-format": "^0.2.3",
"d3-time-format": "0.0.2",
"datalib": "^1.3.0"
"d3-color": "^0.2.4",
"d3-format": "^0.3.0",
"d3-time-format": "0.1.0",
"datalib": "^1.4.5",
"yargs": "^3.23.0"
},

@@ -68,0 +70,0 @@ "browserify": {

@@ -36,7 +36,11 @@ 'use strict';

// no need to pass stats if you pass in the data
if (!stats && encoding.hasValues()) {
stats = summary(encoding.data().values).reduce(function(s, p) {
s[p.field] = p;
return s;
}, {});
if (!stats) {
if (encoding.hasValues()) {
stats = summary(encoding.data().values).reduce(function(s, p) {
s[p.field] = p;
return s;
}, {});
} else {
console.error('No stats provided and data is not embedded.');
}
}

@@ -88,4 +92,3 @@

// auto-sort line/area values
//TODO(kanitw): have some config to turn off auto-sort for line (for line chart that encodes temporal information)
if (lineType) {
if (lineType && encoding.config('autoSortLine')) {
var f = (encoding.isMeasure(X) && encoding.isDimension(Y)) ? Y : X;

@@ -92,0 +95,0 @@ if (!mdef.from) mdef.from = {};

@@ -17,6 +17,6 @@ 'use strict';

// TODO add "having" filter here ()
// TODO add "having" filter here
// append non-zero filter at the end for the data table
data.filterNonZeroForLog(def[def.length - 1], encoding);
// append non-positive filter at the end for the data table
data.filterNonPositive(def[def.length - 1], encoding);

@@ -68,4 +68,3 @@ return def;

return data.raw.transform.time(encoding).concat(
data.raw.transform.bin(encoding)
).concat(
data.raw.transform.bin(encoding),
data.raw.transform.filter(encoding)

@@ -187,3 +186,3 @@ );

data.filterNonZeroForLog = function(dataTable, encoding) {
data.filterNonPositive = function(dataTable, encoding) {
encoding.forEach(function(field, encType) {

@@ -190,0 +189,0 @@ if (encoding.scale(encType).type === 'log') {

@@ -171,2 +171,3 @@ // Package of defining Vega-lite Specification's json schema

default: 5,
minimum: 0,
description: 'A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are "nice" (multiples of 2, 5, 10) and lie within the underlying scale\'s range.'

@@ -182,2 +183,3 @@ },

default: undefined,
minimum: 0,
description: 'Max length for axis title if the title is automatically generated from the field\'s description'

@@ -207,2 +209,4 @@ },

default: undefined, // auto
minimum: 0,
maximum: 360,
description: 'Angle by which to rotate labels. Set to 0 to force horizontal.'

@@ -269,2 +273,3 @@ },

type: 'object',
description: 'Properties of a legend.',
properties: {

@@ -349,3 +354,4 @@ title: {

default: 30,
minimum: 0
minimum: 0,
description: 'Size of marks.'
}

@@ -362,3 +368,4 @@ }

role: 'color',
default: 'steelblue'
default: '#4682b4',
description: 'Color to be used for marks.'
},

@@ -378,4 +385,4 @@ opacity: {

description:
'color palette, if undefined vega-lite will use data property' +
'to pick one from c10palette, c20palette, or ordinalPalette'
'Color palette, if undefined vega-lite will use data property' +
'to pick one from c10palette, c20palette, or ordinalPalette.'
//FIXME

@@ -401,2 +408,3 @@ },

default: undefined,
description: 'Color palette to encode ordinal variables.',
enum: util.keys(colorbrewer)

@@ -408,2 +416,5 @@ },

// default: ['#ccece6', '#00441b'], // BuGn.9 [2-8]
description: 'Color range to encode quantitative variables.',
minItems: 2,
maxItems: 2,
items: {

@@ -426,3 +437,4 @@ type: 'string',

enum: ['circle', 'square', 'cross', 'diamond', 'triangle-up', 'triangle-down'],
default: 'circle'
default: 'circle',
description: 'Mark to be used.'
},

@@ -432,3 +444,3 @@ filled: {

default: false,
description: 'whether the shape\'s color should be used as fill color instead of stroke color'
description: 'Whether the shape\'s color should be used as fill color instead of stroke color.'
}

@@ -594,3 +606,3 @@ }

role: 'color',
default: 'black'
default: '#000000'
},

@@ -617,2 +629,6 @@ gridOpacity: {

},
autoSortLine: {
type: 'boolean',
default: true
},

@@ -656,3 +672,3 @@ // single plot

role: 'color',
default: 'black'
default: '#000000'
},

@@ -668,3 +684,3 @@ cellGridOpacity: {

role: 'color',
default: 'transparent'
default: 'rgba(0,0,0,0)'
},

@@ -671,0 +687,0 @@ textCellWidth: {

@@ -35,3 +35,3 @@ 'use strict';

});
it('should have filter zero in raw', function(){
it('should have filter non-positive in raw', function() {
var rawTransform = _data[0].transform;

@@ -38,0 +38,0 @@ expect(rawTransform[rawTransform.length - 1]).to.eql({

@@ -74,3 +74,120 @@ 'use strict';

describe('point', function() {
describe('1D, horizontal', function() {
var f = fixtures.points['1d_hor'],
e = Encoding.fromSpec(f),
def = marks.point.prop(e, mockLayout, {});
it('should be centered', function() {
expect(def.y).to.eql({value: e.bandSize(Y, mockLayout.y.useSmallBand) / 2});
});
it('should scale on x', function() {
expect(def.x).to.eql({scale: X, field: "data.year"});
});
});
describe('1D, vertical', function() {
var f = fixtures.points['1d_ver'],
e = Encoding.fromSpec(f),
def = marks.point.prop(e, mockLayout, {});
it('should be centered', function() {
expect(def.x).to.eql({value: e.bandSize(X, mockLayout.x.useSmallBand) / 2});
});
it('should scale on y', function() {
expect(def.y).to.eql({scale: Y, field: "data.year"});
});
});
describe('2D, x and y', function() {
var f = fixtures.points['x,y'],
e = Encoding.fromSpec(f),
def = marks.point.prop(e, mockLayout, {});
it('should scale on x', function() {
expect(def.x).to.eql({scale: X, field: "data.year"});
});
it('should scale on y', function(){
expect(def.y).to.eql({scale: Y, field: "data.yield"});
});
});
describe('3D', function() {
describe('x,y,size', function () {
var f = fixtures.points['x,y,size'],
e = Encoding.fromSpec(f),
def = marks.point.prop(e, mockLayout, {});
it('should have scale for size', function () {
expect(def.size).to.eql({scale: SIZE, field: "data.count"});
});
});
describe('x,y,color', function () {
var f = fixtures.points['x,y,stroke'],
e = Encoding.fromSpec(f),
def = marks.point.prop(e, mockLayout, {});
it('should have scale for color', function () {
expect(def.stroke).to.eql({scale: COLOR, field: "data.yield"});
});
});
describe('x,y,shape', function () {
var f = fixtures.points['x,y,shape'],
e = Encoding.fromSpec(f),
def = marks.point.prop(e, mockLayout, {});
it('should have scale for shape', function () {
expect(def.shape).to.eql({scale: SHAPE, field: "data.bin_yield"});
});
});
});
});
describe('line', function() {
describe('2D, x and y', function() {
var f = fixtures.lines['x,y'],
e = Encoding.fromSpec(f),
def = marks.line.prop(e, mockLayout, {});
it('should have scale for x', function() {
expect(def.x).to.eql({scale: X, field: "data.year"});
});
it('should have scale for y', function(){
expect(def.y).to.eql({scale: Y, field: "data.yield"});
});
});
describe('3D', function() {
describe('x,y,color', function () {
var f = fixtures.lines['x,y,stroke'],
e = Encoding.fromSpec(f),
def = marks.line.prop(e, mockLayout, {});
it('should have scale for color', function () {
expect(def.stroke).to.eql({scale: COLOR, field: "data.Acceleration"});
});
});
});
});
describe('area', function() {
describe('2D, x and y', function() {
var f = fixtures.area['x,y'],
e = Encoding.fromSpec(f),
def = marks.area.prop(e, mockLayout, {});
it('should have scale for x', function() {
expect(def.x).to.eql({scale: X, field: "data.Displacement"});
});
it('should have scale for y', function(){
expect(def.y).to.eql({scale: Y, field: "data.Acceleration"});
});
});
describe('3D', function() {
describe('x,y,color', function () {
var f = fixtures.area['x,y,stroke'],
e = Encoding.fromSpec(f),
def = marks.area.prop(e, mockLayout, {});
it('should have scale for color', function () {
expect(def.fill).to.eql({scale: COLOR, field: "data.Miles_per_Gallon"});
});
});
});
});
// TODO add other type of marks
});

@@ -9,7 +9,6 @@ var f = {};

"marktype": "bar",
encoding: {
"encoding": {
"x": {"bin": {"maxbins": 15},"type": "Q","name": "IMDB_Rating"},
"y": {"scale": {"type": "log"},"type": "Q","name": "US_Gross","aggregate": "avg"}
},
"config": {"singleHeight": 400,"singleWidth": 400,"largeBandMaxCardinality": 20},
"data": {"url": "data/movies.json"}

@@ -20,7 +19,6 @@ };

"marktype": "bar",
encoding: {
"encoding": {
"y": {"bin": {"maxbins": 15},"type": "Q","name": "IMDB_Rating"},
"x": {"scale": {"type": "log"},"type": "Q","name": "US_Gross","aggregate": "avg"}
},
"config": {"singleHeight": 400,"singleWidth": 400,"largeBandMaxCardinality": 20},
"data": {"url": "data/movies.json"}

@@ -31,4 +29,3 @@ };

"marktype": "bar",
encoding: {"x": {"type": "Q","name": "US_Gross","aggregate": "sum"}},
"config": {"singleHeight": 400,"singleWidth": 400,"largeBandMaxCardinality": 20},
"encoding": {"x": {"type": "Q","name": "US_Gross","aggregate": "sum"}},
"data": {"url": "data/movies.json"}

@@ -40,4 +37,3 @@ };

"marktype": "bar",
encoding: {"y": {"type": "Q","name": "US_Gross","aggregate": "sum"}},
"config": {"singleHeight": 400,"singleWidth": 400,"largeBandMaxCardinality": 20},
"encoding": {"y": {"type": "Q","name": "US_Gross","aggregate": "sum"}},
"data": {"url": "data/movies.json"}

@@ -67,2 +63,97 @@ };

// POINT
f.points = {};
f.points['1d_hor'] = {
"marktype": "point",
"encoding": {"x": {"name": "year","type": "O"}},
"data": {"url": "data/barley.json"}
};
f.points['1d_ver'] = {
"marktype": "point",
"encoding": {"y": {"name": "year","type": "O"}},
"data": {"url": "data/barley.json"}
};
f.points['x,y'] = {
"marktype": "point",
"encoding": {"x": {"name": "year","type": "O"},"y": {"name": "yield","type": "Q"}},
"data": {"url": "data/barley.json"}
};
f.points['x,y,size'] = {
"marktype": "point",
"encoding": {
"x": {"name": "year","type": "O"},
"y": {"name": "yield","type": "Q"},
"size": {"name": "*","type": "Q","aggregate": "count"}
},
"data": {"url": "data/barley.json"}
};
f.points['x,y,stroke'] = {
"marktype": "point",
"encoding": {
"x": {"name": "year","type": "O"},
"y": {"name": "yield","type": "Q"},
"color": {"name": "yield","type": "Q"}
},
"data": {"url": "data/barley.json"}
};
f.points['x,y,shape'] = {
"marktype": "point",
"encoding": {
"x": {"name": "year","type": "O"},
"y": {"name": "yield","type": "Q"},
"shape": {"bin": {"maxbins": 15},"name": "yield","type": "Q"}
},
"data": {"url": "data/barley.json"}
};
// LINE
f.lines = {};
f.lines['x,y'] = {
"marktype": "line",
"encoding": {"x": {"name": "year","type": "O"},"y": {"name": "yield","type": "Q"}},
"data": {"url": "data/barley.json"}
};
f.lines['x,y,stroke'] = {
"marktype": "line",
"encoding": {
"x": {"name": "name","type": "N"},
"y": {"name": "Cylinders","type": "O"},
"color": {"name": "Acceleration","type": "Q"}
},
"data": {"url": "data/cars.json"}
};
// AREA
f.area = {};
f.area['x,y'] = {
"marktype": "area",
"encoding": {
"x": {"name": "Displacement","type": "Q"},
"y": {"name": "Acceleration","type": "Q"}
},
"data": {"url": "data/cars.json"}
};
f.area['x,y,stroke'] = {
"marktype": "area",
"encoding": {
"x": {"name": "Displacement","type": "Q"},
"y": {"name": "Acceleration","type": "Q"},
"color": {"name": "Miles_per_Gallon","type": "Q"}
},
"data": {"url": "data/cars.json"}
};
module.exports = f;
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