vega-lite
Advanced tools
Comparing version 0.8.0 to 0.8.1
{ | ||
"name": "vega-lite", | ||
"main": "vega-lite.js", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"homepage": "https://github.com/vega/vega-lite", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -105,4 +105,4 @@ Vega-lite's top-level `encoding` property is a key-value mapping between | ||
Vega-lite's `axis` object supports the following [Vega axis properties](https://github.com/vega/vega/wiki/Axes#axis-properties)<sup>1</sup>: | ||
`format`, `grid`, `layer`, `orient`, `ticks`, `title`<sup>2</sup>, and `titleOffset`<sup>3</sup>. | ||
Vega-lite's `axis` object supports the following [Vega axis properties](https://github.com/vega/vega/wiki/Axes#axis-properties): | ||
`format`, `grid`<sup>1</sup>, `layer`, `orient`, `ticks`, `title` <sup>2</sup>, and `titleOffset`<sup>3,4</sup>. | ||
See [Vega documentation](https://github.com/vega/vega/wiki/Axes#axis-properties) for more information. | ||
@@ -119,13 +119,18 @@ | ||
<sup>1</sup> | ||
If `grid` is unspecified, the default value is `true` for ROW and COL. For X | ||
and Y, the default value is `true` for quantitative and time fields and `false` | ||
otherwise. | ||
<sup>1</sup> __In Roadmap__: | ||
Other applicable Vega axis properties will be added. [#181](../../issues/181) | ||
<sup>2</sup> | ||
If unspecified, axis's `title` is generated from the field's name and transformation function applied e.g, "field_name", "SUM(field_name)", "BIN(field_name)", "YEAR(field_name)". | ||
If `title` is unspecified, the default value is produced from the field's name and transformation function applied e.g, "field_name", "SUM(field_name)", "BIN(field_name)", "YEAR(field_name)". | ||
<sup>3</sup> | ||
If unspecified, `titleOffset` is automatically determined. | ||
If `titleOffset` is unspecified, the default value is automatically determined. | ||
__TODO: add detail about default behavior__ | ||
<sup>4</sup> __In Roadmap__: | ||
Other applicable Vega axis properties will be added. [#181](../../issues/181) | ||
## legends | ||
@@ -132,0 +137,0 @@ |
@@ -6,7 +6,7 @@ 'use strict'; | ||
// generates spec.json | ||
// generates vega-lite-schema.json | ||
gulp.task('schema', function () { | ||
gulp.src('src/schema/schemagen.js') | ||
.pipe($.run('node', {silent: true, cwd: 'src/schema'})) | ||
.pipe($.rename('spec.json')) | ||
.pipe($.rename('vega-lite-schema.json')) | ||
.pipe(gulp.dest('.')); | ||
@@ -21,2 +21,1 @@ }); | ||
}); | ||
{ | ||
"name": "vega-lite", | ||
"author": "Jeffrey Heer, Dominik Moritz, Kanit \"Ham\" Wongsuphasawat", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"collaborators": [ | ||
@@ -6,0 +6,0 @@ "Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)", |
@@ -19,3 +19,3 @@ # Vega-lite | ||
The complete schema for specifications as [JSON schema](http://json-schema.org/) is at [spec.json](https://vega.github.io/vega-lite/spec.json). | ||
The complete schema for specifications as [JSON schema](http://json-schema.org/) is at [vega-lite-schema.json](https://vega.github.io/vega-lite/vega-lite-schema.json). | ||
@@ -81,3 +81,3 @@ ## Example specification | ||
You can `npm run watch` to start a watcher task that regenerate the `spec.json` file whenever `schema.js` changes, and lints and tests all JS files when any `.js` file in `test/` or `src/` changes. | ||
You can `npm run watch` to start a watcher task that regenerate the `vega-lite-schema.json` file whenever `schema.js` changes, and lints and tests all JS files when any `.js` file in `test/` or `src/` changes. | ||
@@ -105,2 +105,1 @@ Note: These commands use [Gulp](http://gulpjs.com) internally; to run them directly (instead of through the `npm run` aliases), install gulp globally with | ||
Now all the changes you make in Datalib are reflected in your Vega-lite automatically. | ||
@@ -17,2 +17,4 @@ 'use strict'; | ||
// TODO: rename def to axisDef and avoid side effects where possible. | ||
var def = { | ||
@@ -25,3 +27,6 @@ type: type, | ||
def = axis.orient(def, encoding, name, stats); | ||
var orient = axis.orient(encoding, name, stats); | ||
if (orient) { | ||
def.orient = orient; | ||
} | ||
@@ -54,3 +59,5 @@ // Add axis label custom scale (for bin / time) | ||
if (isRow || isCol) def = axis.hideTicks(def); | ||
if (isRow || isCol) { | ||
def = axis.hideTicks(def); | ||
} | ||
@@ -60,15 +67,13 @@ return def; | ||
axis.orient = function(def, encoding, name, stats) { | ||
axis.orient = function(encoding, name, stats) { | ||
var orient = encoding.encDef(name).axis.orient; | ||
if (orient) { | ||
def.orient = orient; | ||
return orient; | ||
} else if (name === COL) { | ||
def.orient = 'top'; | ||
return 'top'; | ||
} else if (name === X && encoding.has(Y) && encoding.isOrdinalScale(Y) && encoding.cardinality(Y, stats) > 30) { | ||
// x-axis for long y - put on top | ||
return 'top'; | ||
} | ||
// x-axis for long y - put on top | ||
else if (name === X && encoding.has(Y) && encoding.isOrdinalScale(Y) && encoding.cardinality(Y, stats) > 30) { | ||
def.orient = 'top'; | ||
} | ||
return def; | ||
return undefined; | ||
}; | ||
@@ -81,3 +86,11 @@ | ||
if (encoding.axis(name).grid) { | ||
var _grid = encoding.axis(name).grid; | ||
// If `grid` is unspecified, the default value is `true` for ROW and COL. For X | ||
// and Y, the default value is `true` for quantitative and time fields and `false` otherwise. | ||
var grid = _grid === undefined ? | ||
(name === ROW || name === COL || encoding.isTypes(name, [Q, T])) : | ||
_grid; | ||
if (grid) { | ||
def.grid = true; | ||
@@ -84,0 +97,0 @@ |
@@ -169,4 +169,4 @@ // Package of defining Vega-lite Specification's json schema | ||
type: 'boolean', | ||
default: true, | ||
description: 'A flag indicate if gridlines should be created in addition to ticks.' | ||
default: undefined, | ||
description: 'A flag indicate if gridlines should be created in addition to ticks. If `grid` is unspecified, the default value is `true` for ROW and COL. For X and Y, the default value is `true` for quantitative and time fields and `false` otherwise.' | ||
}, | ||
@@ -173,0 +173,0 @@ layer: { |
@@ -89,3 +89,3 @@ 'use strict'; | ||
it('should return specified orient', function () { | ||
var def = axis.orient({}, Encoding.fromSpec({ | ||
var orient = axis.orient(Encoding.fromSpec({ | ||
encoding: { | ||
@@ -95,7 +95,7 @@ x: {name: 'a', axis:{orient: 'bottom'}} | ||
}), 'x', stats); | ||
expect(def.orient).to.eql('bottom'); | ||
expect(orient).to.eql('bottom'); | ||
}); | ||
it('should return undefined by default', function () { | ||
var def = axis.orient({}, Encoding.fromSpec({ | ||
var orient = axis.orient(Encoding.fromSpec({ | ||
encoding: { | ||
@@ -105,7 +105,7 @@ x: {name: 'a'} | ||
}), 'x', stats); | ||
expect(def.orient).to.eql(undefined); | ||
expect(orient).to.eql(undefined); | ||
}); | ||
it('should return top for COL', function () { | ||
var def = axis.orient({}, Encoding.fromSpec({ | ||
var orient = axis.orient(Encoding.fromSpec({ | ||
encoding: { | ||
@@ -116,7 +116,7 @@ x: {name: 'a'}, | ||
}), 'col', stats); | ||
expect(def.orient).to.eql('top'); | ||
expect(orient).to.eql('top'); | ||
}); | ||
it('should return top for X with high cardinality, ordinal Y', function () { | ||
var def = axis.orient({}, Encoding.fromSpec({ | ||
var orient = axis.orient(Encoding.fromSpec({ | ||
encoding: { | ||
@@ -127,3 +127,3 @@ x: {name: 'a'}, | ||
}), 'x', stats); | ||
expect(def.orient).to.eql('top'); | ||
expect(orient).to.eql('top'); | ||
}); | ||
@@ -130,0 +130,0 @@ }); |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4600162
25002
7
103