vega-lite
Advanced tools
Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "vega-lite", | ||
"author": "Jeffrey Heer, Dominik Moritz, Kanit \"Ham\" Wongsuphasawat", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"collaborators": [ | ||
@@ -6,0 +6,0 @@ "Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)", |
@@ -106,3 +106,4 @@ "use strict"; | ||
if (!timeUnit || format) { | ||
return '{{' + templateField + ' | time:\'' + (format || config.timeFormat) + '\'}}'; | ||
var _format = format || config.timeFormat; | ||
return '{{' + templateField + ' | time:\'' + _format + '\'}}'; | ||
} | ||
@@ -109,0 +110,0 @@ else { |
@@ -132,3 +132,5 @@ import {COLOR, OPACITY} from '../channel'; | ||
if (!timeUnit || format) { | ||
return '{{' + templateField + ' | time:\'' + (format || config.timeFormat) + '\'}}'; | ||
// If there is not time unit, or if user explicitly specify format for axis/legend/text. | ||
const _format = format || config.timeFormat; // only use config.timeFormat if there is no timeUnit. | ||
return '{{' + templateField + ' | time:\'' + _format + '\'}}'; | ||
} else { | ||
@@ -135,0 +137,0 @@ return timeUnitTemplate(timeUnit, templateField, shortTimeLabels); |
@@ -14,13 +14,20 @@ "use strict"; | ||
var config = model.config(); | ||
var _orient = orient(config.mark.orient); | ||
if (_orient) { | ||
p.orient = _orient; | ||
var orient = config.mark.orient; | ||
if (orient) { | ||
p.orient = { value: orient }; | ||
} | ||
p.x = x(model.encoding().x, model.scaleName(channel_1.X), model.stack()); | ||
var _x2 = x2(model.encoding().x, model.scaleName(channel_1.X), model.stack(), config.mark.orient); | ||
var stack = model.stack(); | ||
var _x = x(model.encoding().x, model.scaleName(channel_1.X), orient, stack); | ||
if (_x) { | ||
p.x = _x; | ||
} | ||
var _y = y(model.encoding().y, model.scaleName(channel_1.Y), orient, stack); | ||
if (_y) { | ||
p.y = _y; | ||
} | ||
var _x2 = x2(model.encoding().x, model.encoding().x2, model.scaleName(channel_1.X), orient, stack); | ||
if (_x2) { | ||
p.x2 = _x2; | ||
} | ||
p.y = y(model.encoding().y, model.scaleName(channel_1.Y), model.stack()); | ||
var _y2 = y2(model.encoding().y, model.scaleName(channel_1.Y), model.stack(), config.mark.orient); | ||
var _y2 = y2(model.encoding().y, model.encoding().y2, model.scaleName(channel_1.Y), orient, stack); | ||
if (_y2) { | ||
@@ -34,9 +41,3 @@ p.y2 = _y2; | ||
area.properties = properties; | ||
function orient(orient) { | ||
if (orient) { | ||
return { value: orient }; | ||
} | ||
return undefined; | ||
} | ||
function x(fieldDef, scaleName, stack) { | ||
function x(fieldDef, scaleName, orient, stack) { | ||
if (stack && channel_1.X === stack.fieldChannel) { | ||
@@ -49,3 +50,22 @@ return { | ||
else if (fielddef_1.isMeasure(fieldDef)) { | ||
return { scale: scaleName, field: fielddef_1.field(fieldDef) }; | ||
if (orient === 'horizontal') { | ||
if (fieldDef && fieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(fieldDef) | ||
}; | ||
} | ||
else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} | ||
else { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(fieldDef) | ||
}; | ||
} | ||
} | ||
@@ -60,15 +80,26 @@ else if (fielddef_1.isDimension(fieldDef)) { | ||
} | ||
function x2(fieldDef, scaleName, stack, orient) { | ||
if (orient === 'horizontal') { | ||
if (stack && channel_1.X === stack.fieldChannel) { | ||
area.x = x; | ||
function x2(xFieldDef, x2FieldDef, scaleName, orient, stack) { | ||
if (stack && channel_1.X === stack.fieldChannel) { | ||
if (orient === 'horizontal') { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(fieldDef, { suffix: '_end' }) | ||
field: fielddef_1.field(xFieldDef, { suffix: '_end' }) | ||
}; | ||
} | ||
else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
else if (fielddef_1.isMeasure(x2FieldDef)) { | ||
if (orient === 'horizontal') { | ||
if (x2FieldDef && x2FieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(x2FieldDef) | ||
}; | ||
} | ||
else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} | ||
@@ -78,3 +109,4 @@ } | ||
} | ||
function y(fieldDef, scaleName, stack) { | ||
area.x2 = x2; | ||
function y(fieldDef, scaleName, orient, stack) { | ||
if (stack && channel_1.Y === stack.fieldChannel) { | ||
@@ -87,6 +119,19 @@ return { | ||
else if (fielddef_1.isMeasure(fieldDef)) { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(fieldDef) | ||
}; | ||
if (orient !== 'horizontal') { | ||
if (fieldDef && fieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(fieldDef) | ||
}; | ||
} | ||
else { | ||
return { field: { group: 'height' } }; | ||
} | ||
} | ||
else { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(fieldDef) | ||
}; | ||
} | ||
} | ||
@@ -101,15 +146,26 @@ else if (fielddef_1.isDimension(fieldDef)) { | ||
} | ||
function y2(fieldDef, scaleName, stack, orient) { | ||
if (orient !== 'horizontal') { | ||
if (stack && channel_1.Y === stack.fieldChannel) { | ||
area.y = y; | ||
function y2(yFieldDef, y2FieldDef, scaleName, orient, stack) { | ||
if (stack && channel_1.Y === stack.fieldChannel) { | ||
if (orient !== 'horizontal') { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(fieldDef, { suffix: '_end' }) | ||
field: fielddef_1.field(yFieldDef, { suffix: '_end' }) | ||
}; | ||
} | ||
else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
else if (fielddef_1.isMeasure(yFieldDef)) { | ||
if (orient !== 'horizontal') { | ||
if (y2FieldDef && y2FieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: fielddef_1.field(y2FieldDef) | ||
}; | ||
} | ||
else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} | ||
@@ -119,2 +175,3 @@ } | ||
} | ||
area.y2 = y2; | ||
function labels(model) { | ||
@@ -121,0 +178,0 @@ return undefined; |
@@ -1,8 +0,9 @@ | ||
import {UnitModel} from '../unit'; | ||
import {VgValueRef} from '../../vega.schema'; | ||
import {X, Y} from '../../channel'; | ||
import {isDimension, isMeasure, FieldDef, field} from '../../fielddef'; | ||
import {VgValueRef} from '../../vega.schema'; | ||
import {StackProperties} from '../../stack'; | ||
import {applyColorAndOpacity, applyMarkConfig} from '../common'; | ||
import {StackProperties} from '../../stack'; | ||
import {UnitModel} from '../unit'; | ||
@@ -19,14 +20,27 @@ export namespace area { | ||
const _orient = orient(config.mark.orient); | ||
if (_orient) { p.orient = _orient; } | ||
const orient = config.mark.orient; | ||
if (orient) { | ||
p.orient = { value: orient} ; | ||
} | ||
p.x = x(model.encoding().x, model.scaleName(X), model.stack()); | ||
const stack = model.stack(); | ||
const _x = x(model.encoding().x, model.scaleName(X), orient, stack); | ||
if (_x) { | ||
p.x = _x; | ||
} | ||
const _x2 = x2(model.encoding().x, model.scaleName(X), model.stack(), config.mark.orient); | ||
if (_x2) { p.x2 = _x2; } | ||
const _y = y(model.encoding().y, model.scaleName(Y), orient, stack); | ||
if (_y) { | ||
p.y = _y; | ||
} | ||
p.y = y(model.encoding().y, model.scaleName(Y), model.stack()); | ||
const _x2 = x2(model.encoding().x, model.encoding().x2, model.scaleName(X), orient, stack); | ||
if (_x2) { | ||
p.x2 = _x2; | ||
} | ||
const _y2 = y2(model.encoding().y, model.scaleName(Y), model.stack(), config.mark.orient); | ||
if (_y2) { p.y2 = _y2; } | ||
const _y2 = y2(model.encoding().y, model.encoding().y2, model.scaleName(Y), orient, stack); | ||
if (_y2) { | ||
p.y2 = _y2; | ||
} | ||
@@ -38,11 +52,3 @@ applyColorAndOpacity(p, model); | ||
function orient(orient: string): VgValueRef { | ||
if (orient) { | ||
return { value: orient }; | ||
} | ||
return undefined; | ||
} | ||
function x(fieldDef: FieldDef, scaleName: string, stack: StackProperties): VgValueRef { | ||
// x | ||
export function x(fieldDef: FieldDef, scaleName: string, orient: string, stack: StackProperties): VgValueRef { | ||
if (stack && X === stack.fieldChannel) { // Stacked Measure | ||
@@ -54,3 +60,21 @@ return { | ||
} else if (isMeasure(fieldDef)) { // Measure | ||
return { scale: scaleName, field: field(fieldDef) }; | ||
if (orient === 'horizontal') { | ||
// x | ||
if (fieldDef && fieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: field(fieldDef) | ||
}; | ||
} else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} else { | ||
return { | ||
scale: scaleName, | ||
field: field(fieldDef) | ||
}; | ||
} | ||
} else if (isDimension(fieldDef)) { | ||
@@ -65,16 +89,25 @@ return { | ||
function x2(fieldDef: FieldDef, scaleName: string, stack: StackProperties, orient: string): VgValueRef { | ||
// x2 | ||
if (orient === 'horizontal') { | ||
if (stack && X === stack.fieldChannel) { | ||
export function x2(xFieldDef: FieldDef, x2FieldDef: FieldDef, scaleName: string, orient: string, stack: StackProperties): VgValueRef { | ||
// x | ||
if (stack && X === stack.fieldChannel) { // Stacked Measure | ||
if (orient === 'horizontal') { | ||
return { | ||
scale: scaleName, | ||
field: field(fieldDef, { suffix: '_end' }) | ||
field: field(xFieldDef, { suffix: '_end' }) | ||
}; | ||
} else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} else if (isMeasure(x2FieldDef)) { // Measure | ||
if (orient === 'horizontal') { | ||
if (x2FieldDef && x2FieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: field(x2FieldDef) | ||
}; | ||
} else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} | ||
} | ||
@@ -84,4 +117,3 @@ return undefined; | ||
function y(fieldDef: FieldDef, scaleName: string, stack: StackProperties): VgValueRef { | ||
// y | ||
export function y(fieldDef: FieldDef, scaleName: string, orient: string, stack: StackProperties): VgValueRef { | ||
if (stack && Y === stack.fieldChannel) { // Stacked Measure | ||
@@ -93,6 +125,18 @@ return { | ||
} else if (isMeasure(fieldDef)) { | ||
return { | ||
scale: scaleName, | ||
field: field(fieldDef) | ||
}; | ||
if (orient !== 'horizontal') { | ||
// y | ||
if (fieldDef && fieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: field(fieldDef) | ||
}; | ||
} else { | ||
return { field: { group: 'height' } }; | ||
} | ||
} else { | ||
return { | ||
scale: scaleName, | ||
field: field(fieldDef) | ||
}; | ||
} | ||
} else if (isDimension(fieldDef)) { | ||
@@ -107,15 +151,25 @@ return { | ||
function y2(fieldDef: FieldDef, scaleName: string, stack: StackProperties, orient: string): VgValueRef { | ||
if (orient !== 'horizontal') { // 'vertical' or undefined are vertical | ||
if (stack && Y === stack.fieldChannel) { | ||
export function y2(yFieldDef: FieldDef, y2FieldDef: FieldDef, scaleName: string, orient: string, stack: StackProperties): VgValueRef { | ||
if (stack && Y === stack.fieldChannel) { // Stacked Measure | ||
if (orient !== 'horizontal') { | ||
return { | ||
scale: scaleName, | ||
field: field(fieldDef, { suffix: '_end' }) | ||
field: field(yFieldDef, { suffix: '_end' }) | ||
}; | ||
} else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} else if (isMeasure(yFieldDef)) { | ||
if (orient !== 'horizontal') { | ||
// y2 | ||
if (y2FieldDef && y2FieldDef.field) { | ||
return { | ||
scale: scaleName, | ||
field: field(y2FieldDef) | ||
}; | ||
} else { | ||
return { | ||
scale: scaleName, | ||
value: 0 | ||
}; | ||
} | ||
} | ||
} | ||
@@ -125,2 +179,3 @@ return undefined; | ||
export function labels(model: UnitModel) { | ||
@@ -127,0 +182,0 @@ // TODO(#240): fill this method |
"use strict"; | ||
var vlBin = require('./bin'); | ||
var vlChannel = require('./channel'); | ||
var vlConfig = require('./config'); | ||
var vlData = require('./data'); | ||
var vlEncoding = require('./encoding'); | ||
var vlFieldDef = require('./fielddef'); | ||
var vlCompile = require('./compile/compile'); | ||
var vlShorthand = require('./shorthand'); | ||
var vlSpec = require('./spec'); | ||
var vlTimeUnit = require('./timeunit'); | ||
var vlType = require('./type'); | ||
var vlValidate = require('./validate'); | ||
var vlUtil = require('./util'); | ||
exports.bin = vlBin; | ||
exports.channel = vlChannel; | ||
exports.compile = vlCompile.compile; | ||
exports.config = vlConfig; | ||
exports.data = vlData; | ||
exports.encoding = vlEncoding; | ||
exports.fieldDef = vlFieldDef; | ||
exports.shorthand = vlShorthand; | ||
exports.spec = vlSpec; | ||
exports.timeUnit = vlTimeUnit; | ||
exports.type = vlType; | ||
exports.util = vlUtil; | ||
exports.validate = vlValidate; | ||
exports.axis = require('./axis'); | ||
exports.aggregate = require('./aggregate'); | ||
exports.bin = require('./bin'); | ||
exports.channel = require('./channel'); | ||
exports.compile = require('./compile/compile').compile; | ||
exports.config = require('./config'); | ||
exports.data = require('./data'); | ||
exports.encoding = require('./encoding'); | ||
exports.facet = require('./facet'); | ||
exports.fieldDef = require('./fieldDef'); | ||
exports.legend = require('./legend'); | ||
exports.mark = require('./mark'); | ||
exports.scale = require('./scale'); | ||
exports.shorthand = require('./shorthand'); | ||
exports.sort = require('./sort'); | ||
exports.spec = require('./spec'); | ||
exports.stack = require('./stack'); | ||
exports.timeUnit = require('./timeUnit'); | ||
exports.transform = require('./transform'); | ||
exports.type = require('./type'); | ||
exports.util = require('./util'); | ||
exports.validate = require('./validate'); | ||
exports.version = '__VERSION__'; | ||
//# sourceMappingURL=vl.js.map |
@@ -1,29 +0,24 @@ | ||
import * as vlBin from './bin'; | ||
import * as vlChannel from './channel'; | ||
import * as vlConfig from './config'; | ||
import * as vlData from './data'; | ||
import * as vlEncoding from './encoding'; | ||
import * as vlFieldDef from './fielddef'; | ||
import * as vlCompile from './compile/compile'; | ||
import * as vlShorthand from './shorthand'; | ||
import * as vlSpec from './spec'; | ||
import * as vlTimeUnit from './timeunit'; | ||
import * as vlType from './type'; | ||
import * as vlValidate from './validate'; | ||
import * as vlUtil from './util'; | ||
export import axis = require('./axis'); | ||
export import aggregate = require('./aggregate'); | ||
export import bin = require('./bin'); | ||
export import channel = require('./channel'); | ||
export const compile = require('./compile/compile').compile; | ||
export import config = require('./config'); | ||
export import data = require('./data'); | ||
export import encoding = require('./encoding'); | ||
export import facet = require('./facet'); | ||
export import fieldDef = require('./fieldDef'); | ||
export import legend = require('./legend'); | ||
export import mark = require('./mark'); | ||
export import scale = require('./scale'); | ||
export import shorthand = require('./shorthand'); | ||
export import sort = require('./sort'); | ||
export import spec = require('./spec'); | ||
export import stack = require('./stack'); | ||
export import timeUnit = require('./timeUnit'); | ||
export import transform = require('./transform'); | ||
export import type = require('./type'); | ||
export import util = require('./util'); | ||
export import validate = require('./validate'); | ||
export const bin = vlBin; | ||
export const channel = vlChannel; | ||
export const compile = vlCompile.compile; | ||
export const config = vlConfig; | ||
export const data = vlData; | ||
export const encoding = vlEncoding; | ||
export const fieldDef = vlFieldDef; | ||
export const shorthand = vlShorthand; | ||
export const spec = vlSpec; | ||
export const timeUnit = vlTimeUnit; | ||
export const type = vlType; | ||
export const util = vlUtil; | ||
export const validate = vlValidate; | ||
export const version = '__VERSION__'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
2359233
32428