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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vizcore/sdk

v2.0.2

Published

JavaScript SDK for embedding analytics dashboards

Readme

@vizcore/sdk

JavaScript SDK for embedding analytics dashboards with full interactivity and native rendering.

Features

  • Native Rendering - Render dashboards directly in your app without iframes
  • Full Highcharts Support - Interactive charts with animations and tooltips
  • AI Insights - AI-powered contextual insights that suggest new charts
  • Location Filtering - Filter all dashboard data by location or other parameters
  • Theme Support - Light and dark themes with easy customization
  • Responsive - Adapts to any screen size
  • Fast & Lightweight - Minimal dependencies, optimized bundle
  • Real-time Updates - Auto-refresh and live data updates
  • Framework Agnostic - Works with React, Vue, Angular, or vanilla JS

Installation

npm install @vizcore/sdk

Or include via CDN:

<link rel="stylesheet" href="https://unpkg.com/@vizcore/[email protected]/dist/vizcore.css" />
<script src="https://unpkg.com/@vizcore/[email protected]/dist/vizcore.min.js"></script>

Quick Start

import VizCore from "@vizcore/sdk";
import "@vizcore/sdk/dist/vizcore.css";

// Initialize the SDK with API key
VizCore.init({
  apiKey: "your-api-key",
});

// Or initialize with auth token (for authenticated users)
VizCore.init({
  authToken: "Bearer your-jwt-token",
});

// Render a dashboard
const dashboard = await VizCore.render("dashboard-id", "#container", {
  locationId: "location-123",
  theme: "dark",
});

Basic Usage

Authentication

The SDK supports both API key and JWT token authentication:

// Using API Key (for public dashboards)
const renderer = new DashboardRenderer({
  apiKey: "your-api-key",
  container: "#dashboard-container",
});

// Using Auth Token (for authenticated users)
const renderer = new DashboardRenderer({
  authToken: "Bearer your-jwt-token",
  container: "#dashboard-container",
});

// Update auth token dynamically (e.g., after token refresh)
renderer.setAuthToken("Bearer new-jwt-token");

Create a Dashboard Renderer

import { DashboardRenderer } from "@vizcore/sdk";

const renderer = new DashboardRenderer({
  apiKey: "your-api-key", // or use authToken
  container: "#dashboard-container",
});

// Render dashboard with options
await renderer.render("dashboard-id", {
  locationId: "location-123",
  theme: "dark",
  refreshInterval: 30, // seconds
});

Location Filtering

Filter all dashboard data by location:

// Initial render with location
await renderer.render("dashboard-id", {
  locationId: "store-001",
});

// Update location dynamically
await renderer.updateLocation("store-002");

Theme Support

// Set theme during initialization
const renderer = new DashboardRenderer({
  container: "#dashboard",
  theme: "dark", // or 'light'
});

// Update theme dynamically
renderer.updateTheme("light");

AI Insights

Enable AI-powered contextual insights that analyze your dashboard and suggest new charts:

const renderer = new DashboardRenderer({
  container: "#dashboard",
  apiKey: "your-api-key",
  enableInsights: true,
  insightsPosition: "bottom", // or 'left', 'right'
  insightsAutoOpen: true,
});

// Programmatic control
renderer.toggleInsights(); // Toggle panel
renderer.showInsights(); // Show panel
renderer.hideInsights(); // Hide panel
await renderer.refreshInsights(); // Refresh insights

Event Handling

// Listen to dashboard events
renderer.on("dashboard:loaded", (data) => {
  console.log("Dashboard loaded:", data);
});

renderer.on("widget:click", (data) => {
  console.log("Widget clicked:", data);
});

renderer.on("data:updated", (data) => {
  console.log("Data refreshed:", data);
});

// Listen to AI Insights events
renderer.on("insights:loaded", (insights) => {
  console.log("AI insights loaded:", insights);
});

renderer.on("insight-widget:added", (widget) => {
  console.log("Insight widget added:", widget);
});

Framework Integration

React

import { useEffect, useRef } from "react";
import VizCore from "@vizcore/sdk";
import "@vizcore/sdk/dist/vizcore.css";

function Dashboard({ dashboardId, locationId }) {
  const containerRef = useRef(null);
  const rendererRef = useRef(null);

  useEffect(() => {
    const renderer = VizCore.create({
      apiKey: process.env.REACT_APP_API_KEY,
      container: containerRef.current,
    });

    renderer.render(dashboardId, { locationId });
    rendererRef.current = renderer;

    return () => renderer.destroy();
  }, [dashboardId]);

  useEffect(() => {
    if (rendererRef.current) {
      rendererRef.current.updateLocation(locationId);
    }
  }, [locationId]);

  return <div ref={containerRef} />;
}

Vue

<template>
  <div ref="dashboardContainer"></div>
</template>

<script>
import VizCore from "@vizcore/sdk";
import "@vizcore/sdk/dist/vizcore.css";

export default {
  props: ["dashboardId", "locationId"],

  mounted() {
    this.renderer = VizCore.create({
      apiKey: process.env.VUE_APP_API_KEY,
      container: this.$refs.dashboardContainer,
    });

    this.renderer.render(this.dashboardId, {
      locationId: this.locationId,
    });
  },

  watch: {
    locationId(newLocation) {
      this.renderer.updateLocation(newLocation);
    },
  },

  beforeUnmount() {
    if (this.renderer) {
      this.renderer.destroy();
    }
  },
};
</script>

API Reference

VizCore.init(options)

Initialize the SDK with global settings.

  • apiKey - API key for authentication
  • preloadHighcharts - Pre-load Highcharts library (default: false)

VizCore.create(config)

Create a new dashboard renderer instance.

  • container - DOM element or selector
  • apiKey - API key (overrides global)
  • theme - Initial theme ('light' or 'dark')

DashboardRenderer

Methods

  • render(dashboardId, options) - Render a dashboard
  • updateLocation(locationId) - Update location filter
  • updateTheme(theme) - Change theme
  • refresh() - Refresh dashboard data
  • resize() - Recalculate layout
  • destroy() - Clean up and remove dashboard

Events

  • dashboard:loaded - Dashboard successfully loaded
  • dashboard:error - Error loading dashboard
  • widget:loaded - Widget rendered
  • widget:error - Widget error
  • widget:click - Widget interaction
  • data:updated - Data refreshed
  • theme:changed - Theme updated

Configuration

Dashboard Options

{
  locationId: 'location-123',    // Filter by location
  theme: 'dark',                 // Theme (light/dark)
  refreshInterval: 30,           // Auto-refresh in seconds
  parameters: {                  // Custom parameters
    startDate: '2024-01-01',
    endDate: '2024-12-31'
  }
}

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

License

MIT

Support

For issues and questions, please visit our GitHub repository.