public build()

in packages/util-transform/src/facade/bin.ts [163:209]


	public build(df: any, from: any) {
		if (this.fieldValue === undefined) {
			throw new Error('field() must be set on bin transform')
		}
		if (this.extentValue === undefined) {
			throw new Error('extent() must be set on bin transform')
		}

		const spec: any = {
			field: vegaField(this.fieldValue),
			extent: this.extentValue,
			pulse: from,
		}
		if (this.anchorValue) {
			spec.anchor = this.anchorValue
		}
		if (this.maxBinsValue) {
			spec.maxbins = this.maxBinsValue
		}
		if (this.baseValue) {
			spec.base = this.baseValue
		}
		if (this.stepValue) {
			spec.step = this.stepValue
		}
		if (this.stepsValue) {
			spec.stepsValue = this.stepsValue
		}
		if (this.minStepValue) {
			spec.minstep = this.minStepValue
		}
		if (this.divideValue) {
			spec.divide = this.divideValue
		}
		if (this.niceValue !== undefined) {
			spec.nice = this.niceValue
		}
		if (this.asValue) {
			spec.as = this.asValue
		}

		const binNode = df.add(vegaBin, spec)
		if (this.refValue) {
			this.refValue(binNode)
		}
		return binNode
	}