vega-lite
Advanced tools
Comparing version 0.7.6 to 0.7.7
{ | ||
"name": "vega-lite", | ||
"main": "vega-lite.js", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"homepage": "https://github.com/uwdata/vega-lite", | ||
@@ -30,4 +30,4 @@ "authors": [ | ||
"dependencies": { | ||
"datalib": "~1.1.12" | ||
"datalib": "^1.3.0" | ||
} | ||
} |
'use strict'; | ||
/*global location, d3, vl, vg, docCookies, document, $, alert, dl */ | ||
/*global location, d3, vl, vg, docCookies, document, $, alert */ | ||
@@ -78,3 +78,3 @@ var DATASETS = [ | ||
vled.parse = function() { | ||
var spec, encoding; | ||
var spec; | ||
try { | ||
@@ -102,4 +102,3 @@ spec = JSON.parse(d3.select('#vlspec').property('value')); | ||
}; | ||
encoding = vl.Encoding.fromSpec(spec, theme); | ||
vled.loadEncoding(encoding); | ||
vled.loadSpec(spec, theme); | ||
}; | ||
@@ -124,16 +123,15 @@ | ||
var encoding = vl.Encoding.parseShorthand(shorthand); | ||
d3.select('#vlspec').node().value = JSON.stringify(encoding.toSpec(), null, ' ', 60); | ||
var spec = vl.compile(shorthand, vled.dataset.stats); | ||
d3.select('#vlspec').node().value = JSON.stringify(spec, null, ' ', 60); | ||
vled.parse(); | ||
}; | ||
vled.loadEncoding = function(encoding) { | ||
var stats = encoding.hasValues() ? null : vled.dataset.stats; | ||
var spec = vl.compile.encoding(encoding, stats); | ||
vled.loadSpec = function(vlspec, theme) { | ||
var spec = vl.compile(vlspec, vled.dataset.stats, theme); | ||
d3.select('#shorthand').node().value = encoding.toShorthand(); | ||
d3.select('#shorthand').node().value = vl.toShorthand(vlspec); | ||
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(vlspec), 86400); | ||
@@ -224,2 +222,2 @@ $('textarea').trigger('autosize.resize'); | ||
window.onload = vled.init; | ||
window.onload = vled.init; |
{ | ||
"name": "vega-lite", | ||
"author": "Jeffrey Heer, Dominik Moritz, Kanit \"Ham\" Wongsuphasawat", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"collaborators": [ | ||
@@ -22,3 +22,3 @@ "Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)", | ||
}, | ||
"license": "BSD", | ||
"license": "BSD-3-Clause", | ||
"bugs": { | ||
@@ -25,0 +25,0 @@ "url": "https://github.com/uwdata/vega-lite/issues" |
@@ -179,4 +179,6 @@ 'use strict'; | ||
} | ||
} else if (encoding.isType(name, [N, O]) && encoding.axis(name).maxLabelLength) { | ||
} else if (encoding.isTypes(name, [N, O]) && encoding.axis(name).maxLabelLength) { | ||
setter(def, textTemplatePath, '{{data | truncate:' + encoding.axis(name).maxLabelLength + '}}'); | ||
} else { | ||
// nothing | ||
} | ||
@@ -183,0 +185,0 @@ |
@@ -94,5 +94,12 @@ 'use strict'; | ||
// FIXME determine constant for Q and T in a nicer way | ||
return encoding.isType(et, Q) ? 20 : | ||
encoding.isType(et, T) ? 20 : | ||
stats[encoding.fieldName(et)].max; | ||
if (encoding.bin(et)) { | ||
return 5; | ||
} else if (encoding.isType(et, Q)) { | ||
return 10; | ||
} else if (encoding.isType(et, T)) { | ||
return 15; | ||
} else if (encoding.isTypes(et, [N, O]) && encoding.axis(et).maxLabelLength) { | ||
return Math.min(stats[encoding.fieldName(et)].max, encoding.axis(et).maxLabelLength); | ||
} | ||
return stats[encoding.fieldName(et)].max; | ||
} | ||
@@ -115,2 +122,4 @@ | ||
} | ||
} else { | ||
// nothing | ||
} | ||
@@ -117,0 +126,0 @@ setter(layout,[x, 'axisTitleOffset'], encoding.config('characterWidth') * maxLength + 20); |
@@ -182,5 +182,5 @@ 'use strict'; | ||
if (cardinality <= 10) { | ||
range = 'category10k'; | ||
range = encoding.config('c10palette'); | ||
} else { | ||
range = 'category20'; | ||
range = encoding.config('c20palette'); | ||
} | ||
@@ -187,0 +187,0 @@ } else { |
@@ -220,3 +220,3 @@ 'use strict'; | ||
// FIXME | ||
Encoding.toggleSort.support({enc:this._enc}, stats, true) && //HACK | ||
Encoding.toggleSort.support({encoding:this._enc}, stats, true) && //HACK | ||
this.config('toggleSort') === Q | ||
@@ -275,6 +275,9 @@ ) { | ||
var field = this.enc(et); | ||
return field && Encoding.isType(field, type); | ||
return field && vlfield.isType(field, type); | ||
}; | ||
Encoding.isType = vlfield.isType; | ||
proto.isTypes = function(et, type) { | ||
var field = this.enc(et); | ||
return field && vlfield.isTypes(field, type); | ||
}; | ||
@@ -281,0 +284,0 @@ Encoding.isOrdinalScale = function(encoding, encType) { |
@@ -113,3 +113,5 @@ 'use strict'; | ||
vlfield.order.typeThenName = function(field) { | ||
return vlfield.order.type(field) + '_' + field.name.toLowerCase(); | ||
return vlfield.order.type(field) + '_' + | ||
(field.aggregate === 'count' ? '~' : field.name.toLowerCase()); | ||
// ~ is the last character in ASCII | ||
}; | ||
@@ -116,0 +118,0 @@ |
@@ -28,2 +28,9 @@ 'use strict'; | ||
describe('vl.field.isType', function () { | ||
it('should return correct type checking', function() { | ||
var qField = {name: 'number', type:'Q'}; | ||
expect(vlfield.isType(qField, Q)).to.eql(true); | ||
expect(vlfield.isTypes(qField, N)).to.eql(false); | ||
}); | ||
}); | ||
@@ -33,9 +40,9 @@ describe('vl.field.isTypes', function () { | ||
var qField = {name: 'number', type:'Q'}; | ||
expect(vlfield.isType(qField, Q)).to.eql(true); | ||
expect(vlfield.isTypes(qField, [Q])).to.eql(true); | ||
expect(vlfield.isTypes(qField, [Q, O])).to.eql(true); | ||
expect(vlfield.isTypes(qField, [O, Q])).to.eql(true); | ||
expect(vlfield.isTypes(qField, [Q, N])).to.eql(true); | ||
expect(vlfield.isTypes(qField, [N])).to.eql(false); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
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
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
8549285
0
0
140399