Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines the interface to a loader - a class which adds HTML/DOM elements when the SciChartSurface or SciChart3DSurface is loading webassembly

example
// Define a class which implements ISciChartLoader
class CustomChartLoader implements ISciChartLoader {
   public addChartLoader(domChartRoot: HTMLDivElement, theme: IThemeProvider): HTMLElement {
      const loaderContainerDiv = document.createElement("div");
      loaderContainerDiv.style.backgroundColor = theme.loadingAnimationBackground;
      loaderContainerDiv.style.height = "100%";
      loaderContainerDiv.style.width = "100%";
      const loaderText = document.createElement("p");
      loaderText.innerHTML = "Loading SciChart...";
      loaderText.style.color = theme.loadingAnimationForeground;
      loaderText.style.fontFamily = "Arial";
      loaderText.style.margin = "0";
      loaderText.style.padding = "50px";
      loaderContainerDiv.appendChild(loaderText);
      domChartRoot.appendChild(loaderContainerDiv);
      return loaderContainerDiv;
   }

   public removeChartLoader(domChartRoot: HTMLDivElement, loaderElement: HTMLElement): void {
      domChartRoot.removeChild(loaderElement);
   }
}

// Pass the class to the SciChartSurface.create() function
SciChartSurface.create("elementId", { loader: new CustomChartLoader(); });

Hierarchy

  • ISciChartLoader

Implemented by

Index

Properties

type

type: string

The type name of the loader. For Chart builder and serialization

Methods

addChartLoader

  • addChartLoader(domChartRoot: HTMLDivElement, theme: IThemeProvider): HTMLElement
  • Called when a chart loader is added to the DOM.

    example
    public addChartLoader(domChartRoot: HTMLDivElement, theme: IThemeProvider): HTMLElement {
       const loaderContainerDiv = document.createElement("div");
       loaderContainerDiv.style.backgroundColor = theme.loadingAnimationBackground;
       loaderContainerDiv.style.height = "100%";
       loaderContainerDiv.style.width = "100%";
       const loaderText = document.createElement("p");
       loaderText.innerHTML = "Loading SciChart...";
       loaderText.style.color = theme.loadingAnimationForeground;
       loaderText.style.fontFamily = "Arial";
       loaderText.style.margin = "0";
       loaderText.style.padding = "50px";
       loaderContainerDiv.appendChild(loaderText);
       domChartRoot.appendChild(loaderContainerDiv);
       return loaderContainerDiv;
    }

    Parameters

    Returns HTMLElement

removeChartLoader

  • removeChartLoader(domChartRoot: HTMLDivElement, loaderElement: HTMLElement): void
  • Called to remove a chart loader from the DOM.

    example
    public removeChartLoader(domChartRoot: HTMLDivElement, loaderElement: HTMLElement): void {
       domChartRoot.removeChild(loaderElement);
    }

    Parameters

    • domChartRoot: HTMLDivElement
    • loaderElement: HTMLElement

    Returns void

Generated using TypeDoc