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

vue3-funnel-graph-js

v0.0.3

Published

Open-source wrapper for the Funnel graph drawing library for Vue.js 3.

Downloads

1,023

Readme

Vue3 Funnel Graph Js

Open-source wrapper for the Funnel graph drawing library for Vue.js 3.

  • SVG charts
  • Values, Labels, Percentages display
  • Two-dimensional graph support
    • Legend display
    • Detailed percentage breakdown on hover
  • (TODO:) Animated
  • Solid color and gradient fill
  • Horizontal and vertical charts

This is the Vue.js version of FunnelGraph.js, learn more about the library and see documentation here.

Demo

CodePen Demo

Installation

NPM

npm i vue3-funnel-graph-js

Usage

After installing, import the VueFunnelGraph component:

import "vue3-funnel-graph-js/dist/style.css";
import { VueFunnelGraph } from "vue3-funnel-graph-js";

You can now use the custom element:

<vue-funnel-graph
  :width="width"
  :height="height" 
  :labels="labels"
  :values="values" 
  :colors="colors" 
  :sub-labels="subLabels" 
  :direction="direction"
  :gradient-direction="gradientDirection"
  :animated="true"
  :display-percentage="true"
></vue-funnel-graph>

The values are passed to props:

export default {
  name: 'app',
  components: {
      VueFunnelGraph
  },
  data() {
      return {
          labels: ['Impressions', 'Add To Cart', 'Buy'],
          subLabels: ['Direct', 'Social Media', 'Ads'],
          values: [
          // with the given Labels and SubLabels here's what the values represent:
          // 
          // Direct, Social, Ads  
          //    |      |     |  
          //    v      v     v
              [3000, 2500, 6500], // Segments of "Impressions" from top to bottom
              [3000, 1700, 1000], // Segments of "Add To Cart"
              [600,  200,  130]   // Segments of "Buy"
          ],
          colors: [
              ['#FFB178', '#FF3C8E'], // color set for "Impressions" segment
              ['#A0BBFF', '#EC77FF'], // color set for "Add To Cart" segment
              ['#A0F9FF', '#7795FF']  // color set for "Buy" segment
          ],
          direction: 'horizontal',
          gradientDirection: 'horizontal',
          height: 300,
          width: 800
      };
  }
}

Options

| Option | Description | Type | Required | Options | Default | Example | |--------|-------------|------|----------|---------|---------|---------| | width | Width of the funnel graph | number | Yes | | 0 | 800 | | height | Height of the funnel graph | number | Yes | | 0 | 300 | | labels | Title of each data part | array | Yes | | | ['Impressions', 'Add To Cart', 'Buy'] | | values | Numbers that the funnel chart visualizes | array | Yes | | | [12000, 4700, 930] | | colors | Colors of the graph. If a string or array with one element passed it fills the graph with a solid color, if the array contains more than one element it fill the graph with a gradient. For two-dimensional charts and array of arrays shall be passed to fill each segment with a separate gradient. The array can contain arrays and strings mixed. If a there are more segments than colors provided, up to 10 extra segments will be filled with pre-defined solid colors | array⎮string | Yes | | | [12000, 4700, 930] | | subLabels (:sub-labels) | Title of each data segment | array | Yes for two-dimensional graphs | | | ['Direct', 'Social Media', 'Ads'] | | direction | Whether the chart visualization is displayed vertically or horizontally | string | No | 'vertical', 'horizontal' | 'horizontal' | | | gradientDirection (:gradient-direction) | Whether the gradient applied to the segments of the graph is displayed from top to bottom or from left to right | string | No | 'vertical', 'horizontal' | 'horizontal' | | animated | Whether any change in graph shape will be displayed with a smooth transition | boolean | No | true, false | true | false | | displayPercentage (:display-percentage) | Whether to display the automatically calculated percentage values below the labels | boolean | No | true, false | true | |