UNPKG

ag-charts-community

Version:

Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue

184 lines (183 loc) 6.08 kB
import { FontStyle, FontWeight } from "../../../scene/shape/text"; import { DropShadow } from "../../../scene/dropShadow"; import { SeriesNodeDatum, CartesianTooltipRendererParams, SeriesTooltip } from "../series"; import { Label } from "../../label"; import { LegendDatum } from "../../legend"; import { CartesianSeries } from "./cartesianSeries"; import { ChartAxisDirection } from "../../chartAxis"; import { TooltipRendererResult } from "../../chart"; import { TypedEvent } from "../../../util/observable"; export interface BarSeriesNodeClickEvent extends TypedEvent { readonly type: 'nodeClick'; readonly event: MouseEvent; readonly series: BarSeries; readonly datum: any; readonly xKey: string; readonly yKey: string; } export interface BarTooltipRendererParams extends CartesianTooltipRendererParams { readonly processedYValue: any; } interface BarNodeDatum extends SeriesNodeDatum { readonly index: number; readonly yKey: string; readonly yValue: number; readonly x: number; readonly y: number; readonly width: number; readonly height: number; readonly fill?: string; readonly stroke?: string; readonly strokeWidth: number; readonly label?: { readonly x: number; readonly y: number; readonly text: string; readonly fontStyle?: FontStyle; readonly fontWeight?: FontWeight; readonly fontSize: number; readonly fontFamily: string; readonly textAlign: CanvasTextAlign; readonly textBaseline: CanvasTextBaseline; readonly fill: string; }; } export declare enum BarLabelPlacement { Inside = "inside", Outside = "outside" } export declare class BarSeriesLabel extends Label { formatter?: (params: { value: number; }) => string; placement: BarLabelPlacement; } export interface BarSeriesFormatterParams { readonly datum: any; readonly fill?: string; readonly stroke?: string; readonly strokeWidth: number; readonly highlighted: boolean; readonly xKey: string; readonly yKey: string; } export interface BarSeriesFormat { fill?: string; stroke?: string; strokeWidth?: number; } export declare class BarSeriesTooltip extends SeriesTooltip { renderer?: (params: BarTooltipRendererParams) => string | TooltipRendererResult; } export declare class BarSeries extends CartesianSeries { static className: string; static type: "bar"; private rectGroup; private labelGroup; private rectSelection; private labelSelection; private nodeData; private xData; private yData; private yDomain; readonly label: BarSeriesLabel; /** * The assumption is that the values will be reset (to `true`) * in the {@link yKeys} setter. */ private readonly seriesItemEnabled; tooltip: BarSeriesTooltip; flipXY: boolean; fills: string[]; strokes: string[]; fillOpacity: number; strokeOpacity: number; lineDash?: number[]; lineDashOffset: number; formatter?: (params: BarSeriesFormatterParams) => BarSeriesFormat; constructor(); /** * Used to get the position of bars within each group. */ private groupScale; directionKeys: { x: string[]; y: string[]; }; getKeys(direction: ChartAxisDirection): string[]; protected _xKey: string; set xKey(value: string); get xKey(): string; protected _xName: string; set xName(value: string); get xName(): string; private cumYKeyCount; private flatYKeys; hideInLegend: string[]; /** * yKeys: [['coffee']] - regular bars, each category has a single bar that shows a value for coffee * yKeys: [['coffee'], ['tea'], ['milk']] - each category has three bars that show values for coffee, tea and milk * yKeys: [['coffee', 'tea', 'milk']] - each category has a single bar with three stacks that show values for coffee, tea and milk * yKeys: [['coffee', 'tea', 'milk'], ['paper', 'ink']] - each category has 2 stacked bars, * first showing values for coffee, tea and milk and second values for paper and ink */ protected _yKeys: string[][]; set yKeys(yKeys: string[][]); get yKeys(): string[][]; protected _grouped: boolean; set grouped(value: boolean); get grouped(): boolean; /** * A map of `yKeys` to their names (used in legends and tooltips). * For example, if a key is `product_name` it's name can be a more presentable `Product Name`. */ protected _yNames: { [key in string]: string; }; set yNames(values: { [key in string]: string; }); get yNames(): { [key in string]: string; }; setColors(fills: string[], strokes: string[]): void; /** * The value to normalize the bars to. * Should be a finite positive value or `undefined`. * Defaults to `undefined` - bars are not normalized. */ private _normalizedTo?; set normalizedTo(value: number | undefined); get normalizedTo(): number | undefined; private _strokeWidth; set strokeWidth(value: number); get strokeWidth(): number; private _shadow?; set shadow(value: DropShadow | undefined); get shadow(): DropShadow | undefined; onHighlightChange(): void; processData(): boolean; findLargestMinMax(groups: { min: number; max: number; }[][]): { min: number; max: number; }; getDomain(direction: ChartAxisDirection): any[]; fireNodeClickEvent(event: MouseEvent, datum: BarNodeDatum): void; private getCategoryAxis; private getValueAxis; createNodeData(): BarNodeDatum[]; update(): void; private updateSelections; private updateNodes; private updateRectSelection; private updateRectNodes; private updateLabelSelection; private updateLabelNodes; getTooltipHtml(nodeDatum: BarNodeDatum): string; listSeriesItems(legendData: LegendDatum[]): void; toggleSeriesItem(itemId: string, enabled: boolean): void; } export {};