nebula.js

    ›Nucleus guide

    Getting started

    • Introduction
    • Installation
    • Web integration

    Nucleus guide

    • Configuration
    • Rendering supernovae
    • Modify charts
    • Current app selections
    • API Reference
    Edit

    API Reference

    Table of contents

    • function: nucleus(app[, instanceConfig])
      • nucleus.createConfiguration(configuration)
    • class: AppSelections
      • appSelections.mount(element)
      • appSelections.unmount()
    • interface: BaseConfig
    • interface: Configuration
    • interface: Context
    • interface: CreateConfig
    • type Field= <[string]|qae.NxDimension|qae.NxMeasure|[LibraryField]>
    • interface: GetConfig
    • interface: LibraryField
    • interface: LoadType(type, env)
    • class: Nucleus
      • nucleus.context(ctx)
      • nucleus.render(cfg)
      • nucleus.selections()
    • class: SupernovaController
      • supernovaController.destroy()
    • interface: ThemeInfo
    • interface: TypeInfo

    API

    function: nucleus(app[, instanceConfig])

    • app <enigma.Doc>
    • instanceConfig <Configuration>
    • returns: <Nucleus>

    Initiates a new Nucleus instance using the specified app.

    import nucleus from '@nebula.js/nucleus';
    const n = nucleus(app);
    n.render({ id: 'abc' });
    

    nucleus.createConfiguration(configuration)

    • configuration <Configuration> The configuration object
    • returns: <nucleus>

    Creates a new nucleus scope bound to the specified configuration.

    The configuration is merged with all previous scopes.

    import nucleus from '@nebula.js/nucleus';
    // create a 'master' config which registers all types
    const m = nucleus.createConfiguration({
      types: [
        {
          name: 'mekko',
          version: '1.0.0',
          load: () => Promise.resolve(mekko),
        },
      ],
    });
    
    // create an alternate config with dark theme
    // and inherit the config from the previous
    const d = m.createConfiguration({
      theme: 'dark',
    });
    
    m(app).render({ type: 'mekko' }); // will render the object with default theme
    d(app).render({ type: 'mekko' }); // will render the object with 'dark' theme
    nucleus(app).render({ type: 'mekko' }); // will throw error since 'mekko' is not a register type on the default instance
    

    class: AppSelections

    appSelections.mount(element)

    • element <HTMLElement>

    Mounts the app selection UI into the provided HTMLElement

    selections.mount(element);
    

    appSelections.unmount()

    Unmounts the app selection UI from the DOM

    selections.unmount();
    

    interface: BaseConfig

    • element <HTMLElement>
    • options <Object>

    interface: Configuration

    • context <Context>
    • env <Object>
    • themes <Array<ThemeInfo>>
    • types <Array<TypeInfo>>

    interface: Context

    • constraints <Object>
      • active <boolean>
      • passive <boolean>
      • select <boolean>
    • language <string> Defaults to en-US
    • theme <string> Defaults to light

    interface: CreateConfig

    • extends: <BaseConfig>
    • type <string>
    • version <string>
    • fields <Array<Field>>
    • properties <qae.GenericObjectProperties>

    type Field= <string|qae.NxDimension|qae.NxMeasure|LibraryField>

    interface: GetConfig

    • extends: <BaseConfig>
    • id <string>

    interface: LibraryField

    • qLibraryId <string>
    • type <'dimension'|'measure'>

    interface: LoadType(type, env)

    • type <Object>
      • name <string>
      • version <string>
    • env <Object>
    • returns: <Promise<Supernova>>

    class: Nucleus

    nucleus.context(ctx)

    • ctx <Context> The context to update.

    Updates the current context of this nucleus instance. Use this when you want to change some part of the current context, like theme.

    // change theme
    n.context({ theme: 'dark' });
    
    // limit constraints
    n.context({ constraints: { active: true } });
    

    nucleus.render(cfg)

    • cfg <CreateConfig|GetConfig> The render configuration.
    • returns: <Promise<SupernovaController>> A controller to the rendered supernova

    Renders a supernova into an HTMLElement.

    // render from existing object
    n.render({
      element: el,
      id: 'abcdef',
    });
    
    // render on the fly
    n.render({
      type: 'barchart',
      fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
    });
    

    nucleus.selections()

    • returns: <Promise<AppSelections>>

    Gets the app selections of this instance.

    const selections = await n.selections();
    selections.mount(element);
    

    class: SupernovaController

    A controller to further modify a supernova after it has been rendered.

    const ctl = await nucleus(app).render({
      element,
      type: 'barchart',
    });
    ctl.destroy();
    

    supernovaController.destroy()

    Destroys the supernova and removes if from the the DOM.

    const ctl = ctl.destroy();
    

    interface: ThemeInfo

    • id <string> Theme identifier
    • load <Function> A function that should return a Promise that resolve to a raw JSON theme

    interface: TypeInfo

    • load <LoadType>
    • name <string>
    • version <string>
    • meta <Object>
    ← Current app selections
    • Table of contents
    • API
      • function: nucleus(app[, instanceConfig])
      • class: AppSelections
      • interface: BaseConfig
      • interface: Configuration
      • interface: Context
      • interface: CreateConfig
      • type Field= <[string]|qae.NxDimension|qae.NxMeasure|[LibraryField]>
      • interface: GetConfig
      • interface: LibraryField
      • interface: LoadType(type, env)
      • class: Nucleus
      • class: SupernovaController
      • interface: ThemeInfo
      • interface: TypeInfo
    Docs
    Getting Started
    Links
    SlackGitHub
    Qlik Open Source
    Copyright © 2020 QlikTech International AB