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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rfkit/charts

v1.2.28

Published

a chart library based on all

Readme

rfkit-charts

服务于无线电监测产品的 web 图表组件库

安装

pnpm add @rfkit/charts

基本使用

import {
  // 频谱图
  Spectrum,
  LevelStream,
  // IQ图
  IQ,
  // 仪表图
  Gauge,
  Dial,
  // 辅助图形
  Heatmap,
  Occupancy,
} from '@rfkit/charts';

// 行为推送
const publishRef = useRef(null);
const handlePublishChange = (publish) => {
  publishRef.current? = publish;
};

// 图表类型
export enum ChartType {
  // 频谱图
  SingleFrequency = 'singleFrequency',
  Scan = 'scan',
  MScan = 'mscan',
  ScanDF360 = 'ScanDF360',
  DDC = 'ddc',
  Lite = 'lite',
  LiteNormalized = 'liteNormalized',
  LevelStream = 'levelStream',
  // IQ图
  IQEye = 'iqEye',
  IQLine = 'iqLine',
  IQPlanisphere = 'iqPlanisphere',
  IQStream = 'iqStream',
  // 辅助图形
  Heatmap = 'heatmap',
  Occupancy = 'occupancy',
}

// 频谱图
<Spectrum type="singleFrequency" publish={handlePublishChange} /> // 单频频谱
<Spectrum type="scan" publish={handlePublishChange} /> // 扫描频谱
<Spectrum type="scanDF360" publish={handlePublishChange} /> // 扫描测向概率统计
<Spectrum type="ddc" publish={handlePublishChange} channel onChannelChange /> // DCC
<Spectrum type="lite" publish={handlePublishChange} /> // 精简模式
<Spectrum type="liteNormalized" publish={handlePublishChange} /> // 精简模式(Y轴范围0-1)

// DDC特殊参数
export interface Props {
  channel?: number; // 默认32
  onChannelChange?: (c: {
    frequency: number;
    type: MarkerEventType;
    list: number[];
  }) => void;
}

// 电平瀑布图
<LevelStream />

// IQ类型
<IQ type={ChartType} publish={handlePublishChange} />

// 仪表盘
<Gauge publish={handlePublishChange} />
<Dial axisY={{range}} onChange={onChange} publish={handlePublishChange} />

publish(行为推送工具)

export enum PSType {
  // 频谱数据
  SPECTRUM = 'spectrum',
  // 天线因子数据
  ANTENNA_FACTOR = 'antennaFactor',
  // 占用度数据
  OCCUPANCY = 'occupancy',
  // 电平流数据
  LEVEL_STREAM = 'levelStream',
  // 瀑布图数据
  HEATMAP = 'heatmap',
  // IQ数据
  IQ = 'IQ',
  // 示向度盘
  DIAL = 'dial',
  // 刻度尺
  GAUGE = 'gauge',

  // 频谱线属性
  SERIES = 'series',
  // 频谱带宽规则:一般用于单频频谱
  SPECTRUM_BANDWIDTH = 'spectrumBandwidth',
  // 多段扫描规则:一般用于扫描数据的多段组合
  SEGMENTS = 'segments',
  // 多路DCC
  CHANNELS = 'channels',
  // Marker
  MARKER = 'marker',

  // 图形操作
  RESET = 'reset',
}

// 系列配置
interface SeriesConfig {
  readonly name: string;
  // 内外可设置属性
  label?: string;
  color?: string;
}

// 推送频谱线属性
export interface SetSeries extends SeriesConfig {
  pstype: PSType.Series;
}

// 设置频谱带宽规则
export interface SetSpectrumBandwidth extends SpectrumBandwidth {
  pstype: PSType.SpectrumBandwidth;
}

// 设置多段扫描规则
export interface SetSegments {
  pstype: PSType.Segments;
  event?: SegmentsEvent; // 事件类型:默认覆盖数据
  data?: SegmentsOriginal[]; // 多段扫描规则:设置数据才使用
  index?: number; // 段索引:需要外部聚焦某段才使用
}

// 设置天线因子
export interface SetAntennaFactor {
  pstype: PSType.AntennaFactor;
  data: Float32Array;
}

// 设置台站库信息
export interface SetStationInfo {
  pstype: PSType.StationInfo;
  data: StationInfoType[];
}

// 设置多路DCC信道
export interface SetChannels {
  pstype: PSType.Channels;
  event: MarkerEventType;
  frequency?: number;
}

// 设置Marker
export interface SetMarker {
  pstype: PSType.Marker;
  event: MarkerEventType;
  marker?: Partial<MarkerType>;
  frequencies?: number[]; // 设计规定:frequencies必须是频率数据
  silent?: boolean; // 是否通知外部onChange回调
}

// 额外的频谱数据
export interface SpectrumExtraData {
  [key: string]: Float32Array;
}
// 推送频谱数据
export interface PublishSpectrum {
  pstype: PSType.Spectrum;
  data?: Float32Array;
  // 一般仅在静态绘制
  maxData?: Float32Array;
  minData?: Float32Array;
  avgData?: Float32Array;
  backgroundNoiseData?: Float32Array;
  templateData?: Float32Array;
  extraData?: SpectrumExtraData;
  // 瀑布图可选参数
  timestamp?: string;
  // 扫描可选参数
  offset?: number; // 当前段的点偏移量
  segmentOffset?: number; // 当前段的索引
}

// 推送瀑布图数据
export interface PublishHeatmap {
  pstype: PSType.Heatmap;
  data: TimestampedFloat32Array[];
  timestamps: number[];
}

// 推送占用度数据
export interface PublishOccupancy {
  pstype: PSType.Occupancy;
  data: Float32Array;
  totalOccupancy: number;
}

// 推送电平流数据
export interface PublishLevelStream {
  pstype: PSType.LevelStream;
  data: number;
}

// 推送IQ数据
export interface PublishIQ {
  pstype: PSType.IQ;
  IData: number[];
  Qdata: number[];
}

// 推送Dial数据
export interface PublishDial {
  pstype?: PSType.Dial;
  series: Array<{
    value: number;
    color: string;
  }>;
  range?: number[]; // 概率范围 0-360
  yawAngle?: number; // 偏航角 0-360
  isNorthFacing?: boolean; // 是否朝北
}

// 推送Gauge数据
export interface PublishGauge {
  pstype?: PSType.Gauge;
  value: number; // 值
  limit: number; // 门限值
}

// 推送图形操作
export interface Reset {
  pstype: PSType.Reset;
}

// 推送渲染数据(内部)
export interface Render {
  pstype: PSType.Render;
  [key: string]: unknown;
}

export type PublishData =
  | SetSeries
  | SetSpectrumBandwidth
  | SetSegments
  | SetChannels
  | SetMarker
  | SetAntennaFactor
  | PublishSpectrum
  | PublishHeatmap
  | PublishOccupancy
  | PublishLevelStream
  | PublishIQ
  | PublishDial
  | PublishGauge
  | Reset
  | Render;