@apptane/react-ui-charts
Version:
Chart components in Apptane React UI framework
87 lines (86 loc) • 2.97 kB
TypeScript
import { Color, ColorMode, PaletteHue } from "@apptane/react-ui-core";
import PropTypes from "prop-types";
import { ChromaticScheme, Datum } from "../common/Types.js";
export interface GaugeDatum<Data = void> extends Datum<Data> {
/**
* Value associated with the datum.
*/
value: number;
}
export interface GaugeProps<Data = void> {
/**
* Data representing individual slices.
*/
data?: ArrayLike<GaugeDatum<Data>>;
/**
* Specifies the color scheme used to compute slice color.
* If palette hue is specified colors are interpolated between
* 100 and 800 by varying lightness.
* If not specified defaults to built-in colormap.
*/
colorScheme?: ChromaticScheme | PaletteHue;
/**
* Callback to determine color for the slice.
* When this callback returns a valid color, it overrides
* all other color specifications.
*/
color?: (datum: GaugeDatum<Data>) => Color | PaletteHue | undefined;
/**
* Overrides the default width. The default is 100%.
*/
width?: number;
/**
* Overrides height of the gauge interactive area.
*/
height?: number;
/**
* Gauge height.
*/
size?: number;
/**
* Callback to format the value for presentation in tooltip or legend.
*/
formatValue?: (value: number) => string;
/**
* Total value. By default total value is the sum of all values.
*/
total?: number;
/**
* Controls the visibility of tooltips.
* Defaults to `true`.
*/
tooltipVisible?: boolean;
/**
* Indicates that legend should be visible.
*/
legendVisible?: boolean;
/**
* Callback invoked when a slice is clicked via chart or legend.
*/
onClick?: (datum: GaugeDatum<Data>) => void;
/**
* Overrides the color mode.
* Default is to use globally set theme color mode or fallback to `light`.
*/
colorMode?: ColorMode;
}
export declare const GaugePropTypes: {
data: PropTypes.Validator<(PropTypes.InferProps<{
value: PropTypes.Validator<number>;
id: PropTypes.Requireable<string>;
label: PropTypes.Requireable<string>;
color: PropTypes.Requireable<string>;
data: PropTypes.Requireable<any>;
}> | null | undefined)[]>;
colorScheme: PropTypes.Requireable<ChromaticScheme | PaletteHue>;
color: PropTypes.Requireable<(...args: any[]) => any>;
width: PropTypes.Requireable<number>;
height: PropTypes.Requireable<number>;
size: PropTypes.Requireable<number>;
formatValue: PropTypes.Requireable<(...args: any[]) => any>;
total: PropTypes.Requireable<number>;
tooltipVisible: PropTypes.Requireable<boolean>;
legendVisible: PropTypes.Requireable<boolean>;
onClick: PropTypes.Requireable<(...args: any[]) => any>;
colorMode: PropTypes.Requireable<ColorMode>;
};