UNPKG

@trutoo/funnel-graph

Version:

SVG Funnel Graph TypeScript Library.

33 lines (32 loc) 1.91 kB
import { FunnelData, FunnelDataLayered } from './types'; export declare const layerMaxLength: (data: FunnelDataLayered) => number; export declare const layerSums: (data: FunnelDataLayered) => number[]; export declare const layerPercentages: (data: FunnelDataLayered) => number[][]; /** * An example of a two-dimensional funnel graph * #0.................. * ...#1................ * ...... * #0********************#1** #2.........................#3 (A) * ******************* * #2*************************#3 (B) * #2+++++++++++++++++++++++++#3 (C) * +++++++++++++++++++ * #0++++++++++++++++++++#1++ #2-------------------------#3 (D) * ------ * ---#1---------------- * #0----------------- * Main axis is the primary axis of the graph. * In a horizontal graph it's the X axis, and Y is the cross axis. * However we use the names "main" and "cross" axis, * because in a vertical graph the primary axis is the Y axis * and the cross axis is the X axis. * First step of drawing the funnel graph is getting the coordinates of points, * that are used when drawing the paths. * There are 4 paths in the example above: A, B, C and D. * Such funnel has 3 labels and 3 subLabels. * This means that the main axis has 4 points (number of labels + 1) * One the ASCII illustrated graph above, those points are illustrated with a # symbol. */ export declare const generateMainAxisPoints: (data: FunnelData | FunnelDataLayered, size: number) => number[]; export declare const generateCrossAxisPoints: (data: FunnelData | FunnelDataLayered, size: number) => number[][];