public class Line extends PathDataGenerator
Data must be an array-like structure. the type of the array elements depends on the x and y functions. the default x and y functions assumes that each input element is a two-element array of numbers.
| Modifier and Type | Class and Description |
|---|---|
static class |
Line.InterpolationMode
Interpolation mode to be specified in
interpolate(InterpolationMode). |
| Modifier | Constructor and Description |
|---|---|
protected |
Line() |
| Modifier and Type | Method and Description |
|---|---|
Line |
defined(DatumFunction<Boolean> callback)
Sets the function used to controls where the line is defined.
|
Line.InterpolationMode |
interpolate()
Returns the current interpolation mode.
|
Line |
interpolate(Line.InterpolationMode i)
Set the current interpolation mode.
|
double |
tension()
Returns the current tension
|
Line |
tension(double tension)
Sets the Cardinal spline interpolation tension to the specified number in
the range [0, 1].
|
Line |
x(DatumFunction<Double> callback)
Set the function used to compute x coordinates of points generated by
this line generator.
|
Line |
x(double d)
Set the x coordinates of points generated by this generator.
|
Line |
y(DatumFunction<Double> callback)
See
x(DatumFunction). |
Line |
y(double d)
Set the y coordinates of points generated by this generator.
|
generate, generate, generate, generatepublic final Line.InterpolationMode interpolate()
public final Line interpolate(Line.InterpolationMode i)
i - the interpolation modepublic final double tension()
public final Line tension(double tension)
The tension only affects the Cardinal interpolation modes:
Line.InterpolationMode.CARDINAL,
Line.InterpolationMode.CARDINAL_OPEN and
Line.InterpolationMode.CARDINAL_CLOSED.
The default tension is 0.7.
In some sense, this can be interpreted as the length of the tangent; 1 will yield all zero tangents, and 0 yields a Catmull-Rom spline.
tension - the tension in the range [0, 1].public final Line x(double d)
d - public final Line x(DatumFunction<Double> callback)
The default accessor assumes that each input element is a two-element array of numbers.
datumFunction - public final Line y(double d)
d - public final Line y(DatumFunction<Double> callback)
x(DatumFunction).
Note that, like most other graphics libraries, SVG uses the top-left corner as the origin and thus higher values of y are lower on the screen. For visualization we often want the origin in the bottom-left corner instead; one easy way to accomplish this is to invert the range of the y-scale by using range([h, 0]) instead of range([0, h]).
callback - public final Line defined(DatumFunction<Boolean> callback)
The defined accessor can be used to define where the line is defined and undefined, which is typically useful in conjunction with missing data; the generated path data will automatically be broken into multiple distinct subpaths, skipping undefined data.
callback - the function to be called for each datum and returning if the
point is definedCopyright © 2015 gwt-d3. All rights reserved.