Class RevealSdkSettings

This class is used to specify global settings for the SDK.

Index

Properties

betaFeatures: BetaFeatures = ...

Allows enabling and disabling beta features.

fieldFormattingSettingsProvider: (
    desc: RVFieldFormattingDescriptor,
    fmtContext: RVFormattingContext,
) => RVFormattingSpec | null

Specifies a callback function that will be invoked when working with a dashboard and might return the formatting to be used for the given field.

Type Declaration

localizedStringsProvider: (
    element: RVLocalizationElement,
    localizationContext: RVLocalizationContext,
) => string | null

Specifies a callback function that will be invoked when working with a dashboard and might return a replacement text -usually a localized value- to be used instead of the original.

Type Declaration

    • (
          element: RVLocalizationElement,
          localizationContext: RVLocalizationContext,
      ): string | null
    • Parameters

      • element: RVLocalizationElement

        the element that needs to be localized, e.g. a Widget title. The current text is a property of this object.

      • localizationContext: RVLocalizationContext

        provides context information for the localization request. In particular, the dashboard ID containing the element to be localized.

      Returns string | null

      The replacement text. A null return value is the same as returning the current text.

Accessors

  • get enableScalingSupport(): boolean

    Returns boolean

  • set enableScalingSupport(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • get maxCellsRestriction(): number

    Gets/sets the maximum number of cells (rows * columns) that can be requested from the data source for a single visualization. Increasing this value allows visualizations to render more data, but at the cost of higher memory usage and slower performance. Defaults to 100000.

    Returns number

  • set maxCellsRestriction(value: number): void

    Parameters

    • value: number

    Returns void

  • get requestWithCredentialsFlag(): boolean

    Returns boolean

  • set requestWithCredentialsFlag(flag: boolean): void

    Configures if the AJAX requests sent by Reveal to the backend should include authentication cookies or not. You might need to set this flag to true when your backend uses cookies for authentication and session handling and the frontend is in a different domain (CORS rules applies), for example if you're using Angular or React.

    Parameters

    • flag: boolean

      true if the AJAX request sent by Reveal when it sends a request to the backend should have "withCredentials: true" or not.

    Returns void

  • get shapeFilesUrl(): string

    The URL where the MapData.json could be retrieved from. ShapesMetadataFileUrl + "MapData.json" should be pointing to valid MapData.json.

    Returns string

  • set shapeFilesUrl(url: string): void

    Parameters

    • url: string

    Returns void

  • get theme(): RevealTheme

    Get/sets the theme to be used by RevealView when rendering a dashboard. Make sure to set the theme before you have any RevealView rendering a dashboard.

    Returns RevealTheme

  • set theme(theme: RevealTheme): void

    Parameters

    Returns void

Methods

  • Call and await this before you render a RevealView component to make sure all the needed fonts are loaded in the browser. You might also want to call and await this if you update the RevealSdkSettings.theme with another theme that's using different fonts that might not be loaded. Not awaiting this might result on some texts(like dashboard title) being cropped on initial load.

    Returns Promise<void>

  • Returns Promise<void>

    Call and await this before you render a RevealView component to make sure all the needed fonts are loaded in the browser. You might also want to call and await this if you update the RevealSdkSettings.theme with another theme that's using different fonts that might not be loaded. Not awaiting this might result on some texts(like dashboard title) being cropped on initial load.

    Please use the ensureFontsLoaded method, as this method will be removed in a future release.

  • Returns the current locale to be used to localize Reveal Sdk UI.

    Returns string

  • Returns string | null

  • Overrides current localization locale, which is picked up by the browser's, by default. Make sure you await the promise before overriding the locale again. Supported locales are "de","es", "fr", "it", "ja", "ko", "ms", "nl", "pt", "ru", "zh-cn" and "zh-tw".

    await Reveal.RevealSdkSettings.overrideLocale(Reveal.BuiltInLocales.De);
    

    Parameters

    • locale: string

    Returns Promise<void>

  • Specifies a callback function that will be invoked before a request to the Reveal backend and might return additional headers to be included in the request. The specified function is expected to return an object with the headers, like: { 'Session-Id': sessionId } This is useful to send authentication headers to the backend.

    JavaScript:

    RevealSdkSettings.setAdditionalHeadersProvider(function (url) {
    var headers = {};
    headers["x-header-one"] = "single_value";
    headers["x-header-two"] = ["value_1", "value_2"];
    return headers;
    });

    TypeScript:

     RevealSdkSettings.setAdditionalHeadersProvider((url: string) => {
    var headers: Record<string, any> = {};
    headers["x-header-one"] = "single_value";
    headers["x-header-two"] = ["value_1", "value_2"];
    return headers;
    });

    Parameters

    • provider: (url: string) => Record<string, any> | null

    Returns void

  • Set the base url where Reveal SDK Server component is running. You'll need to use this in cases where the backend and the front-end are served from different urls.

    Parameters

    • base: string

      address of the reveal server component.

    Returns void

  • Set the base url that will be used to redirect the final OAuth authentication step, /oauth/authenticated will be added to the provided URL. This is usually just a fake URL that is used only to detect the authentication completed and to get the token ID to be used in the next step of the authentication flow. By default this URL is set to the same value specified with setBaseUrl, you might need to change it if your backend and frontend are running on separate base URLs, as this URL needs to match the frontend URL so some JS scripts can run properly. You might need to put a valid web page under {base}/oauth/authenticated/* so the browser doesn't display an error when redirected to this URL.

    Parameters

    • base: string

      The URL to use as the base URL for OAuth authentication complete.

    Returns void