import { type IColor } from "@gooddata/sdk-model";
/**
* Defines the calculation types for an algorithm.
*
* @remarks
* The table below summarizes the available calculation types:
*
*
* | Type | Algorithm |
* | change | (Primary - Secondary) / Secondary |
* | difference | Primary - Secondary |
* | ratio | Primary / Secondary |
*
* | change_difference |
*
* Change: (Primary - Secondary) / Secondary
*
* Difference: Primary - Secondary
* |
*
*
*
* @public
*/
export type CalculationType = "change" | "ratio" | "difference" | "change_difference";
/**
* Defines how the comparison value will be placed.
*
* @public
*/
export type ComparisonPosition = "top" | "left" | "right" | "auto";
/**
* @internal
*/
export declare const CalculateAs: Record, CalculationType>;
/**
* @internal
*/
export declare const ComparisonPositionValues: Record, ComparisonPosition>;
/**
* Comparison format type
*
* @remarks
* Providing a null value will configure the format to inherit from the format of primary measure.
*
* @public
*/
export type ComparisonFormat = string | null;
/**
* Configuration options for color settings.
*
* @public
*/
export interface IColorConfig {
/**
* Determines whether to disable the comparison color.
*
* @defaultValue false
*/
disabled?: boolean;
/**
* Specifies the color to use, which can be selected from the color palette or provided as an RGB code.
* This color is used when the primary measure greater than the secondary measure.
*
* @defaultValue rgb(0, 193, 141)
*/
positive?: IColor;
/**
* Specifies the color to use, which can be selected from the color palette or provided as an RGB code.
* This color is used when the primary measure less than the secondary measure.
*
* @defaultValue rgb(229, 77, 64)
*/
negative?: IColor;
/**
* Specifies the color to use, which can be selected from the color palette or provided as an RGB code.
* This color is used when the primary measure equal to the secondary measure.
*
* @defaultValue rgb(148, 161, 173)
*/
equals?: IColor;
}
/**
* Configuration options for labeling conditions.
*
* @public
*/
export interface ILabelConfig {
/**
* This property specifies whether to use the unconditional value for all conditions
* or separate values for each condition.
*
* @defaultValue false
*/
isConditional?: boolean;
/**
* Specifies the label to be used for the comparison value.
*
* @remarks
* The default value is based on the calculation type:
*
* | Calculation Type | Default value |
* | change | Change |
* | ratio | of |
* | difference | Difference |
* | change_difference | Change |
*
*/
unconditionalValue?: string;
/**
* This property specify the label of the positive comparison value
*
* Primary is larger than Secondary
*
* @defaultValue based on the calculation type
*
*
* | Calculation type | Default label |
* | change | Increase |
* | difference | Increase |
* | ratio | (Not applicable) |
*
*/
positive?: string;
/**
* This property specify the label of the negative comparison
*
* Primary is less than Secondary
*
* @defaultValue based on the calculation type
*
*
* | Calculation type | Default label |
* | change | Decrease |
* | difference | Decrease |
* | ratio | (Not applicable) |
*
*/
negative?: string;
/**
* This property specify the label of the equals comparison value
*
* Primary is equals Secondary
*
*
* | Calculation type | Default label |
* | change | No change |
* | difference | No difference |
* | ratio | (Not applicable) |
*
*/
equals?: string;
}
/**
* Configuration options for comparing values.
*
* @public
*/
export interface IComparison {
/**
* Enables or disables the comparison.
*
* @defaultValue true
*/
enabled: boolean;
/**
* Defines how the comparison value will be calculated.
*
* @remarks
* The default value is determined by the type of secondary measure:
*
* | Type of secondary measure | Default value |
* | Derived measure | change |
* | Non-derived measure | ratio |
*
*
* @see {@link CalculationType} for available calculation methods.
*
* @defaultValue Based on the secondary measure.
*/
calculationType?: CalculationType;
/**
* Defines how the comparison value will be placed.
*
* @see {@link ComparisonPosition} for supported positions
*
* @defaultValue auto
*/
position?: ComparisonPosition;
/**
* Defines the number format of the comparison value.
*
* @remarks
* The default value is based on the calculation type:
*
* | Calculation Type | Default format |
* | change | Percent (rounded) |
* | ratio | Percent (rounded) |
* | difference | Inherit |
*
*
* @see {@link ComparisonFormat} for supported formats.
*
* @defaultValue Based on the calculation type.
*/
format?: ComparisonFormat;
/**
* Defines the number format of the comparison sub value.
*
* @remarks
* The default value is based on the calculation subtype:
*
* | Calculation Type | Default format |
* | change | Percent (rounded) |
* | ratio | Percent (rounded) |
* | difference | Inherit |
*
*
* @see {@link ComparisonFormat} for supported formats.
*
* @defaultValue Based on the calculation subtype.
*/
subFormat?: ComparisonFormat;
/**
* Controls the visibility of the arrow trend indicator and its direction based on conditions.
*
* @remarks
* The arrow direction is determined as follows:
*
*
* | Condition | Direction |
* | Primary greater than Secondary | Up |
* | Primary less than Secondary | Down |
* | Primary equal to Secondary | No direction, arrow hidden |
*
*/
isArrowEnabled?: boolean;
/**
* Controls the application of conditional colors.
*
* @see {@link IColorConfig} for configuration details.
*/
colorConfig?: IColorConfig;
/**
* Controls the label displayed beneath the comparison value.
*
* @see {@link ILabelConfig} for configuration details.
*/
labelConfig?: ILabelConfig;
}
//# sourceMappingURL=comparison.d.ts.map