@tanstack/charts
Version:
A chart grammar for TypeScript and JavaScript. Marks consume your data directly, channels describe visual encodings, and the engine compiles them into a renderer-neutral keyed scene. TanStack's compact scales cover common numeric and categorical mappings.
62 lines (57 loc) • 3.91 kB
TypeScript
import * as i0 from '@angular/core';
import { TemplateRef, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
import { SafeHtml } from '@angular/platform-browser';
import { ChartValue, ChartHostOptions, ChartTooltipBodyContext, ChartHostCommonOptions, ChartDefinition, ChartTooltipContent } from '@tanstack/charts';
export { DomChartDefinition as ChartDefinition, ChartPoint } from '@tanstack/charts';
interface ChartPresentationOptions {
class?: string;
style?: string;
}
interface ChartTooltipBodyRenderContext<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> extends ChartTooltipBodyContext<TDatum, TXValue, TYValue> {
defaultBody: TemplateRef<unknown>;
}
interface ChartTooltipBodyTemplateContext<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> extends ChartTooltipBodyRenderContext<TDatum, TXValue, TYValue> {
$implicit: ChartTooltipBodyRenderContext<TDatum, TXValue, TYValue>;
}
type ChartCommonOptions<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> = ChartHostCommonOptions<TDatum, TXValue, TYValue> & ChartPresentationOptions;
type ChartOptions<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> = ChartHostOptions<TDatum, TXValue, TYValue> & ChartPresentationOptions;
declare class ChartTooltipBodyDirective<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> {
definition: ChartDefinition<TDatum, TXValue, TYValue>;
readonly templateRef: TemplateRef<ChartTooltipBodyTemplateContext<TDatum, TXValue, TYValue>>;
static ngTemplateContextGuard<TDatum, TXValue extends ChartValue, TYValue extends ChartValue>(_directive: ChartTooltipBodyDirective<TDatum, TXValue, TYValue>, context: unknown): context is ChartTooltipBodyTemplateContext<TDatum, TXValue, TYValue>;
static ɵfac: i0.ɵɵFactoryDeclaration<ChartTooltipBodyDirective<any, any, any>, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ChartTooltipBodyDirective<any, any, any>, "ng-template[tanstackChartTooltipBody]", never, { "definition": { "alias": "tanstackChartTooltipBody"; "required": true; }; }, {}, never, never, true, never>;
}
declare class Chart<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> implements OnChanges, OnDestroy {
options: ChartOptions<TDatum, TXValue, TYValue>;
private surface;
private tooltipOutlet;
private defaultTooltipBody;
set tooltipBodyDirective(directive: ChartTooltipBodyDirective<TDatum, TXValue, TYValue> | undefined);
initialMarkup: SafeHtml | string;
hostClass: string;
hostStyle: string;
protected defaultTooltipContent?: ChartTooltipContent;
protected defaultTooltipText?: string;
private readonly sanitizer;
private readonly generatedId;
private adapter?;
private activeRenderSvg?;
private renderer?;
private tooltipBody?;
private tooltipBodyTarget?;
private tooltipBodyView?;
constructor();
ngOnChanges(_changes: SimpleChanges): void;
ngOnDestroy(): void;
private updateAdapter;
private resolveRenderer;
private readonly handleTooltipBodyChange;
private renderTooltipBody;
private moveTooltipBodyView;
private destroyTooltipBodyView;
static ɵfac: i0.ɵɵFactoryDeclaration<Chart<any, any, any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<Chart<any, any, any>, "tanstack-chart", never, { "options": { "alias": "options"; "required": true; }; }, {}, ["tooltipBodyDirective"], ["ng-template[tanstackChartTooltipBody]"], true, never>;
}
export { Chart, ChartTooltipBodyDirective };
export type { ChartCommonOptions, ChartOptions, ChartPresentationOptions, ChartTooltipBodyRenderContext, ChartTooltipBodyTemplateContext };