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

energy-flow-chart

v2.0.8

Published

能源流向图

Downloads

7

Readme

简介

energy-flow-chart,能源流线图。

快速开始

npm i energy-flow-chart -S

快速应用

全局注入
import EnergyFlowChart from 'energy-flow-chart'
app.use(EnergyFlowChart);
局部注入
import { EnergyFlowChart } from 'energy-flow-chart';
export default {
  name: 'App',
  components: {
    EnergyFlowChart
  }
}

主参数

参数 | 类型 | 必填项 | 默认值 | 参考值 | 说明 ---- | ----- | ------ | ------ | ------ | :------ v-model | Boolean | √ | false | | 是否默认展开。 data | Array | √ | | | 能源流向图数据,树形结构。 opts | Object | × | { label: 'label', id: 'id', children: 'children', iconUrl: 'iconUrl', dataVal1: 'dataVal1', dataVal2: 'dataVal2' } | | 参数。 iconUrlTypes | Array | × | ['1', '2', '3', '4', '5', '0'] | | 字典值对应关系: 1电 2水 3油 4煤 5气 0其他。用于展示不同的设备图片。暂时只提供以上6种设备图片。 bgColor | String | × | #07364B | | 背景颜色。 lineColor | Array | × | [ '#FFCC44' ] | | 流向箭头不同层级不同颜色,索引0为1级颜色以此类推,未设置则使用默认颜色。例如:['#014EB5', '#A800FF']。

opts参数

参数 | 类型 | 必填项 | 默认值 | 说明 ---- | ----- | ------ | ------ | :------ label | String | × | label | 设备名称。 id | String | × | id | 设备唯一标识。 children | String | × | children | 下级数据。 imgUrl | String | × | imgUrl | 图片。 iconUrl | String | × | iconUrl | 内置图片,imgUrl不存在时匹配iconUrlTypes使用。 dataVal1 | String | × | dataVal1 | 数据1。 dataVal2 | String | × | dataVal2 | 数据2。

方法

参数 | 类型| 解释 ---- | ----- | :------ @energyClick | 点击回调 | (obj) => {}。

示例

常规
<EnergyFlowChart
  v-if="energyFlowData.length > 0"
  v-model="develop"
  :data="energyFlowData"
  :opts="{
    id: 'deviceId',
    iconUrl: 'energyType',
    dataVal1: 'eval',
    dataVal2: 'power',
  }"
  :lineColor="['red']"
  @energyClick="energyClick">
</EnergyFlowChart>
export default {
  name: 'App',
  data() {
    return {
      develop: true,
      energyFlowData: [],
    };
  },
  mounted() {
    this.setRemUnit()
    const energyFlowData = [{
      "energyType": "2",
      "eval": "0.00kWh",
      "imgUrl": "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2024%2F0409%2F2fc95034j00sbnoh00013d000j600j6c.jpg&thumbnail=660x2147483647&quality=80&type=jpg",
      "children": [{
        "energyType": "2",
        "eval": "0.00kWh",
        "label": "设备1",
        "power": "555.00KW",
        "deviceId": 52
      }, {
        "energyType": "2",
        "eval": "0.00kWh",
        "children": [{
          "energyType": "2",
          "eval": "0.00kWh",
          "children": [{
            "energyType": "2",
            "eval": "0.00kWh",
            "label": "设备4",
            "power": "/KW",
            "deviceId": 55
          }, {
            "energyType": "2",
            "eval": "0.00kWh",
            "label": "设备5",
            "power": "/KW",
            "deviceId": 56
          }],
          "label": "设备6",
          "power": "/KW",
          "deviceId": 54
        }],
        "label": "设备2",
        "power": "0.00KW",
        "deviceId": 53
      }],
      "label": "设备3",
      "power": "900.00KW",
      "deviceId": 47
    }];
    this.energyFlowData = energyFlowData;
  },
  methods: {
    toggleExpandAll() {
      this.develop = !this.develop;
    },
    // 回调,点击节点的回调,node为节点对象
    energyClick(node) {
      console.log(node)
    },
  }
}