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

v2-charts

v0.1.21

Published

基于 Vue2 和 ECharts 封装的组件库

Readme

v2-charts

基于 Vue2 和 ECharts5 封装的组件。通过组件属性配置试,进一步的解决图表配置繁琐的问题,使代码看起来更加的清晰简洁。

ECharts 官网

简介

在线示例

组件介绍:

  • <charts/> 基础组件,主要用于生成布局和图表。
  • <charts-legend/> 图例组件,主要用于生成图表的图例, 配置项
  • <charts-series/> 图表类型组件,主要用于生成各种不同的图表,配置项
  • <charts-title/> 标题组件,主要用于生成图表标题,配置项
  • <charts-tooltip/> 提示框组件,主要用于生成图表的提示框,配置项
  • <charts-x-axis/> x轴组件,主要用于生成直角坐标系图表的x轴,配置项
  • <charts-y-axis/> y轴组件,主要用于生成直角坐标系图表的y轴,配置项

安装

npm i --save v2-charts

yarn i --save v2-charts

使用

  1. 引用
import V2Charts from 'v2-charts'

Vue.use(V2Charts)
  1. 示例
<template>
  <charts width="500px" height="500px">
    <charts-title text="这是一个饼图示例" left="center"/>
    <charts-legend orient="vertical" left="left"/>
    <charts-tooltip trigger="item" />
    <charts-series
       type="pie"
       name="访问来源"
       radius="50%"
       :data="pieData"
       :label="{
          formatter (item) {
            return `${item.name}\n ${item.value}`
          }
       }"
    />
  </charts>
</template>

<script>
export default {
  name: "charts-demo",
  data() {
    return {
      pieData: [
        { value: 1048, name: "搜索引擎" },
        { value: 735, name: "直接访问" },
        { value: 580, name: "邮件营销" },
        { value: 484, name: "联盟广告" },
        { value: 300, name: "视频广告" },
      ]
    }
  }
}
</script>

image-20210816161312070

属性

Charts 组件Props

| 参数 | 说明 | 类型 | 默认值 | | ---------------- | ------------------------------------------------------------ | ------- | --------- | | width | 图表整体宽度 | String | 300px | | height | 图表整体高度 | String | 300px | | loading | 加载状态 | Boolean | false | | loadingText | 加载状态文本 | String | 加载中... | | empty | 空状态 | Boolean | false | | emptyText | 空状态文本 | String | 暂无数据 | | autoSelect | 图表项自动选中 | Boolean | false | | chartExpandAttrs | 图表拓展属性,请参考官网 配置项 | Object | 无 | | preventRender | 自定义渲染 | Boolean | false |

Charts 组件 Event

| 名称 | 说明 | 回调参数 | | ---------------- | ------------------------------------------------------------ | --------- | | on-render | 获取echarts实例对象 | charts |