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

vue-xchart

v1.1.0

Published

解决显示console.log问题

Downloads

5

Readme

使用说明

安装

npm install vue-xchart echarts -S

在vue中使用

1.在main.js中引入

// main.js
import xchart from 'vue-xchart'
import echarts from 'echarts'
import 'vue-xchart/lib/x-chart.css'
import Theme from 'vue-xchart/theme/index'
Theme(echarts)
Vue.prototype.$echarts = echarts
Vue.use(xchart)
  1. 使用对应的模块 (柱状图为例)
//使用组件
<template>
   <x-bar
   :chartData="barData"
   ></x-bar>  //组件使用是x-xxx
</template>

<script>
export default {
  data(){
    return{
      barData:{
        columns: ['time', 'water', 'gas'],
        rows: [
          {time: '1-1', water: '20', gas: '40'},
          {time: '1-2', water: '20', gas: '40'},
          {time: '1-3', water: '20', gas: '40'},
          {time: '1-4', water: '20', gas: '40'}
        ],
      }
    }
  }
}
</script>
  1. 数据传递

    | 属性 | 数据类型 | 默认传递项 | 说明 | | :--: | :--: | :--: | :--: | | chartWidth | String | 100% | 图形宽度 | | chartHeight | String | 400px | 图形高度 | | chartData | Object | { columns: [], rows: [] }) | 传递数据 | | chartData/rows | Array | [] | 画图数据(包含 x 轴线显示数据) | | chartData/columns | Array | [] | 需要画图的选项(第一个数据为 x 轴显示数据) | | settings | Object | {} | 特殊配置项数据(一些特殊的配置项,方便修改) | | extend | Object | {} | 修改配置项(根据 echats 官网的 option 配置,修改画图的配置) |

settings 配置说明

1.柱状图

| 配置项 | 数据类型 | 代码演示 | 说明 | | :--: | :--: | :--: | :--: | | theme | String | 'drak' | 更新主题 | | legendName | Object | { water: '水'} | 修改 legend 显示的样式 | | myAxis | Object | 传递以下三个值 | 设置 y 轴的配置 | | axisSite | Object | { right: ['fire'] } | 设置双 y 轴 | | axisType | Array | ['normal', '%'] | 设置数据的属性,normal:默认,K:千,%:百分比 | | axisName | Array | ['值', '比率'] | 设置 y 轴的名称 | | label | Object | {show: true,position: 'top'} | 设置数据是否显示(默认不显示)和显示的位置 | | switchAxis | Object | {axis: 'yAxis'} | 切换数据的显示轴线位置(参数为:yAxis 或 xAxis) | | stack | Object | {总和: ['water', 'gas']} | 选择合并递增显示的数据 | | xAxisType | String | 'value' | 设置 x 轴的 type 值 |

2.折线图

| 配置项 | 数据类型 | 代码演示 | 说明 | | :--: | :--: | :--: | :--: | | theme | String | 'drak' | 更新主题 | | legendName | Object | { water: '水'} | 修改 legend 显示的样式 | | myAxis | Object | 传递以下三个值 | 设置 y 轴的配置 | | axisSite | Object | { right: ['fire'] } | 设置双 y 轴 | | axisType | Array | ['normal', '%'] | 设置数据的属性,normal:默认,K:千,%:百分比 | | axisName | Array | ['值', '比率'] | 设置 y 轴的名称 | | label | Object | {show: true,position: 'top'} | 设置数据是否显示(默认不显示)和显示的位置 | | stack | Object | {总和: ['water', 'gas']} | 选择合并递增显示的数据 | | xAxisType | String | 'value' | 设置 x 轴的 type 值 | | area| Boolean| true| 是否显示堆叠面积(默认不显示)| | smooth | Boolean或String或Number | true | 设置弯曲值(范围:0-1) true为0.5 |

3.圆饼图

| 配置项 | 数据类型 | 代码演示 | 说明 | | :--: | :--: | :--: | :--: | | theme | String | 'drak' | 更新主题 | | name | String | 'name' | 设置圆环图的名称 | | selected | String,Boolean | 'single' | 选中模式(默认为false,其他值:true,'single','multiple') | | radius | String,Array | '50%' | 设置半径(数组情况下可以设置圆环图) | | center | Array | [ '50%','50%' ] | 设置图形位置(相对于x,y轴的位置) | | roseType | String,Boolean | 'radius' | 是否展示成南丁格尔图(默认是false,其他值'radius','area') | | more | Array | [ [ '1-1','1-2' ] , [ '1-1','1-2','1-3' ] ] | 多圆饼图时设置 |