Visx Flashcards
Domain
The set of possible output values, which are shown on the y-axis
Generally this is the Min and Max values in the data
Range
all the input values shown on the y-axis
Generally this is 0 to width of the graph
D3 Scale
A function which accepts input within the domain and maps it to output within the range.
You can use the function to calculate positions based on the data:
Domain: 0-10
Range: 0-600
myScale(0); // returns 0 myScale(2); // returns 120 myScale(3); // returns 180 ... myScale(10); // returns 600
What are scale functions used for?
Scales are mainly used for transforming data values to visual variables such as position, length and colour
Linear scale
Linear scale functions are typically used to transform data values into positions and lengths. They are useful when creating bar charts, line charts and many other chart types.
the range can also be specified as colours:
Square Root scale
creates a square-root based scale. It transforms its domain in such a way that if the value b is 4 times bigger than value a, the result is only multiplied by 2.
Its most common use case is to determine the radius of a disk whose surface area must be proportional to the value (useful for sizing circles by area)
Band scale
Band scales are like ordinal scales except the output range is continuous and numeric. Discrete output values are automatically computed by the scale by dividing the continuous range into uniform bands. Band scales are typically used for bar charts with an ordinal or categorical dimension
Log scale
creates a logarithmic scale, a continuous scale in which the domain is transformed by the Math.log function
a log scale domain must be strictly-positive or strictly-negative; the domain must not include or cross zero.
Radial scale
Radial scales are a variant of linear scales where the range is internally squared so that an input value corresponds linearly to the squared output value. These scales are useful when you want the input value to correspond to the area of a graphical mark and the mark is specified by radius, as in a radial bar chart
Ordinal scale
ordinal scales have a discrete domain and range
Point scale
Point scales are a variant of band scales with the bandwidth fixed to zero. Point scales are typically used for scatterplots with an ordinal or categorical dimension
Power scale
creates a power based scale.
The transform applied to values is of the type y = x^k where k, the exponent, can be any real number.
Time scale
Time scales are commonly used for charts where one axis represents the time or date. Line charts, bar charts, you name it. If a dimension of the data is expressed as Date objects, you will probably use d3.scaleTime instead of d3.scaleLinear to represent it on screen
The default domain is one full day, the 1st of January, 2000, in the local time zone (as set in the user’s environment, for example their browser).
axis component
consists of a line with ticks, tick labels, and an axis label that helps viewers interpret your graph.
what are the 5 different Axis components?