primeng
Version:
PrimeNG is a premium UI library for Angular featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock,
79 lines (75 loc) • 2.35 kB
TypeScript
import { ChartType as ChartType$1, ChartOptions as ChartOptions$1, Plugin } from 'chart.js';
export { ChartData } from 'chart.js';
import { PassThrough, PassThroughOption } from 'primeng/api';
/**
* Defines the type of chart.
* @group Types
*/
type ChartType = 'bar' | 'line' | 'scatter' | 'bubble' | 'pie' | 'doughnut' | 'polarArea' | 'radar';
/**
* Untyped chart options. An interface over chart.js' own `ChartOptions`, so the
* bundled d.ts references it by name instead of expanding the internal
* `_DeepPartialObject`, which chart.js does not export.
* Prefer {@link ChartOptions}.
* @group Types
*/
interface ChartOptionsBase extends ChartOptions$1<ChartType$1> {
}
/**
* Chart configuration options. `ChartOptions<'bar'>` resolves to the chart.js type.
* @group Types
*/
type ChartOptions<TType extends ChartType$1 = never> = [TType] extends [never] ? ChartOptionsBase : ChartOptions$1<TType>;
/**
* Per-chart plugin. Options default to `Record<string, any>` rather than chart.js'
* unexported `AnyObject`.
* @group Types
*/
type ChartPlugin<TType extends ChartType$1 = ChartType$1, O = Record<string, any>> = Plugin<TType, O>;
/**
* Event emitted when chart data is selected.
* @group Events
*/
interface ChartDataSelectEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Selected element.
*/
element: unknown;
/**
* Selected dataset.
*/
dataset: unknown[];
}
/**
* Custom pass-through(pt) options.
* @template I Type of instance.
*
* @see {@link UIChart.pt}
* @group Interface
*/
interface ChartPassThroughOptions<I = unknown> {
/**
* Used to pass attributes to the host's DOM element.
*/
host?: PassThroughOption<HTMLElement, I>;
/**
* Used to pass attributes to the root's DOM element.
*/
root?: PassThroughOption<HTMLElement, I>;
/**
* Used to pass attributes to the canvas DOM element.
*/
canvas?: PassThroughOption<HTMLCanvasElement, I>;
}
/**
* Defines valid pass-through options in Chart.
* @see {@link ChartPassThroughOptions}
*
* @template I Type of instance.
*/
type ChartPassThrough<I = unknown> = PassThrough<I, ChartPassThroughOptions<I>>;
export type { ChartDataSelectEvent, ChartOptions, ChartOptionsBase, ChartPassThrough, ChartPassThroughOptions, ChartPlugin, ChartType };