@wix/design-system
Version:
@wix/design-system
38 lines (34 loc) • 1.21 kB
TypeScript
import * as React from 'react';
type chartData = {
label: Date;
value: number;
};
export interface SparklineChartProps {
/** Applied as data-hook HTML attribute that can be used in the tests */
dataHook?: string;
/** Specifies a CSS class name to be appended to the component’s root element.
* @internal
*/
className?: string;
/** Chart data */
data: chartData[];
/** Sets the color of the sparkline */
color?: string;
/** Sets the width of the sparkline (pixels) */
width?: number;
/** Sets the height of the sparkline (pixels) */
height?: number;
/** Indicates the starting index of the highlighted area. Default is 0 */
highlightedStartingIndex?: number;
/** Indicates the ending index of the highlighted area. Default is the last one */
highlightedEndingIndex?: number;
/** Tooltip content (JSX) getter function. */
getTooltipContent?: (index: number) => React.ReactNode;
/** callback when graph is hovered*/
onHover?: (index: number) => void;
/** Sets the duration of the animation in milliseconds
* @default 300
*/
animationDuration?: number;
}
export default class SparklineChart extends React.PureComponent<SparklineChartProps> {}