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

hydro-graph

v1.0.42

Published

A Vue 3 component for hydrograph visualization using ECharts

Downloads

2,601

Readme

HydroGraph 图表组件

A Vue 3 component for hydrograph visualization using ECharts

安装

npm install hydro-graph

依赖

  • Vue 3
  • ECharts 5
  • Dayjs
  • Element Plus

使用方法

<template>
  <div style="width: 100%; height: 500px;">
    <HydroGraph
      :chart-option="chartOption"
      :legend-list="legendList"
      :width="'100%'"
      :height="'100%'"
    />
  </div>
</template>

<script setup>
import { ref } from 'vue'
import HydroGraph from 'hydro-graph'

const chartOption = ref({
  title: '水位流量过程线',
  grid: [{
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  }],
  xAxis: [{
    type: 'time'
  }],
  yAxis: [{
    name: '水位(m)',
    type: 'value'
  }, {
    name: '流量(m³/s)',
    type: 'value'
  }],
  series: [{
    name: '实测水位',
    type: 'line',
    yAxisIndex: 0,
    data: [["2024-01-01 00:00", 10.5], ["2024-01-01 01:00", 10.6], ["2024-01-01 02:00", 10.7]]
  }, {
    name: '实测流量',
    type: 'line',
    yAxisIndex: 1,
    data: [["2024-01-01 00:00", 100], ["2024-01-01 01:00", 110], ["2024-01-01 02:00", 120]]
  }]
})

const legendList = ref([{
  name: '实测水位',
  isSelected: true,
  color: '#304755'
}, {
  name: '实测流量',
  isSelected: true,
  color: '#197e2b'
}])
</script>

参数说明

chartOption

  • 类型: Object
  • 默认值: {}
  • 说明: ECharts 图表配置项,包含标题、网格、坐标轴、系列等配置

legendList

  • 类型: Array
  • 默认值: []
  • 说明: 图例列表,每个对象包含 name、isSelected、color 等属性

width

  • 类型: String
  • 默认值: '100%'
  • 说明: 图表宽度

height

  • 类型: String
  • 默认值: '100%'
  • 说明: 图表高度

backgroundColor

  • 类型: String
  • 默认值: '#fff'
  • 说明: 图表背景色

功能特性

  • 支持多种图表类型:折线图、柱状图、标记线等
  • 支持多级图例和图例全选/取消全选
  • 支持右键菜单:还原缩放、复制图片、导出图片
  • 支持水位-库容转换
  • 支持响应式调整
  • 支持图表交互:鼠标悬停提示、点击标记等

注意事项

  • 组件依赖 Element Plus 用于图例复选框和下拉菜单
  • 图表数据格式应符合 ECharts 要求,时间序列数据建议使用 [[时间, 值], [时间, 值]] 格式
  • 对于大型数据集,建议使用数据分页或虚拟滚动以提高性能

许可证

MIT