@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
26 lines (25 loc) • 1.11 kB
TypeScript
import { IFormattedHeadlineDataItem, IHeadlineDataItem } from "../../../../interfaces/Headlines";
import { IChartConfig } from "../../../../interfaces/Config";
/**
* Format {HeadlineData} value.
*
* The method processes the provided item and returns object with value that can be rendered as it is and 'cssStyle'
* object that can be passed into the react element 'style' attribute.
*
* @param item
* @returns {{cssStyle: {color, backgroundColor}, value: string, isValueEmpty: boolean}}
*/
export declare function formatItemValue(item: IHeadlineDataItem, config?: IChartConfig): IFormattedHeadlineDataItem;
/**
* The method processes the provided IHeadlineDataItem and returns object with formatted value and isValueEmpty flag.
*
* Formatted value conditions:
* - value is rounded to Integer
* - shows '>999%' when value is above the limit
* - shows '<-999%' when value is below the limit
* - otherwise shows 'value%'
*
* @param item
* @returns {{value: string, isValueEmpty: boolean}}
*/
export declare function formatPercentageValue(item: IHeadlineDataItem): IFormattedHeadlineDataItem;