mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
* Remove I prefix from TS types * Update missing `ILayoutItem` typedefs * IEvent should become ChartEvent * Prevent FillTarget collision * Import FontSpec instead of IFontSpec * Prevent recursive DateAdapter problem
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
export interface SplinePoint {
|
|
x: number;
|
|
y: number;
|
|
}
|
|
|
|
/**
|
|
* Props to Rob Spencer at scaled innovation for his post on splining between points
|
|
* http://scaledinnovation.com/analytics/splines/aboutSplines.html
|
|
*/
|
|
export function splineCurve(
|
|
firstPoint: SplinePoint & { skip?: boolean },
|
|
middlePoint: SplinePoint,
|
|
afterPoint: SplinePoint,
|
|
t: number
|
|
): {
|
|
previous: SplinePoint;
|
|
next: SplinePoint;
|
|
};
|
|
|
|
export interface MonotoneSplinePoint extends SplinePoint {
|
|
skip: boolean;
|
|
controlPointPreviousX?: number;
|
|
controlPointPreviousY?: number;
|
|
controlPointNextX?: number;
|
|
controlPointNextY?: number;
|
|
}
|
|
|
|
/**
|
|
* This function calculates Bézier control points in a similar way than |splineCurve|,
|
|
* but preserves monotonicity of the provided data and ensures no local extremums are added
|
|
* between the dataset discrete points due to the interpolation.
|
|
* @see https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
|
|
*/
|
|
export function splineCurveMonotone(points: readonly MonotoneSplinePoint[]): void;
|