new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

D3 · all subjects

d3-scale/band

13 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

scaleBand constructor

d3.scaleBand(domain, range) constructs a new band scale with the specified domain and range, no padding, no rounding and center alignment. Domain defaults to the empty domain and range defaults to [0, 1]. If a single argument is specified, it is interpreted as the range.

band scale call returns band start

Calling a band scale with a value returns the start of the corresponding band derived from the output range. If the value is not in the scale's domain, returns undefined.

band.domain method

band.domain(domain) sets the domain to the specified array of values and returns the scale. Domain values are stored internally in an InternMap from primitive value to index. If domain is not specified, returns the current domain. The first element in domain maps to the first band, the second domain value to the second band, and so on.

band.range method

band.range(range) sets the scale's range to the specified two-element array of numbers and returns the scale. If the elements are not numbers, they will be coerced to numbers. If range is not specified, returns the current range, which defaults to [0, 1].

band.round method

band.round(round) enables or disables rounding and returns the scale. When rounding is enabled, the start and stop of each band will be integers. If round is not specified, returns whether rounding is enabled, defaulting to false. If the width of the range is not a multiple of the cardinality of the domain, there may be leftover unused space even without padding.

band.paddingInner method

band.paddingInner(padding) sets the inner padding to the specified number which must be less than or equal to 1 and returns the scale. If padding is not specified, returns the current inner padding, defaulting to 0. Inner padding specifies the proportion of the range reserved for blank space between bands; a value of 0 means no blank space between bands, and a value of 1 means a bandwidth of zero.

band.paddingOuter method

band.paddingOuter(padding) sets the outer padding to the specified number, typically in the range [0, 1], and returns the scale. If padding is not specified, returns the current outer padding, defaulting to 0. Outer padding specifies the amount of blank space, in terms of multiples of the step, to reserve before the first band and after the last band.

band.padding method

band.padding(padding) is a convenience method for setting both inner and outer padding to the same value and returns the scale. If padding is not specified, returns the current inner padding.

band.align method

band.align(align) sets the alignment to the specified value which must be in the range [0, 1] and returns the scale. If align is not specified, returns the current alignment, defaulting to 0.5. The alignment specifies how outer padding is distributed in the range. A value of 0.5 indicates the bands should be centered within the range. A value of 0 or 1 shifts the bands to one side.

band.bandwidth method

band.bandwidth() returns the width of each band.

band.step method

band.step() returns the distance between the starts of adjacent bands.

band.copy method

band.copy() returns an exact copy of the scale. Changes to the original scale will not affect the copy, and vice versa.

Band scales divide continuous range into uniform bands

Band scales are like ordinal scales except the output range is continuous and numeric. The scale divides the continuous range into uniform bands. Band scales are typically used for bar charts with an ordinal or categorical dimension.

Give your agent this brain