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

shinetek-legend

v1.0.2

Published

图例组件。用于绘制各种专题图图例或色标卡等

Readme

Legend

图例组件。用于绘制各种专题图图例或色标卡等

Demo

legend = new ShinetekLegend(element, legendDoc, option)
legend.render()

legendDoc

// 色块图例
let blockDoc = [
  {
    list: [
      {
        label: '省界',
        color: '#ffc107',
        style: 'line'
      },
      {
        label: '市界',
        color: '#ee1122',
        style: 'line'
      },
      {
        label: '陆地',
        color: '#11ff22',
        style: 'plane'
      },
      {
        label: '水体',
        color: '#1122ff',
        style: 'plane'
      }
    ],
    title: 'test1',
    type: 'block'
  },
  {
    list: [
      {
        label: '沙尘或烟尘',
        color: '#EF4087',
        style: 'plane'
      },
      {
        label: '卷云',
        color: '#000000',
        style: 'plane'
      },
      {
        label: '薄、高的冷云或冰',
        color: '#8C0000',
        style: 'plane'
      },
      {
        label: '薄的中层云',
        color: '#ACA300',
        style: 'plane'
      },
      {
        label: '沙漠上的卷云',
        color: '#00A000',
        style: 'plane'
      },
      {
        label: '沙漠',
        color: '#A2F3FF',
        style: 'plane'
      },
      {
        label: '低空湿空气(~700hpa)',
        color: '#2C71CC',
        style: 'plane'
      },
      {
        label: '低空干燥空气',
        color: '#A086FB',
        style: 'plane'
      },
      {
        label: '测试',
        color: '#113399',
        style: 'plane'
      }
    ],
    title: 'test2',
    type: 'block'
  }
]

// 线性渐变图例
let linearDoc = [
  {
    list: [
      {
        label: '省界',
        color: '#ffc107',
        style: 'line'
      },
      {
        label: '市界',
        color: '#ee1122',
        style: 'line'
      },
      {
        label: '陆地',
        color: '#11ff22',
        style: 'plane'
      },
      {
        label: '水体',
        color: '#1122ff',
        style: 'plane'
      }
    ],
    title: 'test1',
    type: 'block'
  },
  {
    list: [
      {
        value: [0, 5, 10, 15, 20, 25, 30],
        label: ['0', '5', '10', '15', '20', '25', '30'],
        color: ['#FFFCE8', '#004AFF', '#00E8FF', '#00FF38', '#B2FF00', '#FF9C00', '#FF1300']
      }
    ],
    title: 'test2',
    type: 'linear'
  }
]

// 比例尺对象
let scaleDoc = [
  {
    list: [
      {
        value: 0.0025
      }
    ],
    type: 'scale',
    title: 'test'
  }
]

option


// 以下参数为默认值

var options = {
  width: '100%', // 'auto'  or '380'
  model: 'canvas', // 'html' or canvas
  groupSpacing: 15, // 组间距
  itemAlign: 'horizontal', // 布局 vertical
  itemWidth: 55, // 块宽
  itemHeight: 15, // 块高
  itemSpacing: 5, // 块间距
  itemFontSize: '12px',
  itemFontColor: '#000000',
  itemFontFamily: 'Arial',
  itemBorderWidth: 1, // 块边框宽度
  itemBorderColor: '#000000', // 块边框
  itemTextAlign: 'center', // 文字对齐方式 start end
  titleFontSize: '14px',
  titleFontColor: '#000000',
  titleFontFamily: 'Arial',
  titleTextAlign: 'start',
  rowSpacing: 6, // 图例的行间距
  textSpacing: 3, // 文字与色块的间距
  titleSpacing: 5, // 标题与内容的间距
  textRowSpacing: 1, // 文字的行间距
  showItemLabel: true // 是否显示块的标签
}

备注

目前 显示隐藏块的标签 支持 linear like-linear block scale