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

oibp-echarts

v0.0.1

Published

基于 echarts 做的图表组件

Downloads

3

Readme

介绍

本组件基于 echarts,用于展示相关数据,组件包括以下三个区域:

  1. 标题区域:支持设置 0-20 个长度的标题;
  2. 功能区域:目前只支持“截图”、“下钻”功能;
  3. 展示区域:用户可参照 echarts 的配置方式,展示不同的图表。

快速上手

1. 安装

npm i oibp-echarts

2. 在项目中引入

// main.js

import Vue from 'vue'

// 引入 OibpEcharts 组件
import OibpEcharts from 'oibp-echarts'

Vue.component('oibp-echarts', OibpEcharts)

3. 在项目中使用

<template>
  <div class="home">
    <div class="oibpEcharts-container">
      <oibp-echarts
        :title="title" :show-drill-down="showDrillDown" :show-screenshot="showScreenshot" :option="option"
        @drillDown="handleDrillDown"
      />
    </div>
  </div>
</template>

<script>
const ringOption = {
  title: {
    text: '环形图示例',
    left: 'center',
    textStyle: { fontSize: 14, color: '#333' }
  },
  tooltip: {
    trigger: 'item',
    formatter: '{a} <br/>{b}: {c} ({d}%)',
  },
  legend: {
    orient: 'horizontal',
    bottom: 0,
    data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'],
  },
  series: [
    {
      name: '访问来源',
      type: 'pie',
      center: ['50%', '50%'],
      radius: ['40%', '60%'],
      avoidLabelOverlap: false,
      itemStyle: { borderColor: '#fff', borderWidth: 1 },
      data: [
        { value: 335, name: '直接访问' },
        { value: 310, name: '邮件营销' },
        { value: 234, name: '联盟广告' },
        { value: 135, name: '视频广告' },
        { value: 1548, name: '搜索引擎' },
      ],
    }
  ]
}

export default {
  name: 'Home',
  data() {
    return {
      title: '标题',
      showScreenshot: true,
      showDrillDown: true,
      option: ringOption
    }
  },
  methods: {
    handleDrillDown() {
      console.log('下钻')
    }
  }
}
</script>

<style scoped>
.oibpEchartBox-container {
  display: flex;
  overflow-x: auto;
}
</style>

组件支持的属性及方法

| 属性/方法 | 描述 | 类型 | 默认值 | |-----------------|-----------------------------------------------------------------------|----------|--------| | title | 组件标题 | string | '' | | show-drill-down | 是否显示下钻功能 | boolean | true | | show-screenshot | 是否显示截图功能 | boolean | true | | option | Echarts 配置,请参考 Echarts 官网 | object | {} | | drillDown | 点击下钻的回调函数 | function | - |

注意事项

本组件使用了 flex 布局,建议包裹组件的容器也开启 flex 布局。如:


<template>
  <div class="home">
    <div class="oibpEcharts-container">
      <oibp-echarts />
    </div>
  </div>
</template>

<style scoped>
.oibpEcharts-container {
  display: flex;
}
</style>