Curves topic
Curves turn a discrete (pointwise) representation of a line or area into a continuous shape: curves specify how to interpolate between two-dimensional [x, y] points.
Curves are typically not constructed or used directly. Instead, one of the built-in curves is being passed to line.curve or area.curve.
final line = Line(
(d, i, data) => x(d["date"]),
(d, i, data) => y(d["value"]),
)..curve = curveCatmullRomAlpha(0.5);
If desired, you can implement a custom curve. For an example of using a curve directly, see Context to Curve.
Classes
- Curve Curves
- Curves are typically not used directly, instead being passed to Line.curve and Area.curve. However, you can define your own curve implementation should none of the built-in curves satisfy your needs using the following interface; see the curveLinear source for an example implementation.
- Curve Curves
- Curves are typically not used directly, instead being passed to Line.curve and Area.curve. However, you can define your own curve implementation should none of the built-in curves satisfy your needs using the following interface; see the curveLinear source for an example implementation.
- Curve Curves
- Curves are typically not used directly, instead being passed to Line.curve and Area.curve. However, you can define your own curve implementation should none of the built-in curves satisfy your needs using the following interface; see the curveLinear source for an example implementation.
Functions
-
curveBasis(
Path context) → Curve Curves - Produces a cubic basis spline using the specified control points.
-
curveBasis(
Path context) → Curve Curves - Produces a cubic basis spline using the specified control points.
-
curveBasis(
Path context) → Curve Curves - Produces a cubic basis spline using the specified control points.
-
curveBasisClosed(
Path context) → Curve Curves - Produces a closed cubic basis spline using the specified control points.
-
curveBasisClosed(
Path context) → Curve Curves - Produces a closed cubic basis spline using the specified control points.
-
curveBasisClosed(
Path context) → Curve Curves - Produces a closed cubic basis spline using the specified control points.
-
curveBasisOpen(
Path context) → Curve Curves - Produces a cubic basis spline using the specified control points.
-
curveBasisOpen(
Path context) → Curve Curves - Produces a cubic basis spline using the specified control points.
-
curveBasisOpen(
Path context) → Curve Curves - Produces a cubic basis spline using the specified control points.
-
curveBumpX(
Path context) → Curve Curves - Produces a Bézier curve between each pair of points, with horizontal tangents at each point.
-
curveBumpX(
Path context) → Curve Curves - Produces a Bézier curve between each pair of points, with horizontal tangents at each point.
-
curveBumpX(
Path context) → Curve Curves - Produces a Bézier curve between each pair of points, with horizontal tangents at each point.
-
curveBumpY(
Path context) → Curve Curves - Produces a Bézier curve between each pair of points, with vertical tangents at each point.
-
curveBumpY(
Path context) → Curve Curves - Produces a Bézier curve between each pair of points, with vertical tangents at each point.
-
curveBumpY(
Path context) → Curve Curves - Produces a Bézier curve between each pair of points, with vertical tangents at each point.
-
curveBundle(
Path context) → Curve Curves - Produces a straightened cubic basis spline using the specified control points, with the spline straightened according to the curve’s beta (see curveBundleBeta), which defaults to 0.85.
-
curveBundle(
Path context) → Curve Curves - Produces a straightened cubic basis spline using the specified control points, with the spline straightened according to the curve’s beta (see curveBundleBeta), which defaults to 0.85.
-
curveBundle(
Path context) → Curve Curves - Produces a straightened cubic basis spline using the specified control points, with the spline straightened according to the curve’s beta (see curveBundleBeta), which defaults to 0.85.
-
curveBundleBeta(
num beta) → CurveFactory Curves -
Returns a bundle curve with the specified
beta
in the range [0, 1], representing the bundle strength. -
curveBundleBeta(
num beta) → CurveFactory Curves -
Returns a bundle curve with the specified
beta
in the range [0, 1], representing the bundle strength. -
curveBundleBeta(
num beta) → CurveFactory Curves -
Returns a bundle curve with the specified
beta
in the range [0, 1], representing the bundle strength. -
curveCardinal(
Path context) → Curve Curves - Produces a cubic cardinal spline using the specified control points, with one-sided differences used for the first and last piece.
-
curveCardinal(
Path context) → Curve Curves - Produces a cubic cardinal spline using the specified control points, with one-sided differences used for the first and last piece.
-
curveCardinal(
Path context) → Curve Curves - Produces a cubic cardinal spline using the specified control points, with one-sided differences used for the first and last piece.
-
curveCardinalClosed(
Path context) → Curve Curves - Produces a closed cubic cardinal spline using the specified control points. When a line segment ends, the first three control points are repeated, producing a closed loop.
-
curveCardinalClosed(
Path context) → Curve Curves - Produces a closed cubic cardinal spline using the specified control points. When a line segment ends, the first three control points are repeated, producing a closed loop.
-
curveCardinalClosed(
Path context) → Curve Curves - Produces a closed cubic cardinal spline using the specified control points. When a line segment ends, the first three control points are repeated, producing a closed loop.
-
curveCardinalClosedTension(
num tension) → CurveFactory Curves - Equivalent to curveCardinalTension, but returns a curveCardinalClosed.
-
curveCardinalClosedTension(
num tension) → CurveFactory Curves - Equivalent to curveCardinalTension, but returns a curveCardinalClosed.
-
curveCardinalClosedTension(
num tension) → CurveFactory Curves - Equivalent to curveCardinalTension, but returns a curveCardinalClosed.
-
curveCardinalOpen(
Path context) → Curve Curves - Produces a cubic cardinal spline using the specified control points.
-
curveCardinalOpen(
Path context) → Curve Curves - Produces a cubic cardinal spline using the specified control points.
-
curveCardinalOpen(
Path context) → Curve Curves - Produces a cubic cardinal spline using the specified control points.
-
curveCardinalOpenTension(
num tension) → CurveFactory Curves - Equivalent to curveCardinalTension, but returns a curveCardinalOpen.
-
curveCardinalOpenTension(
num tension) → CurveFactory Curves - Equivalent to curveCardinalTension, but returns a curveCardinalOpen.
-
curveCardinalOpenTension(
num tension) → CurveFactory Curves - Equivalent to curveCardinalTension, but returns a curveCardinalOpen.
-
curveCardinalTension(
num tension) → CurveCardinal Function(Path) Curves -
Returns a cardinal curve with the specified
tension
in the range [0, 1]. -
curveCardinalTension(
num tension) → CurveCardinal Function(Path) Curves -
Returns a cardinal curve with the specified
tension
in the range [0, 1]. -
curveCardinalTension(
num tension) → CurveCardinal Function(Path) Curves -
Returns a cardinal curve with the specified
tension
in the range [0, 1]. -
curveCatmullRom(
Path context) → Curve Curves - Produces a cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomAlpha), which defaults to 0.5, as proposed by Yuksel et al. in On the Parameterization of Catmull–Rom Curves, with one-sided differences used for the first and last piece.
-
curveCatmullRom(
Path context) → Curve Curves - Produces a cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomAlpha), which defaults to 0.5, as proposed by Yuksel et al. in On the Parameterization of Catmull–Rom Curves, with one-sided differences used for the first and last piece.
-
curveCatmullRom(
Path context) → Curve Curves - Produces a cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomAlpha), which defaults to 0.5, as proposed by Yuksel et al. in On the Parameterization of Catmull–Rom Curves, with one-sided differences used for the first and last piece.
-
curveCatmullRomAlpha(
num alpha) → CurveFactory Curves -
Returns a cubic Catmull–Rom curve with the specified
alpha
in the range [0, 1]. -
curveCatmullRomAlpha(
num alpha) → CurveFactory Curves -
Returns a cubic Catmull–Rom curve with the specified
alpha
in the range [0, 1]. -
curveCatmullRomAlpha(
num alpha) → CurveFactory Curves -
Returns a cubic Catmull–Rom curve with the specified
alpha
in the range [0, 1]. -
curveCatmullRomClosed(
Path context) → Curve Curves - Produces a closed cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomClosedAlpha), which defaults to 0.5, as proposed by Yuksel et al.
-
curveCatmullRomClosed(
Path context) → Curve Curves - Produces a closed cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomClosedAlpha), which defaults to 0.5, as proposed by Yuksel et al.
-
curveCatmullRomClosed(
Path context) → Curve Curves - Produces a closed cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomClosedAlpha), which defaults to 0.5, as proposed by Yuksel et al.
-
curveCatmullRomClosedAlpha(
num alpha) → CurveFactory Curves - Equivalent to curveCatmullRomAlpha, but returns a curveCatmullRomClosed.
-
curveCatmullRomClosedAlpha(
num alpha) → CurveFactory Curves - Equivalent to curveCatmullRomAlpha, but returns a curveCatmullRomClosed.
-
curveCatmullRomClosedAlpha(
num alpha) → CurveFactory Curves - Equivalent to curveCatmullRomAlpha, but returns a curveCatmullRomClosed.
-
curveCatmullRomOpen(
Path context) → Curve Curves - Produces a cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomClosedAlpha), which defaults to 0.5, as proposed by Yuksel et al.
-
curveCatmullRomOpen(
Path context) → Curve Curves - Produces a cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomClosedAlpha), which defaults to 0.5, as proposed by Yuksel et al.
-
curveCatmullRomOpen(
Path context) → Curve Curves - Produces a cubic Catmull–Rom spline using the specified control points and the parameter alpha (see curveCatmullRomClosedAlpha), which defaults to 0.5, as proposed by Yuksel et al.
-
curveCatmullRomOpenAlpha(
num alpha) → CurveFactory Curves - Equivalent to curveCatmullRomAlpha, but returns a curveCatmullRomOpen.
-
curveCatmullRomOpenAlpha(
num alpha) → CurveFactory Curves - Equivalent to curveCatmullRomAlpha, but returns a curveCatmullRomOpen.
-
curveCatmullRomOpenAlpha(
num alpha) → CurveFactory Curves - Equivalent to curveCatmullRomAlpha, but returns a curveCatmullRomOpen.
-
curveLinear(
Path context) → Curve Curves - Produces a polyline through the specified points.
-
curveLinear(
Path context) → Curve Curves - Produces a polyline through the specified points.
-
curveLinear(
Path context) → Curve Curves - Produces a polyline through the specified points.
-
curveLinearClosed(
Path context) → Curve Curves - Produces a closed polyline through the specified points by repeating the first point when the line segment ends.
-
curveLinearClosed(
Path context) → Curve Curves - Produces a closed polyline through the specified points by repeating the first point when the line segment ends.
-
curveLinearClosed(
Path context) → Curve Curves - Produces a closed polyline through the specified points by repeating the first point when the line segment ends.
-
curveMonotoneX(
Path context) → Curve Curves - Produces a cubic spline that preserves monotonicity in y, assuming monotonicity in x, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
-
curveMonotoneX(
Path context) → Curve Curves - Produces a cubic spline that preserves monotonicity in y, assuming monotonicity in x, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
-
curveMonotoneX(
Path context) → Curve Curves - Produces a cubic spline that preserves monotonicity in y, assuming monotonicity in x, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
-
curveMonotoneY(
Path context) → Curve Curves - Produces a cubic spline that preserves monotonicity in x, assuming monotonicity in y, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
-
curveMonotoneY(
Path context) → Curve Curves - Produces a cubic spline that preserves monotonicity in x, assuming monotonicity in y, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
-
curveMonotoneY(
Path context) → Curve Curves - Produces a cubic spline that preserves monotonicity in x, assuming monotonicity in y, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
-
curveNatural(
Path context) → Curve Curves - Produces a natural cubic spline with the second derivative of the spline set to zero at the endpoints.
-
curveNatural(
Path context) → Curve Curves - Produces a natural cubic spline with the second derivative of the spline set to zero at the endpoints.
-
curveNatural(
Path context) → Curve Curves - Produces a natural cubic spline with the second derivative of the spline set to zero at the endpoints.
-
curveStep(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStep(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStep(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStepAfter(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStepAfter(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStepAfter(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStepBefore(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStepBefore(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
-
curveStepBefore(
Path context) → Curve Curves - Produces a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
Typedefs
- CurveFactory = Curve Function(Path context) Curves
-
The definition of a curve factory: given a
context
, returns a curve. - CurveFactory = Curve Function(Path context) Curves
-
The definition of a curve factory: given a
context
, returns a curve. - CurveFactory = Curve Function(Path context) Curves
-
The definition of a curve factory: given a
context
, returns a curve.