Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function layoutGroup(view, group, _) {
var items = group.items,
width = Math.max(0, group.width || 0),
height = Math.max(0, group.height || 0),
viewBounds = new Bounds().set(0, 0, width, height),
xBounds = viewBounds.clone(),
yBounds = viewBounds.clone(),
legends = [], title,
mark, orient, b, i, n;
// layout axes, gather legends, collect bounds
for (i=0, n=items.length; i
function layoutGroup(view, group, _) {
var items = group.items,
width = Math.max(0, group.width || 0),
height = Math.max(0, group.height || 0),
viewBounds = new Bounds().set(0, 0, width, height),
axisBounds = viewBounds.clone(),
xBounds = viewBounds.clone(),
yBounds = viewBounds.clone(),
legends = [], title,
mark, flow, b, i, n;
// layout axes, gather legends, collect bounds
for (i=0, n=items.length; i
function layoutGroup(view, group, _) {
var items = group.items,
width = Math.max(0, group.width || 0),
height = Math.max(0, group.height || 0),
viewBounds = new Bounds().set(0, 0, width, height),
axisBounds = viewBounds.clone(),
xBounds = viewBounds.clone(),
yBounds = viewBounds.clone(),
legends = [], title,
mark, flow, b, i, n;
// layout axes, gather legends, collect bounds
for (i=0, n=items.length; i
import {Transform} from 'vega-dataflow';
import {Bounds, Marks} from 'vega-scenegraph';
import {inherits} from 'vega-util';
/**
* Calculate bounding boxes for scenegraph items.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.mark - The scenegraph mark instance to bound.
*/
export default function Bound(params) {
Transform.call(this, null, params);
}
var prototype = inherits(Bound, Transform),
temp = new Bounds();
prototype.transform = function(_, pulse) {
var view = pulse.dataflow,
mark = _.mark,
type = mark.marktype,
entry = Marks[type],
bound = entry.bound,
clip = mark.clip,
markBounds = mark.bounds, rebound;
if (entry.nested) {
// multi-item marks have a single bounds instance
if (mark.items.length) view.dirty(mark.items[0]);
markBounds = boundItem(mark, bound);
mark.items.forEach(function(item) {
item.bounds.clear().union(markBounds);
var Fit = 'fit',
Pad = 'pad',
None = 'none';
var AxisRole = 'axis',
TitleRole = 'title',
FrameRole = 'frame',
LegendRole = 'legend',
ScopeRole = 'scope',
RowHeader = 'row-header',
RowFooter = 'row-footer',
ColHeader = 'column-header',
ColFooter = 'column-footer';
var AxisOffset = 0.5,
tempBounds = new Bounds();
/**
* Layout view elements such as axes and legends.
* Also performs size adjustments.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.mark - Scenegraph mark of groups to layout.
*/
export default function ViewLayout(params) {
Transform.call(this, null, params);
}
var prototype = inherits(ViewLayout, Transform);
prototype.transform = function(_, pulse) {
// TODO incremental update, output?
var dl = require('datalib'),
Tuple = require('vega-dataflow').Tuple,
parseMark = require('../parse/mark'),
util = require('../util');
var axisBounds = new (require('vega-scenegraph').Bounds)();
var ORDINAL = 'ordinal';
function axs(model, config) {
var scale,
orient = config.orient,
offset = 0,
titleOffset = config.titleOffset,
axisDef = {},
layer = 'front',
grid = false,
title = null,
tickMajorSize = config.tickSize,
tickMinorSize = config.tickSize,
tickEndSize = config.tickSize,
tickPadding = config.tickPadding || config.padding,
tickValues = null,
export default function(b, opt, group) {
if (!b) return [];
const [u, v] = b,
box = new Bounds().set(u[0], u[1], v[0], v[1]),
scene = group || this.context.dataflow.scenegraph().root;
return intersect(scene, box, filter(opt));
}
function boundTest(scale, orient, tolerance) {
var range = scale.range(),
b = new Bounds();
if (orient === Top || orient === Bottom) {
b.set(range[0], -Infinity, range[1], +Infinity);
} else {
b.set(-Infinity, range[0], +Infinity, range[1]);
}
b.expand(tolerance || 1);
return item => b.encloses(item.bounds);
}