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

hexo-tag-echarts-chart

v1.0.3

Published

A hexo tag for inserting echarts chart in your blog

Downloads

7

Readme

hexo-tag-echarts-chart

npm dependencies version license

Introduction

本插件参考kchen0x/hexo-tag-echarts3

改动点:

1、因为有足迹图的需求所以添加了可以嵌入地图的功能

2、考虑到图表可能会调用外部函数,所以直接渲染源代码,不再仅仅处理option

Install

$ npm install hexo-tag-echarts-chart --save

Usage

{% echarts 400 '85%' %}
  // To do echarts sourceCode goes here
{% endecharts %}

400表示容器的高度 85%表示容器的相对宽度,可自行修改

Demo

sourceCode

{% echarts 500 '100%' %}
{% echarts 500 '100%' %}
var data = [
     {name: '成都', value: 200},{name: '西安', value: 200},
     {name: '青城山', value: 120},{name: '都江堰', value: 120},
     {name: '重庆', value: 200},{name: '长沙', value: 200},
     {name: '华山', value: 120},{name: '平遥', value: 120},
     {name: '灵石', value: 120},{name: '徐州', value: 120},
     {name: '宿迁', value: 120},{name: '上海', value: 200},
     {name: '南京', value: 200},{name: '滁州', value: 120},
     {name: '淮南', value: 120},{name: '蚌埠', value: 120},
     {name: '合肥', value: 200},{name: '中庙', value: 120},
     {name: '芜湖', value: 120},{name: '广州', value: 200},
     {name: '顺德', value: 120},
];
var geoCoordMap = {
    '成都':[104.06,30.67],'西安':[108.95,34.27],'青城山':[103.57,30.90],
    '都江堰':[103.61,30.98],'重庆':[106.56,29.56],'长沙':[113,28.21],
    '华山':[110.08,34.47],'平遥':[112.18,37.20],'灵石':[111.77,36.88],
    '徐州':[117.2,34.26],'宿迁':[118.3,33.96],'上海':[121.48,31.22],
    '南京':[118.78,32.04],'滁州':[118.31,32.31],'淮南':[117.01,32.64],
    '蚌埠':[117.37,32.92],'合肥':[117.27,31.86],'中庙':[117.47,31.59],
    '芜湖':[118.38,31.33],'广州':[113.23,23.16],'顺德':[113.28,22.81],
};

var convertData = function (data) {
  var res = [];
  for (var i = 0; i < data.length; i++) {
    var geoCoord = geoCoordMap[data[i].name];
    if (geoCoord) {
      res.push({
        name: data[i].name,
        value: geoCoord.concat(data[i].value)
      });
    }
  }
  return res;
};

option = {
  title : {
    text: '',
    subtext: '',
    left: 'center',
    top: 'top',
    textStyle: {
      color: '#fff'
    }
  },
  tooltip: {},
  backgroundColor: {
    type: 'linear',
    x: 0, y: 0, x2: 1, y2: 1,
    colorStops: [
      {
        offset: 0, color: '#F0F8FF' // 0% 处的颜色
      }, {
        offset: 1, color: '#091732' // 100% 处的颜色
      }
    ],
    globalCoord: false // 缺省为 false
  },
  geo: {
    map: 'china',
    show: true,
    roam: true,
    label: {
      emphasis: {
        show: false
      }
    },
    itemStyle: {
      normal: {
        areaColor: '#D3D3D3',
        borderColor: '#3B5077',
        // shadowColor: '#1773c3',
        // shadowBlur: 20
      },
      emphasis: {
        areaColor: '#3CB371',
      }
    }
  },
  series: [
    {
      name: '',
      type: 'effectScatter',
      coordinateSystem: 'geo',
      data: convertData(data),
      symbolSize: function (val) {
        return val[2] / 20;
      },
      showEffectOn: 'render',
      rippleEffect: {
        brushType: 'stroke'
      },
      hoverAnimation: true,
      label: {
          normal: {
            formatter: '{b}',
            position: 'right',
            show: false
          }
      },
      itemStyle: {
        normal: {
          color: '#ff4500',
          shadowBlur: 10,
          shadowColor: '#333'
        }
      },
      zlevel: 1
    }
  ]
};
{% endecharts %}

渲染图

足迹

More

关于本插件更多信息请戳这里