valueAlias

Description

The valueAlias property allows you to customize the values in the UI, example would be to take a UUID and replace it with a name.

Currently this property is only available for the following chart types:

  • Area Chart
  • Bar Charts
  • Line Chart
  • Combo Chart

valueAlias can also be used to replace values in the various dropdown components, like Global Filters.

Types

export type ValueAlias =
  | {
      [id: string]: string | number;
    }
  | ValueAliasFunction;
 
export type ValueAliasFunction = (options?: Component.ValueAliasOptions) => 
  string | number | undefined;
 
export type ValueAliasOptions = {
  fieldId?: string;
  value: string | number;
  filter?: AdditionalFilter;
};

Usage

Here are two examples of how to implement valueAlias:

<Vizzly.Dashboard
  valueAlias={({ fieldId, value, filter }) => {
      if (filter?.title === 'Firm' && value === 'AirTree Ventures') {
        return 'AirTree Ventures, Inc.';
      }
      if (fieldId == 'fie_Venture Capital Firm' && value === 'AirTree Ventures') {
        return 'AirTree Ventures, Inc.';
      }
      return undefined;
  }}
  // ... rest of the props
/>