npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@luzmo/ngx-embed

v6.1.9

Published

This is an Angular library for embedding [Luzmo](https://luzmo.com/main) dashboards in your Angular application.

Downloads

11,609

Readme

Angular component for Luzmo dashboard

This is an Angular library for embedding Luzmo dashboards in your Angular application.

Table of contents

  1. Installation instructions
  2. Usage
  3. Examples
  4. Public methods
  5. Events
  6. Changelog
  7. Migration
  8. Compatibility
  9. Quick links

Installation instructions

npm i @luzmo/ngx-embed --save

OR

ng add @luzmo/ngx-embed@latest #This also adds an entry in app.module.ts

Usage

In your app.module.ts import NgxLuzmoDashboardModule as root

import { NgxLuzmoDashboardModule } from '@luzmo/ngx-embed';

@NgModule({
    ...
  imports: [
    ...
    NgxLuzmoDashboardModule
  ],
})

In your HTML template.

<luzmo-dashboard [dashboardId]="dashboardId" [language]="'en'"> </luzmo-dashboard>

OR

<!-- Embed a chart/item by passing the item id as well -->
<luzmo-dashboard [dashboardId]="dashboardId" [itemId]="itemId" [language]="'en'"> </luzmo-dashboard>

Working with events

<!-- Listening for events, logEvent is a function with console log -->
<luzmo-dashboard [dashboardId]="dashboardId" [language]="'en'" (load)="logEvent($event)" (customEvent)="logEvent($event)" (changedFilters)="logEvent($event)"> </luzmo-dashboard>

Available Inputs Below a list of available input options you can add to your ngx-luzmo-dashboard

| Property | Type | Description | | -------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | dashboardId | string | The id of the Luzmo dashboard you wish to embed | | dashboardSlug | string | The slug of the Luzmo dashboard you wish to embed (if a dashboardId is supplied that one will be used) | | itemId | string | The id of the Luzmo item you wish to embed. The dashboardId should be provided as well if you what to embed just a Luzmo item. | | itemDimensions | { width: number/string; height: number/string; } | width and height of item only applies when itemId is provided. | | authKey | string | Authorization key generated via Luzmo API | | authToken | string | Authorization token generated via Luzmo API | | language | string | The language of the dashboard: eg. 'en' (Default: 'auto') | | screenMode | string | The screen mode of your dashboard: 'mobile', 'tablet', 'desktop', 'largeScreen', 'fixed' or 'auto' (Default: 'auto') | | switchScreenModeOnResize | boolean | true: the embedded dashboard can switch screenModes on resize of the container , false: Dashboard will keep the same screenMode (Default: true) | | loaderBackground | string | Background color of the loader element (Default: '#f9f9f9') | | loaderFontColor | string | Font color of the text of the loaders (Default: '#5a5a5a') | | loaderSpinnerColor | string | Spinner color of the loader (Default: 'rgba(255, 165, 0, 0.7)') | | loaderSpinnerBackground | string | Background color of the spinner (Default: 'rgba(169, 169, 169, 0.14)') | | appServer | string | Tenancy of luzmo.com to connect to (Default: 'https://app.luzmo.com/' for US set appServer to 'https://app.us.luzmo.com/') | | timezoneId | string | The timezone you you wish to use in your dashboard. This timezone id needs to be a valid id that is available in the IANA timezone database, for example: Europe/Brussels or America/New_York. | | apiHost | string | API server to connect to (Default: 'https://api.luzmo.com/' for US set apiHost to 'https://api.us.luzmo.com/') | | editMode | string | Specifies if the embedded dashboard should be editable or not. Accepted values: "view" , "editLimited" , "editFull" . Use "view" if you don't want the embedded dashboard to be editable. (Default: "view" ) | | mainColor | string | Optional override of the main color used in the whitelabeling of the embedded dashboard editor. If not provided, the main color of the whitelabeling colors set on the organization will be used. Should be specified as a string of rgb values (i.e. "rgb(50,50,50)"). | | accentColor | string | Optional override of the accent color used in the whitelabeling of the embedded dashboard editor. If not provided, the accent color of the whitelabeling colors set on the organization will be used. Should be specified as a string of rgb values (i.e. "rgb(50,50,50)"). |

Examples

A dashboard with a gray loader background

<luzmo-dashboard #dashboardInstance [dashboardId]="'035c0304-0bfe-4b7c-8c10-a4acb8eb9d76'" [loaderBackground]="'rgb(238,243,246)'"> </luzmo-dashboard>

A dashboard with a purple spinner color of the loader with screenMode="mobile" and switchScreenModeOnResize=false, so that the dashboard will stay in mobile mode

<luzmo-dashboard #dashboardInstance [dashboardId]="'55cfb99c-d602-492b-b192-6c15277fdb9a'" [loaderSpinnerColor]="'purple'" [screenMode]="'mobile'" [switchScreenModeOnResize]="false"> </luzmo-dashboard>

In Component, service can also be used to facilitate different functionality (Only refresh data is implemented here, other methods can also be implemented in similar fashion)

import { NgxLuzmoDashboardService, NgxLuzmoDashboardComponent } from '@luzmo/ngx-embed';
...

@Component({
  ...
})

export class TestIntegrationComponent {
  @ViewChild('dashboardInstance') dashboardInstance: NgxLuzmoDashboardComponent;
  ...
  constructor() { }

  // To refresh data
  refresh() {
    this.dashboardInstance.refreshData().subscribe(); // Unsubscribe in ngOnDestroy
  }
  allFunctions() {
    this.dashboardInstance.getFilters().subscribe(console.log);
    this.dashboardInstance.getData('item-id').subscribe(console.log);
    this.dashboardInstance.reloadDashboard().subscribe(console.log);
    this.dashboardInstance.exportDashboard('png').subscribe(console.log);
    this.dashboardInstance.getAccessibleDashboards().subscribe(console.log);
  }
}

Public methods available on dashboardComponent instance


getDashboards(): Observable<NgxLuzmoDashboard[]>
// Returns an instantly resolved promise with an array of all the visible dashboards on a page with their information.

getData(itemId: string): Observable<ItemData>
// Returns an array the data of a chart of a certain dashboard by adding the dashboardId or the container of the iframe.

getFilters(): Observable<FilterGroup[]>
// Returns an array of active filters.

setAuthorization(key: string, token: string): Observable<void>
// Changes the authorization of all or one dashboard. To fetch data based on new authorization parameters, reloadDashboard() or refreshData() needs to be called.

refreshData(itemId?: string): Observable<void>
// Refreshes the data of a specific chart when the id of that item is supplied. Without a itemId this refreshes the data in all items.

reloadDashboard(): Observable<void>
// Reload the dashboard. (useful when the authorization is changed, and dashboard needs to be reloaded without reloading the iFrame)

exportDashboard(type?: ExportType): Observable<ExportDashboard>
// Exports the current dashboard as either pdf or png. a container class needs to be passed as an argument and an optional type parameter.

getAccessibleDashboards(): Observable<AccessibleDashboards>
// Get accessible dashboards in a integration, make sure apiHost, authKey, authToken are set correctly on the instance.

setEditMode(editMode: DashboardEditMode): Observable<SetEditMode>
// Sets the editMode of the current dashboard. Accepted parameters: view , editLimited , editFull .

Events

| Name | Description | Event Arguments | | -------------- | -------------------------------------- | --------------------- | | changedFilters | Emitted when filters are changed | ChangedFiltersEvent | | customEvent | Emitted when a custom event is fired | CustomEvent | | exported | Emitted when export completes or fails | ExportedEvent | | itemsRendered | Emitted when all items are rendered | ItemsRenderedEvent | | load | Emitted when dashboard is loaded | LoadEvent |

Changelog

Migration

Migrating from cumul.io to luzmo.

  • Change import '@cumul.io/ngx-cumulio-dashboard to import @luzmo/ngx-embed.
  • Change NgxCumulioDashboardModule to NgxLuzmoDashboardModule.
  • Replace all references of Cumulio with Luzmo.
  • Replace all references of cumulio-dashboard to luzmo-dashboard

Compatibility

Angular version compatibility, please select the compatible version of the library from the table below.

| @luzmo/ngx-embed | Angular | |------------|---------| | ➤6.X.X | 16.X.X | | ➤6.0.4 | 17.X.X |

This library requires Angular version 16 and above.

| Angular | |-------------------------------------| | 16.0.0 |

For Angular version < 16.0.0 please use our old library

Quick links

Luzmo | Sample Integration | Migration | Changelog