rms-sparklines
Version:
A sparkline collection, written as web components
35 lines (34 loc) • 1.32 kB
TypeScript
import { Point } from "./Point";
export declare class CanvasMath {
/**
* Drawing notes:
*
* Inline sparkline
* When drawing a simple sparkline, including start, min, max, and end dots
* we must leave a margin between the line and the canvas' edges to avoid
* clipping these dots when their points are a these edges. This is done by
* drawing the sparkline inside a rectangle contained in the canvas'
* drawing area with a distance of half of the dotradius between these
* rectangles' edges.
*/
/**
* Returns the number of pixels between two consecutive values in the x-axis
*/
static xStep(width: number, linePoints: number[], dotradius: number): number;
/**
* Returns the number of pixels between two consecutive values in the y-axis
*/
static yStep(height: number, linePoints: number[], dotradius: number): number;
/**
* Translate from bottom left to top left coordinates
*/
static translateToCanvas(height: number, point: Point, dotradius: number): Point;
/**
* Return the index of the first max point
*/
static maxPointIndex(points: number[]): number;
/**
* Return the index of the first min point
*/
static mixPointIndex(points: number[]): number;
}