vega-lite
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "vega-lite", | ||
"author": "Jeffrey Heer, Dominik Moritz, Kanit \"Ham\" Wongsuphasawat", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"collaborators": [ | ||
@@ -57,28 +57,28 @@ "Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)", | ||
"devDependencies": { | ||
"browser-sync": "^2.12.8", | ||
"browserify": "^13.0.1", | ||
"browserify-versionify": "^1.0.6", | ||
"chai": "^3.5.0", | ||
"cheerio": "^0.20.0", | ||
"exorcist": "^0.4.0", | ||
"istanbul": "^0.4.3", | ||
"browser-sync": "~2.12.8", | ||
"browserify": "~13.0.1", | ||
"browserify-versionify": "~1.0.6", | ||
"chai": "~3.5.0", | ||
"cheerio": "~0.20.0", | ||
"exorcist": "~0.4.0", | ||
"istanbul": "~0.4.3", | ||
"json-diff": "^0.3.1", | ||
"mocha": "^2.4.5", | ||
"nodemon": "^1.9.2", | ||
"source-map-support": "^0.4.0", | ||
"tsify": "^0.16.0", | ||
"tslint": "^3.10.2", | ||
"mocha": "~2.4.5", | ||
"nodemon": "~1.9.2", | ||
"source-map-support": "~0.4.0", | ||
"tsify": "~0.16.0", | ||
"tslint": "~3.10.2", | ||
"typescript": "^1.8.10", | ||
"typescript-json-schema": "^0.1.1", | ||
"uglify-js": "^2.6.2", | ||
"vega": "^2.6.0", | ||
"typescript-json-schema": "~0.1.1", | ||
"uglify-js": "~2.6.2", | ||
"vega": "~2.6.0", | ||
"vega-datasets": "vega/vega-datasets#gh-pages", | ||
"watchify": "^3.7.0", | ||
"yaml-front-matter": "^3.4.0", | ||
"z-schema": "^3.17.0" | ||
"watchify": "~3.7.0", | ||
"yaml-front-matter": "~3.4.0", | ||
"z-schema": "~3.17.0" | ||
}, | ||
"dependencies": { | ||
"datalib": "^1.7.0", | ||
"json-stable-stringify": "^1.0.1", | ||
"yargs": "^4.7.1" | ||
"datalib": "~1.7.0", | ||
"json-stable-stringify": "~1.0.1", | ||
"yargs": "~4.7.1" | ||
}, | ||
@@ -85,0 +85,0 @@ "browserify": { |
@@ -111,5 +111,5 @@ export enum ScaleType { | ||
/** | ||
* The domain of the scale, representing the set of data values. For quantitative data, this can take the form of a two-element array with minimum and maximum values. For ordinal/categorical data, this may be an array of valid input values. The domain may also be specified by a reference to a data source. | ||
* The domain of the scale, representing the set of data values. For quantitative data, this can take the form of a two-element array with minimum and maximum values. For ordinal/categorical data, this may be an array of valid input values. | ||
*/ | ||
domain?: string | number[] | string[]; // TODO: declare vgDataDomain | ||
domain?: number[] | string[]; // TODO: declare vgDataDomain | ||
/** | ||
@@ -116,0 +116,0 @@ * The range of the scale, representing the set of visual values. For numeric values, the range can take the form of a two-element array with minimum and maximum values. For ordinal or quantized data, the range may by an array of desired output values, which are mapped to elements in the specified domain. For ordinal scales only, the range can be defined using a DataRef: the range values are then drawn dynamically from a backing data set. |
@@ -49,2 +49,39 @@ "use strict"; | ||
exports.isSingleTimeUnit = isSingleTimeUnit; | ||
function convert(unit, date) { | ||
var result = new Date(0, 0, 1, 0, 0, 0, 0); | ||
exports.SINGLE_TIMEUNITS.forEach(function (singleUnit) { | ||
if (containsTimeUnit(unit, singleUnit)) { | ||
switch (singleUnit) { | ||
case TimeUnit.DAY: | ||
throw new Error('Cannot convert to TimeUnits containing \'day\''); | ||
case TimeUnit.YEAR: | ||
result.setFullYear(date.getFullYear()); | ||
break; | ||
case TimeUnit.QUARTER: | ||
result.setMonth((Math.floor(date.getMonth() / 3)) * 3); | ||
break; | ||
case TimeUnit.MONTH: | ||
result.setMonth(date.getMonth()); | ||
break; | ||
case TimeUnit.DATE: | ||
result.setDate(date.getDate()); | ||
break; | ||
case TimeUnit.HOURS: | ||
result.setHours(date.getHours()); | ||
break; | ||
case TimeUnit.MINUTES: | ||
result.setMinutes(date.getMinutes()); | ||
break; | ||
case TimeUnit.SECONDS: | ||
result.setSeconds(date.getSeconds()); | ||
break; | ||
case TimeUnit.MILLISECONDS: | ||
result.setMilliseconds(date.getMilliseconds()); | ||
break; | ||
} | ||
} | ||
}); | ||
return result; | ||
} | ||
exports.convert = convert; | ||
exports.MULTI_TIMEUNITS = [ | ||
@@ -51,0 +88,0 @@ TimeUnit.YEARQUARTER, |
@@ -16,2 +16,5 @@ import {COLUMN, ROW, SHAPE, COLOR, Channel} from './channel'; | ||
YEARMONTH = 'yearmonth' as any, | ||
// Note: don't add MONTH DATE because it will be incorrect | ||
// since days on a leap year will be shifted by one if | ||
// we only add | ||
YEARMONTHDATE = 'yearmonthdate' as any, | ||
@@ -53,2 +56,46 @@ YEARMONTHDATEHOURS = 'yearmonthdatehours' as any, | ||
/** | ||
* Converts a date to only have the measurements relevant to the specified unit | ||
* i.e. ('yearmonth', '2000-12-04 07:58:14') -> '2000-12-01 00:00:00' | ||
* Note: the base date is Jan 01 1900 00:00:00 | ||
*/ | ||
export function convert(unit: TimeUnit, date: Date): Date { | ||
const result: Date = new Date(0, 0, 1, 0, 0, 0, 0); // start with uniform date | ||
SINGLE_TIMEUNITS.forEach(function(singleUnit) { | ||
if (containsTimeUnit(unit, singleUnit)) { | ||
switch (singleUnit) { | ||
case TimeUnit.DAY: | ||
throw new Error('Cannot convert to TimeUnits containing \'day\''); | ||
case TimeUnit.YEAR: | ||
result.setFullYear(date.getFullYear()); | ||
break; | ||
case TimeUnit.QUARTER: | ||
// indicate quarter by setting month to be the first of the quarter i.e. may (4) -> april (3) | ||
result.setMonth((Math.floor(date.getMonth() / 3)) * 3); | ||
break; | ||
case TimeUnit.MONTH: | ||
result.setMonth(date.getMonth()); | ||
break; | ||
case TimeUnit.DATE: | ||
result.setDate(date.getDate()); | ||
break; | ||
case TimeUnit.HOURS: | ||
result.setHours(date.getHours()); | ||
break; | ||
case TimeUnit.MINUTES: | ||
result.setMinutes(date.getMinutes()); | ||
break; | ||
case TimeUnit.SECONDS: | ||
result.setSeconds(date.getSeconds()); | ||
break; | ||
case TimeUnit.MILLISECONDS: | ||
result.setMilliseconds(date.getMilliseconds()); | ||
break; | ||
} | ||
} | ||
}); | ||
return result; | ||
} | ||
export const MULTI_TIMEUNITS = [ | ||
@@ -55,0 +102,0 @@ TimeUnit.YEARQUARTER, |
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 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
2465389
33800
+ Addedacorn@7.4.1(transitive)
+ Addedbrfs@1.6.1(transitive)
+ Addedbuffer-equal@0.0.1(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedd3@3.5.17(transitive)
+ Addedd3-geo-projection@0.2.16(transitive)
+ Addedd3-queue@1.2.32.0.3(transitive)
+ Addeddatalib@1.7.3(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addedduplexer2@0.1.4(transitive)
+ Addedescodegen@1.9.12.1.0(transitive)
+ Addedesprima@3.1.34.0.1(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfalafel@2.2.5(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedhas@1.0.4(transitive)
+ Addedhttp-basic@2.5.1(transitive)
+ Addedhttp-response-object@1.1.0(transitive)
+ Addediconv-lite@0.2.11(transitive)
+ Addedjson-stable-stringify@1.0.2(transitive)
+ Addedlevn@0.3.0(transitive)
+ Addedmagic-string@0.22.5(transitive)
+ Addedmerge-source-map@1.0.4(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedobject-inspect@1.4.1(transitive)
+ Addedoptimist@0.3.7(transitive)
+ Addedoptionator@0.8.3(transitive)
+ Addedos-shim@0.1.3(transitive)
+ Addedpkg-conf@1.1.3(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedquote-stream@1.0.2(transitive)
+ Addedrw@1.3.3(transitive)
+ Addedset-blocking@1.0.0(transitive)
+ Addedshallow-copy@0.0.1(transitive)
+ Addedshapefile@0.3.1(transitive)
+ Addedsource-map@0.5.70.6.1(transitive)
+ Addedspawn-sync@1.0.15(transitive)
+ Addedstatic-eval@2.1.1(transitive)
+ Addedstatic-module@2.2.5(transitive)
+ Addedsymbol@0.2.3(transitive)
+ Addedsync-request@2.2.0(transitive)
+ Addedthen-request@2.2.0(transitive)
+ Addedthrough2@2.0.5(transitive)
+ Addedtopojson@1.6.27(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedvlq@0.2.3(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedwordwrap@0.0.3(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedyargs@4.7.1(transitive)
- Removed@types/concat-stream@1.6.1(transitive)
- Removed@types/form-data@0.0.33(transitive)
- Removed@types/node@10.17.608.10.66(transitive)
- Removed@types/qs@6.9.15(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcommander@2.20.3(transitive)
- Removeddatalib@1.9.3(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedget-caller-file@1.0.3(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedget-port@3.2.0(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhttp-basic@8.1.3(transitive)
- Removedhttp-response-object@3.0.2(transitive)
- Removedjson-stable-stringify@1.1.1(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedparse-cache-control@1.0.1(transitive)
- Removedpromise@8.3.0(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsync-request@6.1.0(transitive)
- Removedsync-rpc@1.3.6(transitive)
- Removedthen-request@6.0.2(transitive)
- Removedtopojson-client@3.1.0(transitive)
- Removedwhich-module@1.0.0(transitive)
- Removedyargs@4.8.1(transitive)
Updateddatalib@~1.7.0
Updatedjson-stable-stringify@~1.0.1
Updatedyargs@~4.7.1