@amcharts/amcharts5
Version:
amCharts 5
90 lines • 2.67 kB
TypeScript
import { Pattern, IPatternSettings, IPatternPrivate } from "./Pattern";
export interface IPathPatternSettings extends IPatternSettings {
/**
* An SVG path to use as the pattern's motif.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths} for more information
*/
svgPath?: string;
/**
* Gap between motifs, in pixels.
*
* @default 6
*/
gap?: number;
/**
* The path is scaled (keeping its aspect ratio) to fit within
* `maxWidth` x `maxHeight` pixels.
*
* @default 10
*/
maxWidth?: number;
/**
* The path is scaled (keeping its aspect ratio) to fit within
* `maxWidth` x `maxHeight` pixels.
*
* @default 10
*/
maxHeight?: number;
/**
* If set to `true`, will place every second motif, creating a checkered
* pattern.
*
* @default false
*/
checkered?: boolean;
/**
* Center motifs in their grid cell.
*
* @default true
*/
centered?: boolean;
}
export interface IPathPatternPrivate extends IPatternPrivate {
}
/**
* A pattern that repeats an SVG path as a motif on a grid.
*
* Note: `rotation` rotates each motif around its own centre (the grid stays
* axis-aligned), so the pattern tiles seamlessly at any angle.
*
* @since 5.2.33
* @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/patterns/} for more info
*/
export declare class PathPattern extends Pattern {
_settings: IPathPatternSettings;
_privateSettings: IPathPatternPrivate;
static className: string;
static classNames: Array<string>;
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
protected _clearPath: boolean;
protected _bbox: {
x: number;
y: number;
w: number;
h: number;
};
protected _bboxPath: string | undefined;
_beforeChanged(): void;
/**
* The tile is only a repeat unit (the grid repeats every cell), so shrink an
* oversized `width`/`height` to a single cell (2x2 when `checkered`). Skipped
* for non-`repeat` repetitions.
* @ignore
*/
protected _optimizeTileSize(): void;
_changed(): void;
protected _renderPattern(svgPath: string): void;
/**
* Native geometry bounding box of an SVG path, via a throwaway `<path>`.
* @ignore
*/
protected _getPathBounds(svgPath: string): {
x: number;
y: number;
w: number;
h: number;
};
}
//# sourceMappingURL=PathPattern.d.ts.map