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

@efxlab/chart-core

v0.2.0

Published

Framework-agnostic core types, utilities, and templates for EfxChart

Readme

@efx/chart-core

Framework-agnostic core types, utilities, and templates for ECharts-based multi-chart dashboards.

Installation

npm install @efx/chart-core
# or
pnpm add @efx/chart-core

Peer Dependencies

  • echarts ^5.0.0 || ^6.0.0

Overview

This package provides the foundation for the EfxChart system - a declarative approach to building multi-chart ECharts dashboards using ASCII-based layout templates. It contains:

  • Types: Full TypeScript definitions for ECharts options and chart configuration
  • Templates: Pre-defined ASCII layout templates for common dashboard patterns
  • Utilities: Template parsing, option building, and data generation helpers

Templates

ASCII-based layout templates define how charts are positioned:

import { FINANCE_LAYOUT, EFX_CHART_TEMPLATES } from '@efx/chart-core'

// FINANCE_LAYOUT structure:
{
  name: 'finance',
  sections: ['header', 'sidebar', 'main', 'footer'],
  mobile: `
    | header  |
    | sidebar |
    | main    |
    | footer  |
  `,
  desktop: `
    | header  | header  | header  | header  |
    | sidebar | main    | main    | main    |
    | sidebar | footer  | footer  | footer  |
  `,
}

Available Templates

import {
  FINANCE_LAYOUT,      // Header + sidebar + main + footer
  DASHBOARD_LAYOUT,    // Standard dashboard
  COMPARISON_LAYOUT,   // Side-by-side comparison
  GRID_2X2_LAYOUT,     // 4 equal quadrants
  ANALYTICS_LAYOUT,    // KPIs + main + sidebar
  MONITORING_LAYOUT,   // 3x2 chart grid
  EFX_CHART_TEMPLATES, // All templates as object
} from '@efx/chart-core'

Types

EfxLayoutTemplate

interface EfxLayoutTemplate {
  name: string
  sections: readonly string[]  // Section IDs
  mobile: string               // ASCII template for mobile
  desktop: string              // ASCII template for desktop
  tablet?: string              // Optional tablet layout
}

EfxChartSectionConfig

Configuration for a chart section:

interface EfxChartSectionConfig {
  section: string              // Section ID from template
  title?: string | TitleConfig
  type?: 'line' | 'bar' | 'pie' | 'scatter' | 'area' | 'candlestick'
  data?: unknown[]
  xAxis?: AxisConfig
  yAxis?: AxisConfig
  series?: SeriesConfig
  padding?: number | string | PaddingConfig
  // ... full ECharts options exposure
}

Type Helpers

import type { ExtractSections, SectionId } from '@efx/chart-core'

// Extract section names as union type
type FinanceSections = ExtractSections<typeof FINANCE_LAYOUT>
// => 'header' | 'sidebar' | 'main' | 'footer'

Utilities

Template Parsing

import { parseLayoutTemplate, parseTemplateToLayout } from '@efx/chart-core'

// Parse full template for all breakpoints
const layouts = parseLayoutTemplate(FINANCE_LAYOUT)
// => { mobile: ParsedLayout, desktop: ParsedLayout }

// Parse single ASCII template
const parsed = parseTemplateToLayout(template.desktop)
// => { columns: 4, rows: 3, sectionCoordMap: { header: [[0,3], [0,0]], ... } }

Option Building

import { buildEChartsOption, buildMediaDefinitions } from '@efx/chart-core'

// Build ECharts option from section configs
const option = buildEChartsOption(sections, sectionCoordMap, columns, rows)

// Build responsive media queries
const media = buildMediaDefinitions(mobileLayout, desktopLayout, sections)

Data Generators

Sample data generators for demos and testing:

import {
  generateTimeSeriesData,
  generateCategoryData,
  generateScatterData,
  generatePieData,
  generateMultiSeriesData,
  generateCandlestickData,
} from '@efx/chart-core'

const timeSeries = generateTimeSeriesData(30)    // 30 days of data
const categories = generateCategoryData(5)       // 5 categories
const scatter = generateScatterData(100)         // 100 points

Padding Utilities

import { parsePadding, paddingToGridPosition } from '@efx/chart-core'

// Parse flexible padding formats
parsePadding(10)           // { top: 10, right: 10, bottom: 10, left: 10 }
parsePadding('20,10')      // { top: 10, right: 20, bottom: 10, left: 20 }
parsePadding('10,20,30,40') // { top: 10, right: 20, bottom: 30, left: 40 }

Related Packages

  • @efx/chart-react - React components for EfxChart

License

MIT